@webex/contact-center 0.0.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -0
- package/__mocks__/workerMock.js +15 -0
- package/babel.config.js +15 -0
- package/dist/cc.js +1416 -0
- package/dist/cc.js.map +1 -0
- package/dist/config.js +72 -0
- package/dist/config.js.map +1 -0
- package/dist/constants.js +58 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.js +142 -0
- package/dist/index.js.map +1 -0
- package/dist/logger-proxy.js +115 -0
- package/dist/logger-proxy.js.map +1 -0
- package/dist/metrics/MetricsManager.js +474 -0
- package/dist/metrics/MetricsManager.js.map +1 -0
- package/dist/metrics/behavioral-events.js +322 -0
- package/dist/metrics/behavioral-events.js.map +1 -0
- package/dist/metrics/constants.js +134 -0
- package/dist/metrics/constants.js.map +1 -0
- package/dist/services/WebCallingService.js +323 -0
- package/dist/services/WebCallingService.js.map +1 -0
- package/dist/services/agent/index.js +177 -0
- package/dist/services/agent/index.js.map +1 -0
- package/dist/services/agent/types.js +137 -0
- package/dist/services/agent/types.js.map +1 -0
- package/dist/services/config/Util.js +203 -0
- package/dist/services/config/Util.js.map +1 -0
- package/dist/services/config/constants.js +221 -0
- package/dist/services/config/constants.js.map +1 -0
- package/dist/services/config/index.js +607 -0
- package/dist/services/config/index.js.map +1 -0
- package/dist/services/config/types.js +334 -0
- package/dist/services/config/types.js.map +1 -0
- package/dist/services/constants.js +117 -0
- package/dist/services/constants.js.map +1 -0
- package/dist/services/core/Err.js +43 -0
- package/dist/services/core/Err.js.map +1 -0
- package/dist/services/core/GlobalTypes.js +6 -0
- package/dist/services/core/GlobalTypes.js.map +1 -0
- package/dist/services/core/Utils.js +126 -0
- package/dist/services/core/Utils.js.map +1 -0
- package/dist/services/core/WebexRequest.js +96 -0
- package/dist/services/core/WebexRequest.js.map +1 -0
- package/dist/services/core/aqm-reqs.js +246 -0
- package/dist/services/core/aqm-reqs.js.map +1 -0
- package/dist/services/core/constants.js +109 -0
- package/dist/services/core/constants.js.map +1 -0
- package/dist/services/core/types.js +6 -0
- package/dist/services/core/types.js.map +1 -0
- package/dist/services/core/websocket/WebSocketManager.js +187 -0
- package/dist/services/core/websocket/WebSocketManager.js.map +1 -0
- package/dist/services/core/websocket/connection-service.js +111 -0
- package/dist/services/core/websocket/connection-service.js.map +1 -0
- package/dist/services/core/websocket/keepalive.worker.js +94 -0
- package/dist/services/core/websocket/keepalive.worker.js.map +1 -0
- package/dist/services/core/websocket/types.js +6 -0
- package/dist/services/core/websocket/types.js.map +1 -0
- package/dist/services/index.js +78 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/task/AutoWrapup.js +88 -0
- package/dist/services/task/AutoWrapup.js.map +1 -0
- package/dist/services/task/TaskManager.js +369 -0
- package/dist/services/task/TaskManager.js.map +1 -0
- package/dist/services/task/constants.js +58 -0
- package/dist/services/task/constants.js.map +1 -0
- package/dist/services/task/contact.js +464 -0
- package/dist/services/task/contact.js.map +1 -0
- package/dist/services/task/dialer.js +60 -0
- package/dist/services/task/dialer.js.map +1 -0
- package/dist/services/task/index.js +1188 -0
- package/dist/services/task/index.js.map +1 -0
- package/dist/services/task/types.js +214 -0
- package/dist/services/task/types.js.map +1 -0
- package/dist/types/cc.d.ts +676 -0
- package/dist/types/config.d.ts +66 -0
- package/dist/types/constants.d.ts +45 -0
- package/dist/types/index.d.ts +178 -0
- package/dist/types/logger-proxy.d.ts +71 -0
- package/dist/types/metrics/MetricsManager.d.ts +223 -0
- package/dist/types/metrics/behavioral-events.d.ts +29 -0
- package/dist/types/metrics/constants.d.ts +127 -0
- package/dist/types/services/WebCallingService.d.ts +1 -0
- package/dist/types/services/agent/index.d.ts +46 -0
- package/dist/types/services/agent/types.d.ts +413 -0
- package/dist/types/services/config/Util.d.ts +19 -0
- package/dist/types/services/config/constants.d.ts +203 -0
- package/dist/types/services/config/index.d.ts +171 -0
- package/dist/types/services/config/types.d.ts +1113 -0
- package/dist/types/services/constants.d.ts +97 -0
- package/dist/types/services/core/Err.d.ts +119 -0
- package/dist/types/services/core/GlobalTypes.d.ts +33 -0
- package/dist/types/services/core/Utils.d.ts +36 -0
- package/dist/types/services/core/WebexRequest.d.ts +22 -0
- package/dist/types/services/core/aqm-reqs.d.ts +16 -0
- package/dist/types/services/core/constants.d.ts +85 -0
- package/dist/types/services/core/types.d.ts +47 -0
- package/dist/types/services/core/websocket/WebSocketManager.d.ts +34 -0
- package/dist/types/services/core/websocket/connection-service.d.ts +27 -0
- package/dist/types/services/core/websocket/keepalive.worker.d.ts +2 -0
- package/dist/types/services/core/websocket/types.d.ts +37 -0
- package/dist/types/services/index.d.ts +52 -0
- package/dist/types/services/task/AutoWrapup.d.ts +40 -0
- package/dist/types/services/task/TaskManager.d.ts +1 -0
- package/dist/types/services/task/constants.d.ts +46 -0
- package/dist/types/services/task/contact.d.ts +59 -0
- package/dist/types/services/task/dialer.d.ts +28 -0
- package/dist/types/services/task/index.d.ts +569 -0
- package/dist/types/services/task/types.d.ts +1041 -0
- package/dist/types/types.d.ts +452 -0
- package/dist/types/webex-config.d.ts +53 -0
- package/dist/types/webex.d.ts +7 -0
- package/dist/types.js +292 -0
- package/dist/types.js.map +1 -0
- package/dist/webex-config.js +60 -0
- package/dist/webex-config.js.map +1 -0
- package/dist/webex.js +99 -0
- package/dist/webex.js.map +1 -0
- package/jest.config.js +45 -0
- package/package.json +83 -0
- package/src/cc.ts +1618 -0
- package/src/config.ts +65 -0
- package/src/constants.ts +51 -0
- package/src/index.ts +220 -0
- package/src/logger-proxy.ts +110 -0
- package/src/metrics/MetricsManager.ts +512 -0
- package/src/metrics/behavioral-events.ts +332 -0
- package/src/metrics/constants.ts +135 -0
- package/src/services/WebCallingService.ts +351 -0
- package/src/services/agent/index.ts +149 -0
- package/src/services/agent/types.ts +440 -0
- package/src/services/config/Util.ts +261 -0
- package/src/services/config/constants.ts +249 -0
- package/src/services/config/index.ts +743 -0
- package/src/services/config/types.ts +1117 -0
- package/src/services/constants.ts +111 -0
- package/src/services/core/Err.ts +126 -0
- package/src/services/core/GlobalTypes.ts +34 -0
- package/src/services/core/Utils.ts +132 -0
- package/src/services/core/WebexRequest.ts +103 -0
- package/src/services/core/aqm-reqs.ts +272 -0
- package/src/services/core/constants.ts +106 -0
- package/src/services/core/types.ts +48 -0
- package/src/services/core/websocket/WebSocketManager.ts +196 -0
- package/src/services/core/websocket/connection-service.ts +142 -0
- package/src/services/core/websocket/keepalive.worker.js +88 -0
- package/src/services/core/websocket/types.ts +40 -0
- package/src/services/index.ts +71 -0
- package/src/services/task/AutoWrapup.ts +86 -0
- package/src/services/task/TaskManager.ts +420 -0
- package/src/services/task/constants.ts +52 -0
- package/src/services/task/contact.ts +429 -0
- package/src/services/task/dialer.ts +52 -0
- package/src/services/task/index.ts +1375 -0
- package/src/services/task/types.ts +1113 -0
- package/src/types.ts +639 -0
- package/src/webex-config.ts +54 -0
- package/src/webex.js +96 -0
- package/test/unit/spec/cc.ts +1985 -0
- package/test/unit/spec/metrics/MetricsManager.ts +491 -0
- package/test/unit/spec/metrics/behavioral-events.ts +102 -0
- package/test/unit/spec/services/WebCallingService.ts +416 -0
- package/test/unit/spec/services/agent/index.ts +65 -0
- package/test/unit/spec/services/config/index.ts +1035 -0
- package/test/unit/spec/services/core/Utils.ts +279 -0
- package/test/unit/spec/services/core/WebexRequest.ts +144 -0
- package/test/unit/spec/services/core/aqm-reqs.ts +570 -0
- package/test/unit/spec/services/core/websocket/WebSocketManager.ts +378 -0
- package/test/unit/spec/services/core/websocket/connection-service.ts +178 -0
- package/test/unit/spec/services/task/TaskManager.ts +1351 -0
- package/test/unit/spec/services/task/contact.ts +204 -0
- package/test/unit/spec/services/task/dialer.ts +157 -0
- package/test/unit/spec/services/task/index.ts +1474 -0
- package/tsconfig.json +6 -0
- package/typedoc.json +37 -0
- package/typedoc.md +240 -0
- package/umd/contact-center.min.js +3 -0
- package/umd/contact-center.min.js.map +1 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! Webex JS SDK v3.8.1-next.55 */
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Webex=t():e.Webex=t()}(self,(()=>(()=>{var __webpack_modules__={50176:(e,t,r)=>{r(79169),r(63090),e.exports=r(63093).Array.from},70964:(e,t,r)=>{r(48901),e.exports=r(63093).Array.isArray},76216:(e,t,r)=>{r(78175),e.exports=r(63093).Date.now},23565:(e,t,r)=>{var n=r(63093),i=n.JSON||(n.JSON={stringify:JSON.stringify});e.exports=function(e){return i.stringify.apply(i,arguments)}},94175:(e,t,r)=>{r(56536),r(79169),r(39361),r(99228),r(90401),r(28878),r(33012),e.exports=r(63093).Map},68080:(e,t,r)=>{r(57044),e.exports=r(63093).Number.isNaN},68207:(e,t,r)=>{r(82464),e.exports=r(63093).Object.assign},25380:(e,t,r)=>{r(97660);var n=r(63093).Object;e.exports=function(e,t){return n.create(e,t)}},99848:(e,t,r)=>{r(84521);var n=r(63093).Object;e.exports=function(e,t){return n.defineProperties(e,t)}},82624:(e,t,r)=>{r(15356);var n=r(63093).Object;e.exports=function(e,t,r){return n.defineProperty(e,t,r)}},88058:(e,t,r)=>{r(39827),e.exports=r(63093).Object.entries},36759:(e,t,r)=>{r(8638),e.exports=r(63093).Object.freeze},44221:(e,t,r)=>{r(52812);var n=r(63093).Object;e.exports=function(e,t){return n.getOwnPropertyDescriptor(e,t)}},22991:(e,t,r)=>{r(40342),e.exports=r(63093).Object.getOwnPropertyDescriptors},72818:(e,t,r)=>{r(15898),e.exports=r(63093).Object.getOwnPropertySymbols},87595:(e,t,r)=>{r(92810),e.exports=r(63093).Object.getPrototypeOf},15297:(e,t,r)=>{r(5338),e.exports=r(63093).Object.keys},21900:(e,t,r)=>{r(99269),e.exports=r(63093).Object.setPrototypeOf},42837:(e,t,r)=>{r(73625),e.exports=r(63093).Object.values},16111:(e,t,r)=>{r(68785),e.exports=r(63093).parseInt},89448:(e,t,r)=>{r(56536),r(79169),r(39361),r(63723),r(36556),r(8421),e.exports=r(63093).Promise},58564:(e,t,r)=>{r(41896),e.exports=r(63093).Reflect.apply},98401:(e,t,r)=>{r(90634),e.exports=r(63093).Reflect.construct},53268:(e,t,r)=>{r(51244),e.exports=r(63093).Reflect.defineProperty},76409:(e,t,r)=>{r(16877),e.exports=r(63093).Reflect.deleteProperty},46383:(e,t,r)=>{r(39181),e.exports=r(63093).Reflect.getOwnPropertyDescriptor},42437:(e,t,r)=>{r(69805),e.exports=r(63093).Reflect.get},98828:(e,t,r)=>{r(56536),r(79169),r(39361),r(6348),r(30093),r(42235),r(68572),e.exports=r(63093).Set},71922:(e,t,r)=>{r(15898),r(56536),r(52145),r(74775),e.exports=r(63093).Symbol},72974:(e,t,r)=>{r(79169),r(39361),e.exports=r(33485).f("iterator")},90446:(e,t,r)=>{e.exports=r(33485).f("toPrimitive")},69488:(e,t,r)=>{r(56536),r(39361),r(11610),r(91877),r(20206),e.exports=r(63093).WeakMap},18679:e=>{e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},86687:e=>{e.exports=function(){}},8003:e=>{e.exports=function(e,t,r,n){if(!(e instanceof t)||void 0!==n&&n in e)throw TypeError(r+": incorrect invocation!");return e}},49226:(e,t,r)=>{var n=r(44425);e.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},51705:(e,t,r)=>{var n=r(26510);e.exports=function(e,t){var r=[];return n(e,!1,r.push,r,t),r}},43206:(e,t,r)=>{var n=r(6303),i=r(45321),o=r(10139);e.exports=function(e){return function(t,r,a){var s,c=n(t),u=i(c.length),l=o(a,u);if(e&&r!=r){for(;u>l;)if((s=c[l++])!=s)return!0}else for(;u>l;l++)if((e||l in c)&&c[l]===r)return e||l||0;return!e&&-1}}},18485:(e,t,r)=>{var n=r(31133),i=r(65474),o=r(54922),a=r(45321),s=r(243);e.exports=function(e,t){var r=1==e,c=2==e,u=3==e,l=4==e,d=6==e,f=5==e||d,h=t||s;return function(t,s,p){for(var v,m,g=o(t),y=i(g),b=n(s,p,3),E=a(y.length),S=0,_=r?h(t,E):c?h(t,0):void 0;E>S;S++)if((f||S in y)&&(m=b(v=y[S],S,g),e))if(r)_[S]=m;else if(m)switch(e){case 3:return!0;case 5:return v;case 6:return S;case 2:_.push(v)}else if(l)return!1;return d?-1:u||l?l:_}}},33723:(e,t,r)=>{var n=r(44425),i=r(35730),o=r(23032)("species");e.exports=function(e){var t;return i(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!i(t.prototype)||(t=void 0),n(t)&&null===(t=t[o])&&(t=void 0)),void 0===t?Array:t}},243:(e,t,r)=>{var n=r(33723);e.exports=function(e,t){return new(n(e))(t)}},98659:(e,t,r)=>{"use strict";var n=r(18679),i=r(44425),o=r(44990),a=[].slice,s={};e.exports=Function.bind||function(e){var t=n(this),r=a.call(arguments,1),c=function(){var n=r.concat(a.call(arguments));return this instanceof c?function(e,t,r){if(!(t in s)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";s[t]=Function("F,a","return new F("+n.join(",")+")")}return s[t](e,r)}(t,n.length,n):o(t,n,e)};return i(t.prototype)&&(c.prototype=t.prototype),c}},85158:(e,t,r)=>{var n=r(47489),i=r(23032)("toStringTag"),o="Arguments"==n(function(){return arguments}());e.exports=function(e){var t,r,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?r:o?n(t):"Object"==(a=n(t))&&"function"==typeof t.callee?"Arguments":a}},47489:e=>{var t={}.toString;e.exports=function(e){return t.call(e).slice(8,-1)}},21706:(e,t,r)=>{"use strict";var n=r(56007).f,i=r(69270),o=r(561),a=r(31133),s=r(8003),c=r(26510),u=r(60354),l=r(85490),d=r(7183),f=r(97305),h=r(57010).fastKey,p=r(10069),v=f?"_s":"size",m=function(e,t){var r,n=h(t);if("F"!==n)return e._i[n];for(r=e._f;r;r=r.n)if(r.k==t)return r};e.exports={getConstructor:function(e,t,r,u){var l=e((function(e,n){s(e,l,t,"_i"),e._t=t,e._i=i(null),e._f=void 0,e._l=void 0,e[v]=0,null!=n&&c(n,r,e[u],e)}));return o(l.prototype,{clear:function(){for(var e=p(this,t),r=e._i,n=e._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete r[n.i];e._f=e._l=void 0,e[v]=0},delete:function(e){var r=p(this,t),n=m(r,e);if(n){var i=n.n,o=n.p;delete r._i[n.i],n.r=!0,o&&(o.n=i),i&&(i.p=o),r._f==n&&(r._f=i),r._l==n&&(r._l=o),r[v]--}return!!n},forEach:function(e){p(this,t);for(var r,n=a(e,arguments.length>1?arguments[1]:void 0,3);r=r?r.n:this._f;)for(n(r.v,r.k,this);r&&r.r;)r=r.p},has:function(e){return!!m(p(this,t),e)}}),f&&n(l.prototype,"size",{get:function(){return p(this,t)[v]}}),l},def:function(e,t,r){var n,i,o=m(e,t);return o?o.v=r:(e._l=o={i:i=h(t,!0),k:t,v:r,p:n=e._l,n:void 0,r:!1},e._f||(e._f=o),n&&(n.n=o),e[v]++,"F"!==i&&(e._i[i]=o)),e},getEntry:m,setStrong:function(e,t,r){u(e,t,(function(e,r){this._t=p(e,t),this._k=r,this._l=void 0}),(function(){for(var e=this,t=e._k,r=e._l;r&&r.r;)r=r.p;return e._t&&(e._l=r=r?r.n:e._t._f)?l(0,"keys"==t?r.k:"values"==t?r.v:[r.k,r.v]):(e._t=void 0,l(1))}),r?"entries":"values",!r,!0),d(t)}}},80540:(e,t,r)=>{var n=r(85158),i=r(51705);e.exports=function(e){return function(){if(n(this)!=e)throw TypeError(e+"#toJSON isn't generic");return i(this)}}},77760:(e,t,r)=>{"use strict";var n=r(561),i=r(57010).getWeak,o=r(49226),a=r(44425),s=r(8003),c=r(26510),u=r(18485),l=r(3920),d=r(10069),f=u(5),h=u(6),p=0,v=function(e){return e._l||(e._l=new m)},m=function(){this.a=[]},g=function(e,t){return f(e.a,(function(e){return e[0]===t}))};m.prototype={get:function(e){var t=g(this,e);if(t)return t[1]},has:function(e){return!!g(this,e)},set:function(e,t){var r=g(this,e);r?r[1]=t:this.a.push([e,t])},delete:function(e){var t=h(this.a,(function(t){return t[0]===e}));return~t&&this.a.splice(t,1),!!~t}},e.exports={getConstructor:function(e,t,r,o){var u=e((function(e,n){s(e,u,t,"_i"),e._t=t,e._i=p++,e._l=void 0,null!=n&&c(n,r,e[o],e)}));return n(u.prototype,{delete:function(e){if(!a(e))return!1;var r=i(e);return!0===r?v(d(this,t)).delete(e):r&&l(r,this._i)&&delete r[this._i]},has:function(e){if(!a(e))return!1;var r=i(e);return!0===r?v(d(this,t)).has(e):r&&l(r,this._i)}}),u},def:function(e,t,r){var n=i(o(t),!0);return!0===n?v(e).set(t,r):n[e._i]=r,e},ufstore:v}},66924:(e,t,r)=>{"use strict";var n=r(3220),i=r(14518),o=r(57010),a=r(84930),s=r(44379),c=r(561),u=r(26510),l=r(8003),d=r(44425),f=r(8182),h=r(56007).f,p=r(18485)(0),v=r(97305);e.exports=function(e,t,r,m,g,y){var b=n[e],E=b,S=g?"set":"add",_=E&&E.prototype,w={};return v&&"function"==typeof E&&(y||_.forEach&&!a((function(){(new E).entries().next()})))?(E=t((function(t,r){l(t,E,e,"_c"),t._c=new b,null!=r&&u(r,g,t[S],t)})),p("add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON".split(","),(function(e){var t="add"==e||"set"==e;!(e in _)||y&&"clear"==e||s(E.prototype,e,(function(r,n){if(l(this,E,e),!t&&y&&!d(r))return"get"==e&&void 0;var i=this._c[e](0===r?0:r,n);return t?this:i}))})),y||h(E.prototype,"size",{get:function(){return this._c.size}})):(E=m.getConstructor(t,e,g,S),c(E.prototype,r),o.NEED=!0),f(E,e),w[e]=E,i(i.G+i.W+i.F,w),y||m.setStrong(E,e,g),E}},63093:e=>{var t=e.exports={version:"2.6.12"};"number"==typeof __e&&(__e=t)},10101:(e,t,r)=>{"use strict";var n=r(56007),i=r(35831);e.exports=function(e,t,r){t in e?n.f(e,t,i(0,r)):e[t]=r}},31133:(e,t,r)=>{var n=r(18679);e.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}},59359:e=>{e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},97305:(e,t,r)=>{e.exports=!r(84930)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},3299:(e,t,r)=>{var n=r(44425),i=r(3220).document,o=n(i)&&n(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},75834:e=>{e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},94331:(e,t,r)=>{var n=r(31304),i=r(18382),o=r(55066);e.exports=function(e){var t=n(e),r=i.f;if(r)for(var a,s=r(e),c=o.f,u=0;s.length>u;)c.call(e,a=s[u++])&&t.push(a);return t}},14518:(e,t,r)=>{var n=r(3220),i=r(63093),o=r(31133),a=r(44379),s=r(3920),c="prototype",u=function(e,t,r){var l,d,f,h=e&u.F,p=e&u.G,v=e&u.S,m=e&u.P,g=e&u.B,y=e&u.W,b=p?i:i[t]||(i[t]={}),E=b[c],S=p?n:v?n[t]:(n[t]||{})[c];for(l in p&&(r=t),r)(d=!h&&S&&void 0!==S[l])&&s(b,l)||(f=d?S[l]:r[l],b[l]=p&&"function"!=typeof S[l]?r[l]:g&&d?o(f,n):y&&S[l]==f?function(e){var t=function(t,r,n){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,r)}return new e(t,r,n)}return e.apply(this,arguments)};return t[c]=e[c],t}(f):m&&"function"==typeof f?o(Function.call,f):f,m&&((b.virtual||(b.virtual={}))[l]=f,e&u.R&&E&&!E[l]&&a(E,l,f)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,e.exports=u},84930:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},26510:(e,t,r)=>{var n=r(31133),i=r(12441),o=r(92566),a=r(49226),s=r(45321),c=r(25816),u={},l={},d=e.exports=function(e,t,r,d,f){var h,p,v,m,g=f?function(){return e}:c(e),y=n(r,d,t?2:1),b=0;if("function"!=typeof g)throw TypeError(e+" is not iterable!");if(o(g)){for(h=s(e.length);h>b;b++)if((m=t?y(a(p=e[b])[0],p[1]):y(e[b]))===u||m===l)return m}else for(v=g.call(e);!(p=v.next()).done;)if((m=i(v,y,p.value,t))===u||m===l)return m};d.BREAK=u,d.RETURN=l},3220:e=>{var t=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t)},3920:e=>{var t={}.hasOwnProperty;e.exports=function(e,r){return t.call(e,r)}},44379:(e,t,r)=>{var n=r(56007),i=r(35831);e.exports=r(97305)?function(e,t,r){return n.f(e,t,i(1,r))}:function(e,t,r){return e[t]=r,e}},588:(e,t,r)=>{var n=r(3220).document;e.exports=n&&n.documentElement},17209:(e,t,r)=>{e.exports=!r(97305)&&!r(84930)((function(){return 7!=Object.defineProperty(r(3299)("div"),"a",{get:function(){return 7}}).a}))},44990:e=>{e.exports=function(e,t,r){var n=void 0===r;switch(t.length){case 0:return n?e():e.call(r);case 1:return n?e(t[0]):e.call(r,t[0]);case 2:return n?e(t[0],t[1]):e.call(r,t[0],t[1]);case 3:return n?e(t[0],t[1],t[2]):e.call(r,t[0],t[1],t[2]);case 4:return n?e(t[0],t[1],t[2],t[3]):e.call(r,t[0],t[1],t[2],t[3])}return e.apply(r,t)}},65474:(e,t,r)=>{var n=r(47489);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==n(e)?e.split(""):Object(e)}},92566:(e,t,r)=>{var n=r(64502),i=r(23032)("iterator"),o=Array.prototype;e.exports=function(e){return void 0!==e&&(n.Array===e||o[i]===e)}},35730:(e,t,r)=>{var n=r(47489);e.exports=Array.isArray||function(e){return"Array"==n(e)}},44425:e=>{e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},12441:(e,t,r)=>{var n=r(49226);e.exports=function(e,t,r,i){try{return i?t(n(r)[0],r[1]):t(r)}catch(t){var o=e.return;throw void 0!==o&&n(o.call(e)),t}}},95415:(e,t,r)=>{"use strict";var n=r(69270),i=r(35831),o=r(8182),a={};r(44379)(a,r(23032)("iterator"),(function(){return this})),e.exports=function(e,t,r){e.prototype=n(a,{next:i(1,r)}),o(e,t+" Iterator")}},60354:(e,t,r)=>{"use strict";var n=r(34436),i=r(14518),o=r(29763),a=r(44379),s=r(64502),c=r(95415),u=r(8182),l=r(65194),d=r(23032)("iterator"),f=!([].keys&&"next"in[].keys()),h="keys",p="values",v=function(){return this};e.exports=function(e,t,r,m,g,y,b){c(r,t,m);var E,S,_,w=function(e){if(!f&&e in x)return x[e];switch(e){case h:case p:return function(){return new r(this,e)}}return function(){return new r(this,e)}},R=t+" Iterator",C=g==p,T=!1,x=e.prototype,k=x[d]||x["@@iterator"]||g&&x[g],I=k||w(g),A=g?C?w("entries"):I:void 0,O="Array"==t&&x.entries||k;if(O&&(_=l(O.call(new e)))!==Object.prototype&&_.next&&(u(_,R,!0),n||"function"==typeof _[d]||a(_,d,v)),C&&k&&k.name!==p&&(T=!0,I=function(){return k.call(this)}),n&&!b||!f&&!T&&x[d]||a(x,d,I),s[t]=I,s[R]=v,g)if(E={values:C?I:w(p),keys:y?I:w(h),entries:A},b)for(S in E)S in x||o(x,S,E[S]);else i(i.P+i.F*(f||T),t,E);return E}},98661:(e,t,r)=>{var n=r(23032)("iterator"),i=!1;try{var o=[7][n]();o.return=function(){i=!0},Array.from(o,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!i)return!1;var r=!1;try{var o=[7],a=o[n]();a.next=function(){return{done:r=!0}},o[n]=function(){return a},e(o)}catch(e){}return r}},85490:e=>{e.exports=function(e,t){return{value:t,done:!!e}}},64502:e=>{e.exports={}},34436:e=>{e.exports=!0},57010:(e,t,r)=>{var n=r(46918)("meta"),i=r(44425),o=r(3920),a=r(56007).f,s=0,c=Object.isExtensible||function(){return!0},u=!r(84930)((function(){return c(Object.preventExtensions({}))})),l=function(e){a(e,n,{value:{i:"O"+ ++s,w:{}}})},d=e.exports={KEY:n,NEED:!1,fastKey:function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,n)){if(!c(e))return"F";if(!t)return"E";l(e)}return e[n].i},getWeak:function(e,t){if(!o(e,n)){if(!c(e))return!0;if(!t)return!1;l(e)}return e[n].w},onFreeze:function(e){return u&&d.NEED&&c(e)&&!o(e,n)&&l(e),e}}},9734:(e,t,r)=>{var n=r(3220),i=r(26998).set,o=n.MutationObserver||n.WebKitMutationObserver,a=n.process,s=n.Promise,c="process"==r(47489)(a);e.exports=function(){var e,t,r,u=function(){var n,i;for(c&&(n=a.domain)&&n.exit();e;){i=e.fn,e=e.next;try{i()}catch(n){throw e?r():t=void 0,n}}t=void 0,n&&n.enter()};if(c)r=function(){a.nextTick(u)};else if(!o||n.navigator&&n.navigator.standalone)if(s&&s.resolve){var l=s.resolve(void 0);r=function(){l.then(u)}}else r=function(){i.call(n,u)};else{var d=!0,f=document.createTextNode("");new o(u).observe(f,{characterData:!0}),r=function(){f.data=d=!d}}return function(n){var i={fn:n,next:void 0};t&&(t.next=i),e||(e=i,r()),t=i}}},36253:(e,t,r)=>{"use strict";var n=r(18679);function i(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n})),this.resolve=n(t),this.reject=n(r)}e.exports.f=function(e){return new i(e)}},47382:(e,t,r)=>{"use strict";var n=r(97305),i=r(31304),o=r(18382),a=r(55066),s=r(54922),c=r(65474),u=Object.assign;e.exports=!u||r(84930)((function(){var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=u({},e)[r]||Object.keys(u({},t)).join("")!=n}))?function(e,t){for(var r=s(e),u=arguments.length,l=1,d=o.f,f=a.f;u>l;)for(var h,p=c(arguments[l++]),v=d?i(p).concat(d(p)):i(p),m=v.length,g=0;m>g;)h=v[g++],n&&!f.call(p,h)||(r[h]=p[h]);return r}:u},69270:(e,t,r)=>{var n=r(49226),i=r(16287),o=r(75834),a=r(72596)("IE_PROTO"),s=function(){},c="prototype",u=function(){var e,t=r(3299)("iframe"),n=o.length;for(t.style.display="none",r(588).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),u=e.F;n--;)delete u[c][o[n]];return u()};e.exports=Object.create||function(e,t){var r;return null!==e?(s[c]=n(e),r=new s,s[c]=null,r[a]=e):r=u(),void 0===t?r:i(r,t)}},56007:(e,t,r)=>{var n=r(49226),i=r(17209),o=r(32548),a=Object.defineProperty;t.f=r(97305)?Object.defineProperty:function(e,t,r){if(n(e),t=o(t,!0),n(r),i)try{return a(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e}},16287:(e,t,r)=>{var n=r(56007),i=r(49226),o=r(31304);e.exports=r(97305)?Object.defineProperties:function(e,t){i(e);for(var r,a=o(t),s=a.length,c=0;s>c;)n.f(e,r=a[c++],t[r]);return e}},30826:(e,t,r)=>{var n=r(55066),i=r(35831),o=r(6303),a=r(32548),s=r(3920),c=r(17209),u=Object.getOwnPropertyDescriptor;t.f=r(97305)?u:function(e,t){if(e=o(e),t=a(t,!0),c)try{return u(e,t)}catch(e){}if(s(e,t))return i(!n.f.call(e,t),e[t])}},23208:(e,t,r)=>{var n=r(6303),i=r(95733).f,o={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return a&&"[object Window]"==o.call(e)?function(e){try{return i(e)}catch(e){return a.slice()}}(e):i(n(e))}},95733:(e,t,r)=>{var n=r(26567),i=r(75834).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return n(e,i)}},18382:(e,t)=>{t.f=Object.getOwnPropertySymbols},65194:(e,t,r)=>{var n=r(3920),i=r(54922),o=r(72596)("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=i(e),n(e,o)?e[o]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},26567:(e,t,r)=>{var n=r(3920),i=r(6303),o=r(43206)(!1),a=r(72596)("IE_PROTO");e.exports=function(e,t){var r,s=i(e),c=0,u=[];for(r in s)r!=a&&n(s,r)&&u.push(r);for(;t.length>c;)n(s,r=t[c++])&&(~o(u,r)||u.push(r));return u}},31304:(e,t,r)=>{var n=r(26567),i=r(75834);e.exports=Object.keys||function(e){return n(e,i)}},55066:(e,t)=>{t.f={}.propertyIsEnumerable},70874:(e,t,r)=>{var n=r(14518),i=r(63093),o=r(84930);e.exports=function(e,t){var r=(i.Object||{})[e]||Object[e],a={};a[e]=t(r),n(n.S+n.F*o((function(){r(1)})),"Object",a)}},30572:(e,t,r)=>{var n=r(97305),i=r(31304),o=r(6303),a=r(55066).f;e.exports=function(e){return function(t){for(var r,s=o(t),c=i(s),u=c.length,l=0,d=[];u>l;)r=c[l++],n&&!a.call(s,r)||d.push(e?[r,s[r]]:s[r]);return d}}},74737:(e,t,r)=>{var n=r(95733),i=r(18382),o=r(49226),a=r(3220).Reflect;e.exports=a&&a.ownKeys||function(e){var t=n.f(o(e)),r=i.f;return r?t.concat(r(e)):t}},24049:(e,t,r)=>{var n=r(3220).parseInt,i=r(28685).trim,o=r(58917),a=/^[-+]?0[xX]/;e.exports=8!==n(o+"08")||22!==n(o+"0x16")?function(e,t){var r=i(String(e),3);return n(r,t>>>0||(a.test(r)?16:10))}:n},19934:e=>{e.exports=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}}},77116:(e,t,r)=>{var n=r(49226),i=r(44425),o=r(36253);e.exports=function(e,t){if(n(e),i(t)&&t.constructor===e)return t;var r=o.f(e);return(0,r.resolve)(t),r.promise}},35831:e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},561:(e,t,r)=>{var n=r(44379);e.exports=function(e,t,r){for(var i in t)r&&e[i]?e[i]=t[i]:n(e,i,t[i]);return e}},29763:(e,t,r)=>{e.exports=r(44379)},74573:(e,t,r)=>{"use strict";var n=r(14518),i=r(18679),o=r(31133),a=r(26510);e.exports=function(e){n(n.S,e,{from:function(e){var t,r,n,s,c=arguments[1];return i(this),(t=void 0!==c)&&i(c),null==e?new this:(r=[],t?(n=0,s=o(c,arguments[2],2),a(e,!1,(function(e){r.push(s(e,n++))}))):a(e,!1,r.push,r),new this(r))}})}},72758:(e,t,r)=>{"use strict";var n=r(14518);e.exports=function(e){n(n.S,e,{of:function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];return new this(t)}})}},96573:(e,t,r)=>{var n=r(44425),i=r(49226),o=function(e,t){if(i(e),!n(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,n){try{(n=r(31133)(Function.call,r(30826).f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,r){return o(e,r),t?e.__proto__=r:n(e,r),e}}({},!1):void 0),check:o}},7183:(e,t,r)=>{"use strict";var n=r(3220),i=r(63093),o=r(56007),a=r(97305),s=r(23032)("species");e.exports=function(e){var t="function"==typeof i[e]?i[e]:n[e];a&&t&&!t[s]&&o.f(t,s,{configurable:!0,get:function(){return this}})}},8182:(e,t,r)=>{var n=r(56007).f,i=r(3920),o=r(23032)("toStringTag");e.exports=function(e,t,r){e&&!i(e=r?e:e.prototype,o)&&n(e,o,{configurable:!0,value:t})}},72596:(e,t,r)=>{var n=r(5628)("keys"),i=r(46918);e.exports=function(e){return n[e]||(n[e]=i(e))}},5628:(e,t,r)=>{var n=r(63093),i=r(3220),o="__core-js_shared__",a=i[o]||(i[o]={});(e.exports=function(e,t){return a[e]||(a[e]=void 0!==t?t:{})})("versions",[]).push({version:n.version,mode:r(34436)?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},312:(e,t,r)=>{var n=r(49226),i=r(18679),o=r(23032)("species");e.exports=function(e,t){var r,a=n(e).constructor;return void 0===a||null==(r=n(a)[o])?t:i(r)}},87268:(e,t,r)=>{var n=r(72579),i=r(59359);e.exports=function(e){return function(t,r){var o,a,s=String(i(t)),c=n(r),u=s.length;return c<0||c>=u?e?"":void 0:(o=s.charCodeAt(c))<55296||o>56319||c+1===u||(a=s.charCodeAt(c+1))<56320||a>57343?e?s.charAt(c):o:e?s.slice(c,c+2):a-56320+(o-55296<<10)+65536}}},28685:(e,t,r)=>{var n=r(14518),i=r(59359),o=r(84930),a=r(58917),s="["+a+"]",c=RegExp("^"+s+s+"*"),u=RegExp(s+s+"*$"),l=function(e,t,r){var i={},s=o((function(){return!!a[e]()||"
"!="
"[e]()})),c=i[e]=s?t(d):a[e];r&&(i[r]=c),n(n.P+n.F*s,"String",i)},d=l.trim=function(e,t){return e=String(i(e)),1&t&&(e=e.replace(c,"")),2&t&&(e=e.replace(u,"")),e};e.exports=l},58917:e=>{e.exports="\t\n\v\f\r \u2028\u2029\ufeff"},26998:(e,t,r)=>{var n,i,o,a=r(31133),s=r(44990),c=r(588),u=r(3299),l=r(3220),d=l.process,f=l.setImmediate,h=l.clearImmediate,p=l.MessageChannel,v=l.Dispatch,m=0,g={},y="onreadystatechange",b=function(){var e=+this;if(g.hasOwnProperty(e)){var t=g[e];delete g[e],t()}},E=function(e){b.call(e.data)};f&&h||(f=function(e){for(var t=[],r=1;arguments.length>r;)t.push(arguments[r++]);return g[++m]=function(){s("function"==typeof e?e:Function(e),t)},n(m),m},h=function(e){delete g[e]},"process"==r(47489)(d)?n=function(e){d.nextTick(a(b,e,1))}:v&&v.now?n=function(e){v.now(a(b,e,1))}:p?(o=(i=new p).port2,i.port1.onmessage=E,n=a(o.postMessage,o,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScripts?(n=function(e){l.postMessage(e+"","*")},l.addEventListener("message",E,!1)):n=y in u("script")?function(e){c.appendChild(u("script"))[y]=function(){c.removeChild(this),b.call(e)}}:function(e){setTimeout(a(b,e,1),0)}),e.exports={set:f,clear:h}},10139:(e,t,r)=>{var n=r(72579),i=Math.max,o=Math.min;e.exports=function(e,t){return(e=n(e))<0?i(e+t,0):o(e,t)}},72579:e=>{var t=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:t)(e)}},6303:(e,t,r)=>{var n=r(65474),i=r(59359);e.exports=function(e){return n(i(e))}},45321:(e,t,r)=>{var n=r(72579),i=Math.min;e.exports=function(e){return e>0?i(n(e),9007199254740991):0}},54922:(e,t,r)=>{var n=r(59359);e.exports=function(e){return Object(n(e))}},32548:(e,t,r)=>{var n=r(44425);e.exports=function(e,t){if(!n(e))return e;var r,i;if(t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;if("function"==typeof(r=e.valueOf)&&!n(i=r.call(e)))return i;if(!t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},46918:e=>{var t=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++t+r).toString(36))}},58411:(e,t,r)=>{var n=r(3220).navigator;e.exports=n&&n.userAgent||""},10069:(e,t,r)=>{var n=r(44425);e.exports=function(e,t){if(!n(e)||e._t!==t)throw TypeError("Incompatible receiver, "+t+" required!");return e}},10305:(e,t,r)=>{var n=r(3220),i=r(63093),o=r(34436),a=r(33485),s=r(56007).f;e.exports=function(e){var t=i.Symbol||(i.Symbol=o?{}:n.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:a.f(e)})}},33485:(e,t,r)=>{t.f=r(23032)},23032:(e,t,r)=>{var n=r(5628)("wks"),i=r(46918),o=r(3220).Symbol,a="function"==typeof o;(e.exports=function(e){return n[e]||(n[e]=a&&o[e]||(a?o:i)("Symbol."+e))}).store=n},25816:(e,t,r)=>{var n=r(85158),i=r(23032)("iterator"),o=r(64502);e.exports=r(63093).getIteratorMethod=function(e){if(null!=e)return e[i]||e["@@iterator"]||o[n(e)]}},63090:(e,t,r)=>{"use strict";var n=r(31133),i=r(14518),o=r(54922),a=r(12441),s=r(92566),c=r(45321),u=r(10101),l=r(25816);i(i.S+i.F*!r(98661)((function(e){Array.from(e)})),"Array",{from:function(e){var t,r,i,d,f=o(e),h="function"==typeof this?this:Array,p=arguments.length,v=p>1?arguments[1]:void 0,m=void 0!==v,g=0,y=l(f);if(m&&(v=n(v,p>2?arguments[2]:void 0,2)),null==y||h==Array&&s(y))for(r=new h(t=c(f.length));t>g;g++)u(r,g,m?v(f[g],g):f[g]);else for(d=y.call(f),r=new h;!(i=d.next()).done;g++)u(r,g,m?a(d,v,[i.value,g],!0):i.value);return r.length=g,r}})},48901:(e,t,r)=>{var n=r(14518);n(n.S,"Array",{isArray:r(35730)})},74296:(e,t,r)=>{"use strict";var n=r(86687),i=r(85490),o=r(64502),a=r(6303);e.exports=r(60354)(Array,"Array",(function(e,t){this._t=a(e),this._i=0,this._k=t}),(function(){var e=this._t,t=this._k,r=this._i++;return!e||r>=e.length?(this._t=void 0,i(1)):i(0,"keys"==t?r:"values"==t?e[r]:[r,e[r]])}),"values"),o.Arguments=o.Array,n("keys"),n("values"),n("entries")},78175:(e,t,r)=>{var n=r(14518);n(n.S,"Date",{now:function(){return(new Date).getTime()}})},99228:(e,t,r)=>{"use strict";var n=r(21706),i=r(10069),o="Map";e.exports=r(66924)(o,(function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}}),{get:function(e){var t=n.getEntry(i(this,o),e);return t&&t.v},set:function(e,t){return n.def(i(this,o),0===e?0:e,t)}},n,!0)},57044:(e,t,r)=>{var n=r(14518);n(n.S,"Number",{isNaN:function(e){return e!=e}})},82464:(e,t,r)=>{var n=r(14518);n(n.S+n.F,"Object",{assign:r(47382)})},97660:(e,t,r)=>{var n=r(14518);n(n.S,"Object",{create:r(69270)})},84521:(e,t,r)=>{var n=r(14518);n(n.S+n.F*!r(97305),"Object",{defineProperties:r(16287)})},15356:(e,t,r)=>{var n=r(14518);n(n.S+n.F*!r(97305),"Object",{defineProperty:r(56007).f})},8638:(e,t,r)=>{var n=r(44425),i=r(57010).onFreeze;r(70874)("freeze",(function(e){return function(t){return e&&n(t)?e(i(t)):t}}))},52812:(e,t,r)=>{var n=r(6303),i=r(30826).f;r(70874)("getOwnPropertyDescriptor",(function(){return function(e,t){return i(n(e),t)}}))},92810:(e,t,r)=>{var n=r(54922),i=r(65194);r(70874)("getPrototypeOf",(function(){return function(e){return i(n(e))}}))},5338:(e,t,r)=>{var n=r(54922),i=r(31304);r(70874)("keys",(function(){return function(e){return i(n(e))}}))},99269:(e,t,r)=>{var n=r(14518);n(n.S,"Object",{setPrototypeOf:r(96573).set})},56536:()=>{},68785:(e,t,r)=>{var n=r(14518),i=r(24049);n(n.G+n.F*(parseInt!=i),{parseInt:i})},63723:(e,t,r)=>{"use strict";var n,i,o,a,s=r(34436),c=r(3220),u=r(31133),l=r(85158),d=r(14518),f=r(44425),h=r(18679),p=r(8003),v=r(26510),m=r(312),g=r(26998).set,y=r(9734)(),b=r(36253),E=r(19934),S=r(58411),_=r(77116),w="Promise",R=c.TypeError,C=c.process,T=C&&C.versions,x=T&&T.v8||"",k=c[w],I="process"==l(C),A=function(){},O=i=b.f,L=!!function(){try{var e=k.resolve(1),t=(e.constructor={})[r(23032)("species")]=function(e){e(A,A)};return(I||"function"==typeof PromiseRejectionEvent)&&e.then(A)instanceof t&&0!==x.indexOf("6.6")&&-1===S.indexOf("Chrome/66")}catch(e){}}(),M=function(e){var t;return!(!f(e)||"function"!=typeof(t=e.then))&&t},N=function(e,t){if(!e._n){e._n=!0;var r=e._c;y((function(){for(var n=e._v,i=1==e._s,o=0,a=function(t){var r,o,a,s=i?t.ok:t.fail,c=t.resolve,u=t.reject,l=t.domain;try{s?(i||(2==e._h&&F(e),e._h=1),!0===s?r=n:(l&&l.enter(),r=s(n),l&&(l.exit(),a=!0)),r===t.promise?u(R("Promise-chain cycle")):(o=M(r))?o.call(r,c,u):c(r)):u(n)}catch(e){l&&!a&&l.exit(),u(e)}};r.length>o;)a(r[o++]);e._c=[],e._n=!1,t&&!e._h&&P(e)}))}},P=function(e){g.call(c,(function(){var t,r,n,i=e._v,o=D(e);if(o&&(t=E((function(){I?C.emit("unhandledRejection",i,e):(r=c.onunhandledrejection)?r({promise:e,reason:i}):(n=c.console)&&n.error&&n.error("Unhandled promise rejection",i)})),e._h=I||D(e)?2:1),e._a=void 0,o&&t.e)throw t.v}))},D=function(e){return 1!==e._h&&0===(e._a||e._c).length},F=function(e){g.call(c,(function(){var t;I?C.emit("rejectionHandled",e):(t=c.onrejectionhandled)&&t({promise:e,reason:e._v})}))},U=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),N(t,!0))},j=function(e){var t,r=this;if(!r._d){r._d=!0,r=r._w||r;try{if(r===e)throw R("Promise can't be resolved itself");(t=M(e))?y((function(){var n={_w:r,_d:!1};try{t.call(e,u(j,n,1),u(U,n,1))}catch(e){U.call(n,e)}})):(r._v=e,r._s=1,N(r,!1))}catch(e){U.call({_w:r,_d:!1},e)}}};L||(k=function(e){p(this,k,w,"_h"),h(e),n.call(this);try{e(u(j,this,1),u(U,this,1))}catch(e){U.call(this,e)}},(n=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=r(561)(k.prototype,{then:function(e,t){var r=O(m(this,k));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=I?C.domain:void 0,this._c.push(r),this._a&&this._a.push(r),this._s&&N(this,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),o=function(){var e=new n;this.promise=e,this.resolve=u(j,e,1),this.reject=u(U,e,1)},b.f=O=function(e){return e===k||e===a?new o(e):i(e)}),d(d.G+d.W+d.F*!L,{Promise:k}),r(8182)(k,w),r(7183)(w),a=r(63093)[w],d(d.S+d.F*!L,w,{reject:function(e){var t=O(this);return(0,t.reject)(e),t.promise}}),d(d.S+d.F*(s||!L),w,{resolve:function(e){return _(s&&this===a?k:this,e)}}),d(d.S+d.F*!(L&&r(98661)((function(e){k.all(e).catch(A)}))),w,{all:function(e){var t=this,r=O(t),n=r.resolve,i=r.reject,o=E((function(){var r=[],o=0,a=1;v(e,!1,(function(e){var s=o++,c=!1;r.push(void 0),a++,t.resolve(e).then((function(e){c||(c=!0,r[s]=e,--a||n(r))}),i)})),--a||n(r)}));return o.e&&i(o.v),r.promise},race:function(e){var t=this,r=O(t),n=r.reject,i=E((function(){v(e,!1,(function(e){t.resolve(e).then(r.resolve,n)}))}));return i.e&&n(i.v),r.promise}})},41896:(e,t,r)=>{var n=r(14518),i=r(18679),o=r(49226),a=(r(3220).Reflect||{}).apply,s=Function.apply;n(n.S+n.F*!r(84930)((function(){a((function(){}))})),"Reflect",{apply:function(e,t,r){var n=i(e),c=o(r);return a?a(n,t,c):s.call(n,t,c)}})},90634:(e,t,r)=>{var n=r(14518),i=r(69270),o=r(18679),a=r(49226),s=r(44425),c=r(84930),u=r(98659),l=(r(3220).Reflect||{}).construct,d=c((function(){function e(){}return!(l((function(){}),[],e)instanceof e)})),f=!c((function(){l((function(){}))}));n(n.S+n.F*(d||f),"Reflect",{construct:function(e,t){o(e),a(t);var r=arguments.length<3?e:o(arguments[2]);if(f&&!d)return l(e,t,r);if(e==r){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var n=[null];return n.push.apply(n,t),new(u.apply(e,n))}var c=r.prototype,h=i(s(c)?c:Object.prototype),p=Function.apply.call(e,h,t);return s(p)?p:h}})},51244:(e,t,r)=>{var n=r(56007),i=r(14518),o=r(49226),a=r(32548);i(i.S+i.F*r(84930)((function(){Reflect.defineProperty(n.f({},1,{value:1}),1,{value:2})})),"Reflect",{defineProperty:function(e,t,r){o(e),t=a(t,!0),o(r);try{return n.f(e,t,r),!0}catch(e){return!1}}})},16877:(e,t,r)=>{var n=r(14518),i=r(30826).f,o=r(49226);n(n.S,"Reflect",{deleteProperty:function(e,t){var r=i(o(e),t);return!(r&&!r.configurable)&&delete e[t]}})},39181:(e,t,r)=>{var n=r(30826),i=r(14518),o=r(49226);i(i.S,"Reflect",{getOwnPropertyDescriptor:function(e,t){return n.f(o(e),t)}})},69805:(e,t,r)=>{var n=r(30826),i=r(65194),o=r(3920),a=r(14518),s=r(44425),c=r(49226);a(a.S,"Reflect",{get:function e(t,r){var a,u,l=arguments.length<3?t:arguments[2];return c(t)===l?t[r]:(a=n.f(t,r))?o(a,"value")?a.value:void 0!==a.get?a.get.call(l):void 0:s(u=i(t))?e(u,r,l):void 0}})},6348:(e,t,r)=>{"use strict";var n=r(21706),i=r(10069);e.exports=r(66924)("Set",(function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}}),{add:function(e){return n.def(i(this,"Set"),e=0===e?0:e,e)}},n)},79169:(e,t,r)=>{"use strict";var n=r(87268)(!0);r(60354)(String,"String",(function(e){this._t=String(e),this._i=0}),(function(){var e,t=this._t,r=this._i;return r>=t.length?{value:void 0,done:!0}:(e=n(t,r),this._i+=e.length,{value:e,done:!1})}))},15898:(e,t,r)=>{"use strict";var n=r(3220),i=r(3920),o=r(97305),a=r(14518),s=r(29763),c=r(57010).KEY,u=r(84930),l=r(5628),d=r(8182),f=r(46918),h=r(23032),p=r(33485),v=r(10305),m=r(94331),g=r(35730),y=r(49226),b=r(44425),E=r(54922),S=r(6303),_=r(32548),w=r(35831),R=r(69270),C=r(23208),T=r(30826),x=r(18382),k=r(56007),I=r(31304),A=T.f,O=k.f,L=C.f,M=n.Symbol,N=n.JSON,P=N&&N.stringify,D="prototype",F=h("_hidden"),U=h("toPrimitive"),j={}.propertyIsEnumerable,B=l("symbol-registry"),q=l("symbols"),V=l("op-symbols"),G=Object[D],W="function"==typeof M&&!!x.f,z=n.QObject,H=!z||!z[D]||!z[D].findChild,K=o&&u((function(){return 7!=R(O({},"a",{get:function(){return O(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=A(G,t);n&&delete G[t],O(e,t,r),n&&e!==G&&O(G,t,n)}:O,$=function(e){var t=q[e]=R(M[D]);return t._k=e,t},J=W&&"symbol"==typeof M.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof M},Y=function(e,t,r){return e===G&&Y(V,t,r),y(e),t=_(t,!0),y(r),i(q,t)?(r.enumerable?(i(e,F)&&e[F][t]&&(e[F][t]=!1),r=R(r,{enumerable:w(0,!1)})):(i(e,F)||O(e,F,w(1,{})),e[F][t]=!0),K(e,t,r)):O(e,t,r)},Q=function(e,t){y(e);for(var r,n=m(t=S(t)),i=0,o=n.length;o>i;)Y(e,r=n[i++],t[r]);return e},X=function(e){var t=j.call(this,e=_(e,!0));return!(this===G&&i(q,e)&&!i(V,e))&&(!(t||!i(this,e)||!i(q,e)||i(this,F)&&this[F][e])||t)},Z=function(e,t){if(e=S(e),t=_(t,!0),e!==G||!i(q,t)||i(V,t)){var r=A(e,t);return!r||!i(q,t)||i(e,F)&&e[F][t]||(r.enumerable=!0),r}},ee=function(e){for(var t,r=L(S(e)),n=[],o=0;r.length>o;)i(q,t=r[o++])||t==F||t==c||n.push(t);return n},te=function(e){for(var t,r=e===G,n=L(r?V:S(e)),o=[],a=0;n.length>a;)!i(q,t=n[a++])||r&&!i(G,t)||o.push(q[t]);return o};W||(s((M=function(){if(this instanceof M)throw TypeError("Symbol is not a constructor!");var e=f(arguments.length>0?arguments[0]:void 0),t=function(r){this===G&&t.call(V,r),i(this,F)&&i(this[F],e)&&(this[F][e]=!1),K(this,e,w(1,r))};return o&&H&&K(G,e,{configurable:!0,set:t}),$(e)})[D],"toString",(function(){return this._k})),T.f=Z,k.f=Y,r(95733).f=C.f=ee,r(55066).f=X,x.f=te,o&&!r(34436)&&s(G,"propertyIsEnumerable",X,!0),p.f=function(e){return $(h(e))}),a(a.G+a.W+a.F*!W,{Symbol:M});for(var re="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ne=0;re.length>ne;)h(re[ne++]);for(var ie=I(h.store),oe=0;ie.length>oe;)v(ie[oe++]);a(a.S+a.F*!W,"Symbol",{for:function(e){return i(B,e+="")?B[e]:B[e]=M(e)},keyFor:function(e){if(!J(e))throw TypeError(e+" is not a symbol!");for(var t in B)if(B[t]===e)return t},useSetter:function(){H=!0},useSimple:function(){H=!1}}),a(a.S+a.F*!W,"Object",{create:function(e,t){return void 0===t?R(e):Q(R(e),t)},defineProperty:Y,defineProperties:Q,getOwnPropertyDescriptor:Z,getOwnPropertyNames:ee,getOwnPropertySymbols:te});var ae=u((function(){x.f(1)}));a(a.S+a.F*ae,"Object",{getOwnPropertySymbols:function(e){return x.f(E(e))}}),N&&a(a.S+a.F*(!W||u((function(){var e=M();return"[null]"!=P([e])||"{}"!=P({a:e})||"{}"!=P(Object(e))}))),"JSON",{stringify:function(e){for(var t,r,n=[e],i=1;arguments.length>i;)n.push(arguments[i++]);if(r=t=n[1],(b(t)||void 0!==e)&&!J(e))return g(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!J(t))return t}),n[1]=t,P.apply(N,n)}}),M[D][U]||r(44379)(M[D],U,M[D].valueOf),d(M,"Symbol"),d(Math,"Math",!0),d(n.JSON,"JSON",!0)},11610:(e,t,r)=>{"use strict";var n,i=r(3220),o=r(18485)(0),a=r(29763),s=r(57010),c=r(47382),u=r(77760),l=r(44425),d=r(10069),f=r(10069),h=!i.ActiveXObject&&"ActiveXObject"in i,p="WeakMap",v=s.getWeak,m=Object.isExtensible,g=u.ufstore,y=function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},b={get:function(e){if(l(e)){var t=v(e);return!0===t?g(d(this,p)).get(e):t?t[this._i]:void 0}},set:function(e,t){return u.def(d(this,p),e,t)}},E=e.exports=r(66924)(p,y,b,u,!0,!0);f&&h&&(c((n=u.getConstructor(y,p)).prototype,b),s.NEED=!0,o(["delete","has","get","set"],(function(e){var t=E.prototype,r=t[e];a(t,e,(function(t,i){if(l(t)&&!m(t)){this._f||(this._f=new n);var o=this._f[e](t,i);return"set"==e?this:o}return r.call(this,t,i)}))})))},33012:(e,t,r)=>{r(74573)("Map")},28878:(e,t,r)=>{r(72758)("Map")},90401:(e,t,r)=>{var n=r(14518);n(n.P+n.R,"Map",{toJSON:r(80540)("Map")})},39827:(e,t,r)=>{var n=r(14518),i=r(30572)(!0);n(n.S,"Object",{entries:function(e){return i(e)}})},40342:(e,t,r)=>{var n=r(14518),i=r(74737),o=r(6303),a=r(30826),s=r(10101);n(n.S,"Object",{getOwnPropertyDescriptors:function(e){for(var t,r,n=o(e),c=a.f,u=i(n),l={},d=0;u.length>d;)void 0!==(r=c(n,t=u[d++]))&&s(l,t,r);return l}})},73625:(e,t,r)=>{var n=r(14518),i=r(30572)(!1);n(n.S,"Object",{values:function(e){return i(e)}})},36556:(e,t,r)=>{"use strict";var n=r(14518),i=r(63093),o=r(3220),a=r(312),s=r(77116);n(n.P+n.R,"Promise",{finally:function(e){var t=a(this,i.Promise||o.Promise),r="function"==typeof e;return this.then(r?function(r){return s(t,e()).then((function(){return r}))}:e,r?function(r){return s(t,e()).then((function(){throw r}))}:e)}})},8421:(e,t,r)=>{"use strict";var n=r(14518),i=r(36253),o=r(19934);n(n.S,"Promise",{try:function(e){var t=i.f(this),r=o(e);return(r.e?t.reject:t.resolve)(r.v),t.promise}})},68572:(e,t,r)=>{r(74573)("Set")},42235:(e,t,r)=>{r(72758)("Set")},30093:(e,t,r)=>{var n=r(14518);n(n.P+n.R,"Set",{toJSON:r(80540)("Set")})},52145:(e,t,r)=>{r(10305)("asyncIterator")},74775:(e,t,r)=>{r(10305)("observable")},20206:(e,t,r)=>{r(74573)("WeakMap")},91877:(e,t,r)=>{r(72758)("WeakMap")},39361:(e,t,r)=>{r(74296);for(var n=r(3220),i=r(44379),o=r(64502),a=r(23032)("toStringTag"),s="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),c=0;c<s.length;c++){var u=s[c],l=n[u],d=l&&l.prototype;d&&!d[a]&&i(d,a,u),o[u]=o.Array}},25512:(e,t,r)=>{var n=r(28583);e.exports=function(e){var t,r=this,i=[].slice.call(arguments);t=e&&e.hasOwnProperty("constructor")?e.constructor:function(){return r.apply(this,arguments)},n(t,r);var o=function(){this.constructor=t};return o.prototype=r.prototype,t.prototype=new o,e&&(i.unshift(t.prototype),n.apply(null,i)),t.__super__=r.prototype,t}},90765:(e,t,r)=>{var n=r(49740),i=r(25512),o=r(1469),a=r(38169),s=r(28583),c=[].slice;function u(e,t){if(t||(t={}),t.model&&(this.model=t.model),t.comparator&&(this.comparator=t.comparator),t.parent&&(this.parent=t.parent),!this.mainIndex){var r=this.model&&this.model.prototype&&this.model.prototype.idAttribute;this.mainIndex=r||"id"}this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,s({silent:!0},t))}s(u.prototype,n,{initialize:function(){},isModel:function(e){return this.model&&e instanceof this.model},add:function(e,t){return this.set(e,s({merge:!1,add:!0,remove:!1},t))},parse:function(e,t){return e},serialize:function(){return this.map((function(e){if(e.serialize)return e.serialize();var t={};return s(t,e),delete t.collection,t}))},toJSON:function(){return this.serialize()},set:function(e,t){(t=s({add:!0,remove:!0,merge:!0},t)).parse&&(e=this.parse(e,t));var r,n,i,a,c,u,l,d=!o(e);e=d?e?[e]:[]:e.slice();var f=t.at,h=this.comparator&&null==f&&!1!==t.sort,p="string"==typeof this.comparator?this.comparator:null,v=[],m=[],g={},y=t.add,b=t.merge,E=t.remove,S=!(h||!y||!E)&&[],_=this.model&&this.model.prototype||Object.prototype;for(u=0,l=e.length;u<l;u++){if(i=e[u]||{},this.isModel(i)?r=n=i:_.generateId?r=_.generateId(i):void 0===(r=i[this.mainIndex])&&this._isDerivedIndex(_)&&(r=_._derived[this.mainIndex].fn.call(i)),a=this.get(r))E&&(g[a.cid||a[this.mainIndex]]=!0),b&&(i=i===n?n.attributes:i,t.parse&&(i=a.parse(i,t)),a.set?(a.set(i,t),h&&!c&&a.hasChanged(p)&&(c=!0)):s(a,i)),e[u]=a;else if(y){if(!(n=e[u]=this._prepareModel(i,t)))continue;v.push(n),this._addReference(n,t)}(n=a||n)&&(S&&(n.isNew&&n.isNew()||!n[this.mainIndex]||!g[n.cid||n[this.mainIndex]])&&S.push(n),g[n[this.mainIndex]]=!0)}if(E){for(u=0,l=this.length;u<l;u++)g[(n=this.models[u]).cid||n[this.mainIndex]]||m.push(n);for(m.length&&this.remove(m,t),u=0,l=v.length;u<l;u++)this._index(v[u])}if(v.length||S&&S.length)if(h&&(c=!0),null!=f)for(u=0,l=v.length;u<l;u++)this.models.splice(f+u,0,v[u]);else{var w=S||v;for(u=0,l=w.length;u<l;u++)this.models.push(w[u])}if(c&&this.sort({silent:!0}),!t.silent){for(u=0,l=v.length;u<l;u++)(n=v[u]).trigger?n.trigger("add",n,this,t):this.trigger("add",n,this,t);(c||S&&S.length)&&this.trigger("sort",this,t)}return d?e[0]:e},get:function(e,t){if(null!=e){var r=this.mainIndex,n=this._indexes[t||r];return n&&(n[e]||void 0!==e[r]&&n[e[r]])||this._indexes.cid[e]||this._indexes.cid[e.cid]}},at:function(e){return this.models[e]},remove:function(e,t){var r,n,i,a,s=!o(e);for(t||(t={}),r=0,n=(e=s?[e]:c.call(e)).length;r<n;r++)(i=e[r]=this.get(e[r]))&&(this._deIndex(i),a=this.models.indexOf(i),this.models.splice(a,1),t.silent||(t.index=a,i.trigger?i.trigger("remove",i,this,t):this.trigger("remove",i,this,t)),this._removeReference(i,t));return s?e[0]:e},reset:function(e,t){t||(t={});for(var r=0,n=this.models.length;r<n;r++)this._removeReference(this.models[r],t);return t.previousModels=this.models,this._reset(),e=this.add(e,s({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},sort:function(e){var t=this;if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return e||(e={}),"string"==typeof this.comparator?this.models.sort((function(e,r){return e.get?(e=e.get(t.comparator),r=r.get(t.comparator)):(e=e[t.comparator],r=r[t.comparator]),e>r||void 0===e?1:e<r||void 0===r?-1:0})):1===this.comparator.length?this.models.sort((function(e,r){return(e=t.comparator(e))>(r=t.comparator(r))||void 0===e?1:e<r||void 0===r?-1:0})):this.models.sort(a(this.comparator,this)),e.silent||this.trigger("sort",this,e),this},_reset:function(){var e=c.call(this.indexes||[]),t=0;e.push(this.mainIndex),e.push("cid");var r=e.length;for(this.models=[],this._indexes={};t<r;t++)this._indexes[e[t]]={}},_prepareModel:function(e,t){if(!this.model)return e;if(this.isModel(e))return e.collection||(e.collection=this),e;(t=t?s({},t):{}).collection=this;var r=new this.model(e,t);return r.validationError?(this.trigger("invalid",this,r.validationError,t),!1):r},_deIndex:function(e,t,r){var n;if(void 0===t)for(var i in this._indexes)n=e.hasOwnProperty(i)?e[i]:e.get&&e.get(i),delete this._indexes[i][n];else{if(void 0===this._indexes[t])throw new Error("Given attribute is not an index");delete this._indexes[t][r]}},_index:function(e,t){var r;if(void 0===t)for(var n in this._indexes)null!=(r=e.hasOwnProperty(n)?e[n]:e.get&&e.get(n))&&(this._indexes[n][r]=e);else{if(void 0===this._indexes[t])throw new Error("Given attribute is not an index");(r=e[t]||e.get&&e.get(t))&&(this._indexes[t][r]=e)}},_isDerivedIndex:function(e){return!(!e||"object"!=typeof e._derived)&&Object.keys(e._derived).indexOf(this.mainIndex)>=0},_addReference:function(e,t){this._index(e),e.collection||(e.collection=this),e.on&&e.on("all",this._onModelEvent,this)},_removeReference:function(e,t){this===e.collection&&delete e.collection,this._deIndex(e),e.off&&e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,r,n){var i=e.split(":")[0],o=e.split(":")[1];("add"!==i&&"remove"!==i||r===this)&&("destroy"===i&&this.remove(t,n),t&&"change"===i&&o&&this._indexes[o]&&(this._deIndex(t,o,t.previousAttributes()[o]),this._index(t,o)),this.trigger.apply(this,arguments))}}),Object.defineProperties(u.prototype,{length:{get:function(){return this.models.length}},isCollection:{get:function(){return!0}}});["indexOf","lastIndexOf","every","some","forEach","map","filter","reduce","reduceRight"].forEach((function(e){u.prototype[e]=function(){return this.models[e].apply(this.models,arguments)}})),u.prototype.each=u.prototype.forEach,u.extend=i,e.exports=u},49740:(e,t,r)=>{var n=r(51463),i=r(3674),o=r(41609),a=r(28583),s=r(84486),c=Array.prototype.slice,u=r(25668),l={on:function(e,t,r){return u.eventsApi(this,"on",e,[t,r])&&t?(this._events||(this._events={}),(this._events[e]||(this._events[e]=[])).push({callback:t,context:r,ctx:r||this}),this):this},once:function(e,t,r){if(!u.eventsApi(this,"once",e,[t,r])||!t)return this;var i=this,o=n((function(){i.off(e,o),t.apply(this,arguments)}));return o._callback=t,this.on(e,o,r)},off:function(e,t,r){var n,o,a,s,c,l,d,f;if(!this._events||!u.eventsApi(this,"off",e,[t,r]))return this;if(!e&&!t&&!r)return this._events=void 0,this;for(c=0,l=(s=e?[e]:i(this._events)).length;c<l;c++)if(e=s[c],a=this._events[e]){if(this._events[e]=n=[],t||r)for(d=0,f=a.length;d<f;d++)o=a[d],(t&&t!==o.callback&&t!==o.callback._callback||r&&r!==o.context)&&n.push(o);n.length||delete this._events[e]}return this},trigger:function(e){if(!this._events)return this;var t=c.call(arguments,1);if(!u.eventsApi(this,"trigger",e,t))return this;var r=this._events[e],n=this._events.all;return r&&u.triggerEvents(r,t),n&&u.triggerEvents(n,arguments),this},stopListening:function(e,t,r){var n=this._listeningTo;if(!n)return this;var i=!t&&!r;r||"object"!=typeof t||(r=this),e&&((n={})[e._listenId]=e);var a=this;return s(n,(function(e,n){e.off(t,r,a),(i||o(e._events))&&delete a._listeningTo[n]})),this},createEmitter:function(e){return a(e||{},l)},listenTo:u.createListenMethod("on"),listenToOnce:u.createListenMethod("once"),listenToAndRun:function(e,t,r){return this.listenTo.apply(this,arguments),r||"object"!=typeof t||(r=this),r.apply(this),this}};l.bind=l.on,l.unbind=l.off,l.removeListener=l.off,l.removeAllListeners=l.off,l.emit=l.trigger,e.exports=l},25668:(e,t,r)=>{var n=r(73955),i=/\s+/;t.triggerEvents=function(e,t){var r,n=-1,i=e.length,o=t[0],a=t[1],s=t[2];switch(t.length){case 0:for(;++n<i;)(r=e[n]).callback.call(r.ctx);return;case 1:for(;++n<i;)(r=e[n]).callback.call(r.ctx,o);return;case 2:for(;++n<i;)(r=e[n]).callback.call(r.ctx,o,a);return;case 3:for(;++n<i;)(r=e[n]).callback.call(r.ctx,o,a,s);return;default:for(;++n<i;)(r=e[n]).callback.apply(r.ctx,t);return}},t.eventsApi=function(e,t,r,n){if(!r)return!0;if("object"==typeof r){for(var o in r)e[t].apply(e,[o,r[o]].concat(n));return!1}if(i.test(r)){for(var a=r.split(i),s=0,c=a.length;s<c;s++)e[t].apply(e,[a[s]].concat(n));return!1}return!0},t.createListenMethod=function(e){return function(t,r,i){if(!t)throw new Error("Trying to listenTo event: '"+r+"' but the target object is undefined");if((this._listeningTo||(this._listeningTo={}))[t._listenId||(t._listenId=n("l"))]=t,i||"object"!=typeof r||(i=this),"function"!=typeof t[e])throw new Error("Trying to listenTo event: '"+r+"' on object: "+t.toString()+" but it does not have an 'on' method so is unbindable");return t[e](r,i,this),this}}},65109:(e,t,r)=>{"use strict";var n=r(73955),i=r(28583),o=function(e){return i({},e)},a=r(82723),s=r(7187),c=r(2525),u=r(64721),l=r(47037),d=r(13218),f=r(47960),h=r(23560),p=r(18446),v=r(18721),m=r(58613),g=r(93386),y=r(49740),b=r(78414),E=r(72185),S=/^change:/,_=function(){};function w(e,t){t||(t={}),this.cid||(this.cid=n("state")),this._events={},this._values={},this._eventBubblingHandlerCache={},this._definition=Object.create(this._definition),t.parse&&(e=this.parse(e,t)),this.parent=t.parent,this.collection=t.collection,this._keyTree=new b,this._initCollections(),this._initChildren(),this._cache={},this._previousAttributes={},e&&this.set(e,i({silent:!0,initial:!0},t)),this._changed={},this._derived&&this._initDerived(),!1!==t.init&&this.initialize.apply(this,arguments)}function R(e,t,r,n){var i,o,a=e._definition[t]={};if(l(r))(i=e._ensureValidType(r))&&(a.type=i);else{if(Array.isArray(r)&&(r={type:(o=r)[0],required:o[1],default:o[2]}),(i=e._ensureValidType(r.type))&&(a.type=i),r.required&&(a.required=!0),r.default&&"object"==typeof r.default)throw new TypeError("The default value for "+t+" cannot be an object/array, must be a value or a function which returns a value/object/array");a.default=r.default,a.allowNull=!!r.allowNull&&r.allowNull,r.setOnce&&(a.setOnce=!0),a.required&&void 0===a.default&&!a.setOnce&&(a.default=e._getDefaultForType(i)),a.test=r.test,a.values=r.values}return n&&(a.session=!0),i||(i=l(r)?r:r.type,console.warn("Invalid data type of `"+i+"` for `"+t+"` property. Use one of the default types or define your own")),Object.defineProperty(e,t,{set:function(e){this.set(t,e)},get:function(){if(!this._values)throw Error('You may be trying to `extend` a state object with "'+t+'" which has been defined in `props` on the object being extended');var e=this._values[t],r=this._dataTypes[a.type];if(void 0!==e)return r&&r.get&&(e=r.get(e)),e;var n=m(a,"default");(this._values[t]=n,void 0!==n)&&this._getOnChangeForType(a.type)(n,e,t);return n}}),a}function C(e,t,r){(e._derived[t]={fn:h(r)?r:r.fn,cache:!1!==r.cache,depList:r.deps||[]}).depList.forEach((function(r){e._deps[r]=g(e._deps[r]||[],[t])})),Object.defineProperty(e,t,{get:function(){return this._getDerivedProperty(t)},set:function(){throw new TypeError("`"+t+"` is a derived property, it can't be set directly.")}})}i(w.prototype,y,{extraProperties:"ignore",idAttribute:"id",namespaceAttribute:"namespace",typeAttribute:"modelType",initialize:function(){return this},getId:function(){return this[this.idAttribute]},getNamespace:function(){return this[this.namespaceAttribute]},getType:function(){return this[this.typeAttribute]},isNew:function(){return null==this.getId()},escape:function(e){return s(this.get(e))},isValid:function(e){return this._validate({},i(e||{},{validate:!0}))},parse:function(e,t){return e},serialize:function(e){var t=i({props:!0},e),r=this.getAttributes(t,!0),n=function(e,t){r[t]=this[t].serialize()}.bind(this);return c(this._children,n),c(this._collections,n),r},set:function(e,t,r){var n,i,o,a,s,c,l,f,h,p,v,g,y,b,E,S,_,w=this,R=this.extraProperties;if(d(e)||null===e?(h=e,r=t):(h={})[e]=t,r=r||{},!this._validate(h,r))return!1;g=r.unset,v=r.silent,b=r.initial,n=this._changing,this._changing=!0,i=[],b?this._previousAttributes={}:n||(this._previousAttributes=this.attributes,this._changed={});for(var C=0,T=Object.keys(h),x=T.length;C<x;C++){if(o=typeof(a=h[f=T[C]]),y=this._values[f],!(s=this._definition[f])){if(this._children[f]||this._collections[f]){d(a)||(a={}),this[f].set(a,r);continue}if("ignore"===R)continue;if("reject"===R)throw new TypeError('No "'+f+'" property defined on '+(this.type||"this")+' model and extraProperties not set to "ignore" or "allow"');if("allow"===R)s=this._createPropertyDefinition(f,"any");else if(R)throw new TypeError('Invalid value for extraProperties: "'+R+'"')}if(S=this._getCompareForType(s.type),_=this._getOnChangeForType(s.type),(p=this._dataTypes[s.type])&&p.set&&(a=(c=p.set(a)).val,o=c.type),s.test&&(l=s.test.call(this,a,o)))throw new TypeError("Property '"+f+"' failed validation with error: "+l);if(void 0===a&&s.required)throw new TypeError("Required property '"+f+"' must be of type "+s.type+". Tried to set "+a);if(null===a&&s.required&&!s.allowNull)throw new TypeError("Property '"+f+"' must be of type "+s.type+" (cannot be null). Tried to set "+a);if(s.type&&"any"!==s.type&&s.type!==o&&null!=a)throw new TypeError("Property '"+f+"' must be of type "+s.type+". Tried to set "+a);if(s.values&&!u(s.values,a)){var k=m(s,"default");if(g&&void 0!==k)a=k;else if(!g||g&&void 0!==a)throw new TypeError("Property '"+f+"' must be one of values: "+s.values.join(", ")+". Tried to set "+a)}if(E=b||!S(y,a,f),s.setOnce&&void 0!==y&&E)throw new TypeError("Property '"+f+"' can only be set once.");E?(_(a,y,f),b||(this._changed[f]=a,this._previousAttributes[f]=y,g&&delete this._values[f],v||i.push({prev:y,val:a,key:f})),g||(this._values[f]=a)):delete this._changed[f]}if(i.length&&(this._pending=!0),i.forEach((function(e){w.trigger("change:"+e.key,w,e.val,r)})),n)return this;for(;this._pending;)this._pending=!1,this.trigger("change",this,r);return this._pending=!1,this._changing=!1,this},get:function(e){return this[e]},toggle:function(e){var t=this._definition[e];if("boolean"===t.type)this[e]=!this[e];else{if(!t||!t.values)throw new TypeError("Can only toggle properties that are type `boolean` or have `values` array.");this[e]=E(t.values,this[e])}return this},previousAttributes:function(){return o(this._previousAttributes)},hasChanged:function(e){return null==e?!!Object.keys(this._changed).length:v(this._derived,e)?this._derived[e].depList.some((function(e){return this.hasChanged(e)}),this):v(this._changed,e)},changedAttributes:function(e){if(!e)return!!this.hasChanged()&&o(this._changed);var t,r,n=!1,i=this._changing?this._previousAttributes:this.attributes;for(var a in e)(r=this._definition[a])&&(this._getCompareForType(r.type)(i[a],t=e[a])||((n||(n={}))[a]=t));return n},toJSON:function(){return this.serialize()},unset:function(e,t){var r=this;(e=Array.isArray(e)?e:[e]).forEach((function(e){var n,o=r._definition[e];if(o)return o.required?(n=m(o,"default"),r.set(e,n,t)):r.set(e,n,i({},t,{unset:!0}))}))},clear:function(e){var t=this;return Object.keys(this.attributes).forEach((function(r){t.unset(r,e)})),this},previous:function(e){return null!=e&&Object.keys(this._previousAttributes).length?this._previousAttributes[e]:null},_getDefaultForType:function(e){var t=this._dataTypes[e];return t&&t.default},_getCompareForType:function(e){var t=this._dataTypes[e];return t&&t.compare?t.compare.bind(this):p},_getOnChangeForType:function(e){var t=this._dataTypes[e];return t&&t.onChange?t.onChange.bind(this):_},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=i({},this.attributes,e);var r=this.validationError=this.validate(e,t)||null;return!r||(this.trigger("invalid",this,r,i(t||{},{validationError:r})),!1)},_createPropertyDefinition:function(e,t,r){return R(this,e,t,r)},_ensureValidType:function(e){return u(["string","number","boolean","array","object","date","state","any"].concat(Object.keys(this._dataTypes)),e)?e:void 0},getAttributes:function(e,t){e=i({session:!1,props:!1,derived:!1},e||{});var r,n,o={};for(var a in this._definition)n=this._definition[a],(e.session&&n.session||e.props&&!n.session)&&(r=t?this._values[a]:this[a],t&&r&&h(r.serialize)&&(r=r.serialize()),void 0===r&&(r=m(n,"default")),void 0!==r&&(o[a]=r));if(e.derived)for(var s in this._derived)o[s]=this[s];return o},_initDerived:function(){var e=this;c(this._derived,(function(t,r){var n=e._derived[r];n.deps=n.depList;var i=function(){var t=n.fn.call(e);e._cache[r]===t&&n.cache||(n.cache&&(e._previousAttributes[r]=e._cache[r]),e._cache[r]=t,e.trigger("change:"+r,e,e._cache[r]))};n.deps.forEach((function(t){e._keyTree.add(t,i)}))})),this.on("all",(function(t){S.test(t)&&e._keyTree.get(t.split(":")[1]).forEach((function(e){e()}))}),this)},_getDerivedProperty:function(e,t){return this._derived[e].cache?(!t&&this._cache.hasOwnProperty(e)||(this._cache[e]=this._derived[e].fn.apply(this)),this._cache[e]):this._derived[e].fn.apply(this)},_initCollections:function(){var e;if(this._collections)for(e in this._collections)this._safeSet(e,new this._collections[e](null,{parent:this}))},_initChildren:function(){var e;if(this._children)for(e in this._children)this._safeSet(e,new this._children[e]({},{parent:this})),this.listenTo(this[e],"all",this._getCachedEventBubblingHandler(e))},_getCachedEventBubblingHandler:function(e){return this._eventBubblingHandlerCache[e]||(this._eventBubblingHandlerCache[e]=function(t,r,n){S.test(t)?this.trigger("change:"+e+"."+t.split(":")[1],r,n):"change"===t&&this.trigger("change",this)}.bind(this)),this._eventBubblingHandlerCache[e]},_verifyRequired:function(){var e=this.attributes;for(var t in this._definition)if(this._definition[t].required&&void 0===e[t])return!1;return!0},_safeSet:function(e,t){if(e in this)throw new Error("Encountered namespace collision while setting instance property `"+e+"`");return this[e]=t,this}}),Object.defineProperties(w.prototype,{attributes:{get:function(){return this.getAttributes({props:!0,session:!0})}},all:{get:function(){return this.getAttributes({session:!0,props:!0,derived:!0})}},isState:{get:function(){return!0},set:function(){}}});var T={string:{default:function(){return""}},date:{set:function(e){var t;if(null==e)t="object";else if(f(e))t="date",e=e.valueOf();else{var r=null,n=new Date(e).valueOf();isNaN(n)&&(n=new Date(parseInt(e,10)).valueOf(),isNaN(n)&&(r=!0)),e=n,t="date",r&&(t=typeof e)}return{val:e,type:t}},get:function(e){return null==e?e:new Date(e)},default:function(){return new Date}},array:{set:function(e){return{val:e,type:Array.isArray(e)?"array":typeof e}},default:function(){return[]}},object:{set:function(e){var t=typeof e;return"object"!==t&&void 0===e&&(e=null,t="object"),{val:e,type:t}},default:function(){return{}}},state:{set:function(e){return e instanceof w||e&&e.isState?{val:e,type:"state"}:{val:e,type:typeof e}},compare:function(e,t){return e===t},onChange:function(e,t,r){t&&this.stopListening(t,"all",this._getCachedEventBubblingHandler(r)),null!=e&&this.listenTo(e,"all",this._getCachedEventBubblingHandler(r))}}};w.extend=function(e){var t,r=this;t=e&&e.hasOwnProperty("constructor")?e.constructor:function(){return r.apply(this,arguments)},i(t,r);var n=function(){this.constructor=t};if(n.prototype=r.prototype,t.prototype=new n,t.prototype._derived=i({},r.prototype._derived),t.prototype._deps=i({},r.prototype._deps),t.prototype._definition=i({},r.prototype._definition),t.prototype._collections=i({},r.prototype._collections),t.prototype._children=i({},r.prototype._children),t.prototype._dataTypes=i({},r.prototype._dataTypes||T),e)for(var o=["dataTypes","props","session","derived","collections","children"],s=0;s<arguments.length;s++){var u=arguments[s];u.dataTypes&&c(u.dataTypes,(function(e,r){t.prototype._dataTypes[r]=e})),u.props&&c(u.props,(function(e,r){R(t.prototype,r,e)})),u.session&&c(u.session,(function(e,r){R(t.prototype,r,e,!0)})),u.derived&&c(u.derived,(function(e,r){C(t.prototype,r,e)})),u.collections&&c(u.collections,(function(e,r){t.prototype._collections[r]=e})),u.children&&c(u.children,(function(e,r){t.prototype._children[r]=e})),i(t.prototype,a(u,o))}return t.__super__=r.prototype,t},e.exports=w},72185:e=>{e.exports=function(e,t){var r=e.length,n=e.indexOf(t)+1;return n>r-1&&(n=0),e[n]}},25144:(e,t,r)=>{var n=r(61070),i=r(33217),o=r(98433),a=r(4220);e.exports.Backoff=n,e.exports.FunctionCall=a,e.exports.FibonacciStrategy=o,e.exports.ExponentialStrategy=i,e.exports.fibonacci=function(e){return new n(new o(e))},e.exports.exponential=function(e){return new n(new i(e))},e.exports.call=function(e,t,r){var n=Array.prototype.slice.call(arguments);return e=n[0],t=n.slice(1,n.length-1),r=n[n.length-1],new a(e,t,r)}},61070:(e,t,r)=>{var n=r(17187),i=r(3814);function o(e){n.EventEmitter.call(this),this.backoffStrategy_=e,this.maxNumberOfRetry_=-1,this.backoffNumber_=0,this.backoffDelay_=0,this.timeoutID_=-1,this.handlers={backoff:this.onBackoff_.bind(this)}}r(89539).inherits(o,n.EventEmitter),o.prototype.failAfter=function(e){i.checkArgument(e>0,"Expected a maximum number of retry greater than 0 but got %s.",e),this.maxNumberOfRetry_=e},o.prototype.backoff=function(e){i.checkState(-1===this.timeoutID_,"Backoff in progress."),this.backoffNumber_===this.maxNumberOfRetry_?(this.emit("fail",e),this.reset()):(this.backoffDelay_=this.backoffStrategy_.next(),this.timeoutID_=setTimeout(this.handlers.backoff,this.backoffDelay_),this.emit("backoff",this.backoffNumber_,this.backoffDelay_,e))},o.prototype.onBackoff_=function(){this.timeoutID_=-1,this.emit("ready",this.backoffNumber_,this.backoffDelay_),this.backoffNumber_++},o.prototype.reset=function(){this.backoffNumber_=0,this.backoffStrategy_.reset(),clearTimeout(this.timeoutID_),this.timeoutID_=-1},e.exports=o},4220:(e,t,r)=>{var n=r(17187),i=r(3814),o=r(89539),a=r(61070),s=r(98433);function c(e,t,r){n.EventEmitter.call(this),i.checkIsFunction(e,"Expected fn to be a function."),i.checkIsArray(t,"Expected args to be an array."),i.checkIsFunction(r,"Expected callback to be a function."),this.function_=e,this.arguments_=t,this.callback_=r,this.lastResult_=[],this.numRetries_=0,this.backoff_=null,this.strategy_=null,this.failAfter_=-1,this.retryPredicate_=c.DEFAULT_RETRY_PREDICATE_,this.state_=c.State_.PENDING}o.inherits(c,n.EventEmitter),c.State_={PENDING:0,RUNNING:1,COMPLETED:2,ABORTED:3},c.DEFAULT_RETRY_PREDICATE_=function(e){return!0},c.prototype.isPending=function(){return this.state_==c.State_.PENDING},c.prototype.isRunning=function(){return this.state_==c.State_.RUNNING},c.prototype.isCompleted=function(){return this.state_==c.State_.COMPLETED},c.prototype.isAborted=function(){return this.state_==c.State_.ABORTED},c.prototype.setStrategy=function(e){return i.checkState(this.isPending(),"FunctionCall in progress."),this.strategy_=e,this},c.prototype.retryIf=function(e){return i.checkState(this.isPending(),"FunctionCall in progress."),this.retryPredicate_=e,this},c.prototype.getLastResult=function(){return this.lastResult_.concat()},c.prototype.getNumRetries=function(){return this.numRetries_},c.prototype.failAfter=function(e){return i.checkState(this.isPending(),"FunctionCall in progress."),this.failAfter_=e,this},c.prototype.abort=function(){this.isCompleted()||this.isAborted()||(this.isRunning()&&this.backoff_.reset(),this.state_=c.State_.ABORTED,this.lastResult_=[new Error("Backoff aborted.")],this.emit("abort"),this.doCallback_())},c.prototype.start=function(e){i.checkState(!this.isAborted(),"FunctionCall is aborted."),i.checkState(this.isPending(),"FunctionCall already started.");var t=this.strategy_||new s;this.backoff_=e?e(t):new a(t),this.backoff_.on("ready",this.doCall_.bind(this,!0)),this.backoff_.on("fail",this.doCallback_.bind(this)),this.backoff_.on("backoff",this.handleBackoff_.bind(this)),this.failAfter_>0&&this.backoff_.failAfter(this.failAfter_),this.state_=c.State_.RUNNING,this.doCall_(!1)},c.prototype.doCall_=function(e){e&&this.numRetries_++;var t=["call"].concat(this.arguments_);n.EventEmitter.prototype.emit.apply(this,t);var r=this.handleFunctionCallback_.bind(this);this.function_.apply(null,this.arguments_.concat(r))},c.prototype.doCallback_=function(){this.callback_.apply(null,this.lastResult_)},c.prototype.handleFunctionCallback_=function(){if(!this.isAborted()){var e=Array.prototype.slice.call(arguments);this.lastResult_=e,n.EventEmitter.prototype.emit.apply(this,["callback"].concat(e));var t=e[0];t&&this.retryPredicate_(t)?this.backoff_.backoff(t):(this.state_=c.State_.COMPLETED,this.doCallback_())}},c.prototype.handleBackoff_=function(e,t,r){this.emit("backoff",e,t,r)},e.exports=c},33217:(e,t,r)=>{var n=r(89539),i=r(3814),o=r(99618);function a(e){o.call(this,e),this.backoffDelay_=0,this.nextBackoffDelay_=this.getInitialDelay(),this.factor_=a.DEFAULT_FACTOR,e&&void 0!==e.factor&&(i.checkArgument(e.factor>1,"Exponential factor should be greater than 1 but got %s.",e.factor),this.factor_=e.factor)}n.inherits(a,o),a.DEFAULT_FACTOR=2,a.prototype.next_=function(){return this.backoffDelay_=Math.min(this.nextBackoffDelay_,this.getMaxDelay()),this.nextBackoffDelay_=this.backoffDelay_*this.factor_,this.backoffDelay_},a.prototype.reset_=function(){this.backoffDelay_=0,this.nextBackoffDelay_=this.getInitialDelay()},e.exports=a},98433:(e,t,r)=>{var n=r(89539),i=r(99618);function o(e){i.call(this,e),this.backoffDelay_=0,this.nextBackoffDelay_=this.getInitialDelay()}n.inherits(o,i),o.prototype.next_=function(){var e=Math.min(this.nextBackoffDelay_,this.getMaxDelay());return this.nextBackoffDelay_+=this.backoffDelay_,this.backoffDelay_=e,e},o.prototype.reset_=function(){this.nextBackoffDelay_=this.getInitialDelay(),this.backoffDelay_=0},e.exports=o},99618:(e,t,r)=>{r(17187),r(89539);function n(e){return null!=e}function i(e){if(n((e=e||{}).initialDelay)&&e.initialDelay<1)throw new Error("The initial timeout must be greater than 0.");if(n(e.maxDelay)&&e.maxDelay<1)throw new Error("The maximal timeout must be greater than 0.");if(this.initialDelay_=e.initialDelay||100,this.maxDelay_=e.maxDelay||1e4,this.maxDelay_<=this.initialDelay_)throw new Error("The maximal backoff delay must be greater than the initial backoff delay.");if(n(e.randomisationFactor)&&(e.randomisationFactor<0||e.randomisationFactor>1))throw new Error("The randomisation factor must be between 0 and 1.");this.randomisationFactor_=e.randomisationFactor||0}i.prototype.getMaxDelay=function(){return this.maxDelay_},i.prototype.getInitialDelay=function(){return this.initialDelay_},i.prototype.next=function(){var e=this.next_(),t=1+Math.random()*this.randomisationFactor_;return Math.round(e*t)},i.prototype.next_=function(){throw new Error("BackoffStrategy.next_() unimplemented.")},i.prototype.reset=function(){this.reset_()},i.prototype.reset_=function(){throw new Error("BackoffStrategy.reset_() unimplemented.")},e.exports=i},79742:(e,t)=>{"use strict";t.byteLength=function(e){var t=s(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,o=s(e),a=o[0],c=o[1],u=new i(function(e,t,r){return 3*(t+r)/4-r}(0,a,c)),l=0,d=c>0?a-4:a;for(r=0;r<d;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===c&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],a=16383,s=0,u=n-i;s<u;s+=a)o.push(c(e,s,s+a>u?u:s+a));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=o[a],n[o.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,n){for(var i,o,a=[],s=t;s<n;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},51206:function(e){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=90)}({17:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n=r(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||""},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||""},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,r,n){void 0===n&&(n=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(r),a=Math.max(i,o),s=0,c=e.map([t,r],(function(t){var r=a-e.getVersionPrecision(t),n=t+new Array(r+1).join(".0");return e.map(n.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(n&&(s=a-Math.min(i,o)),a-=1;a>=s;){if(c[0][a]>c[1][a])return 1;if(c[0][a]===c[1][a]){if(a===s)return 0;a-=1}else if(c[0][a]<c[1][a])return-1}},e.map=function(e,t){var r,n=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)n.push(t(e[r]));return n},e.find=function(e,t){var r,n;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(r=0,n=e.length;r<n;r+=1){var i=e[r];if(t(i,r))return i}},e.assign=function(e){for(var t,r,n=e,i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var s=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){n[t]=e[t]}))};for(t=0,r=o.length;t<r;t+=1)s();return e},e.getBrowserAlias=function(e){return n.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return n.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,r){"use strict";t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,i=(n=r(91))&&n.__esModule?n:{default:n},o=r(18);function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s=function(){function e(){}var t,r,n;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,n=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(r=null)&&a(t.prototype,r),n&&a(t,n),e}();t.default=s,e.exports=t.default},91:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n=c(r(92)),i=c(r(93)),o=c(r(94)),a=c(r(95)),s=c(r(17));function c(e){return e&&e.__esModule?e:{default:e}}var u=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=s.default.find(n.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=s.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=s.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=s.default.find(a.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return s.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,r={},n=0,i={},o=0;if(Object.keys(e).forEach((function(t){var a=e[t];"string"==typeof a?(i[t]=a,o+=1):"object"==typeof a&&(r[t]=a,n+=1)})),n>0){var a=Object.keys(r),c=s.default.find(a,(function(e){return t.isOS(e)}));if(c){var u=this.satisfies(r[c]);if(void 0!==u)return u}var l=s.default.find(a,(function(e){return t.isPlatform(e)}));if(l){var d=this.satisfies(r[l]);if(void 0!==d)return d}}if(o>0){var f=Object.keys(i),h=s.default.find(f,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),n=e.toLowerCase(),i=s.default.getBrowserTypeByAlias(n);return t&&i&&(n=i.toLowerCase()),n===r},t.compareVersion=function(e){var t=[0],r=e,n=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(n=!0,r=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(n=!0,r=e.substr(1)),t.indexOf(s.default.compareVersions(i,r,n))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=u,e.exports=t.default},92:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},r=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},r=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},r=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},r=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},r=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},r=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},r=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},r=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},r=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},r=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},r=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},r=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},r=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},r=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},r=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},r=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},r=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},r=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},r=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},r=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},r=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t={name:"Android Browser"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},r=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=i.default.getMacOSVersionName(t),n={name:o.OS_MAP.MacOS,version:t};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=i.default.getAndroidVersionName(t),n={name:o.OS_MAP.Android,version:t};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:o.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},r=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},r=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},r=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},r=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=a,e.exports=t.default}})},88500:(e,t,r)=>{"use strict";var n=r(48764).Buffer,i=r(48764).SlowBuffer;function o(e,t){if(!n.isBuffer(e)||!n.isBuffer(t))return!1;if(e.length!==t.length)return!1;for(var r=0,i=0;i<e.length;i++)r|=e[i]^t[i];return 0===r}e.exports=o,o.install=function(){n.prototype.equal=i.prototype.equal=function(e){return o(this,e)}};var a=n.prototype.equal,s=i.prototype.equal;o.restore=function(){n.prototype.equal=a,i.prototype.equal=s}},48764:(e,t,r)=>{"use strict";const n=r(79742),i=r(80645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},t.INSPECT_MAX_BYTES=50;const a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|v(e,t);let n=s(r);const i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(J(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(J(e,ArrayBuffer)||e&&J(e.buffer,ArrayBuffer))return h(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(J(e,SharedArrayBuffer)||e&&J(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||Y(e.length)?s(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),s(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),r=s(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function h(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,c.prototype),n}function p(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function v(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||J(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return K(e).length;default:if(i)return n?-1:H(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,r);case"utf8":case"utf-8":return T(this,t,r);case"ascii":return k(this,t,r);case"latin1":case"binary":return I(this,t,r);case"base64":return C(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Y(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){let o,a=1,s=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){let n=-1;for(o=r;o<s;o++)if(u(e,o)===u(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===c)return n*a}else-1!==n&&(o-=o-n),n=-1}else for(r+c>s&&(r=s-c),o=r;o>=0;o--){let r=!0;for(let n=0;n<c;n++)if(u(e,o+n)!==u(t,n)){r=!1;break}if(r)return o}return-1}function E(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=t.length;let a;for(n>o/2&&(n=o/2),a=0;a<n;++a){const n=parseInt(t.substr(2*a,2),16);if(Y(n))return a;e[r+a]=n}return a}function S(e,t,r,n){return $(H(t,e.length-r),e,r,n)}function _(e,t,r,n){return $(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function w(e,t,r,n){return $(K(t),e,r,n)}function R(e,t,r,n){return $(function(e,t){let r,n,i;const o=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)r=e.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function C(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function T(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const t=e[i];let o=null,a=t>239?4:t>223?3:t>191?2:1;if(i+a<=r){let r,n,s,c;switch(a){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[i+1],n=e[i+2],s=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&s,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=a}return function(e){const t=e.length;if(t<=x)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=x));return r}(n)}t.kMaxLength=a,c.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,r){return function(e,t,r){return l(e),e<=0?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)}(e,t,r)},c.allocUnsafe=function(e){return d(e)},c.allocUnsafeSlow=function(e){return d(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(J(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),J(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=c.allocUnsafe(t);let i=0;for(r=0;r<e.length;++r){let t=e[r];if(J(t,Uint8Array))i+t.length>n.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},c.byteLength=v,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)g(this,t,t+1);return this},c.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},c.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?T(this,0,e):m.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,i){if(J(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0);const s=Math.min(o,a),u=this.slice(n,i),l=e.slice(t,r);for(let e=0;e<s;++e)if(u[e]!==l[e]){o=u[e],a=l[e];break}return o<a?-1:a<o?1:0},c.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},c.prototype.indexOf=function(e,t,r){return y(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return y(this,e,t,r,!1)},c.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":case"latin1":case"binary":return _(this,e,t,r);case"base64":return w(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const x=4096;function k(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function I(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function A(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=Q[e[n]];return i}function O(e,t,r){const n=e.slice(t,r);let i="";for(let e=0;e<n.length-1;e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}function L(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function N(e,t,r,n,i){V(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,r}function P(e,t,r,n,i){V(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a>>=8,e[r+2]=a,a>>=8,e[r+1]=a,a>>=8,e[r]=a,r+8}function D(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function F(e,t,r,n,o){return t=+t,r>>>=0,o||D(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function U(e,t,r,n,o){return t=+t,r>>>=0,o||D(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,c.prototype),n},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return n},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=X((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),c.prototype.readBigUInt64BE=X((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=X((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),c.prototype.readBigInt64BE=X((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){M(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){M(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=X((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=X((function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=0,o=1,a=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=r-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=X((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=X((function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,r){return F(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return F(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);const i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},c.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!c.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{const o=c.isBuffer(e)?e:c.from(e,n),a=o.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%a]}return this};const j={};function B(e,t,r){j[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function q(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function V(e,t,r,n,i,o){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new j.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||W(t,e.length-(r+1))}(n,i,o)}function G(e,t){if("number"!=typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,r){if(Math.floor(e)!==e)throw G(e,r),new j.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}B("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),B("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),B("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=q(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=q(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const z=/[^+/0-9A-Za-z-_]/g;function H(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let a=0;a<n;++a){if(r=e.charCodeAt(a),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function K(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function $(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function J(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!=e}const Q=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function X(e){return"undefined"==typeof BigInt?Z:e}function Z(){throw new Error("BigInt not supported")}},21924:(e,t,r)=>{"use strict";var n=r(40210),i=r(55559),o=i(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&o(e,".prototype.")>-1?i(r):r}},55559:(e,t,r)=>{"use strict";var n=r(58612),i=r(40210),o=r(67771),a=i("%TypeError%"),s=i("%Function.prototype.apply%"),c=i("%Function.prototype.call%"),u=i("%Reflect.apply%",!0)||n.call(c,s),l=i("%Object.defineProperty%",!0),d=i("%Math.max%");if(l)try{l({},"a",{value:1})}catch(e){l=null}e.exports=function(e){if("function"!=typeof e)throw new a("a function is required");var t=u(n,c,arguments);return o(t,1+d(0,e.length-(arguments.length-1)),!0)};var f=function(){return u(n,s,arguments)};l?l(e.exports,"apply",{value:f}):e.exports.apply=f},78249:function(e,t,r){var n;e.exports=(n=n||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==r.g&&r.g.crypto&&(n=r.g.crypto),!n)try{n=r(42480)}catch(e){}var i=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),a={},s=a.lib={},c=s.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=s.WordArray=c.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||d).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var a=r[o>>>2]>>>24-o%4*8&255;t[n+o>>>2]|=a<<24-(n+o)%4*8}else for(var s=0;s<i;s+=4)t[n+s>>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(i());return new u.init(t,e)}}),l=a.enc={},d=l.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new u.init(r,t/2)}},f=l.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new u.init(r,t)}},h=l.Utf8={stringify:function(e){try{return decodeURIComponent(escape(f.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return f.parse(unescape(encodeURIComponent(e)))}},p=s.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=h.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,o=n.sigBytes,a=this.blockSize,s=o/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,l=e.min(4*c,o);if(c){for(var d=0;d<c;d+=a)this._doProcessBlock(i,d);r=i.splice(0,c),n.sigBytes-=l}return new u.init(r,l)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),v=(s.Hasher=p.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new v.HMAC.init(e,r).finalize(t)}}}),a.algo={});return a}(Math),n)},52153:function(e,t,r){var n;e.exports=(n=r(78249),function(e){var t=n,r=t.lib,i=r.WordArray,o=r.Hasher,a=t.algo,s=[],c=[];!function(){function t(t){for(var r=e.sqrt(t),n=2;n<=r;n++)if(!(t%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)t(n)&&(i<8&&(s[i]=r(e.pow(n,.5))),c[i]=r(e.pow(n,1/3)),i++),n++}();var u=[],l=a.SHA256=o.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],l=r[5],d=r[6],f=r[7],h=0;h<64;h++){if(h<16)u[h]=0|e[t+h];else{var p=u[h-15],v=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,m=u[h-2],g=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;u[h]=v+u[h-7]+g+u[h-16]}var y=n&i^n&o^i&o,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),E=f+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&l^~s&d)+c[h]+u[h];f=d,d=l,l=s,s=a+E|0,a=o,o=i,i=n,n=E+(b+y)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+s|0,r[5]=r[5]+l|0,r[6]=r[6]+d|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=e.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),n.SHA256)},12296:(e,t,r)=>{"use strict";var n=r(31044)(),i=r(40210),o=n&&i("%Object.defineProperty%",!0);if(o)try{o({},"a",{value:1})}catch(e){o=!1}var a=i("%SyntaxError%"),s=i("%TypeError%"),c=r(27296);e.exports=function(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new s("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new s("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new s("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new s("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new s("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new s("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,i=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,l=arguments.length>6&&arguments[6],d=!!c&&c(e,t);if(o)o(e,t,{configurable:null===u&&d?d.configurable:!u,enumerable:null===n&&d?d.enumerable:!n,value:r,writable:null===i&&d?d.writable:!i});else{if(!l&&(n||i||u))throw new a("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}}},35015:(e,t,r)=>{"use strict";var n=r(89509).Buffer,i=r(6972),o=128;function a(e){if(n.isBuffer(e))return e;if("string"==typeof e)return n.from(e,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function s(e,t,r){for(var n=0;t+n<r&&0===e[t+n];)++n;return e[t+n]>=o&&--n,n}e.exports={derToJose:function(e,t){e=a(e);var r=i(t),s=r+1,c=e.length,u=0;if(48!==e[u++])throw new Error('Could not find expected "seq"');var l=e[u++];if(l===(1|o)&&(l=e[u++]),c-u<l)throw new Error('"seq" specified length of "'+l+'", only "'+(c-u)+'" remaining');if(2!==e[u++])throw new Error('Could not find expected "int" for "r"');var d=e[u++];if(c-u-2<d)throw new Error('"r" specified length of "'+d+'", only "'+(c-u-2)+'" available');if(s<d)throw new Error('"r" specified length of "'+d+'", max of "'+s+'" is acceptable');var f=u;if(u+=d,2!==e[u++])throw new Error('Could not find expected "int" for "s"');var h=e[u++];if(c-u!==h)throw new Error('"s" specified length of "'+h+'", expected "'+(c-u)+'"');if(s<h)throw new Error('"s" specified length of "'+h+'", max of "'+s+'" is acceptable');var p=u;if((u+=h)!==c)throw new Error('Expected to consume entire buffer, but "'+(c-u)+'" bytes remain');var v=r-d,m=r-h,g=n.allocUnsafe(v+d+m+h);for(u=0;u<v;++u)g[u]=0;e.copy(g,u,f+Math.max(-v,0),f+d);for(var y=u=r;u<y+m;++u)g[u]=0;return e.copy(g,u,p+Math.max(-m,0),p+h),g=(g=g.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(e,t){e=a(e);var r=i(t),c=e.length;if(c!==2*r)throw new TypeError('"'+t+'" signatures must be "'+2*r+'" bytes, saw "'+c+'"');var u=s(e,0,r),l=s(e,r,e.length),d=r-u,f=r-l,h=2+d+1+1+f,p=h<o,v=n.allocUnsafe((p?2:3)+h),m=0;return v[m++]=48,p?v[m++]=h:(v[m++]=1|o,v[m++]=255&h),v[m++]=2,v[m++]=d,u<0?(v[m++]=0,m+=e.copy(v,m,0,r)):m+=e.copy(v,m,u,r),v[m++]=2,v[m++]=f,l<0?(v[m++]=0,e.copy(v,m,r)):e.copy(v,m,r+l),v}}},6972:e=>{"use strict";function t(e){return(e/8|0)+(e%8==0?0:1)}var r={ES256:t(256),ES384:t(384),ES512:t(521)};e.exports=function(e){var t=r[e];if(t)return t;throw new Error('Unknown algorithm "'+e+'"')}},17187:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}v(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&v(e,"error",t,r)}(e,i,{once:!0})}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var i,o,a,u;if(s(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=c(e))>0&&a.length>i&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=l.bind(n);return i.listener=r,n.wrapFn=i,i}function f(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):p(i,i.length)}function h(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function v(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),o.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},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var u=c.length,l=p(c,u);for(r=0;r<u;++r)n(l[r],this,t)}return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return s(t),this.on(e,d(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,d(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,o,a;if(s(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return f(this,e,!0)},o.prototype.rawListeners=function(e){return f(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},o.prototype.listenerCount=h,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},40001:(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";const Token=__webpack_require__(83416),strtok3=__webpack_require__(35849),{stringToBytes,tarHeaderChecksumMatches,uint32SyncSafeToken}=__webpack_require__(76188),supported=__webpack_require__(49898),minimumBytes=4100;async function fromStream(e){const t=await strtok3.fromStream(e);try{return await fromTokenizer(t)}finally{await t.close()}}async function fromBuffer(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer||Buffer.isBuffer(e)))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof e}\``);const t=e instanceof Buffer?e:Buffer.from(e);if(!(t&&t.length>1))return;return fromTokenizer(strtok3.fromBuffer(t))}function _check(e,t,r){r={offset:0,...r};for(const[n,i]of t.entries())if(r.mask){if(i!==(r.mask[n]&e[n+r.offset]))return!1}else if(i!==e[n+r.offset])return!1;return!0}async function fromTokenizer(e){try{return _fromTokenizer(e)}catch(e){if(!(e instanceof strtok3.EndOfStreamError))throw e}}async function _fromTokenizer(e){let t=Buffer.alloc(minimumBytes);const r=(e,r)=>_check(t,e,r),n=(e,t)=>r(stringToBytes(e),t);if(e.fileInfo.size||(e.fileInfo.size=Number.MAX_SAFE_INTEGER),await e.peekBuffer(t,{length:12,mayBeLess:!0}),r([66,77]))return{ext:"bmp",mime:"image/bmp"};if(r([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(r([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(r([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(r([37,33]))return await e.peekBuffer(t,{length:24,mayBeLess:!0}),n("PS-Adobe-",{offset:2})&&n(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(r([31,160])||r([31,157]))return{ext:"Z",mime:"application/x-compress"};if(r([255,216,255]))return{ext:"jpg",mime:"image/jpeg"};if(r([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(r([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(r([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(n("ID3")){await e.ignore(6);const i=await e.readToken(uint32SyncSafeToken);return e.position+i>e.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await e.ignore(i),fromTokenizer(e))}if(n("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((67===t[0]||70===t[0])&&r([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(r([71,73,70]))return{ext:"gif",mime:"image/gif"};if(n("FLIF"))return{ext:"flif",mime:"image/flif"};if(n("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(n("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(n("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(n("FORM"))return{ext:"aif",mime:"audio/aiff"};if(n("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(r([80,75,3,4])){try{for(;e.position+30<e.fileInfo.size;){await e.readBuffer(t,{length:30});const o={compressedSize:t.readUInt32LE(18),uncompressedSize:t.readUInt32LE(22),filenameLength:t.readUInt16LE(26),extraFieldLength:t.readUInt16LE(28)};if(o.filename=await e.readToken(new Token.StringType(o.filenameLength,"utf-8")),await e.ignore(o.extraFieldLength),"META-INF/mozilla.rsa"===o.filename)return{ext:"xpi",mime:"application/x-xpinstall"};if(o.filename.endsWith(".rels")||o.filename.endsWith(".xml")){switch(o.filename.split("/")[0]){case"_rels":default:break;case"word":return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};case"ppt":return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};case"xl":return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}}}if(o.filename.startsWith("xl/"))return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(o.filename.startsWith("3D/")&&o.filename.endsWith(".model"))return{ext:"3mf",mime:"model/3mf"};if("mimetype"===o.filename&&o.compressedSize===o.uncompressedSize){switch(await e.readToken(new Token.StringType(o.compressedSize,"utf-8"))){case"application/epub+zip":return{ext:"epub",mime:"application/epub+zip"};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:"application/vnd.oasis.opendocument.text"};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:"application/vnd.oasis.opendocument.spreadsheet"};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:"application/vnd.oasis.opendocument.presentation"}}}if(0===o.compressedSize){let a=-1;for(;a<0&&e.position<e.fileInfo.size;)await e.peekBuffer(t,{mayBeLess:!0}),a=t.indexOf("504B0304",0,"hex"),await e.ignore(a>=0?a:t.length)}else await e.ignore(o.compressedSize)}}catch(s){if(!(s instanceof strtok3.EndOfStreamError))throw s}return{ext:"zip",mime:"application/zip"}}if(n("OggS")){await e.ignore(28);const c=Buffer.alloc(8);return await e.readBuffer(c),_check(c,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/opus"}:_check(c,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:_check(c,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:_check(c,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:_check(c,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:_check(c,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(r([80,75])&&(3===t[2]||5===t[2]||7===t[2])&&(4===t[3]||6===t[3]||8===t[3]))return{ext:"zip",mime:"application/zip"};if(n("ftyp",{offset:4})&&0!=(96&t[8])){const u=t.toString("binary",8,12).replace("\0"," ").trim();switch(u){case"avif":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return u.startsWith("3g")?u.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(n("MThd"))return{ext:"mid",mime:"audio/midi"};if(n("wOFF")&&(r([0,1,0,0],{offset:4})||n("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(n("wOF2")&&(r([0,1,0,0],{offset:4})||n("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(r([212,195,178,161])||r([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(n("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(n("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(n("fLaC"))return{ext:"flac",mime:"audio/x-flac"};if(r([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(n("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(n("%PDF")){await e.ignore(1350);const l=10485760,d=Buffer.alloc(Math.min(l,e.fileInfo.size));return await e.readBuffer(d,{mayBeLess:!0}),d.includes(Buffer.from("AIPrivateData"))?{ext:"ai",mime:"application/postscript"}:{ext:"pdf",mime:"application/pdf"}}if(r([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(r([73,73,42,0]))return n("CR",{offset:8})?{ext:"cr2",mime:"image/x-canon-cr2"}:r([28,0,254,0],{offset:8})||r([31,0,11,0],{offset:8})?{ext:"nef",mime:"image/x-nikon-nef"}:r([8,0,0,0],{offset:4})&&(r([45,0,254,0],{offset:8})||r([39,0,254,0],{offset:8}))?{ext:"dng",mime:"image/x-adobe-dng"}:(t=Buffer.alloc(24),await e.peekBuffer(t),(r([16,251,134,1],{offset:4})||r([8,0,0,0],{offset:4}))&&r([0,254,0,4,0,1,0,0,0,1,0,0,0,3,1],{offset:9})?{ext:"arw",mime:"image/x-sony-arw"}:{ext:"tif",mime:"image/tiff"});if(r([77,77,0,42]))return{ext:"tif",mime:"image/tiff"};if(n("MAC "))return{ext:"ape",mime:"audio/ape"};if(r([26,69,223,163])){async function f(){const t=await e.peekNumber(Token.UINT8);let r=128,n=0;for(;0==(t&r)&&0!==r;)++n,r>>=1;const i=Buffer.alloc(n+1);return await e.readBuffer(i),i}async function h(){const e=await f(),t=await f();t[0]^=128>>t.length-1;const r=Math.min(6,t.length);return{id:e.readUIntBE(0,e.length),len:t.readUIntBE(t.length-r,r)}}async function p(t,r){for(;r>0;){const t=await h();if(17026===t.id)return e.readToken(new Token.StringType(t.len,"utf-8"));await e.ignore(t.len),--r}}const v=await h();switch(await p(0,v.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/x-matroska"};default:return}}if(r([82,73,70,70])){if(r([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(r([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/vnd.wave"};if(r([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(n("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(r([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(n("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(n("MSCF")||n("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(r([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(r([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(r([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(r([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(n("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(n("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(r([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(n("IMPM"))return{ext:"it",mime:"audio/x-it"};if(n("-lh0-",{offset:2})||n("-lh1-",{offset:2})||n("-lh2-",{offset:2})||n("-lh3-",{offset:2})||n("-lh4-",{offset:2})||n("-lh5-",{offset:2})||n("-lh6-",{offset:2})||n("-lh7-",{offset:2})||n("-lzs-",{offset:2})||n("-lz4-",{offset:2})||n("-lz5-",{offset:2})||n("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(r([0,0,1,186])){if(r([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(r([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(n("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(r([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(n("<?xml "))return{ext:"xml",mime:"application/xml"};if(r([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(r([82,97,114,33,26,7])&&(0===t[6]||1===t[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(n("solid "))return{ext:"stl",mime:"model/stl"};if(n("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(n("!<arch>")){await e.ignore(8);return"debian-binary"===await e.readToken(new Token.StringType(13,"ascii"))?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"}}if(r([137,80,78,71,13,10,26,10])){async function m(){return{length:await e.readToken(Token.INT32_BE),type:await e.readToken(new Token.StringType(4,"binary"))}}await e.ignore(8);do{const g=await m();if(g.length<0)return;switch(g.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await e.ignore(g.length+4)}}while(e.position+8<e.fileInfo.size);return{ext:"png",mime:"image/png"}}if(r([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/x-apache-arrow"};if(r([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(r([102,114,101,101],{offset:4})||r([109,100,97,116],{offset:4})||r([109,111,111,118],{offset:4})||r([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(r([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(n("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(r([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(r([48,38,178,117,142,102,207,17,166,217])){async function y(){const t=Buffer.alloc(16);return await e.readBuffer(t),{id:t,size:Number(await e.readToken(Token.UINT64_LE))}}for(await e.ignore(30);e.position+24<e.fileInfo.size;){const b=await y();let E=b.size-24;if(_check(b.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){const S=Buffer.alloc(16);if(E-=await e.readBuffer(S),_check(S,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(_check(S,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}await e.ignore(E)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(r([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((r([126,16,4])||r([126,24,4]))&&r([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(r([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(r([0,0,0,12,106,80,32,32,13,10,135,10])){await e.ignore(20);switch(await e.readToken(new Token.StringType(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}}if(r([255,10])||r([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(r([0,0,1,186])||r([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(r([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(r([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(r([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(r([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await e.peekBuffer(t,{length:Math.min(256,e.fileInfo.size),mayBeLess:!0}),n("BEGIN:")){if(n("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(n("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(n("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(n("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(n("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(r([4,0,0,0])&&t.length>=16){const _=t.readUInt32LE(12);if(_>12&&t.length>=_+16)try{const w=t.slice(16,_+16).toString();if(JSON.parse(w).files)return{ext:"asar",mime:"application/x-asar"}}catch(R){}}if(r([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(n("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(r([71],{offset:4})&&(r([71],{offset:192})||r([71],{offset:196})))return{ext:"mts",mime:"video/mp2t"};if(r([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(r([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(r([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(r([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(r([76,80],{offset:34})&&(r([0,0,1],{offset:8})||r([1,0,2],{offset:8})||r([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(r([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(await e.peekBuffer(t,{length:Math.min(512,e.fileInfo.size),mayBeLess:!0}),tarHeaderChecksumMatches(t))return{ext:"tar",mime:"application/x-tar"};if(r([255,254,255,14,83,0,107,0,101,0,116,0,99,0,104,0,85,0,112,0,32,0,77,0,111,0,100,0,101,0,108,0]))return{ext:"skp",mime:"application/vnd.sketchup.skp"};if(n("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"};if(t.length>=2&&r([255,224],{offset:0,mask:[255,224]})){if(r([16],{offset:1,mask:[22]}))return r([8],{offset:1,mask:[8]}),{ext:"aac",mime:"audio/aac"};if(r([2],{offset:1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(r([4],{offset:1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(r([6],{offset:1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}const stream=readableStream=>new Promise(((resolve,reject)=>{const stream=eval("require")("stream");readableStream.on("error",reject),readableStream.once("readable",(async()=>{const e=new stream.PassThrough;let t;t=stream.pipeline?stream.pipeline(readableStream,e,(()=>{})):readableStream.pipe(e);const r=readableStream.read(minimumBytes)||readableStream.read()||Buffer.alloc(0);try{const t=await fromBuffer(r);e.fileType=t}catch(e){reject(e)}resolve(t)}))})),fileType={fromStream,fromTokenizer,fromBuffer,stream};Object.defineProperty(fileType,"extensions",{get:()=>new Set(supported.extensions)}),Object.defineProperty(fileType,"mimeTypes",{get:()=>new Set(supported.mimeTypes)}),module.exports=fileType},97769:(e,t,r)=>{"use strict";const n=r(26597),i=r(40001);const o={fromFile:async function(e){const t=await n.fromFile(e);try{return await i.fromTokenizer(t)}finally{await t.close()}}};Object.assign(o,i),Object.defineProperty(o,"extensions",{get:()=>i.extensions}),Object.defineProperty(o,"mimeTypes",{get:()=>i.mimeTypes}),e.exports=o},49898:e=>{"use strict";e.exports={extensions:["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","ai","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf"],mimeTypes:["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/x-apache-arrow","video/mp4","audio/midi","video/x-matroska","video/webm","video/quicktime","video/vnd.avi","audio/vnd.wave","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","audio/opus","video/ogg","audio/ogg","application/ogg","audio/x-flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd"]}},76188:(e,t)=>{"use strict";t.stringToBytes=e=>[...e].map((e=>e.charCodeAt(0))),t.tarHeaderChecksumMatches=(e,t=0)=>{const r=parseInt(e.toString("utf8",148,154).replace(/\0.*$/,"").trim(),8);if(isNaN(r))return!1;let n=256;for(let r=t;r<t+148;r++)n+=e[r];for(let r=t+156;r<t+512;r++)n+=e[r];return r===n},t.uint32SyncSafeToken={get:(e,t)=>127&e[t+3]|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4}},94029:(e,t,r)=>{"use strict";var n=r(95320),i=Object.prototype.toString,o=Object.prototype.hasOwnProperty;e.exports=function(e,t,r){if(!n(t))throw new TypeError("iterator must be a function");var a;arguments.length>=3&&(a=r),"[object Array]"===i.call(e)?function(e,t,r){for(var n=0,i=e.length;n<i;n++)o.call(e,n)&&(null==r?t(e[n],n,e):t.call(r,e[n],n,e))}(e,t,a):"string"==typeof e?function(e,t,r){for(var n=0,i=e.length;n<i;n++)null==r?t(e.charAt(n),n,e):t.call(r,e.charAt(n),n,e)}(e,t,a):function(e,t,r){for(var n in e)o.call(e,n)&&(null==r?t(e[n],n,e):t.call(r,e[n],n,e))}(e,t,a)}},17648:e=>{"use strict";var t=Object.prototype.toString,r=Math.max,n=function(e,t){for(var r=[],n=0;n<e.length;n+=1)r[n]=e[n];for(var i=0;i<t.length;i+=1)r[i+e.length]=t[i];return r};e.exports=function(e){var i=this;if("function"!=typeof i||"[object Function]"!==t.apply(i))throw new TypeError("Function.prototype.bind called on incompatible "+i);for(var o,a=function(e,t){for(var r=[],n=t||0,i=0;n<e.length;n+=1,i+=1)r[i]=e[n];return r}(arguments,1),s=r(0,i.length-a.length),c=[],u=0;u<s;u++)c[u]="$"+u;if(o=Function("binder","return function ("+function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r}(c,",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof o){var t=i.apply(this,n(a,arguments));return Object(t)===t?t:this}return i.apply(e,n(a,arguments))})),i.prototype){var l=function(){};l.prototype=i.prototype,o.prototype=new l,l.prototype=null}return o}},58612:(e,t,r)=>{"use strict";var n=r(17648);e.exports=Function.prototype.bind||n},40210:(e,t,r)=>{"use strict";var n,i=SyntaxError,o=Function,a=TypeError,s=function(e){try{return o('"use strict"; return ('+e+").constructor;")()}catch(e){}},c=Object.getOwnPropertyDescriptor;if(c)try{c({},"")}catch(e){c=null}var u=function(){throw new a},l=c?function(){try{return u}catch(e){try{return c(arguments,"callee").get}catch(e){return u}}}():u,d=r(41405)(),f=r(28185)(),h=Object.getPrototypeOf||(f?function(e){return e.__proto__}:null),p={},v="undefined"!=typeof Uint8Array&&h?h(Uint8Array):n,m={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":d&&h?h([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":p,"%AsyncGenerator%":p,"%AsyncGeneratorFunction%":p,"%AsyncIteratorPrototype%":p,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":p,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":d&&h?h(h([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&d&&h?h((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&d&&h?h((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":d&&h?h(""[Symbol.iterator]()):n,"%Symbol%":d?Symbol:n,"%SyntaxError%":i,"%ThrowTypeError%":l,"%TypedArray%":v,"%TypeError%":a,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet};if(h)try{null.error}catch(e){var g=h(h(e));m["%Error.prototype%"]=g}var y=function e(t){var r;if("%AsyncFunction%"===t)r=s("async function () {}");else if("%GeneratorFunction%"===t)r=s("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=s("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=e("%AsyncGenerator%");i&&h&&(r=h(i.prototype))}return m[t]=r,r},b={"%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"]},E=r(58612),S=r(48824),_=E.call(Function.call,Array.prototype.concat),w=E.call(Function.apply,Array.prototype.splice),R=E.call(Function.call,String.prototype.replace),C=E.call(Function.call,String.prototype.slice),T=E.call(Function.call,RegExp.prototype.exec),x=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,k=/\\(\\)?/g,I=function(e,t){var r,n=e;if(S(b,n)&&(n="%"+(r=b[n])[0]+"%"),S(m,n)){var o=m[n];if(o===p&&(o=y(n)),void 0===o&&!t)throw new a("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:o}}throw new i("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new a('"allowMissing" argument must be a boolean');if(null===T(/^%?[^%]*%?$/,e))throw new i("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(e){var t=C(e,0,1),r=C(e,-1);if("%"===t&&"%"!==r)throw new i("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new i("invalid intrinsic syntax, expected opening `%`");var n=[];return R(e,x,(function(e,t,r,i){n[n.length]=r?R(i,k,"$1"):t||e})),n}(e),n=r.length>0?r[0]:"",o=I("%"+n+"%",t),s=o.name,u=o.value,l=!1,d=o.alias;d&&(n=d[0],w(r,_([0,1],d)));for(var f=1,h=!0;f<r.length;f+=1){var p=r[f],v=C(p,0,1),g=C(p,-1);if(('"'===v||"'"===v||"`"===v||'"'===g||"'"===g||"`"===g)&&v!==g)throw new i("property names with quotes must have matching quotes");if("constructor"!==p&&h||(l=!0),S(m,s="%"+(n+="."+p)+"%"))u=m[s];else if(null!=u){if(!(p in u)){if(!t)throw new a("base intrinsic for "+e+" exists, but the property is not available.");return}if(c&&f+1>=r.length){var y=c(u,p);u=(h=!!y)&&"get"in y&&!("originalValue"in y.get)?y.get:u[p]}else h=S(u,p),u=u[p];h&&!l&&(m[s]=u)}}return u}},58908:(e,t,r)=>{var n;n="undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:{},e.exports=n},27296:(e,t,r)=>{"use strict";var n=r(40210)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(e){n=null}e.exports=n},31044:(e,t,r)=>{"use strict";var n=r(40210)("%Object.defineProperty%",!0),i=function(){if(n)try{return n({},"a",{value:1}),!0}catch(e){return!1}return!1};i.hasArrayLengthDefineBug=function(){if(!i())return null;try{return 1!==n([],"length",{value:1}).length}catch(e){return!0}},e.exports=i},28185:e=>{"use strict";var t={foo:{}},r=Object;e.exports=function(){return{__proto__:t}.foo===t.foo&&!({__proto__:null}instanceof r)}},41405:(e,t,r)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=r(55419);e.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},55419:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},96410:(e,t,r)=>{"use strict";var n=r(55419);e.exports=function(){return n()&&!!Symbol.toStringTag}},48824:(e,t,r)=>{"use strict";var n=Function.prototype.call,i=Object.prototype.hasOwnProperty,o=r(58612);e.exports=o.call(n,i)},80645:(e,t)=>{t.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,c=(1<<s)-1,u=c>>1,l=-7,d=r?i-1:0,f=r?-1:1,h=e[t+d];for(d+=f,o=h&(1<<-l)-1,h>>=-l,l+=s;l>0;o=256*o+e[t+d],d+=f,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+e[t+d],d+=f,l-=8);if(0===o)o=1-u;else{if(o===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,n),o-=u}return(h?-1:1)*a*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var a,s,c,u=8*o-i-1,l=(1<<u)-1,d=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[r+h]=255&s,h+=p,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;e[r+h]=255&a,h+=p,a/=256,u-=8);e[r+h-p]|=128*v}},35717:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},93917:e=>{var t=function(e){if(!e.match(/^([0-9]{1,3}\.){3}[0-9]{1,3}$/))return!1;var t=e.split(".");for(let e of t){if(Number(e)>255)return!1}return!0},r=function(e,t=8){if("::"===(e=e.toLowerCase()))return!0;if(!e.match(/^([0-9a-f]{0,4}:?){2,8}$/))return!1;if(":"===e[e.length-1]&&":"!==e[e.length-2])return!1;if(e.split("::").length>2)return!1;if(1===e.split("::").length&&e.split(":").length!==t)return!1;if(2===e.split("::").length){var r=e.split("::")[1];r=r.split(":");for(let e=0;e<r.length-1;e++)if(""===r[e])return!1}return!0},n=function(e){var[n,i]=d(e);return r(n,6)&&t(i)},i=function(e,t,r="0"){for(;e.length<t;)e+=r;return e},o=function(e,t,r="0"){for(;e.length<t;)e=r+e;return e},a=function(e,t){for(var r=[];e.length>0;){var n=e.substring(0,t);r.push(n),e=e.substring(t)}return r},s=function(e){return Number(e).toString(2)},c=function(e){return parseInt(e,2)},u=function(e){return e.split(".").map((e=>o(s(e),8))).join("")},l=function(e){return e.toString(16)},d=function(e){var t=e.lastIndexOf(":"),r=e.substring(0,t),n=e.substring(t+1);return":"===r[r.length-1]&&(r+=":"),[r,n]},f=function(e){var[t,r]=d(e),[n,i]=t.split("::");for(n=n.split(":"),i=void 0!==i?i.split(":"):[];n.length+i.length<6;)n.push("0");var a=n.concat(i);for(let e=0;e<a.length;e++)0===a[e].length&&(a[e]="0");return a.map((e=>parseInt(e,16))).map((e=>o(s(e),16))).join("")+u(r)},h=function(e){return a(e,8).map(c).join(".")},p=function(e){var t=function(e){var t=e.split(":"),r=0,n=null,i=!1,o=0,a=null;for(let e=0;e<t.length;e++)i?"0"===t[e]?o++:(o>r&&(r=o,n=a),i=!1,o=0,a=null):"0"===t[e]&&(i=!0,o=1,a=e);return null!==a&&o>r&&(r=o,n=a),r<2?e:t.slice(0,n).join(":")+"::"+t.slice(n+r).join(":")}(a(e,16).map(c).map(l).join(":"));return t},v=function(e,t){var r=function(e){var[t,r]=e.split("::");for(t=t.split(":"),r=void 0!==r?r.split(":"):[];t.length+r.length<8;)t.push("0");var n=t.concat(r);for(let e=0;e<n.length;e++)0===n[e].length&&(n[e]="0");return n.map((e=>parseInt(e,16))).map((e=>o(s(e),16))).join("")}(e),n=r.substring(0,t),a=i(n,128);return p(a)},m=function(e,t){var r,n,o,a,s,c,u=f(e).substring(0,t),l=i(u,128);return n=(r=l).substring(0,96),o=r.substring(96),a=p(n),s=h(o),":"!==(c=a)[c.length-1]&&(c+=":"),c+s};e.exports=function(e,o=24,a=24){if("string"!=typeof e)return null;var s=function(e){return t(e)?"IPv4":r(e)?"IPv6":n(e)?"IPv6_4":"None"}(e=e.trim().toLowerCase());return"IPv4"===s?function(e,t){var r=u(e).substring(0,t),n=i(r,32);return h(n)}(e,o):"IPv6"===s?v(e,a):"IPv6_4"===s?function(e){return n(e)&&(!f(e).substring(0,96).includes("1")||!f(e).substring(0,80).includes("1")&&!f(e).substring(80,96).includes("0"))}(e)?m(e,o+96):m(e,a):null}},82584:(e,t,r)=>{"use strict";var n=r(96410)(),i=r(21924)("Object.prototype.toString"),o=function(e){return!(n&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===i(e)},a=function(e){return!!o(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==i(e)&&"[object Function]"===i(e.callee)},s=function(){return o(arguments)}();o.isLegacyArguments=a,e.exports=s?o:a},95320:e=>{"use strict";var t,r,n=Function.prototype.toString,i="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof i&&"function"==typeof Object.defineProperty)try{t=Object.defineProperty({},"length",{get:function(){throw r}}),r={},i((function(){throw 42}),null,t)}catch(e){e!==r&&(i=null)}else i=null;var o=/^\s*class\b/,a=function(e){try{var t=n.call(e);return o.test(t)}catch(e){return!1}},s=function(e){try{return!a(e)&&(n.call(e),!0)}catch(e){return!1}},c=Object.prototype.toString,u="function"==typeof Symbol&&!!Symbol.toStringTag,l=!(0 in[,]),d=function(){return!1};if("object"==typeof document){var f=document.all;c.call(f)===c.call(document.all)&&(d=function(e){if((l||!e)&&(void 0===e||"object"==typeof e))try{var t=c.call(e);return("[object HTMLAllCollection]"===t||"[object HTML document.all class]"===t||"[object HTMLCollection]"===t||"[object Object]"===t)&&null==e("")}catch(e){}return!1})}e.exports=i?function(e){if(d(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;try{i(e,null,t)}catch(e){if(e!==r)return!1}return!a(e)&&s(e)}:function(e){if(d(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(u)return s(e);if(a(e))return!1;var t=c.call(e);return!("[object Function]"!==t&&"[object GeneratorFunction]"!==t&&!/^\[object HTML/.test(t))&&s(e)}},27376:e=>{e.exports=function(e){if(!e)return!1;var r=t.call(e);return"[object Function]"===r||"function"==typeof e&&"[object RegExp]"!==r||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)};var t=Object.prototype.toString},48662:(e,t,r)=>{"use strict";var n,i=Object.prototype.toString,o=Function.prototype.toString,a=/^\s*(?:function)?\*/,s=r(96410)(),c=Object.getPrototypeOf;e.exports=function(e){if("function"!=typeof e)return!1;if(a.test(o.call(e)))return!0;if(!s)return"[object GeneratorFunction]"===i.call(e);if(!c)return!1;if(void 0===n){var t=function(){if(!s)return!1;try{return Function("return function*() {}")()}catch(e){}}();n=!!t&&c(t)}return c(e)===n}},85692:(e,t,r)=>{"use strict";var n=r(86430);e.exports=function(e){return!!n(e)}},97626:(e,t,r)=>{var n=r(40158);e.exports=function(e,t){t=t||{};var r=n.decode(e,t);if(!r)return null;var i=r.payload;if("string"==typeof i)try{var o=JSON.parse(i);null!==o&&"object"==typeof o&&(i=o)}catch(e){}return!0===t.complete?{header:r.header,payload:i,signature:r.signature}:i}},49704:(e,t,r)=>{e.exports={decode:r(97626),verify:r(17030),sign:r(22506),JsonWebTokenError:r(58619),NotBeforeError:r(71826),TokenExpiredError:r(2340)}},58619:e=>{var t=function(e,t){Error.call(this,e),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="JsonWebTokenError",this.message=e,t&&(this.inner=t)};(t.prototype=Object.create(Error.prototype)).constructor=t,e.exports=t},71826:(e,t,r)=>{var n=r(58619),i=function(e,t){n.call(this,e),this.name="NotBeforeError",this.date=t};(i.prototype=Object.create(n.prototype)).constructor=i,e.exports=i},2340:(e,t,r)=>{var n=r(58619),i=function(e,t){n.call(this,e),this.name="TokenExpiredError",this.expiredAt=t};(i.prototype=Object.create(n.prototype)).constructor=i,e.exports=i},85599:(e,t,r)=>{var n=r(34155);const i=r(81249);e.exports=i.satisfies(n.version,">=15.7.0")},14964:(e,t,r)=>{var n=r(34155),i=r(81249);e.exports=i.satisfies(n.version,"^6.12.0 || >=8.0.0")},91564:(e,t,r)=>{var n=r(34155);const i=r(81249);e.exports=i.satisfies(n.version,">=16.9.0")},68034:(e,t,r)=>{var n=r(57824);e.exports=function(e,t){var r=t||Math.floor(Date.now()/1e3);if("string"==typeof e){var i=n(e);if(void 0===i)return;return Math.floor(r+i/1e3)}return"number"==typeof e?r+e:void 0}},47566:(e,t,r)=>{const n=r(85599),i=r(91564),o={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},a={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};e.exports=function(e,t){if(!e||!t)return;const r=t.asymmetricKeyType;if(!r)return;const s=o[r];if(!s)throw new Error(`Unknown key type "${r}".`);if(!s.includes(e))throw new Error(`"alg" parameter for "${r}" key type must be one of: ${s.join(", ")}.`);if(n)switch(r){case"ec":const r=t.asymmetricKeyDetails.namedCurve,n=a[e];if(r!==n)throw new Error(`"alg" parameter "${e}" requires curve "${n}".`);break;case"rsa-pss":if(i){const r=parseInt(e.slice(-3),10),{hashAlgorithm:n,mgf1HashAlgorithm:i,saltLength:o}=t.asymmetricKeyDetails;if(n!==`sha${r}`||i!==n)throw new Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}.`);if(void 0!==o&&o>r>>3)throw new Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}.`)}}}},22506:(e,t,r)=>{const n=r(68034),i=r(14964),o=r(47566),a=r(40158),s=r(28922),c=r(48094),u=r(55928),l=r(23126),d=r(8146),f=r(25751),h=r(38917),{KeyObject:p,createSecretKey:v,createPrivateKey:m}=r(66507),g=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];i&&g.splice(3,0,"PS256","PS384","PS512");const y={expiresIn:{isValid:function(e){return u(e)||f(e)&&e},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(e){return u(e)||f(e)&&e},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(e){return f(e)||Array.isArray(e)},message:'"audience" must be a string or array'},algorithm:{isValid:s.bind(null,g),message:'"algorithm" must be a valid string enum value'},header:{isValid:d,message:'"header" must be an object'},encoding:{isValid:f,message:'"encoding" must be a string'},issuer:{isValid:f,message:'"issuer" must be a string'},subject:{isValid:f,message:'"subject" must be a string'},jwtid:{isValid:f,message:'"jwtid" must be a string'},noTimestamp:{isValid:c,message:'"noTimestamp" must be a boolean'},keyid:{isValid:f,message:'"keyid" must be a string'},mutatePayload:{isValid:c,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:c,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:c,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},b={iat:{isValid:l,message:'"iat" should be a number of seconds'},exp:{isValid:l,message:'"exp" should be a number of seconds'},nbf:{isValid:l,message:'"nbf" should be a number of seconds'}};function E(e,t,r,n){if(!d(r))throw new Error('Expected "'+n+'" to be a plain object.');Object.keys(r).forEach((function(i){const o=e[i];if(o){if(!o.isValid(r[i]))throw new Error(o.message)}else if(!t)throw new Error('"'+i+'" is not allowed in "'+n+'"')}))}const S={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},_=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];e.exports=function(e,t,r,i){"function"==typeof r?(i=r,r={}):r=r||{};const s="object"==typeof e&&!Buffer.isBuffer(e),c=Object.assign({alg:r.algorithm||"HS256",typ:s?"JWT":void 0,kid:r.keyid},r.header);function u(e){if(i)return i(e);throw e}if(!t&&"none"!==r.algorithm)return u(new Error("secretOrPrivateKey must have a value"));if(null!=t&&!(t instanceof p))try{t=m(t)}catch(e){try{t=v("string"==typeof t?Buffer.from(t):t)}catch(e){return u(new Error("secretOrPrivateKey is not valid key material"))}}if(c.alg.startsWith("HS")&&"secret"!==t.type)return u(new Error(`secretOrPrivateKey must be a symmetric key when using ${c.alg}`));if(/^(?:RS|PS|ES)/.test(c.alg)){if("private"!==t.type)return u(new Error(`secretOrPrivateKey must be an asymmetric key when using ${c.alg}`));if(!r.allowInsecureKeySizes&&!c.alg.startsWith("ES")&&void 0!==t.asymmetricKeyDetails&&t.asymmetricKeyDetails.modulusLength<2048)return u(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`))}if(void 0===e)return u(new Error("payload is required"));if(s){try{!function(e){E(b,!0,e,"payload")}(e)}catch(e){return u(e)}r.mutatePayload||(e=Object.assign({},e))}else{const t=_.filter((function(e){return void 0!==r[e]}));if(t.length>0)return u(new Error("invalid "+t.join(",")+" option for "+typeof e+" payload"))}if(void 0!==e.exp&&void 0!==r.expiresIn)return u(new Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(void 0!==e.nbf&&void 0!==r.notBefore)return u(new Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{!function(e){E(y,!1,e,"options")}(r)}catch(e){return u(e)}if(!r.allowInvalidAsymmetricKeyTypes)try{o(c.alg,t)}catch(e){return u(e)}const l=e.iat||Math.floor(Date.now()/1e3);if(r.noTimestamp?delete e.iat:s&&(e.iat=l),void 0!==r.notBefore){try{e.nbf=n(r.notBefore,l)}catch(e){return u(e)}if(void 0===e.nbf)return u(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(void 0!==r.expiresIn&&"object"==typeof e){try{e.exp=n(r.expiresIn,l)}catch(e){return u(e)}if(void 0===e.exp)return u(new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(S).forEach((function(t){const n=S[t];if(void 0!==r[t]){if(void 0!==e[n])return u(new Error('Bad "options.'+t+'" option. The payload already has an "'+n+'" property.'));e[n]=r[t]}}));const d=r.encoding||"utf8";if("function"!=typeof i){let n=a.sign({header:c,payload:e,secret:t,encoding:d});if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(c.alg)&&n.length<256)throw new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`);return n}i=i&&h(i),a.createSign({header:c,privateKey:t,payload:e,encoding:d}).once("error",i).once("done",(function(e){if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(c.alg)&&e.length<256)return i(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`));i(null,e)}))}},17030:(e,t,r)=>{const n=r(58619),i=r(71826),o=r(2340),a=r(97626),s=r(68034),c=r(47566),u=r(14964),l=r(40158),{KeyObject:d,createSecretKey:f,createPublicKey:h}=r(66507),p=["RS256","RS384","RS512"],v=["ES256","ES384","ES512"],m=["RS256","RS384","RS512"],g=["HS256","HS384","HS512"];u&&(p.splice(p.length,0,"PS256","PS384","PS512"),m.splice(m.length,0,"PS256","PS384","PS512")),e.exports=function(e,t,r,u){let y;if("function"!=typeof r||u||(u=r,r={}),r||(r={}),r=Object.assign({},r),y=u||function(e,t){if(e)throw e;return t},r.clockTimestamp&&"number"!=typeof r.clockTimestamp)return y(new n("clockTimestamp must be a number"));if(void 0!==r.nonce&&("string"!=typeof r.nonce||""===r.nonce.trim()))return y(new n("nonce must be a non-empty string"));if(void 0!==r.allowInvalidAsymmetricKeyTypes&&"boolean"!=typeof r.allowInvalidAsymmetricKeyTypes)return y(new n("allowInvalidAsymmetricKeyTypes must be a boolean"));const b=r.clockTimestamp||Math.floor(Date.now()/1e3);if(!e)return y(new n("jwt must be provided"));if("string"!=typeof e)return y(new n("jwt must be a string"));const E=e.split(".");if(3!==E.length)return y(new n("jwt malformed"));let S;try{S=a(e,{complete:!0})}catch(e){return y(e)}if(!S)return y(new n("invalid token"));const _=S.header;let w;if("function"==typeof t){if(!u)return y(new n("verify must be called asynchronous if secret or public key is provided as a callback"));w=t}else w=function(e,r){return r(null,t)};return w(_,(function(t,a){if(t)return y(new n("error in secret or public key callback: "+t.message));const u=""!==E[2].trim();if(!u&&a)return y(new n("jwt signature is required"));if(u&&!a)return y(new n("secret or public key must be provided"));if(!u&&!r.algorithms)return y(new n('please specify "none" in "algorithms" to verify unsigned tokens'));if(null!=a&&!(a instanceof d))try{a=h(a)}catch(e){try{a=f("string"==typeof a?Buffer.from(a):a)}catch(e){return y(new n("secretOrPublicKey is not valid key material"))}}if(r.algorithms||("secret"===a.type?r.algorithms=g:["rsa","rsa-pss"].includes(a.asymmetricKeyType)?r.algorithms=m:"ec"===a.asymmetricKeyType?r.algorithms=v:r.algorithms=p),-1===r.algorithms.indexOf(S.header.alg))return y(new n("invalid algorithm"));if(_.alg.startsWith("HS")&&"secret"!==a.type)return y(new n(`secretOrPublicKey must be a symmetric key when using ${_.alg}`));if(/^(?:RS|PS|ES)/.test(_.alg)&&"public"!==a.type)return y(new n(`secretOrPublicKey must be an asymmetric key when using ${_.alg}`));if(!r.allowInvalidAsymmetricKeyTypes)try{c(_.alg,a)}catch(e){return y(e)}let w;try{w=l.verify(e,S.header.alg,a)}catch(e){return y(e)}if(!w)return y(new n("invalid signature"));const R=S.payload;if(void 0!==R.nbf&&!r.ignoreNotBefore){if("number"!=typeof R.nbf)return y(new n("invalid nbf value"));if(R.nbf>b+(r.clockTolerance||0))return y(new i("jwt not active",new Date(1e3*R.nbf)))}if(void 0!==R.exp&&!r.ignoreExpiration){if("number"!=typeof R.exp)return y(new n("invalid exp value"));if(b>=R.exp+(r.clockTolerance||0))return y(new o("jwt expired",new Date(1e3*R.exp)))}if(r.audience){const e=Array.isArray(r.audience)?r.audience:[r.audience];if(!(Array.isArray(R.aud)?R.aud:[R.aud]).some((function(t){return e.some((function(e){return e instanceof RegExp?e.test(t):e===t}))})))return y(new n("jwt audience invalid. expected: "+e.join(" or ")))}if(r.issuer){if("string"==typeof r.issuer&&R.iss!==r.issuer||Array.isArray(r.issuer)&&-1===r.issuer.indexOf(R.iss))return y(new n("jwt issuer invalid. expected: "+r.issuer))}if(r.subject&&R.sub!==r.subject)return y(new n("jwt subject invalid. expected: "+r.subject));if(r.jwtid&&R.jti!==r.jwtid)return y(new n("jwt jwtid invalid. expected: "+r.jwtid));if(r.nonce&&R.nonce!==r.nonce)return y(new n("jwt nonce invalid. expected: "+r.nonce));if(r.maxAge){if("number"!=typeof R.iat)return y(new n("iat required when maxAge is specified"));const e=s(r.maxAge,R.iat);if(void 0===e)return y(new n('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(b>=e+(r.clockTolerance||0))return y(new o("maxAge exceeded",new Date(1e3*e)))}if(!0===r.complete){const e=S.signature;return y(null,{header:_,payload:R,signature:e})}return y(null,R)}))}},54178:(e,t,r)=>{var n=r(88500),i=r(89509).Buffer,o=r(86035),a=r(35015),s=r(89539),c="secret must be a string or buffer",u="key must be a string or a buffer",l="key must be a string, a buffer or an object",d="function"==typeof o.createPublicKey;function f(e){if(!i.isBuffer(e)&&"string"!=typeof e){if(!d)throw m(u);if("object"!=typeof e)throw m(u);if("string"!=typeof e.type)throw m(u);if("string"!=typeof e.asymmetricKeyType)throw m(u);if("function"!=typeof e.export)throw m(u)}}function h(e){if(!i.isBuffer(e)&&"string"!=typeof e&&"object"!=typeof e)throw m(l)}function p(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function v(e){var t=4-(e=e.toString()).length%4;if(4!==t)for(var r=0;r<t;++r)e+="=";return e.replace(/\-/g,"+").replace(/_/g,"/")}function m(e){var t=[].slice.call(arguments,1),r=s.format.bind(s,e).apply(null,t);return new TypeError(r)}function g(e){var t;return t=e,i.isBuffer(t)||"string"==typeof t||(e=JSON.stringify(e)),e}function y(e){return function(t,r){!function(e){if(!i.isBuffer(e)){if("string"==typeof e)return e;if(!d)throw m(c);if("object"!=typeof e)throw m(c);if("secret"!==e.type)throw m(c);if("function"!=typeof e.export)throw m(c)}}(r),t=g(t);var n=o.createHmac("sha"+e,r);return p((n.update(t),n.digest("base64")))}}function b(e){return function(t,r,o){var a=y(e)(t,o);return n(i.from(r),i.from(a))}}function E(e){return function(t,r){h(r),t=g(t);var n=o.createSign("RSA-SHA"+e);return p((n.update(t),n.sign(r,"base64")))}}function S(e){return function(t,r,n){f(n),t=g(t),r=v(r);var i=o.createVerify("RSA-SHA"+e);return i.update(t),i.verify(n,r,"base64")}}function _(e){return function(t,r){h(r),t=g(t);var n=o.createSign("RSA-SHA"+e);return p((n.update(t),n.sign({key:r,padding:o.constants.RSA_PKCS1_PSS_PADDING,saltLength:o.constants.RSA_PSS_SALTLEN_DIGEST},"base64")))}}function w(e){return function(t,r,n){f(n),t=g(t),r=v(r);var i=o.createVerify("RSA-SHA"+e);return i.update(t),i.verify({key:n,padding:o.constants.RSA_PKCS1_PSS_PADDING,saltLength:o.constants.RSA_PSS_SALTLEN_DIGEST},r,"base64")}}function R(e){var t=E(e);return function(){var r=t.apply(null,arguments);return r=a.derToJose(r,"ES"+e)}}function C(e){var t=S(e);return function(r,n,i){return n=a.joseToDer(n,"ES"+e).toString("base64"),t(r,n,i)}}function T(){return function(){return""}}function x(){return function(e,t){return""===t}}d&&(u+=" or a KeyObject",c+="or a KeyObject"),e.exports=function(e){var t={hs:y,rs:E,ps:_,es:R,none:T},r={hs:b,rs:S,ps:w,es:C,none:x},n=e.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/i);if(!n)throw m('"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".',e);var i=(n[1]||n[3]).toLowerCase(),o=n[2];return{sign:t[i](o),verify:r[i](o)}}},40158:(e,t,r)=>{var n=r(48952),i=r(43079);t.ALGORITHMS=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"],t.sign=n.sign,t.verify=i.verify,t.decode=i.decode,t.isValid=i.isValid,t.createSign=function(e){return new n(e)},t.createVerify=function(e){return new i(e)}},97006:(e,t,r)=>{var n=r(34155),i=r(89509).Buffer,o=r(42830);function a(e){if(this.buffer=null,this.writable=!0,this.readable=!0,!e)return this.buffer=i.alloc(0),this;if("function"==typeof e.pipe)return this.buffer=i.alloc(0),e.pipe(this),this;if(e.length||"object"==typeof e)return this.buffer=e,this.writable=!1,n.nextTick(function(){this.emit("end",e),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof e+")")}r(89539).inherits(a,o),a.prototype.write=function(e){this.buffer=i.concat([this.buffer,i.from(e)]),this.emit("data",e)},a.prototype.end=function(e){e&&this.write(e),this.emit("end",e),this.emit("close"),this.writable=!1,this.readable=!1},e.exports=a},48952:(e,t,r)=>{var n=r(89509).Buffer,i=r(97006),o=r(54178),a=r(42830),s=r(32010),c=r(89539);function u(e,t){return n.from(e,t).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function l(e){var t=e.header,r=e.payload,n=e.secret||e.privateKey,i=e.encoding,a=o(t.alg),l=function(e,t,r){r=r||"utf8";var n=u(s(e),"binary"),i=u(s(t),r);return c.format("%s.%s",n,i)}(t,r,i),d=a.sign(l,n);return c.format("%s.%s",l,d)}function d(e){var t=e.secret||e.privateKey||e.key,r=new i(t);this.readable=!0,this.header=e.header,this.encoding=e.encoding,this.secret=this.privateKey=this.key=r,this.payload=new i(e.payload),this.secret.once("close",function(){!this.payload.writable&&this.readable&&this.sign()}.bind(this)),this.payload.once("close",function(){!this.secret.writable&&this.readable&&this.sign()}.bind(this))}c.inherits(d,a),d.prototype.sign=function(){try{var e=l({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",e),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},d.sign=l,e.exports=d},32010:(e,t,r)=>{var n=r(48764).Buffer;e.exports=function(e){return"string"==typeof e?e:"number"==typeof e||n.isBuffer(e)?e.toString():JSON.stringify(e)}},43079:(e,t,r)=>{var n=r(89509).Buffer,i=r(97006),o=r(54178),a=r(42830),s=r(32010),c=r(89539),u=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function l(e){if(function(e){return"[object Object]"===Object.prototype.toString.call(e)}(e))return e;try{return JSON.parse(e)}catch(e){return}}function d(e){var t=e.split(".",1)[0];return l(n.from(t,"base64").toString("binary"))}function f(e){return e.split(".")[2]}function h(e){return u.test(e)&&!!d(e)}function p(e,t,r){if(!t){var n=new Error("Missing algorithm parameter for jws.verify");throw n.code="MISSING_ALGORITHM",n}var i=f(e=s(e)),a=function(e){return e.split(".",2).join(".")}(e);return o(t).verify(a,i,r)}function v(e,t){if(t=t||{},!h(e=s(e)))return null;var r=d(e);if(!r)return null;var i=function(e,t){t=t||"utf8";var r=e.split(".")[1];return n.from(r,"base64").toString(t)}(e);return("JWT"===r.typ||t.json)&&(i=JSON.parse(i,t.encoding)),{header:r,payload:i,signature:f(e)}}function m(e){var t=(e=e||{}).secret||e.publicKey||e.key,r=new i(t);this.readable=!0,this.algorithm=e.algorithm,this.encoding=e.encoding,this.secret=this.publicKey=this.key=r,this.signature=new i(e.signature),this.secret.once("close",function(){!this.signature.writable&&this.readable&&this.verify()}.bind(this)),this.signature.once("close",function(){!this.secret.writable&&this.readable&&this.verify()}.bind(this))}c.inherits(m,a),m.prototype.verify=function(){try{var e=p(this.signature.buffer,this.algorithm,this.key.buffer),t=v(this.signature.buffer,this.encoding);return this.emit("done",e,t),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},m.decode=v,m.isValid=h,m.verify=p,e.exports=m},78414:e=>{var t=Array.prototype.slice;function r(e){if("object"!=typeof(e=e||{}))throw new TypeError("Options must be an object");this.storage={},this.separator=e.separator||"."}r.prototype.add=function(e,t){(this.storage[e]||(this.storage[e]=[])).push(t)},r.prototype.remove=function(e){var t,r;for(t in this.storage)(r=this.storage[t]).some((function(t,n){if(t===e)return r.splice(n,1),!0}))},r.prototype.get=function(e){var t,r=[];for(t in this.storage)e&&e!==t&&0!==t.indexOf(e+this.separator)||(r=r.concat(this.storage[t]));return r},r.prototype.getGrouped=function(e){var r,n={};for(r in this.storage)e&&e!==r&&0!==r.indexOf(e+this.separator)||(n[r]=t.call(this.storage[r]));return n},r.prototype.getAll=function(e){var r,n={};for(r in this.storage)e!==r&&0!==r.indexOf(e+this.separator)||(n[r]=t.call(this.storage[r]));return n},r.prototype.run=function(e,r){var n=t.call(arguments,2);this.get(e).forEach((function(e){e.apply(r||this,n)}))},e.exports=r},28922:e=>{var t=1/0,r=9007199254740991,n=17976931348623157e292,i=NaN,o="[object Arguments]",a="[object Function]",s="[object GeneratorFunction]",c="[object String]",u="[object Symbol]",l=/^\s+|\s+$/g,d=/^[-+]0x[0-9a-f]+$/i,f=/^0b[01]+$/i,h=/^0o[0-7]+$/i,p=/^(?:0|[1-9]\d*)$/,v=parseInt;function m(e){return e!=e}function g(e,t){return function(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(t,(function(t){return e[t]}))}var y,b,E=Object.prototype,S=E.hasOwnProperty,_=E.toString,w=E.propertyIsEnumerable,R=(y=Object.keys,b=Object,function(e){return y(b(e))}),C=Math.max;function T(e,t){var r=I(e)||function(e){return function(e){return L(e)&&A(e)}(e)&&S.call(e,"callee")&&(!w.call(e,"callee")||_.call(e)==o)}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,i=!!n;for(var a in e)!t&&!S.call(e,a)||i&&("length"==a||k(a,n))||r.push(a);return r}function x(e){if(r=(t=e)&&t.constructor,n="function"==typeof r&&r.prototype||E,t!==n)return R(e);var t,r,n,i=[];for(var o in Object(e))S.call(e,o)&&"constructor"!=o&&i.push(o);return i}function k(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||p.test(e))&&e>-1&&e%1==0&&e<t}var I=Array.isArray;function A(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!function(e){var t=O(e)?_.call(e):"";return t==a||t==s}(e)}function O(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function L(e){return!!e&&"object"==typeof e}e.exports=function(e,r,o,a){var s;e=A(e)?e:(s=e)?g(s,function(e){return A(e)?T(e):x(e)}(s)):[],o=o&&!a?function(e){var r=function(e){if(!e)return 0===e?e:0;if(e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||L(e)&&_.call(e)==u}(e))return i;if(O(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=O(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(l,"");var r=f.test(e);return r||h.test(e)?v(e.slice(2),r?2:8):d.test(e)?i:+e}(e),e===t||e===-t){return(e<0?-1:1)*n}return e==e?e:0}(e),o=r%1;return r==r?o?r-o:r:0}(o):0;var p=e.length;return o<0&&(o=C(p+o,0)),function(e){return"string"==typeof e||!I(e)&&L(e)&&_.call(e)==c}(e)?o<=p&&e.indexOf(r,o)>-1:!!p&&function(e,t,r){if(t!=t)return function(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}(e,m,r);for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,r,o)>-1}},48094:e=>{var t=Object.prototype.toString;e.exports=function(e){return!0===e||!1===e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Boolean]"==t.call(e)}},55928:e=>{var t=1/0,r=17976931348623157e292,n=NaN,i="[object Symbol]",o=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt,l=Object.prototype.toString;function d(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=function(e){return"number"==typeof e&&e==function(e){var f=function(e){if(!e)return 0===e?e:0;if(e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&l.call(e)==i}(e))return n;if(d(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=d(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(o,"");var r=s.test(e);return r||c.test(e)?u(e.slice(2),r?2:8):a.test(e)?n:+e}(e),e===t||e===-t){return(e<0?-1:1)*r}return e==e?e:0}(e),h=f%1;return f==f?h?f-h:f:0}(e)}},23126:e=>{var t=Object.prototype.toString;e.exports=function(e){return"number"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Number]"==t.call(e)}},8146:e=>{var t,r,n=Function.prototype,i=Object.prototype,o=n.toString,a=i.hasOwnProperty,s=o.call(Object),c=i.toString,u=(t=Object.getPrototypeOf,r=Object,function(e){return t(r(e))});e.exports=function(e){if(!function(e){return!!e&&"object"==typeof e}(e)||"[object Object]"!=c.call(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e))return!1;var t=u(e);if(null===t)return!0;var r=a.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&o.call(r)==s}},25751:e=>{var t=Object.prototype.toString,r=Array.isArray;e.exports=function(e){return"string"==typeof e||!r(e)&&function(e){return!!e&&"object"==typeof e}(e)&&"[object String]"==t.call(e)}},38917:e=>{var t="Expected a function",r=1/0,n=17976931348623157e292,i=NaN,o="[object Symbol]",a=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,u=/^0o[0-7]+$/i,l=parseInt,d=Object.prototype.toString;function f(e,f){var p;if("function"!=typeof f)throw new TypeError(t);return e=function(e){var t=function(e){if(!e)return 0===e?e:0;if(e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&d.call(e)==o}(e))return i;if(h(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=h(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(a,"");var r=c.test(e);return r||u.test(e)?l(e.slice(2),r?2:8):s.test(e)?i:+e}(e),e===r||e===-r){return(e<0?-1:1)*n}return e==e?e:0}(e),f=t%1;return t==t?f?t-f:t:0}(e),function(){return--e>0&&(p=f.apply(this,arguments)),e<=1&&(f=void 0),p}}function h(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=function(e){return f(2,e)}},18552:(e,t,r)=>{var n=r(10852)(r(55639),"DataView");e.exports=n},1989:(e,t,r)=>{var n=r(51789),i=r(80401),o=r(57667),a=r(21327),s=r(81866);function c(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}c.prototype.clear=n,c.prototype.delete=i,c.prototype.get=o,c.prototype.has=a,c.prototype.set=s,e.exports=c},96425:(e,t,r)=>{var n=r(3118),i=r(9435);function o(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}o.prototype=n(i.prototype),o.prototype.constructor=o,e.exports=o},38407:(e,t,r)=>{var n=r(27040),i=r(14125),o=r(82117),a=r(67518),s=r(54705);function c(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}c.prototype.clear=n,c.prototype.delete=i,c.prototype.get=o,c.prototype.has=a,c.prototype.set=s,e.exports=c},7548:(e,t,r)=>{var n=r(3118),i=r(9435);function o(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}o.prototype=n(i.prototype),o.prototype.constructor=o,e.exports=o},57071:(e,t,r)=>{var n=r(10852)(r(55639),"Map");e.exports=n},83369:(e,t,r)=>{var n=r(24785),i=r(11285),o=r(96e3),a=r(49916),s=r(95265);function c(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}c.prototype.clear=n,c.prototype.delete=i,c.prototype.get=o,c.prototype.has=a,c.prototype.set=s,e.exports=c},53818:(e,t,r)=>{var n=r(10852)(r(55639),"Promise");e.exports=n},58525:(e,t,r)=>{var n=r(10852)(r(55639),"Set");e.exports=n},88668:(e,t,r)=>{var n=r(83369),i=r(90619),o=r(72385);function a(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new n;++t<r;)this.add(e[t])}a.prototype.add=a.prototype.push=i,a.prototype.has=o,e.exports=a},46384:(e,t,r)=>{var n=r(38407),i=r(37465),o=r(63779),a=r(67599),s=r(44758),c=r(34309);function u(e){var t=this.__data__=new n(e);this.size=t.size}u.prototype.clear=i,u.prototype.delete=o,u.prototype.get=a,u.prototype.has=s,u.prototype.set=c,e.exports=u},62705:(e,t,r)=>{var n=r(55639).Symbol;e.exports=n},11149:(e,t,r)=>{var n=r(55639).Uint8Array;e.exports=n},70577:(e,t,r)=>{var n=r(10852)(r(55639),"WeakMap");e.exports=n},96874:e=>{e.exports=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}},44174:e=>{e.exports=function(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i<o;){var a=e[i];t(n,a,r(a),e)}return n}},77412:e=>{e.exports=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}},34963:e=>{e.exports=function(e,t){for(var r=-1,n=null==e?0:e.length,i=0,o=[];++r<n;){var a=e[r];t(a,r,e)&&(o[i++]=a)}return o}},47443:(e,t,r)=>{var n=r(42118);e.exports=function(e,t){return!!(null==e?0:e.length)&&n(e,t,0)>-1}},1196:e=>{e.exports=function(e,t,r){for(var n=-1,i=null==e?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}},14636:(e,t,r)=>{var n=r(22545),i=r(35694),o=r(1469),a=r(44144),s=r(65776),c=r(36719),u=Object.prototype.hasOwnProperty;e.exports=function(e,t){var r=o(e),l=!r&&i(e),d=!r&&!l&&a(e),f=!r&&!l&&!d&&c(e),h=r||l||d||f,p=h?n(e.length,String):[],v=p.length;for(var m in e)!t&&!u.call(e,m)||h&&("length"==m||d&&("offset"==m||"parent"==m)||f&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||s(m,v))||p.push(m);return p}},29932:e=>{e.exports=function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}},62488:e=>{e.exports=function(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}},62663:e=>{e.exports=function(e,t,r,n){var i=-1,o=null==e?0:e.length;for(n&&o&&(r=e[++i]);++i<o;)r=t(r,e[i],i,e);return r}},82908:e=>{e.exports=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}},44286:e=>{e.exports=function(e){return e.split("")}},49029:e=>{var t=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;e.exports=function(e){return e.match(t)||[]}},86556:(e,t,r)=>{var n=r(89465),i=r(77813);e.exports=function(e,t,r){(void 0!==r&&!i(e[t],r)||void 0===r&&!(t in e))&&n(e,t,r)}},34865:(e,t,r)=>{var n=r(89465),i=r(77813),o=Object.prototype.hasOwnProperty;e.exports=function(e,t,r){var a=e[t];o.call(e,t)&&i(a,r)&&(void 0!==r||t in e)||n(e,t,r)}},18470:(e,t,r)=>{var n=r(77813);e.exports=function(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}},81119:(e,t,r)=>{var n=r(89881);e.exports=function(e,t,r,i){return n(e,(function(e,n,o){t(i,e,r(e),o)})),i}},44037:(e,t,r)=>{var n=r(98363),i=r(3674);e.exports=function(e,t){return e&&n(t,i(t),e)}},63886:(e,t,r)=>{var n=r(98363),i=r(81704);e.exports=function(e,t){return e&&n(t,i(t),e)}},89465:(e,t,r)=>{var n=r(38777);e.exports=function(e,t,r){"__proto__"==t&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}},85990:(e,t,r)=>{var n=r(46384),i=r(77412),o=r(34865),a=r(44037),s=r(63886),c=r(64626),u=r(278),l=r(18805),d=r(1911),f=r(58234),h=r(46904),p=r(64160),v=r(43824),m=r(29148),g=r(38517),y=r(1469),b=r(44144),E=r(56688),S=r(13218),_=r(72928),w=r(3674),R=r(81704),C="[object Arguments]",T="[object Function]",x="[object Object]",k={};k[C]=k["[object Array]"]=k["[object ArrayBuffer]"]=k["[object DataView]"]=k["[object Boolean]"]=k["[object Date]"]=k["[object Float32Array]"]=k["[object Float64Array]"]=k["[object Int8Array]"]=k["[object Int16Array]"]=k["[object Int32Array]"]=k["[object Map]"]=k["[object Number]"]=k[x]=k["[object RegExp]"]=k["[object Set]"]=k["[object String]"]=k["[object Symbol]"]=k["[object Uint8Array]"]=k["[object Uint8ClampedArray]"]=k["[object Uint16Array]"]=k["[object Uint32Array]"]=!0,k["[object Error]"]=k[T]=k["[object WeakMap]"]=!1,e.exports=function e(t,r,I,A,O,L){var M,N=1&r,P=2&r,D=4&r;if(I&&(M=O?I(t,A,O,L):I(t)),void 0!==M)return M;if(!S(t))return t;var F=y(t);if(F){if(M=v(t),!N)return u(t,M)}else{var U=p(t),j=U==T||"[object GeneratorFunction]"==U;if(b(t))return c(t,N);if(U==x||U==C||j&&!O){if(M=P||j?{}:g(t),!N)return P?d(t,s(M,t)):l(t,a(M,t))}else{if(!k[U])return O?t:{};M=m(t,U,N)}}L||(L=new n);var B=L.get(t);if(B)return B;L.set(t,M),_(t)?t.forEach((function(n){M.add(e(n,r,I,n,t,L))})):E(t)&&t.forEach((function(n,i){M.set(i,e(n,r,I,i,t,L))}));var q=F?void 0:(D?P?h:f:P?R:w)(t);return i(q||t,(function(n,i){q&&(n=t[i=n]),o(M,i,e(n,r,I,i,t,L))})),M}},3118:(e,t,r)=>{var n=r(13218),i=Object.create,o=function(){function e(){}return function(t){if(!n(t))return{};if(i)return i(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();e.exports=o},20731:(e,t,r)=>{var n=r(88668),i=r(47443),o=r(1196),a=r(29932),s=r(7518),c=r(74757);e.exports=function(e,t,r,u){var l=-1,d=i,f=!0,h=e.length,p=[],v=t.length;if(!h)return p;r&&(t=a(t,s(r))),u?(d=o,f=!1):t.length>=200&&(d=c,f=!1,t=new n(t));e:for(;++l<h;){var m=e[l],g=null==r?m:r(m);if(m=u||0!==m?m:0,f&&g==g){for(var y=v;y--;)if(t[y]===g)continue e;p.push(m)}else d(t,g,u)||p.push(m)}return p}},89881:(e,t,r)=>{var n=r(47816),i=r(99291)(n);e.exports=i},41848:e=>{e.exports=function(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}},21078:(e,t,r)=>{var n=r(62488),i=r(37285);e.exports=function e(t,r,o,a,s){var c=-1,u=t.length;for(o||(o=i),s||(s=[]);++c<u;){var l=t[c];r>0&&o(l)?r>1?e(l,r-1,o,a,s):n(s,l):a||(s[s.length]=l)}return s}},28483:(e,t,r)=>{var n=r(25063)();e.exports=n},47816:(e,t,r)=>{var n=r(28483),i=r(3674);e.exports=function(e,t){return e&&n(e,t,i)}},97786:(e,t,r)=>{var n=r(71811),i=r(40327);e.exports=function(e,t){for(var r=0,o=(t=n(t,e)).length;null!=e&&r<o;)e=e[i(t[r++])];return r&&r==o?e:void 0}},68866:(e,t,r)=>{var n=r(62488),i=r(1469);e.exports=function(e,t,r){var o=t(e);return i(e)?o:n(o,r(e))}},44239:(e,t,r)=>{var n=r(62705),i=r(89607),o=r(2333),a=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?i(e):o(e)}},78565:e=>{var t=Object.prototype.hasOwnProperty;e.exports=function(e,r){return null!=e&&t.call(e,r)}},13:e=>{e.exports=function(e,t){return null!=e&&t in Object(e)}},42118:(e,t,r)=>{var n=r(41848),i=r(62722),o=r(42351);e.exports=function(e,t,r){return t==t?o(e,t,r):n(e,i,r)}},9454:(e,t,r)=>{var n=r(44239),i=r(37005);e.exports=function(e){return i(e)&&"[object Arguments]"==n(e)}},41761:(e,t,r)=>{var n=r(44239),i=r(37005);e.exports=function(e){return i(e)&&"[object Date]"==n(e)}},90939:(e,t,r)=>{var n=r(2492),i=r(37005);e.exports=function e(t,r,o,a,s){return t===r||(null==t||null==r||!i(t)&&!i(r)?t!=t&&r!=r:n(t,r,o,a,e,s))}},2492:(e,t,r)=>{var n=r(46384),i=r(67114),o=r(18351),a=r(16096),s=r(64160),c=r(1469),u=r(44144),l=r(36719),d="[object Arguments]",f="[object Array]",h="[object Object]",p=Object.prototype.hasOwnProperty;e.exports=function(e,t,r,v,m,g){var y=c(e),b=c(t),E=y?f:s(e),S=b?f:s(t),_=(E=E==d?h:E)==h,w=(S=S==d?h:S)==h,R=E==S;if(R&&u(e)){if(!u(t))return!1;y=!0,_=!1}if(R&&!_)return g||(g=new n),y||l(e)?i(e,t,r,v,m,g):o(e,t,E,r,v,m,g);if(!(1&r)){var C=_&&p.call(e,"__wrapped__"),T=w&&p.call(t,"__wrapped__");if(C||T){var x=C?e.value():e,k=T?t.value():t;return g||(g=new n),m(x,k,r,v,g)}}return!!R&&(g||(g=new n),a(e,t,r,v,m,g))}},25588:(e,t,r)=>{var n=r(64160),i=r(37005);e.exports=function(e){return i(e)&&"[object Map]"==n(e)}},2958:(e,t,r)=>{var n=r(46384),i=r(90939);e.exports=function(e,t,r,o){var a=r.length,s=a,c=!o;if(null==e)return!s;for(e=Object(e);a--;){var u=r[a];if(c&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++a<s;){var l=(u=r[a])[0],d=e[l],f=u[1];if(c&&u[2]){if(void 0===d&&!(l in e))return!1}else{var h=new n;if(o)var p=o(d,f,l,e,t,h);if(!(void 0===p?i(f,d,3,o,h):p))return!1}}return!0}},62722:e=>{e.exports=function(e){return e!=e}},28458:(e,t,r)=>{var n=r(23560),i=r(37724),o=r(13218),a=r(80346),s=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,l=c.toString,d=u.hasOwnProperty,f=RegExp("^"+l.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!o(e)||i(e))&&(n(e)?f:s).test(a(e))}},29221:(e,t,r)=>{var n=r(64160),i=r(37005);e.exports=function(e){return i(e)&&"[object Set]"==n(e)}},38749:(e,t,r)=>{var n=r(44239),i=r(41780),o=r(37005),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=function(e){return o(e)&&i(e.length)&&!!a[n(e)]}},67206:(e,t,r)=>{var n=r(91573),i=r(16432),o=r(6557),a=r(1469),s=r(39601);e.exports=function(e){return"function"==typeof e?e:null==e?o:"object"==typeof e?a(e)?i(e[0],e[1]):n(e):s(e)}},280:(e,t,r)=>{var n=r(25726),i=r(86916),o=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return i(e);var t=[];for(var r in Object(e))o.call(e,r)&&"constructor"!=r&&t.push(r);return t}},10313:(e,t,r)=>{var n=r(13218),i=r(25726),o=r(33498),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return o(e);var t=i(e),r=[];for(var s in e)("constructor"!=s||!t&&a.call(e,s))&&r.push(s);return r}},9435:e=>{e.exports=function(){}},69199:(e,t,r)=>{var n=r(89881),i=r(98612);e.exports=function(e,t){var r=-1,o=i(e)?Array(e.length):[];return n(e,(function(e,n,i){o[++r]=t(e,n,i)})),o}},91573:(e,t,r)=>{var n=r(2958),i=r(1499),o=r(42634);e.exports=function(e){var t=i(e);return 1==t.length&&t[0][2]?o(t[0][0],t[0][1]):function(r){return r===e||n(r,e,t)}}},16432:(e,t,r)=>{var n=r(90939),i=r(27361),o=r(79095),a=r(15403),s=r(89162),c=r(42634),u=r(40327);e.exports=function(e,t){return a(e)&&s(t)?c(u(e),t):function(r){var a=i(r,e);return void 0===a&&a===t?o(r,e):n(t,a,3)}}},42980:(e,t,r)=>{var n=r(46384),i=r(86556),o=r(28483),a=r(59783),s=r(13218),c=r(81704),u=r(36390);e.exports=function e(t,r,l,d,f){t!==r&&o(r,(function(o,c){if(f||(f=new n),s(o))a(t,r,c,l,e,d,f);else{var h=d?d(u(t,c),o,c+"",t,r,f):void 0;void 0===h&&(h=o),i(t,c,h)}}),c)}},59783:(e,t,r)=>{var n=r(86556),i=r(64626),o=r(77133),a=r(278),s=r(38517),c=r(35694),u=r(1469),l=r(29246),d=r(44144),f=r(23560),h=r(13218),p=r(68630),v=r(36719),m=r(36390),g=r(59881);e.exports=function(e,t,r,y,b,E,S){var _=m(e,r),w=m(t,r),R=S.get(w);if(R)n(e,r,R);else{var C=E?E(_,w,r+"",e,t,S):void 0,T=void 0===C;if(T){var x=u(w),k=!x&&d(w),I=!x&&!k&&v(w);C=w,x||k||I?u(_)?C=_:l(_)?C=a(_):k?(T=!1,C=i(w,!0)):I?(T=!1,C=o(w,!0)):C=[]:p(w)||c(w)?(C=_,c(_)?C=g(_):h(_)&&!f(_)||(C=s(w))):T=!1}T&&(S.set(w,C),b(C,w,y,E,S),S.delete(w)),n(e,r,C)}}},82689:(e,t,r)=>{var n=r(29932),i=r(97786),o=r(67206),a=r(69199),s=r(71131),c=r(7518),u=r(85022),l=r(6557),d=r(1469);e.exports=function(e,t,r){t=t.length?n(t,(function(e){return d(e)?function(t){return i(t,1===e.length?e[0]:e)}:e})):[l];var f=-1;t=n(t,c(o));var h=a(e,(function(e,r,i){return{criteria:n(t,(function(t){return t(e)})),index:++f,value:e}}));return s(h,(function(e,t){return u(e,t,r)}))}},25970:(e,t,r)=>{var n=r(63012),i=r(79095);e.exports=function(e,t){return n(e,t,(function(t,r){return i(e,r)}))}},63012:(e,t,r)=>{var n=r(97786),i=r(10611),o=r(71811);e.exports=function(e,t,r){for(var a=-1,s=t.length,c={};++a<s;){var u=t[a],l=n(e,u);r(l,u)&&i(c,o(u,e),l)}return c}},40371:e=>{e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},79152:(e,t,r)=>{var n=r(97786);e.exports=function(e){return function(t){return n(t,e)}}},18674:e=>{e.exports=function(e){return function(t){return null==e?void 0:e[t]}}},5976:(e,t,r)=>{var n=r(6557),i=r(45357),o=r(30061);e.exports=function(e,t){return o(i(e,t,n),e+"")}},10611:(e,t,r)=>{var n=r(34865),i=r(71811),o=r(65776),a=r(13218),s=r(40327);e.exports=function(e,t,r,c){if(!a(e))return e;for(var u=-1,l=(t=i(t,e)).length,d=l-1,f=e;null!=f&&++u<l;){var h=s(t[u]),p=r;if("__proto__"===h||"constructor"===h||"prototype"===h)return e;if(u!=d){var v=f[h];void 0===(p=c?c(v,h,f):void 0)&&(p=a(v)?v:o(t[u+1])?[]:{})}n(f,h,p),f=f[h]}return e}},28045:(e,t,r)=>{var n=r(6557),i=r(89250),o=i?function(e,t){return i.set(e,t),e}:n;e.exports=o},56560:(e,t,r)=>{var n=r(75703),i=r(38777),o=r(6557),a=i?function(e,t){return i(e,"toString",{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:o;e.exports=a},14259:e=>{e.exports=function(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++n<i;)o[n]=e[n+t];return o}},71131:e=>{e.exports=function(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}},22545:e=>{e.exports=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}},80531:(e,t,r)=>{var n=r(62705),i=r(29932),o=r(1469),a=r(33448),s=n?n.prototype:void 0,c=s?s.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(o(t))return i(t,e)+"";if(a(t))return c?c.call(t):"";var r=t+"";return"0"==r&&1/t==-Infinity?"-0":r}},27561:(e,t,r)=>{var n=r(67990),i=/^\s+/;e.exports=function(e){return e?e.slice(0,n(e)+1).replace(i,""):e}},7518:e=>{e.exports=function(e){return function(t){return e(t)}}},45652:(e,t,r)=>{var n=r(88668),i=r(47443),o=r(1196),a=r(74757),s=r(23593),c=r(21814);e.exports=function(e,t,r){var u=-1,l=i,d=e.length,f=!0,h=[],p=h;if(r)f=!1,l=o;else if(d>=200){var v=t?null:s(e);if(v)return c(v);f=!1,l=a,p=new n}else p=t?[]:h;e:for(;++u<d;){var m=e[u],g=t?t(m):m;if(m=r||0!==m?m:0,f&&g==g){for(var y=p.length;y--;)if(p[y]===g)continue e;t&&p.push(g),h.push(m)}else l(p,g,r)||(p!==h&&p.push(g),h.push(m))}return h}},57406:(e,t,r)=>{var n=r(71811),i=r(10928),o=r(40292),a=r(40327);e.exports=function(e,t){return t=n(t,e),null==(e=o(e,t))||delete e[a(i(t))]}},47415:(e,t,r)=>{var n=r(29932);e.exports=function(e,t){return n(t,(function(t){return e[t]}))}},74757:e=>{e.exports=function(e,t){return e.has(t)}},54290:(e,t,r)=>{var n=r(6557);e.exports=function(e){return"function"==typeof e?e:n}},71811:(e,t,r)=>{var n=r(1469),i=r(15403),o=r(55514),a=r(79833);e.exports=function(e,t){return n(e)?e:i(e,t)?[e]:o(a(e))}},40180:(e,t,r)=>{var n=r(14259);e.exports=function(e,t,r){var i=e.length;return r=void 0===r?i:r,!t&&r>=i?e:n(e,t,r)}},74318:(e,t,r)=>{var n=r(11149);e.exports=function(e){var t=new e.constructor(e.byteLength);return new n(t).set(new n(e)),t}},64626:(e,t,r)=>{e=r.nmd(e);var n=r(55639),i=t&&!t.nodeType&&t,o=i&&e&&!e.nodeType&&e,a=o&&o.exports===i?n.Buffer:void 0,s=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var r=e.length,n=s?s(r):new e.constructor(r);return e.copy(n),n}},57157:(e,t,r)=>{var n=r(74318);e.exports=function(e,t){var r=t?n(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}},93147:e=>{var t=/\w*$/;e.exports=function(e){var r=new e.constructor(e.source,t.exec(e));return r.lastIndex=e.lastIndex,r}},40419:(e,t,r)=>{var n=r(62705),i=n?n.prototype:void 0,o=i?i.valueOf:void 0;e.exports=function(e){return o?Object(o.call(e)):{}}},77133:(e,t,r)=>{var n=r(74318);e.exports=function(e,t){var r=t?n(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}},26393:(e,t,r)=>{var n=r(33448);e.exports=function(e,t){if(e!==t){var r=void 0!==e,i=null===e,o=e==e,a=n(e),s=void 0!==t,c=null===t,u=t==t,l=n(t);if(!c&&!l&&!a&&e>t||a&&s&&u&&!c&&!l||i&&s&&u||!r&&u||!o)return 1;if(!i&&!a&&!l&&e<t||l&&r&&o&&!i&&!a||c&&r&&o||!s&&o||!u)return-1}return 0}},85022:(e,t,r)=>{var n=r(26393);e.exports=function(e,t,r){for(var i=-1,o=e.criteria,a=t.criteria,s=o.length,c=r.length;++i<s;){var u=n(o[i],a[i]);if(u)return i>=c?u:u*("desc"==r[i]?-1:1)}return e.index-t.index}},52157:e=>{var t=Math.max;e.exports=function(e,r,n,i){for(var o=-1,a=e.length,s=n.length,c=-1,u=r.length,l=t(a-s,0),d=Array(u+l),f=!i;++c<u;)d[c]=r[c];for(;++o<s;)(f||o<a)&&(d[n[o]]=e[o]);for(;l--;)d[c++]=e[o++];return d}},14054:e=>{var t=Math.max;e.exports=function(e,r,n,i){for(var o=-1,a=e.length,s=-1,c=n.length,u=-1,l=r.length,d=t(a-c,0),f=Array(d+l),h=!i;++o<d;)f[o]=e[o];for(var p=o;++u<l;)f[p+u]=r[u];for(;++s<c;)(h||o<a)&&(f[p+n[s]]=e[o++]);return f}},278:e=>{e.exports=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}},98363:(e,t,r)=>{var n=r(34865),i=r(89465);e.exports=function(e,t,r,o){var a=!r;r||(r={});for(var s=-1,c=t.length;++s<c;){var u=t[s],l=o?o(r[u],e[u],u,r,e):void 0;void 0===l&&(l=e[u]),a?i(r,u,l):n(r,u,l)}return r}},18805:(e,t,r)=>{var n=r(98363),i=r(99551);e.exports=function(e,t){return n(e,i(e),t)}},1911:(e,t,r)=>{var n=r(98363),i=r(51442);e.exports=function(e,t){return n(e,i(e),t)}},14429:(e,t,r)=>{var n=r(55639)["__core-js_shared__"];e.exports=n},97991:e=>{e.exports=function(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}},55189:(e,t,r)=>{var n=r(44174),i=r(81119),o=r(67206),a=r(1469);e.exports=function(e,t){return function(r,s){var c=a(r)?n:i,u=t?t():{};return c(r,e,o(s,2),u)}}},21463:(e,t,r)=>{var n=r(5976),i=r(16612);e.exports=function(e){return n((function(t,r){var n=-1,o=r.length,a=o>1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(a=e.length>3&&"function"==typeof a?(o--,a):void 0,s&&i(r[0],r[1],s)&&(a=o<3?void 0:a,o=1),t=Object(t);++n<o;){var c=r[n];c&&e(t,c,n,a)}return t}))}},99291:(e,t,r)=>{var n=r(98612);e.exports=function(e,t){return function(r,i){if(null==r)return r;if(!n(r))return e(r,i);for(var o=r.length,a=t?o:-1,s=Object(r);(t?a--:++a<o)&&!1!==i(s[a],a,s););return r}}},25063:e=>{e.exports=function(e){return function(t,r,n){for(var i=-1,o=Object(t),a=n(t),s=a.length;s--;){var c=a[e?s:++i];if(!1===r(o[c],c,o))break}return t}}},22402:(e,t,r)=>{var n=r(71774),i=r(55639);e.exports=function(e,t,r){var o=1&t,a=n(e);return function t(){return(this&&this!==i&&this instanceof t?a:e).apply(o?r:this,arguments)}}},98805:(e,t,r)=>{var n=r(40180),i=r(62689),o=r(83140),a=r(79833);e.exports=function(e){return function(t){t=a(t);var r=i(t)?o(t):void 0,s=r?r[0]:t.charAt(0),c=r?n(r,1).join(""):t.slice(1);return s[e]()+c}}},35393:(e,t,r)=>{var n=r(62663),i=r(53816),o=r(58748),a=RegExp("['’]","g");e.exports=function(e){return function(t){return n(o(i(t).replace(a,"")),e,"")}}},71774:(e,t,r)=>{var n=r(3118),i=r(13218);e.exports=function(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=n(e.prototype),o=e.apply(r,t);return i(o)?o:r}}},46347:(e,t,r)=>{var n=r(96874),i=r(71774),o=r(86935),a=r(94487),s=r(20893),c=r(46460),u=r(55639);e.exports=function(e,t,r){var l=i(e);return function i(){for(var d=arguments.length,f=Array(d),h=d,p=s(i);h--;)f[h]=arguments[h];var v=d<3&&f[0]!==p&&f[d-1]!==p?[]:c(f,p);return(d-=v.length)<r?a(e,t,o,i.placeholder,void 0,f,v,void 0,void 0,r-d):n(this&&this!==u&&this instanceof i?l:e,this,f)}}},86935:(e,t,r)=>{var n=r(52157),i=r(14054),o=r(97991),a=r(71774),s=r(94487),c=r(20893),u=r(90451),l=r(46460),d=r(55639);e.exports=function e(t,r,f,h,p,v,m,g,y,b){var E=128&r,S=1&r,_=2&r,w=24&r,R=512&r,C=_?void 0:a(t);return function T(){for(var x=arguments.length,k=Array(x),I=x;I--;)k[I]=arguments[I];if(w)var A=c(T),O=o(k,A);if(h&&(k=n(k,h,p,w)),v&&(k=i(k,v,m,w)),x-=O,w&&x<b){var L=l(k,A);return s(t,r,e,T.placeholder,f,k,L,g,y,b-x)}var M=S?f:this,N=_?M[t]:t;return x=k.length,g?k=u(k,g):R&&x>1&&k.reverse(),E&&y<x&&(k.length=y),this&&this!==d&&this instanceof T&&(N=C||a(N)),N.apply(M,k)}}},84375:(e,t,r)=>{var n=r(96874),i=r(71774),o=r(55639);e.exports=function(e,t,r,a){var s=1&t,c=i(e);return function t(){for(var i=-1,u=arguments.length,l=-1,d=a.length,f=Array(d+u),h=this&&this!==o&&this instanceof t?c:e;++l<d;)f[l]=a[l];for(;u--;)f[l++]=arguments[++i];return n(h,s?r:this,f)}}},94487:(e,t,r)=>{var n=r(86528),i=r(258),o=r(69255);e.exports=function(e,t,r,a,s,c,u,l,d,f){var h=8&t;t|=h?32:64,4&(t&=~(h?64:32))||(t&=-4);var p=[e,t,s,h?c:void 0,h?u:void 0,h?void 0:c,h?void 0:u,l,d,f],v=r.apply(void 0,p);return n(e)&&i(v,p),v.placeholder=a,o(v,e,t)}},23593:(e,t,r)=>{var n=r(58525),i=r(50308),o=r(21814),a=n&&1/o(new n([,-0]))[1]==1/0?function(e){return new n(e)}:i;e.exports=a},97727:(e,t,r)=>{var n=r(28045),i=r(22402),o=r(46347),a=r(86935),s=r(84375),c=r(66833),u=r(63833),l=r(258),d=r(69255),f=r(40554),h=Math.max;e.exports=function(e,t,r,p,v,m,g,y){var b=2&t;if(!b&&"function"!=typeof e)throw new TypeError("Expected a function");var E=p?p.length:0;if(E||(t&=-97,p=v=void 0),g=void 0===g?g:h(f(g),0),y=void 0===y?y:f(y),E-=v?v.length:0,64&t){var S=p,_=v;p=v=void 0}var w=b?void 0:c(e),R=[e,t,r,p,v,S,_,m,g,y];if(w&&u(R,w),e=R[0],t=R[1],r=R[2],p=R[3],v=R[4],!(y=R[9]=void 0===R[9]?b?0:e.length:h(R[9]-E,0))&&24&t&&(t&=-25),t&&1!=t)C=8==t||16==t?o(e,t,y):32!=t&&33!=t||v.length?a.apply(void 0,R):s(e,t,r,p);else var C=i(e,t,r);return d((w?n:l)(C,R),e,t)}},92052:(e,t,r)=>{var n=r(42980),i=r(13218);e.exports=function e(t,r,o,a,s,c){return i(t)&&i(r)&&(c.set(r,t),n(t,r,void 0,e,c),c.delete(r)),t}},60696:(e,t,r)=>{var n=r(68630);e.exports=function(e){return n(e)?void 0:e}},69389:(e,t,r)=>{var n=r(18674)({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"});e.exports=n},38777:(e,t,r)=>{var n=r(10852),i=function(){try{var e=n(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=i},67114:(e,t,r)=>{var n=r(88668),i=r(82908),o=r(74757);e.exports=function(e,t,r,a,s,c){var u=1&r,l=e.length,d=t.length;if(l!=d&&!(u&&d>l))return!1;var f=c.get(e),h=c.get(t);if(f&&h)return f==t&&h==e;var p=-1,v=!0,m=2&r?new n:void 0;for(c.set(e,t),c.set(t,e);++p<l;){var g=e[p],y=t[p];if(a)var b=u?a(y,g,p,t,e,c):a(g,y,p,e,t,c);if(void 0!==b){if(b)continue;v=!1;break}if(m){if(!i(t,(function(e,t){if(!o(m,t)&&(g===e||s(g,e,r,a,c)))return m.push(t)}))){v=!1;break}}else if(g!==y&&!s(g,y,r,a,c)){v=!1;break}}return c.delete(e),c.delete(t),v}},18351:(e,t,r)=>{var n=r(62705),i=r(11149),o=r(77813),a=r(67114),s=r(68776),c=r(21814),u=n?n.prototype:void 0,l=u?u.valueOf:void 0;e.exports=function(e,t,r,n,u,d,f){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!d(new i(e),new i(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return o(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var h=s;case"[object Set]":var p=1&n;if(h||(h=c),e.size!=t.size&&!p)return!1;var v=f.get(e);if(v)return v==t;n|=2,f.set(e,t);var m=a(h(e),h(t),n,u,d,f);return f.delete(e),m;case"[object Symbol]":if(l)return l.call(e)==l.call(t)}return!1}},16096:(e,t,r)=>{var n=r(58234),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,r,o,a,s){var c=1&r,u=n(e),l=u.length;if(l!=n(t).length&&!c)return!1;for(var d=l;d--;){var f=u[d];if(!(c?f in t:i.call(t,f)))return!1}var h=s.get(e),p=s.get(t);if(h&&p)return h==t&&p==e;var v=!0;s.set(e,t),s.set(t,e);for(var m=c;++d<l;){var g=e[f=u[d]],y=t[f];if(o)var b=c?o(y,g,f,t,e,s):o(g,y,f,e,t,s);if(!(void 0===b?g===y||a(g,y,r,o,s):b)){v=!1;break}m||(m="constructor"==f)}if(v&&!m){var E=e.constructor,S=t.constructor;E==S||!("constructor"in e)||!("constructor"in t)||"function"==typeof E&&E instanceof E&&"function"==typeof S&&S instanceof S||(v=!1)}return s.delete(e),s.delete(t),v}},89464:(e,t,r)=>{var n=r(18674)({"&":"&","<":"<",">":">",'"':""","'":"'"});e.exports=n},99021:(e,t,r)=>{var n=r(85564),i=r(45357),o=r(30061);e.exports=function(e){return o(i(e,void 0,n),e+"")}},31957:(e,t,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},58234:(e,t,r)=>{var n=r(68866),i=r(99551),o=r(3674);e.exports=function(e){return n(e,o,i)}},46904:(e,t,r)=>{var n=r(68866),i=r(51442),o=r(81704);e.exports=function(e){return n(e,o,i)}},66833:(e,t,r)=>{var n=r(89250),i=r(50308),o=n?function(e){return n.get(e)}:i;e.exports=o},97658:(e,t,r)=>{var n=r(52060),i=Object.prototype.hasOwnProperty;e.exports=function(e){for(var t=e.name+"",r=n[t],o=i.call(n,t)?r.length:0;o--;){var a=r[o],s=a.func;if(null==s||s==e)return a.name}return t}},20893:e=>{e.exports=function(e){return e.placeholder}},45050:(e,t,r)=>{var n=r(37019);e.exports=function(e,t){var r=e.__data__;return n(t)?r["string"==typeof t?"string":"hash"]:r.map}},1499:(e,t,r)=>{var n=r(89162),i=r(3674);e.exports=function(e){for(var t=i(e),r=t.length;r--;){var o=t[r],a=e[o];t[r]=[o,a,n(a)]}return t}},10852:(e,t,r)=>{var n=r(28458),i=r(47801);e.exports=function(e,t){var r=i(e,t);return n(r)?r:void 0}},85924:(e,t,r)=>{var n=r(5569)(Object.getPrototypeOf,Object);e.exports=n},89607:(e,t,r)=>{var n=r(62705),i=Object.prototype,o=i.hasOwnProperty,a=i.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=o.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var i=a.call(e);return n&&(t?e[s]=r:delete e[s]),i}},99551:(e,t,r)=>{var n=r(34963),i=r(70479),o=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols,s=a?function(e){return null==e?[]:(e=Object(e),n(a(e),(function(t){return o.call(e,t)})))}:i;e.exports=s},51442:(e,t,r)=>{var n=r(62488),i=r(85924),o=r(99551),a=r(70479),s=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)n(t,o(e)),e=i(e);return t}:a;e.exports=s},64160:(e,t,r)=>{var n=r(18552),i=r(57071),o=r(53818),a=r(58525),s=r(70577),c=r(44239),u=r(80346),l="[object Map]",d="[object Promise]",f="[object Set]",h="[object WeakMap]",p="[object DataView]",v=u(n),m=u(i),g=u(o),y=u(a),b=u(s),E=c;(n&&E(new n(new ArrayBuffer(1)))!=p||i&&E(new i)!=l||o&&E(o.resolve())!=d||a&&E(new a)!=f||s&&E(new s)!=h)&&(E=function(e){var t=c(e),r="[object Object]"==t?e.constructor:void 0,n=r?u(r):"";if(n)switch(n){case v:return p;case m:return l;case g:return d;case y:return f;case b:return h}return t}),e.exports=E},47801:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},58775:e=>{var t=/\{\n\/\* \[wrapped with (.+)\] \*/,r=/,? & /;e.exports=function(e){var n=e.match(t);return n?n[1].split(r):[]}},222:(e,t,r)=>{var n=r(71811),i=r(35694),o=r(1469),a=r(65776),s=r(41780),c=r(40327);e.exports=function(e,t,r){for(var u=-1,l=(t=n(t,e)).length,d=!1;++u<l;){var f=c(t[u]);if(!(d=null!=e&&r(e,f)))break;e=e[f]}return d||++u!=l?d:!!(l=null==e?0:e.length)&&s(l)&&a(f,l)&&(o(e)||i(e))}},62689:e=>{var t=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");e.exports=function(e){return t.test(e)}},93157:e=>{var t=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;e.exports=function(e){return t.test(e)}},51789:(e,t,r)=>{var n=r(94536);e.exports=function(){this.__data__=n?n(null):{},this.size=0}},80401:e=>{e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},57667:(e,t,r)=>{var n=r(94536),i=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(n){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return i.call(t,e)?t[e]:void 0}},21327:(e,t,r)=>{var n=r(94536),i=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return n?void 0!==t[e]:i.call(t,e)}},81866:(e,t,r)=>{var n=r(94536);e.exports=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=n&&void 0===t?"__lodash_hash_undefined__":t,this}},43824:e=>{var t=Object.prototype.hasOwnProperty;e.exports=function(e){var r=e.length,n=new e.constructor(r);return r&&"string"==typeof e[0]&&t.call(e,"index")&&(n.index=e.index,n.input=e.input),n}},29148:(e,t,r)=>{var n=r(74318),i=r(57157),o=r(93147),a=r(40419),s=r(77133);e.exports=function(e,t,r){var c=e.constructor;switch(t){case"[object ArrayBuffer]":return n(e);case"[object Boolean]":case"[object Date]":return new c(+e);case"[object DataView]":return i(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return s(e,r);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(e);case"[object RegExp]":return o(e);case"[object Symbol]":return a(e)}}},38517:(e,t,r)=>{var n=r(3118),i=r(85924),o=r(25726);e.exports=function(e){return"function"!=typeof e.constructor||o(e)?{}:n(i(e))}},83112:e=>{var t=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;e.exports=function(e,r){var n=r.length;if(!n)return e;var i=n-1;return r[i]=(n>1?"& ":"")+r[i],r=r.join(n>2?", ":" "),e.replace(t,"{\n/* [wrapped with "+r+"] */\n")}},37285:(e,t,r)=>{var n=r(62705),i=r(35694),o=r(1469),a=n?n.isConcatSpreadable:void 0;e.exports=function(e){return o(e)||i(e)||!!(a&&e&&e[a])}},65776:e=>{var t=/^(?:0|[1-9]\d*)$/;e.exports=function(e,r){var n=typeof e;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&t.test(e))&&e>-1&&e%1==0&&e<r}},16612:(e,t,r)=>{var n=r(77813),i=r(98612),o=r(65776),a=r(13218);e.exports=function(e,t,r){if(!a(r))return!1;var s=typeof t;return!!("number"==s?i(r)&&o(t,r.length):"string"==s&&t in r)&&n(r[t],e)}},15403:(e,t,r)=>{var n=r(1469),i=r(33448),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;e.exports=function(e,t){if(n(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!i(e))||(a.test(e)||!o.test(e)||null!=t&&e in Object(t))}},37019:e=>{e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},86528:(e,t,r)=>{var n=r(96425),i=r(66833),o=r(97658),a=r(8111);e.exports=function(e){var t=o(e),r=a[t];if("function"!=typeof r||!(t in n.prototype))return!1;if(e===r)return!0;var s=i(r);return!!s&&e===s[0]}},37724:(e,t,r)=>{var n,i=r(14429),o=(n=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";e.exports=function(e){return!!o&&o in e}},25726:e=>{var t=Object.prototype;e.exports=function(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||t)}},89162:(e,t,r)=>{var n=r(13218);e.exports=function(e){return e==e&&!n(e)}},27040:e=>{e.exports=function(){this.__data__=[],this.size=0}},14125:(e,t,r)=>{var n=r(18470),i=Array.prototype.splice;e.exports=function(e){var t=this.__data__,r=n(t,e);return!(r<0)&&(r==t.length-1?t.pop():i.call(t,r,1),--this.size,!0)}},82117:(e,t,r)=>{var n=r(18470);e.exports=function(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}},67518:(e,t,r)=>{var n=r(18470);e.exports=function(e){return n(this.__data__,e)>-1}},54705:(e,t,r)=>{var n=r(18470);e.exports=function(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}},24785:(e,t,r)=>{var n=r(1989),i=r(38407),o=r(57071);e.exports=function(){this.size=0,this.__data__={hash:new n,map:new(o||i),string:new n}}},11285:(e,t,r)=>{var n=r(45050);e.exports=function(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}},96e3:(e,t,r)=>{var n=r(45050);e.exports=function(e){return n(this,e).get(e)}},49916:(e,t,r)=>{var n=r(45050);e.exports=function(e){return n(this,e).has(e)}},95265:(e,t,r)=>{var n=r(45050);e.exports=function(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}},68776:e=>{e.exports=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}},42634:e=>{e.exports=function(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}},24523:(e,t,r)=>{var n=r(88306);e.exports=function(e){var t=n(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}},63833:(e,t,r)=>{var n=r(52157),i=r(14054),o=r(46460),a="__lodash_placeholder__",s=128,c=Math.min;e.exports=function(e,t){var r=e[1],u=t[1],l=r|u,d=l<131,f=u==s&&8==r||u==s&&256==r&&e[7].length<=t[8]||384==u&&t[7].length<=t[8]&&8==r;if(!d&&!f)return e;1&u&&(e[2]=t[2],l|=1&r?0:4);var h=t[3];if(h){var p=e[3];e[3]=p?n(p,h,t[4]):h,e[4]=p?o(e[3],a):t[4]}return(h=t[5])&&(p=e[5],e[5]=p?i(p,h,t[6]):h,e[6]=p?o(e[5],a):t[6]),(h=t[7])&&(e[7]=h),u&s&&(e[8]=null==e[8]?t[8]:c(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=l,e}},89250:(e,t,r)=>{var n=r(70577),i=n&&new n;e.exports=i},94536:(e,t,r)=>{var n=r(10852)(Object,"create");e.exports=n},86916:(e,t,r)=>{var n=r(5569)(Object.keys,Object);e.exports=n},33498:e=>{e.exports=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}},31167:(e,t,r)=>{e=r.nmd(e);var n=r(31957),i=t&&!t.nodeType&&t,o=i&&e&&!e.nodeType&&e,a=o&&o.exports===i&&n.process,s=function(){try{var e=o&&o.require&&o.require("util").types;return e||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=s},2333:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},5569:e=>{e.exports=function(e,t){return function(r){return e(t(r))}}},45357:(e,t,r)=>{var n=r(96874),i=Math.max;e.exports=function(e,t,r){return t=i(void 0===t?e.length-1:t,0),function(){for(var o=arguments,a=-1,s=i(o.length-t,0),c=Array(s);++a<s;)c[a]=o[t+a];a=-1;for(var u=Array(t+1);++a<t;)u[a]=o[a];return u[t]=r(c),n(e,this,u)}}},40292:(e,t,r)=>{var n=r(97786),i=r(14259);e.exports=function(e,t){return t.length<2?e:n(e,i(t,0,-1))}},52060:e=>{e.exports={}},90451:(e,t,r)=>{var n=r(278),i=r(65776),o=Math.min;e.exports=function(e,t){for(var r=e.length,a=o(t.length,r),s=n(e);a--;){var c=t[a];e[a]=i(c,r)?s[c]:void 0}return e}},46460:e=>{var t="__lodash_placeholder__";e.exports=function(e,r){for(var n=-1,i=e.length,o=0,a=[];++n<i;){var s=e[n];s!==r&&s!==t||(e[n]=t,a[o++]=n)}return a}},55639:(e,t,r)=>{var n=r(31957),i="object"==typeof self&&self&&self.Object===Object&&self,o=n||i||Function("return this")();e.exports=o},36390:e=>{e.exports=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}},90619:e=>{e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},72385:e=>{e.exports=function(e){return this.__data__.has(e)}},258:(e,t,r)=>{var n=r(28045),i=r(21275)(n);e.exports=i},21814:e=>{e.exports=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}},30061:(e,t,r)=>{var n=r(56560),i=r(21275)(n);e.exports=i},69255:(e,t,r)=>{var n=r(58775),i=r(83112),o=r(30061),a=r(87241);e.exports=function(e,t,r){var s=t+"";return o(e,i(s,a(n(s),r)))}},21275:e=>{var t=Date.now;e.exports=function(e){var r=0,n=0;return function(){var i=t(),o=16-(i-n);if(n=i,o>0){if(++r>=800)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}},37465:(e,t,r)=>{var n=r(38407);e.exports=function(){this.__data__=new n,this.size=0}},63779:e=>{e.exports=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}},67599:e=>{e.exports=function(e){return this.__data__.get(e)}},44758:e=>{e.exports=function(e){return this.__data__.has(e)}},34309:(e,t,r)=>{var n=r(38407),i=r(57071),o=r(83369);e.exports=function(e,t){var r=this.__data__;if(r instanceof n){var a=r.__data__;if(!i||a.length<199)return a.push([e,t]),this.size=++r.size,this;r=this.__data__=new o(a)}return r.set(e,t),this.size=r.size,this}},42351:e=>{e.exports=function(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}},83140:(e,t,r)=>{var n=r(44286),i=r(62689),o=r(676);e.exports=function(e){return i(e)?o(e):n(e)}},55514:(e,t,r)=>{var n=r(24523),i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,o=/\\(\\)?/g,a=n((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(i,(function(e,r,n,i){t.push(n?i.replace(o,"$1"):r||e)})),t}));e.exports=a},40327:(e,t,r)=>{var n=r(33448);e.exports=function(e){if("string"==typeof e||n(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t}},80346:e=>{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},67990:e=>{var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},676:e=>{var t="\\ud800-\\udfff",r="["+t+"]",n="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",i="\\ud83c[\\udffb-\\udfff]",o="[^"+t+"]",a="(?:\\ud83c[\\udde6-\\uddff]){2}",s="[\\ud800-\\udbff][\\udc00-\\udfff]",c="(?:"+n+"|"+i+")"+"?",u="[\\ufe0e\\ufe0f]?",l=u+c+("(?:\\u200d(?:"+[o,a,s].join("|")+")"+u+c+")*"),d="(?:"+[o+n+"?",n,a,s,r].join("|")+")",f=RegExp(i+"(?="+i+")|"+d+l,"g");e.exports=function(e){return e.match(f)||[]}},2757:e=>{var t="\\ud800-\\udfff",r="\\u2700-\\u27bf",n="a-z\\xdf-\\xf6\\xf8-\\xff",i="A-Z\\xc0-\\xd6\\xd8-\\xde",o="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",a="["+o+"]",s="\\d+",c="["+r+"]",u="["+n+"]",l="[^"+t+o+s+r+n+i+"]",d="(?:\\ud83c[\\udde6-\\uddff]){2}",f="[\\ud800-\\udbff][\\udc00-\\udfff]",h="["+i+"]",p="(?:"+u+"|"+l+")",v="(?:"+h+"|"+l+")",m="(?:['’](?:d|ll|m|re|s|t|ve))?",g="(?:['’](?:D|LL|M|RE|S|T|VE))?",y="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",b="[\\ufe0e\\ufe0f]?",E=b+y+("(?:\\u200d(?:"+["[^"+t+"]",d,f].join("|")+")"+b+y+")*"),S="(?:"+[c,d,f].join("|")+")"+E,_=RegExp([h+"?"+u+"+"+m+"(?="+[a,h,"$"].join("|")+")",v+"+"+g+"(?="+[a,h+p,"$"].join("|")+")",h+"?"+p+"+"+m,h+"+"+g,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",s,S].join("|"),"g");e.exports=function(e){return e.match(_)||[]}},87241:(e,t,r)=>{var n=r(77412),i=r(47443),o=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];e.exports=function(e,t){return n(o,(function(r){var n="_."+r[0];t&r[1]&&!i(e,n)&&e.push(n)})),e.sort()}},21913:(e,t,r)=>{var n=r(96425),i=r(7548),o=r(278);e.exports=function(e){if(e instanceof n)return e.clone();var t=new i(e.__wrapped__,e.__chain__);return t.__actions__=o(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}},28583:(e,t,r)=>{var n=r(34865),i=r(98363),o=r(21463),a=r(98612),s=r(25726),c=r(3674),u=Object.prototype.hasOwnProperty,l=o((function(e,t){if(s(t)||a(t))i(t,c(t),e);else for(var r in t)u.call(t,r)&&n(e,r,t[r])}));e.exports=l},89567:(e,t,r)=>{var n=r(40554);e.exports=function(e,t){var r;if("function"!=typeof t)throw new TypeError("Expected a function");return e=n(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=void 0),r}}},38169:(e,t,r)=>{var n=r(5976),i=r(97727),o=r(20893),a=r(46460),s=n((function(e,t,r){var n=1;if(r.length){var c=a(r,o(s));n|=32}return i(e,n,t,r,c)}));s.placeholder={},e.exports=s},68929:(e,t,r)=>{var n=r(48403),i=r(35393)((function(e,t,r){return t=t.toLowerCase(),e+(r?n(t):t)}));e.exports=i},48403:(e,t,r)=>{var n=r(79833),i=r(11700);e.exports=function(e){return i(n(e).toLowerCase())}},66678:(e,t,r)=>{var n=r(85990);e.exports=function(e){return n(e,4)}},50361:(e,t,r)=>{var n=r(85990);e.exports=function(e){return n(e,5)}},75703:e=>{e.exports=function(e){return function(){return e}}},40087:(e,t,r)=>{var n=r(97727);function i(e,t,r){var o=n(e,8,void 0,void 0,void 0,void 0,void 0,t=r?void 0:t);return o.placeholder=i.placeholder,o}i.placeholder={},e.exports=i},23279:(e,t,r)=>{var n=r(13218),i=r(7771),o=r(14841),a=Math.max,s=Math.min;e.exports=function(e,t,r){var c,u,l,d,f,h,p=0,v=!1,m=!1,g=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var r=c,n=u;return c=u=void 0,p=t,d=e.apply(n,r)}function b(e){var r=e-h;return void 0===h||r>=t||r<0||m&&e-p>=l}function E(){var e=i();if(b(e))return S(e);f=setTimeout(E,function(e){var r=t-(e-h);return m?s(r,l-(e-p)):r}(e))}function S(e){return f=void 0,g&&c?y(e):(c=u=void 0,d)}function _(){var e=i(),r=b(e);if(c=arguments,u=this,h=e,r){if(void 0===f)return function(e){return p=e,f=setTimeout(E,t),v?y(e):d}(h);if(m)return clearTimeout(f),f=setTimeout(E,t),y(h)}return void 0===f&&(f=setTimeout(E,t)),d}return t=o(t)||0,n(r)&&(v=!!r.leading,l=(m="maxWait"in r)?a(o(r.maxWait)||0,t):l,g="trailing"in r?!!r.trailing:g),_.cancel=function(){void 0!==f&&clearTimeout(f),p=0,c=h=u=f=void 0},_.flush=function(){return void 0===f?d:S(i())},_}},53816:(e,t,r)=>{var n=r(69389),i=r(79833),o=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,a=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");e.exports=function(e){return(e=i(e))&&e.replace(o,n).replace(a,"")}},91747:(e,t,r)=>{var n=r(5976),i=r(77813),o=r(16612),a=r(81704),s=Object.prototype,c=s.hasOwnProperty,u=n((function(e,t){e=Object(e);var r=-1,n=t.length,u=n>2?t[2]:void 0;for(u&&o(t[0],t[1],u)&&(n=1);++r<n;)for(var l=t[r],d=a(l),f=-1,h=d.length;++f<h;){var p=d[f],v=e[p];(void 0===v||i(v,s[p])&&!c.call(e,p))&&(e[p]=l[p])}return e}));e.exports=u},66913:(e,t,r)=>{var n=r(96874),i=r(5976),o=r(92052),a=r(30236),s=i((function(e){return e.push(void 0,o),n(a,void 0,e)}));e.exports=s},91966:(e,t,r)=>{var n=r(20731),i=r(21078),o=r(5976),a=r(29246),s=o((function(e,t){return a(e)?n(e,i(t,1,a,!0)):[]}));e.exports=s},77813:e=>{e.exports=function(e,t){return e===t||e!=e&&t!=t}},7187:(e,t,r)=>{var n=r(89464),i=r(79833),o=/[&<>"']/g,a=RegExp(o.source);e.exports=function(e){return(e=i(e))&&a.test(e)?e.replace(o,n):e}},85564:(e,t,r)=>{var n=r(21078);e.exports=function(e){return(null==e?0:e.length)?n(e,1):[]}},84486:(e,t,r)=>{var n=r(77412),i=r(89881),o=r(54290),a=r(1469);e.exports=function(e,t){return(a(e)?n:i)(e,o(t))}},2525:(e,t,r)=>{var n=r(47816),i=r(54290);e.exports=function(e,t){return e&&n(e,i(t))}},27361:(e,t,r)=>{var n=r(97786);e.exports=function(e,t,r){var i=null==e?void 0:n(e,t);return void 0===i?r:i}},18721:(e,t,r)=>{var n=r(78565),i=r(222);e.exports=function(e,t){return null!=e&&i(e,t,n)}},79095:(e,t,r)=>{var n=r(13),i=r(222);e.exports=function(e,t){return null!=e&&i(e,t,n)}},6557:e=>{e.exports=function(e){return e}},64721:(e,t,r)=>{var n=r(42118),i=r(98612),o=r(47037),a=r(40554),s=r(52628),c=Math.max;e.exports=function(e,t,r,u){e=i(e)?e:s(e),r=r&&!u?a(r):0;var l=e.length;return r<0&&(r=c(l+r,0)),o(e)?r<=l&&e.indexOf(t,r)>-1:!!l&&n(e,t,r)>-1}},35694:(e,t,r)=>{var n=r(9454),i=r(37005),o=Object.prototype,a=o.hasOwnProperty,s=o.propertyIsEnumerable,c=n(function(){return arguments}())?n:function(e){return i(e)&&a.call(e,"callee")&&!s.call(e,"callee")};e.exports=c},1469:e=>{var t=Array.isArray;e.exports=t},98612:(e,t,r)=>{var n=r(23560),i=r(41780);e.exports=function(e){return null!=e&&i(e.length)&&!n(e)}},29246:(e,t,r)=>{var n=r(98612),i=r(37005);e.exports=function(e){return i(e)&&n(e)}},44144:(e,t,r)=>{e=r.nmd(e);var n=r(55639),i=r(95062),o=t&&!t.nodeType&&t,a=o&&e&&!e.nodeType&&e,s=a&&a.exports===o?n.Buffer:void 0,c=(s?s.isBuffer:void 0)||i;e.exports=c},47960:(e,t,r)=>{var n=r(41761),i=r(7518),o=r(31167),a=o&&o.isDate,s=a?i(a):n;e.exports=s},41609:(e,t,r)=>{var n=r(280),i=r(64160),o=r(35694),a=r(1469),s=r(98612),c=r(44144),u=r(25726),l=r(36719),d=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(s(e)&&(a(e)||"string"==typeof e||"function"==typeof e.splice||c(e)||l(e)||o(e)))return!e.length;var t=i(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(u(e))return!n(e).length;for(var r in e)if(d.call(e,r))return!1;return!0}},18446:(e,t,r)=>{var n=r(90939);e.exports=function(e,t){return n(e,t)}},23560:(e,t,r)=>{var n=r(44239),i=r(13218);e.exports=function(e){if(!i(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},41780:e=>{e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},56688:(e,t,r)=>{var n=r(25588),i=r(7518),o=r(31167),a=o&&o.isMap,s=a?i(a):n;e.exports=s},81763:(e,t,r)=>{var n=r(44239),i=r(37005);e.exports=function(e){return"number"==typeof e||i(e)&&"[object Number]"==n(e)}},13218:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},37005:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},68630:(e,t,r)=>{var n=r(44239),i=r(85924),o=r(37005),a=Function.prototype,s=Object.prototype,c=a.toString,u=s.hasOwnProperty,l=c.call(Object);e.exports=function(e){if(!o(e)||"[object Object]"!=n(e))return!1;var t=i(e);if(null===t)return!0;var r=u.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&c.call(r)==l}},72928:(e,t,r)=>{var n=r(29221),i=r(7518),o=r(31167),a=o&&o.isSet,s=a?i(a):n;e.exports=s},47037:(e,t,r)=>{var n=r(44239),i=r(1469),o=r(37005);e.exports=function(e){return"string"==typeof e||!i(e)&&o(e)&&"[object String]"==n(e)}},33448:(e,t,r)=>{var n=r(44239),i=r(37005);e.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==n(e)}},36719:(e,t,r)=>{var n=r(38749),i=r(7518),o=r(31167),a=o&&o.isTypedArray,s=a?i(a):n;e.exports=s},3674:(e,t,r)=>{var n=r(14636),i=r(280),o=r(98612);e.exports=function(e){return o(e)?n(e):i(e)}},81704:(e,t,r)=>{var n=r(14636),i=r(10313),o=r(98612);e.exports=function(e){return o(e)?n(e,!0):i(e)}},10928:e=>{e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},88306:(e,t,r)=>{var n=r(83369);function i(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(i.Cache||n),r}i.Cache=n,e.exports=i},82492:(e,t,r)=>{var n=r(42980),i=r(21463)((function(e,t,r){n(e,t,r)}));e.exports=i},30236:(e,t,r)=>{var n=r(42980),i=r(21463)((function(e,t,r,i){n(e,t,r,i)}));e.exports=i},50308:e=>{e.exports=function(){}},7771:(e,t,r)=>{var n=r(55639);e.exports=function(){return n.Date.now()}},82723:(e,t,r)=>{var n=r(29932),i=r(85990),o=r(57406),a=r(71811),s=r(98363),c=r(60696),u=r(99021),l=r(46904),d=u((function(e,t){var r={};if(null==e)return r;var u=!1;t=n(t,(function(t){return t=a(t,e),u||(u=t.length>1),t})),s(e,l(e),r),u&&(r=i(r,7,c));for(var d=t.length;d--;)o(r,t[d]);return r}));e.exports=d},51463:(e,t,r)=>{var n=r(89567);e.exports=function(e){return n(2,e)}},75472:(e,t,r)=>{var n=r(82689),i=r(1469);e.exports=function(e,t,r,o){return null==e?[]:(i(t)||(t=null==t?[]:[t]),i(r=o?void 0:r)||(r=null==r?[]:[r]),n(e,t,r))}},53131:(e,t,r)=>{var n=r(5976),i=r(97727),o=r(20893),a=r(46460),s=n((function(e,t){var r=a(t,o(s));return i(e,32,void 0,t,r)}));s.placeholder={},e.exports=s},43174:(e,t,r)=>{var n=r(55189)((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]}));e.exports=n},78718:(e,t,r)=>{var n=r(25970),i=r(99021)((function(e,t){return null==e?{}:n(e,t)}));e.exports=i},39601:(e,t,r)=>{var n=r(40371),i=r(79152),o=r(15403),a=r(40327);e.exports=function(e){return o(e)?n(a(e)):i(e)}},58613:(e,t,r)=>{var n=r(71811),i=r(23560),o=r(40327);e.exports=function(e,t,r){var a=-1,s=(t=n(t,e)).length;for(s||(s=1,e=void 0);++a<s;){var c=null==e?void 0:e[o(t[a])];void 0===c&&(a=s,c=r),e=i(c)?c.call(e):c}return e}},36968:(e,t,r)=>{var n=r(10611);e.exports=function(e,t,r){return null==e?e:n(e,t,r)}},70479:e=>{e.exports=function(){return[]}},95062:e=>{e.exports=function(){return!1}},18601:(e,t,r)=>{var n=r(14841),i=1/0;e.exports=function(e){return e?(e=n(e))===i||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},40554:(e,t,r)=>{var n=r(18601);e.exports=function(e){var t=n(e),r=t%1;return t==t?r?t-r:t:0}},14841:(e,t,r)=>{var n=r(27561),i=r(13218),o=r(33448),a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(o(e))return NaN;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=s.test(e);return r||c.test(e)?u(e.slice(2),r?2:8):a.test(e)?NaN:+e}},59881:(e,t,r)=>{var n=r(98363),i=r(81704);e.exports=function(e){return n(e,i(e))}},79833:(e,t,r)=>{var n=r(80531);e.exports=function(e){return null==e?"":n(e)}},93386:(e,t,r)=>{var n=r(21078),i=r(5976),o=r(45652),a=r(29246),s=i((function(e){return o(n(e,1,a,!0))}));e.exports=s},77043:(e,t,r)=>{var n=r(21078),i=r(67206),o=r(5976),a=r(45652),s=r(29246),c=r(10928),u=o((function(e){var t=c(e);return s(t)&&(t=void 0),a(n(e,1,s,!0),i(t,2))}));e.exports=u},73955:(e,t,r)=>{var n=r(79833),i=0;e.exports=function(e){var t=++i;return n(e)+t}},98601:(e,t,r)=>{var n=r(57406);e.exports=function(e,t){return null==e||n(e,t)}},11700:(e,t,r)=>{var n=r(98805)("toUpperCase");e.exports=n},52628:(e,t,r)=>{var n=r(47415),i=r(3674);e.exports=function(e){return null==e?[]:n(e,i(e))}},58748:(e,t,r)=>{var n=r(49029),i=r(93157),o=r(79833),a=r(2757);e.exports=function(e,t,r){return e=o(e),void 0===(t=r?void 0:t)?i(e)?a(e):n(e):e.match(t)||[]}},90359:(e,t,r)=>{var n=r(54290),i=r(53131);e.exports=function(e,t){return i(n(t),e)}},8111:(e,t,r)=>{var n=r(96425),i=r(7548),o=r(9435),a=r(1469),s=r(37005),c=r(21913),u=Object.prototype.hasOwnProperty;function l(e){if(s(e)&&!a(e)&&!(e instanceof n)){if(e instanceof i)return e;if(u.call(e,"__wrapped__"))return c(e)}return new i(e)}l.prototype=o.prototype,l.prototype.constructor=l,e.exports=l},39593:(e,t,r)=>{"use strict";const n=r(34411),i=Symbol("max"),o=Symbol("length"),a=Symbol("lengthCalculator"),s=Symbol("allowStale"),c=Symbol("maxAge"),u=Symbol("dispose"),l=Symbol("noDisposeOnSet"),d=Symbol("lruList"),f=Symbol("cache"),h=Symbol("updateAgeOnGet"),p=()=>1;const v=(e,t,r)=>{const n=e[f].get(t);if(n){const t=n.value;if(m(e,t)){if(y(e,n),!e[s])return}else r&&(e[h]&&(n.value.now=Date.now()),e[d].unshiftNode(n));return t.value}},m=(e,t)=>{if(!t||!t.maxAge&&!e[c])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[c]&&r>e[c]},g=e=>{if(e[o]>e[i])for(let t=e[d].tail;e[o]>e[i]&&null!==t;){const r=t.prev;y(e,t),t=r}},y=(e,t)=>{if(t){const r=t.value;e[u]&&e[u](r.key,r.value),e[o]-=r.length,e[f].delete(r.key),e[d].removeNode(t)}};class b{constructor(e,t,r,n,i){this.key=e,this.value=t,this.length=r,this.now=n,this.maxAge=i||0}}const E=(e,t,r,n)=>{let i=r.value;m(e,i)&&(y(e,r),e[s]||(i=void 0)),i&&t.call(n,i.value,i.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[i]=e.max||1/0;const t=e.length||p;if(this[a]="function"!=typeof t?p:t,this[s]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[c]=e.maxAge||0,this[u]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[h]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||1/0,g(this)}get max(){return this[i]}set allowStale(e){this[s]=!!e}get allowStale(){return this[s]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[c]=e,g(this)}get maxAge(){return this[c]}set lengthCalculator(e){"function"!=typeof e&&(e=p),e!==this[a]&&(this[a]=e,this[o]=0,this[d].forEach((e=>{e.length=this[a](e.value,e.key),this[o]+=e.length}))),g(this)}get lengthCalculator(){return this[a]}get length(){return this[o]}get itemCount(){return this[d].length}rforEach(e,t){t=t||this;for(let r=this[d].tail;null!==r;){const n=r.prev;E(this,e,r,t),r=n}}forEach(e,t){t=t||this;for(let r=this[d].head;null!==r;){const n=r.next;E(this,e,r,t),r=n}}keys(){return this[d].toArray().map((e=>e.key))}values(){return this[d].toArray().map((e=>e.value))}reset(){this[u]&&this[d]&&this[d].length&&this[d].forEach((e=>this[u](e.key,e.value))),this[f]=new Map,this[d]=new n,this[o]=0}dump(){return this[d].map((e=>!m(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[d]}set(e,t,r){if((r=r||this[c])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const n=r?Date.now():0,s=this[a](t,e);if(this[f].has(e)){if(s>this[i])return y(this,this[f].get(e)),!1;const a=this[f].get(e).value;return this[u]&&(this[l]||this[u](e,a.value)),a.now=n,a.maxAge=r,a.value=t,this[o]+=s-a.length,a.length=s,this.get(e),g(this),!0}const h=new b(e,t,s,n,r);return h.length>this[i]?(this[u]&&this[u](e,t),!1):(this[o]+=h.length,this[d].unshift(h),this[f].set(e,this[d].head),g(this),!0)}has(e){if(!this[f].has(e))return!1;const t=this[f].get(e).value;return!m(this,t)}get(e){return v(this,e,!0)}peek(e){return v(this,e,!1)}pop(){const e=this[d].tail;return e?(y(this,e),e.value):null}del(e){y(this,this[f].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const n=e[r],i=n.e||0;if(0===i)this.set(n.k,n.v);else{const e=i-t;e>0&&this.set(n.k,n.v,e)}}}prune(){this[f].forEach(((e,t)=>v(this,t,!1)))}}},57824:e=>{var t=1e3,r=60*t,n=60*r,i=24*n,o=7*i,a=365.25*i;function s(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,c){c=c||{};var u=typeof e;if("string"===u&&e.length>0)return function(e){if((e=String(e)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*a;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*i;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===u&&isFinite(e))return c.long?function(e){var o=Math.abs(e);if(o>=i)return s(e,o,i,"day");if(o>=n)return s(e,o,n,"hour");if(o>=r)return s(e,o,r,"minute");if(o>=t)return s(e,o,t,"second");return e+" ms"}(e):function(e){var o=Math.abs(e);if(o>=i)return Math.round(e/i)+"d";if(o>=n)return Math.round(e/n)+"h";if(o>=r)return Math.round(e/r)+"m";if(o>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},70631:(e,t,r)=>{var n="function"==typeof Map&&Map.prototype,i=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,o=n&&i&&"function"==typeof i.get?i.get:null,a=n&&Map.prototype.forEach,s="function"==typeof Set&&Set.prototype,c=Object.getOwnPropertyDescriptor&&s?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,u=s&&c&&"function"==typeof c.get?c.get:null,l=s&&Set.prototype.forEach,d="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,f="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,h="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,p=Boolean.prototype.valueOf,v=Object.prototype.toString,m=Function.prototype.toString,g=String.prototype.match,y=String.prototype.slice,b=String.prototype.replace,E=String.prototype.toUpperCase,S=String.prototype.toLowerCase,_=RegExp.prototype.test,w=Array.prototype.concat,R=Array.prototype.join,C=Array.prototype.slice,T=Math.floor,x="function"==typeof BigInt?BigInt.prototype.valueOf:null,k=Object.getOwnPropertySymbols,I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,A="function"==typeof Symbol&&"object"==typeof Symbol.iterator,O="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===A||"symbol")?Symbol.toStringTag:null,L=Object.prototype.propertyIsEnumerable,M=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function N(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||_.call(/e/,t))return t;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var n=e<0?-T(-e):T(e);if(n!==e){var i=String(n),o=y.call(t,i.length+1);return b.call(i,r,"$&_")+"."+b.call(b.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return b.call(t,r,"$&_")}var P=r(24654),D=P.custom,F=V(D)?D:null;function U(e,t,r){var n="double"===(r.quoteStyle||t)?'"':"'";return n+e+n}function j(e){return b.call(String(e),/"/g,""")}function B(e){return!("[object Array]"!==z(e)||O&&"object"==typeof e&&O in e)}function q(e){return!("[object RegExp]"!==z(e)||O&&"object"==typeof e&&O in e)}function V(e){if(A)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!I)return!1;try{return I.call(e),!0}catch(e){}return!1}e.exports=function e(t,n,i,s){var c=n||{};if(W(c,"quoteStyle")&&"single"!==c.quoteStyle&&"double"!==c.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(W(c,"maxStringLength")&&("number"==typeof c.maxStringLength?c.maxStringLength<0&&c.maxStringLength!==1/0:null!==c.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var v=!W(c,"customInspect")||c.customInspect;if("boolean"!=typeof v&&"symbol"!==v)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(W(c,"indent")&&null!==c.indent&&"\t"!==c.indent&&!(parseInt(c.indent,10)===c.indent&&c.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(W(c,"numericSeparator")&&"boolean"!=typeof c.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var E=c.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 K(t,c);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var _=String(t);return E?N(t,_):_}if("bigint"==typeof t){var T=String(t)+"n";return E?N(t,T):T}var k=void 0===c.depth?5:c.depth;if(void 0===i&&(i=0),i>=k&&k>0&&"object"==typeof t)return B(t)?"[Array]":"[Object]";var D=function(e,t){var r;if("\t"===e.indent)r="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;r=R.call(Array(e.indent+1)," ")}return{base:r,prev:R.call(Array(t+1),r)}}(c,i);if(void 0===s)s=[];else if(H(s,t)>=0)return"[Circular]";function G(t,r,n){if(r&&(s=C.call(s)).push(r),n){var o={depth:c.depth};return W(c,"quoteStyle")&&(o.quoteStyle=c.quoteStyle),e(t,o,i+1,s)}return e(t,c,i+1,s)}if("function"==typeof t&&!q(t)){var $=function(e){if(e.name)return e.name;var t=g.call(m.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null}(t),ee=Z(t,G);return"[Function"+($?": "+$:" (anonymous)")+"]"+(ee.length>0?" { "+R.call(ee,", ")+" }":"")}if(V(t)){var te=A?b.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):I.call(t);return"object"!=typeof t||A?te:J(te)}if(function(e){if(!e||"object"!=typeof e)return!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;return"string"==typeof e.nodeName&&"function"==typeof e.getAttribute}(t)){for(var re="<"+S.call(String(t.nodeName)),ne=t.attributes||[],ie=0;ie<ne.length;ie++)re+=" "+ne[ie].name+"="+U(j(ne[ie].value),"double",c);return re+=">",t.childNodes&&t.childNodes.length&&(re+="..."),re+="</"+S.call(String(t.nodeName))+">"}if(B(t)){if(0===t.length)return"[]";var oe=Z(t,G);return D&&!function(e){for(var t=0;t<e.length;t++)if(H(e[t],"\n")>=0)return!1;return!0}(oe)?"["+X(oe,D)+"]":"[ "+R.call(oe,", ")+" ]"}if(function(e){return!("[object Error]"!==z(e)||O&&"object"==typeof e&&O in e)}(t)){var ae=Z(t,G);return"cause"in Error.prototype||!("cause"in t)||L.call(t,"cause")?0===ae.length?"["+String(t)+"]":"{ ["+String(t)+"] "+R.call(ae,", ")+" }":"{ ["+String(t)+"] "+R.call(w.call("[cause]: "+G(t.cause),ae),", ")+" }"}if("object"==typeof t&&v){if(F&&"function"==typeof t[F]&&P)return P(t,{depth:k-i});if("symbol"!==v&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!o||!e||"object"!=typeof e)return!1;try{o.call(e);try{u.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var se=[];return a&&a.call(t,(function(e,r){se.push(G(r,t,!0)+" => "+G(e,t))})),Q("Map",o.call(t),se,D)}if(function(e){if(!u||!e||"object"!=typeof e)return!1;try{u.call(e);try{o.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var ce=[];return l&&l.call(t,(function(e){ce.push(G(e,t))})),Q("Set",u.call(t),ce,D)}if(function(e){if(!d||!e||"object"!=typeof e)return!1;try{d.call(e,d);try{f.call(e,f)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return Y("WeakMap");if(function(e){if(!f||!e||"object"!=typeof e)return!1;try{f.call(e,f);try{d.call(e,d)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return Y("WeakSet");if(function(e){if(!h||!e||"object"!=typeof e)return!1;try{return h.call(e),!0}catch(e){}return!1}(t))return Y("WeakRef");if(function(e){return!("[object Number]"!==z(e)||O&&"object"==typeof e&&O in e)}(t))return J(G(Number(t)));if(function(e){if(!e||"object"!=typeof e||!x)return!1;try{return x.call(e),!0}catch(e){}return!1}(t))return J(G(x.call(t)));if(function(e){return!("[object Boolean]"!==z(e)||O&&"object"==typeof e&&O in e)}(t))return J(p.call(t));if(function(e){return!("[object String]"!==z(e)||O&&"object"==typeof e&&O in e)}(t))return J(G(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if(t===r.g)return"{ [object globalThis] }";if(!function(e){return!("[object Date]"!==z(e)||O&&"object"==typeof e&&O in e)}(t)&&!q(t)){var ue=Z(t,G),le=M?M(t)===Object.prototype:t instanceof Object||t.constructor===Object,de=t instanceof Object?"":"null prototype",fe=!le&&O&&Object(t)===t&&O in t?y.call(z(t),8,-1):de?"Object":"",he=(le||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(fe||de?"["+R.call(w.call([],fe||[],de||[]),": ")+"] ":"");return 0===ue.length?he+"{}":D?he+"{"+X(ue,D)+"}":he+"{ "+R.call(ue,", ")+" }"}return String(t)};var G=Object.prototype.hasOwnProperty||function(e){return e in this};function W(e,t){return G.call(e,t)}function z(e){return v.call(e)}function H(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}function K(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return K(y.call(e,0,t.maxStringLength),t)+n}return U(b.call(b.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,$),"single",t)}function $(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+E.call(t.toString(16))}function J(e){return"Object("+e+")"}function Y(e){return e+" { ? }"}function Q(e,t,r,n){return e+" ("+t+") {"+(n?X(r,n):R.call(r,", "))+"}"}function X(e,t){if(0===e.length)return"";var r="\n"+t.prev+t.base;return r+R.call(e,","+r)+"\n"+t.prev}function Z(e,t){var r=B(e),n=[];if(r){n.length=e.length;for(var i=0;i<e.length;i++)n[i]=W(e,i)?t(e[i],e):""}var o,a="function"==typeof k?k(e):[];if(A){o={};for(var s=0;s<a.length;s++)o["$"+a[s]]=a[s]}for(var c in e)W(e,c)&&(r&&String(Number(c))===c&&c<e.length||A&&o["$"+c]instanceof Symbol||(_.call(/[^\w$]/,c)?n.push(t(c,e)+": "+t(e[c],e)):n.push(c+": "+t(e[c],e))));if("function"==typeof k)for(var u=0;u<a.length;u++)L.call(e,a[u])&&n.push("["+t(a[u])+"]: "+t(e[a[u]],e));return n}},24753:(e,t,r)=>{e.exports=r(24753)},4947:e=>{var t=function(e){return e.replace(/^\s+|\s+$/g,"")};e.exports=function(e){if(!e)return{};for(var r,n={},i=t(e).split("\n"),o=0;o<i.length;o++){var a=i[o],s=a.indexOf(":"),c=t(a.slice(0,s)).toLowerCase(),u=t(a.slice(s+1));void 0===n[c]?n[c]=u:(r=n[c],"[object Array]"===Object.prototype.toString.call(r)?n[c].push(u):n[c]=[n[c],u])}return n}},28985:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Deferred=void 0;t.Deferred=class{constructor(){this.resolve=()=>null,this.reject=()=>null,this.promise=new Promise(((e,t)=>{this.reject=t,this.resolve=e}))}}},37279:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EndOfStreamError=t.defaultMessages=void 0,t.defaultMessages="End-Of-Stream";class r extends Error{constructor(){super(t.defaultMessages)}}t.EndOfStreamError=r},56654:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StreamReader=t.EndOfStreamError=void 0;const n=r(37279),i=r(28985);var o=r(37279);Object.defineProperty(t,"EndOfStreamError",{enumerable:!0,get:function(){return o.EndOfStreamError}});t.StreamReader=class{constructor(e){if(this.s=e,this.deferred=null,this.endOfStream=!1,this.peekQueue=[],!e.read||!e.once)throw new Error("Expected an instance of stream.Readable");this.s.once("end",(()=>this.reject(new n.EndOfStreamError))),this.s.once("error",(e=>this.reject(e))),this.s.once("close",(()=>this.reject(new Error("Stream closed"))))}async peek(e,t,r){const n=await this.read(e,t,r);return this.peekQueue.push(e.subarray(t,t+n)),n}async read(e,t,r){if(0===r)return 0;if(0===this.peekQueue.length&&this.endOfStream)throw new n.EndOfStreamError;let i=r,o=0;for(;this.peekQueue.length>0&&i>0;){const r=this.peekQueue.pop();if(!r)throw new Error("peekData should be defined");const n=Math.min(r.length,i);e.set(r.subarray(0,n),t+o),o+=n,i-=n,n<r.length&&this.peekQueue.push(r.subarray(n))}for(;i>0&&!this.endOfStream;){const r=Math.min(i,1048576),n=await this.readFromStream(e,t+o,r);if(o+=n,n<r)break;i-=n}return o}async readFromStream(e,t,r){const n=this.s.read(r);if(n)return e.set(n,t),n.length;{const n={buffer:e,offset:t,length:r,deferred:new i.Deferred};return this.deferred=n.deferred,this.s.once("readable",(()=>{this.readDeferred(n)})),n.deferred.promise}}readDeferred(e){const t=this.s.read(e.length);t?(e.buffer.set(t,e.offset),e.deferred.resolve(t.length),this.deferred=null):this.s.once("readable",(()=>{this.readDeferred(e)}))}reject(e){this.endOfStream=!0,this.deferred&&(this.deferred.reject(e),this.deferred=null)}}},55167:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StreamReader=t.EndOfStreamError=void 0;var n=r(37279);Object.defineProperty(t,"EndOfStreamError",{enumerable:!0,get:function(){return n.EndOfStreamError}});var i=r(56654);Object.defineProperty(t,"StreamReader",{enumerable:!0,get:function(){return i.StreamReader}})},31795:function(e,t,r){var n;e=r.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,s=i.object&&e&&!e.nodeType&&e,c=a&&s&&"object"==typeof r.g&&r.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(o=c);var u=Math.pow(2,53)-1,l=/\bOpera/,d=Object.prototype,f=d.hasOwnProperty,h=d.toString;function p(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function v(e){return e=E(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:p(e)}function m(e,t){for(var r in e)f.call(e,r)&&t(e[r],r,e)}function g(e){return null==e?p(e):h.call(e).slice(8,-1)}function y(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function b(e,t){var r=null;return function(e,t){var r=-1,n=e?e.length:0;if("number"==typeof n&&n>-1&&n<=u)for(;++r<n;)t(e[r],r,e);else m(e,t)}(e,(function(n,i){r=t(r,n,i,e)})),r}function E(e){return String(e).replace(/^ +| +$/g,"")}var S=function e(t){var r=o,n=t&&"object"==typeof t&&"String"!=g(t);n&&(r=t,t=null);var i=r.navigator||{},a=i.userAgent||"";t||(t=a);var s,c,u,d,f,p=n?!!i.likeChrome:/\bChrome\b/.test(t)&&!/internal|\n/i.test(h.toString()),S="Object",_=n?S:"ScriptBridgingProxyObject",w=n?S:"Environment",R=n&&r.java?"JavaPackage":g(r.java),C=n?S:"RuntimeObject",T=/\bJava/.test(R)&&r.java,x=T&&g(r.environment)==w,k=T?"a":"α",I=T?"b":"β",A=r.document||{},O=r.operamini||r.opera,L=l.test(L=n&&O?O["[[Class]]"]:g(O))?L:O=null,M=t,N=[],P=null,D=t==a,F=D&&O&&"function"==typeof O.version&&O.version(),U=b([{label:"EdgeHTML",pattern:"Edge"},"Trident",{label:"WebKit",pattern:"AppleWebKit"},"iCab","Presto","NetFront","Tasman","KHTML","Gecko"],(function(e,r){return e||RegExp("\\b"+(r.pattern||y(r))+"\\b","i").exec(t)&&(r.label||r)})),j=function(e){return b(e,(function(e,r){return e||RegExp("\\b"+(r.pattern||y(r))+"\\b","i").exec(t)&&(r.label||r)}))}(["Adobe AIR","Arora","Avant Browser","Breach","Camino","Electron","Epiphany","Fennec","Flock","Galeon","GreenBrowser","iCab","Iceweasel","K-Meleon","Konqueror","Lunascape","Maxthon",{label:"Microsoft Edge",pattern:"(?:Edge|Edg|EdgA|EdgiOS)"},"Midori","Nook Browser","PaleMoon","PhantomJS","Raven","Rekonq","RockMelt",{label:"Samsung Internet",pattern:"SamsungBrowser"},"SeaMonkey",{label:"Silk",pattern:"(?:Cloud9|Silk-Accelerated)"},"Sleipnir","SlimBrowser",{label:"SRWare Iron",pattern:"Iron"},"Sunrise","Swiftfox","Vivaldi","Waterfox","WebPositive",{label:"Yandex Browser",pattern:"YaBrowser"},{label:"UC Browser",pattern:"UCBrowser"},"Opera Mini",{label:"Opera Mini",pattern:"OPiOS"},"Opera",{label:"Opera",pattern:"OPR"},"Chromium","Chrome",{label:"Chrome",pattern:"(?:HeadlessChrome)"},{label:"Chrome Mobile",pattern:"(?:CriOS|CrMo)"},{label:"Firefox",pattern:"(?:Firefox|Minefield)"},{label:"Firefox for iOS",pattern:"FxiOS"},{label:"IE",pattern:"IEMobile"},{label:"IE",pattern:"MSIE"},"Safari"]),B=G([{label:"BlackBerry",pattern:"BB10"},"BlackBerry",{label:"Galaxy S",pattern:"GT-I9000"},{label:"Galaxy S2",pattern:"GT-I9100"},{label:"Galaxy S3",pattern:"GT-I9300"},{label:"Galaxy S4",pattern:"GT-I9500"},{label:"Galaxy S5",pattern:"SM-G900"},{label:"Galaxy S6",pattern:"SM-G920"},{label:"Galaxy S6 Edge",pattern:"SM-G925"},{label:"Galaxy S7",pattern:"SM-G930"},{label:"Galaxy S7 Edge",pattern:"SM-G935"},"Google TV","Lumia","iPad","iPod","iPhone","Kindle",{label:"Kindle Fire",pattern:"(?:Cloud9|Silk-Accelerated)"},"Nexus","Nook","PlayBook","PlayStation Vita","PlayStation","TouchPad","Transformer",{label:"Wii U",pattern:"WiiU"},"Wii","Xbox One",{label:"Xbox 360",pattern:"Xbox"},"Xoom"]),q=function(e){return b(e,(function(e,r,n){return e||(r[B]||r[/^[a-z]+(?: +[a-z]+\b)*/i.exec(B)]||RegExp("\\b"+y(n)+"(?:\\b|\\w*\\d)","i").exec(t))&&n}))}({Apple:{iPad:1,iPhone:1,iPod:1},Alcatel:{},Archos:{},Amazon:{Kindle:1,"Kindle Fire":1},Asus:{Transformer:1},"Barnes & Noble":{Nook:1},BlackBerry:{PlayBook:1},Google:{"Google TV":1,Nexus:1},HP:{TouchPad:1},HTC:{},Huawei:{},Lenovo:{},LG:{},Microsoft:{Xbox:1,"Xbox One":1},Motorola:{Xoom:1},Nintendo:{"Wii U":1,Wii:1},Nokia:{Lumia:1},Oppo:{},Samsung:{"Galaxy S":1,"Galaxy S2":1,"Galaxy S3":1,"Galaxy S4":1},Sony:{PlayStation:1,"PlayStation Vita":1},Xiaomi:{Mi:1,Redmi:1}}),V=function(e){return b(e,(function(e,r){var n=r.pattern||y(r);return!e&&(e=RegExp("\\b"+n+"(?:/[\\d.]+|[ \\w.]*)","i").exec(t))&&(e=function(e,t,r){var n={"10.0":"10",6.4:"10 Technical Preview",6.3:"8.1",6.2:"8",6.1:"Server 2008 R2 / 7","6.0":"Server 2008 / Vista",5.2:"Server 2003 / XP 64-bit",5.1:"XP",5.01:"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};return t&&r&&/^Win/i.test(e)&&!/^Windows Phone /i.test(e)&&(n=n[/[\d.]+$/.exec(e)])&&(e="Windows "+n),e=String(e),t&&r&&(e=e.replace(RegExp(t,"i"),r)),v(e.replace(/ ce$/i," CE").replace(/\bhpw/i,"web").replace(/\bMacintosh\b/,"Mac OS").replace(/_PowerPC\b/i," OS").replace(/\b(OS X) [^ \d]+/i,"$1").replace(/\bMac (OS X)\b/,"$1").replace(/\/(\d)/," $1").replace(/_/g,".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i,"").replace(/\bx86\.64\b/gi,"x86_64").replace(/\b(Windows Phone) OS\b/,"$1").replace(/\b(Chrome OS \w+) [\d.]+\b/,"$1").split(" on ")[0])}(e,n,r.label||r)),e}))}(["Windows Phone","KaiOS","Android","CentOS",{label:"Chrome OS",pattern:"CrOS"},"Debian",{label:"DragonFly BSD",pattern:"DragonFly"},"Fedora","FreeBSD","Gentoo","Haiku","Kubuntu","Linux Mint","OpenBSD","Red Hat","SuSE","Ubuntu","Xubuntu","Cygwin","Symbian OS","hpwOS","webOS ","webOS","Tablet OS","Tizen","Linux","Mac OS X","Macintosh","Mac","Windows 98;","Windows "]);function G(e){return b(e,(function(e,r){var n=r.pattern||y(r);return!e&&(e=RegExp("\\b"+n+" *\\d+[.\\w_]*","i").exec(t)||RegExp("\\b"+n+" *\\w+-[\\w]*","i").exec(t)||RegExp("\\b"+n+"(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)","i").exec(t))&&((e=String(r.label&&!RegExp(n,"i").test(r.label)?r.label:e).split("/"))[1]&&!/[\d.]+/.test(e[0])&&(e[0]+=" "+e[1]),r=r.label||r,e=v(e[0].replace(RegExp(n,"i"),r).replace(RegExp("; *(?:"+r+"[_-])?","i")," ").replace(RegExp("("+r+")[-_.]?(\\w)","i"),"$1 $2"))),e}))}function W(e){return b(e,(function(e,r){return e||(RegExp(r+"(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)","i").exec(t)||0)[1]||null}))}if(U&&(U=[U]),/\bAndroid\b/.test(V)&&!B&&(s=/\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(t))&&(B=E(s[1]).replace(/^[a-z]{2}-[a-z]{2};\s*/i,"")||null),q&&!B?B=G([q]):q&&B&&(B=B.replace(RegExp("^("+y(q)+")[-_.\\s]","i"),q+" ").replace(RegExp("^("+y(q)+")[-_.]?(\\w)","i"),q+" $2")),(s=/\bGoogle TV\b/.exec(B))&&(B=s[0]),/\bSimulator\b/i.test(t)&&(B=(B?B+" ":"")+"Simulator"),"Opera Mini"==j&&/\bOPiOS\b/.test(t)&&N.push("running in Turbo/Uncompressed mode"),"IE"==j&&/\blike iPhone OS\b/.test(t)?(q=(s=e(t.replace(/like iPhone OS/,""))).manufacturer,B=s.product):/^iP/.test(B)?(j||(j="Safari"),V="iOS"+((s=/ OS ([\d_]+)/i.exec(t))?" "+s[1].replace(/_/g,"."):"")):"Konqueror"==j&&/^Linux\b/i.test(V)?V="Kubuntu":q&&"Google"!=q&&(/Chrome/.test(j)&&!/\bMobile Safari\b/i.test(t)||/\bVita\b/.test(B))||/\bAndroid\b/.test(V)&&/^Chrome/.test(j)&&/\bVersion\//i.test(t)?(j="Android Browser",V=/\bAndroid\b/.test(V)?V:"Android"):"Silk"==j?(/\bMobi/i.test(t)||(V="Android",N.unshift("desktop mode")),/Accelerated *= *true/i.test(t)&&N.unshift("accelerated")):"UC Browser"==j&&/\bUCWEB\b/.test(t)?N.push("speed mode"):"PaleMoon"==j&&(s=/\bFirefox\/([\d.]+)\b/.exec(t))?N.push("identifying as Firefox "+s[1]):"Firefox"==j&&(s=/\b(Mobile|Tablet|TV)\b/i.exec(t))?(V||(V="Firefox OS"),B||(B=s[1])):!j||(s=!/\bMinefield\b/i.test(t)&&/\b(?:Firefox|Safari)\b/.exec(j))?(j&&!B&&/[\/,]|^[^(]+?\)/.test(t.slice(t.indexOf(s+"/")+8))&&(j=null),(s=B||q||V)&&(B||q||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(V))&&(j=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(V)?V:s)+" Browser")):"Electron"==j&&(s=(/\bChrome\/([\d.]+)\b/.exec(t)||0)[1])&&N.push("Chromium "+s),F||(F=W(["(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)","Version",y(j),"(?:Firefox|Minefield|NetFront)"])),(s=("iCab"==U&&parseFloat(F)>3?"WebKit":/\bOpera\b/.test(j)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(U)&&"WebKit"||!U&&/\bMSIE\b/i.test(t)&&("Mac OS"==V?"Tasman":"Trident")||"WebKit"==U&&/\bPlayStation\b(?! Vita\b)/i.test(j)&&"NetFront")&&(U=[s]),"IE"==j&&(s=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(j+=" Mobile",V="Windows Phone "+(/\+$/.test(s)?s:s+".x"),N.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(j="IE Mobile",V="Windows Phone 8.x",N.unshift("desktop mode"),F||(F=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=j&&"Trident"==U&&(s=/\brv:([\d.]+)/.exec(t))&&(j&&N.push("identifying as "+j+(F?" "+F:"")),j="IE",F=s[1]),D){if(d="global",f=null!=(u=r)?typeof u[d]:"number",/^(?:boolean|number|string|undefined)$/.test(f)||"object"==f&&!u[d])g(s=r.runtime)==_?(j="Adobe AIR",V=s.flash.system.Capabilities.os):g(s=r.phantom)==C?(j="PhantomJS",F=(s=s.version||null)&&s.major+"."+s.minor+"."+s.patch):"number"==typeof A.documentMode&&(s=/\bTrident\/(\d+)/i.exec(t))?(F=[F,A.documentMode],(s=+s[1]+4)!=F[1]&&(N.push("IE "+F[1]+" mode"),U&&(U[1]=""),F[1]=s),F="IE"==j?String(F[1].toFixed(1)):F[0]):"number"==typeof A.documentMode&&/^(?:Chrome|Firefox)\b/.test(j)&&(N.push("masking as "+j+" "+F),j="IE",F="11.0",U=["Trident"],V="Windows");else if(T&&(M=(s=T.lang.System).getProperty("os.arch"),V=V||s.getProperty("os.name")+" "+s.getProperty("os.version")),x){try{F=r.require("ringo/engine").version.join("."),j="RingoJS"}catch(e){(s=r.system)&&s.global.system==r.system&&(j="Narwhal",V||(V=s[0].os||null))}j||(j="Rhino")}else"object"==typeof r.process&&!r.process.browser&&(s=r.process)&&("object"==typeof s.versions&&("string"==typeof s.versions.electron?(N.push("Node "+s.versions.node),j="Electron",F=s.versions.electron):"string"==typeof s.versions.nw&&(N.push("Chromium "+F,"Node "+s.versions.node),j="NW.js",F=s.versions.nw)),j||(j="Node.js",M=s.arch,V=s.platform,F=(F=/[\d.]+/.exec(s.version))?F[0]:null));V=V&&v(V)}if(F&&(s=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(F)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(D&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(P=/b/i.test(s)?"beta":"alpha",F=F.replace(RegExp(s+"\\+?$"),"")+("beta"==P?I:k)+(/\d+\+?/.exec(s)||"")),"Fennec"==j||"Firefox"==j&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(V))j="Firefox Mobile";else if("Maxthon"==j&&F)F=F.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(V=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&N.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(j)&&(!j||B||/Browser|Mobi/.test(j))||"Windows CE"!=V&&!/Mobi/i.test(t))if("IE"==j&&D)try{null===r.external&&N.unshift("platform preview")}catch(e){N.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(s=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||F)?(V=((s=[s,/BB10/.test(t)])[1]?(B=null,q="BlackBerry"):"Device Software")+" "+s[0],F=null):this!=m&&"Wii"!=B&&(D&&O||/Opera/.test(j)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==j&&/\bOS X (?:\d+\.){2,}/.test(V)||"IE"==j&&(V&&!/^Win/.test(V)&&F>5.5||/\bWindows XP\b/.test(V)&&F>8||8==F&&!/\bTrident\b/.test(t)))&&!l.test(s=e.call(m,t.replace(l,"")+";"))&&s.name&&(s="ing as "+s.name+((s=s.version)?" "+s:""),l.test(j)?(/\bIE\b/.test(s)&&"Mac OS"==V&&(V=null),s="identify"+s):(s="mask"+s,j=L?v(L.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(s)&&(V=null),D||(F=null)),U=["Presto"],N.push(s));else j+=" Mobile";(s=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(s=[parseFloat(s.replace(/\.(\d)$/,".0$1")),s],"Safari"==j&&"+"==s[1].slice(-1)?(j="WebKit Nightly",P="alpha",F=s[1].slice(0,-1)):F!=s[1]&&F!=(s[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(F=null),s[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==s[0]&&537.36==s[2]&&parseFloat(s[1])>=28&&"WebKit"==U&&(U=["Blink"]),D&&(p||s[1])?(U&&(U[1]="like Chrome"),s=s[1]||((s=s[0])<530?1:s<532?2:s<532.05?3:s<533?4:s<534.03?5:s<534.07?6:s<534.1?7:s<534.13?8:s<534.16?9:s<534.24?10:s<534.3?11:s<535.01?12:s<535.02?"13+":s<535.07?15:s<535.11?16:s<535.19?17:s<536.05?18:s<536.1?19:s<537.01?20:s<537.11?"21+":s<537.13?23:s<537.18?24:s<537.24?25:s<537.36?26:"Blink"!=U?"27":"28")):(U&&(U[1]="like Safari"),s=(s=s[0])<400?1:s<500?2:s<526?3:s<533?4:s<534?"4+":s<535?5:s<537?6:s<538?7:s<601?8:s<602?9:s<604?10:s<606?11:s<608?12:"12"),U&&(U[1]+=" "+(s+="number"==typeof s?".x":/[.+]/.test(s)?"":"+")),"Safari"==j&&(!F||parseInt(F)>45)?F=s:"Chrome"==j&&/\bHeadlessChrome/i.test(t)&&N.unshift("headless")),"Opera"==j&&(s=/\bzbov|zvav$/.exec(V))?(j+=" ",N.unshift("desktop mode"),"zvav"==s?(j+="Mini",F=null):j+="Mobile",V=V.replace(RegExp(" *"+s+"$"),"")):"Safari"==j&&/\bChrome\b/.exec(U&&U[1])?(N.unshift("desktop mode"),j="Chrome Mobile",F=null,/\bOS X\b/.test(V)?(q="Apple",V="iOS 4.3+"):V=null):/\bSRWare Iron\b/.test(j)&&!F&&(F=W("Chrome")),F&&0==F.indexOf(s=/[\d.]+$/.exec(V))&&t.indexOf("/"+s+"-")>-1&&(V=E(V.replace(s,""))),V&&-1!=V.indexOf(j)&&!RegExp(j+" OS").test(V)&&(V=V.replace(RegExp(" *"+y(j)+" *"),"")),U&&!/\b(?:Avant|Nook)\b/.test(j)&&(/Browser|Lunascape|Maxthon/.test(j)||"Safari"!=j&&/^iOS/.test(V)&&/\bSafari\b/.test(U[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(j)&&U[1])&&(s=U[U.length-1])&&N.push(s),N.length&&(N=["("+N.join("; ")+")"]),q&&B&&B.indexOf(q)<0&&N.push("on "+q),B&&N.push((/^on /.test(N[N.length-1])?"":"on ")+B),V&&(s=/ ([\d.+]+)$/.exec(V),c=s&&"/"==V.charAt(V.length-s[0].length-1),V={architecture:32,family:s&&!c?V.replace(s[0],""):V,version:s?s[1]:null,toString:function(){var e=this.version;return this.family+(e&&!c?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(s=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(M))&&!/\bi686\b/i.test(M)?(V&&(V.architecture=64,V.family=V.family.replace(RegExp(" *"+s),"")),j&&(/\bWOW64\b/i.test(t)||D&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&N.unshift("32-bit")):V&&/^OS X/.test(V.family)&&"Chrome"==j&&parseFloat(F)>=39&&(V.architecture=64),t||(t=null);var z={};return z.description=t,z.layout=U&&U[0],z.manufacturer=q,z.name=j,z.prerelease=P,z.product=B,z.ua=t,z.version=j&&F,z.os=V||{architecture:null,family:null,version:null,toString:function(){return"null"}},z.parse=e,z.toString=function(){return this.description||""},z.version&&N.unshift(F),z.name&&N.unshift(j),V&&j&&(V!=String(V).split(" ")[0]||V!=j.split(" ")[0]&&!B)&&N.push(B?"("+V+")":"on "+V),N.length&&(z.description=N.join(" ")),z}();o.platform=S,void 0===(n=function(){return S}.call(t,r,t,e))||(e.exports=n)}.call(this)},3814:(e,t,r)=>{e.exports=r(91361)},91361:(e,t,r)=>{var n=r(89539),i=e.exports=r(73984);function o(e,t,r,i){r=r||"";var o=new e(n.format.apply(this,[r].concat(i)));throw Error.captureStackTrace(o,t),o}function a(e,t,r){o(i.IllegalArgumentError,e,t,r)}function s(e){var t=typeof e;if("object"==t){if(!e)return"null";if(e instanceof Array)return"array"}return t}function c(e){return function(t,r){var n=s(t);if(n==e)return t;a(arguments.callee,r||'Expected "'+e+'" but got "'+n+'".',Array.prototype.slice.call(arguments,2))}}e.exports.checkArgument=function(e,t){e||a(arguments.callee,t,Array.prototype.slice.call(arguments,2))},e.exports.checkState=function(e,t){e||function(e,t,r){o(i.IllegalStateError,e,t,r)}(arguments.callee,t,Array.prototype.slice.call(arguments,2))},e.exports.checkIsDef=function(e,t){if(void 0!==e)return e;a(arguments.callee,t||"Expected value to be defined but was undefined.",Array.prototype.slice.call(arguments,2))},e.exports.checkIsDefAndNotNull=function(e,t){if(null!=e)return e;a(arguments.callee,t||'Expected value to be defined and not null but got "'+s(e)+'".',Array.prototype.slice.call(arguments,2))},e.exports.checkIsString=c("string"),e.exports.checkIsArray=c("array"),e.exports.checkIsNumber=c("number"),e.exports.checkIsBoolean=c("boolean"),e.exports.checkIsFunction=c("function"),e.exports.checkIsObject=c("object")},73984:(e,t,r)=>{var n=r(89539);function i(e){Error.call(this,e),this.message=e}function o(e){Error.call(this,e),this.message=e}n.inherits(i,Error),i.prototype.name="IllegalArgumentError",n.inherits(o,Error),o.prototype.name="IllegalStateError",e.exports.IllegalStateError=o,e.exports.IllegalArgumentError=i},34155:e=>{var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var s,c=[],u=!1,l=-1;function d(){u&&s&&(u=!1,s.length?c=s.concat(c):l=-1,c.length&&f())}function f(){if(!u){var e=a(d);u=!0;for(var t=c.length;t;){for(s=c,c=[];++l<t;)s&&s[l].run();l=-1,t=c.length}s=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function p(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new h(e,t)),1!==c.length||u||a(f)},h.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},55798:e=>{"use strict";var t=String.prototype.replace,r=/%20/g,n="RFC1738",i="RFC3986";e.exports={default:i,formatters:{RFC1738:function(e){return t.call(e,r,"+")},RFC3986:function(e){return String(e)}},RFC1738:n,RFC3986:i}},80129:(e,t,r)=>{"use strict";var n=r(58261),i=r(55235),o=r(55798);e.exports={formats:o,parse:i,stringify:n}},55235:(e,t,r)=>{"use strict";var n=r(12769),i=Object.prototype.hasOwnProperty,o=Array.isArray,a={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:n.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},s=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},c=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},u=function(e,t,r,n){if(e){var o=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/g,s=r.depth>0&&/(\[[^[\]]*])/.exec(o),u=s?o.slice(0,s.index):o,l=[];if(u){if(!r.plainObjects&&i.call(Object.prototype,u)&&!r.allowPrototypes)return;l.push(u)}for(var d=0;r.depth>0&&null!==(s=a.exec(o))&&d<r.depth;){if(d+=1,!r.plainObjects&&i.call(Object.prototype,s[1].slice(1,-1))&&!r.allowPrototypes)return;l.push(s[1])}return s&&l.push("["+o.slice(s.index)+"]"),function(e,t,r,n){for(var i=n?t:c(t,r),o=e.length-1;o>=0;--o){var a,s=e[o];if("[]"===s&&r.parseArrays)a=[].concat(i);else{a=r.plainObjects?Object.create(null):{};var u="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,l=parseInt(u,10);r.parseArrays||""!==u?!isNaN(l)&&s!==u&&String(l)===u&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(a=[])[l]=i:"__proto__"!==u&&(a[u]=i):a={0:i}}i=a}return i}(l,t,r,n)}};e.exports=function(e,t){var r=function(e){if(!e)return a;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?a.charset:e.charset;return{allowDots:void 0===e.allowDots?a.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:a.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:a.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:a.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:a.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:a.comma,decoder:"function"==typeof e.decoder?e.decoder:a.decoder,delimiter:"string"==typeof e.delimiter||n.isRegExp(e.delimiter)?e.delimiter:a.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:a.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:a.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:a.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:a.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:a.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var l="string"==typeof e?function(e,t){var r,u={__proto__:null},l=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,d=t.parameterLimit===1/0?void 0:t.parameterLimit,f=l.split(t.delimiter,d),h=-1,p=t.charset;if(t.charsetSentinel)for(r=0;r<f.length;++r)0===f[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===f[r]?p="utf-8":"utf8=%26%2310003%3B"===f[r]&&(p="iso-8859-1"),h=r,r=f.length);for(r=0;r<f.length;++r)if(r!==h){var v,m,g=f[r],y=g.indexOf("]="),b=-1===y?g.indexOf("="):y+1;-1===b?(v=t.decoder(g,a.decoder,p,"key"),m=t.strictNullHandling?null:""):(v=t.decoder(g.slice(0,b),a.decoder,p,"key"),m=n.maybeMap(c(g.slice(b+1),t),(function(e){return t.decoder(e,a.decoder,p,"value")}))),m&&t.interpretNumericEntities&&"iso-8859-1"===p&&(m=s(m)),g.indexOf("[]=")>-1&&(m=o(m)?[m]:m),i.call(u,v)?u[v]=n.combine(u[v],m):u[v]=m}return u}(e,r):e,d=r.plainObjects?Object.create(null):{},f=Object.keys(l),h=0;h<f.length;++h){var p=f[h],v=u(p,l[p],r,"string"==typeof e);d=n.merge(d,v,r)}return!0===r.allowSparse?d:n.compact(d)}},58261:(e,t,r)=>{"use strict";var n=r(37478),i=r(12769),o=r(55798),a=Object.prototype.hasOwnProperty,s={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},c=Array.isArray,u=Array.prototype.push,l=function(e,t){u.apply(e,c(t)?t:[t])},d=Date.prototype.toISOString,f=o.default,h={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:i.encode,encodeValuesOnly:!1,format:f,formatter:o.formatters[f],indices:!1,serializeDate:function(e){return d.call(e)},skipNulls:!1,strictNullHandling:!1},p={},v=function e(t,r,o,a,s,u,d,f,v,m,g,y,b,E,S,_){for(var w,R=t,C=_,T=0,x=!1;void 0!==(C=C.get(p))&&!x;){var k=C.get(t);if(T+=1,void 0!==k){if(k===T)throw new RangeError("Cyclic object value");x=!0}void 0===C.get(p)&&(T=0)}if("function"==typeof f?R=f(r,R):R instanceof Date?R=g(R):"comma"===o&&c(R)&&(R=i.maybeMap(R,(function(e){return e instanceof Date?g(e):e}))),null===R){if(s)return d&&!E?d(r,h.encoder,S,"key",y):r;R=""}if("string"==typeof(w=R)||"number"==typeof w||"boolean"==typeof w||"symbol"==typeof w||"bigint"==typeof w||i.isBuffer(R))return d?[b(E?r:d(r,h.encoder,S,"key",y))+"="+b(d(R,h.encoder,S,"value",y))]:[b(r)+"="+b(String(R))];var I,A=[];if(void 0===R)return A;if("comma"===o&&c(R))E&&d&&(R=i.maybeMap(R,d)),I=[{value:R.length>0?R.join(",")||null:void 0}];else if(c(f))I=f;else{var O=Object.keys(R);I=v?O.sort(v):O}for(var L=a&&c(R)&&1===R.length?r+"[]":r,M=0;M<I.length;++M){var N=I[M],P="object"==typeof N&&void 0!==N.value?N.value:R[N];if(!u||null!==P){var D=c(R)?"function"==typeof o?o(L,N):L:L+(m?"."+N:"["+N+"]");_.set(t,T);var F=n();F.set(p,_),l(A,e(P,D,o,a,s,u,"comma"===o&&E&&c(R)?null:d,f,v,m,g,y,b,E,S,F))}}return A};e.exports=function(e,t){var r,i=e,u=function(e){if(!e)return h;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||h.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=o.default;if(void 0!==e.format){if(!a.call(o.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var n=o.formatters[r],i=h.filter;return("function"==typeof e.filter||c(e.filter))&&(i=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:h.addQueryPrefix,allowDots:void 0===e.allowDots?h.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:h.charsetSentinel,delimiter:void 0===e.delimiter?h.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:h.encode,encoder:"function"==typeof e.encoder?e.encoder:h.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:h.encodeValuesOnly,filter:i,format:r,formatter:n,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:h.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:h.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:h.strictNullHandling}}(t);"function"==typeof u.filter?i=(0,u.filter)("",i):c(u.filter)&&(r=u.filter);var d,f=[];if("object"!=typeof i||null===i)return"";d=t&&t.arrayFormat in s?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var p=s[d];if(t&&"commaRoundTrip"in t&&"boolean"!=typeof t.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var m="comma"===p&&t&&t.commaRoundTrip;r||(r=Object.keys(i)),u.sort&&r.sort(u.sort);for(var g=n(),y=0;y<r.length;++y){var b=r[y];u.skipNulls&&null===i[b]||l(f,v(i[b],b,p,m,u.strictNullHandling,u.skipNulls,u.encode?u.encoder:null,u.filter,u.sort,u.allowDots,u.serializeDate,u.format,u.formatter,u.encodeValuesOnly,u.charset,g))}var E=f.join(u.delimiter),S=!0===u.addQueryPrefix?"?":"";return u.charsetSentinel&&("iso-8859-1"===u.charset?S+="utf8=%26%2310003%3B&":S+="utf8=%E2%9C%93&"),E.length>0?S+E:""}},12769:(e,t,r)=>{"use strict";var n=r(55798),i=Object.prototype.hasOwnProperty,o=Array.isArray,a=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),s=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r};e.exports={arrayToObject:s,assign:function(e,t){return Object.keys(t).reduce((function(e,r){return e[r]=t[r],e}),e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n<t.length;++n)for(var i=t[n],a=i.obj[i.prop],s=Object.keys(a),c=0;c<s.length;++c){var u=s[c],l=a[u];"object"==typeof l&&null!==l&&-1===r.indexOf(l)&&(t.push({obj:a,prop:u}),r.push(l))}return function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(o(r)){for(var n=[],i=0;i<r.length;++i)void 0!==r[i]&&n.push(r[i]);t.obj[t.prop]=n}}}(t),e},decode:function(e,t,r){var n=e.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},encode:function(e,t,r,i,o){if(0===e.length)return e;var s=e;if("symbol"==typeof e?s=Symbol.prototype.toString.call(e):"string"!=typeof e&&(s=String(e)),"iso-8859-1"===r)return escape(s).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var c="",u=0;u<s.length;++u){var l=s.charCodeAt(u);45===l||46===l||95===l||126===l||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||o===n.RFC1738&&(40===l||41===l)?c+=s.charAt(u):l<128?c+=a[l]:l<2048?c+=a[192|l>>6]+a[128|63&l]:l<55296||l>=57344?c+=a[224|l>>12]+a[128|l>>6&63]+a[128|63&l]:(u+=1,l=65536+((1023&l)<<10|1023&s.charCodeAt(u)),c+=a[240|l>>18]+a[128|l>>12&63]+a[128|l>>6&63]+a[128|63&l])}return c},isBuffer:function(e){return!(!e||"object"!=typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(o(e)){for(var r=[],n=0;n<e.length;n+=1)r.push(t(e[n]));return r}return t(e)},merge:function e(t,r,n){if(!r)return t;if("object"!=typeof r){if(o(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(n&&(n.plainObjects||n.allowPrototypes)||!i.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var a=t;return o(t)&&!o(r)&&(a=s(t,n)),o(t)&&o(r)?(r.forEach((function(r,o){if(i.call(t,o)){var a=t[o];a&&"object"==typeof a&&r&&"object"==typeof r?t[o]=e(a,r,n):t.push(r)}else t[o]=r})),t):Object.keys(r).reduce((function(t,o){var a=r[o];return i.call(t,o)?t[o]=e(t[o],a,n):t[o]=a,t}),a)}}},29335:e=>{"use strict";function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,n,i,o){n=n||"&",i=i||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(n);var c=1e3;o&&"number"==typeof o.maxKeys&&(c=o.maxKeys);var u=e.length;c>0&&u>c&&(u=c);for(var l=0;l<u;++l){var d,f,h,p,v=e[l].replace(s,"%20"),m=v.indexOf(i);m>=0?(d=v.substr(0,m),f=v.substr(m+1)):(d=v,f=""),h=decodeURIComponent(d),p=decodeURIComponent(f),t(a,h)?r(a[h])?a[h].push(p):a[h]=[a[h],p]:a[h]=p}return a};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},68795:e=>{"use strict";var t=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,o,a,s){return o=o||"&",a=a||"=",null===e&&(e=void 0),"object"==typeof e?n(i(e),(function(i){var s=encodeURIComponent(t(i))+a;return r(e[i])?n(e[i],(function(e){return s+encodeURIComponent(t(e))})).join(o):s+encodeURIComponent(t(e[i]))})).join(o):s?encodeURIComponent(t(s))+a+encodeURIComponent(t(e)):""};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function n(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n<e.length;n++)r.push(t(e[n],n));return r}var i=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t}},87735:(e,t,r)=>{"use strict";t.decode=t.parse=r(29335),t.encode=t.stringify=r(68795)},94281:e=>{"use strict";var t={};function r(e,r,n){n||(n=Error);var i=function(e){var t,n;function i(t,n,i){return e.call(this,function(e,t,n){return"string"==typeof r?r:r(e,t,n)}(t,n,i))||this}return n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,i}(n);i.prototype.name=n.name,i.prototype.code=e,t[e]=i}function n(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}r("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(e,t,r){var i,o,a,s;if("string"==typeof t&&(o="not ",t.substr(!a||a<0?0:+a,o.length)===o)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))s="The ".concat(e," ").concat(i," ").concat(n(t,"type"));else{var c=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";s='The "'.concat(e,'" ').concat(c," ").concat(i," ").concat(n(t,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.q=t},56753:(e,t,r)=>{"use strict";var n=r(34155),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=l;var o=r(79481),a=r(64229);r(35717)(l,o);for(var s=i(a.prototype),c=0;c<s.length;c++){var u=s[c];l.prototype[u]||(l.prototype[u]=a.prototype[u])}function l(e){if(!(this instanceof l))return new l(e);o.call(this,e),a.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",d)))}function d(){this._writableState.ended||n.nextTick(f,this)}function f(e){e.end()}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(l.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(l.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},82725:(e,t,r)=>{"use strict";e.exports=i;var n=r(74605);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}r(35717)(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},79481:(e,t,r)=>{"use strict";var n,i=r(34155);e.exports=C,C.ReadableState=R;r(17187).EventEmitter;var o=function(e,t){return e.listeners(t).length},a=r(22503),s=r(48764).Buffer,c=(void 0!==r.g?r.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var u,l=r(94616);u=l&&l.debuglog?l.debuglog("stream"):function(){};var d,f,h,p=r(57327),v=r(61195),m=r(82457).getHighWaterMark,g=r(94281).q,y=g.ERR_INVALID_ARG_TYPE,b=g.ERR_STREAM_PUSH_AFTER_EOF,E=g.ERR_METHOD_NOT_IMPLEMENTED,S=g.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(35717)(C,a);var _=v.errorOrDestroy,w=["error","close","destroy","pause","resume"];function R(e,t,i){n=n||r(56753),e=e||{},"boolean"!=typeof i&&(i=t instanceof n),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(this,e,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(d||(d=r(32553).s),this.decoder=new d(e.encoding),this.encoding=e.encoding)}function C(e){if(n=n||r(56753),!(this instanceof C))return new C(e);var t=this instanceof n;this._readableState=new R(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),a.call(this)}function T(e,t,r,n,i){u("readableAddChunk",t);var o,a=e._readableState;if(null===t)a.reading=!1,function(e,t){if(u("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?A(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,O(e)))}(e,a);else if(i||(o=function(e,t){var r;n=t,s.isBuffer(n)||n instanceof c||"string"==typeof t||void 0===t||e.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],t));var n;return r}(a,t)),o)_(e,o);else if(a.objectMode||t&&t.length>0)if("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===s.prototype||(t=function(e){return s.from(e)}(t)),n)a.endEmitted?_(e,new S):x(e,a,t,!0);else if(a.ended)_(e,new b);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(t=a.decoder.write(t),a.objectMode||0!==t.length?x(e,a,t,!1):L(e,a)):x(e,a,t,!1)}else n||(a.reading=!1,L(e,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&A(e)),L(e,t)}Object.defineProperty(C.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),C.prototype.destroy=v.destroy,C.prototype._undestroy=v.undestroy,C.prototype._destroy=function(e,t){t(e)},C.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=s.from(e,t),t=""),r=!0),T(this,e,t,!1,r)},C.prototype.unshift=function(e){return T(this,e,null,!0,!1)},C.prototype.isPaused=function(){return!1===this._readableState.flowing},C.prototype.setEncoding=function(e){d||(d=r(32553).s);var t=new d(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var k=1073741824;function I(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=k?e=k:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,i.nextTick(O,e))}function O(e){var t=e._readableState;u("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,F(e)}function L(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(M,e,t))}function M(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(u("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function N(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function P(e){u("readable nexttick read 0"),e.read(0)}function D(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),F(e),t.flowing&&!t.reading&&e.read(0)}function F(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function U(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function j(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,i.nextTick(B,t,e))}function B(e,t){if(u("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function q(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}C.prototype.read=function(e){u("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?j(this):A(this),null;if(0===(e=I(e,t))&&t.ended)return 0===t.length&&j(this),null;var n,i=t.needReadable;return u("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&u("length less than watermark",i=!0),t.ended||t.reading?u("reading or ended",i=!1):i&&(u("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=I(r,t))),null===(n=e>0?U(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&j(this)),null!==n&&this.emit("data",n),n},C.prototype._read=function(e){_(this,new E("_read()"))},C.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,u("pipe count=%d opts=%j",n.pipesCount,t);var a=(!t||!1!==t.end)&&e!==i.stdout&&e!==i.stderr?c:m;function s(t,i){u("onunpipe"),t===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,u("cleanup"),e.removeListener("close",p),e.removeListener("finish",v),e.removeListener("drain",l),e.removeListener("error",h),e.removeListener("unpipe",s),r.removeListener("end",c),r.removeListener("end",m),r.removeListener("data",f),d=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function c(){u("onend"),e.end()}n.endEmitted?i.nextTick(a):r.once("end",a),e.on("unpipe",s);var l=function(e){return function(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,F(e))}}(r);e.on("drain",l);var d=!1;function f(t){u("ondata");var i=e.write(t);u("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==q(n.pipes,e))&&!d&&(u("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function h(t){u("onerror",t),m(),e.removeListener("error",h),0===o(e,"error")&&_(e,t)}function p(){e.removeListener("finish",v),m()}function v(){u("onfinish"),e.removeListener("close",p),m()}function m(){u("unpipe"),r.unpipe(e)}return r.on("data",f),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",h),e.once("close",p),e.once("finish",v),e.emit("pipe",r),n.flowing||(u("pipe resume"),r.resume()),e},C.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=q(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},C.prototype.on=function(e,t){var r=a.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,u("on readable",n.length,n.reading),n.length?A(this):n.reading||i.nextTick(P,this))),r},C.prototype.addListener=C.prototype.on,C.prototype.removeListener=function(e,t){var r=a.prototype.removeListener.call(this,e,t);return"readable"===e&&i.nextTick(N,this),r},C.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||i.nextTick(N,this),t},C.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(D,e,t))}(this,e)),e.paused=!1,this},C.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},C.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(u("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<w.length;o++)e.on(w[o],this.emit.bind(this,w[o]));return this._read=function(t){u("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(C.prototype[Symbol.asyncIterator]=function(){return void 0===f&&(f=r(45850)),f(this)}),Object.defineProperty(C.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(C.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(C.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),C._fromList=U,Object.defineProperty(C.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(C.from=function(e,t){return void 0===h&&(h=r(15167)),h(C,e,t)})},74605:(e,t,r)=>{"use strict";e.exports=l;var n=r(94281).q,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,a=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=n.ERR_TRANSFORM_WITH_LENGTH_0,c=r(56753);function u(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function l(e){if(!(this instanceof l))return new l(e);c.call(this,e),this._transformState={afterTransform:u.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",d)}function d(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?f(this,null,null):this._flush((function(t,r){f(e,t,r)}))}function f(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new s;if(e._transformState.transforming)throw new a;return e.push(null)}r(35717)(l,c),l.prototype.push=function(e,t){return this._transformState.needTransform=!1,c.prototype.push.call(this,e,t)},l.prototype._transform=function(e,t,r){r(new i("_transform()"))},l.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},l.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},l.prototype._destroy=function(e,t){c.prototype._destroy.call(this,e,(function(e){t(e)}))}},64229:(e,t,r)=>{"use strict";var n,i=r(34155);function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=C,C.WritableState=R;var a={deprecate:r(94927)},s=r(22503),c=r(48764).Buffer,u=(void 0!==r.g?r.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var l,d=r(61195),f=r(82457).getHighWaterMark,h=r(94281).q,p=h.ERR_INVALID_ARG_TYPE,v=h.ERR_METHOD_NOT_IMPLEMENTED,m=h.ERR_MULTIPLE_CALLBACK,g=h.ERR_STREAM_CANNOT_PIPE,y=h.ERR_STREAM_DESTROYED,b=h.ERR_STREAM_NULL_VALUES,E=h.ERR_STREAM_WRITE_AFTER_END,S=h.ERR_UNKNOWN_ENCODING,_=d.errorOrDestroy;function w(){}function R(e,t,a){n=n||r(56753),e=e||{},"boolean"!=typeof a&&(a=t instanceof n),this.objectMode=!!e.objectMode,a&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=f(this,e,"writableHighWaterMark",a),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,o=r.writecb;if("function"!=typeof o)throw new m;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,o){--t.pendingcb,r?(i.nextTick(o,n),i.nextTick(O,e,t),e._writableState.errorEmitted=!0,_(e,n)):(o(n),e._writableState.errorEmitted=!0,_(e,n),O(e,t))}(e,r,n,t,o);else{var a=I(r)||e.destroyed;a||r.corked||r.bufferProcessing||!r.bufferedRequest||k(e,r),n?i.nextTick(x,e,r,a,o):x(e,r,a,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function C(e){var t=this instanceof(n=n||r(56753));if(!t&&!l.call(C,this))return new C(e);this._writableState=new R(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),s.call(this)}function T(e,t,r,n,i,o,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new y("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function x(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),O(e,t)}function k(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),a=t.corkedRequestsFree;a.entry=r;for(var s=0,c=!0;r;)i[s]=r,r.isBuf||(c=!1),r=r.next,s+=1;i.allBuffers=c,T(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,l=r.encoding,d=r.callback;if(T(e,t,!1,t.objectMode?1:u.length,u,l,d),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function I(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function A(e,t){e._final((function(r){t.pendingcb--,r&&_(e,r),t.prefinished=!0,e.emit("prefinish"),O(e,t)}))}function O(e,t){var r=I(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,i.nextTick(A,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}r(35717)(C,s),R.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(R.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(C,Symbol.hasInstance,{value:function(e){return!!l.call(this,e)||this===C&&(e&&e._writableState instanceof R)}})):l=function(e){return e instanceof this},C.prototype.pipe=function(){_(this,new g)},C.prototype.write=function(e,t,r){var n,o=this._writableState,a=!1,s=!o.objectMode&&(n=e,c.isBuffer(n)||n instanceof u);return s&&!c.isBuffer(e)&&(e=function(e){return c.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof r&&(r=w),o.ending?function(e,t){var r=new E;_(e,r),i.nextTick(t,r)}(this,r):(s||function(e,t,r,n){var o;return null===r?o=new b:"string"==typeof r||t.objectMode||(o=new p("chunk",["string","Buffer"],r)),!o||(_(e,o),i.nextTick(n,o),!1)}(this,o,e,r))&&(o.pendingcb++,a=function(e,t,r,n,i,o){if(!r){var a=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=c.from(t,r));return t}(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=t.objectMode?1:n.length;t.length+=s;var u=t.length<t.highWaterMark;u||(t.needDrain=!0);if(t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else T(e,t,!1,s,n,i,o);return u}(this,o,s,e,t,r)),a},C.prototype.cork=function(){this._writableState.corked++},C.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||k(this,e))},C.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new S(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(C.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(C.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),C.prototype._write=function(e,t,r){r(new v("_write()"))},C.prototype._writev=null,C.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,r){t.ending=!0,O(e,t),r&&(t.finished?i.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(C.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(C.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),C.prototype.destroy=d.destroy,C.prototype._undestroy=d.undestroy,C.prototype._destroy=function(e,t){t(e)}},45850:(e,t,r)=>{"use strict";var n,i=r(34155);function o(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=r(8610),s=Symbol("lastResolve"),c=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),d=Symbol("lastPromise"),f=Symbol("handlePromise"),h=Symbol("stream");function p(e,t){return{value:e,done:t}}function v(e){var t=e[s];if(null!==t){var r=e[h].read();null!==r&&(e[d]=null,e[s]=null,e[c]=null,t(p(r,!1)))}}function m(e){i.nextTick(v,e)}var g=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((o(n={get stream(){return this[h]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[l])return Promise.resolve(p(void 0,!0));if(this[h].destroyed)return new Promise((function(t,r){i.nextTick((function(){e[u]?r(e[u]):t(p(void 0,!0))}))}));var r,n=this[d];if(n)r=new Promise(function(e,t){return function(r,n){e.then((function(){t[l]?r(p(void 0,!0)):t[f](r,n)}),n)}}(n,this));else{var o=this[h].read();if(null!==o)return Promise.resolve(p(o,!1));r=new Promise(this[f])}return this[d]=r,r}},Symbol.asyncIterator,(function(){return this})),o(n,"return",(function(){var e=this;return new Promise((function(t,r){e[h].destroy(null,(function(e){e?r(e):t(p(void 0,!0))}))}))})),n),g);e.exports=function(e){var t,r=Object.create(y,(o(t={},h,{value:e,writable:!0}),o(t,s,{value:null,writable:!0}),o(t,c,{value:null,writable:!0}),o(t,u,{value:null,writable:!0}),o(t,l,{value:e._readableState.endEmitted,writable:!0}),o(t,f,{value:function(e,t){var n=r[h].read();n?(r[d]=null,r[s]=null,r[c]=null,e(p(n,!1))):(r[s]=e,r[c]=t)},writable:!0}),t));return r[d]=null,a(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[c];return null!==t&&(r[d]=null,r[s]=null,r[c]=null,t(e)),void(r[u]=e)}var n=r[s];null!==n&&(r[d]=null,r[s]=null,r[c]=null,n(p(void 0,!0))),r[l]=!0})),e.on("readable",m.bind(null,r)),r}},57327:(e,t,r)=>{"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t,r){return(t=s(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}}function s(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var c=r(48764).Buffer,u=r(52361).inspect,l=u&&u.custom||"inspect";e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,r,n;return t=e,(r=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return c.alloc(0);for(var t,r,n,i=c.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,r=i,n=a,c.prototype.copy.call(t,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=c.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:l,value:function(e,t){return u(this,i(i({},t),{},{depth:0,customInspect:!1}))}}])&&a(t.prototype,r),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},61195:(e,t,r)=>{"use strict";var n=r(34155);function i(e,t){a(e,t),o(e)}function o(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,s=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return s||c?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(a,this,e)):n.nextTick(a,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?n.nextTick(o,r):(r._writableState.errorEmitted=!0,n.nextTick(i,r,e)):n.nextTick(i,r,e):t?(n.nextTick(o,r),t(e)):n.nextTick(o,r)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}},8610:(e,t,r)=>{"use strict";var n=r(94281).q.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function e(t,r,o){if("function"==typeof r)return e(t,null,r);r||(r={}),o=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}(o||i);var a=r.readable||!1!==r.readable&&t.readable,s=r.writable||!1!==r.writable&&t.writable,c=function(){t.writable||l()},u=t._writableState&&t._writableState.finished,l=function(){s=!1,u=!0,a||o.call(t)},d=t._readableState&&t._readableState.endEmitted,f=function(){a=!1,d=!0,s||o.call(t)},h=function(e){o.call(t,e)},p=function(){var e;return a&&!d?(t._readableState&&t._readableState.ended||(e=new n),o.call(t,e)):s&&!u?(t._writableState&&t._writableState.ended||(e=new n),o.call(t,e)):void 0},v=function(){t.req.on("finish",l)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?s&&!t._writableState&&(t.on("end",c),t.on("close",c)):(t.on("complete",l),t.on("abort",p),t.req?v():t.on("request",v)),t.on("end",f),t.on("finish",l),!1!==r.error&&t.on("error",h),t.on("close",p),function(){t.removeListener("complete",l),t.removeListener("abort",p),t.removeListener("request",v),t.req&&t.req.removeListener("finish",l),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",l),t.removeListener("end",f),t.removeListener("error",h),t.removeListener("close",p)}}},15167:e=>{e.exports=function(){throw new Error("Readable.from is not available in the browser")}},59946:(e,t,r)=>{"use strict";var n;var i=r(94281).q,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(e){if(e)throw e}function c(e){e()}function u(e,t){return e.pipe(t)}e.exports=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var l,d=function(e){return e.length?"function"!=typeof e[e.length-1]?s:e.pop():s}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new o("streams");var f=t.map((function(e,i){var o=i<t.length-1;return function(e,t,i,o){o=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(o);var s=!1;e.on("close",(function(){s=!0})),void 0===n&&(n=r(8610)),n(e,{readable:t,writable:i},(function(e){if(e)return o(e);s=!0,o()}));var c=!1;return function(t){if(!s&&!c)return c=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new a("pipe"))}}(e,o,i>0,(function(e){l||(l=e),e&&f.forEach(c),o||(f.forEach(c),d(l))}))}));return t.reduce(u)}},82457:(e,t,r)=>{"use strict";var n=r(94281).q.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,r,i){var o=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},22503:(e,t,r)=>{e.exports=r(17187).EventEmitter},89509:(e,t,r)=>{var n=r(48764),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},22257:(e,t,r)=>{const n=Symbol("SemVer ANY");class i{static get ANY(){return n}constructor(e,t){if(t=o(t),e instanceof i){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),u("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===n?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(e){const t=this.options.loose?a[s.COMPARATORLOOSE]:a[s.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new l(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(u("Comparator.test",e,this.options.loose),this.semver===n||e===n)return!0;if("string"==typeof e)try{e=new l(e,this.options)}catch(e){return!1}return c(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof i))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new d(e.value,t).test(this.value):""===e.operator?""===e.value||new d(this.value,t).test(e.semver):(!(t=o(t)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||(!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||(!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||(!!(c(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(c(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}e.exports=i;const o=r(12893),{safeRe:a,t:s}=r(55765),c=r(7539),u=r(74225),l=r(26376),d=r(66902)},66902:(e,t,r)=>{class n{constructor(e,t){if(t=o(t),e instanceof n)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new n(e.raw,t);if(e instanceof a)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!m(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&g(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&p)|(this.options.loose&&v))+":"+e,r=i.get(t);if(r)return r;const n=this.options.loose,o=n?u[l.HYPHENRANGELOOSE]:u[l.HYPHENRANGE];e=e.replace(o,I(this.options.includePrerelease)),s("hyphen replace",e),e=e.replace(u[l.COMPARATORTRIM],d),s("comparator trim",e),e=e.replace(u[l.TILDETRIM],f),s("tilde trim",e),e=e.replace(u[l.CARETTRIM],h),s("caret trim",e);let c=e.split(" ").map((e=>b(e,this.options))).join(" ").split(/\s+/).map((e=>k(e,this.options)));n&&(c=c.filter((e=>(s("loose invalid filter",e,this.options),!!e.match(u[l.COMPARATORLOOSE]))))),s("range list",c);const g=new Map,y=c.map((e=>new a(e,this.options)));for(const e of y){if(m(e))return[e];g.set(e.value,e)}g.size>1&&g.has("")&&g.delete("");const E=[...g.values()];return i.set(t,E),E}intersects(e,t){if(!(e instanceof n))throw new TypeError("a Range is required");return this.set.some((r=>y(r,t)&&e.set.some((e=>y(e,t)&&r.every((r=>e.every((e=>r.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new c(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(A(this.set[t],e,this.options))return!0;return!1}}e.exports=n;const i=new(r(39593))({max:1e3}),o=r(12893),a=r(22257),s=r(74225),c=r(26376),{safeRe:u,t:l,comparatorTrimReplace:d,tildeTrimReplace:f,caretTrimReplace:h}=r(55765),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:v}=r(83295),m=e=>"<0.0.0-0"===e.value,g=e=>""===e.value,y=(e,t)=>{let r=!0;const n=e.slice();let i=n.pop();for(;r&&n.length;)r=n.every((e=>i.intersects(e,t))),i=n.pop();return r},b=(e,t)=>(s("comp",e,t),e=w(e,t),s("caret",e),e=S(e,t),s("tildes",e),e=C(e,t),s("xrange",e),e=x(e,t),s("stars",e),e),E=e=>!e||"x"===e.toLowerCase()||"*"===e,S=(e,t)=>e.trim().split(/\s+/).map((e=>_(e,t))).join(" "),_=(e,t)=>{const r=t.loose?u[l.TILDELOOSE]:u[l.TILDE];return e.replace(r,((t,r,n,i,o)=>{let a;return s("tilde",e,t,r,n,i,o),E(r)?a="":E(n)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:E(i)?a=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:o?(s("replaceTilde pr",o),a=`>=${r}.${n}.${i}-${o} <${r}.${+n+1}.0-0`):a=`>=${r}.${n}.${i} <${r}.${+n+1}.0-0`,s("tilde return",a),a}))},w=(e,t)=>e.trim().split(/\s+/).map((e=>R(e,t))).join(" "),R=(e,t)=>{s("caret",e,t);const r=t.loose?u[l.CARETLOOSE]:u[l.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,o,a)=>{let c;return s("caret",e,t,r,i,o,a),E(r)?c="":E(i)?c=`>=${r}.0.0${n} <${+r+1}.0.0-0`:E(o)?c="0"===r?`>=${r}.${i}.0${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${n} <${+r+1}.0.0-0`:a?(s("replaceCaret pr",a),c="0"===r?"0"===i?`>=${r}.${i}.${o}-${a} <${r}.${i}.${+o+1}-0`:`>=${r}.${i}.${o}-${a} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${o}-${a} <${+r+1}.0.0-0`):(s("no pr"),c="0"===r?"0"===i?`>=${r}.${i}.${o}${n} <${r}.${i}.${+o+1}-0`:`>=${r}.${i}.${o}${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${o} <${+r+1}.0.0-0`),s("caret return",c),c}))},C=(e,t)=>(s("replaceXRanges",e,t),e.split(/\s+/).map((e=>T(e,t))).join(" ")),T=(e,t)=>{e=e.trim();const r=t.loose?u[l.XRANGELOOSE]:u[l.XRANGE];return e.replace(r,((r,n,i,o,a,c)=>{s("xRange",e,r,n,i,o,a,c);const u=E(i),l=u||E(o),d=l||E(a),f=d;return"="===n&&f&&(n=""),c=t.includePrerelease?"-0":"",u?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&f?(l&&(o=0),a=0,">"===n?(n=">=",l?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):"<="===n&&(n="<",l?i=+i+1:o=+o+1),"<"===n&&(c="-0"),r=`${n+i}.${o}.${a}${c}`):l?r=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(r=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),s("xRange return",r),r}))},x=(e,t)=>(s("replaceStars",e,t),e.trim().replace(u[l.STAR],"")),k=(e,t)=>(s("replaceGTE0",e,t),e.trim().replace(u[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),I=e=>(t,r,n,i,o,a,s,c,u,l,d,f,h)=>`${r=E(n)?"":E(i)?`>=${n}.0.0${e?"-0":""}`:E(o)?`>=${n}.${i}.0${e?"-0":""}`:a?`>=${r}`:`>=${r}${e?"-0":""}`} ${c=E(u)?"":E(l)?`<${+u+1}.0.0-0`:E(d)?`<${u}.${+l+1}.0-0`:f?`<=${u}.${l}.${d}-${f}`:e?`<${u}.${l}.${+d+1}-0`:`<=${c}`}`.trim(),A=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(s(e[r].semver),e[r].semver!==a.ANY&&e[r].semver.prerelease.length>0){const n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0}},26376:(e,t,r)=>{const n=r(74225),{MAX_LENGTH:i,MAX_SAFE_INTEGER:o}=r(83295),{safeRe:a,t:s}=r(55765),c=r(12893),{compareIdentifiers:u}=r(86742);class l{constructor(e,t){if(t=c(t),e instanceof l){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>i)throw new TypeError(`version is longer than ${i} characters`);n("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?a[s.LOOSE]:a[s.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>o||this.major<0)throw new TypeError("Invalid major version");if(this.minor>o||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>o||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<o)return t}return e})):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(n("SemVer.compare",this.version,this.options,e),!(e instanceof l)){if("string"==typeof e&&e===this.version)return 0;e=new l(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof l||(e=new l(e,this.options)),u(this.major,e.major)||u(this.minor,e.minor)||u(this.patch,e.patch)}comparePre(e){if(e instanceof l||(e=new l(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const r=this.prerelease[t],i=e.prerelease[t];if(n("prerelease compare",t,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return u(r,i)}while(++t)}compareBuild(e){e instanceof l||(e=new l(e,this.options));let t=0;do{const r=this.build[t],i=e.build[t];if(n("prerelease compare",t,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return u(r,i)}while(++t)}inc(e,t,r){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(r)?1:0;if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(0===this.prerelease.length)this.prerelease=[e];else{let n=this.prerelease.length;for(;--n>=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),0===u(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=l},13507:(e,t,r)=>{const n=r(33959);e.exports=(e,t)=>{const r=n(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}},7539:(e,t,r)=>{const n=r(58718),i=r(81194),o=r(71312),a=r(25903),s=r(21544),c=r(12056);e.exports=(e,t,r,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return n(e,r,u);case"!=":return i(e,r,u);case">":return o(e,r,u);case">=":return a(e,r,u);case"<":return s(e,r,u);case"<=":return c(e,r,u);default:throw new TypeError(`Invalid operator: ${t}`)}}},99038:(e,t,r)=>{const n=r(26376),i=r(33959),{safeRe:o,t:a}=r(55765);e.exports=(e,t)=>{if(e instanceof n)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let t;for(;(t=o[a.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),o[a.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;o[a.COERCERTL].lastIndex=-1}else r=e.match(o[a.COERCE]);return null===r?null:i(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)}},88880:(e,t,r)=>{const n=r(26376);e.exports=(e,t,r)=>{const i=new n(e,r),o=new n(t,r);return i.compare(o)||i.compareBuild(o)}},27880:(e,t,r)=>{const n=r(46269);e.exports=(e,t)=>n(e,t,!0)},46269:(e,t,r)=>{const n=r(26376);e.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))},62378:(e,t,r)=>{const n=r(33959);e.exports=(e,t)=>{const r=n(e,null,!0),i=n(t,null,!0),o=r.compare(i);if(0===o)return null;const a=o>0,s=a?r:i,c=a?i:r,u=!!s.prerelease.length;if(!!c.prerelease.length&&!u)return c.patch||c.minor?s.patch?"patch":s.minor?"minor":"major":"major";const l=u?"pre":"";return r.major!==i.major?l+"major":r.minor!==i.minor?l+"minor":r.patch!==i.patch?l+"patch":"prerelease"}},58718:(e,t,r)=>{const n=r(46269);e.exports=(e,t,r)=>0===n(e,t,r)},71312:(e,t,r)=>{const n=r(46269);e.exports=(e,t,r)=>n(e,t,r)>0},25903:(e,t,r)=>{const n=r(46269);e.exports=(e,t,r)=>n(e,t,r)>=0},20253:(e,t,r)=>{const n=r(26376);e.exports=(e,t,r,i,o)=>{"string"==typeof r&&(o=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,o).version}catch(e){return null}}},21544:(e,t,r)=>{const n=r(46269);e.exports=(e,t,r)=>n(e,t,r)<0},12056:(e,t,r)=>{const n=r(46269);e.exports=(e,t,r)=>n(e,t,r)<=0},38679:(e,t,r)=>{const n=r(26376);e.exports=(e,t)=>new n(e,t).major},87789:(e,t,r)=>{const n=r(26376);e.exports=(e,t)=>new n(e,t).minor},81194:(e,t,r)=>{const n=r(46269);e.exports=(e,t,r)=>0!==n(e,t,r)},33959:(e,t,r)=>{const n=r(26376);e.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}},52358:(e,t,r)=>{const n=r(26376);e.exports=(e,t)=>new n(e,t).patch},57559:(e,t,r)=>{const n=r(33959);e.exports=(e,t)=>{const r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}},79795:(e,t,r)=>{const n=r(46269);e.exports=(e,t,r)=>n(t,e,r)},63657:(e,t,r)=>{const n=r(88880);e.exports=(e,t)=>e.sort(((e,r)=>n(r,e,t)))},45712:(e,t,r)=>{const n=r(66902);e.exports=(e,t,r)=>{try{t=new n(t,r)}catch(e){return!1}return t.test(e)}},21100:(e,t,r)=>{const n=r(88880);e.exports=(e,t)=>e.sort(((e,r)=>n(e,r,t)))},76397:(e,t,r)=>{const n=r(33959);e.exports=(e,t)=>{const r=n(e,t);return r?r.version:null}},81249:(e,t,r)=>{const n=r(55765),i=r(83295),o=r(26376),a=r(86742),s=r(33959),c=r(76397),u=r(13507),l=r(20253),d=r(62378),f=r(38679),h=r(87789),p=r(52358),v=r(57559),m=r(46269),g=r(79795),y=r(27880),b=r(88880),E=r(21100),S=r(63657),_=r(71312),w=r(21544),R=r(58718),C=r(81194),T=r(25903),x=r(12056),k=r(7539),I=r(99038),A=r(22257),O=r(66902),L=r(45712),M=r(51042),N=r(85775),P=r(71657),D=r(95316),F=r(89042),U=r(6826),j=r(97606),B=r(50032),q=r(82937),V=r(17908),G=r(50799);e.exports={parse:s,valid:c,clean:u,inc:l,diff:d,major:f,minor:h,patch:p,prerelease:v,compare:m,rcompare:g,compareLoose:y,compareBuild:b,sort:E,rsort:S,gt:_,lt:w,eq:R,neq:C,gte:T,lte:x,cmp:k,coerce:I,Comparator:A,Range:O,satisfies:L,toComparators:M,maxSatisfying:N,minSatisfying:P,minVersion:D,validRange:F,outside:U,gtr:j,ltr:B,intersects:q,simplifyRange:V,subset:G,SemVer:o,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:i.SEMVER_SPEC_VERSION,RELEASE_TYPES:i.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}},83295:e=>{const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},74225:(e,t,r)=>{const n="object"==typeof r(34155)&&{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.NODE_DEBUG&&/\bsemver\b/i.test({ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=n},86742:e=>{const t=/^[0-9]+$/,r=(e,r)=>{const n=t.test(e),i=t.test(r);return n&&i&&(e=+e,r=+r),e===r?0:n&&!i?-1:i&&!n?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},12893:e=>{const t=Object.freeze({loose:!0}),r=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:r},55765:(e,t,r)=>{const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:o}=r(83295),a=r(74225),s=(t=e.exports={}).re=[],c=t.safeRe=[],u=t.src=[],l=t.t={};let d=0;const f="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",o],[f,i]],p=(e,t,r)=>{const n=(e=>{for(const[t,r]of h)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),i=d++;a(e,i,t),l[e]=i,u[i]=t,s[i]=new RegExp(t,r?"g":void 0),c[i]=new RegExp(n,r?"g":void 0)};p("NUMERICIDENTIFIER","0|[1-9]\\d*"),p("NUMERICIDENTIFIERLOOSE","\\d+"),p("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),p("MAINVERSION",`(${u[l.NUMERICIDENTIFIER]})\\.(${u[l.NUMERICIDENTIFIER]})\\.(${u[l.NUMERICIDENTIFIER]})`),p("MAINVERSIONLOOSE",`(${u[l.NUMERICIDENTIFIERLOOSE]})\\.(${u[l.NUMERICIDENTIFIERLOOSE]})\\.(${u[l.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASEIDENTIFIER",`(?:${u[l.NUMERICIDENTIFIER]}|${u[l.NONNUMERICIDENTIFIER]})`),p("PRERELEASEIDENTIFIERLOOSE",`(?:${u[l.NUMERICIDENTIFIERLOOSE]}|${u[l.NONNUMERICIDENTIFIER]})`),p("PRERELEASE",`(?:-(${u[l.PRERELEASEIDENTIFIER]}(?:\\.${u[l.PRERELEASEIDENTIFIER]})*))`),p("PRERELEASELOOSE",`(?:-?(${u[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[l.PRERELEASEIDENTIFIERLOOSE]})*))`),p("BUILDIDENTIFIER",`${f}+`),p("BUILD",`(?:\\+(${u[l.BUILDIDENTIFIER]}(?:\\.${u[l.BUILDIDENTIFIER]})*))`),p("FULLPLAIN",`v?${u[l.MAINVERSION]}${u[l.PRERELEASE]}?${u[l.BUILD]}?`),p("FULL",`^${u[l.FULLPLAIN]}$`),p("LOOSEPLAIN",`[v=\\s]*${u[l.MAINVERSIONLOOSE]}${u[l.PRERELEASELOOSE]}?${u[l.BUILD]}?`),p("LOOSE",`^${u[l.LOOSEPLAIN]}$`),p("GTLT","((?:<|>)?=?)"),p("XRANGEIDENTIFIERLOOSE",`${u[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),p("XRANGEIDENTIFIER",`${u[l.NUMERICIDENTIFIER]}|x|X|\\*`),p("XRANGEPLAIN",`[v=\\s]*(${u[l.XRANGEIDENTIFIER]})(?:\\.(${u[l.XRANGEIDENTIFIER]})(?:\\.(${u[l.XRANGEIDENTIFIER]})(?:${u[l.PRERELEASE]})?${u[l.BUILD]}?)?)?`),p("XRANGEPLAINLOOSE",`[v=\\s]*(${u[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[l.XRANGEIDENTIFIERLOOSE]})(?:${u[l.PRERELEASELOOSE]})?${u[l.BUILD]}?)?)?`),p("XRANGE",`^${u[l.GTLT]}\\s*${u[l.XRANGEPLAIN]}$`),p("XRANGELOOSE",`^${u[l.GTLT]}\\s*${u[l.XRANGEPLAINLOOSE]}$`),p("COERCE",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?(?:$|[^\\d])`),p("COERCERTL",u[l.COERCE],!0),p("LONETILDE","(?:~>?)"),p("TILDETRIM",`(\\s*)${u[l.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",p("TILDE",`^${u[l.LONETILDE]}${u[l.XRANGEPLAIN]}$`),p("TILDELOOSE",`^${u[l.LONETILDE]}${u[l.XRANGEPLAINLOOSE]}$`),p("LONECARET","(?:\\^)"),p("CARETTRIM",`(\\s*)${u[l.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",p("CARET",`^${u[l.LONECARET]}${u[l.XRANGEPLAIN]}$`),p("CARETLOOSE",`^${u[l.LONECARET]}${u[l.XRANGEPLAINLOOSE]}$`),p("COMPARATORLOOSE",`^${u[l.GTLT]}\\s*(${u[l.LOOSEPLAIN]})$|^$`),p("COMPARATOR",`^${u[l.GTLT]}\\s*(${u[l.FULLPLAIN]})$|^$`),p("COMPARATORTRIM",`(\\s*)${u[l.GTLT]}\\s*(${u[l.LOOSEPLAIN]}|${u[l.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",p("HYPHENRANGE",`^\\s*(${u[l.XRANGEPLAIN]})\\s+-\\s+(${u[l.XRANGEPLAIN]})\\s*$`),p("HYPHENRANGELOOSE",`^\\s*(${u[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[l.XRANGEPLAINLOOSE]})\\s*$`),p("STAR","(<|>)?=?\\s*\\*"),p("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),p("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},97606:(e,t,r)=>{const n=r(6826);e.exports=(e,t,r)=>n(e,t,">",r)},82937:(e,t,r)=>{const n=r(66902);e.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))},50032:(e,t,r)=>{const n=r(6826);e.exports=(e,t,r)=>n(e,t,"<",r)},85775:(e,t,r)=>{const n=r(26376),i=r(66902);e.exports=(e,t,r)=>{let o=null,a=null,s=null;try{s=new i(t,r)}catch(e){return null}return e.forEach((e=>{s.test(e)&&(o&&-1!==a.compare(e)||(o=e,a=new n(o,r)))})),o}},71657:(e,t,r)=>{const n=r(26376),i=r(66902);e.exports=(e,t,r)=>{let o=null,a=null,s=null;try{s=new i(t,r)}catch(e){return null}return e.forEach((e=>{s.test(e)&&(o&&1!==a.compare(e)||(o=e,a=new n(o,r)))})),o}},95316:(e,t,r)=>{const n=r(26376),i=r(66902),o=r(71312);e.exports=(e,t)=>{e=new i(e,t);let r=new n("0.0.0");if(e.test(r))return r;if(r=new n("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t<e.set.length;++t){const i=e.set[t];let a=null;i.forEach((e=>{const t=new n(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":a&&!o(t,a)||(a=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!a||r&&!o(r,a)||(r=a)}return r&&e.test(r)?r:null}},6826:(e,t,r)=>{const n=r(26376),i=r(22257),{ANY:o}=i,a=r(66902),s=r(45712),c=r(71312),u=r(21544),l=r(12056),d=r(25903);e.exports=(e,t,r,f)=>{let h,p,v,m,g;switch(e=new n(e,f),t=new a(t,f),r){case">":h=c,p=l,v=u,m=">",g=">=";break;case"<":h=u,p=d,v=c,m="<",g="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(s(e,t,f))return!1;for(let r=0;r<t.set.length;++r){const n=t.set[r];let a=null,s=null;if(n.forEach((e=>{e.semver===o&&(e=new i(">=0.0.0")),a=a||e,s=s||e,h(e.semver,a.semver,f)?a=e:v(e.semver,s.semver,f)&&(s=e)})),a.operator===m||a.operator===g)return!1;if((!s.operator||s.operator===m)&&p(e,s.semver))return!1;if(s.operator===g&&v(e,s.semver))return!1}return!0}},17908:(e,t,r)=>{const n=r(45712),i=r(46269);e.exports=(e,t,r)=>{const o=[];let a=null,s=null;const c=e.sort(((e,t)=>i(e,t,r)));for(const e of c){n(e,t,r)?(s=e,a||(a=e)):(s&&o.push([a,s]),s=null,a=null)}a&&o.push([a,null]);const u=[];for(const[e,t]of o)e===t?u.push(e):t||e!==c[0]?t?e===c[0]?u.push(`<=${t}`):u.push(`${e} - ${t}`):u.push(`>=${e}`):u.push("*");const l=u.join(" || "),d="string"==typeof t.raw?t.raw:String(t);return l.length<d.length?l:t}},50799:(e,t,r)=>{const n=r(66902),i=r(22257),{ANY:o}=i,a=r(45712),s=r(46269),c=[new i(">=0.0.0-0")],u=[new i(">=0.0.0")],l=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===o){if(1===t.length&&t[0].semver===o)return!0;e=r.includePrerelease?c:u}if(1===t.length&&t[0].semver===o){if(r.includePrerelease)return!0;t=u}const n=new Set;let i,l,h,p,v,m,g;for(const t of e)">"===t.operator||">="===t.operator?i=d(i,t,r):"<"===t.operator||"<="===t.operator?l=f(l,t,r):n.add(t.semver);if(n.size>1)return null;if(i&&l){if(h=s(i.semver,l.semver,r),h>0)return null;if(0===h&&(">="!==i.operator||"<="!==l.operator))return null}for(const e of n){if(i&&!a(e,String(i),r))return null;if(l&&!a(e,String(l),r))return null;for(const n of t)if(!a(e,String(n),r))return!1;return!0}let y=!(!l||r.includePrerelease||!l.semver.prerelease.length)&&l.semver,b=!(!i||r.includePrerelease||!i.semver.prerelease.length)&&i.semver;y&&1===y.prerelease.length&&"<"===l.operator&&0===y.prerelease[0]&&(y=!1);for(const e of t){if(g=g||">"===e.operator||">="===e.operator,m=m||"<"===e.operator||"<="===e.operator,i)if(b&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===b.major&&e.semver.minor===b.minor&&e.semver.patch===b.patch&&(b=!1),">"===e.operator||">="===e.operator){if(p=d(i,e,r),p===e&&p!==i)return!1}else if(">="===i.operator&&!a(i.semver,String(e),r))return!1;if(l)if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),"<"===e.operator||"<="===e.operator){if(v=f(l,e,r),v===e&&v!==l)return!1}else if("<="===l.operator&&!a(l.semver,String(e),r))return!1;if(!e.operator&&(l||i)&&0!==h)return!1}return!(i&&m&&!l&&0!==h)&&(!(l&&g&&!i&&0!==h)&&(!b&&!y))},d=(e,t,r)=>{if(!e)return t;const n=s(e.semver,t.semver,r);return n>0?e:n<0||">"===t.operator&&">="===e.operator?t:e},f=(e,t,r)=>{if(!e)return t;const n=s(e.semver,t.semver,r);return n<0?e:n>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;e:for(const n of e.set){for(const e of t.set){const t=l(n,e,r);if(i=i||null!==t,t)continue e}if(i)return!1}return!0}},51042:(e,t,r)=>{const n=r(66902);e.exports=(e,t)=>new n(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")))},89042:(e,t,r)=>{const n=r(66902);e.exports=(e,t)=>{try{return new n(e,t).range||"*"}catch(e){return null}}},67771:(e,t,r)=>{"use strict";var n=r(40210),i=r(12296),o=r(31044)(),a=r(27296),s=n("%TypeError%"),c=n("%Math.floor%");e.exports=function(e,t){if("function"!=typeof e)throw new s("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||c(t)!==t)throw new s("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,u=!0;if("length"in e&&a){var l=a(e,"length");l&&!l.configurable&&(n=!1),l&&!l.writable&&(u=!1)}return(n||u||!r)&&(o?i(e,"length",t,!0,!0):i(e,"length",t)),e}},37478:(e,t,r)=>{"use strict";var n=r(40210),i=r(21924),o=r(70631),a=n("%TypeError%"),s=n("%WeakMap%",!0),c=n("%Map%",!0),u=i("WeakMap.prototype.get",!0),l=i("WeakMap.prototype.set",!0),d=i("WeakMap.prototype.has",!0),f=i("Map.prototype.get",!0),h=i("Map.prototype.set",!0),p=i("Map.prototype.has",!0),v=function(e,t){for(var r,n=e;null!==(r=n.next);n=r)if(r.key===t)return n.next=r.next,r.next=e.next,e.next=r,r};e.exports=function(){var e,t,r,n={assert:function(e){if(!n.has(e))throw new a("Side channel does not contain "+o(e))},get:function(n){if(s&&n&&("object"==typeof n||"function"==typeof n)){if(e)return u(e,n)}else if(c){if(t)return f(t,n)}else if(r)return function(e,t){var r=v(e,t);return r&&r.value}(r,n)},has:function(n){if(s&&n&&("object"==typeof n||"function"==typeof n)){if(e)return d(e,n)}else if(c){if(t)return p(t,n)}else if(r)return function(e,t){return!!v(e,t)}(r,n);return!1},set:function(n,i){s&&n&&("object"==typeof n||"function"==typeof n)?(e||(e=new s),l(e,n,i)):c?(t||(t=new c),h(t,n,i)):(r||(r={key:{},next:null}),function(e,t,r){var n=v(e,t);n?n.value=r:e.next={key:t,next:e.next,value:r}}(r,n,i))}};return n}},42830:(e,t,r)=>{e.exports=i;var n=r(17187).EventEmitter;function i(){n.call(this)}r(35717)(i,n),i.Readable=r(79481),i.Writable=r(64229),i.Duplex=r(56753),i.Transform=r(74605),i.PassThrough=r(82725),i.finished=r(8610),i.pipeline=r(59946),i.Stream=i,i.prototype.pipe=function(e,t){var r=this;function i(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(r.on("end",s),r.on("close",c));var a=!1;function s(){a||(a=!0,e.end())}function c(){a||(a=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){if(l(),0===n.listenerCount(this,"error"))throw e}function l(){r.removeListener("data",i),e.removeListener("drain",o),r.removeListener("end",s),r.removeListener("close",c),r.removeListener("error",u),e.removeListener("error",u),r.removeListener("end",l),r.removeListener("close",l),e.removeListener("close",l)}return r.on("error",u),e.on("error",u),r.on("end",l),r.on("close",l),e.on("close",l),e.emit("pipe",r),e}},32553:(e,t,r)=>{"use strict";var n=r(89509).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=l,this.end=d,t=3;break;default:return this.write=f,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}t.s=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=a(t[n]);if(i>=0)return i>0&&(e.lastNeed=i-1),i;if(--n<r||-2===i)return 0;if(i=a(t[n]),i>=0)return i>0&&(e.lastNeed=i-2),i;if(--n<r||-2===i)return 0;if(i=a(t[n]),i>=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},80842:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractTokenizer=void 0;const n=r(55167);t.AbstractTokenizer=class{constructor(e){this.position=0,this.numBuffer=new Uint8Array(8),this.fileInfo=e||{}}async readToken(e,t=this.position){const r=Buffer.alloc(e.len);if(await this.readBuffer(r,{position:t})<e.len)throw new n.EndOfStreamError;return e.get(r,0)}async peekToken(e,t=this.position){const r=Buffer.alloc(e.len);if(await this.peekBuffer(r,{position:t})<e.len)throw new n.EndOfStreamError;return e.get(r,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new n.EndOfStreamError;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new n.EndOfStreamError;return e.get(this.numBuffer,0)}async ignore(e){if(void 0!==this.fileInfo.size){const t=this.fileInfo.size-this.position;if(e>t)return this.position+=t,t}return this.position+=e,e}async close(){}normalizeOptions(e,t){if(t&&void 0!==t.position&&t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return t?{mayBeLess:!0===t.mayBeLess,offset:t.offset?t.offset:0,length:t.length?t.length:e.length-(t.offset?t.offset:0),position:t.position?t.position:this.position}:{mayBeLess:!1,offset:0,length:e.length,position:this.position}}}},30778:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BufferTokenizer=void 0;const n=r(55167),i=r(80842);class o extends i.AbstractTokenizer{constructor(e,t){super(t),this.uint8Array=e,this.fileInfo.size=this.fileInfo.size?this.fileInfo.size:e.length}async readBuffer(e,t){if(t&&t.position){if(t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");this.position=t.position}const r=await this.peekBuffer(e,t);return this.position+=r,r}async peekBuffer(e,t){const r=this.normalizeOptions(e,t),i=Math.min(this.uint8Array.length-r.position,r.length);if(!r.mayBeLess&&i<r.length)throw new n.EndOfStreamError;return e.set(this.uint8Array.subarray(r.position,r.position+i),r.offset),i}async close(){}}t.BufferTokenizer=o},27859:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromFile=t.FileTokenizer=void 0;const n=r(80842),i=r(55167),o=r(77209);class a extends n.AbstractTokenizer{constructor(e,t){super(t),this.fd=e}async readBuffer(e,t){const r=this.normalizeOptions(e,t);this.position=r.position;const n=await o.read(this.fd,e,r.offset,r.length,r.position);if(this.position+=n.bytesRead,n.bytesRead<r.length&&(!t||!t.mayBeLess))throw new i.EndOfStreamError;return n.bytesRead}async peekBuffer(e,t){const r=this.normalizeOptions(e,t),n=await o.read(this.fd,e,r.offset,r.length,r.position);if(!r.mayBeLess&&n.bytesRead<r.length)throw new i.EndOfStreamError;return n.bytesRead}async close(){return o.close(this.fd)}}t.FileTokenizer=a,t.fromFile=async function(e){const t=await o.stat(e);if(!t.isFile)throw new Error(`File not a file: ${e}`);const r=await o.open(e,"r");return new a(r,{path:e,size:t.size})}},77209:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.readFile=t.writeFileSync=t.writeFile=t.read=t.open=t.close=t.stat=t.createReadStream=t.pathExists=void 0;const n=r(4059);t.pathExists=n.existsSync,t.createReadStream=n.createReadStream,t.stat=async function(e){return new Promise(((t,r)=>{n.stat(e,((e,n)=>{e?r(e):t(n)}))}))},t.close=async function(e){return new Promise(((t,r)=>{n.close(e,(e=>{e?r(e):t()}))}))},t.open=async function(e,t){return new Promise(((r,i)=>{n.open(e,t,((e,t)=>{e?i(e):r(t)}))}))},t.read=async function(e,t,r,i,o){return new Promise(((a,s)=>{n.read(e,t,r,i,o,((e,t,r)=>{e?s(e):a({bytesRead:t,buffer:r})}))}))},t.writeFile=async function(e,t){return new Promise(((r,i)=>{n.writeFile(e,t,(e=>{e?i(e):r()}))}))},t.writeFileSync=function(e,t){n.writeFileSync(e,t)},t.readFile=async function(e){return new Promise(((t,r)=>{n.readFile(e,((e,n)=>{e?r(e):t(n)}))}))}},20599:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReadStreamTokenizer=void 0;const n=r(80842),i=r(55167);class o extends n.AbstractTokenizer{constructor(e,t){super(t),this.streamReader=new i.StreamReader(e)}async getFileInfo(){return this.fileInfo}async readBuffer(e,t){const r=this.normalizeOptions(e,t),n=r.position-this.position;if(n>0)return await this.ignore(n),this.readBuffer(e,t);if(n<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(0===r.length)return 0;const o=await this.streamReader.read(e,r.offset,r.length);if(this.position+=o,(!t||!t.mayBeLess)&&o<r.length)throw new i.EndOfStreamError;return o}async peekBuffer(e,t){const r=this.normalizeOptions(e,t);let n=0;if(r.position){const t=r.position-this.position;if(t>0){const i=new Uint8Array(r.length+t);return n=await this.peekBuffer(i,{mayBeLess:r.mayBeLess}),e.set(i.subarray(t),r.offset),n-t}if(t<0)throw new Error("Cannot peek from a negative offset in a stream")}if(r.length>0){try{n=await this.streamReader.peek(e,r.offset,r.length)}catch(e){if(t&&t.mayBeLess&&e instanceof i.EndOfStreamError)return 0;throw e}if(!r.mayBeLess&&n<r.length)throw new i.EndOfStreamError}return n}async ignore(e){const t=Math.min(256e3,e),r=new Uint8Array(t);let n=0;for(;n<e;){const i=e-n,o=await this.readBuffer(r,{length:Math.min(t,i)});if(o<0)return o;n+=o}return n}}t.ReadStreamTokenizer=o},35849:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromBuffer=t.fromStream=t.EndOfStreamError=void 0;const n=r(20599),i=r(30778);var o=r(55167);Object.defineProperty(t,"EndOfStreamError",{enumerable:!0,get:function(){return o.EndOfStreamError}}),t.fromStream=function(e,t){return t=t||{},new n.ReadStreamTokenizer(e,t)},t.fromBuffer=function(e,t){return new i.BufferTokenizer(e,t)}},26597:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromStream=t.fromBuffer=t.EndOfStreamError=t.fromFile=void 0;const n=r(77209),i=r(35849);var o=r(27859);Object.defineProperty(t,"fromFile",{enumerable:!0,get:function(){return o.fromFile}});var a=r(35849);Object.defineProperty(t,"EndOfStreamError",{enumerable:!0,get:function(){return a.EndOfStreamError}}),Object.defineProperty(t,"fromBuffer",{enumerable:!0,get:function(){return a.fromBuffer}}),t.fromStream=async function(e,t){if(t=t||{},e.path){const r=await n.stat(e.path);t.path=e.path,t.size=r.size}return i.fromStream(e,t)}},83416:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AnsiStringType=t.StringType=t.BufferType=t.Uint8ArrayType=t.IgnoreType=t.Float80_LE=t.Float80_BE=t.Float64_LE=t.Float64_BE=t.Float32_LE=t.Float32_BE=t.Float16_LE=t.Float16_BE=t.INT64_BE=t.UINT64_BE=t.INT64_LE=t.UINT64_LE=t.INT32_LE=t.INT32_BE=t.INT24_BE=t.INT24_LE=t.INT16_LE=t.INT16_BE=t.INT8=t.UINT32_BE=t.UINT32_LE=t.UINT24_BE=t.UINT24_LE=t.UINT16_BE=t.UINT16_LE=t.UINT8=void 0;const n=r(80645);function i(e){return new DataView(e.buffer,e.byteOffset)}t.UINT8={len:1,get:(e,t)=>i(e).getUint8(t),put:(e,t,r)=>(i(e).setUint8(t,r),t+1)},t.UINT16_LE={len:2,get:(e,t)=>i(e).getUint16(t,!0),put:(e,t,r)=>(i(e).setUint16(t,r,!0),t+2)},t.UINT16_BE={len:2,get:(e,t)=>i(e).getUint16(t),put:(e,t,r)=>(i(e).setUint16(t,r),t+2)},t.UINT24_LE={len:3,get(e,t){const r=i(e);return r.getUint8(t)+(r.getUint16(t+1,!0)<<8)},put(e,t,r){const n=i(e);return n.setUint8(t,255&r),n.setUint16(t+1,r>>8,!0),t+3}},t.UINT24_BE={len:3,get(e,t){const r=i(e);return(r.getUint16(t)<<8)+r.getUint8(t+2)},put(e,t,r){const n=i(e);return n.setUint16(t,r>>8),n.setUint8(t+2,255&r),t+3}},t.UINT32_LE={len:4,get:(e,t)=>i(e).getUint32(t,!0),put:(e,t,r)=>(i(e).setUint32(t,r,!0),t+4)},t.UINT32_BE={len:4,get:(e,t)=>i(e).getUint32(t),put:(e,t,r)=>(i(e).setUint32(t,r),t+4)},t.INT8={len:1,get:(e,t)=>i(e).getInt8(t),put:(e,t,r)=>(i(e).setInt8(t,r),t+1)},t.INT16_BE={len:2,get:(e,t)=>i(e).getInt16(t),put:(e,t,r)=>(i(e).setInt16(t,r),t+2)},t.INT16_LE={len:2,get:(e,t)=>i(e).getInt16(t,!0),put:(e,t,r)=>(i(e).setInt16(t,r,!0),t+2)},t.INT24_LE={len:3,get(e,r){const n=t.UINT24_LE.get(e,r);return n>8388607?n-16777216:n},put(e,t,r){const n=i(e);return n.setUint8(t,255&r),n.setUint16(t+1,r>>8,!0),t+3}},t.INT24_BE={len:3,get(e,r){const n=t.UINT24_BE.get(e,r);return n>8388607?n-16777216:n},put(e,t,r){const n=i(e);return n.setUint16(t,r>>8),n.setUint8(t+2,255&r),t+3}},t.INT32_BE={len:4,get:(e,t)=>i(e).getInt32(t),put:(e,t,r)=>(i(e).setInt32(t,r),t+4)},t.INT32_LE={len:4,get:(e,t)=>i(e).getInt32(t,!0),put:(e,t,r)=>(i(e).setInt32(t,r,!0),t+4)},t.UINT64_LE={len:8,get:(e,t)=>i(e).getBigUint64(t,!0),put:(e,t,r)=>(i(e).setBigUint64(t,r,!0),t+8)},t.INT64_LE={len:8,get:(e,t)=>i(e).getBigInt64(t,!0),put:(e,t,r)=>(i(e).setBigInt64(t,r,!0),t+8)},t.UINT64_BE={len:8,get:(e,t)=>i(e).getBigUint64(t),put:(e,t,r)=>(i(e).setBigUint64(t,r),t+8)},t.INT64_BE={len:8,get:(e,t)=>i(e).getBigInt64(t),put:(e,t,r)=>(i(e).setBigInt64(t,r),t+8)},t.Float16_BE={len:2,get(e,t){return n.read(e,t,!1,10,this.len)},put(e,t,r){return n.write(e,r,t,!1,10,this.len),t+this.len}},t.Float16_LE={len:2,get(e,t){return n.read(e,t,!0,10,this.len)},put(e,t,r){return n.write(e,r,t,!0,10,this.len),t+this.len}},t.Float32_BE={len:4,get:(e,t)=>i(e).getFloat32(t),put:(e,t,r)=>(i(e).setFloat32(t,r),t+4)},t.Float32_LE={len:4,get:(e,t)=>i(e).getFloat32(t,!0),put:(e,t,r)=>(i(e).setFloat32(t,r,!0),t+4)},t.Float64_BE={len:8,get:(e,t)=>i(e).getFloat64(t),put:(e,t,r)=>(i(e).setFloat64(t,r),t+8)},t.Float64_LE={len:8,get:(e,t)=>i(e).getFloat64(t,!0),put:(e,t,r)=>(i(e).setFloat64(t,r,!0),t+8)},t.Float80_BE={len:10,get(e,t){return n.read(e,t,!1,63,this.len)},put(e,t,r){return n.write(e,r,t,!1,63,this.len),t+this.len}},t.Float80_LE={len:10,get(e,t){return n.read(e,t,!0,63,this.len)},put(e,t,r){return n.write(e,r,t,!0,63,this.len),t+this.len}};t.IgnoreType=class{constructor(e){this.len=e}get(e,t){}};t.Uint8ArrayType=class{constructor(e){this.len=e}get(e,t){return e.subarray(t,t+this.len)}};t.BufferType=class{constructor(e){this.len=e}get(e,t){return Buffer.from(e.subarray(t,t+this.len))}};t.StringType=class{constructor(e,t){this.len=e,this.encoding=t}get(e,t){return Buffer.from(e).toString(this.encoding,t,t+this.len)}};class o{constructor(e){this.len=e}static decode(e,t,r){let n="";for(let i=t;i<r;++i)n+=o.codePointToString(o.singleByteDecoder(e[i]));return n}static inRange(e,t,r){return t<=e&&e<=r}static codePointToString(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}static singleByteDecoder(e){if(o.inRange(e,0,127))return e;const t=o.windows1252[e-128];if(null===t)throw Error("invaliding encoding");return t}get(e,t=0){return o.decode(e,t,t+this.len)}}t.AnsiStringType=o,o.windows1252=[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]},52511:function(e,t,r){var n;e=r.nmd(e),function(i){t&&t.nodeType,e&&e.nodeType;var o="object"==typeof r.g&&r.g;o.global!==o&&o.window!==o&&o.self;var a,s=2147483647,c=36,u=1,l=26,d=38,f=700,h=72,p=128,v="-",m=/^xn--/,g=/[^\x20-\x7E]/,y=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=c-u,S=Math.floor,_=String.fromCharCode;function w(e){throw new RangeError(b[e])}function R(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function C(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+R((e=e.replace(y,".")).split("."),t).join(".")}function T(e){for(var t,r,n=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}function x(e){return R(e,(function(e){var t="";return e>65535&&(t+=_((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=_(e)})).join("")}function k(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function I(e,t,r){var n=0;for(e=r?S(e/f):e>>1,e+=S(e/t);e>E*l>>1;n+=c)e=S(e/E);return S(n+(E+1)*e/(e+d))}function A(e){var t,r,n,i,o,a,d,f,m,g,y,b=[],E=e.length,_=0,R=p,C=h;for((r=e.lastIndexOf(v))<0&&(r=0),n=0;n<r;++n)e.charCodeAt(n)>=128&&w("not-basic"),b.push(e.charCodeAt(n));for(i=r>0?r+1:0;i<E;){for(o=_,a=1,d=c;i>=E&&w("invalid-input"),((f=(y=e.charCodeAt(i++))-48<10?y-22:y-65<26?y-65:y-97<26?y-97:c)>=c||f>S((s-_)/a))&&w("overflow"),_+=f*a,!(f<(m=d<=C?u:d>=C+l?l:d-C));d+=c)a>S(s/(g=c-m))&&w("overflow"),a*=g;C=I(_-o,t=b.length+1,0==o),S(_/t)>s-R&&w("overflow"),R+=S(_/t),_%=t,b.splice(_++,0,R)}return x(b)}function O(e){var t,r,n,i,o,a,d,f,m,g,y,b,E,R,C,x=[];for(b=(e=T(e)).length,t=p,r=0,o=h,a=0;a<b;++a)(y=e[a])<128&&x.push(_(y));for(n=i=x.length,i&&x.push(v);n<b;){for(d=s,a=0;a<b;++a)(y=e[a])>=t&&y<d&&(d=y);for(d-t>S((s-r)/(E=n+1))&&w("overflow"),r+=(d-t)*E,t=d,a=0;a<b;++a)if((y=e[a])<t&&++r>s&&w("overflow"),y==t){for(f=r,m=c;!(f<(g=m<=o?u:m>=o+l?l:m-o));m+=c)C=f-g,R=c-g,x.push(_(k(g+C%R,0))),f=S(C/R);x.push(_(k(f,0))),o=I(r,E,n==i),r=0,++n}++r,++t}return x.join("")}a={version:"1.4.1",ucs2:{decode:T,encode:x},decode:A,encode:O,toASCII:function(e){return C(e,(function(e){return g.test(e)?"xn--"+O(e):e}))},toUnicode:function(e){return C(e,(function(e){return m.test(e)?A(e.slice(4).toLowerCase()):e}))}},void 0===(n=function(){return a}.call(t,r,t,e))||(e.exports=n)}()},8575:(e,t,r)=>{"use strict";var n=r(52511);function i(){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 o=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,s=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),u=["'"].concat(c),l=["%","/","?",";","#"].concat(u),d=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,p={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},m={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},g=r(80129);function y(e,t,r){if(e&&"object"==typeof e&&e instanceof i)return e;var n=new i;return n.parse(e,t,r),n}i.prototype.parse=function(e,t,r){if("string"!=typeof e)throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),a=-1!==i&&i<e.indexOf("#")?"?":"#",c=e.split(a);c[0]=c[0].replace(/\\/g,"/");var y=e=c.join(a);if(y=y.trim(),!r&&1===e.split("#").length){var b=s.exec(y);if(b)return this.path=y,this.href=y,this.pathname=b[1],b[2]?(this.search=b[2],this.query=t?g.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var E=o.exec(y);if(E){var S=(E=E[0]).toLowerCase();this.protocol=S,y=y.substr(E.length)}if(r||E||y.match(/^\/\/[^@/]+@[^@/]+/)){var _="//"===y.substr(0,2);!_||E&&v[E]||(y=y.substr(2),this.slashes=!0)}if(!v[E]&&(_||E&&!m[E])){for(var w,R,C=-1,T=0;T<d.length;T++){-1!==(x=y.indexOf(d[T]))&&(-1===C||x<C)&&(C=x)}-1!==(R=-1===C?y.lastIndexOf("@"):y.lastIndexOf("@",C))&&(w=y.slice(0,R),y=y.slice(R+1),this.auth=decodeURIComponent(w)),C=-1;for(T=0;T<l.length;T++){var x;-1!==(x=y.indexOf(l[T]))&&(-1===C||x<C)&&(C=x)}-1===C&&(C=y.length),this.host=y.slice(0,C),y=y.slice(C),this.parseHost(),this.hostname=this.hostname||"";var k="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!k)for(var I=this.hostname.split(/\./),A=(T=0,I.length);T<A;T++){var O=I[T];if(O&&!O.match(f)){for(var L="",M=0,N=O.length;M<N;M++)O.charCodeAt(M)>127?L+="x":L+=O[M];if(!L.match(f)){var P=I.slice(0,T),D=I.slice(T+1),F=O.match(h);F&&(P.push(F[1]),D.unshift(F[2])),D.length&&(y="/"+D.join(".")+y),this.hostname=P.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),k||(this.hostname=n.toASCII(this.hostname));var U=this.port?":"+this.port:"",j=this.hostname||"";this.host=j+U,this.href+=this.host,k&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==y[0]&&(y="/"+y))}if(!p[S])for(T=0,A=u.length;T<A;T++){var B=u[T];if(-1!==y.indexOf(B)){var q=encodeURIComponent(B);q===B&&(q=escape(B)),y=y.split(B).join(q)}}var V=y.indexOf("#");-1!==V&&(this.hash=y.substr(V),y=y.slice(0,V));var G=y.indexOf("?");if(-1!==G?(this.search=y.substr(G),this.query=y.substr(G+1),t&&(this.query=g.parse(this.query)),y=y.slice(0,G)):t&&(this.search="",this.query={}),y&&(this.pathname=y),m[S]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){U=this.pathname||"";var W=this.search||"";this.path=U+W}return this.href=this.format(),this},i.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",r=this.pathname||"",n=this.hash||"",i=!1,o="";this.host?i=e+this.host:this.hostname&&(i=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&"object"==typeof this.query&&Object.keys(this.query).length&&(o=g.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var a=this.search||o&&"?"+o||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||m[t])&&!1!==i?(i="//"+(i||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):i||(i=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),t+i+(r=r.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(a=a.replace("#","%23"))+n},i.prototype.resolve=function(e){return this.resolveObject(y(e,!1,!0)).format()},i.prototype.resolveObject=function(e){if("string"==typeof e){var t=new i;t.parse(e,!1,!0),e=t}for(var r=new i,n=Object.keys(this),o=0;o<n.length;o++){var a=n[o];r[a]=this[a]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),c=0;c<s.length;c++){var u=s[c];"protocol"!==u&&(r[u]=e[u])}return m[r.protocol]&&r.hostname&&!r.pathname&&(r.pathname="/",r.path=r.pathname),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!m[e.protocol]){for(var l=Object.keys(e),d=0;d<l.length;d++){var f=l[d];r[f]=e[f]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||v[e.protocol])r.pathname=e.pathname;else{for(var h=(e.pathname||"").split("/");h.length&&!(e.host=h.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==h[0]&&h.unshift(""),h.length<2&&h.unshift(""),r.pathname=h.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var p=r.pathname||"",g=r.search||"";r.path=p+g}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var y=r.pathname&&"/"===r.pathname.charAt(0),b=e.host||e.pathname&&"/"===e.pathname.charAt(0),E=b||y||r.host&&e.pathname,S=E,_=r.pathname&&r.pathname.split("/")||[],w=(h=e.pathname&&e.pathname.split("/")||[],r.protocol&&!m[r.protocol]);if(w&&(r.hostname="",r.port=null,r.host&&(""===_[0]?_[0]=r.host:_.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===h[0]?h[0]=e.host:h.unshift(e.host)),e.host=null),E=E&&(""===h[0]||""===_[0])),b)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,_=h;else if(h.length)_||(_=[]),_.pop(),_=_.concat(h),r.search=e.search,r.query=e.query;else if(null!=e.search){if(w)r.host=_.shift(),r.hostname=r.host,(k=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=k.shift(),r.hostname=k.shift(),r.host=r.hostname);return r.search=e.search,r.query=e.query,null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!_.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var R=_.slice(-1)[0],C=(r.host||e.host||_.length>1)&&("."===R||".."===R)||""===R,T=0,x=_.length;x>=0;x--)"."===(R=_[x])?_.splice(x,1):".."===R?(_.splice(x,1),T++):T&&(_.splice(x,1),T--);if(!E&&!S)for(;T--;T)_.unshift("..");!E||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),C&&"/"!==_.join("/").substr(-1)&&_.push("");var k,I=""===_[0]||_[0]&&"/"===_[0].charAt(0);w&&(r.hostname=I?"":_.length?_.shift():"",r.host=r.hostname,(k=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=k.shift(),r.hostname=k.shift(),r.host=r.hostname));return(E=E||r.host&&_.length)&&!I&&_.unshift(""),_.length>0?r.pathname=_.join("/"):(r.pathname=null,r.path=null),null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},i.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)},t.parse=y,t.resolve=function(e,t){return y(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?y(e,!1,!0).resolveObject(t):t},t.format=function(e){return"string"==typeof e&&(e=y(e)),e instanceof i?e.format():i.prototype.format.call(e)},t.Url=i},83031:(e,t,r)=>{e.exports=r(32482)},32482:(e,t)=>{t.version="1.0.0",t.encode=function(e){return e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},t.decode=function(e){return e=(e+=Array(5-e.length%4).join("=")).replace(/\-/g,"+").replace(/\_/g,"/"),new Buffer(e,"base64")},t.validate=function(e){return/^[A-Za-z0-9\-_]+$/.test(e)}},94927:(e,t,r)=>{function n(e){try{if(!r.g.localStorage)return!1}catch(e){return!1}var t=r.g.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}e.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}},20384:e=>{e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},55955:(e,t,r)=>{"use strict";var n=r(82584),i=r(48662),o=r(86430),a=r(85692);function s(e){return e.call.bind(e)}var c="undefined"!=typeof BigInt,u="undefined"!=typeof Symbol,l=s(Object.prototype.toString),d=s(Number.prototype.valueOf),f=s(String.prototype.valueOf),h=s(Boolean.prototype.valueOf);if(c)var p=s(BigInt.prototype.valueOf);if(u)var v=s(Symbol.prototype.valueOf);function m(e,t){if("object"!=typeof e)return!1;try{return t(e),!0}catch(e){return!1}}function g(e){return"[object Map]"===l(e)}function y(e){return"[object Set]"===l(e)}function b(e){return"[object WeakMap]"===l(e)}function E(e){return"[object WeakSet]"===l(e)}function S(e){return"[object ArrayBuffer]"===l(e)}function _(e){return"undefined"!=typeof ArrayBuffer&&(S.working?S(e):e instanceof ArrayBuffer)}function w(e){return"[object DataView]"===l(e)}function R(e){return"undefined"!=typeof DataView&&(w.working?w(e):e instanceof DataView)}t.isArgumentsObject=n,t.isGeneratorFunction=i,t.isTypedArray=a,t.isPromise=function(e){return"undefined"!=typeof Promise&&e instanceof Promise||null!==e&&"object"==typeof e&&"function"==typeof e.then&&"function"==typeof e.catch},t.isArrayBufferView=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):a(e)||R(e)},t.isUint8Array=function(e){return"Uint8Array"===o(e)},t.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===o(e)},t.isUint16Array=function(e){return"Uint16Array"===o(e)},t.isUint32Array=function(e){return"Uint32Array"===o(e)},t.isInt8Array=function(e){return"Int8Array"===o(e)},t.isInt16Array=function(e){return"Int16Array"===o(e)},t.isInt32Array=function(e){return"Int32Array"===o(e)},t.isFloat32Array=function(e){return"Float32Array"===o(e)},t.isFloat64Array=function(e){return"Float64Array"===o(e)},t.isBigInt64Array=function(e){return"BigInt64Array"===o(e)},t.isBigUint64Array=function(e){return"BigUint64Array"===o(e)},g.working="undefined"!=typeof Map&&g(new Map),t.isMap=function(e){return"undefined"!=typeof Map&&(g.working?g(e):e instanceof Map)},y.working="undefined"!=typeof Set&&y(new Set),t.isSet=function(e){return"undefined"!=typeof Set&&(y.working?y(e):e instanceof Set)},b.working="undefined"!=typeof WeakMap&&b(new WeakMap),t.isWeakMap=function(e){return"undefined"!=typeof WeakMap&&(b.working?b(e):e instanceof WeakMap)},E.working="undefined"!=typeof WeakSet&&E(new WeakSet),t.isWeakSet=function(e){return E(e)},S.working="undefined"!=typeof ArrayBuffer&&S(new ArrayBuffer),t.isArrayBuffer=_,w.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&w(new DataView(new ArrayBuffer(1),0,1)),t.isDataView=R;var C="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function T(e){return"[object SharedArrayBuffer]"===l(e)}function x(e){return void 0!==C&&(void 0===T.working&&(T.working=T(new C)),T.working?T(e):e instanceof C)}function k(e){return m(e,d)}function I(e){return m(e,f)}function A(e){return m(e,h)}function O(e){return c&&m(e,p)}function L(e){return u&&m(e,v)}t.isSharedArrayBuffer=x,t.isAsyncFunction=function(e){return"[object AsyncFunction]"===l(e)},t.isMapIterator=function(e){return"[object Map Iterator]"===l(e)},t.isSetIterator=function(e){return"[object Set Iterator]"===l(e)},t.isGeneratorObject=function(e){return"[object Generator]"===l(e)},t.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===l(e)},t.isNumberObject=k,t.isStringObject=I,t.isBooleanObject=A,t.isBigIntObject=O,t.isSymbolObject=L,t.isBoxedPrimitive=function(e){return k(e)||I(e)||A(e)||O(e)||L(e)},t.isAnyArrayBuffer=function(e){return"undefined"!=typeof Uint8Array&&(_(e)||x(e))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(e){Object.defineProperty(t,e,{enumerable:!1,value:function(){throw new Error(e+" is not supported in userland")}})}))},89539:(e,t,r)=>{var n=r(34155),i=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++)r[t[n]]=Object.getOwnPropertyDescriptor(e,t[n]);return r},o=/%[sdj%]/g;t.format=function(e){if(!b(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(u(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,i=n.length,a=String(e).replace(o,(function(e){if("%%"===e)return"%";if(r>=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),s=n[r];r<i;s=n[++r])g(s)||!_(s)?a+=" "+s:a+=" "+u(s);return a},t.deprecate=function(e,r){if(void 0!==n&&!0===n.noDeprecation)return e;if(void 0===n)return function(){return t.deprecate(e,r).apply(this,arguments)};var i=!1;return function(){if(!i){if(n.throwDeprecation)throw new Error(r);n.traceDeprecation?console.trace(r):console.error(r),i=!0}return e.apply(this,arguments)}};var a={},s=/^$/;if({ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.NODE_DEBUG){var c={ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.NODE_DEBUG;c=c.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),s=new RegExp("^"+c+"$","i")}function u(e,r){var n={seen:[],stylize:d};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),m(r)?n.showHidden=r:r&&t._extend(n,r),E(n.showHidden)&&(n.showHidden=!1),E(n.depth)&&(n.depth=2),E(n.colors)&&(n.colors=!1),E(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=l),f(n,e,n.depth)}function l(e,t){var r=u.styles[t];return r?"["+u.colors[r][0]+"m"+e+"["+u.colors[r][1]+"m":e}function d(e,t){return e}function f(e,r,n){if(e.customInspect&&r&&C(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return b(i)||(i=f(e,i,n)),i}var o=function(e,t){if(E(t))return e.stylize("undefined","undefined");if(b(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(y(t))return e.stylize(""+t,"number");if(m(t))return e.stylize(""+t,"boolean");if(g(t))return e.stylize("null","null")}(e,r);if(o)return o;var a=Object.keys(r),s=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(r)),R(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return h(r);if(0===a.length){if(C(r)){var c=r.name?": "+r.name:"";return e.stylize("[Function"+c+"]","special")}if(S(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(w(r))return e.stylize(Date.prototype.toString.call(r),"date");if(R(r))return h(r)}var u,l="",d=!1,_=["{","}"];(v(r)&&(d=!0,_=["[","]"]),C(r))&&(l=" [Function"+(r.name?": "+r.name:"")+"]");return S(r)&&(l=" "+RegExp.prototype.toString.call(r)),w(r)&&(l=" "+Date.prototype.toUTCString.call(r)),R(r)&&(l=" "+h(r)),0!==a.length||d&&0!=r.length?n<0?S(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),u=d?function(e,t,r,n,i){for(var o=[],a=0,s=t.length;a<s;++a)I(t,String(a))?o.push(p(e,t,r,n,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(p(e,t,r,n,i,!0))})),o}(e,r,n,s,a):a.map((function(t){return p(e,r,n,s,t,d)})),e.seen.pop(),function(e,t,r){var n=e.reduce((function(e,t){return t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0);if(n>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(u,l,_)):_[0]+l+_[1]}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,r,n,i,o){var a,s,c;if((c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(s=e.stylize("[Setter]","special")),I(n,i)||(a="["+i+"]"),s||(e.seen.indexOf(c.value)<0?(s=g(r)?f(e,c.value,null):f(e,c.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").slice(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),E(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.slice(1,-1),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function v(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function g(e){return null===e}function y(e){return"number"==typeof e}function b(e){return"string"==typeof e}function E(e){return void 0===e}function S(e){return _(e)&&"[object RegExp]"===T(e)}function _(e){return"object"==typeof e&&null!==e}function w(e){return _(e)&&"[object Date]"===T(e)}function R(e){return _(e)&&("[object Error]"===T(e)||e instanceof Error)}function C(e){return"function"==typeof e}function T(e){return Object.prototype.toString.call(e)}function x(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(e=e.toUpperCase(),!a[e])if(s.test(e)){var r=n.pid;a[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else a[e]=function(){};return a[e]},t.inspect=u,u.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]},u.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.types=r(55955),t.isArray=v,t.isBoolean=m,t.isNull=g,t.isNullOrUndefined=function(e){return null==e},t.isNumber=y,t.isString=b,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=E,t.isRegExp=S,t.types.isRegExp=S,t.isObject=_,t.isDate=w,t.types.isDate=w,t.isError=R,t.types.isNativeError=R,t.isFunction=C,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(20384);var k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function I(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,r;console.log("%s - %s",(e=new Date,r=[x(e.getHours()),x(e.getMinutes()),x(e.getSeconds())].join(":"),[e.getDate(),k[e.getMonth()],r].join(" ")),t.format.apply(t,arguments))},t.inherits=r(35717),t._extend=function(e,t){if(!t||!_(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var A="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function O(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(A&&e[A]){var t;if("function"!=typeof(t=e[A]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,A,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise((function(e,n){t=e,r=n})),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push((function(e,n){e?r(e):t(n)}));try{e.apply(this,i)}catch(e){r(e)}return n}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),A&&Object.defineProperty(t,A,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,i(e))},t.promisify.custom=A,t.callbackify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function t(){for(var t=[],r=0;r<arguments.length;r++)t.push(arguments[r]);var i=t.pop();if("function"!=typeof i)throw new TypeError("The last argument must be of type Function");var o=this,a=function(){return i.apply(o,arguments)};e.apply(this,t).then((function(e){n.nextTick(a.bind(null,null,e))}),(function(e){n.nextTick(O.bind(null,e,a))}))}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,i(e)),t}},55877:(e,t,r)=>{var n=r(23570),i=r(71171),o=i;o.v1=n,o.v4=i,e.exports=o},45327:e=>{for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);e.exports=function(e,r){var n=r||0,i=t;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]]].join("")}},85217:e=>{var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var r=new Uint8Array(16);e.exports=function(){return t(r),r}}else{var n=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}}},23570:(e,t,r)=>{var n,i,o=r(85217),a=r(45327),s=0,c=0;e.exports=function(e,t,r){var u=t&&r||0,l=t||[],d=(e=e||{}).node||n,f=void 0!==e.clockseq?e.clockseq:i;if(null==d||null==f){var h=o();null==d&&(d=n=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==f&&(f=i=16383&(h[6]<<8|h[7]))}var p=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:c+1,m=p-s+(v-c)/1e4;if(m<0&&void 0===e.clockseq&&(f=f+1&16383),(m<0||p>s)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");s=p,c=v,i=f;var g=(1e4*(268435455&(p+=122192928e5))+v)%4294967296;l[u++]=g>>>24&255,l[u++]=g>>>16&255,l[u++]=g>>>8&255,l[u++]=255&g;var y=p/4294967296*1e4&268435455;l[u++]=y>>>8&255,l[u++]=255&y,l[u++]=y>>>24&15|16,l[u++]=y>>>16&255,l[u++]=f>>>8|128,l[u++]=255&f;for(var b=0;b<6;++b)l[u+b]=d[b];return t||a(l)}},71171:(e,t,r)=>{var n=r(85217),i=r(45327);e.exports=function(e,t,r){var o=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||n)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var s=0;s<16;++s)t[o+s]=a[s];return t||i(a)}},86430:(e,t,r)=>{"use strict";var n=r(94029),i=r(63083),o=r(55559),a=r(21924),s=r(27296),c=a("Object.prototype.toString"),u=r(96410)(),l="undefined"==typeof globalThis?r.g:globalThis,d=i(),f=a("String.prototype.slice"),h=Object.getPrototypeOf,p=a("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return r;return-1},v={__proto__:null};n(d,u&&s&&h?function(e){var t=new l[e];if(Symbol.toStringTag in t){var r=h(t),n=s(r,Symbol.toStringTag);if(!n){var i=h(r);n=s(i,Symbol.toStringTag)}v["$"+e]=o(n.get)}}:function(e){var t=new l[e],r=t.slice||t.set;r&&(v["$"+e]=o(r))});e.exports=function(e){if(!e||"object"!=typeof e)return!1;if(!u){var t=f(c(e),8,-1);return p(d,t)>-1?t:"Object"===t&&function(e){var t=!1;return n(v,(function(r,n){if(!t)try{r(e),t=f(n,1)}catch(e){}})),t}(e)}return s?function(e){var t=!1;return n(v,(function(r,n){if(!t)try{"$"+r(e)===n&&(t=f(n,1))}catch(e){}})),t}(e):null}},47529:e=>{e.exports=function(){for(var e={},r=0;r<arguments.length;r++){var n=arguments[r];for(var i in n)t.call(n,i)&&(e[i]=n[i])}return e};var t=Object.prototype.hasOwnProperty},49602:e=>{"use strict";e.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}},34411:(e,t,r)=>{"use strict";function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var r=0,i=arguments.length;r<i;r++)t.push(arguments[r]);return t}function i(e,t,r){var n=t===e.head?new s(r,null,t,e):new s(r,t,t.next,e);return null===n.next&&(e.tail=n),null===n.prev&&(e.head=n),e.length++,n}function o(e,t){e.tail=new s(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function a(e,t){e.head=new s(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function s(e,t,r,n){if(!(this instanceof s))return new s(e,t,r,n);this.list=n,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}e.exports=n,n.Node=s,n.create=n,n.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,r=e.prev;return t&&(t.prev=r),r&&(r.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=r),e.list.length--,e.next=null,e.prev=null,e.list=null,t},n.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},n.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},n.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)o(this,arguments[e]);return this.length},n.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)a(this,arguments[e]);return this.length},n.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},n.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},n.prototype.forEach=function(e,t){t=t||this;for(var r=this.head,n=0;null!==r;n++)e.call(t,r.value,n,this),r=r.next},n.prototype.forEachReverse=function(e,t){t=t||this;for(var r=this.tail,n=this.length-1;null!==r;n--)e.call(t,r.value,n,this),r=r.prev},n.prototype.get=function(e){for(var t=0,r=this.head;null!==r&&t<e;t++)r=r.next;if(t===e&&null!==r)return r.value},n.prototype.getReverse=function(e){for(var t=0,r=this.tail;null!==r&&t<e;t++)r=r.prev;if(t===e&&null!==r)return r.value},n.prototype.map=function(e,t){t=t||this;for(var r=new n,i=this.head;null!==i;)r.push(e.call(t,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(e,t){t=t||this;for(var r=new n,i=this.tail;null!==i;)r.push(e.call(t,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(e,t){var r,n=this.head;if(arguments.length>1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,r=this.head.value}for(var i=0;null!==n;i++)r=e(r,n.value,i),n=n.next;return r},n.prototype.reduceReverse=function(e,t){var r,n=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,r=this.tail.value}for(var i=this.length-1;null!==n;i--)r=e(r,n.value,i),n=n.prev;return r},n.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},n.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},n.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,o=this.head;null!==o&&i<e;i++)o=o.next;for(;null!==o&&i<t;i++,o=o.next)r.push(o.value);return r},n.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,o=this.tail;null!==o&&i>t;i--)o=o.prev;for(;null!==o&&i>e;i--,o=o.prev)r.push(o.value);return r},n.prototype.splice=function(e,t,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var n=0,o=this.head;null!==o&&n<e;n++)o=o.next;var a=[];for(n=0;o&&n<t;n++)a.push(o.value),o=this.removeNode(o);null===o&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev);for(n=0;n<r.length;n++)o=i(this,o,r[n]);return a},n.prototype.reverse=function(){for(var e=this.head,t=this.tail,r=e;null!==r;r=r.prev){var n=r.prev;r.prev=r.next,r.next=n}return this.head=t,this.tail=e,this};try{r(49602)(n)}catch(e){}},42480:()=>{},66507:()=>{},86035:()=>{},24654:()=>{},52361:()=>{},94616:()=>{},4059:()=>{},27921:(e,t,r)=>{e.exports=r(50176)},78149:(e,t,r)=>{e.exports=r(70964)},66130:(e,t,r)=>{e.exports=r(76216)},8450:(e,t,r)=>{e.exports=r(23565)},18281:(e,t,r)=>{e.exports=r(94175)},7520:(e,t,r)=>{e.exports=r(68080)},18428:(e,t,r)=>{e.exports=r(68207)},93364:(e,t,r)=>{e.exports=r(99848)},26771:(e,t,r)=>{e.exports=r(82624)},43562:(e,t,r)=>{e.exports=r(88058)},27392:(e,t,r)=>{e.exports=r(36759)},95366:(e,t,r)=>{e.exports=r(44221)},6919:(e,t,r)=>{e.exports=r(22991)},62680:(e,t,r)=>{e.exports=r(72818)},26243:(e,t,r)=>{e.exports=r(15297)},18433:(e,t,r)=>{e.exports=r(42837)},79529:(e,t,r)=>{e.exports=r(16111)},73473:(e,t,r)=>{e.exports=r(89448)},71544:(e,t,r)=>{e.exports=r(58564)},63755:(e,t,r)=>{e.exports=r(98401)},79873:(e,t,r)=>{e.exports=r(53268)},67857:(e,t,r)=>{e.exports=r(76409)},39907:(e,t,r)=>{e.exports=r(46383)},90487:(e,t,r)=>{e.exports=r(98828)},85579:(e,t,r)=>{e.exports=r(71922)},22013:(e,t,r)=>{e.exports=r(72974)},83977:(e,t,r)=>{e.exports=r(69488)},11996:(e,t,r)=>{var n=r(63207).default,i=r(82624),o=r(71922),a=r(25380),s=r(87595),c=r(21900),u=r(89448);function l(){"use strict";e.exports=l=function(){return r},e.exports.__esModule=!0,e.exports.default=e.exports;var t,r={},d=Object.prototype,f=d.hasOwnProperty,h=i||function(e,t,r){e[t]=r.value},p="function"==typeof o?o:{},v=p.iterator||"@@iterator",m=p.asyncIterator||"@@asyncIterator",g=p.toStringTag||"@@toStringTag";function y(e,t,r){return i(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{y({},"")}catch(t){y=function(e,t,r){return e[t]=r}}function b(e,t,r,n){var i=t&&t.prototype instanceof T?t:T,o=a(i.prototype),s=new U(n||[]);return h(o,"_invoke",{value:N(e,r,s)}),o}function E(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}r.wrap=b;var S="suspendedStart",_="suspendedYield",w="executing",R="completed",C={};function T(){}function x(){}function k(){}var I={};y(I,v,(function(){return this}));var A=s&&s(s(j([])));A&&A!==d&&f.call(A,v)&&(I=A);var O=k.prototype=T.prototype=a(I);function L(e){["next","throw","return"].forEach((function(t){y(e,t,(function(e){return this._invoke(t,e)}))}))}function M(e,t){function r(i,o,a,s){var c=E(e[i],e,o);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==n(l)&&f.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,a,s)}),(function(e){r("throw",e,a,s)})):t.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return r("throw",e,a,s)}))}s(c.arg)}var i;h(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(o,o):o()}})}function N(e,r,n){var i=S;return function(o,a){if(i===w)throw new Error("Generator is already running");if(i===R){if("throw"===o)throw a;return{value:t,done:!0}}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var c=P(s,n);if(c){if(c===C)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===S)throw i=R,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=w;var u=E(e,r,n);if("normal"===u.type){if(i=n.done?R:_,u.arg===C)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i=R,n.method="throw",n.arg=u.arg)}}}function P(e,r){var n=r.method,i=e.iterator[n];if(i===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),C;var o=E(i,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,C;var a=o.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,C):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,C)}function D(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function F(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function U(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(D,this),this.reset(!0)}function j(e){if(e||""===e){var r=e[v];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function r(){for(;++i<e.length;)if(f.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}throw new TypeError(n(e)+" is not iterable")}return x.prototype=k,h(O,"constructor",{value:k,configurable:!0}),h(k,"constructor",{value:x,configurable:!0}),x.displayName=y(k,g,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return c?c(e,k):(e.__proto__=k,y(e,g,"GeneratorFunction")),e.prototype=a(O),e},r.awrap=function(e){return{__await:e}},L(M.prototype),y(M.prototype,m,(function(){return this})),r.AsyncIterator=M,r.async=function(e,t,n,i,o){void 0===o&&(o=u);var a=new M(b(e,t,n,i),o);return r.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},L(O),y(O,g,"Generator"),y(O,v,(function(){return this})),y(O,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=j,U.prototype={constructor:U,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(F),!e)for(var r in this)"t"===r.charAt(0)&&f.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,i){return a.type="throw",a.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=f.call(o,"catchLoc"),c=f.call(o,"finallyLoc");if(s&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&f.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,C):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),C},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),F(r),C}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;F(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:j(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),C}},r}e.exports=l,e.exports.__esModule=!0,e.exports.default=e.exports},63207:(e,t,r)=>{var n=r(71922),i=r(72974);function o(t){return e.exports=o="function"==typeof n&&"symbol"==typeof i?function(e){return typeof e}:function(e){return e&&"function"==typeof n&&e.constructor===n&&e!==n.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,o(t)}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},33453:(e,t,r)=>{var n=r(11996)();e.exports=n;try{regeneratorRuntime=n}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},63083:(e,t,r)=>{"use strict";var n=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],i="undefined"==typeof globalThis?r.g:globalThis;e.exports=function(){for(var e=[],t=0;t<n.length;t++)"function"==typeof i[n[t]]&&(e[e.length]=n[t]);return e}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(r.exports,r,r.exports,__webpack_require__),r.loaded=!0,r.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.d(__webpack_exports__,{default:()=>rU});var e={};__webpack_require__.r(e),__webpack_require__.d(e,{ActiveSpeakerInfo:()=>nb,CodecInfo:()=>ab,ConnectionState:()=>bg,ErrorType:()=>vR,Errors:()=>Gx,H264Codec:()=>ob,LocalCameraStream:()=>Hm,LocalDisplayStream:()=>Km,LocalMicrophoneStream:()=>$m,LocalStream:()=>Gm,LocalStreamEventNames:()=>Um,LocalSystemAudioStream:()=>Jm,Media:()=>yI,MediaConnectionEventNames:()=>hR,MediaContent:()=>Vy,MediaFamily:()=>qy,MediaStreamTrackKind:()=>Py,MediaType:()=>Wy,MultistreamRoapMediaConnection:()=>Vx,NetworkQualityEventNames:()=>Rk,NetworkQualityMonitor:()=>mI,PeerConnection:()=>Uy,Policy:()=>Gy,ReceiveSlot:()=>HS,ReceiveSlotEvents:()=>AS,ReceiverSelectedInfo:()=>yb,RecommendedOpusBitrates:()=>Nb,RemoteStream:()=>Ym,RemoteStreamEventNames:()=>Vm,RemoteTrackType:()=>pR,RoapMediaConnection:()=>jx,SendSlot:()=>iw,StatsAnalyzer:()=>vI,StatsAnalyzerEventNames:()=>wk,StreamEventNames:()=>bm,StreamRequest:()=>uw,WcmeError:()=>xb,WcmeErrorType:()=>eb,configureWcmeLogger:()=>bw,createCameraAndMicrophoneStreams:()=>nm,createCameraStream:()=>tm,createDisplayMedia:()=>im,createDisplayStream:()=>om,createDisplayStreamWithAudio:()=>am,createMicrophoneStream:()=>rm,getAudioInputDevices:()=>cm,getAudioOutputDevices:()=>um,getDevices:()=>sm,getErrorDescription:()=>Sw,getLogger:()=>yw,getMediaFamily:()=>Yy,getRecommendedMaxBitrateForFrameSize:()=>jb,getVideoInputDevices:()=>lm,setLogger:()=>Ew,setOnDeviceChangeHandler:()=>fm});var t=__webpack_require__(82492),r=__webpack_require__.n(t),n=__webpack_require__(82723),i=__webpack_require__.n(n),o=__webpack_require__(13218),a=__webpack_require__.n(o),s=__webpack_require__(50361),c=__webpack_require__.n(s),u=__webpack_require__(26243),l=__webpack_require__.n(u),d=__webpack_require__(71544),f=__webpack_require__.n(d),h=__webpack_require__(73473),p=__webpack_require__.n(h),v=__webpack_require__(89539),m=__webpack_require__.n(v),g=__webpack_require__(65109),y=__webpack_require__.n(g),b=__webpack_require__(82624),E=__webpack_require__(71922),S=__webpack_require__(72974);function _(e){return _="function"==typeof E&&"symbol"==typeof S?function(e){return typeof e}:function(e){return e&&"function"==typeof E&&e.constructor===E&&e!==E.prototype?"symbol":typeof e},_(e)}var w=__webpack_require__(90446);function R(e){var t=function(e,t){if("object"!==_(e)||null===e)return e;var r=e[w];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==_(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===_(t)?t:String(t)}function C(e,t,r){return(t=R(t))in e?b(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var T=__webpack_require__(70964);function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var k=__webpack_require__(50176);function I(e,t){if(e){if("string"==typeof e)return x(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?k(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?x(e,t):void 0}}function A(e){return function(e){if(T(e))return x(e)}(e)||function(e){if(void 0!==E&&null!=e[S]||null!=e["@@iterator"])return k(e)}(e)||I(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var O=__webpack_require__(90359),L=__webpack_require__.n(O),M=__webpack_require__(58613),N=__webpack_require__.n(M),P=__webpack_require__(6557),D=__webpack_require__.n(P),F=__webpack_require__(23279),U=__webpack_require__.n(F),j=__webpack_require__(40087),B=__webpack_require__.n(j),q=__webpack_require__(18281),V=__webpack_require__.n(q),G=__webpack_require__(90487),W=__webpack_require__.n(G),z=__webpack_require__(83031),H=__webpack_require__(89509);const K=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)};function $(e){return z.decode(e).toString()}function J(e){var t=e;return K(t)||(t=H.Buffer.from(t)),z.encode(t)}const Y={fromBase64url:$,toBase64Url:J,encode:function(e){return J(e)},decode:function(e){return $(e)},validate:function(e){return z.validate(e)}};function Q(){var e=this;this.promise=new(p())((function(t,r){e.resolve=t,e.reject=r}))}function X(e,t){if(!e||!t)throw new Error("missing parameter for makeStateDataType");return{dataType:{set:function(r){return r instanceof e?(r.parent=this,{val:r,type:t}):{val:r?new e(r,{parent:this}):void 0,type:t}},compare:function(e,t){return e===t},onChange:function(e,t,r){t&&this.stopListening(t,"all",this._getCachedEventBubblingHandler(r)),e&&this.listenTo(e,"all",this._getCachedEventBubblingHandler(r))}},prop:{test:function(e){return!!e&&(e.parent=this,!1)},type:t}}}var Z=__webpack_require__(98401),ee=__webpack_require__(21900);function te(e,t){return te=ee?ee.bind():function(e,t){return e.__proto__=t,e},te(e,t)}function re(e,t,r){return re=function(){if("undefined"==typeof Reflect||!Z)return!1;if(Z.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Z(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Z.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&te(i,r.prototype),i},re.apply(null,arguments)}function ne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ie(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),b(e,R(n.key),n)}}function oe(e,t,r){return t&&ie(e.prototype,t),r&&ie(e,r),b(e,"prototype",{writable:!1}),e}var ae=__webpack_require__(83977),se=__webpack_require__.n(ae);function ce(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.shift(),i=new(se()),o=new(se()),a=t.length>1?ce.apply(void 0,t):t[0],s="(".concat([n.name].concat(t.map((function(e){return e.name}))).join(", "),")"),c=function(){function e(){ne(this,e);for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];i.set(this,re(n,r)),o.set(this,0)}return oe(e,[{key:"size",get:function(){return o.get(this)}},{key:"add",value:function(){return this.set.apply(this,arguments)}},{key:"clear",value:function(){var e=i.get(this).clear();return o.set(this,0),e}},{key:"delete",value:function(e){for(var t=i.get(this),r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];if(!n.length)return t.delete(e);var s=t.get(e);if(!s)return!1;var c=s.delete.apply(s,n);return c&&o.set(this,o.get(this)-1),0===s.size&&t.delete(e),c}},{key:"get",value:function(e){var t=i.get(this);if(!t.get)return t;for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];if(!n.length)return t.get(e);var a=t.get(e);return a?a.get?a.get.apply(a,n):a:void 0}},{key:"has",value:function(){return void 0!==this.get.apply(this,arguments)}},{key:"set",value:function(){for(var e=!1,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];this.has.apply(this,r)&&(e=!0);var s=i.get(this),c=r.shift();if(!s.get)return ue.apply(void 0,[s,c].concat(r)),this;var u=s.get(c);if(!u){if(!a)return ue.apply(void 0,[s,c].concat(r)),this;ue(s,c,u=new a)}return ue.apply(void 0,[u].concat(r)),e||o.set(this,o.get(this)+1),this}},{key:"inspect",value:function(){return"Container".concat(s," {\n ").concat(m().inspect(i.get(this),{depth:null}),"\n}")}}]),e}();return c}function ue(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(e.add)e.add.apply(e,r);else if(e.set)e.set.apply(e,r);else{if(!e.push)throw new TypeError("Could not determine how to insert into the specified container");e.push.apply(e,r)}}var le=se(),de=V(),fe=new(ce(le,de,de));function he(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(3===t.length)return f()(s,null,t);var n=t[0]||{},i=n.cacheFailures,o=n.cacheSuccesses,a=n.keyFactory;return s;function s(e,t,r){var n=t;return r.value=L()(r.value,(function(t){for(var r=this,s=n,c=arguments.length,u=new Array(c>1?c-1:0),l=1;l<c;l++)u[l-1]=arguments[l];a&&(s="".concat(s,"_").concat(a.apply(void 0,u)));var d=fe.get(this,e,s);return d||(d=f()(t,this,u),!i&&d&&d.catch&&(d=d.catch((function(t){return fe.delete(r,e,s),p().reject(t)}))),!o&&d&&d.then&&(d=d.then((function(t){return fe.delete(r,e,s),t}))),fe.set(this,e,s,d),d)})),"object"!==_(e)||e.prototype||(e[t]=r.value),r}}const pe={email:/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,containsEmails:/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/g,uuid:/^[a-f\d]{8}(?:-[a-f\d]{4}){3}-[a-f\d]{12}$/,containsMTID:/(MTID=)[^&$#]*/g,execEmail:/[^\s]+?@[^\s]+?/,execUuid:/[a-f\d]{8}(?:-[a-f\d]{4}){3}-[a-f\d]{12}/};var ve=__webpack_require__(1469),me=__webpack_require__.n(ve);function ge(e,t){return["on","once"].forEach((function(r){t[r]=function(){return e[r].apply(e,arguments),t}})),e}function ye(e,t,r){(e=me()(e)?e:[e]).forEach((function(e){t.on&&t.on(e,(function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return be.apply(void 0,[r,e].concat(n))}))}))}function be(e){var t=e.trigger||e.emit;if(!t)throw new Error("count not determine emit method");for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return f()(t,e,n)}var Ee=__webpack_require__(89448);function Se(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Ee.resolve(c).then(n,i)}function _e(e){return function(){var t=this,r=arguments;return new Ee((function(n,i){var o=e.apply(t,r);function a(e){Se(o,n,i,a,s,"next",e)}function s(e){Se(o,n,i,a,s,"throw",e)}a(void 0)}))}}var we=__webpack_require__(33453),Re=__webpack_require__.n(we),Ce="unable to access window.navigator.userAgent";var Te=__webpack_require__(62680),xe=__webpack_require__.n(Te),ke=__webpack_require__(95366),Ie=__webpack_require__.n(ke),Ae=__webpack_require__(6919),Oe=__webpack_require__.n(Ae),Le=__webpack_require__(93364),Me=__webpack_require__.n(Le),Ne=__webpack_require__(26771),Pe=__webpack_require__.n(Ne),De=__webpack_require__(23560),Fe=__webpack_require__.n(De),Ue=__webpack_require__(91747),je=__webpack_require__.n(Ue),Be=__webpack_require__(17187),qe=__webpack_require__.n(Be),Ve=__webpack_require__(25144);function Ge(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function We(e){return function(t){return new(p())((function(r){r(e(t))})).then((function(){return t})).catch((function(){return t}))}}function ze(e){return function(t,r,n){n.value=L()(n.value,(function(t){for(var r=this,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return new(p())((function(n){r[e]=!0,n(f()(t,r,i).then(We((function(){r[e]=!1}))).catch((function(t){return r[e]=!1,p().reject(t)})))}))}))}}var He=__webpack_require__(63755),Ke=__webpack_require__.n(He),$e=__webpack_require__(25380);function Je(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=$e(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),b(e,"prototype",{writable:!1}),t&&te(e,t)}function Ye(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Qe(e,t){if(t&&("object"===_(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Ye(e)}var Xe=__webpack_require__(87595);function Ze(e){return Ze=ee?Xe.bind():function(e){return e.__proto__||Xe(e)},Ze(e)}var et=__webpack_require__(94175);function tt(e){var t="function"==typeof et?new et:void 0;return tt=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return re(e,arguments,Ze(this).constructor)}return r.prototype=$e(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),te(r,e)},tt(e)}function rt(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var nt=function(e){Je(r,e);var t=rt(r);function r(){var e,n,i;ne(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];if((e=t.call.apply(t,[this].concat(a))).parse)n=(i=e).parse.apply(i,a);else if(e.constructor.parse){var c;n=(c=e.constructor).parse.apply(c,a)}return n||(n=e.constructor.defaultMessage),e.name=e.constructor.name,e.message=n,e}return oe(r,null,[{key:"parse",value:function(){return arguments.length<=0?void 0:arguments[0]}}]),r}(tt(Error));C(nt,"defaultMessage","An error occurred");var it=Object.defineProperty;function ot(e,t,r){var n=r.configurable,i=r.enumerable,o=r.initializer,a=r.value;return{configurable:n,enumerable:i,get:function(){if(this!==e){var r=o?o.call(this):a;return it(this,t,{configurable:n,enumerable:i,writable:!0,value:r}),r}},set:St(t)}}function at(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return yt(ot,t)}var st,ct,ut,lt,dt,ft,ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function pt(e,t,r,n){r&&Object.defineProperty(e,t,{enumerable:r.enumerable,configurable:r.configurable,writable:r.writable,value:r.initializer?r.initializer.call(n):void 0})}function vt(e,t,r,n,i){var o={};return Object.keys(n).forEach((function(e){o[e]=n[e]})),o.enumerable=!!o.enumerable,o.configurable=!!o.configurable,("value"in o||o.initializer)&&(o.writable=!0),o=r.slice().reverse().reduce((function(r,n){return n(e,t,r)||r}),o),i&&void 0!==o.initializer&&(o.value=o.initializer?o.initializer.call(i):void 0,o.initializer=void 0),void 0===o.initializer&&(Object.defineProperty(e,t,o),o=null),o}function mt(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}var gt=Object.defineProperty;Object.getOwnPropertyDescriptor,Object.getOwnPropertyNames,Object.getOwnPropertySymbols;function yt(e,t){return function(e){if(!e||!e.hasOwnProperty)return!1;for(var t=["value","initializer","get","set"],r=0,n=t.length;r<n;r++)if(e.hasOwnProperty(t[r]))return!0;return!1}(t[t.length-1])?e.apply(void 0,mt(t).concat([[]])):function(){return e.apply(void 0,mt(Array.prototype.slice.call(arguments)).concat([t]))}}var bt=(st=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),pt(this,"debounceTimeoutIds",ct,this),pt(this,"throttleTimeoutIds",ut,this),pt(this,"throttlePreviousTimestamps",lt,this),pt(this,"throttleTrailingArgs",dt,this),pt(this,"profileLastRan",ft,this)},ct=vt(st.prototype,"debounceTimeoutIds",[at],{enumerable:!0,initializer:function(){return{}}}),ut=vt(st.prototype,"throttleTimeoutIds",[at],{enumerable:!0,initializer:function(){return{}}}),lt=vt(st.prototype,"throttlePreviousTimestamps",[at],{enumerable:!0,initializer:function(){return{}}}),dt=vt(st.prototype,"throttleTrailingArgs",[at],{enumerable:!0,initializer:function(){return null}}),ft=vt(st.prototype,"profileLastRan",[at],{enumerable:!0,initializer:function(){return null}}),st),Et="function"==typeof Symbol?Symbol("__core_decorators__"):"__core_decorators__";function St(e){return function(t){return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t}),t}}function _t(e,t){return e.bind?e.bind(t):function(){return e.apply(t,arguments)}}var wt="object"===("undefined"==typeof console?"undefined":ht(console))&&console&&"function"==typeof console.warn?_t(console.warn,console):function(){};var Rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ct=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var Tt=/^function ([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?(\([^\)]*\))[\s\S]+$/;!function(){function e(t,r,n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.parentKlass=t,this.childKlass=r,this.parentDescriptor=n,this.childDescriptor=i}Ct(e,[{key:"_getTopic",value:function(e){return void 0===e?null:"value"in e?e.value:"get"in e?e.get:"set"in e?e.set:void 0}},{key:"_extractTopicSignature",value:function(e){return"function"===(void 0===e?"undefined":Rt(e))?this._extractFunctionSignature(e):this.key}},{key:"_extractFunctionSignature",value:function(e){var t=this;return e.toString().replace(Tt,(function(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.key)+arguments[2]}))}},{key:"key",get:function(){return this.childDescriptor.key}},{key:"parentNotation",get:function(){return this.parentKlass.constructor.name+"#"+this.parentPropertySignature}},{key:"childNotation",get:function(){return this.childKlass.constructor.name+"#"+this.childPropertySignature}},{key:"parentTopic",get:function(){return this._getTopic(this.parentDescriptor)}},{key:"childTopic",get:function(){return this._getTopic(this.childDescriptor)}},{key:"parentPropertySignature",get:function(){return this._extractTopicSignature(this.parentTopic)}},{key:"childPropertySignature",get:function(){return this._extractTopicSignature(this.childTopic)}}]),Ct(e,[{key:"assert",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";!0!==e&&this.error("{child} does not properly override {parent}"+t)}},{key:"error",value:function(e){var t=this;throw e=e.replace("{parent}",(function(e){return t.parentNotation})).replace("{child}",(function(e){return t.childNotation})),new SyntaxError(e)}}])}();Object.assign;Object.assign,"function"==typeof Symbol&&Symbol.iterator;Object.assign;Object.defineProperty,Object.getPrototypeOf;function xt(e,t,r){return r.writable=!1,r}Object.assign;Object.assign;Object.defineProperty;"function"==typeof Symbol&&Symbol.iterator,Object.defineProperty,Object.getPrototypeOf;Object.assign;var kt={};console.time&&console.time.bind(console),console.timeEnd&&console.timeEnd.bind(console);Object.assign,Object.getPrototypeOf,Object.getOwnPropertyDescriptor;var It=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},At=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},Ot={profile:console.profile?_t(console.profile,console):function(){},profileEnd:console.profileEnd?_t(console.profileEnd,console):function(){},warn:wt};function Lt(e,t,r,n){var i=At(n,3),o=i[0],a=void 0===o?null:o,s=i[1],c=void 0!==s&&s,u=i[2],l=void 0===u?Ot:u;if(!Mt.__enabled)return Mt.__warned||(l.warn("console.profile is not supported. All @profile decorators are disabled."),Mt.__warned=!0),r;var d=r.value;if(null===a&&(a=e.constructor.name+"."+t),"function"!=typeof d)throw new SyntaxError("@profile can only be used on functions, not: "+d);return It({},r,{value:function(){var e,t=Date.now(),r=(!1===(e=this).hasOwnProperty(Et)&>(e,Et,{value:new bt}),e[Et]);(!0===c&&!r.profileLastRan||!1===c||"number"==typeof c&&t-r.profileLastRan>c||"function"==typeof c&&c.apply(this,arguments))&&(l.profile(a),r.profileLastRan=t);try{return d.apply(this,arguments)}finally{l.profileEnd(a)}}})}function Mt(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return yt(Lt,t)}Mt.__enabled=!!console.profile,Mt.__warned=!1;Object.defineProperty,Object.getOwnPropertyDescriptor;const Nt=function(){return function(){}};var Pt=__webpack_require__(88306),Dt=__webpack_require__.n(Pt),Ft=__webpack_require__(51206),Ut=__webpack_require__.n(Ft),jt=__webpack_require__(58908),Bt=__webpack_require__.n(jt),qt={getOSName:function(){return __webpack_require__(24753).platform()},getOSVersion:function(){return __webpack_require__(24753).release()},getBrowserName:function(){return""},getBrowserVersion:function(){return""},isBrowser:function(){return!1}};const Vt=Dt()((function(e){var t,r;return e||null!==(t=Bt().navigator)&&void 0!==t&&t.userAgent?(r=Ut().getParser(e||Bt().navigator.userAgent),{getOSName:function(){var e;return null!==(e=null==r?void 0:r.getOSName())&&void 0!==e?e:""},getOSVersion:function(){var e;return null!==(e=null==r?void 0:r.getOSVersion())&&void 0!==e?e:""},getBrowserName:function(){var e;return null!==(e=null==r?void 0:r.getBrowserName())&&void 0!==e?e:""},getBrowserVersion:function(){var e;return null!==(e=null==r?void 0:r.getBrowserVersion())&&void 0!==e?e:""},isBrowser:function(e){return!(null==r||!r.isBrowser(e,!0))}}):qt}));function Gt(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var Wt=function(e){Je(r,e);var t=Gt(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(function(e){Je(r,e);var t=Gt(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(nt));function zt(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(3===t.length)return zt("@").apply(void 0,t);var n=t[0],i=t[1];return function(e,t,r){if("initialize"!==t)throw new TypeError("@persist can only currently be applied to AmpersandState objects or their derivatives and must be applied to the initialize method");r.value=L()(r.value,(function(e){for(var t=this,r=arguments.length,o=new Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];var s=f()(e,this,o),c="@"===n?"change":"change:".concat(n);return this.on(c,U()((function(){return!i||f().apply(Reflect,[i,t].concat(o))?"@"===n?t.boundedStorage.put(n,t):t.boundedStorage.put(n,t[n]):p().resolve()}),0)),s})),Qt(e,t)}}var Ht=V(),Kt=new(ce(Ht,Ht,W()));function $t(e){if(!e)throw new Error("`key` is required");return function(t,r,n){return Kt.add(t,r,e),n.value=L()(n.value,(function(e){for(var n=this,i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];var s=Kt.get(t,r);return p().all(A(s).map((function(e){return n.boundedStorage.waitFor(e)}))).then((function(){return f()(e,n,o)}))})),"object"!==_(t)||t.prototype||(t[r]=n.value),Qt(t,r),n}}var Jt=new(W());var Yt=new(W());function Qt(e,t){var r=function(e){return e.namespace?e.namespace:e}(e);if(!Jt.has(r)){if(Jt.add(r),e.initialize)return void(e.initialize=L()(e.initialize,(function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];var o=f()(e,this,r);return f()(n,this,r),o})));e.initialize=n}function n(){var r=this,n=this.getNamespace();this.webex.initialize=L()(this.webex.initialize||D(),(function(i){var o=this;Yt.add(n);for(var a=arguments.length,s=new Array(a>1?a-1:0),c=1;c<a;c++)s[c-1]=arguments[c];f()(i,this,s);var u=B()((function(e,t){o.logger.debug("storage:(".concat(n,"): got `").concat(e,"` for first time")),"@"===e?r.parent.set(C({},n.toLowerCase(),t)):N()(r[e],"isState")?r[e].set(t):r.set(e,t),o.logger.debug("storage:(".concat(n,"): set `").concat(e,"` for first time"))})),l=B()((function(e,t){return t instanceof Wt?(o.logger.debug("storage(".concat(n,"): no data for `").concat(e,"`, continuing")),p().resolve()):(o.logger.error("storage(".concat(n,"): failed to init `").concat(e,"`"),t),p().reject(t))})),d=Kt.get(e,t),h=[];d.forEach((function(e){h.push(o.boundedStorage.get(n,e).then(u(e)).catch(l(e)))})),p().all(h).then((function(){Yt.delete(n),0===Yt.size&&(o.loaded=!0)}))}))}}var Xt=__webpack_require__(15297);function Zt(e,t,r,n,i){var o={};return Xt(n).forEach((function(e){o[e]=n[e]})),o.enumerable=!!o.enumerable,o.configurable=!!o.configurable,("value"in o||o.initializer)&&(o.writable=!0),o=r.slice().reverse().reduce((function(r,n){return n(e,t,r)||r}),o),i&&void 0!==o.initializer&&(o.value=o.initializer?o.initializer.call(i):void 0,o.initializer=void 0),void 0===o.initializer&&(b(e,t,o),o=null),o}var er=__webpack_require__(18428),tr=__webpack_require__.n(er),rr=__webpack_require__(49740),nr=__webpack_require__.n(rr),ir=new(se());function or(e,t){var r,n,i=(r=he({keyFactory:function(e){return e}}),n=function(){function r(){ne(this,r),t.logger.debug("webex-store: constructing ".concat(e,"Storage")),ir.set(this,new(V()))}return oe(r,[{key:"adapter",get:function(){return t.config.storage["".concat(e,"Adapter")]}},{key:"bindings",get:function(){return ir.get(this)}},{key:"clear",value:function(){var e=[];return this.bindings.forEach((function(t){e.push(t.clear())})),p().all(e)}},{key:"del",value:function(e,r){return t.logger.debug("webex-store: removing ".concat(e,":").concat(r)),this._getBinding(e).then((function(e){return e.del(r)}))}},{key:"get",value:function(e,r){return t.logger.debug("webex-store: retrieving ".concat(e,":").concat(r)),this._getBinding(e).then((function(e){return e.get(r)}))}},{key:"put",value:function(e,r,n){return void 0===n?this.del(e,r):(t.logger.debug("webex-store: setting ".concat(e,":").concat(r)),this._getBinding(e).then((function(e){return e.put(r,n.serialize?n.serialize():n)})).then((function(){return n})))}},{key:"_getBinding",value:function(e){var r=this;return new(p())((function(n){t.logger.debug("storage: getting binding for `".concat(e,"`"));var i=r.bindings.get(e);return i?(t.logger.debug("storage: found binding for `".concat(e,"`")),n(i)):n(r.adapter.bind(e,{logger:t.logger}).then((function(n){return t.logger.debug("storage: made binding for `".concat(e,"`")),r.bindings.set(e,n),n})))}))}}]),r}(),Zt(n.prototype,"_getBinding",[r],Ie()(n.prototype,"_getBinding"),n.prototype),n);return tr()(i.prototype,nr()),new i}var ar=new(se());function sr(e){if(!a()(e))return e;var t=e.serialize?e.serialize():e;return l()(t).forEach((function(e){var r=t[e];me()(r)?0===r.length?t[e]=void 0:t[e]=r.map(sr):a()(r)&&l()(r).forEach((function(e){r[e]=sr(r[e])}))})),l()(t).reduce((function(e,r){return e&&!t[r]}),!0)?void 0:t}function cr(e,t){var r,n,i=(r=he({keyFactory:function(e){return"initValue-".concat(e)}}),n=function(){function r(){ne(this,r),ar.set(this,new(V()))}return oe(r,[{key:"clear",value:function(){return t.webex["".concat(e,"Storage")].del(t.getNamespace())}},{key:"del",value:function(){for(var r,n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return(r=t.webex["".concat(e,"Storage")]).del.apply(r,[t.getNamespace()].concat(i))}},{key:"get",value:function(r){var n=ar.get(this).get(r);return n||(n=new Q,ar.get(this).set(r,n)),t.webex["".concat(e,"Storage")].get(t.getNamespace(),r).then((function(e){return n.resolve(),e}))}},{key:"put",value:function(r,n){return t.webex["".concat(e,"Storage")].put(t.getNamespace(),r,sr(n))}},{key:"waitFor",value:function(e){t.logger.debug("plugin-storage(".concat(t.getNamespace(),"): waiting to init key `").concat(e,"`"));var r=ar.get(this).get(e);return r?(t.logger.debug("plugin-storage(".concat(t.getNamespace(),"): already inited `").concat(e,"`")),r.promise):(t.logger.debug("plugin-storage(".concat(t.getNamespace(),"): initing `").concat(e,"`")),this.initValue(e))}},{key:"initValue",value:function(r){var n=new Q;return ar.get(this).set(r,n),t.webex["".concat(e,"Storage")].get(t.getNamespace(),r).then((function(e){t.logger.debug("plugin-storage(".concat(t.getNamespace(),"): got `").concat(r,"` for first time")),"@"===r?t.parent.set(e):N()(t[r],"isState")?t[r].set(e):t.set(r,e),t.logger.debug("plugin-storage(".concat(t.getNamespace(),"): set `").concat(r,"` for first time")),n.resolve(),t.logger.debug("plugin-storage(".concat(t.getNamespace(),"): inited `").concat(r,"`"))})).catch((function(e){return e instanceof Wt?(t.logger.debug("plugin-storage(".concat(t.getNamespace(),"): no data for `").concat(r,"`, continuing")),n.resolve()):(t.logger.warn("plugin-storage(".concat(t.getNamespace(),"): failed to init `").concat(r,"`"),e),n.reject(e))})),n.promise}}]),r}(),Zt(n.prototype,"initValue",[r],Ie()(n.prototype,"initValue"),n.prototype),n);return new i}function ur(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t=t||{},!e)return p().reject(new Error("`namespace` is required"));if(!t.logger)return p().reject(new Error("`options.logger` is required"));var r=t.logger,n=new(V())([["@",{}]]);return t.data&&l()(t.data).forEach((function(e){n.set(e,t.data[e])})),r.debug("memory-store-adapter: returning binding"),p().resolve({clear:function(){return r.debug("memory-store-adapter: clearing the binding"),p().resolve(n.clear())},del:function(e){return r.debug("memory-store-adapter: deleting `".concat(e,"`")),p().resolve(n.delete(e))},get:function(e){r.debug("memory-store-adapter: reading `".concat(e,"`"));var t=n.get(e);return void 0===t?p().reject(new Wt):p().resolve(t)},put:function(e,t){return r.debug("memory-store-adapter: writing `".concat(e,"`")),p().resolve(n.set(e,t))}})}const lr={bind:ur,preload:function(e){return{bind:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e[t]&&(r.data=e[t]),ur(t,r)}}}};const dr=y().extend({derived:{boundedStorage:{deps:[],fn:function(){return cr("bounded",this)}},unboundedStorage:{deps:[],fn:function(){return cr("unbounded",this)}},config:{cache:!1,deps:["webex","webex.config"],fn:function(){if(this.webex&&this.webex.config){var e=this.getNamespace();return e?this.webex.config[e.toLowerCase()]:this.webex.config}return{}}},logger:{deps:["webex","webex.logger"],fn:function(){return this.webex.logger||console}},webex:{deps:["parent"],fn:function(){if(!this.parent&&!this.collection)throw new Error("Cannot determine `this.webex` without `this.parent` or `this.collection`. Please initialize `this` via `children` or `collection` or set `this.parent` manually");for(var e=this;e.parent||e.collection;)e=e.parent||e.collection;return e}}},session:{parent:{type:"any"},ready:{default:!0,type:"boolean"}},clear:function(e){var t=this;return l()(this.attributes).forEach((function(r){"parent"!==r&&t.unset(r,e)})),l()(this._children).forEach((function(e){t[e].clear()})),l()(this._collections).forEach((function(e){t[e].reset()})),this},initialize:function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];f()(y().prototype.initialize,this,r),this._dataTypes=c()(this._dataTypes),l()(this._dataTypes).forEach((function(t){e._dataTypes[t].set&&(e._dataTypes[t].set=e._dataTypes[t].set.bind(e))})),this.on("change",(function(t,r){e.parent&&e.parent.trigger("change:".concat(e.getNamespace().toLowerCase()),e.parent,e,r)}))},inspect:function(e){return m().inspect(i()(this.serialize({props:!0,session:!0,derived:!0}),"boundedStorage","unboundedStorage","config","logger","webex","parent"),{depth:e})},request:function(){var e;return(e=this.webex).request.apply(e,arguments)},upload:function(){var e;return(e=this.webex).upload.apply(e,arguments)},when:function(e){for(var t=this,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];if(n&&n.length>0)throw new Error("#when() does not accept a callback, you must attach to its promise");return new(p())((function(r){t.once(e,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r(t)}))}))},_filterSetParameters:function(e,t,r){var n;return a()(e)||null===e?(n=e,r=t):(n={})[e]=t,[n,r=r||{}]}});var fr=__webpack_require__(98601),hr=__webpack_require__.n(fr),pr=__webpack_require__(36968),vr=__webpack_require__.n(pr),mr=__webpack_require__(10928),gr=__webpack_require__.n(mr),yr=__webpack_require__(47037),br=__webpack_require__.n(yr),Er=__webpack_require__(27361),Sr=__webpack_require__.n(Er),_r=__webpack_require__(66913),wr=__webpack_require__.n(_r),Rr=__webpack_require__(8450),Cr=__webpack_require__.n(Rr),Tr=__webpack_require__(67857),xr=__webpack_require__.n(Tr),kr=__webpack_require__(28583),Ir=__webpack_require__.n(kr),Ar=__webpack_require__(39907),Or=__webpack_require__.n(Ar),Lr=__webpack_require__(79873),Mr=__webpack_require__.n(Lr),Nr=__webpack_require__(78718),Pr=__webpack_require__.n(Nr),Dr=__webpack_require__(18433),Fr=__webpack_require__.n(Dr),Ur=__webpack_require__(79529),jr=__webpack_require__.n(Ur);function Br(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}function qr(e){var t=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(e),r=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(e),n=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(r),i=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(r),o=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(r),a=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(r),s=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(r),c=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(r),u=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(r),l=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(r),d=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(r),f=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(r),h=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(r),p=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(r),v=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(r),m=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(r),g=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(r),y=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(r),b=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(r),E=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(r),S=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(e),_=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(S),w=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(S),R=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(S),C=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(S),T=function(e){Je(r,e);var t=Br(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(S);tr()(e,{0:t,NetworkOrCORSError:t,400:r,BadRequest:r,401:n,Unauthorized:n,402:i,PaymentRequired:i,403:o,Forbidden:o,404:a,NotFound:a,405:s,MethodNotAllowed:s,406:c,NotAcceptable:c,407:u,ProxyAuthenticationRequired:u,408:l,RequestTimeout:l,409:d,Conflict:d,410:f,Gone:f,411:h,LengthRequired:h,412:p,PreconditionFailed:p,413:v,RequestEntityTooLarge:v,414:m,RequestUriTooLong:m,415:g,UnsupportedMediaType:g,416:y,RequestRangeNotSatisfiable:y,417:b,ExpectationFailed:b,429:E,TooManyRequests:E,500:S,InternalServerError:S,501:_,NotImplemented:_,502:w,BadGateway:w,503:R,ServiceUnavailable:R,504:C,GatewayTimeout:C,505:T,HttpVersionNotSupported:T,select:function(t){if(null==t)return e;t=t.statusCode||t;var r=e[t];return r||(t="".concat(t.toString().split("").shift(),"00"),t=jr()(t,10),e[t]||e)}})}function Vr(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var Gr=function(e){Je(r,e);var t=Vr(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"parse",value:function(e){var t,r=e.body;switch(_(r)){case"string":try{r=JSON.parse(r),t=this.parseObject(r)}catch(e){t=r}break;case"object":t=this.parseObject(r)}return t||(t=this.defaultMessage),Me()(this,{body:{enumerable:!1,value:r},httpVersion:{enumerable:!1,value:e.httpVersion},headers:{enumerable:!1,value:e.headers||{}},rawHeaders:{enumerable:!1,value:e.rawHeaders||[]},trailers:{enumerable:!1,value:e.trailers||{}},rawTrailers:{enumerable:!1,value:e.rawTrailers||[]},method:{enumerable:!1,value:e.method},url:{enumerable:!1,value:e.url},statusCode:{enumerable:!1,value:e.statusCode},statusMessage:{enumerable:!1,value:e.statusMessage},socket:{enumerable:!1,value:e.socket},_res:{enumerable:!1,value:e}}),t}},{key:"parseObject",value:function(e){var t=Fr()(Pr()(e,r.errorKeys));if(0===t.length)return Cr()(e,null,2);var n=t[0];return"object"===_(n)?this.parseObject(n):n}}]),r}(nt);C(Gr,"errorKeys",["error","errorString","response","errorResponse","message","msg"]),C(Gr,"defaultMessage","An error was received while trying to fulfill the request"),qr(Gr),Gr.makeSubTypes=qr;var Wr=function(){function e(t){var r=this;ne(this,e),t&&l()(t).forEach((function(e){var n=t[e];Mr()(r,e,{enumerable:!0,value:n})}))}return oe(e,[{key:"logOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Sr()(this,"webex.logger",console);({ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}).ENABLE_VERBOSE_NETWORK_LOGGING&&t&&(t.info("/***** Interceptor ****************************************************\\"),t.info("".concat(this.constructor.name," - ").concat(Cr()(e,null,2))))}},{key:"onRequest",value:function(e){return p().resolve(e)}},{key:"onRequestError",value:function(e,t){return p().reject(t)}},{key:"onResponse",value:function(e,t){return p().resolve(t)}},{key:"onResponseError",value:function(e,t){return p().reject(t)}}],[{key:"create",value:function(){throw new Error("`Interceptor.create()` must be defined")}}]),e}();function zr(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var Hr=function(e){Je(r,e);var t=zr(r);function r(e,n){var i;ne(this,r),i=t.call(this,e);var o=n&&(n.error||n.ErrorConstructor)||Gr;return Me()(Ye(i),{ErrorConstructor:{value:o}}),i}return oe(r,[{key:"onResponse",value:function(e,t){if(t.statusCode){if(t.statusCode<400)return p().resolve(t);if(404===t.statusCode&&t.body&&2000002===t.body.errorCode)return p().resolve(t);if(404===t.statusCode&&t.body&&404100===t.body.code)return p().resolve(t)}return p().reject(new(this.ErrorConstructor.select(t.statusCode))(t))}}],[{key:"create",value:function(e){return new r(this,e)}}]),r}(Wr),Kr=__webpack_require__(27921),$r=__webpack_require__.n(Kr),Jr=__webpack_require__(85579),Yr=__webpack_require__.n(Jr),Qr=__webpack_require__(22013),Xr=__webpack_require__.n(Qr),Zr=__webpack_require__(78149),en=__webpack_require__.n(Zr),tn=__webpack_require__(80129),rn=__webpack_require__.n(tn),nn=__webpack_require__(58908),on=__webpack_require__(27376),an=__webpack_require__(4947),sn=__webpack_require__(47529);function cn(e,t,r){var n=e;return on(t)?(r=t,"string"==typeof e&&(n={uri:e})):n=sn(t,{uri:e}),n.callback=r,n}function un(e,t,r){return ln(t=cn(e,t,r))}function ln(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,r=function(r,n,i){t||(t=!0,e.callback(r,n,i))};function n(){var e=void 0;if(e=c.response?c.response:c.responseText||function(e){if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML;return null}(c),v)try{e=JSON.parse(e)}catch(e){}return e}function i(e){var t;(clearTimeout(u),e instanceof Error)||(e=e instanceof ProgressEvent?new Error("XMLHttpRequest Error: ProgressEvent: loaded=".concat(e.loaded,", total=").concat(e.total,", lengthComputable=").concat(e.lengthComputable,", target.readyState=").concat(null===(t=e.target)||void 0===t?void 0:t.readyState)):new Error(""+(e||"Unknown XMLHttpRequest Error")));return e.statusCode=0,r(e,m)}function o(){if(!s){var t;clearTimeout(u),t=e.useXDR&&void 0===c.status?200:1223===c.status?204:c.status;var i=m,o=null;return 0!==t?(i={body:n(),statusCode:t,method:d,headers:{},url:l,rawRequest:c},c.getAllResponseHeaders&&(i.headers=an(c.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),r(o,i,i.body)}}var a,s,c=e.xhr||null;c||(c=e.cors||e.useXDR?new un.XDomainRequest:new un.XMLHttpRequest);var u,l=e.uri||e.url,d=e.method||"GET",f=e.body||e.data,h=e.headers||{},p=!!e.sync,v=!1,m={body:void 0,headers:{},statusCode:0,method:d,url:l,rawRequest:c};if("json"in e&&!1!==e.json&&(v=!0,h.accept||h.Accept||(h.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(h["content-type"]||h["Content-Type"]||(h["Content-Type"]="application/json"),f=Cr()(!0===e.json?f:e.json))),c.onreadystatechange=function(){4===c.readyState&&setTimeout(o,0)},c.onload=o,c.onerror=i,c.onprogress=function(){},c.onabort=function(){s=!0},c.ontimeout=i,c.open(d,l,!p,e.username,e.password),p||(c.withCredentials=!!e.withCredentials),!p&&e.timeout>0&&(u=setTimeout((function(){if(!s){s=!0,c.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",i(e)}}),e.timeout)),c.setRequestHeader)for(a in h)h.hasOwnProperty(a)&&c.setRequestHeader(a,h[a]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(c.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(c),c.send(f||null),c}un.XMLHttpRequest=nn.XMLHttpRequest||function(){},un.XDomainRequest="withCredentials"in new un.XMLHttpRequest?un.XMLHttpRequest:nn.XDomainRequest,function(e,t){for(var r=0;r<e.length;r+=1)t(e[r])}(["get","put","post","patch","head","delete"],(function(e){un["delete"===e?"del":e]=function(t,r,n){return(r=cn(t,r,n)).method=e.toUpperCase(),ln(r)}}));const dn=un;var fn=__webpack_require__(97769);function hn(e){return pn.apply(this,arguments)}function pn(){return(pn=_e(Re().mark((function e(t){var r;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t instanceof Blob||t instanceof ArrayBuffer||t instanceof Uint8Array){e.next=2;break}throw new Error("`detect` requires a buffer of type Blob, ArrayBuffer, or Uint8Array");case 2:if(!(t instanceof Blob)){e.next=4;break}return e.abrupt("return",t.type);case 4:return e.next=6,(0,fn.fromBuffer)(t);case 6:if(r=e.sent){e.next=9;break}return e.abrupt("return","application/octet-stream");case 9:return e.abrupt("return",r.mime);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function vn(e,t){var r=void 0!==Yr()&&e[Xr()]||e["@@iterator"];if(!r){if(en()(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return mn(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return $r()(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return mn(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function mn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function gn(e){return new(p())((function(n){var i=Pr()(e,"method","uri","withCredentials","headers","timeout","responseType");i.response=!0,function(e){e.xhr=new XMLHttpRequest}(i),function(e,t){e.method&&["PATCH","POST","PUT"].includes(e.method.toUpperCase())&&(e.xhr||(e.xhr=new XMLHttpRequest),e.xhr.upload.onprogress=t.upload.emit.bind(t.upload,"progress"))}(i,e),function(e,t){if(t.auth)if(t.auth.bearer)e.headers.authorization="Bearer ".concat(t.auth.bearer);else{var r=t.auth.user||t.auth.username,n=t.auth.pass||t.auth.password,i=btoa("".concat(r,":").concat(n));e.headers.Authorization="Basic ".concat(i)}}(i,e),function(e,t){t.jar&&(e.withCredentials=!0)}(i,e),function(e,t){var r={cors:!0,withCredentials:!1,timeout:0};je()(e,Pr()(t,l()(r)),r)}(i,e),function(e,t){"buffer"===t.responseType&&(e.responseType="arraybuffer")}(i,e),function(e,r){t.apply(this,arguments)}(i,e),function(e,t){"json"in t&&!0!==t.json||!t.body?t.form?(e.headers["Content-Type"]="application/x-www-form-urlencoded",e.body=rn().stringify(t.form),xr()(e,"json")):t.formData?e.body=l()(t.formData).reduce((function(e,n){return r(e,n,t.formData[n]),e}),new FormData):(e.body=t.body,xr()(e,"json")):e.json=t.body}(i,e),function(e,t){t.qs&&(e.uri+="?".concat(rn().stringify(t.qs)))}(i,e),e.logger.debug("start http ".concat(e.method?e.method:"request"," to ").concat(e.uri));var o=dn(i,(function(t,r){t&&e.logger.warn("XHR error for ".concat(e.method||"request"," to ").concat(e.uri," :"),t),r?(r.statusCode>=400?e.logger.warn("http ".concat(e.method?e.method:"request"," to ").concat(e.uri," result: ").concat(r.statusCode)):e.logger.debug("http ".concat(e.method?e.method:"request"," to ").concat(e.uri," result: ").concat(r.statusCode)),r.options=e,function(e,t){if(!t.json&&"object"!==_(e.body))try{e.body=JSON.parse(e.body)}catch(e){}}(r,i),n(r)):n({statusCode:0,options:e,headers:e.headers,method:e.method,url:e.uri,body:t})}));o.onprogress=e.download.emit.bind(e.download,"progress")})).catch((function(t){return e.logger.warn(t),{statusCode:0,options:e,headers:e.headers,method:e.method,url:e.uri,body:t}}));function t(){return t=_e(Re().mark((function e(t,r){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.body instanceof Blob||r.body instanceof ArrayBuffer)){e.next=8;break}if(r.json=t.json=!1,e.t0=t.headers["content-type"],e.t0){e.next=7;break}return e.next=6,hn(r.body);case 6:e.t0=e.sent;case 7:t.headers["content-type"]=e.t0;case 8:case"end":return e.stop()}}),e)}))),t.apply(this,arguments)}function r(e,t,n){if(me()(n)){var i,o=vn(n);try{for(o.s();!(i=o.n()).done;){r(e,t,i.value)}}catch(e){o.e(e)}finally{o.f()}}else(n=function(e){if(e instanceof ArrayBuffer){var t=e.type?new Blob([e],{type:e.type}):new Blob([e]);return t.filename=e.filename||e.name||"untitled",t}return e}(n)).name?(n.filename=n.name,e.append(t,n,n.name)):e.append(t,n)}}function yn(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,i="on".concat(r),o="on".concat(r,"Error");return t.reduce((function(t,r){return t.then((function(t){return r.logOptions(e),r[i]?r[i](e,t):p().resolve(t)}),(function(t){return r.logOptions(e),r[o]?r[o](e,t):p().reject(t)}))}),p().resolve(n))}function bn(){return(bn=_e(Re().mark((function e(t){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.url&&(t.uri=t.url,t.url=null),t.headers=t.headers||{},t.json?(t.headers.accept=t.headers.accept||t.headers.Accept||"application/json","GET"!==t.method&&"HEAD"!==t.method&&(t.headers["content-type"]=t.headers["content-type"]||t.headers["Content-Type"]||"application/json",t.body=Cr()(!0===t.json?t.body:t.json))):void 0!==t.json&&xr()(t,"json"),t.download=new Be.EventEmitter,t.upload=new Be.EventEmitter,t.keepalive=!0,e.abrupt("return",yn(t,t.interceptors,"Request").then((function(){return t})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}__webpack_require__(81763);var En=__webpack_require__(7520),Sn=__webpack_require__.n(En);var _n=B()((function(e,t){if(br()(t)){var r=t;(t=arguments[2]||{}).uri=r}return["download","interceptors","logger","upload"].forEach((function(e){var r=Or()(t,e);r=Ir()({},r,{enumerable:!1,writable:!0}),Mr()(t,e,r)})),je()(t,e),t.json||!1===t.json||xr()(t,"json"),t.logger=t.logger||this.logger||console,function(e){return e.url&&(e.uri=e.url,e.url=null),e.headers=e.headers||{},e.download=new Be.EventEmitter,e.upload=new Be.EventEmitter,yn(e,e.interceptors,"Request").then((function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.request?e.request.apply(e,[e].concat(r)):gn.apply(void 0,[e].concat(r))})).then((function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return yn.apply(void 0,[e,e.interceptors.slice().reverse(),"Response"].concat(r))}))}(t)})),wn=B()((function(e,t){return["download","interceptors","logger","upload"].forEach((function(e){var r=Or()(t,e);r=Ir()({},r,{enumerable:!1,writable:!0}),Mr()(t,e,r)})),je()(t,e),t.logger=t.logger||this.logger||console,function(e){return bn.apply(this,arguments)}(t)})),Rn=function(e){var t=function(e){var t=(new Date).getTime();return e.$timings=e.$timings||{},e.$timings.requestStart=t,e.$timings.networkStart=t,e}(e);return fetch(t.uri,t)},Cn={json:!0,interceptors:[Hr.create()]},Tn=_n,xn=(_n(Cn),__webpack_require__(55877)),kn=__webpack_require__.n(xn);function In(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var An=function(e){Je(r,e);var t=In(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"onRequest",value:function(e){var t=this;return e.headers=e.headers||{},"authorization"in e.headers||"auth"in e?(e.headers.authorization||xr()(e.headers,"authorization"),p().resolve(e)):this.requiresCredentials(e).then((function(r){return r?t.webex.credentials.getUserToken().then((function(t){return e.headers.authorization=t.toString(),e})):e}))}},{key:"requiresCredentials",value:function(e){var t=this;if(!1===e.addAuthHeader)return p().resolve(!1);if(!this.webex.internal.services)return p().resolve(!1);var r=this.webex.internal.services,n=(r.getServiceFromUrl(e.uri||"")||{}).name,i=e.resource,o=e.uri,a=e.service||e.api;return a&&"u2c"===a||n&&"u2c"===n?i&&i.includes("limited")||o&&o.includes("limited")?p().resolve(!1):p().resolve(!0):r.validateDomains&&r.hasAllowedDomains()&&o&&r.isAllowedDomainUrl(o)?p().resolve(!0):r.waitForService({name:a,url:o}).then((function(e){return!!r.getServiceFromUrl(e)})).catch((function(e){return t.webex.logger.warn("auth-interceptor: failed to validate service exists in catalog",e),!1}))}},{key:"onResponseError",value:function(e,t){var r=this;return this.shouldAttemptReauth(t,e).then((function(n){return n&&(r.webex.logger.info("auth: received 401, attempting to reauthenticate"),t.options.headers&&xr()(t.options.headers,"authorization"),r.webex.credentials.canRefresh)?r.webex.credentials.refresh().then((function(){return r.replay(e)})):p().reject(t)}))}},{key:"replay",value:function(e){return e.replayCount?e.replayCount+=1:e.replayCount=1,e.replayCount>this.webex.config.maxAuthenticationReplays?(this.webex.logger.error("auth: failed after ".concat(this.webex.config.maxAuthenticationReplays," replay attempts")),p().reject(new Error("Failed after ".concat(this.webex.config.maxAuthenticationReplays," replay attempts")))):(this.webex.logger.info("auth: replaying request ".concat(e.replayCount," time")),this.webex.request(e))}},{key:"shouldAttemptReauth",value:function(e,t){return t&&!1===t.shouldRefreshAccessToken?p().resolve(!1):401===e.statusCode?p().resolve(!0):p().resolve(!1)}}],[{key:"create",value:function(){return new r({webex:this})}}]),r}(Wr),On=__webpack_require__(66130),Ln=__webpack_require__.n(On);function Mn(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var Nn=function(e){Je(r,e);var t=Mn(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"onRequest",value:function(e){return e.$timings=e.$timings||{},e.$timings.networkStart=Ln()(),e}},{key:"onResponse",value:function(e,t){return e.$timings.networkEnd=Ln()(),t}},{key:"onResponseError",value:function(e,t){return e.$timings.networkEnd=Ln()(),p().reject(t)}}],[{key:"create",value:function(e){return new r(this,e)}}]),r}(Wr);function Pn(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var Dn=function(e){Je(r,e);var t=Pn(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"onRequest",value:function(e){return e.noTransform?e:this.webex.transform("outbound",e)}},{key:"onResponse",value:function(e,t){return e.disableTransform?t:this.webex.transform("inbound",t)}},{key:"onResponseError",value:function(e,t){return this.webex.transform("inbound",t).then((function(e){return p().reject(e||t)}))}}],[{key:"create",value:function(){return new r({webex:this})}}]),r}(Wr),Fn=__webpack_require__(66678),Un=__webpack_require__.n(Fn);function jn(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var Bn="cisco-no-http-redirect",qn="cisco-location",Vn=function(e){Je(r,e);var t=jn(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"onRequest",value:function(e){return e&&e.uri&&"string"==typeof e.uri&&(e.uri.includes("https://idbroker")||e.uri.includes(this.webex.config.credentials.samlUrl)||e.uri.includes(this.webex.config.credentials.tokenUrl)||e.uri.includes(this.webex.config.credentials.authorizeUrl))?e:Bn in e.headers?(e.headers[Bn]||xr()(e.headers,Bn),e):(e.headers[Bn]=!0,e.$redirectCount=e.$redirectCount||0,e)}},{key:"onResponse",value:function(e,t){if(t.headers&&t.headers[qn])return(e=Un()(e)).uri=t.headers[qn],e.$redirectCount+=1,e.$redirectCount>this.webex.config.maxAppLevelRedirects?p().reject(new Error("Maximum redirects exceeded")):this.webex.request(e);if(t.headers&&t.body&&2000002===t.body.errorCode&&t.body.location){if(e=Un()(e),this.webex.logger.warn("redirect: url redirects needed from",e.uri),t.options&&t.options.qs){var r=t.body.location.split("?");e.uri=r[0]}else e.uri=t.body.location;return this.webex.logger.warn("redirect: url redirects needed to",e.uri),e.$redirectCount+=1,e.$redirectCount>this.webex.config.maxLocusRedirects?p().reject(new Error("Maximum redirects exceeded")):this.webex.request(e)}if(t.headers&&t.body&&404100===t.body.code&&t.body.data&&t.body.data.siteFullUrl){if(e=Un()(e),this.webex.logger.warn("redirect: url redirects needed from",e.uri),t.options&&t.options.qs){var n=t.body.data.siteFullUrl.split("?");e.uri=n[0]}else e.uri=e.uri.replace(/(?<=https:\/\/)[^/]+/,t.body.data.siteFullUrl);return this.webex.logger.warn("redirect: url redirects needed to",e.uri),e.$redirectCount+=1,e.$redirectCount>this.webex.config.maxLocusRedirects?p().reject(new Error("Maximum redirects exceeded")):this.webex.request(e)}return t}}],[{key:"create",value:function(){return new r({webex:this})}}]),r}(Wr);function Gn(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var Wn=function(e){Je(r,e);var t=Gn(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"onRequest",value:function(e){var t=Sr()(this,"webex.logger",console);try{this.webex.trigger("request:start",e)}catch(e){t.warn("event handler for request:start failed ",e)}return p().resolve(e)}},{key:"onRequestError",value:function(e,t){var r=Sr()(this,"webex.logger",console);try{this.webex.trigger("request:end",e,t),this.webex.trigger("request:failure",e,t)}catch(e){r.warn("event handler for request:end failed ",e)}return p().reject(t)}},{key:"onResponse",value:function(e,t){var r=Sr()(this,"webex.logger",console);try{this.webex.trigger("request:success",t.options,t)}catch(e){r.warn("event handler for request:success failed ",e)}return p().resolve(t)}},{key:"onResponseError",value:function(e,t){var r=Sr()(this,"webex.logger",console);try{this.webex.trigger("request:end",e,t),this.webex.trigger("request:failure",e,t)}catch(e){r.warn("event handler for request:failure failed ",e)}return p().reject(t)}}],[{key:"create",value:function(){return new r({webex:this})}}]),r}(Wr),zn=__webpack_require__(18721),Hn=__webpack_require__.n(zn);function Kn(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var $n=function(e){Je(r,e);var t=Kn(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"onRequest",value:function(e){var t=Sr()(this,"webex.logger",console);t.info("/**********************************************************************\\ "),t.info("Request:",e.method||"GET",e.uri),t.info("WEBEX_TRACKINGID: ",Sr()(e,"headers.trackingid")),Hn()(e,"headers.x-trans-id")&&t.info("X-Trans-ID: ",Sr()(e,"headers.x-trans-id"));var r=new Date;if({ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.ENABLE_VERBOSE_NETWORK_LOGGING){t.info("timestamp (start): ",r.getTime(),r.toISOString());try{e.body&&e.body.length&&!me()(e.body)&&!br()(e.body)?t.info("Request Options:",m().inspect(i()(e,"body"),{depth:null})):t.info("Request Options:",m().inspect(e,{depth:null}))}catch(e){t.warn("Could not stringify request options:",e)}}return p().resolve(e)}},{key:"onRequestError",value:function(e,t){this.onRequest(e);var r=Sr()(this,"webex.logger",console);return r.error("Request Failed: ",t.stack),r.info("\\**********************************************************************/"),p().reject(t)}}],[{key:"create",value:function(){return new r({webex:this})}}]),r}(Wr);function Jn(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var Yn=function(e){Je(r,e);var t=Jn(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"onRequest",value:function(e){return e.$timings=e.$timings||{},e.$timings.requestStart=Ln()(),e}},{key:"onRequestError",value:function(e){return e.$timings.requestEnd=e.$timings.requestFail=Ln()(),p().reject(e)}},{key:"onResponse",value:function(e,t){return e.$timings.requestEnd=Ln()(),p().resolve(t)}},{key:"onResponseError",value:function(e,t){return e.$timings.requestEnd=e.$timings.requestFail=Ln()(),p().reject(t)}}],[{key:"create",value:function(e){return new r(this,e)}}]),r}(Wr);function Qn(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var Xn=function(e){Je(r,e);var t=Qn(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"onResponse",value:function(e,t){var r=new Date;this.printResponseHeader(e,t);var n=Sr()(this,"webex.logger",console);if({ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.ENABLE_VERBOSE_NETWORK_LOGGING)if(n.info("timestamp (end): ",r.getTime(),r.toISOString()),"string"==typeof t.body||K(t.body))n.info("Response: ","Not printed, it`s probably a file");else if("object"===_(t.body))try{n.info("Response: ",m().inspect(i()(t.body,"features"),{depth:null}))}catch(e){n.info("Response: ","[Not Serializable]",e)}return n.info("\\**********************************************************************/"),t}},{key:"onResponseError",value:function(e,t){var r=new Date;this.printResponseHeader(e,t);var n=Sr()(this,"webex.logger",console);if({ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.ENABLE_VERBOSE_NETWORK_LOGGING){n.info("timestamp (end): ",r.getTime(),r.toISOString());try{n.error("Response: ",m().inspect(t.body,{depth:null}))}catch(e){n.error("Response: ",t.body)}}return n.info("\\**********************************************************************/"),p().reject(t)}},{key:"printResponseHeader",value:function(e,t){var r=Sr()(this,"webex.logger",console);r.info("Status Code:",t.statusCode),r.info("WEBEX_TRACKINGID:",Sr()(e,"headers.trackingid")||Sr()(t,"headers.trackingid")),r.info("Network duration:",e.$timings.networkEnd-e.$timings.networkStart),r.info("Processing duration:",e.$timings.requestEnd-e.$timings.requestStart)}}],[{key:"create",value:function(){return new r({webex:this})}}]),r}(Wr);function Zn(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var ei=function(e){Je(r,e);var t=Zn(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"parse",value:function(e){var t=f()(Gr.prototype.parse,this,[e]);return Mr()(this,"options",{enumerable:!1,value:e.options}),Mr()(this,"body",{enumerable:!1,value:e.body}),this.body&&this.body.errorCode&&(t+="\nerrorCode : ".concat(this.body.errorCode)),this.options.url?t+="\n".concat(this.options.method," ").concat(this.options.url):this.options.uri?t+="\n".concat(this.options.method," ").concat(this.options.uri):t+="\n".concat(this.options.method," ").concat(this.options.service.toUpperCase(),"/").concat(this.options.resource),t+="\nWEBEX_TRACKING_ID: ".concat(this.options.headers.trackingid),this.options.headers&&this.options.headers["x-trans-id"]&&(t+="\nX-Trans-Id: ".concat(this.options.headers["x-trans-id"])),this.headers["retry-after"]&&(Mr()(this,"retryAfter",{enumerable:!0,value:this.headers["retry-after"],writeable:!1}),t+="\nRETRY-AFTER: ".concat(this.retryAfter)),t+="\n"}}]),r}(Gr);Gr.makeSubTypes(ei);var ti=function(e){Je(r,e);var t=Zn(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(Gr.BadRequest);function ri(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}Gr[429]=ti,Gr.TooManyRequests=ti;var ni=new(se()),ii=function(e){Je(r,e);var t=ri(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ne(this,r);var i=Sr()(n,"webex.config.appName"),o=Sr()(n,"webex.config.appVersion")||"0.0";return e=t.call(this,n),i?ni.set(Ye(e),"".concat(i,"/").concat(o)):ni.set(Ye(e),"@webex/http-core"),e}return oe(r,[{key:"onRequest",value:function(e){return e}}],[{key:"create",value:function(){return new r({webex:this})}}]),r}(Wr);function oi(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var ai=new(V()),si=function(e){Je(r,e);var t=oi(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"sequence",get:function(){var e=ai.get(this)||0;return e+=1,ai.set(this,e),e}},{key:"onRequest",value:function(e){if(e.headers=e.headers||{},"trackingid"in e.headers)return e.headers.trackingid||xr()(e.headers,"trackingid"),e;if(this.requiresTrackingId(e)&&(e.headers.trackingid="".concat(this.webex.sessionId,"_").concat(this.sequence)),e.headers.trackingid&&e.replayCount){var t=e.headers.trackingid.split("+");t[1]=e.replayCount,e.headers.trackingid=t.join("+")}return e}},{key:"requiresTrackingId",value:function(e){return!e.headers.trackingid}}],[{key:"create",value:function(){return new r({webex:this})}}]),r}(Wr);function ci(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var ui=new(se()),li=function(e){Je(r,e);var t=ci(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ne(this,r);var i=Sr()(n,"webex.webex",!1)?"webex":"webex-js-sdk",o=Sr()(n,"webex.version","development");return e=t.call(this,n),ui.set(Ye(e),"".concat(i,"/").concat(o," (").concat("web",")")),e}return oe(r,[{key:"onRequest",value:function(e){var t,r;e.headers=e.headers||{};var n=null!==(t=null===(r=this.webex)||void 0===r?void 0:r.config)&&void 0!==t?t:{},i=n.appName,o=n.appVersion,a=n.appPlatform,s="".concat(ui.get(this));return i&&(s+=" ".concat(i,"/").concat(null!=o?o:"0.0")),a&&(s+=" ".concat(a)),e.uri&&e.uri.includes("https://idbroker")||e.uri&&(e.uri.includes(this.webex.config.credentials.samlUrl)||e.uri.includes(this.webex.config.credentials.tokenUrl)||e.uri.includes(this.webex.config.credentials.authorizeUrl))?e:"spark-user-agent"in e.headers?(e.headers["spark-user-agent"]||xr()(e.headers,"spark-user-agent"),e):(e.headers["spark-user-agent"]=s,e)}}],[{key:"create",value:function(){return new r({webex:this})}}]),r}(Wr);function di(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var fi=new(se()),hi=/.*(idbroker|identity)(bts)?.ciscospark.com\/([^/]+)/,pi=function(e){Je(r,e);var t=di(r);function r(){var e;ne(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return e=t.call.apply(t,[this].concat(i)),fi.set(Ye(e),new(V())),e}return oe(r,[{key:"onRequest",value:function(e){return this.isRateLimited(e.uri)?p().reject(new Error("API rate limited ".concat(e.uri))):p().resolve(e)}},{key:"onResponseError",value:function(e,t){return 429===t.statusCode&&(e.uri.includes("idbroker")||e.uri.includes("identity"))&&this.setRateLimitExpiry(e.uri,this.extractRetryAfterTime(e)),p().reject(t)}},{key:"extractRetryAfterTime",value:function(e){var t=1e3,r=e.headers["retry-after"]||null;return null===r||r<=0?6e4:r>3600?36e5:r*t}},{key:"setRateLimitExpiry",value:function(e,t){var r=this.getApiName(e);if(!r)return!1;var n=(new Date).getTime()+t;return fi.get(this).set(r,n)}},{key:"getRateLimitStatus",value:function(e){var t=this.getApiName(e);if(!t)return!1;var r=(new Date).getTime(),n=fi.get(this);return void 0!==n.get(t)&&r<n.get(t)}},{key:"getApiName",value:function(e){if(!e)return null;var t=e.match(hi);return t?t[2]:null}},{key:"isRateLimited",value:function(e){return!(!e||!e.includes("idbroker")&&!e.includes("identity"))&&this.getRateLimitStatus(e)}}],[{key:"create",value:function(){return new r({webex:this})}}]),r}(Wr);function vi(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var mi=function(e){Je(r,e);var t=vi(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"onResponseError",value:function(e,t){if(451===t.statusCode){var r=this.webex.internal.device,n=["Received `HTTP 451 Unavailable For Legal Reasons`, ","discarding credentials and device registration"].join("");r&&this.webex.internal.device.clear(),this.webex.credentials.clear(),this.webex.logger.info(n)}return p().reject(t)}}],[{key:"create",value:function(){return new r({webex:this})}}]),r}(Wr);function gi(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var yi=function(e){Je(r,e);var t=gi(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"onRequest",value:function(e){var t=this.webex.config.defaultRequestOptions;return t?(l()(t).forEach((function(r){l()(e).includes(r)||(e[r]=t[r])})),e):e}}],[{key:"create",value:function(){return new r({webex:this})}}]),r}(Wr);function bi(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var Ei=function(e){Je(r,e);var t=bi(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"onRequest",value:function(e){if(e.uri)try{e.uri=this.webex.internal.services.replaceHostFromHostmap(e.uri)}catch(e){}return e}}],[{key:"create",value:function(){return new r({webex:this})}}]),r}(Wr);const Si={maxAppLevelRedirects:10,maxLocusRedirects:5,maxAuthenticationReplays:1,maxReconnectAttempts:1,onBeforeLogout:[],trackingIdPrefix:"webex-js-sdk",trackingIdSuffix:"",AlternateLogger:void 0,credentials:new(y().extend({extraProperties:"allow",props:{idbroker:["object",!1,function(){return{url:"https://idbroker.webex.com"}}],identity:["object",!1,function(){return{url:"https://identity.webex.com"}}],authorizationString:["string",!1,{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.WEBEX_AUTHORIZATION_STRING||{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.AUTHORIZATION_STRING],authorizeUrl:["string",!1,{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.WEBEX_AUTHORIZE_URL||"".concat("https://idbroker.webex.com","/idb/oauth2/v1/authorize")],client_id:["string",!1,{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.WEBEX_CLIENT_ID||{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.COMMON_IDENTITY_CLIENT_ID||{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.CLIENT_ID],client_secret:["string",!1,{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.WEBEX_CLIENT_SECRET||{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.COMMON_IDENTITY_CLIENT_SECRET||{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.CLIENT_SECRET],redirect_uri:["string",!1,{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.WEBEX_REDIRECT_URI||{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.COMMON_IDENTITY_REDIRECT_URI||{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.REDIRECT_URI],scope:["string",!1,{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.WEBEX_SCOPE||{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.WEBEX_SCOPES||{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.COMMON_IDENTITY_SCOPE||{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.SCOPE],cisService:["string",!1,"webex"]},derived:{activationUrl:{deps:["idbroker.url"],fn:function(){return"".concat(this.idbroker.url||"https://idbroker.webex.com","/idb/token/v1/actions/UserActivation/invoke")},cache:!1},generateOtpUrl:{deps:["idbroker.url"],fn:function(){return"".concat(this.idbroker.url||"https://idbroker.webex.com","/idb/token/v1/actions/UserOTP/Generate/invoke")},cache:!1},validateOtpUrl:{deps:["idbroker.url"],fn:function(){return"".concat(this.idbroker.url||"https://idbroker.webex.com","/idb/token/v1/actions/UserOTP/Validate/invoke")},cache:!1},tokenUrl:{deps:["idbroker.url"],fn:function(){return{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.TOKEN_URL||"".concat(this.idbroker.url,"/idb/oauth2/v1/access_token")},cache:!1},revokeUrl:{deps:["idbroker.url"],fn:function(){return{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.REVOKE_URL||"".concat(this.idbroker.url,"/idb/oauth2/v1/revoke")},cache:!1},logoutUrl:{deps:["idbroker.url"],fn:function(){return"".concat(this.idbroker.url,"/idb/oauth2/v1/logout")},cache:!1},setPasswordUrl:{deps:["identity.url"],fn:function(){return"".concat(this.identity.url||"https://identity.webex.com","/identity/scim/v1/Users")},cache:!1}}})),fedramp:{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.ENABLE_FEDRAMP||!1,services:{discovery:{hydra:"https://api.ciscospark.com/v1",sqdiscovery:"https://ds.ciscospark.com/v1/region",u2c:"https://u2c.wbx2.com/u2c/api/v1"},validateDomains:!0,servicesNotNeedValidation:["webex-appapi-service"],allowedDomains:[]},device:{preDiscoveryServices:{hydra:"https://api.ciscospark.com/v1",hydraServiceUrl:"https://api.ciscospark.com/v1"},validateDomains:!0},metrics:{type:["behavioral","operational"]},payloadTransformer:{predicates:[],transforms:[]},storage:{boundedAdapter:lr,unboundedAdapter:lr}};var _i=__webpack_require__(93386),wi=__webpack_require__.n(_i);function Ri(e,t,r){(e._derived[t]={fn:Fe()(r)?r:r.fn,cache:!1!==r.cache,depList:r.deps||[]}).depList.forEach((function(r){e._deps[r]=wi()(e._deps[r]||[],[t])})),Mr()(e,t,{get:function(){return this._getDerivedProperty(t)},set:function(){throw new TypeError("`".concat(t,"` is a derived property, it can't be set directly."))}})}const Ci=y().extend({derived:{ready:{deps:[],fn:function(){var e=this;return l()(this._children).reduce((function(t,r){return t&&e[r]&&!1!==e[r].ready}),!0)}}},inspect:function(e){return m().inspect(this.serialize({props:!0,session:!0,derived:!0}),{depth:e})}});var Ti,xi=__webpack_require__(34155);function ki(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ii(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ki(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):ki(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}var Ai={WebexTrackingIdInterceptor:si.create,RequestEventInterceptor:Wn.create,RateLimitInterceptor:pi.create,RequestLoggerInterceptor:{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.ENABLE_NETWORK_LOGGING||{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.ENABLE_VERBOSE_NETWORK_LOGGING?$n.create:void 0,ResponseLoggerInterceptor:{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.ENABLE_NETWORK_LOGGING||{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.ENABLE_VERBOSE_NETWORK_LOGGING?Xn.create:void 0,RequestTimingInterceptor:Yn.create,ServiceInterceptor:void 0,UserAgentInterceptor:ii.create,WebexUserAgentInterceptor:li.create,AuthInterceptor:An.create,KmsDryErrorInterceptor:void 0,PayloadTransformerInterceptor:Dn.create,ConversationInterceptor:void 0,RedirectInterceptor:Vn.create,HttpStatusInterceptor:function(){return Hr.create({error:ei})},NetworkTimingInterceptor:Nn.create,EmbargoInterceptor:mi.create,DefaultOptionsInterceptor:yi.create,HostMapInterceptor:Ei.create},Oi=["ResponseLoggerInterceptor","RequestTimingInterceptor","RequestEventInterceptor","WebexTrackingIdInterceptor","RateLimitInterceptor"],Li=["HttpStatusInterceptor","NetworkTimingInterceptor","EmbargoInterceptor","RequestLoggerInterceptor","RateLimitInterceptor"],Mi=y().extend((Ti={version:"3.8.1-next.55",children:{internal:Ci},constructor:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return"string"==typeof e?e={credentials:{supertoken:{access_token:e}}}:(["credentials.authorization","authorization","credentials.supertoken.supertoken","supertoken","access_token","credentials.authorization.supertoken"].forEach((function(t){var r=Sr()(e,t);r&&(hr()(e,t),vr()(e,"credentials.supertoken",r))})),["credentials","credentials.authorization"].forEach((function(t){var r=Sr()(e,t);"string"==typeof r&&(hr()(e,t),vr()(e,"credentials.supertoken",r))})),"string"==typeof Sr()(e,"credentials.access_token")&&(vr()(e,"credentials.access_token",this.bearerValidator(Sr()(e,"credentials.access_token").trim())),vr()(e,"credentials.supertoken",e.credentials))),f()(y(),this,[e,t])},derived:{boundedStorage:{deps:[],fn:function(){return or("bounded",this)}},unboundedStorage:{deps:[],fn:function(){return or("unbounded",this)}},ready:{deps:["loaded","internal.ready"],fn:function(){var e=this;return this.loaded&&l()(this._children).reduce((function(t,r){return t&&e[r]&&!1!==e[r].ready}),!0)}}},session:{config:{type:"object"},loaded:{default:!1,type:"boolean"},request:{setOnce:!0,type:"any"},sessionId:{type:"string"}},refresh:function(){var e;return(e=this.credentials).refresh.apply(e,arguments)},transform:function(e,t){var r=this,n=this.config.payloadTransformer.predicates.filter((function(t){return!t.direction||t.direction===e})),i={webex:this};return p().all(n.map((function(e){return e.test(i,t).then((function(r){if(r)return e.extract(t).then((function(t){return{name:e.name,target:t}}))}))}))).then((function(t){return t.filter((function(e){return Boolean(e)})).reduce((function(t,n){var i=n.name,o=n.target,a=n.alias;return t.then((function(){return a?r.applyNamedTransform(e,a,o):r.applyNamedTransform(e,i,o)}))}),p().resolve())})).then((function(){return t}))},applyNamedTransform:function(e,t,r){for(var n=this,i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];return br()(t)&&(o.unshift(r),r=t,t={webex:this,transform:function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n.applyNamedTransform.apply(n,[e,t].concat(i))}}),t.webex.config.payloadTransformer.transforms.filter((function(t){return t.name===r&&(!t.direction||t.direction===e)})).reduce((function(e,r){return e.then((function(){var e;return r.alias?(e=t).transform.apply(e,[r.alias].concat(o)):p().resolve(r.fn.apply(r,[t].concat(o)))}))}),p().resolve()).then((function(){return gr()(o)}))},getWindow:function(){return window},initialize:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.config=r()({},Si,t.config),this.trigger("change:config");var n=function t(){e.loaded&&(e.trigger("loaded"),e.stopListening(e,"change:loaded",t))};xi.nextTick((function(){e.listenToAndRun(e,"change:loaded",n)}));var i=function t(){e.ready&&(e.trigger("ready"),e.stopListening(e,"change:ready",t))};xi.nextTick((function(){e.listenToAndRun(e,"change:ready",i)})),l()(this.constructor.prototype._children).forEach((function(t){e.listenTo(e[t],"change",(function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];n.unshift("change:".concat(t)),e.trigger.apply(e,n)}))}));var o=function(t,r){var n=(e.config.interceptors||Ai)[r];return Fe()(n)?(t.push(f()(n,e,[])),t):t},a=[];this.config.interceptors?l()(this.config.interceptors).reduce(o,a):(a=Oi.reduce(o,a),a=l()(Ai).filter((function(e){return!(Oi.includes(e)||Li.includes(e))})).reduce(o,a),a=Li.reduce(o,a)),this.request=Tn({json:!0,interceptors:a}),this.prepareFetchOptions=wn({json:!0,interceptors:a}),this.setTimingsAndFetch=Rn;var s="".concat(Sr()(this,"config.trackingIdPrefix","webex-js-sdk"),"_").concat(Sr()(this,"config.trackingIdBase",kn().v4()));Sr()(this,"config.trackingIdSuffix")&&(s+="_".concat(Sr()(this,"config.trackingIdSuffix"))),this.sessionId=s},setConfig:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.config=r()({},this.config,e)},bearerValidator:function(e){return e.includes("Bearer")&&e.split(" ").length-1==0?(console.warn("Your access token does not have a space between 'Bearer' and the token, please add a space to it or replace it with this already fixed version:\n\n".concat(e.replace("Bearer","Bearer ").replace(/\s+/g," "))),console.info("Tip: You don't need to add 'Bearer' to the access_token field. The token by itself is fine"),e.replace("Bearer","Bearer ").replace(/\s+/g," ")):e.split(" ").length-1>1?(console.warn("Your access token has ".concat(e.split(" ").length-2," too many spaces, please use this format:\n\n").concat(e.replace(/\s+/g," "))),console.info("Tip: You don't need to add 'Bearer' to the access_token field, the token by itself is fine"),e.replace(/\s+/g," ")):e.replace(/\s+/g," ")},inspect:function(e){return m().inspect(i()(this.serialize({props:!0,session:!0,derived:!0}),"boundedStorage","unboundedStorage","request","config"),{depth:e})},logout:function(e){for(var t=this,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var o=this.credentials.supertoken&&(this.credentials.supertoken.refresh_token||this.credentials.supertoken.access_token);return e=tr()({token:o},e),this.config.onBeforeLogout.reverse().reduce((function(r,i){var o=i.plugin,a=i.fn;return r.then((function(){return p().resolve(f()(a,t[o]||t.internal[o],[e].concat(n))).catch((function(e){t.logger.warn("onBeforeLogout from plugin ".concat(o,": failed"),e)}))}))}),p().resolve()).then((function(){return p().all([t.boundedStorage.clear(),t.unboundedStorage.clear()])})).then((function(){var e;return(e=t.credentials).invalidate.apply(e,n)})).then((function(){var r;return t.authorization&&t.authorization.logout&&(r=t.authorization).logout.apply(r,[e].concat(n))})).then((function(){return t.trigger("client:logout")}))},measure:function(){var e;return this.metrics?(e=this.metrics).sendUnstructured.apply(e,arguments):p().resolve()},upload:function(e){var t=this;return _e(Re().mark((function r(){var n,o;return Re().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(e.file){r.next=2;break}return r.abrupt("return",p().reject(new Error("`options.file` is required")));case 2:return e.phases=e.phases||{},e.phases.initialize=e.phases.initialize||{},e.phases.upload=e.phases.upload||{},e.phases.finalize=e.phases.finalize||{},wr()(e.phases.initialize,{method:"POST",body:{uploadProtocol:"content-length"}},i()(e,"file","phases")),wr()(e.phases.upload,{method:"PUT",json:!1,withCredentials:!1,body:e.file,headers:{"x-trans-id":kn().v4(),authorization:void 0}}),wr()(e.phases.finalize,{method:"POST"},i()(e,"file","phases")),n=new Be.EventEmitter,o=t._uploadPhaseInitialize(e).then((function(){var r=t._uploadPhaseUpload(e);return ye("progress",r,n),r})).then((function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return t._uploadPhaseFinalize.apply(t,[e].concat(n))})).then((function(e){return Ii(Ii({},e.body),e.headers)})),ge(n,o),r.abrupt("return",o);case 13:case"end":return r.stop()}}),r)})))()},_uploadPhaseInitialize:function(e){var t=this;return this.logger.debug("client: initiating upload session"),this.request(e.phases.initialize).then((function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];var o=1024*(n[0].body.fileUploadSizeLimit||2048)*1024,a=e.file.byteLength;return o&&o<a?t._uploadAbortSession.apply(t,[a].concat(n)):t._uploadApplySession.apply(t,[e].concat(n))})).then((function(e){return t.logger.debug("client: initiated upload session"),e}))},_uploadAbortSession:function(e,t){var r=this;return this.logger.debug("client: deleting uploaded file"),this.request({method:"DELETE",url:t.body.url,headers:t.options.headers}).then((function(){r.logger.debug("client: deleting uploaded file complete");var n={currentFileSizeInBytes:e,fileUploadSizeLimitInMB:t.body.fileUploadSizeLimit||2048,message:"file-upload-size-limit-enabled"};return p().reject(new Error("".concat(Cr()(n))))}))},_uploadApplySession:function(e,t){var r=t.body;["upload","finalize"].reduce((function(e,t){return e[t]=l()(e[t]).reduce((function(e,t){return t.startsWith("$")&&(e[t.substr(1)]=e[t](r),xr()(e,t)),e}),e[t]),e}),e.phases)},_uploadPhaseUpload:function(e){var t=this;this.logger.debug("client: uploading file");var r=this.request(e.phases.upload).then((function(e){return t.logger.debug("client: uploaded file"),e}));return ge(e.phases.upload.upload,r),r},_uploadPhaseFinalize:function(e){var t=this;return this.logger.debug("client: finalizing upload session"),this.request(e.phases.finalize).then((function(e){return t.logger.debug("client: finalized upload session"),e}))}},Zt(Ti,"_uploadPhaseUpload",[function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n,i=t[0]||{};return i=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ge(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):Ge(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}({},i),je()(i,{backoff:!0,delay:1,maxAttempts:3}),n=i.backoff?{initialDelay:i.delay,maxDelay:i.maxDelay}:{initialDelay:1,maxDelay:1},3===t.length?f()(o,null,t):o;function o(e,t,r){return r.value=L()(r.value,(function(e){for(var t=this,r=arguments.length,o=new Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];var s=new Be.EventEmitter,c=new(p())((function(r,a){var c=Ve.call((function(r){var n=f()(e,t,o);return Fe()(n.on)&&(n.on("progress",s.emit.bind(s,"progress")),n.on("upload-progress",s.emit.bind(s,"upload-progress")),n.on("download-progress",s.emit.bind(s,"download-progress"))),n.then((function(e){r(null,e)})).catch((function(e){e||(e=new Error("retryable method failed without providing an error object")),r(e)}))}),(function(e,t){return e?a(e):r(t)}));c.setStrategy(new Ve.ExponentialStrategy(n)),i.maxAttempts&&c.failAfter(i.maxAttempts-1),c.start()}));return c.on=function(e,t){return s.on(e,t),c},c})),"object"!==_(e)||e.prototype||(e[t]=r.value),r}}],Ie()(Ti,"_uploadPhaseUpload"),Ti),Ti));Mi.version="3.8.1-next.55",function(e,t,n){e.registerPlugin=function(i,o){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e.prototype._children[i]||a.replace){if(e.prototype._children[i]=o,a.proxies)throw new Error("Proxies are not currently supported for private plugins");if(a.interceptors&&l()(a.interceptors).forEach((function(e){n[e]=a.interceptors[e]})),a.config&&r()(t,a.config),Hn()(a,"payloadTransformer.predicates")&&(t.payloadTransformer.predicates=t.payloadTransformer.predicates.concat(Sr()(a,"payloadTransformer.predicates"))),Hn()(a,"payloadTransformer.transforms")&&(t.payloadTransformer.transforms=t.payloadTransformer.transforms.concat(Sr()(a,"payloadTransformer.transforms"))),a.onBeforeLogout)t.onBeforeLogout=t.onBeforeLogout||[],(me()(a.onBeforeLogout)?a.onBeforeLogout:[a.onBeforeLogout]).forEach((function(e){return t.onBeforeLogout.push({plugin:i,fn:e})}));if(o.prototype._definition&&o.prototype._definition.ready){var s=e.prototype._derived.ready,c=s.fn,u={deps:s.depList.concat("".concat(i,".ready")),fn:c};!function(e,t,r){var n=e._derived[t]={fn:Fe()(r)?r:r.fn,cache:!1!==r.cache,depList:r.deps||[]};n.depList.forEach((function(r){e._deps[r]=wi()(e._deps[r]||[],[t])})),Mr()(e,t,{get:function(){return this._getDerivedProperty(t)},set:function(){throw new TypeError("`".concat(t,"` is a derived property, it can't be set directly."))}})}(e.prototype,"ready",u)}}}}(Ci,Si,Ai),function(e,t,n){e.registerPlugin=function(i,o){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e.prototype._children[i]||a.replace){if(e.prototype._children[i]=o,a.proxies&&a.proxies.forEach((function(t){Ri(e.prototype,t,{deps:["".concat(i,".").concat(t)],fn:function(){return this[i][t]}})})),a.interceptors&&l()(a.interceptors).forEach((function(e){n[e]=a.interceptors[e]})),a.config&&r()(t,a.config),Hn()(a,"payloadTransformer.predicates")&&(t.payloadTransformer.predicates=t.payloadTransformer.predicates.concat(Sr()(a,"payloadTransformer.predicates"))),Hn()(a,"payloadTransformer.transforms")&&(t.payloadTransformer.transforms=t.payloadTransformer.transforms.concat(Sr()(a,"payloadTransformer.transforms"))),a.onBeforeLogout)t.onBeforeLogout=t.onBeforeLogout||[],(me()(a.onBeforeLogout)?a.onBeforeLogout:[a.onBeforeLogout]).forEach((function(e){return t.onBeforeLogout.push({plugin:i,fn:e})}));if(o.prototype._definition&&o.prototype._definition.ready){var s=e.prototype._derived.ready,c=s.fn,u={deps:s.depList.concat("".concat(i,".ready")),fn:c};Ri(e.prototype,"ready",u)}}}}(Mi,Si,Ai);const Ni=Mi;function Pi(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Mi.registerPlugin(e,t,r)}function Di(e,t,r){Ci.registerPlugin(e,t,r)}var Fi={error:["log"],warn:["error","log"],info:["log"],debug:["info","log"],trace:["debug","info","log"]};function Ui(e){var t=Fi[e];if(t)for(t=t.slice();!console[e];)e=t.pop();return function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console)[e].apply(t,n)}}var ji=dr.extend({namespace:"Logger",error:Ui("error"),warn:Ui("warn"),log:Ui("log"),info:Ui("info"),debug:Ui("debug"),trace:Ui("trace"),version:"0.0.0-next"});Pi("logger",ji);var Bi=__webpack_require__(41609),qi=__webpack_require__.n(Bi),Vi=__webpack_require__(87735),Gi=__webpack_require__(8575),Wi=__webpack_require__(49704),zi=__webpack_require__.n(Wi);function Hi(){var e=setTimeout.apply(void 0,arguments);return e.unref&&e.unref(),e}function Ki(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var $i=function(e){Je(r,e);var t=Ki(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"parse",value:function(e){var t=e.body||e;return Me()(this,{error:{enumerable:!0,value:t.error},errorDescription:{enumerable:!0,value:t.error_description},errorUri:{enumerable:!0,value:t.error_uri},res:{enumerable:!1,value:e}}),this.errorDescription}}]),r}(nt),Ji=function(e){Je(r,e);var t=Ki(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}($i),Yi=function(e){Je(r,e);var t=Ki(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}($i),Qi=function(e){Je(r,e);var t=Ki(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}($i),Xi=function(e){Je(r,e);var t=Ki(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}($i),Zi=function(e){Je(r,e);var t=Ki(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}($i),eo=function(e){Je(r,e);var t=Ki(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}($i),to={OAuthError:$i,InvalidRequestError:Ji,InvalidClientError:Yi,InvalidGrantError:Qi,UnauthorizedClientError:Xi,UnsupportGrantTypeError:Zi,InvalidScopeError:eo,invalid_request:Ji,invalid_client:Yi,invalid_grant:Qi,unauthorized_client:Xi,unsupported_grant_type:Zi,invalid_scope:eo,select:function(e){return to[e]||$i}};const ro=to;var no,io=__webpack_require__(91966),oo=__webpack_require__.n(io),ao=" ";function so(e){return e?e.split(ao).sort().join(ao):""}function co(e,t){if(!t)return"";var r=en()(e)?e:[e];return t.split(ao).filter((function(e){return!r.includes(e)})).sort().join(ao)}function uo(e,t){var r,n,i=null!==(r=null==e?void 0:e.split(ao))&&void 0!==r?r:[],o=null!==(n=null==t?void 0:t.split(ao))&&void 0!==n?n:[];return oo()(i,o).sort().join(ao)}function lo(e,t){return function(e){if(T(e))return e}(e)||function(e,t){var r=null==e?null:void 0!==E&&e[S]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(e,t)||I(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fo(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function ho(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fo(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):fo(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}function po(e){if(400!==e.statusCode)return p().reject(e);var t=ro.select(e.body.error);return t===$i&&e instanceof ei?p().reject(e):t?p().reject(new t(e._res||e)):p().reject(e)}var vo=dr.extend((Zt(no={derived:{canAuthorize:{deps:["access_token","isExpired"],fn:function(){return!!this.access_token&&!this.isExpired}},canDownscope:{deps:["canAuthorize"],fn:function(){return this.canAuthorize&&!!this.config.client_id}},canRefresh:{deps:["refresh_token"],fn:function(){return!!this.refresh_token&&!!this.config.refreshCallback}},isExpired:{deps:["expires","_isExpired"],fn:function(){return!!this.expires&&this._isExpired}},_string:{deps:["access_token","token_type"],fn:function(){return this.access_token&&this.token_type?"".concat(this.token_type," ").concat(this.access_token):""}}},namespace:"Credentials",props:{scope:"string",access_token:"string",expires:"number",expires_in:"number",refresh_token:"string",refresh_token_expires:"number",refresh_token_expires_in:"number",token_type:{default:"Bearer",type:"string"}},session:{_isExpired:{default:!1,type:"boolean"},previousToken:{type:"state"}},downscope:function(e){var t=this;return this.logger.info("token: downscoping token to ".concat(e)),this.isExpired?(this.logger.info("token: request received to downscope expired access_token"),p().reject(new Error("cannot downscope expired access token"))):this.canDownscope?""!==uo(e,this.config.scope)?p().reject(new Error("new scope (".concat(e,") is not subset of the available scopes (").concat(this.config.scope,")"))):(e&&(e=so(e)),e===so(this.config.scope)?p().reject(new Error("token: scope reduction requires a reduced scope")):this.webex.request({method:"POST",uri:this.config.tokenUrl,addAuthHeader:!1,form:{grant_type:"urn:cisco:oauth:grant-type:scope-reduction",token:this.access_token,scope:e,client_id:this.config.client_id,self_contained_token:!0}}).then((function(r){return t.logger.info("token: downscoped token to ".concat(e)),new vo(tr()(r.body,{scope:e}),{parent:t.parent})}))):(this.config.client_id?this.logger.info("token: request received to downscope invalid access_token"):this.logger.trace("token: cannot downscope without client_id"),p().reject(new Error("cannot downscope access token")))},initialize:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(f()(dr.prototype.initialize,this,[t,r]),"string"==typeof t&&(this.access_token=t),!this.access_token)throw new Error("`access_token` is required");this.expires&&(this.expires<Ln()()?this._isExpired=!0:Hi((function(){e._isExpired=!0}),this.expires-Ln()()))},refresh:function(){var e=this;if(!this.canRefresh)throw new Error("Not enough information available to refresh this access token");if(!this.config.refreshCallback)throw new Error("Cannot refresh access token without refreshCallback");return(p().resolve(this.config.refreshCallback(this.webex,this))||this.webex.request({method:"POST",uri:this.config.tokenUrl,form:{grant_type:"refresh_token",redirect_uri:this.config.redirect_uri,refresh_token:this.refresh_token},auth:{user:this.config.client_id,pass:this.config.client_secret,sendImmediately:!0},shouldRefreshAccessToken:!1}).then((function(e){return e.body}))).then((function(t){if(!t)throw new Error("token: refreshCallback() did not produce an object");return t.refresh_token||tr()(t,Pr()(e,"refresh_token","refresh_token_expires","refresh_token_expires_in")),e.access_token===t.access_token?(e.logger.error("token: new token matches current token"),p().reject(new Error("new token matches current token"))):(e.previousToken&&(e.previousToken.revoke(),e.unset("previousToken")),t.previousToken=e,t.scope=e.scope,new vo(t,{parent:e.parent}))})).catch(po)},revoke:function(){var e=this;return this.isExpired?(this.logger.info("token: already expired, not making making revocation request"),p().resolve()):this.canAuthorize?this.config.client_secret?(this.logger.info("token: revoking access token"),this.webex.request({method:"POST",uri:this.config.revokeUrl,form:{token:this.access_token,token_type_hint:"access_token"},auth:{user:this.config.client_id,pass:this.config.client_secret,sendImmediately:!0},shouldRefreshAccessToken:!1}).then((function(){e.unset(["access_token","expires","expires_in","token_type"]),e.logger.info("token: access token revoked")})).catch(po)):(this.logger.info("token: no client secret available, not making revocation request"),p().resolve()):(this.logger.info("token: no longer valid, not making revocation request"),p().resolve())},set:function(){var e=lo(this._filterSetParameters.apply(this,arguments),2),t=e[0],r=e[1];if(!t.token_type&&t.access_token&&t.access_token.includes(" ")){var n=lo(t.access_token.split(" "),2),i=n[0],o=n[1];t=ho(ho({},t),{},{access_token:o,token_type:i})}var a=Ln()();return!t.expires&&t.expires_in&&(t.expires=a+1e3*t.expires_in),!t.refresh_token_expires&&t.refresh_token_expires_in&&(t.refresh_token_expires=a+1e3*t.refresh_token_expires_in),t.scope&&(t.scope=so(t.scope)),f()(dr.prototype.set,this,[t,r])},toString:function(){if(!this._string)throw new Error("cannot stringify Token");return this._string},validate:function(){throw new Error("Token#validate() must not be used in production")},version:"0.0.0-next"},"downscope",[he({keyFactory:function(e){return e}})],Ie()(no,"downscope"),no),Zt(no,"refresh",[he],Ie()(no,"refresh"),no),Zt(no,"revoke",[he],Ie()(no,"revoke"),no),no));const mo=vo;var go=__webpack_require__(90765),yo=__webpack_require__.n(go);const bo=yo().extend({mainIndex:"scope",model:mo,namespace:"Credentials"});var Eo,So,_o,wo,Ro,Co,To,xo="JS_SDK_CREDENTIALS_DOWNSCOPE_FAILED",ko="JS_SDK_CREDENTIALS_TOKEN_REFRESH_SCOPE_MISMATCH",Io=["discovery","limited","signin","postauth","custom"],Ao="SERVICE_CATALOGS_ENUM_TYPES_STRING",Oo="SERVICE_CATALOGS_ENUM_TYPES_NUMBER",Lo=["wbx2.com","ciscospark.com","webex.com","webexapis.com","broadcloudpbx.com","broadcloud.eu","broadcloud.com.au","broadcloudpbx.net"];function Mo(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function No(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Mo(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):Mo(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}var Po=dr.extend((Eo=he({keyFactory:function(e){return e}}),So=$t("@"),_o=zt("@"),wo=$t("@"),Ro=ze("isRefreshing"),Co=$t("@"),To={collections:{userTokens:bo},dataTypes:{token:X(mo,"token").dataType},derived:{canAuthorize:{deps:["supertoken","supertoken.canAuthorize","canRefresh"],fn:function(){return Boolean(this.supertoken&&this.supertoken.canAuthorize||this.canRefresh)}},canRefresh:{deps:["supertoken","supertoken.canRefresh"],fn:function(){return!!this.config.jwtRefreshCallback||Boolean(this.supertoken&&this.supertoken.canRefresh)}},isUnverifiedGuest:{deps:["supertoken"],fn:function(){var e=!1;try{e="guest"===JSON.parse(Y.decode(this.supertoken.access_token.split(".")[1])).user_type}catch(e){}return e}}},props:{supertoken:X(mo,"token").prop},namespace:"Credentials",session:{isRefreshing:{default:!1,type:"boolean"},ready:{default:!1,type:"boolean"},refreshTimer:{default:void 0,type:"any"}},buildLoginUrl:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clientType:"public"};if(e.state&&!a()(e.state))throw new Error("if specified, `options.state` must be an object");return e.client_id=this.config.client_id,e.redirect_uri=this.config.redirect_uri,e.scope=this.config.scope,(e=c()(e)).response_type||(e.response_type="public"===e.clientType?"token":"code"),xr()(e,"clientType"),e.state&&(qi()(e.state)?delete e.state:e.state=Y.toBase64Url(Cr()(e.state))),"".concat(this.config.authorizeUrl,"?").concat(Vi.stringify(e))},getOrgId:function(){this.logger.info("credentials: attempting to retrieve the OrgId from token");try{return this.logger.info("credentials: trying to extract OrgId from JWT"),this.extractOrgIdFromJWT(this.supertoken.access_token)}catch(t){this.logger.info("credentials: could not extract OrgId from JWT"),this.logger.info("credentials: attempting to extract OrgId from user token");try{var e;return this.extractOrgIdFromUserToken(null===(e=this.supertoken)||void 0===e?void 0:e.access_token)}catch(e){throw this.logger.info("credentials: could not extract OrgId from user token"),e}}},extractOrgIdFromJWT:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=zi().decode(e);if(!t)throw new Error("unable to extract the OrgId from the provided JWT");if(!t.realm)throw new Error("the provided JWT does not contain an OrgId");return t.realm},extractOrgIdFromUserToken:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split("_");if(3!==e.length)throw new Error("the provided token is not a valid format, token has ".concat(e.length," sections"));return e[2]},buildLogoutUrl:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"".concat(this.config.logoutUrl,"?").concat(Vi.stringify(No({cisService:this.config.service,goto:this.config.redirect_uri},e)))},calcRefreshTimeout:function(e){return Math.floor((Math.floor(4*Math.random())+6)/10*e)},constructor:function(){var e=this;this._dataTypes=c()(this._dataTypes),l()(this._dataTypes).forEach((function(t){e._dataTypes[t].set&&(e._dataTypes[t].set=e._dataTypes[t].set.bind(e))}));for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];f()(dr,this,r)},downscope:function(e){var t=this;return this.supertoken.downscope(e).catch((function(r){var n,i=null!==(n=null==r?void 0:r.body)&&void 0!==n?n:r;return t.logger.warn('credentials: failed to downscope supertoken to "'.concat(e,'"'),i),t.logger.trace("credentials: falling back to supertoken for ".concat(e)),t.webex.internal.metrics.submitClientMetrics(xo,{fields:{requestedScope:e,failReason:i}}),p().resolve(new mo(No({scope:e},t.supertoken.serialize())),{parent:t})}))},getClientToken:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.logger.info("credentials: requesting client credentials grant"),this.webex.request({method:"POST",uri:t.uri||this.config.tokenUrl,form:{grant_type:"client_credentials",scope:t.scope||"webexsquare:admin",self_contained_token:!0},auth:{user:this.config.client_id,pass:this.config.client_secret,sendImmediately:!0},shouldRefreshAccessToken:!1}).then((function(t){return new mo(t.body,{parent:e})})).catch((function(e){if(400!==e.statusCode)return p().reject(e);var t=ro.select(e.body.error);return p().reject(new t(e._res||e))}))},getUserToken:function(e){var t=this;return p().resolve(!this.isRefreshing||new(p())((function(e){t.logger.info("credentials: token refresh inflight; delaying getUserToken until refresh completes"),t.once("change:isRefreshing",(function(){t.logger.info("credentials: token refresh complete; reinvoking getUserToken"),e()}))}))).then((function(){if(!t.canAuthorize)return t.logger.info("credentials: cannot produce an access token from current state"),p().reject(new Error("Current state cannot produce an access token"));if(e||(e=co("spark:kms",t.supertoken.scope)),(e=so(e))===so(t.supertoken.scope))return p().resolve(t.supertoken);var r=t.userTokens.get(e);return r&&r.access_token?p().resolve(r):t.downscope(e).then(We((function(e){return t.userTokens.add(e)})))}))},initialize:function(e,t){var r=this;e&&("string"==typeof e&&(this.supertoken=e),e.access_token&&(this.supertoken=e),e.authorization&&(e.authorization.supertoken?this.supertoken=e.authorization.supertoken:this.supertoken=e.authorization),this.supertoken&&this.supertoken.expires&&this.scheduleRefresh(this.supertoken.expires)),f()(dr.prototype.initialize,this,[e,t]),this.listenToOnce(this.parent,"change:config",(function(){if(r.config.authorizationString){var e=Gi.parse(r.config.authorizationString,!0);r.config.client_id=e.query.client_id,r.config.redirect_uri=e.query.redirect_uri,r.config.scope=e.query.scope,r.config.authorizeUrl=e.href.substr(0,e.href.indexOf("?"))}})),this.webex.once("loaded",(function(){r.ready=!0}))},invalidate:function(){this.logger.info("credentials: invalidating tokens"),this.refreshTimer&&(clearTimeout(this.refreshTimer),this.unset("refreshTimer"));try{this.unset("supertoken")}catch(e){this.logger.warn("credentials: failed to clear supertoken",e)}for(;this.userTokens.models.length;)try{this.userTokens.remove(this.userTokens.models[0])}catch(e){this.logger.warn("credentials: failed to remove user token",e)}return this.logger.info("credentials: finished removing tokens"),p().resolve()},refresh:function(){var e=this;this.logger.info("credentials: refresh requested");var t=this.supertoken,r=Un()(this.userTokens.models);return this.config.jwtRefreshCallback?this.config.jwtRefreshCallback(this.webex).then((function(t){return e.webex.authorization.requestAccessTokenFromJwt({jwt:t})})):(this.webex.internal.services&&this.webex.internal.services.updateCredentialsConfig(),t.refresh().catch((function(t){if(t instanceof $i){for(e.unset("supertoken");e.userTokens.models.length;)try{e.userTokens.remove(e.userTokens.models[0])}catch(t){e.logger.warn("credentials: failed to remove user token",t)}e.webex.trigger("client:InvalidRequestError")}return p().reject(t)})).then((function(t){e.refreshTimer&&(clearTimeout(e.refreshTimer),e.unset("refreshTimer")),e.supertoken=t;var n=uo(e.config.scope,t.scope);return""!==n&&(e.logger.warn('credentials: "'.concat(n,'" scope(s) are invalid because not listed in the supertoken, they will be excluded from user token requests.')),e.webex.internal.metrics.submitClientMetrics(ko,{fields:{invalidScopes:n}})),p().all(r.map((function(r){var n=co(uo(r.scope,t.scope),r.scope);return e.downscope(n).then((function(t){return e.logger.info("credentials: revoking token for ".concat(r.scope)),r.revoke().catch((function(t){e.logger.warn("credentials: failed to revoke user token",t)})).then((function(){e.userTokens.remove(r.scope),e.userTokens.add(t)}))}))})))})).then((function(){e.scheduleRefresh(e.supertoken.expires)})))},scheduleRefresh:function(e){var t=this,r=e-Ln()();if(r>0){var n=this.calcRefreshTimeout(r);this.refreshTimer=Hi((function(){return t.refresh()}),n)}else this.refresh()},version:"0.0.0-next"},Zt(To,"getUserToken",[Eo,So],Ie()(To,"getUserToken"),To),Zt(To,"initialize",[_o],Ie()(To,"initialize"),To),Zt(To,"invalidate",[he,wo],Ie()(To,"invalidate"),To),Zt(To,"refresh",[he,Ro,Co],Ie()(To,"refresh"),To),To));Pi("credentials",Po,{proxies:["canAuthorize","canRefresh"]});var Do=__webpack_require__(84486),Fo=__webpack_require__.n(Do),Uo=__webpack_require__(52153),jo=__webpack_require__.n(Uo);const Bo="JS_SDK_SERVICE_NOT_FOUND";const qo=y().extend({namespace:"ServiceUrl",props:{defaultUrl:["string",!0,void 0],hosts:["array",!1,function(){return[]}],name:["string",!0,void 0]},_generateHostUrl:function(e){var t=Gi.parse(this.defaultUrl);return t.host="".concat(e).concat(t.port?":".concat(t.port):""),Gi.format(t)},_getHostUrls:function(){var e=this;return this.hosts.map((function(t){return{url:e._generateHostUrl(t.host),priority:t.priority}}))},_getPriorityHostUrl:function(e){if(0===this.hosts.length)return this.defaultUrl;var t=e?this.hosts.filter((function(t){return t.id===e})):this.hosts.filter((function(e){return e.homeCluster})),r=t.filter((function(e){return!e.failed}));return t=0===r.length?t.map((function(e){return e.failed=!1,e})):r,this._generateHostUrl(t.reduce((function(e,t){return e.priority>t.priority||!e.homeCluster?t:e}),{}).host)},failHost:function(e){if(e===this.defaultUrl)return!0;var t=Gi.parse(e).hostname,r=this.hosts.find((function(e){return e.host===t}));return r&&(r.failed=!0),void 0!==r},get:function(e,t){return e?this._getPriorityHostUrl(t):this.defaultUrl}});function Vo(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function Go(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Vo(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):Vo(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}function Wo(e,t){var r=void 0!==Yr()&&e[Xr()]||e["@@iterator"];if(!r){if(en()(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return zo(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return $r()(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zo(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function zo(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Ho=y().extend({namespace:"ServiceCatalog",props:{serviceGroups:["object",!0,function(){return{discovery:[],override:[],preauth:[],postauth:[],signin:[]}}],status:["object",!0,function(){return{discovery:{ready:!1,collecting:!1},override:{ready:!1,collecting:!1},preauth:{ready:!1,collecting:!1},postauth:{ready:!1,collecting:!1},signin:{ready:!1,collecting:!1}}}],isReady:["boolean",!1,!1],allowedDomains:["array",!1,function(){return[]}]},_getUrl:function(e,t){return("string"==typeof t?this.serviceGroups[t]||[]:[].concat(A(this.serviceGroups.override),A(this.serviceGroups.postauth),A(this.serviceGroups.signin),A(this.serviceGroups.preauth),A(this.serviceGroups.discovery))).find((function(t){return t.name===e}))},_listServiceUrls:function(){return[].concat(A(this.serviceGroups.override),A(this.serviceGroups.postauth),A(this.serviceGroups.signin),A(this.serviceGroups.preauth),A(this.serviceGroups.discovery))},_loadServiceUrls:function(e,t){var r=this;return t.forEach((function(t){r._getUrl(t.name,e)||r.serviceGroups[e].push(t)})),this},_unloadServiceUrls:function(e,t){var r,n=this;return t.forEach((function(t){(r=n._getUrl(t.name,e))&&n.serviceGroups[e].splice(n.serviceGroups[e].indexOf(r),1)})),this},clean:function(){this.serviceGroups.preauth.length=0,this.serviceGroups.signin.length=0,this.serviceGroups.postauth.length=0,this.status.preauth={ready:!1},this.status.signin={ready:!1},this.status.postauth={ready:!1}},findClusterId:function(e){for(var t,r=Gi.parse(e),n=0,i=l()(this.serviceGroups);n<i.length;n++){var o,a=i[n],s=Wo(this.serviceGroups[a]);try{for(s.s();!(o=s.n()).done;){var c=o.value;t=Gi.parse(c.defaultUrl);var u,d=Wo(c.hosts);try{for(d.s();!(u=d.n()).done;){var f=u.value;if(r.hostname===f.host&&f.id)return f.id}}catch(e){d.e(e)}finally{d.f()}if(t.hostname===r.hostname&&c.hosts.length>0){var h,p=Wo(c.hosts);try{for(p.s();!(h=p.n()).done;){var v=h.value;if(v.homeCluster)return v.id}}catch(e){p.e(e)}finally{p.f()}return c.hosts[0].id}}}catch(e){s.e(e)}finally{s.f()}}},findServiceFromClusterId:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.clusterId,r=e.priorityHost,n=void 0===r||r,i=e.serviceGroup,o=("string"==typeof i?this.serviceGroups[i]||[]:[].concat(A(this.serviceGroups.override),A(this.serviceGroups.postauth),A(this.serviceGroups.signin),A(this.serviceGroups.preauth),A(this.serviceGroups.discovery))).find((function(e){return e.hosts.find((function(e){return e.id===t}))}));if(o)return{name:o.name,url:o.get(n,t)}},findServiceUrlFromUrl:function(e){return[].concat(A(this.serviceGroups.discovery),A(this.serviceGroups.preauth),A(this.serviceGroups.signin),A(this.serviceGroups.postauth),A(this.serviceGroups.override)).find((function(t){if(e.startsWith(t.defaultUrl))return!0;var r,n=Wo(t.hosts);try{for(n.s();!(r=n.n()).done;){var i=r.value,o=new URL(t.defaultUrl);if(o.host=i.host,e.startsWith(o.toString()))return!0}}catch(e){n.e(e)}finally{n.f()}return!1}))},findAllowedDomain:function(e){var t=Gi.parse(e);if(t.host)return this.allowedDomains.find((function(e){return t.host.includes(e)}))},get:function(e,t,r){var n=this._getUrl(e,r);return n?n.get(t):void 0},getAllowedDomains:function(){return A(this.allowedDomains)},list:function(e,t){var r={},n="string"==typeof t?this.serviceGroups[t]||[]:[].concat(A(this.serviceGroups.discovery),A(this.serviceGroups.preauth),A(this.serviceGroups.signin),A(this.serviceGroups.postauth),A(this.serviceGroups.override));return n&&n.forEach((function(t){r[t.name]=t.get(e)})),r},markFailedUrl:function(e,t){var r=this,n=this._getUrl(l()(this.list()).find((function(t){return r._getUrl(t).failHost(e)})));if(n)return t?n.get(!1):n.get(!0)},setAllowedDomains:function(e){this.allowedDomains=A(e)},addAllowedDomains:function(e){this.allowedDomains=wi()(this.allowedDomains,e)},updateServiceUrls:function(e,t){var r=this,n=this.serviceGroups[e].filter((function(e){return t.every((function(t){return t.name!==e.name}))}));return this._unloadServiceUrls(e,n),t.forEach((function(t){var n=r._getUrl(t.name,e);n?(n.defaultUrl=t.defaultUrl,n.hosts=t.hosts||[]):r._loadServiceUrls(e,[new qo(Go({},t))])})),this.status[e].ready=!0,this.trigger(e),this},waitForCatalog:function(e,t){var r=this;return new(p())((function(n,i){r.status[e].ready&&n();var o=setTimeout((function(){return i(new Error("services: timeout occured while waiting for '".concat(e,"' catalog to populate")))}),1e3*("number"==typeof t&&t>=0?t:60));r.once(e,(function(){clearTimeout(o),n()}))}))}});const Ko=Ho;var $o=function(){function e(t){ne(this,e),e.validate(t),this.catalog=t.catalog,this.default=t.defaultUri,this.hostGroup=t.hostGroup,this.id=t.id,this.priority=t.priority,this.uri=t.uri,this.failed=!1,this.replaced=!1}return oe(e,[{key:"active",get:function(){return!this.failed&&!this.replaced}},{key:"local",get:function(){return this.default.includes(this.hostGroup)}},{key:"service",get:function(){return this.id.split(":")[3]}},{key:"url",get:function(){var e=Gi.parse(this.default);return e.host="".concat(this.uri).concat(e.port?":".concat(e.port):""),Gi.format(e)}},{key:"setStatus",value:function(e){var t=e.failed,r=e.replaced;return void 0!==t&&(this.failed=t),void 0!==r&&(this.replaced=r),this}}],[{key:"polyGenerate",value:function(t){var r=t.catalog,n=t.name,i=t.url;return new e({catalog:r,defaultUri:i,hostGroup:Gi.parse(i).host,id:n?"poly-head:poly-group:poly-cluster:".concat(n):void 0,priority:1,uri:Gi.parse(i).host})}},{key:"validate",value:function(e){var t=e.catalog,r=e.defaultUri,n=e.hostGroup,i=e.id,o=e.priority,a=e.uri,s=function(e){throw new Error("service-host: invalid constructor parameters, ".concat(e))};Io.includes(t)||s("'catalog' must be a string"),"string"!=typeof r&&s("'defaultUri' must be a string"),"string"!=typeof n&&s("'hostGroup' must be a string"),"string"==typeof i&&4===i.split(":").length||s("'id' must be a string that contains 3 ':' characters"),"number"!=typeof o&&s("'priority' must be a number"),"string"!=typeof a&&s("'uri' must be a string")}}]),e}();function Jo(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function Yo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Jo(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):Jo(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}var Qo=function(){function e(){ne(this,e),this.hosts=[]}return oe(e,[{key:"map",get:function(){return this.find({active:!0,local:!0,priority:!0}).reduce((function(e,t){var r={};return r[t.service]=t.url,Yo(Yo({},e),r)}),{})}},{key:"clear",value:function(e){var t=this.find(e);return this.hosts=this.hosts.filter((function(e){return!t.includes(e)})),t}},{key:"failed",value:function(e){var t=this.find(e);return t.forEach((function(e){e.setStatus({failed:!0})})),t}},{key:"filterActive",value:function(e){return"boolean"==typeof e?this.hosts.filter((function(t){return t.active===e})):A(this.hosts)}},{key:"filterCatalog",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=(en()(t)?t:[t]).map((function(t){return e.mapCatalogName({id:t,type:Ao})||t}));return r.length>0?this.hosts.filter((function(e){return r.includes(e.catalog)})):A(this.hosts)}},{key:"filterCluster",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=en()(e)?e:[e];return t.length>0?this.hosts.filter((function(e){return t.includes(e.id)})):A(this.hosts)}},{key:"filterLocal",value:function(e){return"boolean"==typeof e?this.hosts.filter((function(t){return t.local===e})):A(this.hosts)}},{key:"filterPriority",value:function(t){return t?this.hosts.reduce((function(t,r){if(!r.active)return t;var n=t.find((function(e){return e.hostGroup===r.hostGroup}));return n?((e.mapCatalogName({id:n.catalog,type:Oo})<e.mapCatalogName({id:r.catalog,type:Oo})||n.priority<r.priority)&&(t.splice(t.indexOf(n,1)),t.push(r)),t):(t.push(r),t)}),[]):A(this.hosts)}},{key:"filterService",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=en()(e)?e:[e];return t.length>0?this.hosts.filter((function(e){return t.includes(e.service)})):A(this.hosts)}},{key:"filterUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=en()(e)?e:[e];return t.length>0?this.hosts.filter((function(e){return t.includes(e.url)})):A(this.hosts)}},{key:"find",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.active,n=t.catalog,i=t.cluster,o=t.local,a=t.priority,s=t.service,c=t.url;return this.hosts.filter((function(t){return e.filterActive(r).includes(t)&&e.filterCatalog(n).includes(t)&&e.filterCluster(i).includes(t)&&e.filterLocal(o).includes(t)&&e.filterPriority(a).includes(t)&&e.filterService(s).includes(t)&&e.filterUrl(c).includes(t)}))}},{key:"load",value:function(){var t,r=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter((function(t){return!!e.mapCatalogName({id:t.catalog,type:Ao})}));return(t=this.hosts).push.apply(t,A(r.map((function(e){return new $o(e)})))),this}},{key:"replaced",value:function(e){var t=this.find(e);return t.forEach((function(e){e.setStatus({replaced:!0})})),t}},{key:"reset",value:function(e){var t=this.find(e);return t.forEach((function(e){e.setStatus({failed:!1})})),t}}],[{key:"mapCatalogName",value:function(e){var t=e.id,r=e.type;if("number"==typeof t){if(r===Oo)return void 0!==Io[t]?t:void 0;if(r===Ao)return Io[t]}if("string"==typeof t){if(r===Ao)return Io.includes(t)?t:void 0;if(r===Oo)return Io.includes(t)?Io.indexOf(t):void 0}}},{key:"mapRemoteCatalog",value:function(t){var r=t.catalog,n=t.hostCatalog,i=t.serviceLinks,o=e.mapCatalogName({id:r,type:Ao});if(!Io.includes(o))throw new Error("service-catalogs: '".concat(r,"' is not a valid catalog"));return l()(n).reduce((function(e,t){return e.push.apply(e,A(n[t].map((function(e){return{catalog:o,defaultUri:i[e.id.split(":")[3]],hostGroup:t,id:e.id,priority:e.priority,uri:e.host}})))),e}),[])}}]),e}(),Xo=function(){function e(){var t=this;ne(this,e),Io.forEach((function(r){t[r]=e.generateCatalogState()}))}return oe(e,[{key:"setCollecting",value:function(e,t){this[e]&&(this[e].collecting=t)}},{key:"setReady",value:function(e,t){this[e]&&(this[e].ready=t)}}],[{key:"generateCatalogState",value:function(){return{collecting:!1,ready:!1}}}]),e}();const Zo={hydra:"https://api-usgov.webex.com/v1",u2c:"https://u2c.gov.ciscospark.com/u2c/api/v1",sqdiscovery:"https://ds.ciscospark.com/v1/region"};function ea(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function ta(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ea(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):ea(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}var ra=/(?:^\/)|(?:\/$)/,na={ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.WEBEX_CONVERSATION_CLUSTER_SERVICE||"identityLookup",ia={ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.WEBEX_CONVERSATION_DEFAULT_CLUSTER||"".concat("urn:TEAM:us-east-2_a",":").concat(na),oa=dr.extend({namespace:"Services",registries:new(se()),states:new(se()),props:{validateDomains:["boolean",!1,!0],initFailed:["boolean",!1,!1]},_catalogs:new(se()),_serviceUrls:null,_hostCatalog:null,getRegistry:function(){return this.registries.get(this.webex)},getState:function(){return this.states.get(this.webex)},_getCatalog:function(){return this._catalogs.get(this.webex)},get:function(e,t,r){return this._getCatalog().get(e,t,r)},hasService:function(e){return!!this.get(e)},hasAllowedDomains:function(){return this._getCatalog().getAllowedDomains().length>0},list:function(e,t){return this._getCatalog().list(e,t)},markFailedUrl:function(e,t){return this._getCatalog().markFailedUrl(e,t)},_updateServiceUrls:function(e){this._serviceUrls=ta(ta({},this._serviceUrls),e)},_updateHostCatalog:function(e){this._hostCatalog=ta(ta({},this._hostCatalog),e)},updateServices:function(){var e,t,r=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.from,o=n.query,a=n.token,s=n.forceRefresh,c=this._getCatalog();switch(i){case"limited":t="preauth";break;case"signin":t="signin";break;default:t="postauth"}if(c.status[t].collecting)return this.waitForCatalog(t);if(c.status[t].collecting=!0,"preauth"===t){var u=o&&l()(o)[0];if(!["email","emailhash","userId","orgId","mode"].includes(u))return p().reject(new Error("a query param of email, emailhash, userId, orgId, or mode is required"))}if("preauth"===t||"signin"===t){var d=l()(o)[0];e={},"email"===d&&o.email?e.emailhash=jo()(o.email.toLowerCase()).toString():e[d]=o[d]}return this._fetchNewServiceHostmap({from:i,token:a,query:e,forceRefresh:s}).then((function(e){c.updateServiceUrls(t,e),r.updateCredentialsConfig(),c.status[t].collecting=!1})).catch((function(e){return c.status[t].collecting=!1,p().reject(e)}))},validateUser:function(e){var t=this,r=e.email,n=e.reqId,i=void 0===n?"WEBCLIENT":n,o=e.forceRefresh,a=void 0!==o&&o,s=e.activationOptions,c=void 0===s?{}:s,u=e.preloginUserId;if(this.logger.info("services: validating a user"),!r)return p().reject(new Error("`email` is required"));if(this.webex.credentials.canAuthorize)return this.updateServices({forceRefresh:a}).then((function(){return t.webex.credentials.getUserToken()})).then((function(e){return t.sendUserActivation({email:r,reqId:i,token:e.toString(),activationOptions:c,preloginUserId:u})})).then((function(e){return{activated:!0,exists:!0,details:"user is authorized via a user token",user:e}}));var l,d=this.webex.credentials.config,f=d.client_id,h=d.client_secret;return f&&h?this.collectPreauthCatalog({email:r}).then((function(){var e=t.get("idbroker",!0);return t.webex.credentials.getClientToken({uri:"".concat(e,"idb/oauth2/v1/access_token"),scope:"webexsquare:admin webexsquare:get_conversation Identity:SCIM"})})).then((function(e){return l=e.toString(),t.collectSigninCatalog({email:r,token:l,forceRefresh:a})})).catch((function(e){return{exists:"NotFound"!==e.name,activated:!1,details:"NotFound"!==e.name?"user exists but is not activated":"user does not exist and is not activated"}})).then((function(e){return p().all([e||{activated:!0,exists:!0,details:"user exists and is activated"},t.sendUserActivation({email:r,reqId:i,token:l,activationOptions:c,preloginUserId:u})])})).then((function(e){var t=lo(e,2),r=t[0],n=t[1];return ta(ta({},r),{},{user:n})})).catch((function(e){var t={statusCode:e.statusCode,responseText:e.body&&e.body.message,body:e.body};return p().reject(t)})):p().reject(new Error("client authentication details are not available"))},getMeetingPreferences:function(){var e=this;return this.request({method:"GET",service:"hydra",resource:"meetingPreferences"}).then((function(t){return e.logger.info("services: received user region info"),t.body})).catch((function(t){e.logger.info("services: was not able to fetch user login information",t)}))},fetchClientRegionInfo:function(){var e=this,t=this.webex.config.services;return this.request({uri:t.discovery.sqdiscovery,addAuthHeader:!1,headers:{"spark-user-agent":null},timeout:5e3}).then((function(t){return e.logger.info("services: received user region info"),t.body})).catch((function(t){e.logger.info("services: was not able to get user region info",t)}))},sendUserActivation:function(e){var t,r,n=this,i=e.email,o=e.reqId,a=e.token,s=e.activationOptions,c=e.preloginUserId;return this.logger.info("services: sending user activation request"),this.fetchClientRegionInfo().then((function(e){return e&&(t=e.countryCode,r=e.timezone),n.request({service:"license",resource:"users/activations",method:"POST",headers:{accept:"application/json",authorization:a,"x-prelogin-userid":c},body:ta({email:i,reqId:o,countryCode:t,timeZone:r},s),shouldRefreshAccessToken:!1})})).then((function(e){return e.body})).catch((function(e){return p().reject(e)}))},updateCatalog:function(e,t){var r=this._getCatalog(),n=this._formatReceivedHostmap(t);return r.updateServiceUrls(e,n)},collectPreauthCatalog:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?this.updateServices({from:"limited",query:e,forceRefresh:t}):this.updateServices({from:"limited",query:{mode:"DEFAULT_BY_PROXIMITY"},forceRefresh:t})},collectSigninCatalog:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.email,r=e.token,n=e.forceRefresh;return t?r?this.updateServices({from:"signin",query:{email:t},token:r,forceRefresh:n}):p().reject(new Error("`token` is required")):p().reject(new Error("`email` is required"))},updateCredentialsConfig:function(){var e=this.list(!0),t=e.idbroker,r=e.identity;if(t&&r){var n=this.webex.config.credentials,i=n.authorizationString,o=n.authorizeUrl;this.webex.config.credentials.authorizeUrl=i?o:"".concat(t.replace(ra,""),"/idb/oauth2/v1/authorize"),this.webex.setConfig({credentials:{idbroker:{url:t.replace(ra,"")},identity:{url:r.replace(ra,"")}}})}},waitForCatalog:function(e,t){var r=this._getCatalog(),n=this.webex.credentials.supertoken;return"postauth"===e&&n&&n.access_token&&!r.status.postauth.collecting&&!r.status.postauth.ready?r.status.preauth.ready?this.updateServices():this.initServiceCatalogs():r.waitForCatalog(e,t)},waitForService:function(e){var t=this,r=e.name,n=e.timeout,i=void 0===n?5:n,o=e.url,a=this.webex.config.services,s=this._getCatalog();if(a.servicesNotNeedValidation.find((function(e){return e===r})))return p().resolve(this._serviceUrls[r]);var c=this.get(r,!0),u=this.getServiceFromUrl(o);return c||u?p().resolve(c||u.priorityUrl):s.isReady?o?p().resolve(o):(this.webex.internal.metrics.submitClientMetrics(Bo,{fields:{service_name:r}}),p().reject(new Error("services: service '".concat(r,"' was not found in any of the catalogs")))):new(p())((function(e,n){p().all(["preauth","signin","postauth"].map((function(n){return a=n,s.waitForCatalog(a,i).then((function(){var n=t.get(r,!0),i=t.getServiceFromUrl(o);(n||i)&&e(n||i.priorityUrl)})).catch((function(){}));var a}))).then((function(){t.webex.internal.metrics.submitClientMetrics(Bo,{fields:{service_name:r}}),n(new Error("services: service '".concat(r,"' was not found after waiting")))}))}))},replaceHostFromHostmap:function(e){var t=new URL(e),r=this._hostCatalog;if(!r)return e;var n=r[t.host];if(n&&n[0]){var i=n[0].host;return t.host=i,t.toString()}return e},_formatReceivedHostmap:function(e){this._updateHostCatalog(e.hostCatalog);var t=function(e){return e.id.split(":")[3]},r=[];return l()(e.serviceLinks).forEach((function(n){var i,o,a=e.serviceLinks[n];try{o=new URL(a).host}catch(e){return}var s=e.hostCatalog[o],c={name:n,defaultUrl:a,defaultHost:o,hosts:[]};if(r.push(c),s&&s[0]){var u=t(s[0]);Fo()(s,(function(e){t(e)===u&&c.hosts.push(ta(ta({},e),{},{homeCluster:!0}))}));var l=[];Fo()(e.hostCatalog,(function(e){e!==s&&Fo()(e,(function(e){t(e)===u&&l.push(ta(ta({},e),{},{homeCluster:!1}))}))})),(i=c.hosts).push.apply(i,l)}})),this._updateServiceUrls(e.serviceLinks),this._updateHostCatalog(e.hostCatalog),r},getClusterId:function(e){return this._getCatalog().findClusterId(e)},getServiceFromClusterId:function(e){return this._getCatalog().findServiceFromClusterId(e)},getServiceUrlFromClusterId:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).cluster,t=void 0===e?"us":e,r="us"===t?ia:t;r.split(":").length<4&&(r="".concat(t,":").concat(na));var n=(this.getServiceFromClusterId({clusterId:r})||{}).url;if(!n)throw Error("Could not find service for cluster [".concat(t,"]"));return n},getServiceFromUrl:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=this._getCatalog().findServiceUrlFromUrl(e);if(t)return{name:t.name,priorityUrl:t.get(!0),defaultUrl:t.get()}},isServiceUrl:function(e){return!!this._getCatalog().findServiceUrlFromUrl(e)},isAllowedDomainUrl:function(e){return!!this._getCatalog().findAllowedDomain(e)},convertUrlToPriorityHostUrl:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=this.getServiceFromUrl(e);if(!t)throw Error("No service associated with url: [".concat(e,"]"));return e.replace(t.defaultUrl,t.priorityUrl)},_fetchNewServiceHostmap:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.from,n=t.query,i=t.token,o=t.forceRefresh,a=r?"/".concat(r,"/catalog"):"/catalog",s=ta(ta({},n),{},{format:"hostmap"});o&&(s.timestamp=(new Date).getTime());var c={method:"GET",service:"u2c",resource:a,qs:s};return i&&(c.headers={authorization:i}),this.webex.internal.newMetrics.callDiagnosticLatencies.measureLatency((function(){return e.request(c)}),"internal.get.u2c.time").then((function(t){var r=t.body;return e._formatReceivedHostmap(r)}))},initConfig:function(){var e=this._getCatalog(),t=this.webex.config,r=t.services,n=t.fedramp;if(r){if(n&&(r.discovery=Zo),r.discovery){var i=l()(r.discovery).map((function(e){return{name:e,defaultUrl:r.discovery[e]}}));e.updateServiceUrls("discovery",i)}if(r.override){var o=l()(r.override).map((function(e){return{name:e,defaultUrl:r.override[e]}}));e.updateServiceUrls("override",o)}n||(r.allowedDomains=wi()(r.allowedDomains,Lo)),r.allowedDomains&&e.setAllowedDomains(r.allowedDomains),this.validateDomains=r.validateDomains}},initServiceCatalogs:function(){var e=this;this.logger.info("services: initializing initial service catalogs");var t=this.webex.credentials;return p().resolve().then((function(){return t.getOrgId()})).then((function(t){return e.collectPreauthCatalog({orgId:t})})).then((function(){return t.canAuthorize?e.updateServices().catch((function(){e.initFailed=!0,e.logger.warn("services: cannot retrieve postauth catalog")})):p().resolve()}))},initialize:function(){var e=this,t=new Ko,r=new Qo,n=new Xo;this._catalogs.set(this.webex,t),this.registries.set(this.webex,r),this.states.set(this.webex,n),this.listenToOnce(this.webex,"change:config",(function(){e.initConfig()})),this.listenToOnce(this.webex,"ready",(function(){var r=e.webex.credentials.supertoken;if(r&&r.access_token)e.initServiceCatalogs().then((function(){t.isReady=!0})).catch((function(t){e.initFailed=!0,e.logger.error("services: failed to init initial services when credentials available, ".concat(null==t?void 0:t.message))}));else{var n=e.webex.config.email;e.collectPreauthCatalog(n?{email:n}:void 0).catch((function(t){e.initFailed=!0,e.logger.error("services: failed to init initial services when no credentials available, ".concat(null==t?void 0:t.message))}))}}))},version:"0.0.0-next"});const aa=oa;function sa(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var ca=function(e){Je(r,e);var t=sa(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"onResponseError",value:function(e,t){if((t instanceof ei.InternalServerError||t instanceof ei.BadGateway||t instanceof ei.ServiceUnavailable)&&e.uri){var r=this.webex.internal.device.features.developer.get("web-high-availability");if(r&&r.value)return this.webex.internal.metrics.submitClientMetrics("web-ha",{fields:{success:!1},tags:{action:"failed",error:t.message,url:e.uri}}),p().resolve(this.webex.internal.services.markFailedUrl(e.uri)).then((function(){return p().reject(t)}))}return p().reject(t)}}],[{key:"create",value:function(){return new r({webex:this})}}]),r}(Wr);function ua(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var la=/(?:^\/)|(?:\/$)/,da=function(e){Je(r,e);var t=ua(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"onRequest",value:function(e){var t=this;if(e.uri)return e;this.normalizeOptions(e),this.validateOptions(e);var r=this.webex.internal.services,n=e.service,i=e.resource,o=e.waitForServiceTimeout;return r.waitForService({name:n,timeout:o}).then((function(r){return e.uri=t.generateUri(r,i),e})).catch((function(){return p().reject(new Error("service-interceptor: '".concat(n,"' is not a known service")))}))}},{key:"generateUri",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.replace(la,""),n=t.replace(la,"");return"".concat(r,"/").concat(n)}},{key:"normalizeOptions",value:function(e){e.api&&(e.service=e.service||e.api,delete e.api)}},{key:"validateOptions",value:function(e){if(!e.resource)throw new Error("a `resource` parameter is required");if(!e.service)throw new Error("a valid 'service' parameter is required")}}],[{key:"create",value:function(){return new r({webex:this})}}]),r}(Wr);Di("services",aa,{interceptors:{ServiceInterceptor:da.create,ServerErrorInterceptor:ca.create}});var fa=__webpack_require__(77043),ha=__webpack_require__.n(fa);const pa=y().extend({namespace:"ServiceDetail",props:{serviceUrls:["array",!1,function(){return[]}],serviceName:["string",!0,void 0],id:["string",!0,void 0]},_generateHostUrl:function(e){var t=new URL(e.baseUrl);return t.host="".concat(e.host).concat(t.port?":".concat(t.port):""),t.href},_getPriorityHostUrl:function(){var e=this._searchForValidPriorityHost();return e||(this.serviceUrls=this.serviceUrls.map((function(e){return e.failed=!1,e})),e=this._searchForValidPriorityHost()),e?this._generateHostUrl(e):""},_searchForValidPriorityHost:function(){return this.serviceUrls.find((function(e){return e.priority>0&&!e.failed}))},failHost:function(e){var t=new URL(e),r=this.serviceUrls.find((function(e){return e.host===t.host}));return r&&(r.failed=!0),void 0!==r},get:function(){return this.serviceUrls&&0!==this.serviceUrls.length?this._getPriorityHostUrl():""}});function va(e,t){var r=void 0!==Yr()&&e[Xr()]||e["@@iterator"];if(!r){if(en()(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return ma(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return $r()(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ma(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function ma(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var ga=y().extend({namespace:"ServiceCatalog",props:{serviceGroups:["object",!0,function(){return{discovery:[],override:[],preauth:[],postauth:[],signin:[]}}],status:["object",!0,function(){return{discovery:{ready:!1,collecting:!1},override:{ready:!1,collecting:!1},preauth:{ready:!1,collecting:!1},postauth:{ready:!1,collecting:!1},signin:{ready:!1,collecting:!1}}}],isReady:["boolean",!1,!1],allowedDomains:["array",!1,function(){return[]}]},_getAllServiceDetails:function(e){return"string"==typeof e?this.serviceGroups[e]||[]:[].concat(A(this.serviceGroups.override),A(this.serviceGroups.postauth),A(this.serviceGroups.signin),A(this.serviceGroups.preauth),A(this.serviceGroups.discovery))},_getServiceDetail:function(e,t){return this._getAllServiceDetails(t).find((function(t){return t.id===e}))},_loadServiceDetails:function(e,t){var r=this;t.forEach((function(t){r._getServiceDetail(t.id,e)||r.serviceGroups[e].push(t)}))},_unloadServiceDetails:function(e,t){var r,n=this;t.forEach((function(t){(r=n._getServiceDetail(t.id,e))&&n.serviceGroups[e].splice(n.serviceGroups[e].indexOf(r),1)}))},clean:function(){this.serviceGroups.preauth.length=0,this.serviceGroups.signin.length=0,this.serviceGroups.postauth.length=0,this.status.preauth={ready:!1},this.status.signin={ready:!1},this.status.postauth={ready:!1}},findClusterId:function(e){try{var t,r=new URL(e);return null===(t=this._getAllServiceDetails().find((function(e){return e.serviceUrls.find((function(e){return e.host===r.host}))})))||void 0===t?void 0:t.id}catch(e){return}},findServiceFromClusterId:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.clusterId,r=e.serviceGroup,n=this._getServiceDetail(t,r);if(n)return{name:n.serviceName,url:n.get()}},findServiceDetailFromUrl:function(e){return this._getAllServiceDetails().find((function(t){var r,n=va(t.serviceUrls);try{for(n.s();!(r=n.n()).done;){var i=r.value;if(e.startsWith(i.baseUrl))return!0}}catch(e){n.e(e)}finally{n.f()}return!1}))},findAllowedDomain:function(e){try{var t=new URL(e);return this.allowedDomains.find((function(e){return t.host.includes(e)}))}catch(e){return}},get:function(e,t){var r=this._getServiceDetail(e,t);return r?r.get():void 0},getAllowedDomains:function(){return A(this.allowedDomains)},markFailedServiceUrl:function(e){var t=this._getAllServiceDetails().find((function(t){return t.failHost(e)}));if(t)return t.get()},setAllowedDomains:function(e){this.allowedDomains=A(e)},addAllowedDomains:function(e){this.allowedDomains=wi()(this.allowedDomains,e)},updateServiceGroups:function(e,t){var r=this,n=this.serviceGroups[e].filter((function(e){return t.every((function(t){return t.id!==e.id}))}));this._unloadServiceDetails(e,n),t.forEach((function(t){var n=r._getServiceDetail(t.id,e);n?n.serviceUrls=t.serviceUrls||[]:r._loadServiceDetails(e,[new pa(t)])})),this.status[e].ready=!0,this.trigger(e)},waitForCatalog:function(e,t){var r=this;return new(p())((function(n,i){r.status[e].ready&&n();var o=setTimeout((function(){return i(new Error("services: timeout occured while waiting for '".concat(e,"' catalog to populate")))}),1e3*("number"==typeof t&&t>=0?t:60));r.once(e,(function(){clearTimeout(o),n()}))}))}});const ya=ga,ba={hydra:"https://api-usgov.webex.com/v1",u2c:"https://u2c.gov.ciscospark.com/u2c/api/v1",sqdiscovery:"https://ds.ciscospark.com/v1/region"};function Ea(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function Sa(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ea(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):Ea(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}var _a=/(?:^\/)|(?:\/$)/,wa={ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.WEBEX_CONVERSATION_CLUSTER_SERVICE||"identityLookup",Ra={ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.WEBEX_CONVERSATION_DEFAULT_CLUSTER||"".concat("urn:TEAM:us-east-2_a",":").concat(wa);dr.extend({namespace:"Services",props:{validateDomains:["boolean",!1,!0],initFailed:["boolean",!1,!1]},_catalogs:new(se()),_activeServices:{},_services:[],_getCatalog:function(){return this._catalogs.get(this.webex)},get:function(e,t){var r=this._getCatalog(),n=this._activeServices[e],i=r.get(n,t),o=r.get(e,t);if(i||o)return i||o},hasAllowedDomains:function(){return this._getCatalog().getAllowedDomains().length>0},markFailedUrl:function(e){return this._getCatalog().markFailedServiceUrl(e)},_updateActiveServices:function(e){this._activeServices=Sa(Sa({},this._activeServices),e)},_updateServices:function(e){this._services=ha()(e,this._services,"id")},updateServices:function(){var e,t,r=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.from,o=n.query,a=n.token,s=n.forceRefresh,c=this._getCatalog();switch(i){case"limited":t="preauth";break;case"signin":t="signin";break;default:t="postauth"}if(c.status[t].collecting)return this.waitForCatalog(t);if(c.status[t].collecting=!0,"preauth"===t){var u=o&&l()(o)[0];if(!["email","emailhash","userId","orgId","mode"].includes(u))return p().reject(new Error("a query param of email, emailhash, userId, orgId, or mode is required"))}if("preauth"===t||"signin"===t){var d=l()(o)[0];e={},"email"===d&&o.email?e.emailhash=jo()(o.email.toLowerCase()).toString():e[d]=o[d]}return this._fetchNewServiceHostmap({from:i,token:a,query:e,forceRefresh:s}).then((function(e){c.updateServiceGroups(t,e),r.updateCredentialsConfig(),c.status[t].collecting=!1})).catch((function(e){return c.status[t].collecting=!1,p().reject(e)}))},validateUser:function(e){var t=this,r=e.email,n=e.reqId,i=void 0===n?"WEBCLIENT":n,o=e.forceRefresh,a=void 0!==o&&o,s=e.activationOptions,c=void 0===s?{}:s,u=e.preloginUserId;if(this.logger.info("services: validating a user"),!r)return p().reject(new Error("`email` is required"));if(this.webex.credentials.canAuthorize)return this.updateServices({forceRefresh:a}).then((function(){return t.webex.credentials.getUserToken()})).then((function(e){return t.sendUserActivation({email:r,reqId:i,token:e.toString(),activationOptions:c,preloginUserId:u})})).then((function(e){return{activated:!0,exists:!0,details:"user is authorized via a user token",user:e}}));var l,d=this.webex.credentials.config,f=d.client_id,h=d.client_secret;return f&&h?this.collectPreauthCatalog({email:r}).then((function(){var e=t.get("idbroker");return t.webex.credentials.getClientToken({uri:"".concat(e,"idb/oauth2/v1/access_token"),scope:"webexsquare:admin webexsquare:get_conversation Identity:SCIM"})})).then((function(e){return l=e.toString(),t.collectSigninCatalog({email:r,token:l,forceRefresh:a})})).catch((function(e){return{exists:"NotFound"!==e.name,activated:!1,details:"NotFound"!==e.name?"user exists but is not activated":"user does not exist and is not activated"}})).then((function(e){return p().all([e||{activated:!0,exists:!0,details:"user exists and is activated"},t.sendUserActivation({email:r,reqId:i,token:l,activationOptions:c,preloginUserId:u})])})).then((function(e){var t=lo(e,2),r=t[0],n=t[1];return Sa(Sa({},r),{},{user:n})})).catch((function(e){var t={statusCode:e.statusCode,responseText:e.body&&e.body.message,body:e.body};return p().reject(t)})):p().reject(new Error("client authentication details are not available"))},getMeetingPreferences:function(){var e=this;return this.request({method:"GET",service:"hydra",resource:"meetingPreferences"}).then((function(t){return e.logger.info("services: received user region info"),t.body})).catch((function(t){e.logger.info("services: was not able to fetch user login information",t)}))},fetchClientRegionInfo:function(){var e=this,t=this.webex.config.services;return this.request({uri:t.discovery.sqdiscovery,addAuthHeader:!1,headers:{"spark-user-agent":null},timeout:5e3}).then((function(t){return e.logger.info("services: received user region info"),t.body})).catch((function(t){e.logger.info("services: was not able to get user region info",t)}))},sendUserActivation:function(e){var t,r,n=this,i=e.email,o=e.reqId,a=e.token,s=e.activationOptions,c=e.preloginUserId;return this.logger.info("services: sending user activation request"),this.fetchClientRegionInfo().then((function(e){return e&&(t=e.countryCode,r=e.timezone),n.request({service:"license",resource:"users/activations",method:"POST",headers:{accept:"application/json",authorization:a,"x-prelogin-userid":c},body:Sa({email:i,reqId:o,countryCode:t,timeZone:r},s),shouldRefreshAccessToken:!1})})).then((function(e){return e.body})).catch((function(e){return p().reject(e)}))},updateCatalog:function(e,t){var r=this._getCatalog(),n=this._formatReceivedHostmap(t);return r.updateServiceGroups(e,n)},collectPreauthCatalog:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?this.updateServices({from:"limited",query:e,forceRefresh:t}):this.updateServices({from:"limited",query:{mode:"DEFAULT_BY_PROXIMITY"},forceRefresh:t})},collectSigninCatalog:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.email,r=e.token,n=e.forceRefresh;return t?r?this.updateServices({from:"signin",query:{email:t},token:r,forceRefresh:n}):p().reject(new Error("`token` is required")):p().reject(new Error("`email` is required"))},updateCredentialsConfig:function(){var e=this.get("idbroker"),t=this.get("identity");if(e&&t){var r=this.webex.config.credentials,n=r.authorizationString,i=r.authorizeUrl;this.webex.config.credentials.authorizeUrl=n?i:"".concat(e.replace(_a,""),"/idb/oauth2/v1/authorize"),this.webex.setConfig({credentials:{idbroker:{url:e.replace(_a,"")},identity:{url:t.replace(_a,"")}}})}},waitForCatalog:function(e,t){var r=this._getCatalog(),n=this.webex.credentials.supertoken;return"postauth"===e&&n&&n.access_token&&!r.status.postauth.collecting&&!r.status.postauth.ready?r.status.preauth.ready?this.updateServices():this.initServiceCatalogs():r.waitForCatalog(e,t)},waitForService:function(e){var t=this,r=e.name,n=e.timeout,i=void 0===n?5:n,o=e.url,a=this.webex.config.services,s=this._getCatalog();if(a.servicesNotNeedValidation.find((function(e){return e===r}))){var c=this._activeServices[r];return p().resolve(this.get(c))}var u=this.get(r),l=this.getServiceFromUrl(o);return u||l?p().resolve(u||l.priorityUrl):s.isReady?o?p().resolve(o):(this.webex.internal.metrics.submitClientMetrics(Bo,{fields:{service_name:r}}),p().reject(new Error("services: service '".concat(r,"' was not found in any of the catalogs")))):new(p())((function(e,n){p().all(["preauth","signin","postauth"].map((function(n){return a=n,s.waitForCatalog(a,i).then((function(){var n=t.get(r),i=t.getServiceFromUrl(o);(n||i)&&e(n||i.priorityUrl)})).catch((function(){}));var a}))).then((function(){t.webex.internal.metrics.submitClientMetrics(Bo,{fields:{service_name:r}}),n(new Error("services: service '".concat(r,"' was not found after waiting")))}))}))},replaceHostFromHostmap:function(e){try{return this.convertUrlToPriorityHostUrl(e)}catch(t){return e}},_formatHostMapEntry:function(e){return{id:e.id,serviceName:e.serviceName,serviceUrls:e.serviceUrls.map((function(e){return Sa({host:new URL(e.baseUrl).host},e)}))}},_formatReceivedHostmap:function(e){var t=this,r=e.services,n=e.activeServices,i=r.map((function(e){return t._formatHostMapEntry(e)}));return this._updateActiveServices(n),this._updateServices(r),i},getClusterId:function(e){return this._getCatalog().findClusterId(e)},getServiceFromClusterId:function(e){return this._getCatalog().findServiceFromClusterId(e)},getServiceUrlFromClusterId:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).cluster,t=void 0===e?"us":e,r="us"===t?Ra:t;r.split(":").length<4&&(r="".concat(t,":").concat(wa));var n=(this.getServiceFromClusterId({clusterId:r})||{}).url;if(!n)throw Error("Could not find service for cluster [".concat(t,"]"));return n},getServiceFromUrl:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=this._getCatalog().findServiceDetailFromUrl(e);if(t){var r=t.get(),n=new URL(t.serviceUrls.find((function(t){return e.startsWith(t.baseUrl)})).baseUrl).href;return{name:t.serviceName,priorityUrl:r,defaultUrl:n}}},isAllowedDomainUrl:function(e){return!!this._getCatalog().findAllowedDomain(e)},convertUrlToPriorityHostUrl:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=this.getServiceFromUrl(e);if(!t)throw Error("No service associated with url: [".concat(e,"]"));return e.replace(t.defaultUrl,t.priorityUrl)},_fetchNewServiceHostmap:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.from,n=t.query,i=t.token,o=t.forceRefresh,a=r?"/".concat(r,"/catalog"):"/catalog",s=Sa(Sa({},n||{}),{},{format:"U2CV2"});o&&(s.timestamp=(new Date).getTime());var c={method:"GET",service:"u2c",resource:a,qs:s,headers:{}};return i&&(c.headers={authorization:i}),this.webex.internal.newMetrics.callDiagnosticLatencies.measureLatency((function(){return e.request(c)}),"internal.get.u2c.time").then((function(t){var r=t.body;return e._formatReceivedHostmap(r)}))},initConfig:function(){var e=this,t=this._getCatalog(),r=this.webex.config,n=r.services,i=r.fedramp;if(n){if(i&&(n.discovery=ba),n.discovery){var o=l()(n.discovery).map((function(t){return e._formatHostMapEntry({id:t,serviceName:t,serviceUrls:[{baseUrl:n.discovery[t],priority:1}]})}));t.updateServiceGroups("discovery",o)}if(n.override){var a=l()(n.override).map((function(t){return e._formatHostMapEntry({id:t,serviceName:t,serviceUrls:[{baseUrl:n.override[t],priority:1}]})}));t.updateServiceGroups("override",a)}i||(n.allowedDomains=wi()(n.allowedDomains,Lo)),n.allowedDomains&&t.setAllowedDomains(n.allowedDomains),this.validateDomains=n.validateDomains}},initServiceCatalogs:function(){var e=this;this.logger.info("services: initializing initial service catalogs");var t=this.webex.credentials;return p().resolve().then((function(){return t.getOrgId()})).then((function(t){return e.collectPreauthCatalog({orgId:t})})).then((function(){return t.canAuthorize?e.updateServices().catch((function(){e.initFailed=!0,e.logger.warn("services: cannot retrieve postauth catalog")})):p().resolve()}))},initialize:function(){var e=this,t=new ya;this._catalogs.set(this.webex,t),this.listenToOnce(this.webex,"change:config",(function(){e.initConfig()})),this.listenToOnce(this.webex,"ready",(function(){var r=e.webex.credentials.supertoken;if(r&&r.access_token)e.initServiceCatalogs().then((function(){t.isReady=!0})).catch((function(t){e.initFailed=!0,e.logger.error("services: failed to init initial services when credentials available, ".concat(null==t?void 0:t.message))}));else{var n=e.webex.config.email;e.collectPreauthCatalog(n?{email:n}:void 0).catch((function(t){e.initFailed=!0,e.logger.error("services: failed to init initial services when no credentials available, ".concat(null==t?void 0:t.message))}))}}))},version:"0.0.0-next"});var Ca,Ta,xa=new(se()),ka=(Ca=function(){function e(){var t,r,n,i,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ne(this,e),t=this,r="ready",i=this,(n=Ta)&&b(t,r,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0});var s=o.webex||a.parent;if(!s)throw new Error("One of `attrs.webex` or `options.parent` must be supplied when initializing a StatelessWebexPlugin");for(;s.parent||s.collection;)s=s.parent||s.collection;xa.set(this,s)}return oe(e,[{key:"config",get:function(){var e=this.getNamespace?this.getNamespace():this.namespace;return e?(e=e.toLowerCase(),this.webex.config[e]):this.webex.config}},{key:"logger",get:function(){return this.webex.logger}},{key:"webex",get:function(){return xa.get(this)}},{key:"request",value:function(){var e;return(e=this.webex).request.apply(e,arguments)}},{key:"upload",value:function(){var e;return(e=this.webex).upload.apply(e,arguments)}}]),e}(),Ta=Zt(Ca.prototype,"ready",[function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return yt(xt,t)}],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),Ca);tr()(ka.prototype,nr());var Ia=dr.extend({session:{deferreds:{type:"object",default:function(){return new(V())}},queue:{type:"array",default:function(){return[]}}},derived:{bounce:{fn:function(){var e=this;return function(e,t,r){if(!e)throw new Error("`fn` must be a function");if(!t)throw new Error("`wait` is required");if(!(r=r||{}).maxWait)throw new Error("`options.maxWait` is required");if(!r.maxCalls)throw new Error("`options.maxCalls` is required");var n,i,o=r,a=o.maxCalls,s=o.maxWait,c=0;return function(){c+=1,clearTimeout(i),i=setTimeout((function(){return u()}),t),n||(n=setTimeout((function(){return u()}),s)),c>=a&&f()(u,this,[])};function u(){clearTimeout(i),i=null,clearTimeout(n),n=null,c=0,f()(e,this,[])}}((function(){return e.executeQueue.apply(e,arguments)}),this.config.batcherWait,{maxCalls:this.config.batcherMaxCalls,maxWait:this.config.batcherMaxWait})}}},request:function(e){var t=this,r=new Q;return this.fingerprintRequest(e).then((function(n){t.deferreds.has(n)?r.resolve(t.deferreds.get(n).promise):(t.deferreds.set(n,r),t.prepareItem(e).then((function(e){r.promise=r.promise.then(We((function(){return t.deferreds.delete(n)}))).catch((function(e){return t.deferreds.delete(n),p().reject(e)})),t.enqueue(e).then((function(){return t.bounce()})).catch((function(e){return r.reject(e)}))})).catch((function(e){return r.reject(e)})))})).catch((function(e){return r.reject(e)})),r.promise},enqueue:function(e){return this.queue.push(e),p().resolve()},prepareItem:function(e){return p().resolve(e)},executeQueue:function(){var e=this,t=this.queue.splice(0,this.config.batcherMaxCalls);return new(p())((function(r){r(e.prepareRequest(t).then((function(t){return e.submitHttpRequest(t).then((function(t){return e.handleHttpSuccess(t)}))})).catch((function(r){return r instanceof ei?e.handleHttpError(r):p().all(t.map((function(t){return e.getDeferredForRequest(t).then((function(e){e.reject(r)}))})))})))})).catch((function(t){return e.logger.error(t),p().reject(t)}))},prepareRequest:function(e){return p().resolve(e)},submitHttpRequest:function(e){throw new Error("request() must be implemented")},handleHttpSuccess:function(e){var t=this;return p().all((e.body&&e.body.items||e.body).map((function(e){return t.acceptItem(e)})))},handleHttpError:function(e){var t=this;return e instanceof ei&&Hn()(e,"options.body.map")?p().all(e.options.body.map((function(r){return t.getDeferredForRequest(r).then((function(t){t.reject(e)}))}))):(this.logger.error("http error handler called without a WebexHttpError object",e),p().reject(e))},acceptItem:function(e){var t=this;return this.didItemFail(e).then((function(r){return r?t.handleItemFailure(e):t.handleItemSuccess(e)}))},didItemFail:function(e){return p().resolve(!1)},handleItemFailure:function(e){return this.getDeferredForResponse(e).then((function(t){t.reject(e)}))},handleItemSuccess:function(e){return this.getDeferredForResponse(e).then((function(t){t.resolve(e)}))},getDeferredForRequest:function(e){var t=this;return this.fingerprintRequest(e).then((function(e){var r=t.deferreds.get(e);if(!r)throw new Error("Could not find pending request for received response");return r}))},getDeferredForResponse:function(e){var t=this;return this.fingerprintResponse(e).then((function(e){var r=t.deferreds.get(e);if(!r)throw new Error("Could not find pending request for received response");return r}))},fingerprintRequest:function(e){throw new Error("fingerprintRequest() must be implemented")},fingerprintResponse:function(e){throw new Error("fingerprintResponse() must be implemented")},version:"0.0.0-next"});const Aa=Ia;new(se()),new(se()),new(se());var Oa="webex-js-sdk";const La={device:{preDiscoveryServices:{metricsServiceUrl:{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.METRICS_SERVICE_URL||"https://metrics-a.wbx2.com/metrics/api/v1",metrics:{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.METRICS_SERVICE_URL||"https://metrics-a.wbx2.com/metrics/api/v1"}},metrics:{appType:"browser",batcherWait:500,batcherMaxCalls:50,batcherMaxWait:1500,batcherRetryPlateau:32e3,waitForServiceTimeout:30}};var Ma="other",Na={"Chrome OS":"chrome",macOS:"mac",Windows:"windows",iOS:"ios",Android:"android",Linux:"linux"},Pa=Yr()("metric id"),Da=Aa.extend({namespace:"Metrics",prepareItem:function(e){return e.appType=e.appType||this.config.appType,e.env=e.env||null,e.time=e.time||Ln()(),e.version=e.version||this.webex.version,p().resolve(e)},prepareRequest:function(e){return p().resolve(e.map((function(e){return e.postTime=e.postTime||Ln()(),e})))},submitHttpRequest:function(e){return this.webex.request({method:"POST",service:"metrics",resource:"metrics",body:{metrics:e},waitForServiceTimeout:this.webex.config.metrics.waitForServiceTimeout})},handleHttpSuccess:function(e){var t=this;return p().all(e.options.body.metrics.map((function(e){return t.acceptItem(e)})))},handleHttpError:function(e){var t=this;return e instanceof ei.NetworkOrCORSError?(this.logger.warn("metrics-batcher: received network error submitting metrics, reenqueuing payload"),p().all(e.options.body.metrics.map((function(e){return new(p())((function(r){var n=e[Pa].nextDelay;n<t.config.batcherRetryPlateau&&(e[Pa].nextDelay*=2),Hi((function(){r(t.rerequest(e))}),n)}))})))):f()(Aa.prototype.handleHttpError,this,[e])},rerequest:function(e){var t=this;return p().all([this.getDeferredForRequest(e),this.prepareItem(e)]).then((function(e){var r=lo(e,2),n=r[0],i=r[1];t.enqueue(i).then((function(){return t.bounce()})).catch((function(e){return n.reject(e)}))}))},fingerprintRequest:function(e){return e[Pa]=e[Pa]||{nextDelay:1e3},p().resolve(e[Pa])},fingerprintResponse:function(e){return p().resolve(e[Pa])}});const Fa=Da;var Ua=Fa.extend({namespace:"Metrics",prepareItem:function(e){return p().resolve(e)},prepareRequest:function(e){return p().resolve(e)},submitHttpRequest:function(e){return this.webex.request({method:"POST",service:"metrics",resource:"clientmetrics",body:{metrics:e},waitForServiceTimeout:this.webex.config.metrics.waitForServiceTimeout})}});const ja=Ua;var Ba,qa=__webpack_require__(73955),Va=__webpack_require__.n(qa),Ga=__webpack_require__(93917),Wa=__webpack_require__.n(Ga),za="call-diagnostic-events -> ",Ha="call-diagnostic-events-feature -> ",Ka="PMR",$a="ScheduledMeeting",Ja="Webinar",Ya="Webcast",Qa="NotAllowedError",Xa="NotReadableError",Za="AbortError",es="NotFoundError",ts="OverconstrainedError",rs="SecurityError",ns="TypeError",is=C(C(C(C(C(C(C(C({},"PermissionDeniedError",4032),Qa,4032),Xa,2729),Za,2729),es,2729),ts,2729),rs,2729),ns,2729),os={GENERAL:2050,SDP_MUNGE_MISSING_CODECS:2051},as="NetworkError",ss="FailedToConnectMedia",cs="MediaEngineLost",us="MediaConnectionLost",ls="IceFailure",ds="MediaEngineHang",fs="IceServerRejected",hs="CallFull",ps="RoomTooLarge",vs="GuestAlreadyAdded",ms="LocusUserNotAuthorised",gs="CloudberryUnavailable",ys="RoomTooLarge_FreeAccount",bs="MeetingInactive",Es="MeetingLocked",Ss="MeetingTerminating",_s="Moderator_Pin_Or_Guest_Required",ws="Moderator_Pin_Or_Guest_PIN_Required",Rs="Moderator_Required",Cs="UserNotMemberOfRoom",Ts="NewLocusError",xs="NetworkUnavailable",ks="MeetingUnavailable",Is="MeetingIDInvalid",As="MeetingSiteInvalid",Os="LocusInvalidJoinTime",Ls="LobbyExpired",Ms="MediaConnectionLostPaired",Ns="PhoneNumberNotANumber",Ps="PhoneNumberTooLong",Ds="InvalidDialableKey",Fs="OneOnOneToSelfNotAllowed",Us="RemovedParticipant",js="MeetingLinkNotFound",Bs="PhoneNumberTooShortAfterIdd",qs="InvalidInviteeAddress",Vs="PMRUserAccountLockedOut",Gs="GuestForbidden",Ws="PMRAccountSuspended",zs="EmptyPhoneNumberOrCountryCode",Hs="ConversationNotFound",Ks="SIPCalleeBusy",$s="SIPCalleeNotFound",Js="StartRecordingFailed",Ys="RecordingInProgressFailed",Qs="MeetingInfoLookupError",Xs="CallFullAddGuest",Zs="RequireWebexLogin",ec="UserNotAllowedAccessMeeting",tc="UserNeedsActivation",rc="SignUpInvalidEmail",nc="UnknownError",ic="NoMediaFound",oc="StreamErrorNoMedia",ac="CameraPermissionDenied",sc="FraudDetection",cc="E2EENotSupported",uc="LocusLobbyFullCMR",lc="UserNotInvitedToJoin",dc="MissingRoapAnswer",fc="DTLSHandshakeFailed",hc="ICEFailedWithoutTURN_TLS",pc="ICEFailedWithTURN_TLS",vc="ICEAndReachabilityFailed",mc="MultistreamNotAvailable",gc="SdpOfferCreationError",yc="SdpOfferCreationErrorMissingCodec",bc="WdmRestrictedRegion",Ec="UserNotAllowedJoinWebinar",Sc={58400:4100,99002:4100,99009:4100,58500:4100,400001:4100,403004:4005,403028:4005,403025:4005,403125:4005,403032:4005,403034:4036,403036:4005,403038:4005,403040:4100,403041:4005,403047:4101,403408:4101,403043:4005,403048:4101,403049:4101,403100:4101,403101:4036,403102:4036,403103:4036,403104:4101,404001:4101,404006:4100,423001:4005,423005:4005,423006:4005,423010:4005,423012:4005,423013:4005,429005:4100,403021:4104,403022:4104,403024:4104,403137:4104,423007:4104,403026:4104,403037:4104,403003:4101,403030:4101,2403001:3007,2403002:3002,2403003:3002,2403004:4001,2403018:3001,2403019:3001,2423003:4002,2423004:4003,2423005:4005,2423006:4005,2423016:4005,2423017:4005,2423018:4005,2423012:12e3,2423021:12001,2423007:4006,2403010:4007,2403014:4011,2403015:4012,2423010:4013,2400008:4016,2400011:4017,2400012:4018,2403007:4019,2401002:4020,2404002:4021,2400009:4022,2400025:4023,2423009:4024,2403022:4025,2423008:4026,2400006:4027,2400014:1006,2404001:4028,2403025:4029,2405001:4029,2409005:4029,2409062:12002,2423025:12003,100002:4102,100007:4102,100001:4103,100006:4103,100005:4103,100004:4103,4404002:13e3,4404003:13e3},_c=(C(C(C(C(C(C(C(C(C(C(Ba={1e3:{errorDescription:"UnknownCallFailure",category:"signaling",fatal:!0,name:"locus.response"},1001:{errorDescription:"LocusRateLimitedIncoming",category:"signaling",fatal:!0,name:"locus.response"},1002:{errorDescription:"LocusRateLimitedOutgoing",category:"signaling",fatal:!0,name:"locus.response"},1003:{errorDescription:"LocusUnavailable",category:"signaling",fatal:!0,name:"locus.response"},1004:{errorDescription:"LocusConflict",category:"signaling",fatal:!0,name:"locus.response"},1005:{errorDescription:"Timeout",category:"signaling",fatal:!0,name:"locus.response"},1006:{errorDescription:"LocusInvalidSequenceHash",category:"signaling",fatal:!0},1007:{errorDescription:"UpdateMediaFailed",category:"signaling",fatal:!0}},1010,{errorDescription:"AuthenticationFailed",category:"network",fatal:!0}),1026,{errorDescription:as,category:"network",fatal:!0}),2001,{errorDescription:ss,category:"signaling",fatal:!0}),2002,{errorDescription:cs,category:"signaling",fatal:!0}),2003,{errorDescription:us,category:"signaling",fatal:!0}),2004,{errorDescription:ls,category:"media",fatal:!0}),2005,{errorDescription:ds,category:"signaling",fatal:!0}),2006,{errorDescription:fs,category:"signaling",fatal:!0}),2007,{errorDescription:dc,category:"media",fatal:!0}),2008,{errorDescription:fc,category:"media",fatal:!0}),C(C(C(C(C(C(C(C(C(C(Ba,2009,{errorDescription:hc,category:"media",fatal:!0}),2010,{errorDescription:pc,category:"media",fatal:!0}),2011,{errorDescription:vc,category:"expected",fatal:!0}),2012,{errorDescription:mc,category:"expected",fatal:!1}),2050,{errorDescription:gc,category:"media",fatal:!0,shownToUser:!0}),2051,{errorDescription:yc,category:"expected",fatal:!0,shownToUser:!0}),3001,{errorDescription:hs,category:"expected",fatal:!0}),3002,{errorDescription:ps,category:"expected",fatal:!0}),3004,{errorDescription:vs,category:"expected",fatal:!1}),3005,{errorDescription:ms,category:"expected",fatal:!0}),C(C(C(C(C(C(C(C(C(C(Ba,3006,{errorDescription:gs,category:"expected",fatal:!0}),3007,{errorDescription:oc,category:"expected",fatal:!0}),3013,{errorDescription:ys,category:"expected",fatal:!1}),4001,{errorDescription:bs,category:"expected",fatal:!0}),4002,{errorDescription:Es,category:"expected",fatal:!0,name:"locus.response"}),4003,{errorDescription:Ss,category:"expected",fatal:!0,name:"locus.leave"}),4004,{errorDescription:_s,category:"expected",fatal:!1}),4005,{errorDescription:ws,category:"expected",fatal:!1}),4006,{errorDescription:Rs,category:"expected",fatal:!1}),4007,{errorDescription:Cs,category:"expected",fatal:!0}),C(C(C(C(C(C(C(C(C(C(Ba,4008,{errorDescription:Ts,category:"signaling",fatal:!0}),4009,{errorDescription:xs,category:"network",fatal:!0}),4010,{errorDescription:ks,category:"expected",fatal:!0}),4011,{errorDescription:Is,category:"expected",fatal:!0}),4012,{errorDescription:As,category:"expected",fatal:!0}),4013,{errorDescription:Os,category:"expected",fatal:!0}),4014,{errorDescription:Ls,category:"expected",fatal:!0}),4015,{errorDescription:Ms,category:"expected",fatal:!1}),4016,{errorDescription:Ns,category:"expected",fatal:!0,name:"locus.response"}),4017,{errorDescription:Ps,category:"expected",fatal:!0,name:"locus.response"}),C(C(C(C(C(C(C(C(C(C(Ba,4018,{errorDescription:Ds,category:"expected",fatal:!0,name:"locus.response"}),4019,{errorDescription:Fs,category:"expected",fatal:!0}),4020,{errorDescription:Us,category:"expected",fatal:!0}),4021,{errorDescription:js,category:"expected",fatal:!0}),4022,{errorDescription:Bs,category:"expected",fatal:!0}),4023,{errorDescription:qs,category:"expected",fatal:!0}),4024,{errorDescription:Vs,category:"expected",fatal:!0}),4025,{errorDescription:Gs,category:"expected",fatal:!0}),4026,{errorDescription:Ws,category:"expected",fatal:!0}),4027,{errorDescription:zs,category:"expected",fatal:!0}),C(C(C(C(C(C(C(C(C(C(Ba,4028,{errorDescription:Hs,category:"expected",fatal:!0}),4029,{errorDescription:Js,category:"expected",fatal:!0}),4030,{errorDescription:Ys,category:"expected",fatal:!0}),4032,{errorDescription:ac,category:"expected",fatal:!0}),4036,{errorDescription:Zs,category:"expected",fatal:!0}),5e3,{errorDescription:Ks,category:"expected",fatal:!0}),5001,{errorDescription:$s,category:"expected",fatal:!0}),4100,{errorDescription:Qs,category:"signaling",fatal:!0}),3003,{errorDescription:Xs,category:"expected",fatal:!1}),4101,{errorDescription:ec,category:"expected",fatal:!0}),C(C(C(C(C(C(C(C(C(C(Ba,4102,{errorDescription:tc,category:"expected",fatal:!0}),4103,{errorDescription:rc,category:"expected",fatal:!0}),4104,{errorDescription:Ec,category:"expected",fatal:!0}),2729,{errorDescription:ic,category:"expected",fatal:!1}),9999,{errorDescription:nc,category:"other",fatal:!0}),12e3,{errorDescription:sc,category:"expected",fatal:!0,name:"locus.response",shownToUser:!0}),12001,{errorDescription:uc,category:"expected",fatal:!0,name:"locus.response",shownToUser:!0}),12002,{errorDescription:cc,category:"expected",fatal:!0,name:"locus.response",shownToUser:!0}),12003,{errorDescription:lc,category:"expected",fatal:!0}),13e3,{errorDescription:bc,category:"expected",fatal:!0})),wc="js_sdk_call_diagnostic_event_failed_to_send",Rc=Vt(),Cc=Rc.getOSName,Tc=Rc.getOSVersion,xc=Rc.getBrowserName,kc=Rc.getBrowserVersion,Ic=function(e){return Wa()(e,28,96)},Ac=function(e){var t,r,n=e.clientName,i=e.webexVersion,o=m().format("client=%s","".concat(n));-1!==["chrome","firefox","msie","msedge","safari"].indexOf(xc().toLowerCase())&&(r=m().format("browser=%s","".concat(xc().toLowerCase(),"/").concat(kc().split(".")[0])));var a=m().format("os=%s","".concat(Cc(),"/").concat(Tc().split(".")[0]));return r&&(t="(".concat(r)),a&&(t=t?"".concat(t,"; ").concat(o,"; ").concat(a):"".concat(o,"; (").concat(a)),t?(t+=")",m().format("webex-js-sdk/%s %s","".concat("production","-").concat(i),t)):m().format("webex-js-sdk/%s","".concat("production","-").concat(i))},Oc=function e(t){0!==l()(t).length&&l()(t).forEach((function(r){("object"===_(t[r])||"string"==typeof t[r]||en()(t[r]))&&qi()(t[r])&&delete t[r],en()(t[r])&&(t[r]=A(t[r].filter((function(e){return!!e})))),"object"===_(t[r])&&e(t[r])}))},Lc=function(e,t){var n,i,o,a,s,c,u,l,d=function(e,t){var r,n;return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?"test":null!==(r=e.internal.metrics)&&void 0!==r&&null!==(n=r.config)&&void 0!==n&&n.caBuildType?e.internal.metrics.config.caBuildType:null!=t&&t.includes("localhost")||null!=t&&t.includes("127.0.0.1")?"test":"prod"}(e,null===(n=t.eventPayload)||void 0===n||null===(i=n.event)||void 0===i||null===(o=i.eventData)||void 0===o?void 0:o.webClientDomain,null===(a=t.eventPayload)||void 0===a||null===(s=a.event)||void 0===s||null===(c=s.eventData)||void 0===c?void 0:c.markAsTestEvent),f={buildType:d,networkType:"unknown",upgradeChannel:"prod"===d?"gold":d},h=null===(u=t.eventPayload)||void 0===u||null===(l=u.event)||void 0===l?void 0:l.name,p={},v={},m={},g=e.internal.newMetrics.callDiagnosticLatencies;switch(h){case"client.webexapp.launched":p.downloadTime=g.getDownloadTimeJMT(),p.pageJmt=g.getPageJMT();break;case"client.login.end":p.otherAppApiReqResp=g.getOtherAppApiReqResp(),p.exchangeCITokenJMT=g.getExchangeCITokenJMT();break;case"client.interstitial-window.launched":p.meetingInfoReqResp=g.getMeetingInfoReqResp(),p.clickToInterstitial=g.getClickToInterstitial(),p.refreshCaptchaServiceReqResp=g.getRefreshCaptchaReqResp(),p.downloadIntelligenceModelsReqResp=g.getDownloadIntelligenceModelsReqResp(),p.clickToInterstitialWithUserDelay=g.getClickToInterstitialWithUserDelay();break;case"client.call.initiated":p.meetingInfoReqResp=g.getMeetingInfoReqResp(),p.showInterstitialTime=g.getShowInterstitialTime(),p.registerWDMDeviceJMT=g.getRegisterWDMDeviceJMT(),p.getU2CTime=g.getU2CTime(),p.getReachabilityClustersReqResp=g.getReachabilityClustersReqResp();break;case"client.locus.join.response":p.meetingInfoReqResp=g.getMeetingInfoReqResp(),p.callInitJoinReq=g.getCallInitJoinReq(),p.joinReqResp=g.getJoinReqResp(),p.pageJmt=g.getPageJMT(),p.clickToInterstitial=g.getClickToInterstitial(),p.interstitialToJoinOK=g.getInterstitialToJoinOK(),p.totalJmt=g.getTotalJMT(),p.clientJmt=g.getClientJMT(),p.downloadTime=g.getDownloadTimeJMT(),p.clickToInterstitialWithUserDelay=g.getClickToInterstitialWithUserDelay(),p.totalJMTWithUserDelay=g.getTotalJMTWithUserDelay();break;case"client.ice.end":p.ICESetupTime=g.getICESetupTime(),p.audioICESetupTime=g.getAudioICESetupTime(),p.videoICESetupTime=g.getVideoICESetupTime(),p.shareICESetupTime=g.getShareICESetupTime();break;case"client.media.rx.start":p.localSDPGenRemoteSDPRecv=g.getLocalSDPGenRemoteSDPRecv(),v.joinRespRxStart=g.getAudioJoinRespRxStart(),m.joinRespRxStart=g.getVideoJoinRespRxStart();break;case"client.media-engine.ready":p.totalMediaJMT=g.getTotalMediaJMT(),p.interstitialToMediaOKJMT=g.getInterstitialToMediaOKJMT(),p.callInitMediaEngineReady=g.getCallInitMediaEngineReady(),p.stayLobbyTime=g.getStayLobbyTime(),p.totalMediaJMTWithUserDelay=g.getTotalMediaJMTWithUserDelay(),p.totalJMTWithUserDelay=g.getTotalJMTWithUserDelay();break;case"client.media.tx.start":v.joinRespTxStart=g.getAudioJoinRespTxStart(),m.joinRespTxStart=g.getVideoJoinRespTxStart()}return qi()(p)||(t.eventPayload.event=r()(t.eventPayload.event,{joinTimes:p})),qi()(v)||(t.eventPayload.event=r()(t.eventPayload.event,{audioSetupDelay:v})),qi()(m)||(t.eventPayload.event=r()(t.eventPayload.event,{videoSetupDelay:m})),t.eventPayload.origin=tr()(f,t.eventPayload.origin),e.logger.log("CallDiagnosticLatencies,prepareDiagnosticMetricItem: ".concat(Cr()({latencies:Object.fromEntries(g.latencyTimestamps),event:t}))),t},Mc=function(e){return e instanceof Error?Cr()({message:null==e?void 0:e.message,name:null==e?void 0:e.name,stack:null==e?void 0:e.stack}):e},Nc="Pre Login Metrics --\x3e",Pc=Fa.extend({namespace:"Metrics",preLoginId:void 0,savePreLoginId:function(e){this.preLoginId=e},prepareItem:function(e){return p().resolve(Lc(this.webex,e))},prepareRequest:function(e){return e.forEach((function(e){e.eventPayload.originTime=e.eventPayload.originTime||{},e.eventPayload.originTime.sent=(new Date).toISOString()})),p().resolve(e)},submitHttpRequest:function(e){var t=this,r=Va()("prelogin-batch-");return void 0===this.preLoginId?(this.webex.logger.error(Nc,"PreLoginMetricsBatcher: @submitHttpRequest#".concat(r,". PreLoginId is not set.")),p().reject(new Error("PreLoginId is not set."))):this.webex.request({method:"POST",service:"metrics",resource:"clientmetrics-prelogin",headers:{authorization:!1,"x-prelogin-userid":this.preLoginId},body:{metrics:e},waitForServiceTimeout:this.webex.config.metrics.waitForServiceTimeout}).then((function(e){return t.webex.logger.log(Nc,"PreLoginMetricsBatcher: @submitHttpRequest#".concat(r,". Request successful.")),e})).catch((function(e){return t.webex.logger.error(Nc,"PreLoginMetricsBatcher: @submitHttpRequest#".concat(r,". Request failed:"),"error: ".concat(Mc(e))),p().reject(e)}))}});const Dc=Pc;var Fc=Dc.extend({namespace:"Metrics",prepareItem:function(e){return p().resolve(e)},prepareRequest:function(e){return p().resolve(e)}});const Uc=Fc;function jc(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function Bc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?jc(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):jc(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}var qc=Vt(),Vc=qc.getOSName,Gc=qc.getOSVersion,Wc=qc.getBrowserName,zc=qc.getBrowserVersion;function Hc(){var e;return null!==(e=Na[Vc()])&&void 0!==e?e:Ma}function Kc(e){var t,r=null!==(t=null==e?void 0:e.config)&&void 0!==t?t:{},n=r.appName,i=r.appVersion,o=r.appPlatform,a=Oa;return n&&(a+=" ".concat(n,"/").concat(null!=i?i:"0.0")),o&&(a+=" ".concat(o)),a}const $c=dr.extend({children:{batcher:Fa,clientMetricsBatcher:ja,clientMetricsPreloginBatcher:Uc},namespace:"Metrics",submit:function(e,t){return this.batcher.request(Bc({key:e},t))},getClientMetricsPayload:function(e,t){var r,n,i;if(!e)throw Error("Missing behavioral metric name. Please provide one");var o={metricName:e},a=null===(r=this.webex.meetings)||void 0===r||null===(n=r.config)||void 0===n||null===(i=n.metrics)||void 0===i?void 0:i.clientVersion;return o.tags=Bc(Bc({},t.tags),{},{browser:Wc(),os:Hc(),appVersion:a,domain:"undefined"!=typeof window&&window.location.hostname||"non-browser"}),o.fields=Bc(Bc({},t.fields),{},{browser_version:zc(),os_version:Gc(),sdk_version:this.webex.version,platform:"Web",spark_user_agent:Kc(this.webex),client_id:this.webex.credentials.config.client_id}),o.type=t.type||this.webex.config.metrics.type,o.context=Bc(Bc({},t.context),{},{app:{version:this.webex.version},locale:"en-US",os:{name:Hc(),version:Gc()}}),t.eventPayload&&(o.eventPayload=t.eventPayload),o.timestamp=(new Date).valueOf(),o},submitClientMetrics:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=this.getClientMetricsPayload(e,t);return r?(this.clientMetricsPreloginBatcher.savePreLoginId(r),this.clientMetricsPreloginBatcher.request(n)):this.clientMetricsBatcher.request(n)},aliasUser:function(e){return this.request({method:"POST",api:"metrics",resource:"clientmetrics",headers:{"x-prelogin-userid":e},body:{},qs:{alias:!0}})},version:"0.0.0-next"});var Jc=Fa.extend({namespace:"Metrics",prepareItem:function(e){return p().resolve(Lc(this.webex,e))},prepareRequest:function(e){return e.forEach((function(e){e.eventPayload.originTime=e.eventPayload.originTime||{},e.eventPayload.originTime.sent=(new Date).toISOString()})),p().resolve(e)},submitHttpRequest:function(e){var t=this,r=Va()("ca-batch-");return this.webex.request({method:"POST",service:"metrics",resource:"clientmetrics",body:{metrics:e},waitForServiceTimeout:this.webex.config.metrics.waitForServiceTimeout}).then((function(e){return t.webex.logger.log(za,"CallDiagnosticEventsBatcher: @submitHttpRequest#".concat(r,". Request successful.")),e})).catch((function(e){return t.webex.logger.error(za,"CallDiagnosticEventsBatcher: @submitHttpRequest#".concat(r,". Request failed:"),"error: ".concat(Mc(e))),p().reject(e)}))}});const Yc=Jc;function Qc(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function Xc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qc(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):Qc(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}function Zc(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var eu=Vt(),tu=eu.getOSVersion,ru=eu.getBrowserName,nu=eu.getBrowserVersion,iu=function(e){Je(i,e);var t,n=Zc(i);function i(){var e;ne(this,i);for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return C(Ye(e=n.call.apply(n,[this].concat(r))),"callDiagnosticEventsBatcher",void 0),C(Ye(e),"preLoginMetricsBatcher",void 0),C(Ye(e),"logger",void 0),C(Ye(e),"hasLoggedBrowserSerial",void 0),C(Ye(e),"device",void 0),C(Ye(e),"delayedClientEvents",[]),C(Ye(e),"delayedClientFeatureEvents",[]),C(Ye(e),"eventErrorCache",new(se())),C(Ye(e),"isMercuryConnected",!1),C(Ye(e),"validator",(function(e){return p().resolve({event:null==e?void 0:e.event,valid:!0})})),C(Ye(e),"submitToCallDiagnosticsPreLogin",(function(t,r){var n={eventPayload:t,type:["diagnostic-event"]};return e.preLoginMetricsBatcher.savePreLoginId(r),e.preLoginMetricsBatcher.request(n)})),e.logger=e.webex.logger,e.callDiagnosticEventsBatcher=new Yc({},{parent:e.webex}),e.preLoginMetricsBatcher=new Dc({},{parent:e.webex}),e}return oe(i,[{key:"getCurLoginType",value:function(){return this.webex.canAuthorize?this.webex.credentials.isUnverifiedGuest?"unverified-guest":"login-ci":null}},{key:"getIsConvergedArchitectureEnabled",value:function(e){var t=e.meetingId;if(t){var r,n=this.webex.meetings.getBasicMeetingInformation(t);return null==n||null===(r=n.meetingInfo)||void 0===r?void 0:r.enableConvergedArchitecture}}},{key:"setMercuryConnectedStatus",value:function(e){this.isMercuryConnected=e}},{key:"getSubServiceType",value:function(e){if(e){var t=null==e?void 0:e.meetingInfo;if((null==t||!t.webexScheduled)&&(null==t||!t.enableEvent)&&null!=t&&t.pmr)return Ka;if(null!=t&&t.webexScheduled&&(null==t||!t.enableEvent)&&(null==t||!t.pmr))return $a;if(null!=t&&t.enableConvergedArchitecture&&null!=t&&t.enableEvent)return null!=t&&t.isConvergedWebinarWebcast?Ya:Ja;if(null!=t&&t.webexScheduled&&null!=t&&t.enableEvent&&(null==t||!t.pmr))return Ja}}},{key:"getOrigin",value:function(e,t){var r,n,i,o,a,s,c=null===(r=this.webex.meetings.config)||void 0===r||null===(n=r.metrics)||void 0===n?void 0:n.clientType,u=null===(i=this.webex.meetings.config)||void 0===i||null===(o=i.metrics)||void 0===o?void 0:o.subClientType,l=null===(a=this.webex.meetings.config)||void 0===a||null===(s=a.metrics)||void 0===s?void 0:s.clientVersion,d="".concat(Oa,"/").concat(this.webex.version),f={};if(l&&(f=function(e){var t=lo(e.split("."),2),r=t[0],n=t[1];return{majorVersion:jr()(r,10),minorVersion:jr()(n,10)}}(l)),this.hasLoggedBrowserSerial||(this.logger.log(za,"CallDiagnosticMetrics: @createClientEventObjectInMeeting => collected browser data",Cr()(function(){var e;try{var t;e=null!==Bt()&&void 0!==Bt()&&null!==(t=Bt().navigator)&&void 0!==t&&t.userAgent?Ut().getParser(Bt().navigator.userAgent):{error:Ce}}catch(t){e={error:t.message}}return e}())),this.hasLoggedBrowserSerial=!0),c&&u||e.clientType&&e.subClientType){var h,p,v,m,g,y,b={name:"endpoint",networkType:(null==e?void 0:e.networkType)||"unknown",userAgent:Ac({clientName:null===(h=this.webex.meetings)||void 0===h||null===(p=h.config)||void 0===p||null===(v=p.metrics)||void 0===v?void 0:v.clientName,webexVersion:this.webex.version}),clientInfo:Xc(Xc({clientType:(null==e?void 0:e.clientType)||c,clientVersion:l||d},f),{},{publicNetworkPrefix:Ic(null===(m=this.webex.meetings.geoHintInfo)||void 0===m?void 0:m.clientAddress)||void 0,localNetworkPrefix:Ic(null===(g=this.webex.meetings.meetingCollection.get(t))||void 0===g||null===(y=g.statsAnalyzer)||void 0===y?void 0:y.getLocalIpAddress())||void 0,osVersion:tu()||"unknown",subClientType:(null==e?void 0:e.subClientType)||u,os:Hc(),browser:ru(),browserVersion:nu()})};if(t){var E=this.webex.meetings.getBasicMeetingInformation(t);null!=E&&E.environment&&(b.environment=E.environment)}return null!=e&&e.environment&&(b.environment=e.environment),null!=e&&e.newEnvironment&&(b.newEnvironment=e.newEnvironment),null!=e&&e.clientLaunchMethod&&(b.clientInfo.clientLaunchMethod=e.clientLaunchMethod),null!=e&&e.browserLaunchMethod&&(b.clientInfo.browserLaunchMethod=e.browserLaunchMethod),b}throw new Error("ClientType and SubClientType can't be undefined")}},{key:"getIdentifiers",value:function(e){var t,r,n,i,o,a,s,c,u,l,d,f=e.meeting,h=e.mediaConnections,p=e.correlationId,v=e.webexConferenceIdStr,m=e.globalMeetingId,g=e.preLoginId,y=e.sessionCorrelationId,b={correlationId:"unknown"};if(f&&(b.correlationId=f.correlationId,f.sessionCorrelationId&&(b.sessionCorrelationId=f.sessionCorrelationId)),y&&(b.sessionCorrelationId=y),y&&(b.sessionCorrelationId=y),p&&(b.correlationId=p),this.device){var E=this.device,S=((null==E?void 0:E.config)||{}).installationId;b.userId=(null==E?void 0:E.userId)||g,b.deviceId=null==E?void 0:E.url,b.orgId=null==E?void 0:E.orgId,b.locusUrl=this.webex.internal.services.get("locus"),S&&(b.machineId=S)}(null!=f&&null!==(t=f.locusInfo)&&void 0!==t&&t.fullState&&(b.locusUrl=f.locusUrl,b.locusId=f.locusUrl&&f.locusUrl.split("/").pop(),b.locusStartTime=f.locusInfo.fullState&&f.locusInfo.fullState.lastActive),null!=f&&null!==(r=f.meetingInfo)&&void 0!==r&&r.confIdStr||null!=f&&null!==(n=f.meetingInfo)&&void 0!==n&&n.confID)&&(b.webexConferenceIdStr="".concat((null===(a=f.meetingInfo)||void 0===a?void 0:a.confIdStr)||(null===(s=f.meetingInfo)||void 0===s?void 0:s.confID)));null!=f&&null!==(i=f.meetingInfo)&&void 0!==i&&i.meetingId&&(b.globalMeetingId=null===(c=f.meetingInfo)||void 0===c?void 0:c.meetingId);null!=f&&null!==(o=f.meetingInfo)&&void 0!==o&&o.siteName&&(b.webexSiteName=null===(u=f.meetingInfo)||void 0===u?void 0:u.siteName);h&&(b.mediaAgentAlias=null==h||null===(l=h[0])||void 0===l?void 0:l.mediaAgentAlias,b.mediaAgentGroupId=null==h||null===(d=h[0])||void 0===d?void 0:d.mediaAgentGroupId);if(null!=b&&b.webexConferenceIdStr||!v||(b.webexConferenceIdStr="".concat(v)),null!=b&&b.globalMeetingId||!m||(b.globalMeetingId=m),void 0===b.correlationId)throw new Error("Identifiers initialization failed.");return b}},{key:"prepareDiagnosticEvent",value:function(e,t){var r,n=t.meetingId,i=t.triggeredTime,o=this.getOrigin(t,n),a={eventId:kn().v4(),version:1,origin:o,originTime:{triggered:i||(new Date).toISOString(),sent:"not_defined_yet"},senderCountryCode:null===(r=this.webex.meetings.geoHintInfo)||void 0===r?void 0:r.countryCode,event:e};return"client.mediaquality.event"!==e.name&&Oc(a),a}},{key:"prepareClientFeatureEvent",value:function(e){var t,n=e.name,i=e.payload,o=e.options,a=o.meetingId;o.correlationId;if(!a)throw new Error("Not implemented");return t=this.createFeatureEventObjectInMeeting({name:n,options:o}),t=r()(t,i),this.prepareDiagnosticEvent(t,o)}},{key:"submitFeatureEvent",value:function(e){var t=e.name,r=e.payload,n=e.options;if(e.delaySubmitEvent){var i=Xc(Xc({},n),{},{triggeredTime:(new Date).toISOString()});return this.delayedClientFeatureEvents.push({name:t,payload:r,options:i}),p().resolve()}this.logger.log(Ha,"CallFeatureMetrics: @submitFeatureEvent. Submit Client Feature Event CA event.","name: ".concat(t));var o=this.prepareClientFeatureEvent({name:t,payload:r,options:n});return this.validator({type:"ce",event:o}),this.submitToCallFeatures(o)}},{key:"submitToCallFeatures",value:function(e){var t={eventPayload:e,type:["business"]};return this.callDiagnosticEventsBatcher.request(t)}},{key:"submitMQE",value:function(e){var t=e.name,n=e.payload,i=e.options,o=i.meetingId,a=i.mediaConnections,s=i.webexConferenceIdStr,c=i.globalMeetingId;if(!o)throw new Error("Media quality events cant be sent outside the context of a meeting. Meeting id is required.");var u=this.webex.meetings.getBasicMeetingInformation(o);if(!u)return console.warn("Attempt to send MQE but no meeting was found...","event: ".concat(t,", meetingId: ").concat(o)),void this.webex.internal.metrics.submitClientMetrics(wc,{fields:{meetingId:o,name:t}});var l={name:t,canProceed:!0,identifiers:this.getIdentifiers({meeting:u,mediaConnections:u.mediaConnections||a,webexConferenceIdStr:s,globalMeetingId:c}),eventData:{webClientDomain:window.location.hostname},intervals:n.intervals,callingServiceType:"LOCUS",meetingJoinInfo:{clientSignallingProtocol:"WebRTC"},sourceMetadata:{applicationSoftwareType:Oa,applicationSoftwareVersion:this.webex.version,mediaEngineSoftwareType:ru()||"browser",mediaEngineSoftwareVersion:tu()||"unknown",startTime:(new Date).toISOString()}};l=r()(l,n);var d=this.prepareDiagnosticEvent(l,i);this.validator({type:"mqe",event:d}),this.submitToCallDiagnostics(d)}},{key:"getErrorPayloadForClientErrorCode",value:function(e){var t=e.clientErrorCode,n=e.serviceErrorCode,i=e.serviceErrorName,o=e.rawErrorMessage,a=e.payloadOverrides,s=e.httpStatusCode;if(t){var c=_c[t];if(c)return r()({fatal:!0,shownToUser:!1,name:"other",category:"other"},{errorCode:t},i?{errorData:{errorName:i}}:{},{serviceErrorCode:n},{rawErrorMessage:o},void 0===s?{}:{httpStatusCode:s},c,a||{})}}},{key:"clearErrorCache",value:function(){this.eventErrorCache=new(se())}},{key:"generateClientEventErrorPayload",value:function(e){var t,r,n,i,o,a,s=this.eventErrorCache.get(e);if(s)return[s,!0];var c,u,l=e.message,d=e.statusCode;if(e.name&&(u=e.name,is[u]&&(c=this.getErrorPayloadForClientErrorCode({serviceErrorCode:void 0,clientErrorCode:is[e.name],serviceErrorName:e.name,rawErrorMessage:l,httpStatusCode:d}))),function(e){return e.name===gc}(e)&&!c){var f,h=null===(f=e.cause)||void 0===f?void 0:f.type;c=this.getErrorPayloadForClientErrorCode({serviceErrorCode:void 0,clientErrorCode:os[h]||os.GENERAL,serviceErrorName:e.name,rawErrorMessage:l,httpStatusCode:d})}var p,v=(null==e||null===(t=e.error)||void 0===t||null===(r=t.body)||void 0===r?void 0:r.errorCode)||(null==e||null===(n=e.body)||void 0===n?void 0:n.errorCode)||(null==e||null===(i=e.body)||void 0===i?void 0:i.code)||(null==e||null===(o=e.body)||void 0===o||null===(a=o.reason)||void 0===a?void 0:a.reasonCode);if(v){var m=Sc[v];m&&!c&&(c=this.getErrorPayloadForClientErrorCode({clientErrorCode:m,serviceErrorCode:v,rawErrorMessage:l,httpStatusCode:d})),7!==(p="".concat(v)).length||"2"!==p.charAt(0)||c||(c=this.getErrorPayloadForClientErrorCode({clientErrorCode:4008,serviceErrorCode:v,rawErrorMessage:l,httpStatusCode:d}))}return function(e){var t,r,n,i;return!!(null!==(t=e.body)&&void 0!==t&&null!==(r=t.data)&&void 0!==r&&r.meetingInfo||null!==(n=e.body)&&void 0!==n&&null!==(i=n.url)&&void 0!==i&&i.includes("wbxappapi"))}(e)&&!c&&(c=this.getErrorPayloadForClientErrorCode({clientErrorCode:4100,serviceErrorCode:v,rawErrorMessage:l,httpStatusCode:d})),function(e){return e instanceof ei.NetworkOrCORSError}(e)&&!c&&(c=this.getErrorPayloadForClientErrorCode({clientErrorCode:1026,serviceErrorCode:v,payloadOverrides:e.payloadOverrides,rawErrorMessage:l,httpStatusCode:d})),function(e){return e instanceof ei.Unauthorized}(e)&&!c&&(c=this.getErrorPayloadForClientErrorCode({clientErrorCode:1010,serviceErrorCode:v,payloadOverrides:e.payloadOverrides,rawErrorMessage:l,httpStatusCode:d})),c||(c=this.getErrorPayloadForClientErrorCode({clientErrorCode:9999,serviceErrorCode:v||9999,serviceErrorName:null==e?void 0:e.name,payloadOverrides:e.payloadOverrides,rawErrorMessage:l,httpStatusCode:d})),this.eventErrorCache.set(e,c),[c,!1]}},{key:"createCommonEventObjectInMeeting",value:function(e){var t,r,n,i,o,a=e.name,s=e.options,c=e.eventType,u=void 0===c?"client":c,l=s.meetingId,d=s.mediaConnections,f=s.globalMeetingId,h=s.webexConferenceIdStr,p=s.sessionCorrelationId,v=this.webex.meetings.getBasicMeetingInformation(l);if(!v)return console.warn("Attempt to send common event but no meeting was found...","name: ".concat(a,", meetingId: ").concat(l)),void this.webex.internal.metrics.submitClientMetrics("feature"===u?"js_sdk_call_feature_event_failed_to_send":wc,{fields:{meetingId:l,name:a}});var m=Xc(Xc(Xc({name:a,canProceed:!0,identifiers:this.getIdentifiers({meeting:v,mediaConnections:(null==v?void 0:v.mediaConnections)||d,webexConferenceIdStr:h,globalMeetingId:f,sessionCorrelationId:p}),eventData:{webClientDomain:window.location.hostname},userType:v.getCurUserType(),loginType:"loginType"in v.callStateForMetrics?v.callStateForMetrics.loginType:this.getCurLoginType(),isConvergedArchitectureEnabled:this.getIsConvergedArchitectureEnabled({meetingId:l})},v.userNameInput&&{userNameInput:v.userNameInput}),v.emailInput&&{emailInput:v.emailInput}),{},{webexSubServiceType:this.getSubServiceType(v),webClientPreload:null===(t=this.webex.meetings)||void 0===t||null===(r=t.config)||void 0===r||null===(n=r.metrics)||void 0===n?void 0:n.webClientPreload}),g=null!==(i=s.joinFlowVersion)&&void 0!==i?i:null===(o=v.callStateForMetrics)||void 0===o?void 0:o.joinFlowVersion;g&&(m.joinFlowVersion=g);var y=v.isoLocalClientMeetingJoinTime;return y&&(m.meetingJoinedTime=y),s.meetingJoinPhase&&(m.meetingJoinPhase=s.meetingJoinPhase),m}},{key:"createClientEventObjectInMeeting",value:function(e){var t=e.name,r=e.options,n=e.errors,i=this.createCommonEventObjectInMeeting({name:t,options:r,eventType:"client"});if(i)return Xc(Xc({},i),{},{errors:n,eventData:Xc(Xc({},i.eventData),{},{isMercuryConnected:this.isMercuryConnected})})}},{key:"createFeatureEventObjectInMeeting",value:function(e){var t=e.name,r=e.options,n=this.createCommonEventObjectInMeeting({name:t,options:r,eventType:"feature"});if(n)return Xc(Xc({},n),{},{key:"UcfFeatureUsage"})}},{key:"createClientEventObjectPreMeeting",value:function(e){var t,r,n,i=e.name,o=e.options,a=e.errors,s=o.correlationId,c=o.globalMeetingId,u=o.webexConferenceIdStr,l=o.preLoginId,d=o.sessionCorrelationId,f={name:i,errors:a,canProceed:!0,identifiers:this.getIdentifiers({correlationId:s,sessionCorrelationId:d,preLoginId:l,globalMeetingId:c,webexConferenceIdStr:u}),eventData:{webClientDomain:window.location.hostname,isMercuryConnected:this.isMercuryConnected},loginType:this.getCurLoginType(),webClientPreload:null===(t=this.webex.meetings)||void 0===t||null===(r=t.config)||void 0===r||null===(n=r.metrics)||void 0===n?void 0:n.webClientPreload};return o.joinFlowVersion&&(f.joinFlowVersion=o.joinFlowVersion),o.meetingJoinPhase&&(f.meetingJoinPhase=o.meetingJoinPhase),o.userNameInput&&(f.userNameInput=o.userNameInput),o.emailInput&&(f.emailInput=o.emailInput),f}},{key:"prepareClientEvent",value:function(e){var t,n=e.name,i=e.payload,o=e.options,a=o.meetingId,s=o.correlationId,c=o.rawError,u=[];if(c){var l=lo(this.generateClientEventErrorPayload(c),2),d=l[0],f=l[1];d&&u.push(d),this.logger.log(za,"CallDiagnosticMetrics: @prepareClientEvent. Generated errors:","generatedError (cached: ".concat(f,"): ").concat(Cr()(d)))}if(a)t=this.createClientEventObjectInMeeting({name:n,options:o,errors:u});else{if(!s)throw new Error("Not implemented");t=this.createClientEventObjectPreMeeting({name:n,options:o,errors:u})}return t=r()(t,i),this.prepareDiagnosticEvent(t,o)}},{key:"submitClientEvent",value:function(e){var t=e.name,r=e.payload,n=e.options;if(e.delaySubmitEvent){var i=Xc(Xc({},n),{},{triggeredTime:(new Date).toISOString()});return this.delayedClientEvents.push({name:t,payload:r,options:i}),p().resolve()}this.logger.log(za,"CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.","name: ".concat(t));var o=this.prepareClientEvent({name:t,payload:r,options:n});return null!=n&&n.preLoginId?this.submitToCallDiagnosticsPreLogin(o,null==n?void 0:n.preLoginId):(this.validator({type:"ce",event:o}),this.submitToCallDiagnostics(o))}},{key:"submitDelayedClientEvents",value:function(e){var t=this;if(this.logger.log(za,"CallDiagnosticMetrics: @submitDelayedClientEvents. Submitting delayed client events."),0===this.delayedClientEvents.length)return p().resolve();var r=this.delayedClientEvents.map((function(r){var n=r.name,i=r.payload,o=Xc(Xc({},r.options),e);return t.submitClientEvent({name:n,payload:i,options:o})}));return this.delayedClientEvents=[],p().all(r)}},{key:"submitDelayedClientFeatureEvents",value:function(e){var t=this;if(this.logger.log(Ha,"CallDiagnosticMetrics: @submitDelayedClientFeatureEvents. Submitting delayed feature events."),0===this.delayedClientFeatureEvents.length)return p().resolve();var r=this.delayedClientFeatureEvents.map((function(r){var n=r.name,i=r.payload,o=Xc(Xc({},r.options),e);return t.submitFeatureEvent({name:n,payload:i,options:o})}));return this.delayedClientFeatureEvents=[],p().all(r)}},{key:"submitToCallDiagnostics",value:function(e){var t={eventPayload:e,type:["diagnostic-event"]};return this.callDiagnosticEventsBatcher.request(t)}},{key:"buildClientEventFetchRequestOptions",value:(t=_e(Re().mark((function e(t){var r,n,i,o,a,s;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.name,n=t.payload,i=t.options,this.logger.log(za,"CallDiagnosticMetrics: @buildClientEventFetchRequestOptions. Building request options object for fetch()...","name: ".concat(r)),o=this.prepareClientEvent({name:r,payload:n,options:i}),a=Lc(this.webex,{eventPayload:o,type:["diagnostic-event"]}),s={method:"POST",service:"metrics",resource:"clientmetrics",body:{metrics:[a]},headers:{},waitForServiceTimeout:this.webex.internal.metrics.config.waitForServiceTimeout},i.preLoginId&&(s.headers={authorization:!1,"x-prelogin-userid":i.preLoginId},s.resource="clientmetrics-prelogin"),e.abrupt("return",this.webex.prepareFetchOptions(s));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"isServiceErrorExpected",value:function(e){var t=_c[Sc[e]];return"expected"===(null==t?void 0:t.category)}},{key:"setDeviceInfo",value:function(e){this.logger.log("CallDiagnosticMetrics: @setDeviceInfo called",e),this.device=e}}]),i}(ka);function ou(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var au=Vt(),su=au.getOSVersion,cu=au.getBrowserName,uu=au.getBrowserVersion,lu=function(e){Je(n,e);var t=ou(n);function n(){var e;ne(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return C(Ye(e=t.call.apply(t,[this].concat(i))),"clientMetricsBatcher",void 0),C(Ye(e),"logger",void 0),C(Ye(e),"device",void 0),C(Ye(e),"version",void 0),C(Ye(e),"deviceId",""),e.logger=e.webex.logger,e.clientMetricsBatcher=new ja({},{parent:e.webex}),e.device=e.webex.internal.device,e.version=e.webex.version,e}return oe(n,[{key:"submitEvent",value:function(e){var t=e.kind,r=e.name,n=e.event;return this.logger.log(t,"@submitEvent. Submit event: ".concat(r)),this.clientMetricsBatcher.request(n)}},{key:"getDeviceId",value:function(){if(""===this.deviceId){var e=this.device.url;if(e&&0!==e.length){var t=e.lastIndexOf("/");-1!==t&&(this.deviceId=e.substring(t+1))}}return this.deviceId}},{key:"getContext",value:function(){return{app:{version:this.version},device:{id:this.getDeviceId()},locale:window.navigator.language,os:{name:Hc(),version:su()}}}},{key:"getBrowserDetails",value:function(){return{browser:cu(),browserHeight:window.innerHeight,browserVersion:uu(),browserWidth:window.innerWidth,domain:window.location.hostname,inIframe:window.self!==window.top,locale:window.navigator.language,os:Hc()}}},{key:"isReadyToSubmitEvents",value:function(){var e=this.getDeviceId();return e&&0!==e.length}},{key:"createTaggedEventObject",value:function(e){var t=e.type,n=e.name,i=e.payload;return i=r()(i,this.getBrowserDetails()),{context:this.getContext(),metricName:n,tags:i,timestamp:Ln()(),type:t}}}]),n}(ka);function du(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var fu=function(e){Je(r,e);var t=du(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"submitBehavioralEvent",value:function(e){var t=e.product,r=e.agent,n=e.target,i=e.verb,o=e.payload,a="".concat(t,".").concat(r,".").concat(n,".").concat(i),s=this.createTaggedEventObject({type:["behavioral"],name:a,payload:o});this.submitEvent({kind:"behavioral-events -> ",name:a,event:s})}}]),r}(lu);function hu(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var pu=function(e){Je(r,e);var t=hu(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"submitOperationalEvent",value:function(e){var t=e.name,r=e.payload,n=this.createTaggedEventObject({type:["operational"],name:t,payload:r});this.submitEvent({kind:"operational-events -> ",name:t,event:n})}}]),r}(lu);function vu(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function mu(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vu(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):vu(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}function gu(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var yu=function(e){Je(r,e);var t=gu(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"buildEvent",value:function(e){var t=e.name,r=e.payload,n=e.metadata;return{type:["business"],eventPayload:mu(mu({key:t,client_timestamp:(new Date).toISOString()},n),{},{value:r})}}},{key:"submitBusinessEvent",value:function(e){var t=e.name,r=e.payload,n=e.table,i=e.metadata;switch(n||(n="default"),i||(i={}),i.appType||(i.appType="Web Client"),n){case"wbxapp_callend_metrics":var o=this.buildEvent({name:"callEnd",payload:r,metadata:i});return this.submitEvent({kind:"business-events:wbxapp_callend_metrics -> ",name:"wbxapp_callend_metrics",event:o});case"business_metrics":var a=this.buildEvent({name:t,payload:mu(mu(mu({},this.getContext()),this.getBrowserDetails()),r),metadata:i});return this.submitEvent({kind:"business-events:business_metrics -> ",name:t,event:a});default:var s=this.buildEvent({name:t,payload:r,metadata:mu({context:this.getContext(),browserDetails:this.getBrowserDetails()},i)});return this.submitEvent({kind:"business-events:default -> ",name:t,event:s})}}}]),r}(lu);function bu(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var Eu=function(e){Je(r,e);var t=bu(r);function r(){var e;ne(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return C(Ye(e=t.call.apply(t,[this].concat(i))),"latencyTimestamps",void 0),C(Ye(e),"precomputedLatencies",void 0),C(Ye(e),"meetingId",void 0),e.latencyTimestamps=new(V()),e.precomputedLatencies=new(V()),e}return oe(r,[{key:"clearTimestamps",value:function(){this.latencyTimestamps.clear(),this.precomputedLatencies.clear()}},{key:"setMeetingId",value:function(e){this.meetingId=e}},{key:"getMeeting",value:function(){if(this.meetingId)return this.webex.meetings.getBasicMeetingInformation(this.meetingId)}},{key:"saveTimestamp",value:function(e){var t=e.key,r=e.value,n=void 0===r?(new Date).getTime():r,i=e.options,o=(void 0===i?{}:i).meetingId;o&&this.setMeetingId(o),"client.media.rx.start"===t||"client.media.tx.start"===t||"internal.client.meetinginfo.request"===t||"internal.client.meetinginfo.response"===t||"client.media-engine.remote-sdp-received"===t?this.saveFirstTimestampOnly(t,n):(this.latencyTimestamps.set(t,n),"client.media-engine.local-sdp-generated"===t&&this.latencyTimestamps.delete("client.media-engine.remote-sdp-received"))}},{key:"saveLatency",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&this.precomputedLatencies.get(e)||0;this.precomputedLatencies.set(e,t+r)}},{key:"measureLatency",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=performance.now();return e().finally((function(){r.saveLatency(t,performance.now()-i,n)}))}},{key:"saveFirstTimestampOnly",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(new Date).getTime();this.latencyTimestamps.has(e)||this.latencyTimestamps.set(e,t)}},{key:"getDiffBetweenTimestamps",value:function(e,t){var r=this.latencyTimestamps.get(e),n=this.latencyTimestamps.get(t);if("number"==typeof r&&"number"==typeof n)return n-r}},{key:"getMeetingInfoReqResp",value:function(){return this.getDiffBetweenTimestamps("internal.client.meetinginfo.request","internal.client.meetinginfo.response")}},{key:"getShowInterstitialTime",value:function(){return this.getDiffBetweenTimestamps("client.interstitial-window.start-launch","internal.client.interstitial-window.click.joinbutton")}},{key:"getU2CTime",value:function(){var e=this.precomputedLatencies.get("internal.get.u2c.time");return"number"==typeof e?Math.floor(e):void 0}},{key:"getRegisterWDMDeviceJMT",value:function(){return this.getDiffBetweenTimestamps("internal.register.device.request","internal.register.device.response")}},{key:"getCallInitJoinReq",value:function(){return this.getDiffBetweenTimestamps("internal.client.interstitial-window.click.joinbutton","client.locus.join.request")}},{key:"getJoinReqResp",value:function(){return this.getDiffBetweenTimestamps("client.locus.join.request","client.locus.join.response")}},{key:"getTurnDiscoveryTime",value:function(){return this.getDiffBetweenTimestamps("internal.client.add-media.turn-discovery.start","internal.client.add-media.turn-discovery.end")}},{key:"getLocalSDPGenRemoteSDPRecv",value:function(){return this.getDiffBetweenTimestamps("client.media-engine.local-sdp-generated","client.media-engine.remote-sdp-received")}},{key:"getICESetupTime",value:function(){return this.getDiffBetweenTimestamps("client.ice.start","client.ice.end")}},{key:"getAudioICESetupTime",value:function(){return this.getDiffBetweenTimestamps("client.ice.start","client.ice.end")}},{key:"getVideoICESetupTime",value:function(){return this.getDiffBetweenTimestamps("client.ice.start","client.ice.end")}},{key:"getShareICESetupTime",value:function(){return this.getDiffBetweenTimestamps("client.ice.start","client.ice.end")}},{key:"getStayLobbyTime",value:function(){return this.getDiffBetweenTimestamps("client.locus.join.response","internal.host.meeting.participant.admitted")}},{key:"getPageJMT",value:function(){var e=this.precomputedLatencies.get("internal.client.pageJMT");return"number"==typeof e?e:void 0}},{key:"getDownloadTimeJMT",value:function(){var e=this.precomputedLatencies.get("internal.download.time");return"number"==typeof e?e:void 0}},{key:"getClickToInterstitial",value:function(){if(this.latencyTimestamps.get("internal.client.meeting.click.joinbutton"))return this.getDiffBetweenTimestamps("internal.client.meeting.click.joinbutton","internal.client.meeting.interstitial-window.showed");var e=this.precomputedLatencies.get("internal.click.to.interstitial");return"number"==typeof e?e:void 0}},{key:"getClickToInterstitialWithUserDelay",value:function(){if(this.latencyTimestamps.get("internal.client.meeting.click.joinbutton"))return this.getDiffBetweenTimestamps("internal.client.meeting.click.joinbutton","internal.client.meeting.interstitial-window.showed");var e=this.precomputedLatencies.get("internal.click.to.interstitial.with.user.delay");return"number"==typeof e?e:void 0}},{key:"getInterstitialToJoinOK",value:function(){return this.getDiffBetweenTimestamps("internal.client.interstitial-window.click.joinbutton","client.locus.join.response")}},{key:"getCallInitMediaEngineReady",value:function(){return this.getDiffBetweenTimestamps("internal.client.interstitial-window.click.joinbutton","client.media-engine.ready")}},{key:"getInterstitialToMediaOKJMT",value:function(){var e=this.latencyTimestamps.get("internal.client.interstitial-window.click.joinbutton"),t=this.latencyTimestamps.get("client.ice.end"),r=this.getStayLobbyTime();if(e&&t)return t-e-("number"==typeof r?r:0)}},{key:"getTotalJMT",value:function(){var e=this.getClickToInterstitial(),t=this.getInterstitialToJoinOK();if("number"==typeof e&&"number"==typeof t)return e+t}},{key:"getTotalJMTWithUserDelay",value:function(){var e=this.getClickToInterstitialWithUserDelay(),t=this.getInterstitialToJoinOK();if("number"==typeof e&&"number"==typeof t)return e+t}},{key:"getJoinConfJMT",value:function(){var e=this.getJoinReqResp(),t=this.getICESetupTime();if(e&&t)return e+t}},{key:"getTotalMediaJMT",value:function(){var e=this.getClickToInterstitial(),t=this.getInterstitialToJoinOK(),r=this.getJoinConfJMT(),n=this.getStayLobbyTime();if(e&&t&&r){var i,o=e+t+r;return null!==(i=this.getMeeting())&&void 0!==i&&i.allowMediaInLobby?o:o-n}}},{key:"getTotalMediaJMTWithUserDelay",value:function(){var e=this.getClickToInterstitialWithUserDelay(),t=this.getInterstitialToJoinOK(),r=this.getJoinConfJMT();if(e&&t&&r)return e+t+r}},{key:"getClientJMT",value:function(){var e=this.getInterstitialToJoinOK(),t=this.getJoinConfJMT();if("number"==typeof e&&"number"==typeof t)return e-t}},{key:"getAudioJoinRespRxStart",value:function(){return this.getDiffBetweenTimestamps("client.locus.join.response","client.media.rx.start")}},{key:"getVideoJoinRespRxStart",value:function(){return this.getDiffBetweenTimestamps("client.locus.join.response","client.media.rx.start")}},{key:"getReachabilityClustersReqResp",value:function(){var e=this.precomputedLatencies.get("internal.get.cluster.time");return"number"==typeof e?Math.floor(e):void 0}},{key:"getAudioJoinRespTxStart",value:function(){return this.getDiffBetweenTimestamps("client.locus.join.response","client.media.tx.start")}},{key:"getVideoJoinRespTxStart",value:function(){return this.getDiffBetweenTimestamps("client.locus.join.response","client.media.tx.start")}},{key:"getExchangeCITokenJMT",value:function(){var e=this.precomputedLatencies.get("internal.exchange.ci.token.time");return"number"==typeof e?Math.floor(e):void 0}},{key:"getRefreshCaptchaReqResp",value:function(){var e=this.precomputedLatencies.get("internal.refresh.captcha.time");return"number"==typeof e?Math.floor(e):void 0}},{key:"getDownloadIntelligenceModelsReqResp",value:function(){var e=this.precomputedLatencies.get("internal.api.fetch.intelligence.models");return"number"==typeof e?Math.floor(e):void 0}},{key:"getOtherAppApiReqResp",value:function(){var e=this.precomputedLatencies.get("internal.other.app.api.time");return e>0?Math.floor(e):void 0}}]),r}(dr);function Su(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var _u=function(e){Je(n,e);var t,r=Su(n);function n(){var e;ne(this,n);for(var t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];return C(Ye(e=r.call.apply(r,[this].concat(i))),"callDiagnosticLatencies",void 0),C(Ye(e),"callDiagnosticMetrics",void 0),C(Ye(e),"behavioralMetrics",void 0),C(Ye(e),"operationalMetrics",void 0),C(Ye(e),"businessMetrics",void 0),C(Ye(e),"isReady",!1),C(Ye(e),"delaySubmitClientEvents",!1),C(Ye(e),"delaySubmitClientFeatureEvents",!1),C(Ye(e),"delayedClientEventsOverrides",{}),C(Ye(e),"delayedClientFeatureEventsOverrides",{}),e.callDiagnosticLatencies=new Eu({},{parent:e.webex}),e.onReady(),e}return oe(n,[{key:"onReady",value:function(){var e=this;this.webex.once("ready",(function(){e.callDiagnosticMetrics=new iu({},{parent:e.webex}),e.isReady=!0,e.setDelaySubmitClientEvents({shouldDelay:e.delaySubmitClientEvents,overrides:e.delayedClientEventsOverrides})}))}},{key:"submitInternalEvent",value:function(e){var t=e.name;e.payload,e.options;"internal.reset.join.latencies"===t?this.callDiagnosticLatencies.clearTimestamps():this.callDiagnosticLatencies.saveTimestamp({key:t})}},{key:"lazyBuildBehavioralMetrics",value:function(){this.isReady&&!this.behavioralMetrics&&(this.behavioralMetrics=new fu({},{parent:this.webex}))}},{key:"lazyBuildOperationalMetrics",value:function(){this.isReady&&!this.operationalMetrics&&(this.operationalMetrics=new pu({},{parent:this.webex}))}},{key:"lazyBuildBusinessMetrics",value:function(){this.isReady&&!this.businessMetrics&&(this.businessMetrics=new yu({},{parent:this.webex}))}},{key:"isReadyToSubmitBehavioralEvents",value:function(){var e,t;return this.lazyBuildBehavioralMetrics(),null!==(e=null===(t=this.behavioralMetrics)||void 0===t?void 0:t.isReadyToSubmitEvents())&&void 0!==e&&e}},{key:"isReadyToSubmitOperationalEvents",value:function(){var e,t;return this.lazyBuildOperationalMetrics(),null!==(e=null===(t=this.operationalMetrics)||void 0===t?void 0:t.isReadyToSubmitEvents())&&void 0!==e&&e}},{key:"isReadyToSubmitBusinessEvents",value:function(){var e,t;return this.lazyBuildBusinessMetrics(),null!==(e=null===(t=this.businessMetrics)||void 0===t?void 0:t.isReadyToSubmitEvents())&&void 0!==e&&e}},{key:"submitBehavioralEvent",value:function(e){var t=e.product,r=e.agent,n=e.target,i=e.verb,o=e.payload;return this.isReady?(this.lazyBuildBehavioralMetrics(),this.behavioralMetrics.submitBehavioralEvent({product:t,agent:r,target:n,verb:i,payload:o})):(this.webex.logger.log("NewMetrics: @submitBehavioralEvent. Attempted to submit before webex.ready: ".concat(t,".").concat(r,".").concat(n,".").concat(i)),p().resolve())}},{key:"submitOperationalEvent",value:function(e){var t=e.name,r=e.payload;return this.isReady?(this.lazyBuildOperationalMetrics(),this.operationalMetrics.submitOperationalEvent({name:t,payload:r})):(this.webex.logger.log("NewMetrics: @submitOperationalEvent. Attempted to submit before webex.ready: ".concat(t)),p().resolve())}},{key:"submitBusinessEvent",value:function(e){var t=e.name,r=e.payload,n=e.table,i=e.metadata;return this.isReady?(this.lazyBuildBusinessMetrics(),this.businessMetrics.submitBusinessEvent({name:t,payload:r,table:n,metadata:i})):(this.webex.logger.log("NewMetrics: @submitBusinessEvent. Attempted to submit before webex.ready: ".concat(t)),p().resolve())}},{key:"submitMQE",value:function(e){var t=e.name,r=e.payload,n=e.options;this.callDiagnosticLatencies.saveTimestamp({key:t}),this.callDiagnosticMetrics.submitMQE({name:t,payload:r,options:n})}},{key:"submitFeatureEvent",value:function(e){var t=e.name,r=e.payload,n=e.options;return this.callDiagnosticLatencies&&this.callDiagnosticMetrics?(this.callDiagnosticLatencies.saveTimestamp({key:t,options:{meetingId:null==n?void 0:n.meetingId}}),this.callDiagnosticMetrics.submitFeatureEvent({name:t,payload:r,options:n,delaySubmitEvent:this.delaySubmitClientFeatureEvents})):(this.webex.logger.log("NewMetrics: @submitFeatureEvent. Attempted to submit before webex.ready. Event name: ".concat(t)),p().resolve())}},{key:"submitClientEvent",value:function(e){var t=e.name,r=e.payload,n=e.options;return this.callDiagnosticLatencies&&this.callDiagnosticMetrics?(this.callDiagnosticLatencies.saveTimestamp({key:t,options:{meetingId:null==n?void 0:n.meetingId}}),this.callDiagnosticMetrics.submitClientEvent({name:t,payload:r,options:n,delaySubmitEvent:this.delaySubmitClientEvents})):(this.webex.logger.log("NewMetrics: @submitClientEvent. Attempted to submit before webex.ready. Event name: ".concat(t)),p().resolve())}},{key:"clientMetricsAliasUser",value:function(e){var t=this;return this.webex.request({method:"POST",api:"metrics",resource:"clientmetrics",headers:{"x-prelogin-userid":e},body:{},qs:{alias:!0}}).then((function(e){return t.webex.logger.log("NewMetrics: @clientMetricsAliasUser. Request successful."),e})).catch((function(e){return t.logger.error("NewMetrics: @clientMetricsAliasUser. Request failed:","err: ".concat(Mc(e))),p().reject(e)}))}},{key:"buildClientEventFetchRequestOptions",value:(t=_e(Re().mark((function e(t){var r,n,i;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.name,n=t.payload,i=t.options,e.abrupt("return",this.callDiagnosticMetrics.buildClientEventFetchRequestOptions({name:r,payload:n,options:i}));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"setMetricTimingsAndFetch",value:function(e){return this.webex.setTimingsAndFetch(function(e){if(e.body&&e.json){var t,r=JSON.parse(e.body),n=(new Date).toISOString();null===(t=r.metrics)||void 0===t||t.forEach((function(e){e.eventPayload&&(e.eventPayload.originTime={triggered:n,sent:n})})),e.body=Cr()(r)}return e}(e))}},{key:"isServiceErrorExpected",value:function(e){return this.callDiagnosticMetrics.isServiceErrorExpected(e)}},{key:"setDelaySubmitClientEvents",value:function(e){var t=e.shouldDelay,r=e.overrides;return this.delaySubmitClientEvents=t,this.delayedClientEventsOverrides=r||{},this.isReady&&!t?this.callDiagnosticMetrics.submitDelayedClientEvents(r):p().resolve()}},{key:"setDelaySubmitClientFeatureEvents",value:function(e){var t=e.shouldDelay,r=e.overrides;return this.delaySubmitClientFeatureEvents=t,this.delayedClientFeatureEventsOverrides=r||{},this.isReady&&!t?this.callDiagnosticMetrics.submitDelayedClientFeatureEvents(r):p().resolve()}}]),n}(dr);C(_u,"instance",void 0);const wu=_u;var Ru="FFB51ED5-4319-4C55-8303-B1F2FCCDE231",Cu=function(){function e(t,r,n){var i=r.meetingId,o=r.callId;ne(this,e),C(this,"metricsQueue",[]),C(this,"intervalId",void 0),C(this,"webex",void 0),C(this,"meetingId",void 0),C(this,"callId",void 0),C(this,"correlationId",void 0),C(this,"connectionId",void 0),C(this,"shouldSendMetricsOnNextStatsReport",void 0),this.intervalId=window.setInterval(this.sendMetricsInQueue.bind(this),3e4),this.meetingId=i,this.callId=o,this.webex=t,this.correlationId=n,this.resetConnection()}return oe(e,[{key:"updateCallId",value:function(e){this.callId=e}},{key:"sendMetricsInQueue",value:function(){this.metricsQueue.length&&(this.sendMetrics(),this.metricsQueue=[])}},{key:"sendNextMetrics",value:function(){this.shouldSendMetricsOnNextStatsReport=!0}},{key:"addMetrics",value:function(e){if(e.payload.length){"stats-report"===e.name&&(e.payload=e.payload.map(this.anonymizeIp)),this.metricsQueue.push(e),this.shouldSendMetricsOnNextStatsReport&&"stats-report"===e.name&&(this.sendMetricsInQueue(),this.shouldSendMetricsOnNextStatsReport=!1);try{var t=function(e){try{return e&&e[0]?JSON.parse(e[0]):null}catch(e){return null}}(e.payload);"onconnectionstatechange"===e.name&&t&&"failed"===t.value&&(this.sendMetricsInQueue(),this.resetConnection())}catch(e){console.error(e)}}}},{key:"closeMetrics",value:function(){this.sendMetricsInQueue(),clearInterval(this.intervalId)}},{key:"anonymizeIp",value:function(e){var t=JSON.parse(e);return"local-candidate"!==t.type&&"remote-candidate"!==t.type||(t.ip=Ic(t.ip)||void 0,t.address=Ic(t.address)||void 0,t.relatedAddress=Ic(t.relatedAddress)||void 0),Cr()(t)}},{key:"resetConnection",value:function(){this.connectionId=kn().v4(),this.shouldSendMetricsOnNextStatsReport=!0}},{key:"sendMetrics",value:function(){var e={type:"webrtc",version:"1.1.0",userId:this.webex.internal.device.userId,correlationId:this.correlationId,connectionId:this.connectionId,data:this.metricsQueue};this.meetingId?e.meetingId=this.meetingId:this.callId&&(e.callId=this.callId),this.webex.request({method:"POST",service:"unifiedTelemetry",resource:"metric/v2",headers:{type:"webrtcMedia",appId:Ru},body:{metrics:[e]}})}}]),e}();Di("metrics",$c,{config:La}),Di("newMetrics",wu,{config:La});var Tu=__webpack_require__(75472),xu=__webpack_require__.n(Tu);const ku="JS_SDK_WDM_REGISTRATION_SUCCESSFUL",Iu="JS_SDK_WDM_REGISTRATION_FAILED";var Au="cisco-device-url",Ou=["developer","entitlement","user"],Lu="boolean",Mu="number",Nu="string",Pu="registration:success";function Du(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}var Fu=y().extend({idAttribute:"key",props:{key:"string",lastModified:"date",mutable:"boolean",type:"string",val:"string",value:"any"},constructor:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return je()(t,{parse:!0}),f()(y().prototype.constructor,this,[e,t])},parse:function(e){if(!e||"object"!==_(e))return{};var t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Du(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):Du(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}({},e),r=t.val;return Sn()(Number(r))?"string"==typeof r&&"true"===r.toLowerCase()?(t.type=Lu,t.value=!0):"string"==typeof r&&"false"===r.toLowerCase()?(t.type=Lu,t.value=!1):(t.type=Nu,t.value=r):(t.type=Mu,t.value=Number(r)),t},serialize:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=f()(y().prototype.serialize,this,t);return n.lastModified&&(n.lastModified=new Date(n.lastModified).toISOString()),n},set:function(e,t,r){var n,i;return a()(e)||null===e?(n=e,i=t):((n={})[e]=t,i=r),n=this.parse(n,i),f()(y().prototype.set,this,[n,i])}});const Uu=Fu;const ju=yo().extend({mainIndex:"key",model:Uu});const Bu=y().extend({collections:{developer:ju,entitlement:ju,user:ju},clear:function(e){var t=this;return l()(this.attributes).forEach((function(r){t.unset(r,e)})),l()(this._children).forEach((function(e){t[e].clear()})),l()(this._collections).forEach((function(e){t[e].reset()})),this},initialize:function(){var e=this;["change:value","add","remove"].forEach((function(t){Ou.forEach((function(r){e[r].on(t,(function(t,n){e.trigger("change:".concat(r),e,e[r],n)}))}))}))}});var qu="initial",Vu="in-progress",Gu="idle",Wu=dr.extend({idAttribute:"IpNetworkDetectorId",namespace:"Device",props:{firstIpV4:["number",!0,-1],firstIpV6:["number",!0,-1],firstMdns:["number",!0,-1],totalTime:["number",!0,-1],state:["string",!0,qu],pendingDetection:["object",!1,void 0]},derived:{supportsIpV4:{deps:["firstIpV4","firstIpV6","firstMdns","totalTime"],fn:function(){return this.firstIpV4>=0||!!(this.totalTime<0||this.receivedOnlyMDnsCandidates())&&void 0}},supportsIpV6:{deps:["firstIpV4","firstIpV6","firstMdns","totalTime"],fn:function(){return this.firstIpV6>=0||!!(this.totalTime<0||this.receivedOnlyMDnsCandidates())&&void 0}}},receivedOnlyMDnsCandidates:function(){return this.totalTime>=0&&this.firstMdns>=0&&this.firstIpV4<0&&this.firstIpV6<0},gatherLocalCandidates:function(e){var t=this;return _e(Re().mark((function r(){return Re().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",new(p())((function(r,n){var i=!1;t.firstIpV4=-1,t.firstIpV6=-1,t.firstMdns=-1,t.totalTime=-1;var o=performance.now(),a=function(){i||(i=!0,t.totalTime=performance.now()-o,r())};e.onicecandidate=function(e){var n;null!==(n=e.candidate)&&void 0!==n&&n.address?(e.candidate.address.endsWith(".local")?-1===t.firstMdns&&(t.firstMdns=performance.now()-o):e.candidate.address.includes(":")?-1===t.firstIpV6&&(t.firstIpV6=performance.now()-o):-1===t.firstIpV4&&(t.firstIpV4=performance.now()-o),t.firstIpV4>=0&&t.firstIpV6>=0&&r()):null===e.candidate&&a()},e.onicegatheringstatechange=function(){"complete"===e.iceGatheringState&&a()},e.createDataChannel("data"),e.createOffer().then((function(t){return e.setLocalDescription(t)})).catch((function(e){t.webex.logger.error("Failed to detect ip network version:",e),n(e)}))})));case 1:case"end":return r.stop()}}),r)})))()},detect:function(){var e=arguments,t=this;return _e(Re().mark((function r(){var n,i,o;return Re().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n=e.length>0&&void 0!==e[0]&&e[0],t.state!==Vu){r.next=4;break}return t.pendingDetection={force:n},r.abrupt("return");case 4:if(n||t.state===qu||t.receivedOnlyMDnsCandidates()){r.next=6;break}return r.abrupt("return");case 6:return r.prev=6,t.state=Vu,i=new RTCPeerConnection,r.next=11,t.gatherLocalCandidates(i);case 11:r.sent;case 12:return r.prev=12,i.close(),t.state=Gu,r.finish(12);case 16:t.pendingDetection&&(o=t.pendingDetection.force,t.pendingDetection=void 0,t.detect(o));case 17:case"end":return r.stop()}}),r,null,[[6,,12,16]])})))()},version:"0.0.0-next"});const zu=Wu;var Hu,Ku,$u,Ju,Yu,Qu,Xu,Zu=function(e){return e.all="all",e.features="features",e.websocket="websocket",e.none="none",e}({});function el(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function tl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?el(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):el(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}var rl=dr.extend((Hu=$t("@"),Ku=$t("@"),$u=$t("@"),Ju=$t("@"),Yu=Nt("device#markUrlFailedAndGetNew(): Use services#markFailedUrl()"),Qu=zt("@",(function(){return!this.config.ephemeral})),Xu={namespace:"Device",extraProperties:"allow",idAttribute:"url",children:{features:Bu,ipNetworkDetector:zu},props:{clientMessagingGiphy:"string",customerCompanyName:"string",customerLogoUrl:"string",deviceType:"string",helpUrl:"string",intranetInactivityDuration:"number",intranetInactivityCheckUrl:"string",inNetworkInactivityDuration:"number",ecmEnabledForAllUsers:["boolean",!1,!1],ecmSupportedStorageProviders:["array",!1,function(){return[]}],modificationTime:"string",navigationBarColor:"string",partnerCompanyName:"string",partnerLogoUrl:"string",peopleInsightsEnabled:"boolean",reportingSiteDesc:"string",reportingSiteUrl:"string",searchEncryptionKeyUrl:"string",showSupportText:"boolean",supportProviderCompanyName:"string",supportProviderLogoUrl:"string",url:"string",userId:"string",webFileShareControl:"string",webSocketUrl:"string",whiteboardFileShareControl:"string"},derived:{registered:{deps:["url"],fn:function(){return!!this.url}}},session:{logoutTimer:"any",lastUserActivityDate:"number",isReachabilityChecked:["boolean",!1,!1],energyForecastConfig:"boolean",isInMeeting:"boolean",isInNetwork:"boolean"},meetingStarted:function(){this.webex.trigger("meeting started")},meetingEnded:function(){this.webex.trigger("meeting ended")},setEnergyForecastConfig:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.energyForecastConfig=e},refresh:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.logger.info("device: refreshing"),this.canRegister().then((function(){if(!e.registered)return e.logger.info("device: device not registered, registering"),e.register(t);var r=tl(tl({},e.serialize()),e.config.body?e.config.body:{});delete r.features,delete r.mediaCluster,delete r.etag,e.config.ephemeral&&(r.ttl=e.config.ephemeralDeviceTTL);var n=tl(tl(tl({},e.config.defaults.headers?e.config.defaults.headers:{}),e.config.headers?e.config.headers:{}),e.etag?{"If-None-Match":e.etag}:{}),i=t.includeDetails,o=void 0===i?Zu.all:i,a=kn().v4();return e.set("refresh-request-id",a),e.request({method:"PUT",uri:e.url,body:r,headers:n,qs:{includeUpstreamServices:"".concat(o).concat(e.config.energyForecast&&e.energyForecastConfig?",energyforecast":"")}}).then((function(t){return e.get("refresh-request-id")!==a?(e.logger.info("device: refresh request ID mismatch, ignoring response"),p().resolve()):e.processRegistrationSuccess(t)})).catch((function(r){return 404===r.statusCode?(e.logger.info("device: refresh failed, device is not valid"),e.logger.info("device: attempting to register a new device"),e.clear(),e.register(t)):p().reject(r)}))}))},deleteDevices:function(){var e=this;return this.request({method:"GET",service:"wdm",resource:"devices"}).then((function(t){var r=t.body.devices,n=e._getBody().deviceType,i=r.filter((function(e){return e.deviceType===n})),o=xu()(i,[function(e){return new Date(e.modificationTime)}]);if(o.length>2){var a=o.length,s=Math.ceil(a/3),c=o.slice(0,s).map((function(e){return e.url}));return p().race(c.map((function(t){return e.request({uri:t,method:"DELETE"})})))}return p().resolve()})).catch((function(t){return e.logger.error("Failed to retrieve devices:",t),p().reject(t)}))},register:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.logger.info("device: registering"),this.webex.internal.newMetrics.callDiagnosticMetrics.setDeviceInfo(this),this.canRegister().then((function(){return e.registered?(e.logger.info("device: device already registered, refreshing"),e.refresh(t)):e._registerInternal(t).catch((function(r){var n;if("User has excessive device registrations"===(null==r||null===(n=r.body)||void 0===n?void 0:n.message))return e.deleteDevices().then((function(){return e._registerInternal(t)}));throw r}))}))},_getBody:function(){return tl(tl({},this.config.defaults.body?this.config.defaults.body:{}),this.config.body?this.config.body:{})},_registerInternal:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger.info("device: making registration request");var r=this._getBody(),n=tl(tl({},this.config.defaults.headers?this.config.defaults.headers:{}),this.config.headers?this.config.headers:{});this.config.ephemeral&&(r.ttl=this.config.ephemeralDeviceTTL),this.webex.internal.newMetrics.submitInternalEvent({name:"internal.register.device.request"});var i=t.includeDetails,o=void 0===i?Zu.all:i,a=kn().v4();return this.set("register-request-id",a),this.request({method:"POST",service:"wdm",resource:"devices",body:r,headers:n,qs:{includeUpstreamServices:"".concat(o).concat(this.config.energyForecast&&this.energyForecastConfig?",energyforecast":"")}}).catch((function(t){throw e.webex.internal.newMetrics.submitInternalEvent({name:"internal.register.device.response"}),t})).then((function(t){return e.get("register-request-id")!==a?(e.logger.info("device: register request ID mismatch, ignoring response"),p().resolve()):(e.webex.internal.newMetrics.submitInternalEvent({name:"internal.register.device.response"}),e.webex.internal.metrics.submitClientMetrics(ku),e.processRegistrationSuccess(t))})).catch((function(t){throw e.webex.internal.metrics.submitClientMetrics(Iu,{fields:{error:t}}),t}))},unregister:function(){var e=this;return this.logger.info("device: unregistering"),this.registered?this.request({uri:this.url,method:"DELETE"}).then((function(){return e.clear()})).catch((function(t){throw 404===t.statusCode&&(e.logger.info("device: 404 when deleting device, device is already deleted, clearing device"),e.clear()),t})):(this.logger.warn("device: not registered"),p().resolve())},canRegister:function(){this.logger.info("device: validating if registration can occur");var e=this.webex.internal.services;return e.waitForCatalog("postauth",this.config.canRegisterWaitDuration).then((function(){return e.get("wdm")?p().resolve():p().reject(new Error(["device: cannot register,","'wdm' service is not available from the postauth catalog"].join(" ")))}))},checkNetworkReachability:function(){var e=this;if(this.logger.info("device: checking network reachability"),this.isReachabilityChecked)return p().resolve(this.resetLogoutTimer());if(this.isReachabilityChecked=!0,!this.intranetInactivityCheckUrl)return this.isInNetwork=!1,p().resolve(this.resetLogoutTimer());return this.request({headers:{"cisco-no-http-redirect":null,"spark-user-agent":null,trackingid:null},method:"GET",uri:this.intranetInactivityCheckUrl}).then((function(){return e.isInNetwork=!0,p().resolve(e.resetLogoutTimer())})).catch((function(){return e.logger.info("device: did not reach ping endpoint"),e.logger.info("device: triggering off-network timer"),e.isInNetwork=!1,p().resolve(e.resetLogoutTimer())}))},clear:function(){this.logger.info("device: clearing registered device");for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];f()(dr.prototype.clear,this,t)},getWebSocketUrl:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.logger.info("device: getting the current websocket url");var r=this.webex.internal.services;if(t)return this.waitForRegistration().then((function(){return r.convertUrlToPriorityHostUrl(e.webSocketUrl)})).catch((function(t){return e.logger.warn(t.message),p().reject(new Error("device: failed to get the current websocket url"))}));if(!this.registered)return p().reject(new Error("device: cannot get websocket url, device is not registered"));var n=r.convertUrlToPriorityHostUrl(this.webSocketUrl);return n?p().resolve(n):p().reject(new Error("device: failed to get the current websocket url"))},processRegistrationSuccess:function(e){var t=this;this.logger.info("device: received registration payload");var r=tl({},e.body);delete r.services,delete r.serviceHostMap;var n=(e.headers||{}).etag;if(this.etag&&n&&this.etag===n){var i=r.features;delete r.features,this.features.user.reset(i.user),this.features.entitlement.reset(i.entitlement)}if(this.set(r),this.set({etag:n}),this.config.ephemeral){this.logger.info("device: enqueuing device refresh");var o=1e3*(this.config.ephemeralDeviceTTL/2+60);this.refreshTimer=Hi((function(){return t.refresh()}),o)}this.trigger(Pu,this)},resetLogoutTimer:function(){this.logger.info("device: resetting logout timer"),clearTimeout(this.logoutTimer),this.off("change:lastUserActivityDate"),this.unset("logoutTimer"),!this.isInMeeting&&this.config.enableInactivityEnforcement&&this.isReachabilityChecked&&(this.isInNetwork?this.setLogoutTimer(this.inNetworkInactivityDuration):this.setLogoutTimer(this.intranetInactivityDuration))},setLogoutTimer:function(e){var t=this;this.logger.info("device: setting logout timer"),!e||e<=0||(this.on("change:lastUserActivityDate",(function(){t.resetLogoutTimer()})),this.logoutTimer=Hi((function(){t.webex.logout()}),1e3*e))},waitForRegistration:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.logger.info("device: waiting for registration"),new(p())((function(r,n){e.registered&&r();var i=Hi((function(){return n(new Error("device: timeout occured while waiting for registration"))}),1e3*t);e.once(Pu,(function(){clearTimeout(i),r()}))}))},markUrlFailedAndGetNew:function(e){return p().resolve(this.webex.internal.services.markFailedUrl(e))},initialize:function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];f()(dr.prototype.initialize,this,r),Ou.forEach((function(t){e.features.on("change:".concat(t),(function(t,r,n){e.trigger("change",e,n),e.trigger("change:features",e,e.features,n)}))})),this.on("change:intranetInactivityCheckUrl",(function(){e.checkNetworkReachability()})),this.on("change:intranetInactivityDuration",(function(){e.checkNetworkReachability()})),this.on("change:inNetworkInactivityDuration",(function(){e.checkNetworkReachability()})),this.listenTo(this.webex,"user-activity",(function(){e.lastUserActivityDate=Ln()()})),this.listenTo(this.webex,"meeting started",(function(){e.isInMeeting=!0,e.resetLogoutTimer()})),this.listenTo(this.webex,"meeting ended",(function(){e.isInMeeting=!1,e.resetLogoutTimer()}))},version:"0.0.0-next"},Zt(Xu,"refresh",[he,Hu],Ie()(Xu,"refresh"),Xu),Zt(Xu,"register",[Ku],Ie()(Xu,"register"),Xu),Zt(Xu,"_registerInternal",[he,$u],Ie()(Xu,"_registerInternal"),Xu),Zt(Xu,"unregister",[he,Ju],Ie()(Xu,"unregister"),Xu),Zt(Xu,"markUrlFailedAndGetNew",[Yu],Ie()(Xu,"markUrlFailedAndGetNew"),Xu),Zt(Xu,"initialize",[Qu],Ie()(Xu,"initialize"),Xu),Xu));const nl=rl;function il(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var ol=function(e){Je(r,e);var t=il(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"onRequest",value:function(e){var t=e.headers,r=e.service,n=e.uri,i=this.webex.internal,o=i.device,a=i.services;return!o.url||t&&Au in t&&t[Au]?p().resolve(e):a.waitForService({service:r,url:n}).then((function(t){var r=(a.getServiceFromUrl(t)||{}).name;return r&&!["idbroker","oauth","saml"].includes(r)&&vr()(e,"headers['".concat(Au,"']"),o.url),e})).catch((function(t){return t.message.match(/was not found after waiting/)?e:p().reject(t)}))}}],[{key:"create",value:function(){return new r({webex:this})}}]),r}(Wr),al=__webpack_require__(34155);Di("device",nl,{config:{device:{canRegisterWaitDuration:10,defaults:{body:{name:("string"==typeof al.title?al.title.trim():void 0)||"browser",deviceType:"WEB",model:"web-js-sdk",localizedModel:"webex-js-sdk",systemName:"WEBEX_JS_SDK",systemVersion:"1.0.0"}},enableInactivityEnforcement:!1,ephemeral:!1,ephemeralDeviceTTL:1800,energyForecast:!1},installationId:void 0},interceptors:{DeviceUrlInterceptor:ol.create},onBeforeLogout:function(){return this.unregister()}});var sl,cl,ul,ll=__webpack_require__(43562),dl=__webpack_require__.n(ll),fl=__webpack_require__(34155),hl=__webpack_require__(49704),pl="oauth2-csrf-token",vl=Y.encode(Cr()({})),ml=dr.extend((sl=ze("isAuthorizing"),cl=ze("isAuthorizing"),ul={derived:{isAuthenticating:{deps:["isAuthorizing"],fn:function(){return this.isAuthorizing}}},session:{isAuthorizing:{default:!1,type:"boolean"},ready:{default:!1,type:"boolean"}},namespace:"Credentials",initialize:function(e,t){var r=this,n=f()(dr.prototype.initialize,this,[e,t]);if(!1===e.parse)return this.ready=!0,n;var i=Gi.parse(this.webex.getWindow().location.href,!0);this._checkForErrors(i);var o=i.hash;if(!o)return this.ready=!0,n;o.includes("#")&&(o=o.substr(1)),i.hash=Vi.parse(o),i.hash.state&&(i.hash.state=JSON.parse(Y.decode(i.hash.state)));var a=this._parseHash(i);return a?(this._cleanUrl(i),fl.nextTick((function(){r.webex.credentials.set({supertoken:a}),r.ready=!0})),n):n},initiateLogin:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.state=e.state||{},e.state.csrf_token=this._generateSecurityToken(),"confidential"===this.config.clientType?this.initiateAuthorizationCodeGrant(e):this.initiateImplicitGrant(e)},initiateImplicitGrant:function(e){this.logger.info("authorization: initiating implicit grant flow");var t=this.webex.credentials.buildLoginUrl(tr()({response_type:"token"},e));if(null!=e&&e.separateWindow){var r=tr()({width:600,height:800},"object"===_(e.separateWindow)?e.separateWindow:{}),n=dl()(r).map((function(e){var t=lo(e,2),r=t[0],n=t[1];return"".concat(r,"=").concat(n)})).join(",");this.webex.getWindow().open(t,"_blank",n)}else this.webex.getWindow().location=t;return p().resolve()},initiateAuthorizationCodeGrant:function(e){return this.logger.info("authorization: initiating authorization code grant flow"),this.webex.getWindow().location=this.webex.credentials.buildLoginUrl(tr()({response_type:"code"},e)),p().resolve()},requestAccessTokenFromJwt:function(e){var t=this,r=e.jwt,n=this.webex.internal.services.get("hydra",!0);return n&&"/"!==n.slice(-1)&&(n+="/"),n=n||"https://api.ciscospark.com/v1",this.webex.request({method:"POST",uri:"".concat(n,"jwt/login"),headers:{authorization:r}}).then((function(e){var t=e.body;return{access_token:t.token,token_type:"Bearer",expires_in:t.expiresIn}})).then((function(e){t.webex.credentials.set({supertoken:e})})).then((function(){return t.webex.internal.services.initServiceCatalogs()}))},logout:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.noRedirect||(this.webex.getWindow().location=this.webex.credentials.buildLogoutUrl(e))},createJwt:function(e){return _e(Re().mark((function t(){var r,n,i,o,a,s,c;return Re().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.issuer,n=e.secretId,i=e.displayName,o=e.expiresIn,a=Buffer.from(n,"base64"),s={sub:"guest-user-".concat(kn()()),iss:r,name:i||"Guest User - ".concat(kn()())},"HS256",t.prev=4,c=hl.sign(s,a,{expiresIn:o}),t.abrupt("return",p().resolve({jwt:c}));case 9:return t.prev=9,t.t0=t.catch(4),t.abrupt("return",p().reject(t.t0));case 12:case"end":return t.stop()}}),t,null,[[4,9]])})))()},_checkForErrors:function(e){var t=e.query;if(t&&t.error)throw new(ro.select(t.error))(t)},_cleanUrl:function(e){e=c()(e),this.webex.getWindow().history&&this.webex.getWindow().history.replaceState&&(["access_token","token_type","expires_in","refresh_token","refresh_token_expires_in"].forEach((function(t){return xr()(e.hash,t)})),qi()(e.hash.state)?xr()(e.hash,"state"):(e.hash.state=Y.encode(Cr()(i()(e.hash.state,"csrf_token"))),e.hash.state===vl&&xr()(e.hash,"state")),e.hash=Vi.stringify(e.hash),this.webex.getWindow().history.replaceState({},null,Gi.format(e)))},_generateSecurityToken:function(){this.logger.info("authorization: generating csrf token");var e=kn().v4();return this.webex.getWindow().sessionStorage.setItem("oauth2-csrf-token",e),e},_parseHash:function(e){var t=c()(e.hash);if(t&&this._verifySecurityToken(t),t.access_token)return t.expires_in&&(t.expires_in=jr()(t.expires_in,10)),t.refresh_token_expires_in&&(t.refresh_token_expires_in=jr()(t.refresh_token_expires_in,10)),t;this.ready=!0},_verifySecurityToken:function(e){var t=this.webex.getWindow().sessionStorage.getItem(pl);if(this.webex.getWindow().sessionStorage.removeItem(pl),t){if(!e.state)throw new Error("Expected CSRF token ".concat(t,", but not found in redirect hash"));if(!e.state.csrf_token)throw new Error("Expected CSRF token ".concat(t,", but not found in redirect hash"));var r=e.state.csrf_token;if(r!==t)throw new Error("CSRF token ".concat(r," does not match stored token ").concat(t))}},version:"0.0.0-next"},Zt(ul,"initiateImplicitGrant",[sl],Ie()(ul,"initiateImplicitGrant"),ul),Zt(ul,"initiateAuthorizationCodeGrant",[cl],Ie()(ul,"initiateAuthorizationCodeGrant"),ul),Zt(ul,"requestAccessTokenFromJwt",[he],Ie()(ul,"requestAccessTokenFromJwt"),ul),ul));Pi("authorization",ml,{config:{credentials:{clientType:"public"}},proxies:["isAuthorizing","isAuthenticating"]});var gl=__webpack_require__(43174),yl=__webpack_require__.n(gl),bl=dr.extend({namespace:"Feature",getFeature:function(e,t,r){if("developer"!==e&&"user"!==e&&"entitlement"!==e)return p().reject(new Error("Invalid feature keyType provided. Only `developer`, `user`, and `entitlement` feature toggles are permitted."));r=r||{};var n=this.webex.internal.device.features[e].get(t);return n?r.full?p().resolve(n.serialize()):p().resolve(n.value):p().resolve(null)},updateFeature:function(e){if(e){var t=e.type.toLowerCase();"user"!==t&&"developer"!==t||this.webex.internal.device.features[t].add([e],{merge:!0})}},setFeature:function(e,t,r){var n=this;return"developer"!==e&&"user"!==e?p().reject(new Error("Only `developer` and `user` feature toggles can be set.")):this.request({method:"POST",api:"feature",resource:"features/users/".concat(this.webex.internal.device.userId,"/").concat(e),body:{key:t,mutable:!0,val:r}}).then((function(t){return n.webex.internal.device.features[e].add(t.body,{merge:!0})}))},setBundledFeatures:function(e){var t=this;return e.forEach((function(e){e.mutable=e.mutable||"true","USER"!==e.type&&"DEV"!==e.type&&(e.type="USER")})),this.request({method:"POST",api:"feature",resource:"features/users/".concat(this.webex.internal.device.userId,"/toggles"),body:e}).then((function(e){var r=yl()(e.body.featureToggles,{type:"USER"});t.webex.internal.device.features.user.add(r[0],{merge:!0}),t.webex.internal.device.features.developer.add(r[1],{merge:!0})}))},initialize:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];f()(dr.prototype.initialize,this,t),this.listenToAndRun(this.webex,"change:internal.device.features.developer",this.trigger.bind(this,"change:developer")),this.listenToAndRun(this.webex,"change:internal.device.features.entitlement",this.trigger.bind(this,"change:entitlement")),this.listenToAndRun(this.webex,"change:internal.device.features.user",this.trigger.bind(this,"change:user"))}});Di("feature",bl,{config:{feature:{}}});var El=__webpack_require__(68929),Sl=__webpack_require__.n(El);function _l(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var wl=function(e){Je(r,e);var t=_l(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"parse",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Me()(this,{code:{value:e.code},reason:{value:e.reason}}),e.reason}}]),r}(nt);C(wl,"defaultMessage","Failed to connect to socket");var Rl=function(e){Je(r,e);var t=_l(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(wl);C(Rl,"defaultMessage","UnknownResponse is produced by IE when we receive a 4XXX. You probably want to treat this like a NotFound");var Cl=function(e){Je(r,e);var t=_l(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(wl);C(Cl,"defaultMessage","BadRequest usually implies an attempt to use service account credentials");var Tl=function(e){Je(r,e);var t=_l(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(wl);C(Tl,"defaultMessage","Please refresh your access token");var xl=function(e){Je(r,e);var t=_l(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r)}(wl);function kl(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}C(xl,"defaultMessage","Forbidden usually implies these credentials are not entitled for Webex");var Il=new(se()),Al=function(e){Je(r,e);var t=kl(r);function r(){var e;return ne(this,r),(e=t.call(this))._domain="unknown-domain",e.onmessage=e.onmessage.bind(Ye(e)),e.onclose=e.onclose.bind(Ye(e)),e}return oe(r,[{key:"binaryType",get:function(){return Il.get(this).binaryType}},{key:"bufferedAmount",get:function(){return Il.get(this).bufferedAmount}},{key:"extensions",get:function(){return Il.get(this).extensions}},{key:"protocol",get:function(){return Il.get(this).protocol}},{key:"readyState",get:function(){return Il.get(this).readyState}},{key:"url",get:function(){return Il.get(this).url}},{key:"close",value:function(e){var t=this;return new(p())((function(r,n){var i=Il.get(t);if(i){if(t.logger.info("socket,".concat(t._domain,": closing")),2===i.readyState||3===i.readyState)return t.logger.info("socket,".concat(t._domain,": already closed")),void r();if((e=e||{}).code&&1e3!==e.code&&(e.code<3e3||e.code>4999))n(new Error("`options.code` must be 1000 or between 3000 and 4999 (inclusive)"));else{var o=e.code,a=e.reason;e=je()(e,{code:1e3,reason:"Done"});var s=Hi((function(){try{t.logger.info("socket,".concat(t._domain,": no close event received, forcing closure")),r(t.onclose(o?{code:o,reason:a||"Done (unknown)"}:{code:1e3,reason:"Done (forced)"}))}catch(e){t.logger.warn("socket,".concat(t._domain,": force-close failed"),e)}}),t.forceCloseDelay);i.onclose=function(e){t.logger.info("socket,".concat(t._domain,": close event fired"),e.code,e.reason),clearTimeout(s),t.onclose(e),r(e)},i.close(e.code,e.reason)}}else r()}))}},{key:"open",value:function(e,t){var n=this;try{this._domain=new URL(e).hostname}catch(t){this._domain=e}return new(p())((function(i,o){if(e)if(Il.get(n))o(new Error("Socket#open() can only be called once per instance"));else{(function(e,t){e.forEach((function(e){if(!t[e])throw new Error("missing required property ".concat(e," from ").concat(t))}))})(["forceCloseDelay","pingInterval","pongTimeout","token","trackingId","logger"],t=t||{}),l()(t).forEach((function(e){Mr()(n,e,{enumerable:!1,value:t[e]})}));var a=r.getWebSocketConstructor();n.logger.info("socket,".concat(n._domain,": creating WebSocket"));var s=new a(e,[],t);s.binaryType="arraybuffer",s.onmessage=n.onmessage,s.onclose=function(e){switch(e=n._fixCloseCode(e),n.logger.info("socket,".concat(n._domain,": closed before open"),e.code,e.reason),e.code){case 1005:return o(new Rl(e));case 4400:return o(new Cl(e));case 4401:return o(new Tl(e));case 4403:return o(new xl(e));default:return o(new wl(e))}},s.onopen=function(){n.logger.info("socket,".concat(n._domain,": connected")),n._authorize().then((function(){n.logger.info("socket,".concat(n._domain,": authorized")),s.onclose=n.onclose,i()})).catch(o)},s.onerror=function(e){n.logger.warn("socket,".concat(n._domain,": error event fired"),e)},Il.set(n,s),n.logger.info("socket,".concat(n._domain,": waiting for server"))}else o(new Error("`url` is required"))}))}},{key:"onclose",value:function(e){this.logger.info("socket,".concat(this._domain,": closed"),e.code,e.reason),clearTimeout(this.pongTimer),clearTimeout(this.pingTimer),e=this._fixCloseCode(e),this.emit("close",e),this.removeAllListeners()}},{key:"onmessage",value:function(e){try{var t=JSON.parse(e.data),r=jr()(t.sequenceNumber,10);this.logger.debug("socket,".concat(this._domain,": sequence number: "),r),this.expectedSequenceNumber&&r!==this.expectedSequenceNumber&&(this.logger.debug("socket,".concat(this._domain,": sequence number mismatch indicates lost mercury message. expected: ").concat(this.expectedSequenceNumber,", actual: ").concat(r)),this.emit("sequence-mismatch",r,this.expectedSequenceNumber)),this.expectedSequenceNumber=r+1;var n={data:t};this._acknowledge(n),"pong"===t.type?this.emit("pong",n):this.emit("message",n)}catch(e){this.logger.warn("socket,".concat(this._domain,": error while receiving WebSocket message"),e)}}},{key:"send",value:function(e){var t=this;return new(p())((function(r,n){return 1!==t.readyState?n(new Error("INVALID_STATE_ERROR")):(a()(e)&&(e=Cr()(e)),Il.get(t).send(e),r())}))}},{key:"_acknowledge",value:function(e){return e?Hn()(e,"data.id")?this.send({messageId:e.data.id,type:"ack"}):p().reject(new Error("`event.data.id` is required")):p().reject(new Error("`event` is required"))}},{key:"_authorize",value:function(){var e=this;return new(p())((function(t){e.logger.info("socket,".concat(e._domain,": authorizing")),e.send({id:kn().v4(),type:"authorization",data:{token:e.token},trackingId:e.trackingId,logLevelToken:e.logLevelToken});e.once("message",(function r(n){n.data.type||"mercury.buffer_state"!==n.data.data.eventType&&"mercury.registration_status"!==n.data.data.eventType||(e.removeListener("message",r),e._ping(),t())}))}))}},{key:"_fixCloseCode",value:function(e){if(1005===e.code&&e.reason)switch(e.reason.toLowerCase()){case"replaced":this.logger.info("socket,".concat(this._domain,": fixing CloseEvent code for reason: "),e.reason),e.code=4e3;break;case"authentication failed":case"authentication did not happen within the timeout window of 30000 seconds.":this.logger.info("socket,".concat(this._domain,": fixing CloseEvent code for reason: "),e.reason),e.code=1008}return e}},{key:"_ping",value:function(e){var t=this;e=e||kn().v4();var r=performance.now();return this.pongTimer=Hi((function(){try{t.logger.info("socket,".concat(t._domain,": pong not receive in expected period, closing socket")),t.close({code:1e3,reason:"Pong not received"}).catch((function(e){t.logger.warn("socket,".concat(t._domain,": failed to close socket after missed pong"),e)}))}catch(e){t.logger.error("socket,".concat(t._domain,": error occurred in onPongNotReceived"),e)}}),this.pongTimeout),this.once("pong",(function(){try{clearTimeout(t.pongTimer),t.pingTimer=Hi((function(){return t._ping()}),t.pingInterval)}catch(e){t.logger.error("socket,".concat(t._domain,": error occurred in scheduleNextPingAndCancelPongTimer"),e)}})),this.once("pong",(function(r){try{t.logger.debug("socket,".concat(t._domain,": pong"),r.data.id),r.data&&r.data.id!==e&&(t.logger.info("socket,".concat(t._domain,": received pong for wrong ping id, closing socket")),t.logger.debug("socket,".concat(t._domain,": expected"),e,"received",r.data.id),t.close({code:1e3,reason:"Pong mismatch"}))}catch(e){t.logger.error("socket,".concat(t._domain,": error occurred in confirmPongId"),e)}})),this.once("pong",(function(){return function(e){var r=performance.now()-e;t.logger.debug("socket,".concat(t._domain,": latency: "),r),t.emit("ping-pong-latency",r)}(r)})),this.logger.debug("socket,".concat(this._domain,": ping ").concat(e)),this.send({id:e,type:"ping"})}}],[{key:"getWebSocketConstructor",value:function(){throw new Error("Socket.getWebSocketConstructor() must be implemented in an environmentally appropriate way")}}]),r}(Be.EventEmitter);Al.getWebSocketConstructor=function(){var e;return"undefined"!=typeof WebSocket?e=WebSocket:"undefined"!=typeof MozWebSocket?e=MozWebSocket:void 0!==__webpack_require__.g?e=__webpack_require__.g.WebSocket||__webpack_require__.g.MozWebSocket:"undefined"!=typeof window?e=window.WebSocket||window.MozWebSocket:"undefined"!=typeof self&&(e=self.WebSocket||self.MozWebSocket),e};const Ol=Al;var Ll,Ml,Nl;function Pl(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function Dl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Pl(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):Pl(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}var Fl=["idle","done (forced)","pong not received","pong mismatch"],Ul=dr.extend((Ll=Nt("Mercury#listen(): Use Mercury#connect() instead"),Ml=Nt("Mercury#stopListening(): Use Mercury#disconnect() instead"),Nl={namespace:"Mercury",lastError:void 0,session:{connected:{default:!1,type:"boolean"},connecting:{default:!1,type:"boolean"},hasEverConnected:{default:!1,type:"boolean"},socket:"object",localClusterServiceUrls:"object",mercuryTimeOffset:{default:void 0,type:"number"}},derived:{listening:{deps:["connected"],fn:function(){return this.connected}}},initialize:function(){var e=this;this.on("event:featureToggle_update",(function(t){t&&t.data&&e.webex.internal.feature.updateFeature(t.data.featureToggle)}))},getLastError:function(){return this.lastError},connect:function(e){var t=this;return this.connected?(this.logger.info("".concat(this.namespace,": already connected, will not connect again")),p().resolve()):(this.connecting=!0,this.logger.info("".concat(this.namespace,": starting connection attempt")),this.logger.info("".concat(this.namespace,": debug_mercury_logging stack: "),new Error("debug_mercury_logging").stack),p().resolve(this.webex.internal.device.registered||this.webex.internal.device.register()).then((function(){return t.logger.info("".concat(t.namespace,": connecting")),t._connectWithBackoff(e)})))},logout:function(){return this.logger.info("".concat(this.namespace,": logout() called")),this.logger.info("".concat(this.namespace,": debug_mercury_logging stack: "),new Error("debug_mercury_logging").stack),this.disconnect(this.config.beforeLogoutOptionsCloseReason&&!Fl.includes(this.config.beforeLogoutOptionsCloseReason)?{code:3050,reason:this.config.beforeLogoutOptionsCloseReason}:void 0)},disconnect:function(e){var t=this;return new(p())((function(r){t.backoffCall&&(t.logger.info("".concat(t.namespace,": aborting connection")),t.backoffCall.abort()),t.socket&&(t.socket.removeAllListeners("message"),t.once("offline",r),r(t.socket.close(e||void 0))),r()}))},listen:function(){return this.connect()},stopListening:function(){return this.disconnect()},processRegistrationStatusEvent:function(e){this.localClusterServiceUrls=e.localClusterServiceUrls},_applyOverrides:function(e){e&&e.headers&&l()(e.headers).forEach((function(t){vr()(e,t,e.headers[t])}))},_prepareUrl:function(e){var t=this;return e||(e=this.webex.internal.device.webSocketUrl),this.webex.internal.feature.getFeature("developer","web-high-availability").then((function(r){return r?t.webex.internal.services.convertUrlToPriorityHostUrl(e):e})).then((function(t){e=t})).then((function(){return t.webex.internal.feature.getFeature("developer","web-shared-mercury")})).then((function(r){return e=Gi.parse(e,!0),tr()(e.query,{outboundWireFormat:"text",bufferStates:!0,aliasHttpStatus:!0}),r&&(tr()(e.query,{mercuryRegistrationStatus:!0,isRegistrationRefreshEnabled:!0}),xr()(e.query,"bufferStates")),Sr()(t,"webex.config.device.ephemeral",!1)&&(e.query.multipleConnections=!0),e.query.clientTimestamp=Ln()(),Gi.format(e)}))},_attemptConnection:function(e,t){var r,n=this,i=new Ol;i.on("close",(function(){return n._onclose.apply(n,arguments)})),i.on("message",(function(){return n._onmessage.apply(n,arguments)})),i.on("pong",(function(){return n._setTimeOffset.apply(n,arguments)})),i.on("sequence-mismatch",(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n._emit.apply(n,["sequence-mismatch"].concat(t))})),i.on("ping-pong-latency",(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n._emit.apply(n,["ping-pong-latency"].concat(t))})),p().all([this._prepareUrl(e),this.webex.credentials.getUserToken()]).then((function(e){var t=lo(e,2),o=t[0],a=t[1];if(!n.backoffCall){var s="".concat(n.namespace,": prevent socket open when backoffCall no longer defined");return n.logger.info(s),p().reject(new Error(s))}r=o;var c={forceCloseDelay:n.config.forceCloseDelay,pingInterval:n.config.pingInterval,pongTimeout:n.config.pongTimeout,token:a.toString(),trackingId:"".concat(n.webex.sessionId,"_").concat(Ln()()),logger:n.logger};return n.webex.config.defaultMercuryOptions&&(n.logger.info("".concat(n.namespace,": setting custom options")),c=Dl(Dl({},c),n.webex.config.defaultMercuryOptions)),n.socket=i,n.logger.info("".concat(n.namespace," connection url: ").concat(o)),i.open(o,c)})).then((function(){return n.logger.info("".concat(n.namespace,": connected to mercury, success, action: connected, url: ").concat(r)),t(),n.webex.internal.feature.getFeature("developer","web-high-availability").then((function(e){return e?n.webex.internal.device.refresh():p().resolve()}))})).catch((function(e){var i,o,a;(n.lastError=e,1006!==e.code&&n.backoffCall&&(null===(i=n.backoffCall)||void 0===i?void 0:i.getNumRetries())>0)&&n._emit("connection_failed",e,{retries:null===(a=n.backoffCall)||void 0===a?void 0:a.getNumRetries()});return n.logger.info("".concat(n.namespace,": connection attempt failed"),e,0===(null===(o=n.backoffCall)||void 0===o?void 0:o.getNumRetries())?e.stack:""),e instanceof Rl?(n.logger.info("".concat(n.namespace,": received unknown response code, refreshing device registration")),n.webex.internal.device.refresh().then((function(){return t(e)}))):e instanceof Tl?(n.logger.info("".concat(n.namespace,": received authorization error, reauthorizing")),n.webex.credentials.refresh({force:!0}).then((function(){return t(e)}))):e instanceof Cl||e instanceof xl?(n.logger.warn("".concat(n.namespace,": received unrecoverable response from mercury")),n.backoffCall.abort(),t(e)):e instanceof wl?n.webex.internal.feature.getFeature("developer","web-high-availability").then((function(t){return t?(n.logger.info("".concat(n.namespace,": received a generic connection error, will try to connect to another datacenter. failed, action: 'failed', url: ").concat(r," error: ").concat(e.message)),n.webex.internal.services.markFailedUrl(r)):null})).then((function(){return t(e)})):t(e)})).catch((function(e){n.logger.error("".concat(n.namespace,": failed to handle connection failure"),e),t(e)}))},_connectWithBackoff:function(e){var t=this;return new(p())((function(r,n){var i;(i=Ve.call((function(r){t.logger.info("".concat(t.namespace,": executing connection attempt ").concat(i.getNumRetries())),t._attemptConnection(e,r)}),(function(e){return t.connecting=!1,t.backoffCall=void 0,e?(t.logger.info("".concat(t.namespace,": failed to connect after ").concat(i.getNumRetries()," retries; log statement about next retry was inaccurate; ").concat(e)),n(e)):(t.connected=!0,t.hasEverConnected=!0,t._emit("online"),t.webex.internal.newMetrics.callDiagnosticMetrics.setMercuryConnectedStatus(!0),r())}))).setStrategy(new Ve.ExponentialStrategy({initialDelay:t.config.backoffTimeReset,maxDelay:t.config.backoffTimeMax})),t.config.initialConnectionMaxRetries&&!t.hasEverConnected?i.failAfter(t.config.initialConnectionMaxRetries):t.config.maxRetries&&i.failAfter(t.config.maxRetries),i.on("abort",(function(){t.logger.info("".concat(t.namespace,": connection aborted")),n(new Error("Mercury Connection Aborted"))})),i.on("callback",(function(e){if(e){var r=i.getNumRetries(),n=Math.min(i.strategy_.nextBackoffDelay_,t.config.backoffTimeMax);t.logger.info("".concat(t.namespace,": failed to connect; attempting retry ").concat(r+1," in ").concat(n," ms"))}else t.logger.info("".concat(t.namespace,": connected"))})),i.start(),t.backoffCall=i}))},_emit:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];try{this.trigger.apply(this,t)}catch(e){this.logger.error("".concat(this.namespace,": error occurred in event handler:"),e," with args: ",t)}},_getEventHandlers:function(e){var t=lo(e.split("."),2),r=t[0],n=t[1],i=[];if(!this.webex[r]&&!this.webex.internal[r])return i;var o=Sl()("process_".concat(n,"_event"));return(this.webex[r]||this.webex.internal[r])[o]&&i.push({name:o,namespace:r}),i},_onclose:function(e){try{var t=e.reason&&e.reason.toLowerCase(),r=this.socket.url;switch(this.socket.removeAllListeners(),this.unset("socket"),this.connected=!1,this._emit("offline",e),this.webex.internal.newMetrics.callDiagnosticMetrics.setMercuryConnectedStatus(!1),e.code){case 1003:this.logger.info("".concat(this.namespace,": Mercury service rejected last message; will not reconnect: ").concat(e.reason)),this._emit("offline.permanent",e);break;case 4e3:this.logger.info("".concat(this.namespace,": socket replaced; will not reconnect")),this._emit("offline.replaced",e);break;case 1001:case 1005:case 1006:case 1011:this.logger.info("".concat(this.namespace,": socket disconnected; reconnecting")),this._emit("offline.transient",e),this._reconnect(r);break;case 1e3:case 3050:Fl.includes(t)?(this.logger.info("".concat(this.namespace,": socket disconnected; reconnecting")),this._emit("offline.transient",e),this._reconnect(r)):(this.logger.info("".concat(this.namespace,": socket disconnected; will not reconnect: ").concat(e.reason)),this._emit("offline.permanent",e));break;default:this.logger.info("".concat(this.namespace,": socket disconnected unexpectedly; will not reconnect")),this._emit("offline.permanent",e)}}catch(e){this.logger.error("".concat(this.namespace,": error occurred in close handler"),e)}},_onmessage:function(e){var t=this;this._setTimeOffset(e);var r=e.data;({ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}).ENABLE_MERCURY_LOGGING&&this.logger.debug("".concat(this.namespace,": message envelope: "),r);var n=r.data;return this._applyOverrides(n),this._getEventHandlers(n.eventType).reduce((function(e,r){return e.then((function(){var e=r.namespace,i=r.name;return new(p())((function(r){return r((t.webex[e]||t.webex.internal[e])[i](n))})).catch((function(e){return t.logger.error("".concat(t.namespace,": error occurred in autowired event handler for ").concat(n.eventType),e)}))}))}),p().resolve()).then((function(){t._emit("event",e.data);var i=lo(n.eventType.split("."),1)[0];i===n.eventType?t._emit("event:".concat(i),r):(t._emit("event:".concat(i),r),t._emit("event:".concat(n.eventType),r))})).catch((function(e){t.logger.error("".concat(t.namespace,": error occurred processing socket message"),e)}))},_setTimeOffset:function(e){var t=e.data.wsWriteTimestamp;"number"==typeof t&&t>0&&(this.mercuryTimeOffset=Ln()()-t)},_reconnect:function(e){return this.logger.info("".concat(this.namespace,": reconnecting")),this.connect(e)},version:"0.0.0-next"},Zt(Nl,"connect",[he],Ie()(Nl,"connect"),Nl),Zt(Nl,"disconnect",[he],Ie()(Nl,"disconnect"),Nl),Zt(Nl,"listen",[Ll],Ie()(Nl,"listen"),Nl),Zt(Nl,"stopListening",[Ml],Ie()(Nl,"stopListening"),Nl),Nl));Di("mercury",Ul,{config:{mercury:{pingInterval:{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.MERCURY_PING_INTERVAL||15e3,pongTimeout:{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.MERCURY_PONG_TIMEOUT||14e3,backoffTimeMax:{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.MERCURY_BACKOFF_TIME_MAX||32e3,backoffTimeReset:{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.MERCURY_BACKOFF_TIME_RESET||1e3,forceCloseDelay:{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.MERCURY_FORCE_CLOSE_DELAY||2e3,beforeLogoutOptionsCloseReason:{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.MERCURY_LOGOUT_REASON||"done (forced)"}},onBeforeLogout:function(){return this.logout()}});var jl={silent:0,group:1,groupEnd:2,error:3,warn:4,log:5,info:6,debug:7,trace:8},Bl=l()(jl).filter((function(e){return"silent"!==e})),ql={error:["log"],warn:["error","log"],info:["log"],debug:["info","log"],trace:["debug","info","log"]},Vl="sdk",Gl="client",Wl=/[Aa]uthorization/;function zl(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(t.includes(e))return e;if(t.push(e),me()(e))return e.map((function(e){return zl(e,t)}));if(!a()(e)){if(br()(e)){if(pe.containsEmails.test(e))return e.replace(pe.containsEmails,"[REDACTED]");if(pe.containsMTID.test(e))return e.replace(pe.containsMTID,"$1[REDACTED]")}return e}for(var r=0,n=dl()(e);r<n.length;r++){var i=lo(n[r],2),o=i[0],s=i[1];Wl.test(o)?xr()(e,o):e[o]=zl(s,t)}return e}var Hl=dr.extend({namespace:"Logger",derived:{level:{cache:!1,fn:function(){return this.getCurrentLevel()}},client_level:{cache:!1,fn:function(){return this.getCurrentClientLevel()}}},session:{buffer:{type:"object",default:function(){return{buffer:[],nextIndex:0}}},groupLevel:{type:"number",default:function(){return 0}},sdkBuffer:{type:"object",default:function(){return{buffer:[],nextIndex:0}}},clientBuffer:{type:"object",default:function(){return{buffer:[],nextIndex:0}}}},filter:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.map((function(e){return e instanceof Error?e:zl(e=c()(e))}))},shouldPrint:function(e){return jl[e]<=jl[(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Vl)===Vl?this.getCurrentLevel():this.getCurrentClientLevel()]},shouldBuffer:function(e){return jl[e]<=(this.config.bufferLogLevel?jl[this.config.bufferLogLevel]:jl.info)},getCurrentLevel:function(){if(this.config.level)return this.config.level;if(Bl.includes("log"))return"log";var e=this.webex.internal.device&&this.webex.internal.device.features.developer.get("log-level");return e&&Bl.includes(e)?e:"error"},getCurrentClientLevel:function(){return this.config.clientLevel?this.config.clientLevel:this.getCurrentLevel()},formatLogs:function(){function e(e){return e[1]}var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).diff,r=void 0!==t&&t,n=[],i=r?this.clientBuffer.nextIndex:0,o=r?this.sdkBuffer.nextIndex:0;if(this.config.separateLogBuffers){for(;i<this.clientBuffer.buffer.length||o<this.sdkBuffer.buffer.length;)o<this.sdkBuffer.buffer.length&&(i>=this.clientBuffer.buffer.length||new Date(e(this.sdkBuffer.buffer[o]))<=new Date(e(this.clientBuffer.buffer[i])))?(n.push(this.sdkBuffer.buffer[o]),o+=1):i<this.clientBuffer.buffer.length&&(n.push(this.clientBuffer.buffer[i]),i+=1);r&&(this.clientBuffer.nextIndex=i,this.sdkBuffer.nextIndex=o)}else r?(n=this.buffer.buffer.slice(this.buffer.nextIndex),this.buffer.nextIndex=this.buffer.buffer.length):n=this.buffer.buffer;return n.join("\n")},version:"0.0.0-next"});function Kl(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return function(){var o,a,s=r,c=s===Vl?"wx-js-sdk":this.config.clientName||s;this.config.separateLogBuffers?(a=this.config.clientHistoryLength?this.config.clientHistoryLength:this.config.historyLength,o=s===Vl?this.sdkBuffer:this.clientBuffer):(o=this.buffer,a=this.config.historyLength);try{var u=!n&&this.shouldPrint(e,s),l=i||this.shouldBuffer(e);if(!l&&!u)return;var d=[c].concat(A(this.filter.apply(this,arguments))),f=d.map((function(e){if(e instanceof Error)return e.toString();if("object"===_(e)){var t,r=[];try{t=Cr()(e,(function(e,t){if("object"===_(t)&&null!==t){if(r.includes(t))return;r.push(t)}return t}))}catch(r){t="Failed to stringify: ".concat(e)}return r=null,t}return e}));if(u){var h,p=f;0,(h=console)[t].apply(h,A(p))}if(l){var v=new Date;if(f.unshift(v.toISOString()),f.unshift("| ".repeat(this.groupLevel)),o.buffer.push(f),o.buffer.length>a){var m=o.buffer.length-a;o.buffer.splice(0,m),o.nextIndex-=m,o.nextIndex<0&&(o.nextIndex=0)}"group"===e&&(this.groupLevel+=1),"groupEnd"===e&&this.groupLevel>0&&(this.groupLevel-=1)}}catch(t){n||console.warn("failed to execute Logger#".concat(e),t)}}}Bl.forEach((function(e){var t=ql[e],r=e;if(t)for(t=t.slice();!console[r];)r=t.pop();Hl.prototype["client_".concat(e)]=Kl(e,r,Gl),Hl.prototype[e]=Kl(e,r,Vl)})),Hl.prototype.client_logToBuffer=Kl(Bl.info,Bl.info,Gl,!0,!0),Hl.prototype.logToBuffer=Kl(Bl.info,Bl.info,Vl,!0,!0);Pi("logger",Hl,{config:{logger:{level:"log",historyLength:1e4}},replace:!0});var $l=dr.extend({namespace:"Support",getFeedbackUrl:function(e){return e=e||{},this.request({method:"POST",api:"conversation",resource:"users/deskFeedbackUrl",body:je()(e,{appVersion:this.config.appVersion,appType:this.config.appType,feedbackId:e.feedbackId||kn().v4(),languageCode:this.config.languageCode})}).then((function(e){return e.body.url}))},getSupportUrl:function(){return this.webex.request({method:"GET",api:"conversation",resource:"users/deskSupportUrl",qs:{languageCode:this.config.languageCode}}).then((function(e){return e.body.url}))},submitLogs:function(e,t){var r,n,i=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=this._constructFileMetadata(e),s=o.type;if(!t&&this.webex.logger.sdkBuffer&&this.webex.logger.clientBuffer&&this.webex.logger.buffer){var c=void 0!==s?"diff"===s:this.config.incrementalLogs;t=this.webex.logger.formatLogs({diff:c})}return r=e.locusId&&e.callStart?"".concat(e.locusId,"_").concat(e.callStart,".txt"):"".concat(this.webex.sessionId,".txt"),this.webex.credentials.getUserToken().catch((function(){return i.webex.credentials.getClientToken()})).then(function(){var e=_e(Re().mark((function e(o){var s,c,u,l;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s={authorization:o.toString()},c={service:"clientLogs",resource:"logs/urls"},u={service:"clientLogs",resource:"logs/meta"},l=je()(c,{file:t,shouldAttemptReauth:!1,headers:s,phases:{initialize:{body:{file:r}},upload:{$uri:function(e){return e.tempURL}},finalize:je()(u,{$body:function(e){return n=e.userId,{filename:e.logFilename,data:a,userId:i.webex.internal.device.userId||e.userId}}})}}),e.abrupt("return",i.webex.upload(l));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()).then((function(e){return n&&!e.userId&&(e.userId=n),e}))},_constructFileMetadata:function(e){var t=["locusId","appVersion","callStart","feedbackId","correlationId","meetingId","surveySessionId","productAreaTag","issueTypeTag","issueDescTag","locussessionid","autoupload"].map((function(t){return e[t]?{key:t,value:e[t]}:null})).filter((function(e){return Boolean(e)}));return this.webex.sessionId&&t.push({key:"trackingId",value:this.webex.sessionId}),this.webex.internal.support.config.appVersion&&t.push({key:"appVersion",value:this.webex.internal.support.config.appVersion}),this.webex.internal.device.userId&&t.push({key:"userId",value:this.webex.internal.device.userId}),this.webex.internal.device.orgId&&t.push({key:"orgId",value:this.webex.internal.device.orgId}),t},version:"0.0.0-next"});Di("support",$l,{config:{device:{preDiscoveryServices:{atlasServiceUrl:"https://atlas-a.wbx2.com/admin/api/v1",atlas:"https://atlas-a.wbx2.com/admin/api/v1",clientLogs:{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.CLIENT_LOGS_SERVICE_URL||"https://client-logs-a.wbx2.com/api/v1",clientLogsServiceUrl:{ATLAS_SERVICE_URL:"https://atlas-a.wbx2.com/admin/api/v1",CONVERSATION_SERVICE:"https://conv-a.wbx2.com/conversation/api/v1",ENCRYPTION_SERVICE_URL:"https://encryption-a.wbx2.com",HYDRA_SERVICE_URL:"https://api.ciscospark.com/v1",IDBROKER_BASE_URL:"https://idbroker.webex.com",IDENTITY_BASE_URL:"https://identity.webex.com",U2C_SERVICE_URL:"https://u2c.wbx2.com/u2c/api/v1",SQDISCOVERY_SERVICE_URL:"https://ds.ciscospark.com/v1/region",WDM_SERVICE_URL:"https://wdm-a.wbx2.com/wdm/api/v1",WHISTLER_API_SERVICE_URL:"https://whistler-prod.allnint.ciscospark.com/api/v1",CALLING_SDK_VERSION:"3.8.1-next.22"}.CLIENT_LOGS_SERVICE_URL||"https://client-logs-a.wbx2.com/api/v1"}},support:{appType:"",appVersion:"",languageCode:"",incrementalLogs:!1}}});var Jl,Yl=__webpack_require__(72818);function Ql(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Xt(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Yl){var o=Yl(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var Xl=new Uint8Array(16);function Zl(){if(!Jl&&!(Jl="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Jl(Xl)}const ed=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const td=function(e){return"string"==typeof e&&ed.test(e)};for(var rd=[],nd=0;nd<256;++nd)rd.push((nd+256).toString(16).substr(1));const id=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(rd[e[t+0]]+rd[e[t+1]]+rd[e[t+2]]+rd[e[t+3]]+"-"+rd[e[t+4]]+rd[e[t+5]]+"-"+rd[e[t+6]]+rd[e[t+7]]+"-"+rd[e[t+8]]+rd[e[t+9]]+"-"+rd[e[t+10]]+rd[e[t+11]]+rd[e[t+12]]+rd[e[t+13]]+rd[e[t+14]]+rd[e[t+15]]).toLowerCase();if(!td(r))throw TypeError("Stringified UUID is invalid");return r};const od=function(e,t,r){var n=(e=e||{}).random||(e.rng||Zl)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return id(n)};var ad="GET",sd="POST",cd="PUT",ud=function(e){return e.error="ERROR",e.warn="WARN",e.log="LOG",e.info="INFO",e.trace="TRACE",e}({}),ld="AGENT_DN",dd="EXTENSION",fd="BROWSER",hd="",pd="wxcc_sdk",vd="WebCallingService",md="config-index",gd="cc",yd="connection-service",bd="WebSocketManager",Ed="aqm-reqs",Sd="WebexRequest",_d="TaskManager",wd="Task",Rd={},Cd="telephony",Td="register",xd="deregister",kd="getBuddyAgents",Id="connectWebsocket",Ad="stationLogin",Od="stationLogout",Ld="setAgentState",Md="handleWebsocketMessage",Nd="handleConnectionLost",Pd="silentRelogin",Dd="handleDeviceType",Fd="startOutdial",Ud="getQueues",jd="updateAgentProfile",Bd="wcc-api-gateway",qd="getRTMSDomain",Vd="registerWebCallingLine",Gd="deregisterWebCallingLine",Wd="answerCall",zd="muteUnmuteCall",Hd="declineCall";function Kd(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var $d=function(e){Je(r,e);var t=Kd(r);function r(e,n){var i;return ne(this,r),C(Ye(i=t.call(this)),"id",void 0),C(Ye(i),"isErr","yes"),i.id=e,i.stack=(new Error).stack,"string"==typeof n?i.message=n:n instanceof Error?(i.message=n.message,i.name=n.name):i.message="",i}return oe(r)}(tt(Error)),Jd=function(e){Je(r,e);var t=Kd(r);function r(e,n){var i;return ne(this,r),C(Ye(i=t.call(this)),"id",void 0),C(Ye(i),"details",void 0),C(Ye(i),"isErr","yes"),i.id=e,i.stack=(new Error).stack,i.details=n,i}return oe(r)}(tt(Error)),Yd=function(){function e(){ne(this,e)}return oe(e,null,[{key:"initialize",value:function(t){e.logger=t}},{key:"log",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.logger&&e.logger.log(e.format(ud.log,t,r))}},{key:"info",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.logger&&e.logger.info(e.format(ud.info,t,r))}},{key:"warn",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.logger&&e.logger.warn(e.format(ud.warn,t,r))}},{key:"trace",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.logger&&e.logger.trace(e.format(ud.trace,t,r))}},{key:"error",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.logger&&e.logger.error(e.format(ud.error,t,r))}},{key:"format",value:function(e,t,r){var n=(new Date).toISOString(),i=r.module||"unknown",o=r.method||"unknown",a=r.interactionId?" - interactionId:".concat(r.interactionId):"",s=r.trackingId?" - trackingId:".concat(r.trackingId):"";return"".concat(n," ").concat("PLUGIN_CC"," - [").concat(e,"]: module:").concat(i," - method:").concat(o).concat(a).concat(s," - ").concat(t)}}]),e}();C(Yd,"logger",void 0);var Qd,Xd="uploadLogs",Zd="createPromise",ef="onMessage",tf="initWebSocket",rf="close",nf="register",of="connect",af="webSocketOnCloseHandler",sf="dispatchConnectionEvent",cf="handleSocketClose",uf={STATION_LOGIN_SUCCESS:"Station Login Success",STATION_LOGIN_FAILED:"Station Login Failed",STATION_LOGOUT_SUCCESS:"Station Logout Success",STATION_LOGOUT_FAILED:"Station Logout Failed",STATION_RELOGIN_SUCCESS:"Station Relogin Success",STATION_RELOGIN_FAILED:"Station Relogin Failed",AGENT_STATE_CHANGE_SUCCESS:"Agent State Change Success",AGENT_STATE_CHANGE_FAILED:"Agent State Change Failed",FETCH_BUDDY_AGENTS_SUCCESS:"Fetch Buddy Agents Success",FETCH_BUDDY_AGENTS_FAILED:"Fetch Buddy Agents Failed",WEBSOCKET_REGISTER_SUCCESS:"Websocket Register Success",WEBSOCKET_REGISTER_FAILED:"Websocket Register Failed",AGENT_RONA:"Agent RONA",AGENT_CONTACT_ASSIGN_FAILED:"Agent Contact Assign Failed",AGENT_INVITE_FAILED:"Agent Invite Failed",TASK_ACCEPT_SUCCESS:"Task Accept Success",TASK_ACCEPT_FAILED:"Task Accept Failed",TASK_DECLINE_SUCCESS:"Task Decline Success",TASK_DECLINE_FAILED:"Task Decline Failed",TASK_END_SUCCESS:"Task End Success",TASK_END_FAILED:"Task End Failed",TASK_WRAPUP_SUCCESS:"Task Wrapup Success",TASK_WRAPUP_FAILED:"Task Wrapup Failed",TASK_HOLD_SUCCESS:"Task Hold Success",TASK_HOLD_FAILED:"Task Hold Failed",TASK_RESUME_SUCCESS:"Task Resume Success",TASK_RESUME_FAILED:"Task Resume Failed",TASK_CONSULT_START_SUCCESS:"Task Consult Start Success",TASK_CONSULT_START_FAILED:"Task Consult Start Failed",TASK_CONSULT_END_SUCCESS:"Task Consult End Success",TASK_CONSULT_END_FAILED:"Task Consult End Failed",TASK_TRANSFER_SUCCESS:"Task Transfer Success",TASK_TRANSFER_FAILED:"Task Transfer Failed",TASK_RESUME_RECORDING_SUCCESS:"Task Resume Recording Success",TASK_RESUME_RECORDING_FAILED:"Task Resume Recording Failed",TASK_PAUSE_RECORDING_SUCCESS:"Task Pause Recording Success",TASK_PAUSE_RECORDING_FAILED:"Task Pause Recording Failed",TASK_ACCEPT_CONSULT_SUCCESS:"Task Accept Consult Success",TASK_ACCEPT_CONSULT_FAILED:"Task Accept Consult Failed",TASK_OUTDIAL_SUCCESS:"Task Outdial Success",TASK_OUTDIAL_FAILED:"Task Outdial Failed",UPLOAD_LOGS_SUCCESS:"Upload Logs Success",UPLOAD_LOGS_FAILED:"Upload Logs Failed",WEBSOCKET_DEREGISTER_SUCCESS:"Websocket Deregister Success",WEBSOCKET_DEREGISTER_FAIL:"Websocket Deregister Failed",AGENT_DEVICE_TYPE_UPDATE_SUCCESS:"Agent Device Type Update Success",AGENT_DEVICE_TYPE_UPDATE_FAILED:"Agent Device Type Update Failed"},lf=pd,df=(C(C(C(C(C(C(C(C(C(C(Qd={},uf.STATION_LOGIN_SUCCESS,{product:lf,agent:"user",target:"station_login",verb:"complete"}),uf.STATION_LOGIN_FAILED,{product:lf,agent:"user",target:"station_login",verb:"fail"}),uf.STATION_LOGOUT_SUCCESS,{product:lf,agent:"user",target:"station_logout",verb:"complete"}),uf.STATION_LOGOUT_FAILED,{product:lf,agent:"user",target:"station_logout",verb:"fail"}),uf.STATION_RELOGIN_SUCCESS,{product:lf,agent:"user",target:"station_relogin",verb:"complete"}),uf.STATION_RELOGIN_FAILED,{product:lf,agent:"user",target:"station_relogin",verb:"fail"}),uf.AGENT_STATE_CHANGE_SUCCESS,{product:lf,agent:"user",target:"state_change",verb:"complete"}),uf.AGENT_STATE_CHANGE_FAILED,{product:lf,agent:"user",target:"state_change",verb:"fail"}),uf.FETCH_BUDDY_AGENTS_SUCCESS,{product:lf,agent:"user",target:"buddy_agents_fetch",verb:"complete"}),uf.FETCH_BUDDY_AGENTS_FAILED,{product:lf,agent:"user",target:"buddy_agents_fetch",verb:"fail"}),C(C(C(C(C(C(C(C(C(C(Qd,uf.WEBSOCKET_REGISTER_SUCCESS,{product:lf,agent:"user",target:"websocket_register",verb:"complete"}),uf.WEBSOCKET_REGISTER_FAILED,{product:lf,agent:"user",target:"websocket_register",verb:"fail"}),uf.AGENT_RONA,{product:lf,agent:"service",target:"agent_rona",verb:"set"}),uf.TASK_ACCEPT_SUCCESS,{product:lf,agent:"user",target:"task_accept",verb:"complete"}),uf.TASK_ACCEPT_FAILED,{product:lf,agent:"user",target:"task_accept",verb:"fail"}),uf.TASK_DECLINE_SUCCESS,{product:lf,agent:"user",target:"task_decline",verb:"complete"}),uf.TASK_DECLINE_FAILED,{product:lf,agent:"user",target:"task_decline",verb:"fail"}),uf.TASK_END_SUCCESS,{product:lf,agent:"user",target:"task_end",verb:"complete"}),uf.TASK_END_FAILED,{product:lf,agent:"user",target:"task_end",verb:"fail"}),uf.TASK_WRAPUP_SUCCESS,{product:lf,agent:"user",target:"task_wrapup",verb:"complete"}),C(C(C(C(C(C(C(C(C(C(Qd,uf.TASK_WRAPUP_FAILED,{product:lf,agent:"user",target:"task_wrapup",verb:"fail"}),uf.TASK_HOLD_SUCCESS,{product:lf,agent:"user",target:"task_hold",verb:"complete"}),uf.TASK_HOLD_FAILED,{product:lf,agent:"user",target:"task_hold",verb:"fail"}),uf.TASK_RESUME_SUCCESS,{product:lf,agent:"user",target:"task_resume",verb:"complete"}),uf.TASK_RESUME_FAILED,{product:lf,agent:"user",target:"task_resume",verb:"fail"}),uf.TASK_CONSULT_START_SUCCESS,{product:lf,agent:"user",target:"task_consult_start",verb:"complete"}),uf.TASK_CONSULT_START_FAILED,{product:lf,agent:"user",target:"task_consult_start",verb:"fail"}),uf.TASK_CONSULT_END_SUCCESS,{product:lf,agent:"user",target:"task_consult_end",verb:"complete"}),uf.TASK_CONSULT_END_FAILED,{product:lf,agent:"user",target:"task_consult_end",verb:"fail"}),uf.TASK_TRANSFER_SUCCESS,{product:lf,agent:"user",target:"task_transfer",verb:"complete"}),C(C(C(C(C(C(C(C(C(C(Qd,uf.TASK_TRANSFER_FAILED,{product:lf,agent:"user",target:"task_transfer",verb:"fail"}),uf.TASK_RESUME_RECORDING_SUCCESS,{product:lf,agent:"user",target:"task_resume_recording",verb:"complete"}),uf.TASK_RESUME_RECORDING_FAILED,{product:lf,agent:"user",target:"task_resume_recording",verb:"fail"}),uf.TASK_PAUSE_RECORDING_SUCCESS,{product:lf,agent:"user",target:"task_pause_recording",verb:"complete"}),uf.TASK_PAUSE_RECORDING_FAILED,{product:lf,agent:"user",target:"task_pause_recording",verb:"fail"}),uf.TASK_ACCEPT_CONSULT_SUCCESS,{product:lf,agent:"user",target:"task_accept_consult",verb:"complete"}),uf.TASK_ACCEPT_CONSULT_FAILED,{product:lf,agent:"user",target:"task_accept_consult",verb:"fail"}),uf.TASK_OUTDIAL_SUCCESS,{product:lf,agent:"user",target:"task_outdial",verb:"complete"}),uf.TASK_OUTDIAL_FAILED,{product:lf,agent:"user",target:"task_outdial",verb:"fail"}),uf.UPLOAD_LOGS_SUCCESS,{product:lf,agent:"user",target:"upload_logs",verb:"complete"}),C(C(C(Qd,uf.UPLOAD_LOGS_FAILED,{product:lf,agent:"user",target:"upload_logs",verb:"fail"}),uf.AGENT_DEVICE_TYPE_UPDATE_SUCCESS,{product:lf,agent:"user",target:"agent_device_type_update",verb:"complete"}),uf.AGENT_DEVICE_TYPE_UPDATE_FAILED,{product:lf,agent:"user",target:"agent_device_type_update",verb:"fail"}));function ff(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function hf(e,t){var r=void 0!==Yr()&&e[Xr()]||e["@@iterator"];if(!r){if(en()(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return pf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return $r()(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return pf(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function pf(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var vf=pd.toUpperCase(),mf=function(){function e(){ne(this,e),C(this,"webex",void 0),C(this,"runningEvents",{}),C(this,"pendingBehavioralEvents",[]),C(this,"pendingOperationalEvents",[]),C(this,"pendingBusinessEvents",[]),C(this,"readyToSubmitEvents",!1),C(this,"submittingEvents",!1),C(this,"metricsDisabled",!1)}var t,r,n,i;return oe(e,[{key:"setReadyToSubmitEvents",value:function(){this.readyToSubmitEvents=!0,this.submitPendingEvents()}},{key:"submitPendingEvents",value:(i=_e(Re().mark((function e(){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.submittingEvents){e.next=2;break}return e.abrupt("return");case 2:return this.submittingEvents=!0,e.prev=3,e.next=6,this.submitPendingBehavioralEvents();case 6:return e.next=8,this.submitPendingOperationalEvents();case 8:return e.next=10,this.submitPendingBusinessEvents();case 10:return e.prev=10,this.submittingEvents=!1,e.finish(10);case 13:case"end":return e.stop()}}),e,this,[[3,,10,13]])}))),function(){return i.apply(this,arguments)})},{key:"submitPendingBehavioralEvents",value:(n=_e(Re().mark((function e(){var t,r=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==this.pendingBehavioralEvents.length){e.next=2;break}return e.abrupt("return");case 2:this.readyToSubmitEvents&&(t=A(this.pendingBehavioralEvents),this.pendingBehavioralEvents.length=0,t.forEach((function(e){r.webex.internal.newMetrics.submitBehavioralEvent({product:e.taxonomy.product,agent:e.taxonomy.agent,target:e.taxonomy.target,verb:e.taxonomy.verb,payload:e.payload})})));case 3:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"submitPendingOperationalEvents",value:(r=_e(Re().mark((function e(){var t,r=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==this.pendingOperationalEvents.length){e.next=2;break}return e.abrupt("return");case 2:this.readyToSubmitEvents&&(t=A(this.pendingOperationalEvents),this.pendingOperationalEvents.length=0,t.forEach((function(e){r.webex.internal.newMetrics.submitOperationalEvent({name:"".concat(vf,"_").concat(e.name),payload:e.payload})})));case 3:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"submitPendingBusinessEvents",value:(t=_e(Re().mark((function e(){var t,r=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==this.pendingBusinessEvents.length){e.next=2;break}return e.abrupt("return");case 2:this.readyToSubmitEvents&&(t=A(this.pendingBusinessEvents),this.pendingBusinessEvents.length=0,t.forEach((function(e){r.webex.internal.newMetrics.submitBusinessEvent({name:"".concat(vf,"_").concat(e.name),payload:e.payload,metadata:{appType:pd}})})));case 3:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"addDurationIfTimed",value:function(e,t){for(var r=0,n=dl()(this.runningEvents);r<n.length;r++){var i=lo(n[r],2),o=i[0],a=i[1];if(a.keys.has(e)){var s=a.startTime;return delete this.runningEvents[o],(t=t||{}).duration_ms=Ln()()-s,t}}return t||{}}},{key:"isMetricsDisabled",value:function(){return this.metricsDisabled}},{key:"setMetricsDisabled",value:function(e){this.metricsDisabled=e,e&&this.clearPendingEvents()}},{key:"clearPendingEvents",value:function(){this.pendingBehavioralEvents.length=0,this.pendingOperationalEvents.length=0,this.pendingBusinessEvents.length=0}},{key:"trackBehavioralEvent",value:function(t,r){if(!this.isMetricsDisabled()){var n=function(e){return df[e]}(t),i=e.preparePayload(this.addDurationIfTimed(t,r));this.pendingBehavioralEvents.push({taxonomy:n,payload:i}),this.submitPendingBehavioralEvents()}}},{key:"trackOperationalEvent",value:function(t,r){if(!this.isMetricsDisabled()){var n=this.addDurationIfTimed(t,r);this.pendingOperationalEvents.push({name:e.spacesToUnderscore(t).toUpperCase(),payload:e.preparePayload(n)}),this.submitPendingOperationalEvents()}}},{key:"trackBusinessEvent",value:function(t,r){if(!this.isMetricsDisabled()){var n=this.addDurationIfTimed(t,r);this.pendingBusinessEvents.push({name:e.spacesToUnderscore(t).toUpperCase(),payload:e.preparePayload(n)}),this.submitPendingBusinessEvents()}}},{key:"trackEvent",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["behavioral"];if(!this.isMetricsDisabled()){var n,i=hf(r);try{for(i.s();!(n=i.n()).done;){var o=n.value;switch(o){case"behavioral":this.trackBehavioralEvent(e,t);break;case"operational":this.trackOperationalEvent(e,t);break;case"business":this.trackBusinessEvent(e,t);break;default:Yd.error("[MetricsManager] Invalid metric type: ".concat(o))}}}catch(e){i.e(e)}finally{i.f()}}}},{key:"timeEvent",value:function(e){if(!this.isMetricsDisabled()){var t=en()(e)?e:[e];if(0!==t.length){var r=t[0];this.runningEvents[r]={startTime:Ln()(),keys:new(W())(t)}}else Yd.error("[MetricsManager] No keys provided for timeEvent")}}},{key:"setWebex",value:function(e){var t=this;this.webex=e,this.webex.ready&&this.setReadyToSubmitEvents(),this.webex.once("ready",(function(){t.setReadyToSubmitEvents()}))}}],[{key:"spacesToUnderscore",value:function(e){return e.replace(/ /g,"_")}},{key:"preparePayload",value:function(t){var r={};if(l()(t).forEach((function(n){void 0===t[n]||null===t[n]||""===t[n]||en()(t[n])||"object"===_(t[n])&&0===l()(t[n]).length||(r[e.spacesToUnderscore(n)]=t[n])})),"undefined"==typeof window)return r;var n=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ff(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):ff(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}({},r);return n.tabHidden=document.hidden,n}},{key:"getInstance",value:function(t){return e.instance||(e.instance=new e),!e.instance.webex&&t&&t.webex&&e.instance.setWebex(t.webex),e.instance}},{key:"resetInstance",value:function(){e.instance=void 0}},{key:"getCommonTrackingFieldForAQMResponse",value:function(e){var t,r,n,i,o,a,s,c;return{agentId:(null==e||null===(t=e.data)||void 0===t?void 0:t.agentId)||(null==e?void 0:e.agentId),agentSessionId:(null==e||null===(r=e.data)||void 0===r?void 0:r.agentSessionId)||(null==e?void 0:e.agentSessionId),teamId:null!==(n=null!==(i=null==e?void 0:e.teamId)&&void 0!==i?i:null==e||null===(o=e.data)||void 0===o?void 0:o.teamId)&&void 0!==n?n:void 0,siteId:(null==e||null===(a=e.data)||void 0===a?void 0:a.siteId)||(null==e?void 0:e.siteId),orgId:(null==e||null===(s=e.data)||void 0===s?void 0:s.orgId)||(null==e?void 0:e.orgId),eventType:null==e?void 0:e.type,trackingId:null==e||null===(c=e.data)||void 0===c?void 0:c.trackingId,notifTrackingId:null==e?void 0:e.trackingId}}},{key:"getCommonTrackingFieldForAQMResponseFailed",value:function(e){var t,r,n;return{agentId:null==e||null===(t=e.data)||void 0===t?void 0:t.agentId,trackingId:null==e?void 0:e.trackingId,notifTrackingId:null==e?void 0:e.trackingId,orgId:null==e?void 0:e.orgId,failureType:null==e?void 0:e.type,failureReason:null==e||null===(r=e.data)||void 0===r?void 0:r.reason,reasonCode:null==e||null===(n=e.data)||void 0===n?void 0:n.reasonCode}}}]),e}();function gf(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function yf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?gf(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):gf(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}C(mf,"instance",void 0);var bf=function(){function e(t){ne(this,e),C(this,"webex",void 0);var r=t.webex;this.webex=r}return oe(e,[{key:"request",value:function(){var e=_e(Re().mark((function e(t){var r,n,i,o;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.service,n=t.resource,i=t.method,o=t.body,e.abrupt("return",this.webex.request({service:r,resource:n,method:i,body:o}));case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"uploadLogs",value:function(){var e=_e(Re().mark((function e(){var t,r,n,i=arguments;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:{},r=crypto.randomUUID(),e.prev=2,e.next=5,this.webex.internal.support.submitLogs(yf(yf({},t),{},{feedbackId:r}),void 0,{type:"diff"});case 5:return n=e.sent,Yd.info("Logs uploaded successfully with feedbackId: ".concat(r),{module:Sd,method:Xd}),mf.getInstance().trackEvent(uf.UPLOAD_LOGS_SUCCESS,{trackingId:null==n?void 0:n.trackingid,feedbackId:r,correlationId:null==t?void 0:t.correlationId},["behavioral"]),e.abrupt("return",yf(yf(yf(yf({trackingid:n.trackingid},n.url?{url:n.url}:{}),n.userId?{userId:n.userId}:{}),n.correlationId?{correlationId:n.correlationId}:{}),{},{feedbackId:r}));case 11:throw e.prev=11,e.t0=e.catch(2),Yd.error("Error uploading logs: ".concat(e.t0),{module:Sd,method:Xd}),mf.getInstance().trackEvent(uf.UPLOAD_LOGS_FAILED,{stack:null===e.t0||void 0===e.t0?void 0:e.t0.stack,feedbackId:r,correlationId:null==t?void 0:t.correlationId},["behavioral"]),e.t0;case 16:case"end":return e.stop()}}),e,this,[[2,11]])})));return function(){return e.apply(this,arguments)}}()}],[{key:"getInstance",value:function(t){return!e.instance&&t&&t.webex&&(e.instance=new e(t)),e.instance}}]),e}();C(bf,"instance",void 0);const Ef=bf;var Sf=function(e,t,r){var n,i,o={message:"",fieldName:""},a=e.details,s=null!==(n=null==a||null===(i=a.data)||void 0===i?void 0:i.reason)&&void 0!==n?n:"Error while performing ".concat(t);"AGENT_NOT_FOUND"===s&&"silentRelogin"===t||(Yd.error("".concat(t," failed with reason: ").concat(s),{module:r,method:t,trackingId:null==a?void 0:a.trackingId}),Ef.getInstance().uploadLogs({correlationId:null==a?void 0:a.trackingId})),"stationLogin"===t&&(o=function(e,t){var r,n,i,o="This value is already in use";t===dd&&(o="This extension is already in use"),t===ld&&(o="Dial number is in use. Try a different one. For help, reach out to your administrator or support team.");var a={DUPLICATE_LOCATION:{message:o,fieldName:t},INVALID_DIAL_NUMBER:{message:"Enter a valid US dial number. For help, reach out to your administrator or support team.",fieldName:t}},s=(null==e||null===(r=e.data)||void 0===r?void 0:r.reason)||"";return{message:(null===(n=a[s])||void 0===n?void 0:n.message)||"An error occurred while logging in to the station",fieldName:(null===(i=a[s])||void 0===i?void 0:i.fieldName)||"generic"}}(a,e.loginOption),Yd.error("".concat(t," failed with reason: ").concat(s,", message: ").concat(o.message,", fieldName: ").concat(o.fieldName),{module:r,method:t,trackingId:null==a?void 0:a.trackingId}));var c=new Error(null!=s?s:"Error while performing ".concat(t));return c.data=o,{error:c,reason:s}},_f=function(e){var t=function(e){var t,r;return{trackingId:(null==e||null===(t=e.headers)||void 0===t?void 0:t.trackingid)||(null==e||null===(r=e.headers)||void 0===r?void 0:r.TrackingID),msg:null==e?void 0:e.body}}(e);return new Jd("Service.reqs.generic.failure",t)};function wf(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function Rf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wf(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):wf(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}var Cf={AGENT_CONTACT_ASSIGN_FAILED:"AgentContactAssignFailed",AGENT_CONTACT_OFFER_RONA:"AgentOfferContactRona",AGENT_CONTACT_HELD:"AgentContactHeld",AGENT_CONTACT_HOLD_FAILED:"AgentContactHoldFailed",AGENT_CONTACT_UNHELD:"AgentContactUnheld",AGENT_CONTACT_UNHOLD_FAILED:"AgentContactUnHoldFailed",AGENT_CONSULT_CREATED:"AgentConsultCreated",AGENT_OFFER_CONSULT:"AgentOfferConsult",AGENT_CONSULTING:"AgentConsulting",AGENT_CONSULT_FAILED:"AgentConsultFailed",AGENT_CTQ_FAILED:"AgentCtqFailed",AGENT_CTQ_CANCELLED:"AgentCtqCancelled",AGENT_CTQ_CANCEL_FAILED:"AgentCtqCancelFailed",AGENT_CONSULT_ENDED:"AgentConsultEnded",AGENT_CONSULT_END_FAILED:"AgentConsultEndFailed",AGENT_CONSULT_CONFERENCE_ENDED:"AgentConsultConferenceEnded",AGENT_BLIND_TRANSFERRED:"AgentBlindTransferred",AGENT_BLIND_TRANSFER_FAILED:"AgentBlindTransferFailed",AGENT_VTEAM_TRANSFERRED:"AgentVteamTransferred",AGENT_VTEAM_TRANSFER_FAILED:"AgentVteamTransferFailed",AGENT_CONSULT_TRANSFERRING:"AgentConsultTransferring",AGENT_CONSULT_TRANSFERRED:"AgentConsultTransferred",AGENT_CONSULT_TRANSFER_FAILED:"AgentConsultTransferFailed",CONTACT_RECORDING_PAUSED:"ContactRecordingPaused",CONTACT_RECORDING_PAUSE_FAILED:"ContactRecordingPauseFailed",CONTACT_RECORDING_RESUMED:"ContactRecordingResumed",CONTACT_RECORDING_RESUME_FAILED:"ContactRecordingResumeFailed",CONTACT_ENDED:"ContactEnded",AGENT_CONTACT_END_FAILED:"AgentContactEndFailed",AGENT_WRAPUP:"AgentWrapup",AGENT_WRAPPEDUP:"AgentWrappedUp",AGENT_WRAPUP_FAILED:"AgentWrapupFailed",AGENT_OUTBOUND_FAILED:"AgentOutboundFailed",AGENT_CONTACT:"AgentContact",AGENT_OFFER_CONTACT:"AgentOfferContact",AGENT_CONTACT_ASSIGNED:"AgentContactAssigned",AGENT_CONTACT_UNASSIGNED:"AgentContactUnassigned",AGENT_INVITE_FAILED:"AgentInviteFailed"},Tf=Rf(Rf({},{WELCOME:"Welcome",AGENT_RELOGIN_SUCCESS:"AgentReloginSuccess",AGENT_RELOGIN_FAILED:"AgentReloginFailed",AGENT_DN_REGISTERED:"AgentDNRegistered",AGENT_LOGOUT:"Logout",AGENT_LOGOUT_SUCCESS:"AgentLogoutSuccess",AGENT_LOGOUT_FAILED:"AgentLogoutFailed",AGENT_STATION_LOGIN:"StationLogin",AGENT_STATION_LOGIN_SUCCESS:"AgentStationLoginSuccess",AGENT_STATION_LOGIN_FAILED:"AgentStationLoginFailed",AGENT_STATE_CHANGE:"AgentStateChange",AGENT_MULTI_LOGIN:"AGENT_MULTI_LOGIN",AGENT_STATE_CHANGE_SUCCESS:"AgentStateChangeSuccess",AGENT_STATE_CHANGE_FAILED:"AgentStateChangeFailed",AGENT_BUDDY_AGENTS:"BuddyAgents",AGENT_BUDDY_AGENTS_SUCCESS:"BuddyAgents",AGENT_BUDDY_AGENTS_RETRIEVE_FAILED:"BuddyAgentsRetrieveFailed",AGENT_CONTACT_RESERVED:"AgentContactReserved"}),Cf);function xf(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function kf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?xf(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):xf(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}var If="RoutingMessage",Af="/v1/tasks/",Of="/transfer",Lf="/end",Mf="accept",Nf="toggleMute",Pf="decline",Df="hold",Ff="resume",Uf="end",jf="wrapup",Bf="pauseRecording",qf="resumeRecording",Vf="consult",Gf="endConsult",Wf="transfer",zf="consultTransfer",Hf="updateTaskData",Kf="handleIncomingWebCall",$f="registerTaskListeners",Jf="removeTaskFromCollection",Yf="setupAutoWrapupTimer",Qf="cancelAutoWrapupTimer",Xf="queue",Zf="agent",eh="queue",th="telephony",rh=function(e){return e.TASK_INCOMING="task:incoming",e.TASK_ASSIGNED="task:assigned",e.TASK_MEDIA="task:media",e.TASK_UNASSIGNED="task:unassigned",e.TASK_HOLD="task:hold",e.TASK_RESUME="task:resume",e.TASK_CONSULT_END="task:consultEnd",e.TASK_CONSULT_QUEUE_CANCELLED="task:consultQueueCancelled",e.TASK_CONSULT_QUEUE_FAILED="task:consultQueueFailed",e.TASK_CONSULT_ACCEPTED="task:consultAccepted",e.TASK_CONSULTING="task:consulting",e.TASK_CONSULT_CREATED="task:consultCreated",e.TASK_OFFER_CONSULT="task:offerConsult",e.TASK_END="task:end",e.TASK_WRAPUP="task:wrapup",e.TASK_WRAPPEDUP="task:wrappedup",e.TASK_RECORDING_PAUSED="task:recordingPaused",e.TASK_RECORDING_PAUSE_FAILED="task:recordingPauseFailed",e.TASK_RECORDING_RESUMED="task:recordingResumed",e.TASK_RECORDING_RESUME_FAILED="task:recordingResumeFailed",e.TASK_REJECT="task:rejected",e.TASK_HYDRATE="task:hydrate",e.TASK_OFFER_CONTACT="task:offerContact",e}({});var nh=function(e,t){var r;return(null===(r=e.find((function(e){return e.name===t})))||void 0===r?void 0:r.url)||""},ih=function(e){var t,r;return{showUserDetailsMS:null!==(t=e.showUserDetailsMS)&&void 0!==t&&t,stateSynchronizationMS:null!==(r=e.stateSynchronizationMS)&&void 0!==r&&r}},oh=function(e){var t,r;return{showUserDetailsWebex:null!==(t=e.showUserDetailsWebex)&&void 0!==t&&t,stateSynchronizationWebex:null!==(r=e.stateSynchronizationWebex)&&void 0!==r&&r}},ah=function(e,t){var r=[];return e.forEach((function(e){if(t.includes(e.id)){var n={regex:e.regularExpression,prefix:e.prefix,strippedChars:e.strippedChars,name:e.name};r.push(n)}})),r},sh=function(e,t,r){var n=[];return e.forEach((function(e){e.workTypeCode===t&&e.active&&(0===r.length||r.includes(e.id))&&n.push({id:e.id,name:e.name,isSystem:e.isSystemCode,isDefault:e.defaultCode})})),n};function ch(e){var t,r,n=e.userData,i=e.teamData,o=e.tenantData,a=e.orgInfoData,s=e.auxCodes,c=e.orgSettingsData,u=e.agentProfileData,l=e.dialPlanData,d=e.urlMapping,f=o.timeoutDesktopInactivityEnabled?o.timeoutDesktopInactivityMins:null,h=u.timeoutDesktopInactivityCustomEnabled?u.timeoutDesktopInactivityMins:f,p=sh(s,"WRAP_UP_CODE","ALL"===u.accessWrapUpCode?[]:u.wrapUpCodes),v=sh(s,"IDLE_CODE","ALL"===u.accessIdleCode?[]:u.idleCodes);v.push({id:"0",name:"Available",isSystem:!1,isDefault:!1});var m,g,y=null==(m=p)?void 0:m.find((function(e){return e.isDefault}));return{teams:i,defaultDn:n.defaultDialledNumber,forceDefaultDn:o.forceDefaultDn,forceDefaultDnForAgent:(g=u.agentDNValidation,"PROVISIONED_VALUE"===g),regexUS:o.dnDefaultRegex,regexOther:o.dnOtherRegex,agentId:n.ciUserId,agentName:"".concat(n.firstName," ").concat(n.lastName),agentMailId:n.email,agentProfileID:n.agentProfileId,autoAnswer:u.autoAnswer,dialPlan:u.dialPlanEnabled?{type:"adhocDial",dialPlanEntity:ah(l,u.dialPlans)}:void 0,multimediaProfileId:e.multimediaProfileId,skillProfileId:n.skillProfileId?n.skillProfileId:null,siteId:n.siteId,enterpriseId:a.tenantId,tenantTimezone:a.timezone,privacyShieldVisible:o.privacyShieldVisible,organizationIdleCodes:[],idleCodesAccess:u.accessIdleCode,idleCodes:v,wrapupCodes:p,wrapUpData:{wrapUpProps:{autoWrapup:u.autoWrapUp,autoWrapupInterval:u.autoWrapAfterSeconds,lastAgentRoute:u.lastAgentRouting,wrapUpCodeAccess:u.accessWrapUpCode,wrapUpReasonList:p,allowCancelAutoWrapup:u.allowAutoWrapUpExtension}},defaultWrapupCode:null!==(t=null==y?void 0:y.id)&&void 0!==t?t:"",isOutboundEnabledForTenant:o.outdialEnabled,isOutboundEnabledForAgent:u.outdialEnabled,isAdhocDialingEnabled:u.dialPlanEnabled,isAgentAvailableAfterOutdial:u.agentAvailableAfterOutdial,outDialEp:u.outdialEntryPointId,isCampaignManagementEnabled:c.campaignManagerEnabled,isEndCallEnabled:o.endCallEnabled,isEndConsultEnabled:o.endConsultEnabled,callVariablesSuppressed:o.callVariablesSuppressed,agentDbId:n.dbId,allowConsultToQueue:u.consultToQueue,agentPersonalStatsEnabled:!!u.viewableStatistics&&u.viewableStatistics.agentStats,addressBookId:u.addressBookId,outdialANIId:u.outdialANIId,analyserUserId:n.id,urlMappings:{acqueonApiUrl:nh(d,"ACQUEON_API_URL"),acqueonConsoleUrl:nh(d,"ACQUEON_CONSOLE_URL")},isTimeoutDesktopInactivityEnabled:o.timeoutDesktopInactivityEnabled,timeoutDesktopInactivityMins:h,loginVoiceOptions:null!==(r=u.loginVoiceOptions)&&void 0!==r?r:[],webRtcEnabled:c.webRtcEnabled,maskSensitiveData:!!c.maskSensitiveData&&c.maskSensitiveData,microsoftConfig:ih(u),webexConfig:oh(u),lostConnectionRecoveryTimeout:o.lostConnectionRecoveryTimeout||5e4}}var uh=["id","isSystemCode","name","defaultCode","workTypeCode","active"],lh="getAgentConfig",dh="getUserUsingCI",fh="getDesktopProfileById",hh="getMultimediaProfileById",ph="getListOfTeams",vh="getAllTeams",mh="getListOfAuxCodes",gh="getAllAuxCodes",yh="getSiteInfo",bh="getOrgInfo",Eh="getOrganizationSetting",Sh="getTenantData",_h="getURLMapping",wh="getDialPlanData",Rh="getQueues",Ch=function(e,t){return"organization/".concat(e,"/user/by-ci-user-id/").concat(t)},Th=function(e,t){return"organization/".concat(e,"/agent-profile/").concat(t)},xh=function(e,t){return"organization/".concat(e,"/multimedia-profile/").concat(t)},kh=function(e,t,r,n){return"organization/".concat(e,"/v2/team?page=").concat(t,"&pageSize=").concat(r).concat(n&&n.length>0?"&filter=id=in=(".concat(n,")"):"")},Ih=function(e,t,r,n,i){return"organization/".concat(e,"/v2/auxiliary-code?page=").concat(t,"&pageSize=").concat(r).concat(n&&n.length>0?"&filter=id=in=(".concat(n,")"):"","&attributes=").concat(i)},Ah=function(e){return"organization/".concat(e)},Oh=function(e){return"organization/".concat(e,"/v2/organization-setting?agentView=true")},Lh=function(e,t){return"organization/".concat(e,"/site/").concat(t)},Mh=function(e){return"organization/".concat(e,"/v2/tenant-configuration?agentView=true")},Nh=function(e){return"organization/".concat(e,"/v2/org-url-mapping?sort=name,ASC")},Ph=function(e){return"organization/".concat(e,"/dial-plan?agentView=true")},Dh=function(e,t){return"organization/".concat(e,"/v2/contact-service-queue?").concat(t)};function Fh(e,t){var r=void 0!==Yr()&&e[Xr()]||e["@@iterator"];if(!r){if(en()(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return Uh(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return $r()(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Uh(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Uh(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var jh=function(){function e(){ne(this,e),C(this,"webexReq",void 0),this.webexReq=Ef.getInstance()}var t,r,n,i,o,a,s,c,u,l,d,f,h,v,m;return oe(e,[{key:"getAgentConfig",value:(m=_e(Re().mark((function e(t,r){var n,i,o,a,s,c,u,l,d,f,h,v,m,g,y,b,E,S,_,w,R,C,T,x,k,I=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,i=this.getUserUsingCI(t,r),o=this.getOrgInfo(t),a=this.getOrganizationSetting(t),s=this.getTenantData(t),c=this.getURLMapping(t),u=this.getAllAuxCodes(t,100,[],uh),e.next=9,i;case 9:return l=e.sent,Yd.info("Fetched user data, userId: ".concat(l.ciUserId),{module:md,method:lh}),d=this.getDesktopProfileById(t,l.agentProfileId),f=this.getSiteInfo(t,l.siteId),h=d.then((function(e){return e.dialPlanEnabled?I.getDialPlanData(t):[]})),v=l.teamIds?this.getAllTeams(t,100,l.teamIds):p().resolve([]),e.next=17,p().all([d,f,h,v,o,a,s,c,u]);case 17:return m=e.sent,g=lo(m,9),y=g[0],b=g[1],E=g[2],S=g[3],_=g[4],w=g[5],R=g[6],C=g[7],T=g[8],x=l.multimediaProfileId||(null===(n=S[0])||void 0===n?void 0:n.multiMediaProfileId)||b.multimediaProfileId,Yd.info("Fetched all required data",{module:md,method:lh}),k=ch({userData:l,teamData:S,tenantData:R,orgInfoData:_,auxCodes:T,orgSettingsData:w,agentProfileData:y,dialPlanData:E,urlMapping:C,multimediaProfileId:x}),Yd.info("Parsing completed for agent-config",{module:md,method:lh}),Yd.info("Fetched configuration data successfully",{module:md,method:lh}),e.abrupt("return",k);case 36:throw e.prev=36,e.t0=e.catch(0),Yd.error("getAgentConfig call failed with ".concat(e.t0),{module:md,method:lh}),e.t0;case 40:case"end":return e.stop()}}),e,this,[[0,36]])}))),function(e,t){return m.apply(this,arguments)})},{key:"getUserUsingCI",value:(v=_e(Re().mark((function e(t,r){var n,i;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Yd.info("Fetching user data using CI",{module:md,method:dh}),e.prev=1,n=Ch(t,r),e.next=5,this.webexReq.request({service:Bd,resource:n,method:ad});case 5:if(200===(i=e.sent).statusCode){e.next=8;break}throw new Error("API call failed with ".concat(i.statusCode));case 8:return Yd.log("getUserUsingCI api success.",{module:md,method:dh}),e.abrupt("return",p().resolve(i.body));case 12:throw e.prev=12,e.t0=e.catch(1),Yd.error("getUserUsingCI API call failed with ".concat(e.t0),{module:md,method:dh}),e.t0;case 16:case"end":return e.stop()}}),e,this,[[1,12]])}))),function(e,t){return v.apply(this,arguments)})},{key:"getDesktopProfileById",value:(h=_e(Re().mark((function e(t,r){var n,i;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Yd.info("Fetching desktop profile",{module:md,method:fh}),e.prev=1,n=Th(t,r),e.next=5,this.webexReq.request({service:Bd,resource:n,method:ad});case 5:if(200===(i=e.sent).statusCode){e.next=8;break}throw new Error("API call failed with ".concat(i.statusCode));case 8:return Yd.log("getDesktopProfileById api success.",{module:md,method:fh}),e.abrupt("return",p().resolve(i.body));case 12:throw e.prev=12,e.t0=e.catch(1),Yd.error("getDesktopProfileById API call failed with ".concat(e.t0),{module:md,method:fh}),e.t0;case 16:case"end":return e.stop()}}),e,this,[[1,12]])}))),function(e,t){return h.apply(this,arguments)})},{key:"getMultimediaProfileById",value:(f=_e(Re().mark((function e(t,r){var n,i;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Yd.info("Fetching multimedia profile",{module:md,method:hh}),e.prev=1,n=xh(t,r),e.next=5,this.webexReq.request({service:Bd,resource:n,method:ad});case 5:if(200===(i=e.sent).statusCode){e.next=8;break}throw new Error("API call failed with ".concat(i.statusCode));case 8:return Yd.log("getMultimediaProfileById API success.",{module:md,method:hh}),e.abrupt("return",p().resolve(i.body));case 12:throw e.prev=12,e.t0=e.catch(1),Yd.error("getMultimediaProfileById API call failed with ".concat(e.t0),{module:md,method:hh}),e.t0;case 16:case"end":return e.stop()}}),e,this,[[1,12]])}))),function(e,t){return f.apply(this,arguments)})},{key:"getListOfTeams",value:(d=_e(Re().mark((function e(t,r,n,i){var o,a;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Yd.info("Fetching list of teams",{module:md,method:ph}),e.prev=1,o=kh(t,r,n,i),e.next=5,this.webexReq.request({service:Bd,resource:o,method:ad});case 5:if(200===(a=e.sent).statusCode){e.next=8;break}throw new Error("API call failed with ".concat(a.statusCode));case 8:return Yd.log("getListOfTeams api success.",{module:md,method:ph}),e.abrupt("return",p().resolve(a.body));case 12:throw e.prev=12,e.t0=e.catch(1),Yd.error("getListOfTeams API call failed with ".concat(e.t0),{module:md,method:ph}),e.t0;case 16:case"end":return e.stop()}}),e,this,[[1,12]])}))),function(e,t,r,n){return d.apply(this,arguments)})},{key:"getAllTeams",value:(l=_e(Re().mark((function e(t,r,n){var i,o,a,s,c,u,l,d,f;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,i=[],o=0,e.next=5,this.getListOfTeams(t,o,r,n);case 5:for(a=e.sent,s=a.meta.totalPages,i=i.concat(a.data),c=[],o=1;o<s;o+=1)c.push(this.getListOfTeams(t,o,r,n));return e.next=12,p().all(c);case 12:u=e.sent,l=Fh(u);try{for(l.s();!(d=l.n()).done;)f=d.value,i=i.concat(f.data)}catch(e){l.e(e)}finally{l.f()}return e.abrupt("return",i);case 18:throw e.prev=18,e.t0=e.catch(0),Yd.error("getAllTeams API call failed with ".concat(e.t0),{module:md,method:vh}),e.t0;case 22:case"end":return e.stop()}}),e,this,[[0,18]])}))),function(e,t,r){return l.apply(this,arguments)})},{key:"getListOfAuxCodes",value:(u=_e(Re().mark((function e(t,r,n,i,o){var a,s;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Yd.info("Fetching list of aux codes",{module:md,method:mh}),e.prev=1,a=Ih(t,r,n,i,o),e.next=5,this.webexReq.request({service:Bd,resource:a,method:ad});case 5:if(200===(s=e.sent).statusCode){e.next=8;break}throw new Error("API call failed with ".concat(s.statusCode));case 8:return Yd.log("getListOfAuxCodes api success.",{module:md,method:mh}),e.abrupt("return",p().resolve(s.body));case 12:throw e.prev=12,e.t0=e.catch(1),Yd.error("getListOfAuxCodes API call failed with ".concat(e.t0),{module:md,method:mh}),e.t0;case 16:case"end":return e.stop()}}),e,this,[[1,12]])}))),function(e,t,r,n,i){return u.apply(this,arguments)})},{key:"getAllAuxCodes",value:(c=_e(Re().mark((function e(t,r,n,i){var o,a,s,c,u;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,o=[],a=0,e.next=5,this.getListOfAuxCodes(t,a,r,n,i);case 5:for(s=e.sent,o=o.concat(s.data),c=s.meta.totalPages,u=[],a=1;a<c;a+=1)u.push(this.getListOfAuxCodes(t,a,r,n,i));return e.next=12,p().all(u);case 12:return e.sent.forEach((function(e){o=o.concat(e.data)})),e.abrupt("return",o);case 17:throw e.prev=17,e.t0=e.catch(0),Yd.error("getAllAuxCodes API call failed with ".concat(e.t0),{module:md,method:gh}),e.t0;case 21:case"end":return e.stop()}}),e,this,[[0,17]])}))),function(e,t,r,n){return c.apply(this,arguments)})},{key:"getSiteInfo",value:(s=_e(Re().mark((function e(t,r){var n,i;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Yd.info("Fetching site information",{module:md,method:yh}),e.prev=1,n=Lh(t,r),e.next=5,this.webexReq.request({service:Bd,resource:n,method:ad});case 5:if(200===(i=e.sent).statusCode){e.next=8;break}throw new Error("API call failed with ".concat(i.statusCode));case 8:return Yd.log("getSiteInfo api success.",{module:md,method:yh}),e.abrupt("return",p().resolve(i.body));case 12:throw e.prev=12,e.t0=e.catch(1),Yd.error("getSiteInfo API call failed with ".concat(e.t0),{module:md,method:yh}),e.t0;case 16:case"end":return e.stop()}}),e,this,[[1,12]])}))),function(e,t){return s.apply(this,arguments)})},{key:"getOrgInfo",value:(a=_e(Re().mark((function e(t){var r,n;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=Ah(t),e.next=4,this.webexReq.request({service:Bd,resource:r,method:ad});case 4:if(200===(n=e.sent).statusCode){e.next=7;break}throw new Error("API call failed with ".concat(n.statusCode));case 7:return Yd.log("getOrgInfo api success.",{module:md,method:bh}),e.abrupt("return",p().resolve(n.body));case 11:throw e.prev=11,e.t0=e.catch(0),Yd.error("getOrgInfo API call failed with ".concat(e.t0),{module:md,method:bh}),e.t0;case 15:case"end":return e.stop()}}),e,this,[[0,11]])}))),function(e){return a.apply(this,arguments)})},{key:"getOrganizationSetting",value:(o=_e(Re().mark((function e(t){var r,n;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=Oh(t),e.next=4,this.webexReq.request({service:Bd,resource:r,method:ad});case 4:if(200===(n=e.sent).statusCode){e.next=7;break}throw new Error("API call failed with ".concat(n.statusCode));case 7:return Yd.log("getOrganizationSetting api success.",{module:md,method:Eh}),e.abrupt("return",p().resolve(n.body.data[0]));case 11:throw e.prev=11,e.t0=e.catch(0),Yd.error("getOrganizationSetting API call failed with ".concat(e.t0),{module:md,method:Eh}),e.t0;case 15:case"end":return e.stop()}}),e,this,[[0,11]])}))),function(e){return o.apply(this,arguments)})},{key:"getTenantData",value:(i=_e(Re().mark((function e(t){var r,n;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=Mh(t),e.next=4,this.webexReq.request({service:Bd,resource:r,method:ad});case 4:if(200===(n=e.sent).statusCode){e.next=7;break}throw new Error("API call failed with ".concat(n.statusCode));case 7:return Yd.log("getTenantData api success.",{module:md,method:Sh}),e.abrupt("return",p().resolve(n.body.data[0]));case 11:throw e.prev=11,e.t0=e.catch(0),Yd.error("getTenantData API call failed with ".concat(e.t0),{module:md,method:Sh}),e.t0;case 15:case"end":return e.stop()}}),e,this,[[0,11]])}))),function(e){return i.apply(this,arguments)})},{key:"getURLMapping",value:(n=_e(Re().mark((function e(t){var r,n;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=Nh(t),e.next=4,this.webexReq.request({service:Bd,resource:r,method:ad});case 4:if(200===(n=e.sent).statusCode){e.next=7;break}throw new Error("API call failed with ".concat(n.statusCode));case 7:return Yd.log("getURLMapping api success.",{module:md,method:_h}),e.abrupt("return",p().resolve(n.body.data));case 11:throw e.prev=11,e.t0=e.catch(0),Yd.error("getURLMapping API call failed with ".concat(e.t0),{module:md,method:_h}),e.t0;case 15:case"end":return e.stop()}}),e,this,[[0,11]])}))),function(e){return n.apply(this,arguments)})},{key:"getDialPlanData",value:(r=_e(Re().mark((function e(t){var r,n;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=Ph(t),e.next=4,this.webexReq.request({service:Bd,resource:r,method:ad});case 4:if(200===(n=e.sent).statusCode){e.next=7;break}throw new Error("API call failed with ".concat(n.statusCode));case 7:return Yd.log("getDialPlanData api success.",{module:md,method:wh}),e.abrupt("return",p().resolve(n.body));case 11:throw e.prev=11,e.t0=e.catch(0),Yd.error("getDialPlanData API call failed with ".concat(e.t0),{module:md,method:wh}),e.t0;case 15:case"end":return e.stop()}}),e,this,[[0,11]])}))),function(e){return r.apply(this,arguments)})},{key:"getQueues",value:(t=_e(Re().mark((function e(t,r,n,i,o){var a,s,c,u;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Yd.info("Fetching queue list",{module:md,method:Rh}),e.prev=1,s="page=".concat(r,"&pageSize=").concat(n,"&desktopProfileFilter=true"),i&&(s+="&search=".concat(i)),o&&(s+="&filter=".concat(o)),c=Dh(t,s),e.next=8,this.webexReq.request({service:Bd,resource:c,method:ad});case 8:if(200===(u=e.sent).statusCode){e.next=11;break}throw new Error("API call failed with ".concat(u.statusCode));case 11:return Yd.log("getQueues API success.",{module:md,method:Rh}),e.abrupt("return",null===(a=u.body)||void 0===a?void 0:a.data);case 15:throw e.prev=15,e.t0=e.catch(1),Yd.error("getQueues API call failed with ".concat(e.t0),{module:md,method:Rh}),e.t0;case 19:case"end":return e.stop()}}),e,this,[[1,15]])}))),function(e,r,n,i,o){return t.apply(this,arguments)})}]),e}();function Bh(e,t){var r=void 0!==Yr()&&e[Xr()]||e["@@iterator"];if(!r){if(en()(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return qh(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return $r()(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return qh(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function qh(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Vh=function(){function e(t){var r=this;ne(this,e),C(this,"pendingRequests",{}),C(this,"pendingNotifCancelrequest",{}),C(this,"webexRequest",void 0),C(this,"webSocketManager",void 0),C(this,"onMessage",(function(e){var t=JSON.parse(e);if("Welcome"!==t.type)if("true"!==t.keepalive){"AgentReloginFailed"===t.type&&Yd.info("Silently handling the agent relogin fail",{module:Ed,method:ef});var n,i=!1,o=Bh(l()(r.pendingRequests));try{for(o.s();!(n=o.n()).done;){var a=n.value,s=r.pendingRequests[a];if(s.check(t)){s.handle(t),i=!0;break}}}catch(e){o.e(e)}finally{o.f()}var c,u=Bh(l()(r.pendingNotifCancelrequest));try{for(u.s();!(c=u.n()).done;){var d=c.value,f=r.pendingNotifCancelrequest[d];f.check(t)&&(f.handle(t),i=!0)}}catch(e){u.e(e)}finally{u.f()}i||Yd.info("event=missingEventHandler | [AqmReqs] missing routing message handler",{module:Ed,method:ef})}else Yd.info("Keepalive from web socket",{module:Ed,method:ef});else Yd.info("Welcome message from Notifs Websocket",{module:Ed,method:ef})})),this.webexRequest=Ef.getInstance(),this.webSocketManager=t,this.webSocketManager.on("message",this.onMessage.bind(this))}var t;return oe(e,[{key:"req",value:function(e){var t=this;return function(r,n){return t.makeAPIRequest(e(r),n)}}},{key:"reqEmpty",value:function(e){var t=this;return function(r){return t.makeAPIRequest(e(),r)}}},{key:"makeAPIRequest",value:(t=_e(Re().mark((function e(t,r){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.createPromise(t,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"createPromise",value:function(e,t){var r=this;return new(p())((function(n,i){var o,a,s=r.bindPrint(e.notifSuccess.bind),c=e.notifFail?r.bindPrint(e.notifFail.bind):null,u=null!==(o=e.notifCancel)&&void 0!==o&&o.bind?r.bindPrint(e.notifCancel.bind):null,l="";if(r.pendingRequests[s]&&(l=s),c&&r.pendingRequests[c]&&(l+=c),l&&"disabled"!==e.timeout)i(new Jd("Service.aqm.reqs.Pending",{key:l,msg:"The request has been already created, multiple requests are not allowed."}));else{var d=!1,f=function(){delete r.pendingRequests[s],c&&delete r.pendingRequests[c],u&&delete r.pendingNotifCancelrequest[u],d=!0};r.pendingRequests[s]={check:function(t){return r.bindCheck(e.notifSuccess.bind,t)},handle:function(e){f(),n(e)}},u&&(r.pendingRequests[s].alternateBind=u,r.pendingNotifCancelrequest[u]={check:function(t){var n;return r.bindCheck(null===(n=e.notifCancel)||void 0===n?void 0:n.bind,t)},handle:function(e){var t=r.pendingNotifCancelrequest[u].alternateBind;t&&r.pendingRequests[t].handle(e)},alternateBind:s}),c&&(r.pendingRequests[c]={check:function(t){return r.bindCheck(e.notifFail.bind,t)},handle:function(t){f();var r=e.notifFail;if("errId"in r){Yd.log("Routing request failed: ".concat(Cr()(t)),{module:Ed,method:Zd});var n=new Jd(r.errId,t);Yd.log("Routing request failed: ".concat(n),{module:Ed,method:Zd}),i(n)}else i(r.err(t))}});var h=null;r.webexRequest.request({service:null!==(a=e.host)&&void 0!==a?a:"",resource:e.url,method:e.method?e.method:e.data?sd:ad,body:e.data}).then((function(e){h=e,t&&t(e)})).catch((function(t){f(),null!=t&&t.headers&&(t.headers.Authorization="*"),null!=t&&t.headers&&(t.headers.Authorization="*"),"function"==typeof e.err?i(e.err(t)):"string"==typeof e.err?i(new $d(e.err)):i(new $d("Service.aqm.reqs.GenericRequestError"))})),"disabled"!==e.timeout&&window.setTimeout((function(){var t;d||(f(),null!==(t=h)&&void 0!==t&&t.headers&&(h.headers.Authorization="*"),Yd.error("Routing request timeout".concat(s).concat(h).concat(e.url),{module:Ed,method:Zd}),i(new Jd("Service.aqm.reqs.Timeout",{key:s,response:h})))}),e.timeout&&e.timeout>0?e.timeout:2e4)}}))}},{key:"bindPrint",value:function(e){var t="";for(var r in e)en()(e[r])?t+="".concat(r,"=[").concat(e[r].join(","),"],"):"object"===_(e[r])&&null!==e[r]?t+="".concat(r,"=(").concat(this.bindPrint(e[r]),"),"):t+="".concat(r,"=").concat(e[r],",");return t?t.slice(0,-1):t}},{key:"bindCheck",value:function(e,t){for(var r in e)if(en()(e[r])){if(!e[r].includes(t[r]))return!1}else if("object"===_(e[r])&&null!==e[r]){if("object"!==_(t[r])||null===t[r])return!1;if(!this.bindCheck(e[r],t[r]))return!1}else if(!t[r]||t[r]!==e[r])return!1;return!0}}]),e}();function Gh(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var Wh=function(e){Je(a,e);var t,r,n,i,o=Gh(a);function a(e){var t;ne(this,a),C(Ye(t=o.call(this)),"websocket",void 0),C(Ye(t),"shouldReconnect",void 0),C(Ye(t),"isSocketClosed",void 0),C(Ye(t),"isWelcomeReceived",void 0),C(Ye(t),"url",null),C(Ye(t),"forceCloseWebSocketOnTimeout",void 0),C(Ye(t),"isConnectionLost",void 0),C(Ye(t),"webex",void 0),C(Ye(t),"welcomePromiseResolve",null),C(Ye(t),"keepaliveWorker",void 0);var r=e.webex;t.webex=r,t.shouldReconnect=!0,t.websocket={},t.isSocketClosed=!1,t.isWelcomeReceived=!1,t.forceCloseWebSocketOnTimeout=!1,t.isConnectionLost=!1;var n=new Blob(['\nconsole.log("*** Keepalive Worker Thread ***");\nlet intervalId, intervalDuration, timeOutId, isSocketClosed, closeSocketTimeout;\nlet initialised = false;\nlet initiateWebSocketClosure = false;\n\nconst resetOfflineHandler = function () {\n if (timeOutId) {\n initialised = false;\n clearTimeout(timeOutId);\n timeOutId = null;\n }\n};\n\nconst checkOnlineStatus = function () {\n const onlineStatus = navigator.onLine;\n console.log(\n `[WebSocketStatus] event=checkOnlineStatus | online status=`,\n onlineStatus\n );\n return onlineStatus;\n};\n\n// Checks network status and if it\'s offline then force closes WebSocket\nconst checkNetworkStatus = function () {\n const onlineStatus = checkOnlineStatus();\n postMessage({ type: "keepalive", onlineStatus });\n if (!onlineStatus && !initialised) {\n initialised = true;\n // Sets a timeout of 16s, checks if socket didn\'t close then it closes forcefully\n timeOutId = setTimeout(() => {\n if (!isSocketClosed) {\n initiateWebSocketClosure = true;\n postMessage({ type: "closeSocket" });\n }\n }, closeSocketTimeout);\n }\n\n if (onlineStatus && initialised) {\n initialised = false;\n }\n\n if (initiateWebSocketClosure) {\n initiateWebSocketClosure = false;\n clearTimeout(timeOutId);\n timeOutId = null;\n }\n};\n\naddEventListener("message", (event) => {\n if (event.data?.type === "start") {\n intervalDuration = event.data?.intervalDuration || 4000;\n closeSocketTimeout = event.data?.closeSocketTimeout || 5000;\n console.log("event=Websocket startWorker | keepalive Worker started");\n intervalId = setInterval(\n (checkIfSocketClosed) => {\n checkNetworkStatus();\n isSocketClosed = checkIfSocketClosed;\n },\n intervalDuration,\n event.data?.isSocketClosed\n );\n\n resetOfflineHandler();\n }\n\n if (event.data?.type === "terminate" && intervalId) {\n console.log("event=Websocket terminateWorker | keepalive Worker stopped");\n clearInterval(intervalId);\n intervalId = null;\n resetOfflineHandler();\n }\n});\n\n// Listen for online and offline events\nself.addEventListener(\'online\', () => {\n console.log(\'Network status: online\');\n checkNetworkStatus();\n});\n\nself.addEventListener(\'offline\', () => {\n console.log(\'Network status: offline\');\n checkNetworkStatus();\n});\n'],{type:"application/javascript"});return t.keepaliveWorker=new Worker(URL.createObjectURL(n)),t}return oe(a,[{key:"initWebSocket",value:(i=_e(Re().mark((function e(t){var r,n=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.body,e.next=3,this.register(r);case 3:return e.abrupt("return",new(p())((function(e,t){n.welcomePromiseResolve=e,n.connect().catch((function(e){Yd.error("[WebSocketStatus] | Error in connecting Websocket ".concat(e),{module:bd,method:tf}),t(e)}))})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"close",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Unknown";!this.isSocketClosed&&this.shouldReconnect&&(this.shouldReconnect=e,this.websocket.close(),this.keepaliveWorker.postMessage({type:"terminate"}),Yd.log("[WebSocketStatus] | event=webSocketClose | WebSocket connection closed manually REASON: ".concat(t),{module:bd,method:rf}))}},{key:"handleConnectionLost",value:function(e){this.isConnectionLost=e.isConnectionLost}},{key:"register",value:(n=_e(Re().mark((function e(t){var r;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.webex.request({service:Bd,resource:"v1/notification/subscribe",method:sd,body:t});case 3:r=e.sent,this.url=r.body.webSocketUrl,e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),Yd.error("Register API Failed, Request to RoutingNotifs websocket registration API failed ".concat(e.t0),{module:bd,method:nf});case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e){return n.apply(this,arguments)})},{key:"connect",value:(r=_e(Re().mark((function e(){var t=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.url){e.next=2;break}return e.abrupt("return",void 0);case 2:return Yd.log("[WebSocketStatus] | event=webSocketConnecting | Connecting to WebSocket: ".concat(this.url),{module:bd,method:of}),this.websocket=new WebSocket(this.url),e.abrupt("return",new(p())((function(e,r){t.websocket.onopen=function(){t.isSocketClosed=!1,t.shouldReconnect=!0,t.websocket.send(Cr()({keepalive:"true"})),t.keepaliveWorker.onmessage=function(e){var r,n;"keepalive"===(null==e||null===(r=e.data)||void 0===r?void 0:r.type)&&t.websocket.send(Cr()({keepalive:"true"})),"closeSocket"===(null==e||null===(n=e.data)||void 0===n?void 0:n.type)&&t.isConnectionLost&&(t.forceCloseWebSocketOnTimeout=!0,t.close(!0,"WebSocket did not auto close within 16 secs"),Yd.error("[webSocketTimeout] | event=webSocketTimeout | WebSocket connection closed forcefully",{module:bd,method:of}))},t.keepaliveWorker.postMessage({type:"start",intervalDuration:4e3,isSocketClosed:t.isSocketClosed,closeSocketTimeout:16e3})},t.websocket.onerror=function(e){Yd.error("[WebSocketStatus] | event=socketConnectionFailed | WebSocket connection failed ".concat(e),{module:bd,method:of}),r()},t.websocket.onclose=function(){var e=_e(Re().mark((function e(r){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.webSocketOnCloseHandler(r);case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t.websocket.onmessage=function(e){t.emit("message",e.data);var r=JSON.parse(e.data);r.type===Tf.WELCOME&&(t.isWelcomeReceived=!0,t.welcomePromiseResolve&&(t.welcomePromiseResolve(r.data),t.welcomePromiseResolve=null)),"AGENT_MULTI_LOGIN"===r.type&&(t.close(!1,"multiLogin"),Yd.error("[WebSocketStatus] | event=agentMultiLogin | WebSocket connection closed by agent multiLogin",{module:bd,method:of}))}})));case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"webSocketOnCloseHandler",value:(t=_e(Re().mark((function e(t){var r,n;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.isSocketClosed=!0,this.keepaliveWorker.postMessage({type:"terminate"}),this.shouldReconnect&&(this.emit("socketClose"),this.forceCloseWebSocketOnTimeout?r="WebSocket auto close timed out. Forcefully closed websocket.":(n=navigator.onLine,Yd.info("[WebSocketStatus] | desktop online status is ".concat(n),{module:bd,method:af}),r=n?"missing keepalive from either desktop or notif service":"network issue"),Yd.error("[WebSocketStatus] | event=webSocketClose | WebSocket connection closed REASON: ".concat(r),{module:bd,method:af}),this.forceCloseWebSocketOnTimeout=!1);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),a}(qe());function zh(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var Hh=function(e){Je(r,e);var t=zh(r);function r(e){var n;return ne(this,r),C(Ye(n=t.call(this)),"connectionProp",{lostConnectionRecoveryTimeout:5e4}),C(Ye(n),"wsDisconnectAllowed",8e3),C(Ye(n),"reconnectingTimer",void 0),C(Ye(n),"restoreTimer",void 0),C(Ye(n),"isConnectionLost",void 0),C(Ye(n),"isRestoreFailed",void 0),C(Ye(n),"isSocketReconnected",void 0),C(Ye(n),"isKeepAlive",void 0),C(Ye(n),"reconnectInterval",void 0),C(Ye(n),"webSocketManager",void 0),C(Ye(n),"subscribeRequest",void 0),C(Ye(n),"handleConnectionLost",(function(){n.isConnectionLost=!0,n.dispatchConnectionEvent()})),C(Ye(n),"clearTimerOnRestoreFailed",_e(Re().mark((function e(){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n.reconnectInterval&&clearInterval(n.reconnectInterval);case 1:case"end":return e.stop()}}),e)})))),C(Ye(n),"handleRestoreFailed",_e(Re().mark((function e(){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.isRestoreFailed=!0,n.webSocketManager.shouldReconnect=!1,n.dispatchConnectionEvent(),e.next=5,n.clearTimerOnRestoreFailed();case 5:case"end":return e.stop()}}),e)})))),C(Ye(n),"updateConnectionData",(function(){n.isRestoreFailed=!1,n.isConnectionLost=!1,n.isSocketReconnected=!1})),C(Ye(n),"onPing",(function(e){var t=JSON.parse(e);n.reconnectingTimer&&clearTimeout(n.reconnectingTimer),n.restoreTimer&&clearTimeout(n.restoreTimer),n.isKeepAlive="true"===t.keepalive,(n.isConnectionLost&&!n.isRestoreFailed||n.isKeepAlive)&&!n.isSocketReconnected?(n.updateConnectionData(),n.dispatchConnectionEvent()):n.isSocketReconnected&&n.isKeepAlive&&(n.updateConnectionData(),n.dispatchConnectionEvent(!0)),n.reconnectingTimer=setTimeout(n.handleConnectionLost,n.wsDisconnectAllowed),n.restoreTimer=setTimeout(n.handleRestoreFailed,n.connectionProp&&n.connectionProp.lostConnectionRecoveryTimeout)})),C(Ye(n),"handleSocketClose",_e(Re().mark((function e(){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Yd.info("event=socketConnectionRetry | Trying to reconnect to websocket",{module:yd,method:cf}),!navigator.onLine){e.next=10;break}return e.next=5,n.webSocketManager.initWebSocket({body:n.subscribeRequest});case 5:return e.next=7,n.clearTimerOnRestoreFailed();case 7:n.isSocketReconnected=!0,e.next=11;break;case 10:throw new Error("event=socketConnectionRetry | browser network not available");case 11:case"end":return e.stop()}}),e)})))),C(Ye(n),"onSocketClose",(function(){n.clearTimerOnRestoreFailed(),n.reconnectInterval=setInterval(_e(Re().mark((function e(){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.handleSocketClose();case 2:case"end":return e.stop()}}),e)}))),5e3)})),n.webSocketManager=e.webSocketManager,n.subscribeRequest=e.subscribeRequest,n.isConnectionLost=!1,n.isRestoreFailed=!1,n.isSocketReconnected=!1,n.isKeepAlive=!1,n.setupEventListeners(),n}return oe(r,[{key:"setupEventListeners",value:function(){this.webSocketManager.on("message",this.onPing.bind(this)),this.webSocketManager.on("socketClose",this.onSocketClose.bind(this))}},{key:"dispatchConnectionEvent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t={isConnectionLost:this.isConnectionLost,isRestoreFailed:this.isRestoreFailed,isSocketReconnected:!this.webSocketManager.isSocketClosed&&(e||this.isSocketReconnected),isKeepAlive:this.isKeepAlive};this.webSocketManager.handleConnectionLost(t),Yd.info("Dispatching connection event",{module:yd,method:sf}),this.emit("connectionLost",t)}},{key:"setConnectionProp",value:function(e){this.connectionProp=e}}]),r}(Be.EventEmitter);var Kh=function(){function e(t){ne(this,e),C(this,"agent",void 0),C(this,"config",void 0),C(this,"contact",void 0),C(this,"dialer",void 0),C(this,"webSocketManager",void 0),C(this,"connectionService",void 0);var r=t.webex,n=t.connectionConfig;this.webSocketManager=new Wh({webex:r});var i,o,a=new Vh(this.webSocketManager);this.config=new jh,this.agent={reload:(i=a).reqEmpty((function(){return{host:Bd,url:"/v1/agents/reload",data:{},err:_f,notifSuccess:{bind:{type:Tf.AGENT_RELOGIN_SUCCESS,data:{type:Tf.AGENT_RELOGIN_SUCCESS}},msg:{}},notifFail:{bind:{type:Tf.AGENT_RELOGIN_FAILED,data:{type:Tf.AGENT_RELOGIN_FAILED}},errId:"Service.aqm.agent.reload"}}})),logout:i.req((function(e){return{url:"/v1/agents/logout",host:Bd,data:e.data,err:_f,notifSuccess:{bind:{type:Tf.AGENT_LOGOUT,data:{type:Tf.AGENT_LOGOUT_SUCCESS}},msg:{}},notifFail:{bind:{type:Tf.AGENT_LOGOUT,data:{type:Tf.AGENT_LOGOUT_FAILED}},errId:"Service.aqm.agent.logout"}}})),stationLogin:i.req((function(e){return{url:"/v1/agents/login",host:Bd,data:e.data,err:function(e){var t,r,n,i,o,a,s;return new Jd("Service.aqm.agent.stationLogin",{status:null!==(t=null===(r=e.response)||void 0===r?void 0:r.status)&&void 0!==t?t:0,type:null===(n=e.response)||void 0===n||null===(i=n.data)||void 0===i?void 0:i.errorType,trackingId:null===(o=e.response)||void 0===o||null===(a=o.headers)||void 0===a||null===(s=a.trackingid)||void 0===s?void 0:s.split("_")[1]})},notifSuccess:{bind:{type:Tf.AGENT_STATION_LOGIN,data:{type:Tf.AGENT_STATION_LOGIN_SUCCESS}},msg:{}},notifFail:{bind:{type:Tf.AGENT_STATION_LOGIN,data:{type:Tf.AGENT_STATION_LOGIN_FAILED}},errId:"Service.aqm.agent.stationLoginFailed"}}})),stateChange:i.req((function(e){return{url:"/v1/agents/session/state",host:Bd,data:e.data,err:_f,method:cd,notifSuccess:{bind:{type:Tf.AGENT_STATE_CHANGE,data:{type:Tf.AGENT_STATE_CHANGE_SUCCESS}},msg:{}},notifFail:{bind:{type:Tf.AGENT_STATE_CHANGE,data:{type:Tf.AGENT_STATE_CHANGE_FAILED}},errId:"Service.aqm.agent.stateChange"}}})),buddyAgents:i.req((function(e){return{url:"/v1/agents/buddyList",host:Bd,data:kf({},e.data),err:_f,method:sd,notifSuccess:{bind:{type:Tf.AGENT_BUDDY_AGENTS,data:{type:Tf.AGENT_BUDDY_AGENTS_SUCCESS}},msg:{}},notifFail:{bind:{type:Tf.AGENT_BUDDY_AGENTS,data:{type:Tf.AGENT_BUDDY_AGENTS_RETRIEVE_FAILED}},errId:"Service.aqm.agent.BuddyAgentsRetrieveFailed"}}}))},this.contact={accept:(o=a).req((function(e){return{url:"".concat(Af).concat(e.interactionId,"/accept"),host:Bd,data:{},err:_f,notifSuccess:{bind:{type:If,data:{type:Tf.AGENT_CONTACT_ASSIGNED,interactionId:e.interactionId}},msg:{}},notifFail:{bind:{type:If,data:{type:Tf.AGENT_CONTACT_ASSIGN_FAILED,interactionId:e.interactionId}},errId:"Service.aqm.task.accept"}}})),hold:o.req((function(e){return{url:"".concat(Af).concat(e.interactionId).concat("/hold"),data:e.data,host:Bd,err:_f,notifSuccess:{bind:{type:If,data:{type:Tf.AGENT_CONTACT_HELD,interactionId:e.interactionId}},msg:{}},notifFail:{bind:{type:If,data:{type:Tf.AGENT_CONTACT_HOLD_FAILED}},errId:"Service.aqm.task.hold"}}})),unHold:o.req((function(e){return{url:"".concat(Af).concat(e.interactionId).concat("/unhold"),data:e.data,host:Bd,err:_f,notifSuccess:{bind:{type:If,data:{type:Tf.AGENT_CONTACT_UNHELD,interactionId:e.interactionId}},msg:{}},notifFail:{bind:{type:If,data:{type:Tf.AGENT_CONTACT_UNHOLD_FAILED}},errId:"Service.aqm.task.unHold"}}})),pauseRecording:o.req((function(e){return{url:"".concat(Af).concat(e.interactionId).concat("/record/pause"),data:{},host:Bd,err:_f,notifSuccess:{bind:{type:If,data:{type:Tf.CONTACT_RECORDING_PAUSED,interactionId:e.interactionId}},msg:{}},notifFail:{bind:{type:If,data:{type:Tf.CONTACT_RECORDING_PAUSE_FAILED}},errId:"Service.aqm.task.pauseRecording"}}})),resumeRecording:o.req((function(e){return{url:"".concat(Af).concat(e.interactionId).concat("/record/resume"),data:e.data,host:Bd,err:_f,notifSuccess:{bind:{type:If,data:{type:Tf.CONTACT_RECORDING_RESUMED,interactionId:e.interactionId}},msg:{}},notifFail:{bind:{type:If,data:{type:Tf.CONTACT_RECORDING_RESUME_FAILED}},errId:"Service.aqm.task.resumeRecording"}}})),consult:o.req((function(e){return{url:"".concat(Af).concat(e.interactionId).concat("/consult"),data:e.data,timeout:e.data&&e.data.destinationType===Xf?"disabled":2e4,host:Bd,err:_f,notifSuccess:{bind:{type:If,data:{type:Tf.AGENT_CONSULT_CREATED,interactionId:e.interactionId}},msg:{}},notifFail:{bind:{type:If,data:{type:e.data&&e.data.destinationType===Xf?Tf.AGENT_CTQ_FAILED:Tf.AGENT_CONSULT_FAILED}},errId:"Service.aqm.task.consult"},notifCancel:{bind:{type:If,data:{type:"AgentCtqCancelled",interactionId:e.interactionId}},msg:{}}}})),consultEnd:o.req((function(e){var t=e.data,r=t.isConsult,n=t.isSecondaryEpDnAgent,i=void 0!==n&&n,o=t.queueId;return{url:"".concat(Af).concat(e.interactionId).concat("/consult/end"),host:Bd,data:o?{queueId:o}:{},err:_f,notifSuccess:{bind:{type:"RoutingMessage",data:{type:o?Tf.AGENT_CTQ_CANCELLED:i?Tf.CONTACT_ENDED:r?Tf.AGENT_CONSULT_ENDED:Tf.AGENT_CONSULT_CONFERENCE_ENDED,interactionId:e.interactionId}},msg:{}},notifFail:{bind:{type:"RoutingMessage",data:{type:e.data.queueId?Tf.AGENT_CTQ_CANCEL_FAILED:Tf.AGENT_CONSULT_END_FAILED}},errId:e.data.queueId?"Service.aqm.task.cancelCtq":"Service.aqm.task.consultEnd"}}})),consultAccept:o.req((function(e){return{url:"".concat(Af).concat(e.interactionId).concat("/consult/accept"),data:{},host:Bd,err:_f,notifSuccess:{bind:{type:If,data:{type:Tf.AGENT_CONSULTING,interactionId:e.interactionId}},msg:{}},notifFail:{bind:{type:If,data:{type:Tf.AGENT_CONTACT_ASSIGN_FAILED}},errId:"Service.aqm.task.consultAccept"}}})),blindTransfer:o.req((function(e){return{url:"".concat(Af).concat(e.interactionId).concat(Of),data:e.data,host:Bd,err:_f,notifSuccess:{bind:{type:If,data:{type:Tf.AGENT_BLIND_TRANSFERRED,interactionId:e.interactionId}},msg:{}},notifFail:{bind:{type:If,data:{type:Tf.AGENT_BLIND_TRANSFER_FAILED}},errId:"Service.aqm.task.AgentBlindTransferFailedEvent"}}})),vteamTransfer:o.req((function(e){return{url:"".concat(Af).concat(e.interactionId).concat(Of),data:e.data,host:Bd,err:_f,notifSuccess:{bind:{type:If,data:{type:Tf.AGENT_VTEAM_TRANSFERRED,interactionId:e.interactionId}},msg:{}},notifFail:{bind:{type:If,data:{type:Tf.AGENT_VTEAM_TRANSFER_FAILED}},errId:"Service.aqm.task.AgentVteamTransferFailed"}}})),consultTransfer:o.req((function(e){return{url:"".concat(Af).concat(e.interactionId).concat("/consult/transfer"),data:e.data,host:Bd,err:_f,notifSuccess:{bind:{type:If,data:{type:[Tf.AGENT_CONSULT_TRANSFERRED,Tf.AGENT_CONSULT_TRANSFERRING],interactionId:e.interactionId}},msg:{}},notifFail:{bind:{type:If,data:{type:Tf.AGENT_CONSULT_TRANSFER_FAILED}},errId:"Service.aqm.task.AgentConsultTransferFailed"}}})),end:o.req((function(e){return{url:"".concat(Af).concat(e.interactionId).concat(Lf),data:{},host:Bd,err:_f,notifSuccess:{bind:{type:If,data:{type:Tf.AGENT_WRAPUP,interactionId:e.interactionId}},msg:{}},notifFail:{bind:{type:If,data:{type:Tf.AGENT_CONTACT_END_FAILED}},errId:"Service.aqm.task.end"}}})),wrapup:o.req((function(e){return{url:"".concat(Af).concat(e.interactionId).concat("/wrapup"),data:e.data,host:Bd,err:_f,notifSuccess:{bind:{type:If,data:{type:Tf.AGENT_WRAPPEDUP,interactionId:e.interactionId}},msg:{}},notifFail:{bind:{type:If,data:{type:Tf.AGENT_WRAPUP_FAILED}},errId:"Service.aqm.task.wrapup"}}})),cancelTask:o.req((function(e){return{url:"".concat(Af).concat(e.interactionId).concat(Lf),data:{},host:Bd,err:_f,notifSuccess:{bind:{type:If,data:{type:Tf.CONTACT_ENDED,interactionId:e.interactionId}},msg:{}},notifFail:{bind:{type:If,data:{type:Tf.AGENT_CONTACT_END_FAILED}},errId:"Service.aqm.task.end"}}})),cancelCtq:o.req((function(e){return{url:"".concat(Af).concat(e.interactionId,"/cancelCtq"),data:e.data,host:Bd,err:_f,notifSuccess:{bind:{type:If,data:{type:"AgentCtqCancelled",interactionId:e.interactionId}},msg:{}},notifFail:{bind:{type:If,data:{type:"AgentCtqCancelFailed"}},errId:"Service.aqm.task.cancelCtq"}}}))},this.dialer=function(e){return{startOutdial:e.req((function(e){return{url:"".concat(Af),host:Bd,data:e.data,err:_f,notifSuccess:{bind:{type:If,data:{type:Tf.AGENT_OFFER_CONTACT}},msg:{}},notifFail:{bind:{type:If,data:{type:Tf.AGENT_OUTBOUND_FAILED}},errId:"Service.aqm.dialer.startOutdial"}}}))}}(a),this.connectionService=new Hh({webSocketManager:this.webSocketManager,subscribeRequest:n})}return oe(e,null,[{key:"getInstance",value:function(t){return this.instance||(this.instance=new e(t)),this.instance}}]),e}();C(Kh,"instance",void 0);var $h=function(e){return e.AGENT_STATE_CHANGE="agent:stateChange",e.AGENT_MULTI_LOGIN="agent:multiLogin",e.AGENT_STATION_LOGIN_SUCCESS="agent:stationLoginSuccess",e.AGENT_STATION_LOGIN_FAILED="agent:stationLoginFailed",e.AGENT_LOGOUT_SUCCESS="agent:logoutSuccess",e.AGENT_LOGOUT_FAILED="agent:logoutFailed",e.AGENT_DN_REGISTERED="agent:dnRegistered",e.AGENT_RELOGIN_SUCCESS="agent:reloginSuccess",e.AGENT_STATE_CHANGE_SUCCESS="agent:stateChangeSuccess",e.AGENT_STATE_CHANGE_FAILED="agent:stateChangeFailed",e}({}),Jh=__webpack_require__(42437),Yh=__webpack_require__(44221);function Qh(){return Qh="undefined"!=typeof Reflect&&Jh?Jh.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ze(e)););return e}(e,t);if(n){var i=Yh(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},Qh.apply(this,arguments)}function Xh(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(e)}function Zh(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function ep(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Zh(o,n,i,a,s,"next",e)}function s(e){Zh(o,n,i,a,s,"throw",e)}a(void 0)}))}}function tp(){}function rp(){rp.init.call(this)}function np(e){return void 0===e._maxListeners?rp.defaultMaxListeners:e._maxListeners}function ip(e,t,r,n){var i,o,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]):(o=e._events=new tp,e._eventsCount=0),a){if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),!a.warned&&(i=np(e))&&i>0&&a.length>i){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=a.length,function(e){"function"==typeof console.warn?console.warn(e):console.log(e)}(s)}}else a=o[t]=r,++e._eventsCount;return e}function op(e,t,r){var n=!1;function i(){e.removeListener(t,i),n||(n=!0,r.apply(e,arguments))}return i.listener=r,i}function ap(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function sp(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}tp.prototype=Object.create(null),rp.EventEmitter=rp,rp.usingDomains=!1,rp.prototype.domain=void 0,rp.prototype._events=void 0,rp.prototype._maxListeners=void 0,rp.defaultMaxListeners=10,rp.init=function(){this.domain=null,rp.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new tp,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},rp.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},rp.prototype.getMaxListeners=function(){return np(this)},rp.prototype.emit=function(e){var t,r,n,i,o,a,s,c="error"===e;if(a=this._events)c=c&&null==a.error;else if(!c)return!1;if(s=this.domain,c){if(t=arguments[1],!s){if(t instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(r=a[e]))return!1;var l="function"==typeof r;switch(n=arguments.length){case 1:!function(e,t,r){if(t)e.call(r);else for(var n=e.length,i=sp(e,n),o=0;o<n;++o)i[o].call(r)}(r,l,this);break;case 2:!function(e,t,r,n){if(t)e.call(r,n);else for(var i=e.length,o=sp(e,i),a=0;a<i;++a)o[a].call(r,n)}(r,l,this,arguments[1]);break;case 3:!function(e,t,r,n,i){if(t)e.call(r,n,i);else for(var o=e.length,a=sp(e,o),s=0;s<o;++s)a[s].call(r,n,i)}(r,l,this,arguments[1],arguments[2]);break;case 4:!function(e,t,r,n,i,o){if(t)e.call(r,n,i,o);else for(var a=e.length,s=sp(e,a),c=0;c<a;++c)s[c].call(r,n,i,o)}(r,l,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(n-1),o=1;o<n;o++)i[o-1]=arguments[o];!function(e,t,r,n){if(t)e.apply(r,n);else for(var i=e.length,o=sp(e,i),a=0;a<i;++a)o[a].apply(r,n)}(r,l,this,i)}return!0},rp.prototype.addListener=function(e,t){return ip(this,e,t,!1)},rp.prototype.on=rp.prototype.addListener,rp.prototype.prependListener=function(e,t){return ip(this,e,t,!0)},rp.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,op(this,e,t)),this},rp.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,op(this,e,t)),this},rp.prototype.removeListener=function(e,t){var r,n,i,o,a;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(r=n[e]))return this;if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new tp:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length;o-- >0;)if(r[o]===t||r[o].listener&&r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new tp,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,i=e.length;n<i;r+=1,n+=1)e[r]=e[n];e.pop()}(r,i);n.removeListener&&this.emit("removeListener",e,a||t)}return this},rp.prototype.off=function(e,t){return this.removeListener(e,t)},rp.prototype.removeAllListeners=function(e){var t,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new tp,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new tp:delete r[e]),this;if(0===arguments.length){for(var n,i=Object.keys(r),o=0;o<i.length;++o)"removeListener"!==(n=i[o])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=new tp,this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},rp.prototype.listeners=function(e){var t,r,n=this._events;return r=n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(t):[],r},rp.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):ap.call(e,t)},rp.prototype.listenerCount=ap,rp.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};class cp extends rp{}var up,lp="MEDIA",dp="DEVICE",fp="MEDIA_STREAM_TRACK",hp={error:1,warn:2,info:3,debug:4},pp="error",vp=(e,t)=>{hp[e]<=hp[pp]&&console.log(((e,t)=>{var{ID:r,mediaType:n,action:i,description:o,error:a}=t,s=(new Date).toISOString(),c=a?a.stack?"".concat(a.message,": ").concat(a.stack):"".concat(a):"";return"".concat(s," ").concat(e," ").concat(r||""," ").concat(n," ").concat(i," ").concat(o," ").concat(c).replace(/\s+/g," ").trim()})(e,t))},mp={info:e=>vp("info",e),warn:e=>vp("warn",e),error:e=>vp("error",e),debug:e=>vp("debug",e)},gp=function(e){mp[e]=t=>{var{ID:r,mediaType:n,action:i,description:o,error:a}=t;return pp=e,vp(e,{ID:r,mediaType:n,action:i,description:o,error:a})}};for(var yp of["info","warn","error","debug"])gp(yp);function bp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ep(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function Sp(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,Ep(e,t,"get"))}function _p(e,t,r){return function(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}(e,Ep(e,t,"set"),r),r}function wp(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}!function(e){e.AUDIO_INPUT="audioinput",e.AUDIO_OUTPUT="audiooutput",e.VIDEO_INPUT="videoinput"}(up||(up={}));var Rp,Cp,Tp,xp=new WeakMap;class kp{constructor(e){bp(this,"ID",void 0),bp(this,"groupID",void 0),bp(this,"label",void 0),bp(this,"kind",void 0),wp(this,xp,{writable:!0,value:void 0}),_p(this,xp,e),this.ID=Sp(this,xp).deviceId,this.groupID=Sp(this,xp).groupId,this.label=Sp(this,xp).label,this.kind=Sp(this,xp).kind}}function Ip(e){mp.debug({ID:e.id,mediaType:fp,action:"getTrackSettings()",description:"Called"});var t=e.getSettings();if(t)return mp.debug({ID:e.id,mediaType:fp,action:"getTrackSettings()",description:"Returning track settings ".concat(JSON.stringify(t))}),t;var r=new Error("Unable to get track settings");return mp.info({ID:e.id,mediaType:fp,action:"getTrackSettings()",description:r.message,error:r}),{}}function Ap(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}!function(e){e.TRACK_MUTE_STATE_CHANGED="track:mute"}(Rp||(Rp={})),function(e){e.ENDED="ended",e.LIVE="live"}(Cp||(Cp={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(Tp||(Tp={}));var Op=new WeakMap;class Lp extends cp{constructor(e){super(),bp(this,"ID",void 0),bp(this,"kind",void 0),bp(this,"status",void 0),bp(this,"muted",void 0),bp(this,"label",void 0),Ap(this,Op,{writable:!0,value:void 0}),this.ID=e.id,this.kind=e.kind,this.status=e.readyState,this.muted=e.muted,this.label=e.label,_p(this,Op,e),Sp(this,Op).onmute=()=>{var e=Sp(this,Op).enabled?"muted":"unmuted";this.emit(Rp.TRACK_MUTE_STATE_CHANGED,{action:e})}}stop(){Sp(this,Op).stop(),this.status=Cp.ENDED}applyConstraints(e){var t=this;return ep((function*(){var r,n,i;mp.debug({ID:null==e||null===(r=e.deviceId)||void 0===r?void 0:r.toString(),mediaType:dp,action:"applyConstraints()",description:"Called with ".concat(JSON.stringify(e))}),mp.info({ID:null==e||null===(n=e.deviceId)||void 0===n?void 0:n.toString(),mediaType:dp,action:"applyConstraints()",description:"Applying constraints to track objects"});var o,a=navigator.mediaDevices.getSupportedConstraints(),s=[];for(var c of Object.keys(e)){var u;if(!a[c])mp.debug({ID:null==e||null===(u=e.deviceId)||void 0===u?void 0:u.toString(),mediaType:dp,action:"applyConstraints()",description:"Not supported constraint tracked ".concat(c)}),s.push(c)}return s.length>0?(console.warn("#TrackObject Unsupported constraints - ".concat(s.join(", "))),mp.debug({ID:null==e||null===(o=e.deviceId)||void 0===o?void 0:o.toString(),mediaType:dp,action:"applyConstraints()",description:"Constraints not applied"}),!1):(yield Sp(t,Op).applyConstraints(e),mp.debug({ID:null==e||null===(i=e.deviceId)||void 0===i?void 0:i.toString(),mediaType:dp,action:"applyConstraints()",description:"Constraints applied successfully"}),!0)}))()}getSettings(){mp.debug({mediaType:lp,action:"getSettings()",description:"Called"}),mp.info({mediaType:lp,action:"getSettings()",description:"Fetching constraints properties for the current media stream track"});var e=Ip(Sp(this,Op));return mp.debug({mediaType:lp,action:"getSettings()",description:"Received settings ".concat(JSON.stringify(e))}),e}getMediaStreamTrack(){mp.debug({mediaType:lp,action:"getMediaStreamTrack()",description:"Called"});var e=Sp(this,Op);return mp.debug({mediaType:lp,action:"getMediaStreamTrack()",description:"Received media stream track ".concat(JSON.stringify(e))}),e}}var Mp=new cp,Np=[],Pp=function(){var e=ep((function*(){var e;return mp.debug({mediaType:dp,action:"getDevices()",description:"Called"}),null!==(e=navigator.mediaDevices)&&void 0!==e&&e.enumerateDevices?(mp.info({mediaType:dp,action:"getDevices()",description:"Requesting list of available media input and output devices"}),navigator.mediaDevices.enumerateDevices()):(console.warn("navigator.mediaDevices.enumerateDevices() is not supported."),[])}));return function(){return e.apply(this,arguments)}}(),Dp=function(){var e=ep((function*(){mp.debug({mediaType:dp,action:"getCameras()",description:"Called"});var e=yield Pp();return mp.info({mediaType:dp,action:"getCameras()",description:"Filtering camera devices from all available media devices"}),e.filter((e=>{var{kind:t}=e;return t===up.VIDEO_INPUT})).map((e=>(mp.debug({ID:e.deviceId,mediaType:dp,action:"getCameras()",description:"Received camera device ".concat(JSON.stringify(e))}),new kp(e))))}));return function(){return e.apply(this,arguments)}}(),Fp=function(){var e=ep((function*(){mp.debug({mediaType:dp,action:"getMicrophones()",description:"Called"});var e=yield Pp();return mp.info({mediaType:dp,action:"getMicrophones()",description:"Filtering microphones devices from all available media devices"}),e.filter((e=>{var{kind:t}=e;return t===up.AUDIO_INPUT})).map((e=>(mp.debug({ID:e.deviceId,mediaType:dp,action:"getMicrophones()",description:"Received microphone device ".concat(JSON.stringify(e))}),new kp(e))))}));return function(){return e.apply(this,arguments)}}(),Up=function(){var e=ep((function*(){mp.debug({mediaType:dp,action:"getSpeakers()",description:"Called"});var e=yield Pp();return mp.info({mediaType:dp,action:"getSpeakers()",description:"Filtering speaker devices from all available media devices"}),e.filter((e=>{var{kind:t}=e;return t===up.AUDIO_OUTPUT})).map((e=>(mp.debug({ID:e.deviceId,mediaType:dp,action:"getSpeakers()",description:"Received speaker device ".concat(JSON.stringify(e))}),new kp(e))))}));return function(){return e.apply(this,arguments)}}();function jp(){return jp=ep((function*(e){if(mp.debug({ID:null==e?void 0:e.ID,mediaType:dp,action:"createAudioTrack()",description:"Called ".concat(e?"with ".concat(JSON.stringify(e)):""," ")}),e&&e.kind!==up.AUDIO_INPUT){var t=new Error("Device ".concat(e.ID," is not of kind AUDIO_INPUT"));throw mp.error({ID:e.ID,mediaType:"DEVICE",action:"createAudioTrack()",description:t.message,error:t}),t}mp.info({ID:null==e?void 0:e.ID,mediaType:dp,action:"createAudioTrack()",description:"Creating audio track"});var r=e?{audio:{deviceId:{exact:e.ID}}}:{audio:!0,video:!1},n=(yield navigator.mediaDevices.getUserMedia(r)).getAudioTracks()[0];if(n)return mp.debug({ID:null==e?void 0:e.ID,mediaType:dp,action:"createAudioTrack()",description:"Received audio track ".concat(JSON.stringify(n))}),new Lp(n);var i=new Error("Device could not obtain an audio track of kind ".concat(null==e?void 0:e.kind));throw mp.error({ID:null==e?void 0:e.ID,mediaType:"DEVICE",action:"createAudioTrack()",description:i.message,error:i}),i})),jp.apply(this,arguments)}function Bp(){return Bp=ep((function*(e){if(mp.debug({ID:null==e?void 0:e.ID,mediaType:dp,action:"createVideoTrack()",description:"Called ".concat(e?"with ".concat(JSON.stringify(e)):""," ")}),e&&e.kind!==up.VIDEO_INPUT){var t=new Error("Device ".concat(e.ID," is not of kind VIDEO_INPUT"));throw mp.error({ID:e.ID,mediaType:"DEVICE",action:"createVideoTrack()",description:t.message,error:t}),t}mp.info({ID:null==e?void 0:e.ID,mediaType:dp,action:"createVideoTrack()",description:"Creating video track"});var r=e?{video:{deviceId:{exact:e.ID}}}:{audio:!1,video:!0},n=(yield navigator.mediaDevices.getUserMedia(r)).getVideoTracks()[0];if(n)return mp.debug({ID:null==e?void 0:e.ID,mediaType:dp,action:"createVideoTrack()",description:"Received video track ".concat(JSON.stringify(n))}),new Lp(n);var i=new Error("Device could not obtain a video track of kind ".concat(null==e?void 0:e.kind));throw mp.error({ID:null==e?void 0:e.ID,mediaType:"DEVICE",action:"createVideoTrack()",description:i.message,error:i}),i})),Bp.apply(this,arguments)}function qp(){return(qp=ep((function*(e){var t,r,n;mp.debug({ID:null==e||null===(t=e.deviceId)||void 0===t?void 0:t.toString(),mediaType:dp,action:"createContentTrack()",description:"Called ".concat(e?"with ".concat(JSON.stringify(e)):""," ")}),mp.info({ID:null==e||null===(r=e.deviceId)||void 0===r?void 0:r.toString(),mediaType:lp,action:"createContentTrack()",description:"Creating content track"});var i,o,a;try{o=yield navigator.mediaDevices.getDisplayMedia({audio:!1,video:!0}),[i]=o.getVideoTracks()}catch(f){var s;if(f instanceof Error)mp.error({ID:null==e||null===(s=e.deviceId)||void 0===s?void 0:s.toString(),mediaType:"DEVICE",action:"createContentTrack()",description:f.message,error:f});throw f}if(e){var c,u=function(e){mp.debug({mediaType:lp,action:"getUnsupportedConstraints()",description:"Called with ".concat(JSON.stringify(e))}),mp.info({mediaType:lp,action:"getUnsupportedConstraints()",description:"Filtering list of media track unsupported constraints"});var t=navigator.mediaDevices.getSupportedConstraints(),r=[];return Object.keys(e).forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)&&t[e]||r.push(e)})),mp.debug({mediaType:lp,action:"getUnsupportedConstraints()",description:"Received unsupported constraints ".concat(r)}),r}(e);if(!(u.length<=0)){var l,d=new Error("".concat(u.join(", ")," constraint is not supported by browser"));throw mp.error({ID:null==e||null===(l=e.deviceId)||void 0===l?void 0:l.toString(),mediaType:"DEVICE",action:"createContentTrack()",description:d.message,error:d}),d}i.applyConstraints(e),mp.debug({ID:null==e||null===(c=e.deviceId)||void 0===c?void 0:c.toString(),mediaType:dp,action:"createContentTrack()",description:"Applied media constraints to fetched content track"})}if(i)return mp.debug({ID:null==e||null===(a=e.deviceId)||void 0===a?void 0:a.toString(),mediaType:dp,action:"createContentTrack()",description:"Received content track ".concat(JSON.stringify(i))}),new Lp(i);var f=new Error("Could not obtain a content track");throw mp.error({ID:null==e||null===(n=e.deviceId)||void 0===n?void 0:n.toString(),mediaType:"DEVICE",action:"createContentTrack()",description:f.message,error:f}),f}))).apply(this,arguments)}function Vp(){return Gp.apply(this,arguments)}function Gp(){return Gp=ep((function*(){var e;if(mp.debug({mediaType:dp,action:"deviceChangePublisher()",description:"Called"}),null!==(e=navigator.mediaDevices)&&void 0!==e&&e.enumerateDevices){mp.info({mediaType:dp,action:"deviceChangePublisher()",description:"Calling individual subscription listener obtained by device change event"});var t=yield navigator.mediaDevices.enumerateDevices(),r=[],n=[],i=[],o="changed",a=new Set;t.length!==Np.length&&([n,i,o]=t.length<Np.length?[t,Np,"removed"]:[Np,t,"added"],n.forEach((e=>{a.add(e.groupId)})),r=i.filter((e=>!a.has(e.groupId))),Np.splice(0,Np.length),Np.push(...t),Mp.emit("device:changed",{action:o,devices:r}))}else console.warn("navigator.mediaDevices.enumerateDevices() is not supported.")})),Gp.apply(this,arguments)}function Wp(){return(Wp=ep((function*(e,t){if(mp.debug({mediaType:lp,action:"on()",description:"Subscribing to an ".concat(e,",").concat(t)}),Mp.on(e,t),"device:changed"===e){var r=yield Pp();Np.push(...r),navigator.mediaDevices.addEventListener("devicechange",Vp)}}))).apply(this,arguments)}var zp,Hp={isModuleAdded:!1,workletProcessorUrl:"https://models.intelligence.webex.com/bnr/1.1.0/noise-reduction-effect.worklet.js"};function Kp(){return(Kp=ep((function*(){mp.info({mediaType:fp,action:"loadProcessor()",description:"Creating and loading BNR module"});var e=new AudioContext;return Hp.isModuleAdded=!0,Hp.audioContext=e,yield e.audioWorklet.addModule(Hp.workletProcessorUrl),Hp.workletNode=new AudioWorkletNode(e,"noise-reduction-worklet-processor"),e}))).apply(this,arguments)}function $p(){return $p=ep((function*(e){mp.debug({ID:e.id,mediaType:fp,action:"enableBNR()",description:"Called"});try{!function(e){if(navigator.mediaDevices.getSupportedConstraints().sampleRate){var t=Ip(e),{sampleRate:r}=t;if(r&&![16e3,32e3,48e3].includes(r)){var n=new Error("Sample rate of ".concat(r," is not supported."));throw mp.error({ID:e.id,mediaType:fp,action:"isValidTrack()",description:n.message,error:n}),n}return!0}var i=new Error("Not supported");mp.info({ID:e.id,mediaType:fp,action:"isValidTrack()",description:i.message,error:i})}(e);var t,r=new MediaStream;r.addTrack(e),mp.info({ID:e.id,mediaType:fp,action:"enableBNR()",description:"Checking if BNR module is present already"});var n=Hp.destinationTrack;if(n&&e.id===n.id){var i="BNR is enabled on the track already",o=new Error(i);throw mp.error({ID:e.id,mediaType:fp,action:"enableBNR()",description:i,error:o}),o}Hp.isModuleAdded&&(mp.debug({ID:e.id,mediaType:fp,action:"enableBNR()",description:"Disposing existing BNR module"}),(t=Hp.workletNode).port.postMessage("DISPOSE")),mp.info({ID:e.id,mediaType:fp,action:"enableBNR()",description:"Creating worklet node, connecting source and destination streams"});var a=yield function(){return Kp.apply(this,arguments)}();(t=Hp.workletNode).port.postMessage("ENABLE"),Hp.sourceNode=a.createMediaStreamSource(r),Hp.sourceNode.connect(t),Hp.destinationStream=a.createMediaStreamDestination(),t.connect(Hp.destinationStream),mp.info({ID:e.id,mediaType:fp,action:"enableBNR()",description:"Obtaining noise reduced track and returning"});var s=Hp.destinationStream.stream,[c]=s.getAudioTracks();return Hp.destinationTrack=c,c}catch(t){throw mp.error({ID:e.id,mediaType:fp,action:"enableBNR()",description:"Error in enableBNR",error:t}),t}})),$p.apply(this,arguments)}!function(e){e[e.MediaConnectionError=30001]="MediaConnectionError",e[e.SdpError=30002]="SdpError",e[e.IceGatheringError=30003]="IceGatheringError",e[e.SdpAnswerHandlingError=30004]="SdpAnswerHandlingError",e[e.SdpOfferCreationError=30005]="SdpOfferCreationError",e[e.SdpOfferHandlingError=30006]="SdpOfferHandlingError"}(zp||(zp={}));class Jp extends Error{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e),bp(this,"code",void 0),this.name=t.name||"MediaConnectionError",this.cause=t.cause,this.code=t.code||zp.MediaConnectionError}}function Yp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}class Qp extends Jp{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Yp(Object(r),!0).forEach((function(t){bp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({code:zp.SdpError,name:"SdpError"},t))}}function Xp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}class Zp extends Qp{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xp(Object(r),!0).forEach((function(t){bp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({code:zp.IceGatheringError,name:"IceGatheringError"},t))}}function ev(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}class tv extends Qp{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ev(Object(r),!0).forEach((function(t){bp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ev(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({code:zp.SdpAnswerHandlingError,name:"SdpAnswerHandlingError"},t))}}function rv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}class nv extends Qp{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?rv(Object(r),!0).forEach((function(t){bp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rv(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({code:zp.SdpOfferCreationError,name:"SdpOfferCreationError"},t))}}function iv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}class ov extends Qp{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?iv(Object(r),!0).forEach((function(t){bp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iv(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({code:zp.SdpOfferHandlingError,name:"SdpOfferHandlingError"},t))}}var av=Object.freeze({__proto__:null,get ErrorCode(){return zp},IceGatheringError:Zp,MediaConnectionError:Jp,SdpAnswerHandlingError:tv,SdpError:Qp,SdpOfferCreationError:nv,SdpOfferHandlingError:ov}),sv=e=>JSON.parse(JSON.stringify(e)),cv=(e,t)=>e===t||!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&(e.constructor===t.constructor&&(Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(((r,n)=>!!t[n]&&(!!cv(e[n],t[n])&&r)),!0))),uv=e=>({id:e.id,tracks:e.getTracks().map((e=>({id:e.id,kind:e.kind,label:e.label,enabled:e.enabled,muted:e.muted,readyState:e.readyState})))}),lv=["type","id","timestamp"],dv=(e,t)=>{var r=sv(t);Object.keys(r).forEach((t=>{var n=r[t];e[t]&&Object.keys(n).forEach((i=>{cv(n[i],e[t][i])&&!lv.includes(i)&&delete r[t][i],(e=>!!Object.keys(e).filter((e=>!lv.includes(e))).length)(n)||delete r[t]}))}));var n=-1/0;return Object.keys(r).forEach((e=>{var t=r[e];t.timestamp>n&&(n=t.timestamp)})),Object.keys(r).forEach((e=>{var t=r[e];t.timestamp===n&&delete t.timestamp})),r.timestamp=n,r},fv=e=>[JSON.stringify({value:e,type:"string",id:""})],hv=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:()=>Promise.resolve(),i={},o=(e,r,n)=>{t({timestamp:n?Math.round(n):Date.now(),name:e,payload:r})};o("rtcConfiguration",fv(JSON.stringify(e.getConfiguration())));var a=window.RTCPeerConnection;if(e.addEventListener("icecandidate",(e=>{e.candidate&&o("onicecandidate",fv(JSON.stringify(e.candidate)))})),e.addEventListener("icecandidateerror",(e=>{var{url:t,errorCode:r,errorText:n}=e;o("onicecandidateerror",fv("[".concat(t,"] ").concat(r,": ").concat(n)))})),e.addEventListener("track",(e=>{o("ontrack",fv("".concat(e.track.kind,":").concat(e.track.id," ").concat(e.streams.map((e=>"stream:".concat(e.id))).join(" "))))})),e.addEventListener("signalingstatechange",(()=>{o("onsignalingstatechange",fv(e.signalingState))})),e.addEventListener("iceconnectionstatechange",(()=>{o("oniceconnectionstatechange",fv(e.iceConnectionState))})),e.addEventListener("icegatheringstatechange",(()=>{o("onicegatheringstatechange",fv(e.iceGatheringState))})),e.addEventListener("connectionstatechange",(()=>{o("onconnectionstatechange",fv(e.connectionState))})),e.addEventListener("negotiationneeded",(()=>{o("onnegotiationneeded",fv("negotiationneeded"))})),e.addEventListener("datachannel",(e=>{o("ondatachannel",fv("".concat(e.channel.id,": ").concat(e.channel.label)))})),["close"].forEach((e=>{var t=a.prototype[e];t&&(a.prototype[e]=function(){return o("on".concat(e),fv(e)),t.apply(this,arguments)})})),["createDataChannel"].forEach((e=>{var t=a.prototype[e];t&&(a.prototype[e]=function(){o("on".concat(e),fv(e));var r=t.apply(this,arguments);return r.addEventListener("open",(()=>{o("ondataChannelOpen",fv("".concat(r.id,":").concat(r.label)))})),r.addEventListener("close",(()=>{o("ondataChannelClose",fv("".concat(r.id,":").concat(r.label)))})),r.addEventListener("error",(e=>{var{error:t}=e;o("ondataChannelError",fv("".concat(r.id,":").concat(r.label,": ").concat(t.errorDetail)))})),r})})),["addStream","removeStream"].forEach((e=>{var t=a.prototype[e];t&&(a.prototype[e]=function(){var r=arguments[0],n=r.getTracks().map((e=>"".concat(e.kind,":").concat(e.id))).join(",");return o("on".concat(e),fv("".concat(r.id," ").concat(n))),t.apply(this,arguments)})})),["addTrack"].forEach((e=>{var t=a.prototype[e];t&&(a.prototype[e]=function(){var r=arguments[0],n=[].slice.call(arguments,1);return o("on".concat(e),fv("".concat(r.kind,":").concat(r.id," ").concat(n.map((e=>"stream:".concat(e.id))).join(";")||"-"))),t.apply(this,arguments)})})),["removeTrack"].forEach((e=>{var t=a.prototype[e];t&&(a.prototype[e]=function(){var r=arguments[0].track;return o("on".concat(e),fv(r?"".concat(r.kind,":").concat(r.id):"null")),t.apply(this,arguments)})})),["createOffer","createAnswer"].forEach((e=>{var t=a.prototype[e];t&&(a.prototype[e]=function(){var r,n=arguments;return 1===arguments.length&&"object"==typeof arguments[0]?r=arguments[0]:3===arguments.length&&"object"==typeof arguments[2]&&(r=arguments[2]),o("on".concat(e),fv(r||"")),t.apply(this,r?[r]:void 0).then((t=>{if(o("on".concat(e,"OnSuccess"),fv(t.sdp)),!(n.length>0&&"function"==typeof n[0]))return t;n[0].apply(null,[t])}),(t=>{if(o("on".concat(e,"OnFailure"),fv(t.toString())),!(n.length>1&&"function"==typeof n[1]))throw t;n[1].apply(null,[t])}))})})),["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((t=>{var r=a.prototype[t];r&&(a.prototype[t]=function(){var n=this,i=arguments;return o("on".concat(t),fv("addIceCandidate"===t?arguments[0]:arguments[0]?arguments[0].sdp:"undefined")),r.apply(this,[arguments[0]]).then((()=>{var r;if(o("on".concat(t,"OnSuccess"),fv("success")),t.endsWith("Description")){if(!this.transportEventsPreviouslyAdded){var a=this.getSenders(),s=function(t){if(t.transport&&(t.transport.addEventListener("statechange",(()=>{t&&t.transport&&o("ondtlsStateChange",fv(t.transport.state))})),t.transport.addEventListener("error",(e=>{o("ondtlsError",fv(e.error.errorDetail))})),t.transport.iceTransport&&t.transport.iceTransport.addEventListener("selectedcandidatepairchange",(()=>{var e,r,n,i,a,s;if(t.transport&&t.transport.iceTransport){var c=t.transport.iceTransport.getSelectedCandidatePair(),u="".concat(null===(e=null==c?void 0:c.local)||void 0===e?void 0:e.address,":").concat(null===(r=null==c?void 0:c.local)||void 0===r?void 0:r.port,"/").concat(null===(n=null==c?void 0:c.local)||void 0===n?void 0:n.protocol),l="".concat(null===(i=null==c?void 0:c.remote)||void 0===i?void 0:i.address,":").concat(null===(a=null==c?void 0:c.remote)||void 0===a?void 0:a.port,"/").concat(null===(s=null==c?void 0:c.remote)||void 0===s?void 0:s.protocol),d="local: ".concat(u,", remote: ").concat(l);o("onselectedCandidatePairChange",fv(d))}})),n.transportEventsPreviouslyAdded=!0,"max-bundle"===e.getConfiguration().bundlePolicy))return"break"};for(var c of a){if("break"===s(c))break}}this.sctpEventsPreviouslyAdded||(null===(r=this.sctp)||void 0===r?void 0:r.addEventListener)&&(this.sctp.addEventListener("statechange",(()=>{o("onsctpStateChange",fv(this.sctp.state))})),this.sctpEventsPreviouslyAdded=!0)}i.length>=2&&"function"==typeof i[1]&&i[1].apply(null,[])}),(e=>{if(o("on".concat(t,"OnFailure"),fv(e.toString())),!(i.length>=3&&"function"==typeof i[2]))throw e;i[2].apply(null,[e])}))})})),navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){var s=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(){return o("onnavigator.mediaDevices.getUserMedia",fv(JSON.stringify(arguments[0]))),s.apply(navigator.mediaDevices,arguments).then((e=>(o("onnavigator.mediaDevices.getUserMediaOnSuccess",fv(JSON.stringify(uv(e)))),e)),(e=>(o("onnavigator.mediaDevices.getUserMediaOnFailure",fv(e.name)),Promise.reject(e))))}.bind(navigator.mediaDevices)}if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia){var c=navigator.mediaDevices.getDisplayMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getDisplayMedia=function(){return o("onnavigator.mediaDevices.getDisplayMedia",fv(JSON.stringify(arguments[0]))),c.apply(navigator.mediaDevices,arguments).then((e=>(o("onnavigator.mediaDevices.getDisplayMediaOnSuccess",fv(JSON.stringify(uv(e)))),e)),(e=>(o("onnavigator.mediaDevices.getDisplayMediaOnFailure",fv(e.name)),Promise.reject(e))))}.bind(navigator.mediaDevices)}var u=function(){var t=ep((function*(){return e.getStats(null).then((e=>{var t=new Map;return e.forEach(((e,r)=>t.set(r,e))),n(t).then((()=>{var e,r=(e=>{if(!e.size)return e;var t={};return e.forEach(((e,r)=>{t[r]=e})),t})(t),n=sv(r),a=dv(i,r);return o("stats-report",(e=a,Object.keys(e).filter((e=>"timestamp"!==e)).map((t=>JSON.stringify(e[t])))),a.timestamp!==-1/0?a.timestamp:void 0),i=n,Promise.resolve()}))}))}));return function(){return t.apply(this,arguments)}}(),l=window.setInterval((()=>{"closed"!==e.signalingState?u():window.clearInterval(l)}),r),d=function(){var e=ep((function*(){return u()}));return function(){return e.apply(this,arguments)}}();return{forceStatsReport:d}},pv=void 0!==__webpack_require__.g?__webpack_require__.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function vv(){throw new Error("setTimeout has not been defined")}function mv(){throw new Error("clearTimeout has not been defined")}var gv=vv,yv=mv;function bv(e){if(gv===setTimeout)return setTimeout(e,0);if((gv===vv||!gv)&&setTimeout)return gv=setTimeout,setTimeout(e,0);try{return gv(e,0)}catch(t){try{return gv.call(null,e,0)}catch(t){return gv.call(this,e,0)}}}"function"==typeof pv.setTimeout&&(gv=setTimeout),"function"==typeof pv.clearTimeout&&(yv=clearTimeout);var Ev,Sv=[],_v=!1,wv=-1;function Rv(){_v&&Ev&&(_v=!1,Ev.length?Sv=Ev.concat(Sv):wv=-1,Sv.length&&Cv())}function Cv(){if(!_v){var e=bv(Rv);_v=!0;for(var t=Sv.length;t;){for(Ev=Sv,Sv=[];++wv<t;)Ev&&Ev[wv].run();wv=-1,t=Sv.length}Ev=null,_v=!1,function(e){if(yv===clearTimeout)return clearTimeout(e);if((yv===mv||!yv)&&clearTimeout)return yv=clearTimeout,clearTimeout(e);try{return yv(e)}catch(t){try{return yv.call(null,e)}catch(t){return yv.call(this,e)}}}(e)}}function Tv(e,t){this.fun=e,this.array=t}Tv.prototype.run=function(){this.fun.apply(null,this.array)};function xv(){}var kv=xv,Iv=xv,Av=xv,Ov=xv,Lv=xv,Mv=xv,Nv=xv;var Pv=pv.performance||{},Dv=Pv.now||Pv.mozNow||Pv.msNow||Pv.oNow||Pv.webkitNow||function(){return(new Date).getTime()};var Fv=new Date;var Uv={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];Sv.push(new Tv(e,t)),1!==Sv.length||_v||bv(Cv)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:kv,addListener:Iv,once:Av,off:Ov,removeListener:Lv,removeAllListeners:Mv,emit:Nv,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*Dv.call(Pv),r=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(r-=e[0],(n-=e[1])<0&&(r--,n+=1e9)),[r,n]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-Fv)/1e3}};function jv(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(e)}function Bv(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}var qv="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==pv?pv:"undefined"!=typeof self?self:{},Vv={exports:{}};!function(e){!function(t){var r,n={};n.VERSION="1.6.1";var i={},o=function(e,t){return function(){return t.apply(e,arguments)}},a=function(){var e,t,r=arguments,n=r[0];for(t=1;t<r.length;t++)for(e in r[t])!(e in n)&&r[t].hasOwnProperty(e)&&(n[e]=r[t][e]);return n},s=function(e,t){return{value:e,name:t}};n.TRACE=s(1,"TRACE"),n.DEBUG=s(2,"DEBUG"),n.INFO=s(3,"INFO"),n.TIME=s(4,"TIME"),n.WARN=s(5,"WARN"),n.ERROR=s(8,"ERROR"),n.OFF=s(99,"OFF");var c=function(e){this.context=e,this.setLevel(e.filterLevel),this.log=this.info};c.prototype={setLevel:function(e){e&&"value"in e&&(this.context.filterLevel=e)},getLevel:function(){return this.context.filterLevel},enabledFor:function(e){var t=this.context.filterLevel;return e.value>=t.value},trace:function(){this.invoke(n.TRACE,arguments)},debug:function(){this.invoke(n.DEBUG,arguments)},info:function(){this.invoke(n.INFO,arguments)},warn:function(){this.invoke(n.WARN,arguments)},error:function(){this.invoke(n.ERROR,arguments)},time:function(e){"string"==typeof e&&e.length>0&&this.invoke(n.TIME,[e,"start"])},timeEnd:function(e){"string"==typeof e&&e.length>0&&this.invoke(n.TIME,[e,"end"])},invoke:function(e,t){r&&this.enabledFor(e)&&r(t,a({level:e},this.context))}};var u=new c({filterLevel:n.OFF});!function(){var e=n;e.enabledFor=o(u,u.enabledFor),e.trace=o(u,u.trace),e.debug=o(u,u.debug),e.time=o(u,u.time),e.timeEnd=o(u,u.timeEnd),e.info=o(u,u.info),e.warn=o(u,u.warn),e.error=o(u,u.error),e.log=e.info}(),n.setHandler=function(e){r=e},n.setLevel=function(e){for(var t in u.setLevel(e),i)i.hasOwnProperty(t)&&i[t].setLevel(e)},n.getLevel=function(){return u.getLevel()},n.get=function(e){return i[e]||(i[e]=new c(a({name:e},u.context)))},n.createDefaultHandler=function(e){(e=e||{}).formatter=e.formatter||function(e,t){t.name&&e.unshift("["+t.name+"]")};var t={},r=function(e,t){Function.prototype.apply.call(e,console,t)};return"undefined"==typeof console?function(){}:function(i,o){i=Array.prototype.slice.call(i);var a,s=console.log;o.level===n.TIME?(a=(o.name?"["+o.name+"] ":"")+i[0],"start"===i[1]?console.time?console.time(a):t[a]=(new Date).getTime():console.timeEnd?console.timeEnd(a):r(s,[a+": "+((new Date).getTime()-t[a])+"ms"])):(o.level===n.WARN&&console.warn?s=console.warn:o.level===n.ERROR&&console.error?s=console.error:o.level===n.INFO&&console.info?s=console.info:o.level===n.DEBUG&&console.debug?s=console.debug:o.level===n.TRACE&&console.trace&&(s=console.trace),e.formatter(i,o),r(s,i))}},n.useDefaults=function(e){n.setLevel(e&&e.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(e))},n.setDefaults=n.useDefaults,e.exports?e.exports=n:(n._prevLogger=t.Logger,n.noConflict=function(){return t.Logger=n._prevLogger,n},t.Logger=n)}(qv)}(Vv);var Gv,Wv,zv=Vv.exports,Hv=zv.get("webrtc-core");function Kv(e){return Bv(this,void 0,void 0,(function*(){return navigator.mediaDevices.getUserMedia(e)}))}function $v(e){return navigator.mediaDevices.getDisplayMedia(e)}function Jv(){return Bv(this,void 0,void 0,(function*(){return navigator.mediaDevices.enumerateDevices()}))}function Yv(e){return Bv(this,void 0,void 0,(function*(){try{var t=yield function(e){return Bv(this,void 0,void 0,(function*(){var t=[];return e.includes(Gv.VideoInput)&&t.push(navigator.permissions.query({name:"camera"})),e.includes(Gv.AudioInput)&&t.push(navigator.permissions.query({name:"microphone"})),Promise.all(t)}))}(e);if(t.every((e=>"granted"===e.state)))return!0}catch(e){}try{return(yield Jv()).filter((t=>e.includes(t.kind))).every((e=>e.label))}catch(e){}return!1}))}function Qv(e,t){return Bv(this,void 0,void 0,(function*(){try{if(!(yield Yv(e))){var r=yield Kv({audio:e.includes(Gv.AudioInput),video:e.includes(Gv.VideoInput)}),n=yield t();return r.getTracks().forEach((e=>e.stop())),n}return t()}catch(e){throw Hv.error(e),new Error("Failed to ensure device permissions.")}}))}zv.useDefaults({defaultLevel:zv.DEBUG,formatter:(e,t)=>{e.unshift("[".concat(t.name,"]"))}}),(Wv=Gv||(Gv={})).AudioInput="audioinput",Wv.AudioOutput="audiooutput",Wv.VideoInput="videoinput";var Xv,Zv=Object.freeze({__proto__:null,get DeviceKind(){return Gv},getUserMedia:Kv,getDisplayMedia:$v,enumerateDevices:Jv,setOnDeviceChangeHandler:function(e){navigator.mediaDevices.ondevicechange=e},checkDevicePermissions:Yv,ensureDevicePermissions:Qv});!function(e){e.DEVICE_PERMISSION_DENIED="DEVICE_PERMISSION_DENIED",e.CREATE_STREAM_FAILED="CREATE_STREAM_FAILED",e.ADD_EFFECT_FAILED="ADD_EFFECT_FAILED"}(Xv||(Xv={}));class em{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.type=e,this.message=t}}function tm(e,t){return Bv(this,void 0,void 0,(function*(){var r;try{r=yield Kv({video:Object.assign({},t)})}catch(e){throw new em(Xv.CREATE_STREAM_FAILED,"Failed to create camera stream: ".concat(e))}return new e(r)}))}function rm(e,t){return Bv(this,void 0,void 0,(function*(){var r;try{r=yield Kv({audio:Object.assign({},t)})}catch(e){throw new em(Xv.CREATE_STREAM_FAILED,"Failed to create microphone stream: ".concat(e))}return new e(r)}))}function nm(e,t,r){return Bv(this,void 0,void 0,(function*(){var n;try{n=yield Kv({video:Object.assign({},null==r?void 0:r.video),audio:Object.assign({},null==r?void 0:r.audio)})}catch(e){throw new em(Xv.CREATE_STREAM_FAILED,"Failed to create camera and microphone streams: ".concat(e))}return[new e(new MediaStream(n.getVideoTracks())),new t(new MediaStream(n.getAudioTracks()))]}))}function im(e){return Bv(this,void 0,void 0,(function*(){var t,r,n,i=e.video.constraints||!0,o=(null===(t=e.audio)||void 0===t?void 0:t.constraints)||!!e.audio;try{n=yield $v({video:i,audio:o,controller:e.controller,preferCurrentTab:e.video.preferCurrentTab,selfBrowserSurface:e.video.selfBrowserSurface,surfaceSwitching:e.video.surfaceSwitching,systemAudio:null===(r=e.audio)||void 0===r?void 0:r.systemAudio,monitorTypeSurfaces:e.video.monitorTypeSurfaces})}catch(e){throw new em(Xv.CREATE_STREAM_FAILED,"Failed to create display and/or system audio streams: ".concat(e))}var a=new e.video.displayStreamConstructor(new MediaStream(n.getVideoTracks()));e.video.videoContentHint&&(a.contentHint=e.video.videoContentHint);var s=null;return e.audio&&n.getAudioTracks().length>0&&(s=new e.audio.systemAudioStreamConstructor(new MediaStream(n.getAudioTracks()))),[a,s]}))}function om(e,t){return Bv(this,void 0,void 0,(function*(){var[r]=yield im({video:{displayStreamConstructor:e,videoContentHint:t}});return r}))}function am(e,t,r){return Bv(this,void 0,void 0,(function*(){return im({video:{displayStreamConstructor:e,videoContentHint:r},audio:{systemAudioStreamConstructor:t}})}))}function sm(e){return Bv(this,void 0,void 0,(function*(){var t,r=e?[e]:[Gv.AudioInput,Gv.VideoInput];try{t=yield Qv(r,Jv)}catch(e){throw new em(Xv.DEVICE_PERMISSION_DENIED,"Failed to ensure device permissions")}return t.filter((t=>!e||t.kind===e))}))}function cm(){return Bv(this,void 0,void 0,(function*(){return sm(Gv.AudioInput)}))}function um(){return Bv(this,void 0,void 0,(function*(){return sm(Gv.AudioOutput)}))}function lm(){return Bv(this,void 0,void 0,(function*(){return sm(Gv.VideoInput)}))}var dm,{setOnDeviceChangeHandler:fm}=Zv,hm={exports:{}},pm="object"==typeof Reflect?Reflect:null,vm=pm&&"function"==typeof pm.apply?pm.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};dm=pm&&"function"==typeof pm.ownKeys?pm.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var mm=Number.isNaN||function(e){return e!=e};function gm(){gm.init.call(this)}hm.exports=gm,hm.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}Im(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&Im(e,"error",t,r)}(e,i,{once:!0})}))},gm.EventEmitter=gm,gm.prototype._events=void 0,gm.prototype._eventsCount=0,gm.prototype._maxListeners=void 0;var ym,bm,Em=10;function Sm(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function _m(e){return void 0===e._maxListeners?gm.defaultMaxListeners:e._maxListeners}function wm(e,t,r,n){var i,o,a,s;if(Sm(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=_m(e))>0&&a.length>i&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,s=c,console&&console.warn&&console.warn(s)}return e}function Rm(){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 Cm(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=Rm.bind(n);return i.listener=r,n.wrapFn=i,i}function Tm(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):km(i,i.length)}function xm(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function km(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function Im(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(gm,"defaultMaxListeners",{enumerable:!0,get:function(){return Em},set:function(e){if("number"!=typeof e||e<0||mm(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Em=e}}),gm.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},gm.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||mm(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},gm.prototype.getMaxListeners=function(){return _m(this)},gm.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=i[e];if(void 0===s)return!1;if("function"==typeof s)vm(s,this,t);else{var c=s.length,u=km(s,c);for(r=0;r<c;++r)vm(u[r],this,t)}return!0},gm.prototype.addListener=function(e,t){return wm(this,e,t,!1)},gm.prototype.on=gm.prototype.addListener,gm.prototype.prependListener=function(e,t){return wm(this,e,t,!0)},gm.prototype.once=function(e,t){return Sm(t),this.on(e,Cm(this,e,t)),this},gm.prototype.prependOnceListener=function(e,t){return Sm(t),this.prependListener(e,Cm(this,e,t)),this},gm.prototype.removeListener=function(e,t){var r,n,i,o,a;if(Sm(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},gm.prototype.off=gm.prototype.removeListener,gm.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},gm.prototype.listeners=function(e){return Tm(this,e,!0)},gm.prototype.rawListeners=function(e){return Tm(this,e,!1)},gm.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):xm.call(e,t)},gm.prototype.listenerCount=xm,gm.prototype.eventNames=function(){return this._eventsCount>0?dm(this._events):[]};class Am extends hm.exports.EventEmitter{}class Om{constructor(){this.emitter=new Am}on(e){this.emitter.on("event",e)}once(e){this.emitter.once("event",e)}off(e){this.emitter.off("event",e)}emit(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.emitter.emit("event",...t)}}function Lm(e){return class extends e{on(e,t){this[e].on(t)}once(e,t){this[e].once(t)}off(e,t){this[e].off(t)}}}!function(e){e.Ended="stream-ended"}(bm||(bm={}));ym=bm.Ended;var Mm,Nm,Pm,Dm,Fm,Um,jm=Lm(class{constructor(e){this[ym]=new Om,this.outputStream=e,this.handleTrackEnded=this.handleTrackEnded.bind(this),this.addTrackHandlersForStreamEvents(this.outputTrack)}handleTrackEnded(){this[bm.Ended].emit()}addTrackHandlersForStreamEvents(e){e.addEventListener("ended",this.handleTrackEnded)}addTrackHandlers(e){this.addTrackHandlersForStreamEvents(e)}removeTrackHandlers(e){e.removeEventListener("ended",this.handleTrackEnded)}get id(){return this.outputStream.id}get outputTrack(){return this.outputStream.getTracks()[0]}});!function(e){e.UserMuteStateChange="user-mute-state-change",e.SystemMuteStateChange="system-mute-state-change",e.ConstraintsChange="constraints-change",e.OutputTrackChange="output-track-change",e.EffectAdded="effect-added"}(Um||(Um={}));Mm=Um.UserMuteStateChange,Nm=Um.SystemMuteStateChange,Pm=Um.ConstraintsChange,Dm=Um.OutputTrackChange,Fm=Um.EffectAdded;var Bm,qm,Vm,Gm=Lm(class extends jm{constructor(e){super(e),this[Mm]=new Om,this[Nm]=new Om,this[Pm]=new Om,this[Dm]=new Om,this[Fm]=new Om,this.effects=[],this.loadingEffects=new Map,this.inputStream=e,this.handleTrackMutedBySystem=this.handleTrackMutedBySystem.bind(this),this.handleTrackUnmutedBySystem=this.handleTrackUnmutedBySystem.bind(this),this.addTrackHandlersForLocalStreamEvents(this.inputTrack)}handleTrackMutedBySystem(){this[Um.SystemMuteStateChange].emit(!0)}handleTrackUnmutedBySystem(){this[Um.SystemMuteStateChange].emit(!1)}addTrackHandlersForLocalStreamEvents(e){e.addEventListener("mute",this.handleTrackMutedBySystem),e.addEventListener("unmute",this.handleTrackUnmutedBySystem)}addTrackHandlers(e){super.addTrackHandlers(e),this.addTrackHandlersForLocalStreamEvents(e)}removeTrackHandlers(e){super.removeTrackHandlers(e),e.removeEventListener("mute",this.handleTrackMutedBySystem),e.removeEventListener("unmute",this.handleTrackUnmutedBySystem)}get inputTrack(){return this.inputStream.getTracks()[0]}get muted(){return this.userMuted||this.systemMuted}get userMuted(){return!this.inputTrack.enabled}get systemMuted(){return this.inputTrack.muted}setUserMuted(e){this.inputTrack.enabled===e&&(this.inputTrack.enabled=!e,this[Um.UserMuteStateChange].emit(e))}getSettings(){return this.inputTrack.getSettings()}get label(){return this.inputTrack.label}get readyState(){return this.inputTrack.readyState}changeOutputTrack(e){this.outputTrack.id!==e.id&&(this.inputTrack.id===this.outputTrack.id&&(this.inputStream=new MediaStream(this.inputStream)),this.outputStream.removeTrack(this.outputTrack),this.outputStream.addTrack(e),this.inputTrack.id===this.outputTrack.id&&(this.inputStream=this.outputStream),this[Um.OutputTrackChange].emit(e))}stop(){this.inputTrack.stop(),this.outputTrack.stop(),this.disposeEffects(),this[bm.Ended].emit()}addEffect(e){return Bv(this,void 0,void 0,(function*(){if(!this.effects.some((t=>t.id===e.id))){if(this.loadingEffects.set(e.kind,e),yield e.load(this.outputTrack),e!==this.loadingEffects.get(e.kind))throw yield e.dispose(),new em(Xv.ADD_EFFECT_FAILED,"Another effect with kind ".concat(e.kind," was added while effect ").concat(e.id," was loading, or the effects list was cleared."));this.loadingEffects.delete(e.kind);var t=t=>{var r,n=this.effects.findIndex((t=>t.id===e.id));n===this.effects.length-1?this.changeOutputTrack(t):n>=0?null===(r=this.effects[n+1])||void 0===r||r.replaceInputTrack(t):Hv.error("Effect with ID ".concat(e.id," not found in effects list."))},r=()=>{e.off("track-updated",t),e.off("disposed",r)};e.on("track-updated",t),e.on("disposed",r);var n=this.effects.findIndex((t=>t.kind===e.kind));if(n>=0){var[i]=this.effects.splice(n,1,e);if(i.isEnabled){var o=0===n?this.inputTrack:this.effects[n-1].getOutputTrack();yield e.replaceInputTrack(o),yield e.enable()}yield i.dispose()}else this.effects.push(e);this[Um.EffectAdded].emit(e)}}))}getEffectById(e){return this.effects.find((t=>t.id===e))}getEffectByKind(e){return this.effects.find((t=>t.kind===e))}getEffects(){return this.effects}toJSON(){return{muted:this.muted,label:this.label,readyState:this.readyState,inputStream:{active:this.inputStream.active,id:this.inputStream.id,enabled:this.inputTrack.enabled,muted:this.inputTrack.muted},outputStream:{active:this.outputStream.active,id:this.outputStream.id},effects:this.effects.map((e=>({id:e.id,kind:e.kind,isEnabled:e.isEnabled})))}}disposeEffects(){return Bv(this,void 0,void 0,(function*(){this.loadingEffects.clear(),this.effects.length>0&&(this.changeOutputTrack(this.inputTrack),yield Promise.all(this.effects.map((e=>e.dispose()))),this.effects=[])}))}});class Wm extends Gm{applyConstraints(e){return Bv(this,void 0,void 0,(function*(){return Hv.log("Applying constraints to local track:",e),this.inputTrack.applyConstraints(e).then((()=>{this[Um.ConstraintsChange].emit()}))}))}}class zm extends Gm{applyConstraints(e){return Bv(this,void 0,void 0,(function*(){return Hv.log("Applying constraints to local track:",e),this.inputTrack.applyConstraints(e).then((()=>{this[Um.ConstraintsChange].emit()}))}))}get contentHint(){return this.inputTrack.contentHint}set contentHint(e){this.inputTrack.contentHint=e}getNumActiveSimulcastLayers(){var e=this.inputTrack.getSettings().height;return e<=180?1:e<=360?2:3}}class Hm extends zm{}class Km extends zm{}class $m extends Wm{}class Jm extends Wm{}!function(e){e.Started="started",e.Stopped="stopped"}(qm||(qm={})),function(e){e.MediaStateChange="media-state-change"}(Vm||(Vm={}));Bm=Vm.MediaStateChange;var Ym=Lm(class extends jm{constructor(e){super(e),this[Bm]=new Om,this.handleMediaStarted=this.handleMediaStarted.bind(this),this.handleMediaStopped=this.handleMediaStopped.bind(this),this.outputTrack.addEventListener("mute",this.handleMediaStopped),this.outputTrack.addEventListener("unmute",this.handleMediaStarted)}handleMediaStarted(){this[Vm.MediaStateChange].emit(qm.Started)}handleMediaStopped(){this[Vm.MediaStateChange].emit(qm.Stopped)}addTrackHandlersForRemoteStreamEvents(e){e.addEventListener("mute",this.handleMediaStopped),e.addEventListener("unmute",this.handleMediaStarted)}addTrackHandlers(e){super.addTrackHandlers(e),this.addTrackHandlersForRemoteStreamEvents(e)}removeTrackHandlers(e){super.removeTrackHandlers(e),e.removeEventListener("mute",this.handleMediaStopped),e.removeEventListener("unmute",this.handleMediaStarted)}get mediaState(){return this.outputTrack.muted?qm.Stopped:qm.Started}getSettings(){return this.outputTrack.getSettings()}replaceTrack(e){var t=this.outputTrack;this.removeTrackHandlers(t),this.outputStream.removeTrack(t),this.outputStream.addTrack(e),this.addTrackHandlers(e),t.muted!==e.muted&&(e.muted?this.handleMediaStopped():this.handleMediaStarted())}stop(){this.outputTrack.stop(),this[bm.Ended].emit()}});function Qm(){}function Xm(){Xm.init.call(this)}function Zm(e){return void 0===e._maxListeners?Xm.defaultMaxListeners:e._maxListeners}function eg(e,t,r,n){var i,o,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]):(o=e._events=new Qm,e._eventsCount=0),a){if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),!a.warned&&(i=Zm(e))&&i>0&&a.length>i){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=a.length,function(e){"function"==typeof console.warn?console.warn(e):console.log(e)}(s)}}else a=o[t]=r,++e._eventsCount;return e}function tg(e,t,r){var n=!1;function i(){e.removeListener(t,i),n||(n=!0,r.apply(e,arguments))}return i.listener=r,i}function rg(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function ng(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}Qm.prototype=Object.create(null),Xm.EventEmitter=Xm,Xm.usingDomains=!1,Xm.prototype.domain=void 0,Xm.prototype._events=void 0,Xm.prototype._maxListeners=void 0,Xm.defaultMaxListeners=10,Xm.init=function(){this.domain=null,Xm.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new Qm,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Xm.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},Xm.prototype.getMaxListeners=function(){return Zm(this)},Xm.prototype.emit=function(e){var t,r,n,i,o,a,s,c="error"===e;if(a=this._events)c=c&&null==a.error;else if(!c)return!1;if(s=this.domain,c){if(t=arguments[1],!s){if(t instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(r=a[e]))return!1;var l="function"==typeof r;switch(n=arguments.length){case 1:!function(e,t,r){if(t)e.call(r);else for(var n=e.length,i=ng(e,n),o=0;o<n;++o)i[o].call(r)}(r,l,this);break;case 2:!function(e,t,r,n){if(t)e.call(r,n);else for(var i=e.length,o=ng(e,i),a=0;a<i;++a)o[a].call(r,n)}(r,l,this,arguments[1]);break;case 3:!function(e,t,r,n,i){if(t)e.call(r,n,i);else for(var o=e.length,a=ng(e,o),s=0;s<o;++s)a[s].call(r,n,i)}(r,l,this,arguments[1],arguments[2]);break;case 4:!function(e,t,r,n,i,o){if(t)e.call(r,n,i,o);else for(var a=e.length,s=ng(e,a),c=0;c<a;++c)s[c].call(r,n,i,o)}(r,l,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(n-1),o=1;o<n;o++)i[o-1]=arguments[o];!function(e,t,r,n){if(t)e.apply(r,n);else for(var i=e.length,o=ng(e,i),a=0;a<i;++a)o[a].apply(r,n)}(r,l,this,i)}return!0},Xm.prototype.addListener=function(e,t){return eg(this,e,t,!1)},Xm.prototype.on=Xm.prototype.addListener,Xm.prototype.prependListener=function(e,t){return eg(this,e,t,!0)},Xm.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,tg(this,e,t)),this},Xm.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,tg(this,e,t)),this},Xm.prototype.removeListener=function(e,t){var r,n,i,o,a;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(r=n[e]))return this;if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new Qm:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length;o-- >0;)if(r[o]===t||r[o].listener&&r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new Qm,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,i=e.length;n<i;r+=1,n+=1)e[r]=e[n];e.pop()}(r,i);n.removeListener&&this.emit("removeListener",e,a||t)}return this},Xm.prototype.off=function(e,t){return this.removeListener(e,t)},Xm.prototype.removeAllListeners=function(e){var t,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new Qm,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new Qm:delete r[e]),this;if(0===arguments.length){for(var n,i=Object.keys(r),o=0;o<i.length;++o)"removeListener"!==(n=i[o])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=new Qm,this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},Xm.prototype.listeners=function(e){var t,r,n=this._events;return r=n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(t):[],r},Xm.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):rg.call(e,t)},Xm.prototype.listenerCount=rg,Xm.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==pv||"undefined"!=typeof self&&self;function ig(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var og={exports:{}};!function(e,t){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=90)}({17:function(e,t,r){t.__esModule=!0,t.default=void 0;var n=r(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||""},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||""},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,r,n){void 0===n&&(n=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(r),a=Math.max(i,o),s=0,c=e.map([t,r],(function(t){var r=a-e.getVersionPrecision(t),n=t+new Array(r+1).join(".0");return e.map(n.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(n&&(s=a-Math.min(i,o)),a-=1;a>=s;){if(c[0][a]>c[1][a])return 1;if(c[0][a]===c[1][a]){if(a===s)return 0;a-=1}else if(c[0][a]<c[1][a])return-1}},e.map=function(e,t){var r,n=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)n.push(t(e[r]));return n},e.find=function(e,t){var r,n;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(r=0,n=e.length;r<n;r+=1){var i=e[r];if(t(i,r))return i}},e.assign=function(e){for(var t,r,n=e,i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var s=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){n[t]=e[t]}))};for(t=0,r=o.length;t<r;t+=1)s();return e},e.getBrowserAlias=function(e){return n.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return n.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,r){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(91))&&n.__esModule?n:{default:n},o=r(18);function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s=function(){function e(){}var t,r,n;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,n=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(r=null)&&a(t.prototype,r),n&&a(t,n),e}();t.default=s,e.exports=t.default},91:function(e,t,r){t.__esModule=!0,t.default=void 0;var n=c(r(92)),i=c(r(93)),o=c(r(94)),a=c(r(95)),s=c(r(17));function c(e){return e&&e.__esModule?e:{default:e}}var u=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=s.default.find(n.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=s.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=s.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=s.default.find(a.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return s.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,r={},n=0,i={},o=0;if(Object.keys(e).forEach((function(t){var a=e[t];"string"==typeof a?(i[t]=a,o+=1):"object"==typeof a&&(r[t]=a,n+=1)})),n>0){var a=Object.keys(r),c=s.default.find(a,(function(e){return t.isOS(e)}));if(c){var u=this.satisfies(r[c]);if(void 0!==u)return u}var l=s.default.find(a,(function(e){return t.isPlatform(e)}));if(l){var d=this.satisfies(r[l]);if(void 0!==d)return d}}if(o>0){var f=Object.keys(i),h=s.default.find(f,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),n=e.toLowerCase(),i=s.default.getBrowserTypeByAlias(n);return t&&i&&(n=i.toLowerCase()),n===r},t.compareVersion=function(e){var t=[0],r=e,n=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(n=!0,r=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(n=!0,r=e.substr(1)),t.indexOf(s.default.compareVersions(i,r,n))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=u,e.exports=t.default},92:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},r=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},r=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},r=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},r=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},r=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},r=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},r=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},r=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},r=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},r=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},r=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},r=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},r=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},r=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},r=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},r=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},r=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},r=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},r=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},r=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},r=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t={name:"Android Browser"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},r=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=i.default.getMacOSVersionName(t),n={name:o.OS_MAP.MacOS,version:t};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=i.default.getAndroidVersionName(t),n={name:o.OS_MAP.Android,version:t};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:o.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},r=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},r=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},r=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},r=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=a,e.exports=t.default}})}(og);var ag,sg,cg,ug,lg=ig(og.exports);!function(e){e.CHROME="Chrome",e.FIREFOX="Firefox",e.EDGE="Microsoft Edge",e.SAFARI="Safari"}(ag||(ag={})),function(e){e.WINDOWS="Windows",e.MAC="macOS",e.LINUX="Linux"}(sg||(sg={}));class dg{static getBrowserDetails(){return this.browser.getBrowser()}static getOSDetails(){return this.browser.getOS()}static getPlatformDetails(){return this.browser.getPlatform()}static getEngineDetails(){return this.browser.getEngine()}static isChrome(){return this.browser.getBrowserName()===ag.CHROME}static isFirefox(){return this.browser.getBrowserName()===ag.FIREFOX}static isEdge(){return this.browser.getBrowserName()===ag.EDGE}static isSafari(){return this.browser.getBrowserName()===ag.SAFARI}static isWindows(){return this.browser.getOSName()===sg.WINDOWS}static isMac(){return this.browser.getOSName()===sg.MAC}static isLinux(){return this.browser.getOSName()===sg.LINUX}static isVersionGreaterThan(e){var t={[this.browser.getBrowserName()]:">".concat(e)};return this.browser.satisfies(t)}static isVersionGreaterThanOrEqualTo(e){var t={[this.browser.getBrowserName()]:">=".concat(e)};return this.browser.satisfies(t)}static isVersionLessThan(e){var t={[this.browser.getBrowserName()]:"<".concat(e)};return this.browser.satisfies(t)}static isVersionLessThanOrEqualTo(e){var t={[this.browser.getBrowserName()]:"<=".concat(e)};return this.browser.satisfies(t)}static isSubVersionOf(e){var t={[this.browser.getBrowserName()]:"~".concat(e)};return this.browser.satisfies(t)}}dg.browser=lg.getParser(window.navigator.userAgent),function(e){e.CpuPressureStateChange="cpu-pressure-state-change"}(cg||(cg={}));class fg extends Xm{constructor(){super(),this.lastCpuPressure=void 0,fg.isPressureObserverSupported()&&(this.observer=new PressureObserver(this.handleStateChange.bind(this)),this.observer&&this.observer.observe("cpu"))}handleStateChange(e){e.forEach((e=>{"cpu"===e.source&&e.state!==this.lastCpuPressure&&(this.lastCpuPressure=e.state,this.emit(cg.CpuPressureStateChange,e.state))}))}getCpuPressure(){return this.lastCpuPressure}static isPressureObserverSupported(){return"PressureObserver"in window}}new fg,function(e){e.NOT_CAPABLE="not capable",e.CAPABLE="capable",e.UNKNOWN="unknown"}(ug||(ug={}));var hg,pg={exports:{}},vg="object"==typeof Reflect?Reflect:null,mg=vg&&"function"==typeof vg.apply?vg.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};hg=vg&&"function"==typeof vg.ownKeys?vg.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var gg=Number.isNaN||function(e){return e!=e};function yg(){yg.init.call(this)}pg.exports=yg,pg.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}Ag(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&Ag(e,"error",t,r)}(e,i,{once:!0})}))},yg.EventEmitter=yg,yg.prototype._events=void 0,yg.prototype._eventsCount=0,yg.prototype._maxListeners=void 0;var bg,Eg,Sg=10;function _g(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function wg(e){return void 0===e._maxListeners?yg.defaultMaxListeners:e._maxListeners}function Rg(e,t,r,n){var i,o,a,s;if(_g(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=wg(e))>0&&a.length>i&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,s=c,console&&console.warn&&console.warn(s)}return e}function Cg(){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 Tg(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=Cg.bind(n);return i.listener=r,n.wrapFn=i,i}function xg(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):Ig(i,i.length)}function kg(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function Ig(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function Ag(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(yg,"defaultMaxListeners",{enumerable:!0,get:function(){return Sg},set:function(e){if("number"!=typeof e||e<0||gg(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Sg=e}}),yg.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},yg.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||gg(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},yg.prototype.getMaxListeners=function(){return wg(this)},yg.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=i[e];if(void 0===s)return!1;if("function"==typeof s)mg(s,this,t);else{var c=s.length,u=Ig(s,c);for(r=0;r<c;++r)mg(u[r],this,t)}return!0},yg.prototype.addListener=function(e,t){return Rg(this,e,t,!1)},yg.prototype.on=yg.prototype.addListener,yg.prototype.prependListener=function(e,t){return Rg(this,e,t,!0)},yg.prototype.once=function(e,t){return _g(t),this.on(e,Tg(this,e,t)),this},yg.prototype.prependOnceListener=function(e,t){return _g(t),this.prependListener(e,Tg(this,e,t)),this},yg.prototype.removeListener=function(e,t){var r,n,i,o,a;if(_g(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},yg.prototype.off=yg.prototype.removeListener,yg.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},yg.prototype.listeners=function(e){return xg(this,e,!0)},yg.prototype.rawListeners=function(e){return xg(this,e,!1)},yg.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):kg.call(e,t)},yg.prototype.listenerCount=kg,yg.prototype.eventNames=function(){return this._eventsCount>0?hg(this._events):[]};class Og extends pg.exports.EventEmitter{}!function(e){e.New="New",e.Closed="Closed",e.Connected="Connected",e.Connecting="Connecting",e.Disconnected="Disconnected",e.Failed="Failed"}(bg||(bg={})),function(e){e.PeerConnectionStateChanged="PeerConnectionStateChanged",e.IceConnectionStateChanged="IceConnectionStateChanged"}(Eg||(Eg={}));class Lg extends Og{constructor(e){super(),this.getCurrentStatesCallback=e}onPeerConnectionStateChange(){var e=this.getPeerConnectionState();this.emit(Eg.PeerConnectionStateChanged,e)}onIceConnectionStateChange(){var e=this.getIceConnectionState();this.emit(Eg.IceConnectionStateChanged,e)}evaluateMediaConnectionState(){var e,{connectionState:t,iceState:r}=this.getCurrentStatesCallback(),n=[t,r];return e=n.every((e=>"new"===e))?bg.New:n.some((e=>"closed"===e))?bg.Closed:n.some((e=>"failed"===e))?bg.Failed:n.some((e=>"disconnected"===e))?bg.Disconnected:n.every((e=>"connected"===e||"completed"===e))?bg.Connected:bg.Connecting,Hv.log("iceConnectionState=".concat(r," connectionState=").concat(t," => ").concat(e)),e}getPeerConnectionState(){var{connectionState:e}=this.getCurrentStatesCallback();return e}getIceConnectionState(){var{iceState:e}=this.getCurrentStatesCallback();return e}getConnectionState(){return this.evaluateMediaConnectionState()}}Lg.Events=Eg;var Mg=!0,Ng=!0;function Pg(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function Dg(e,t,r){if(e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);var o=e=>{var t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,o),i.apply(this,[e,o])};var o=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);var n=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}}function Fg(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Mg=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function Ug(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Ng=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function jg(){if("object"==typeof window){if(Mg)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function Bg(e,t){Ng&&console.warn(e+" is deprecated, please use "+t+" instead.")}function qg(e){return"[object Object]"===Object.prototype.toString.call(e)}function Vg(e){return qg(e)?Object.keys(e).reduce((function(t,r){var n=qg(e[r]),i=n?Vg(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,{[r]:i})}),{}):e}function Gg(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((n=>{n.endsWith("Id")?Gg(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((t=>{Gg(e,e.get(t),r)}))})))}function Wg(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;var o=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((t=>{e.forEach((r=>{r.type===n&&r.trackId===t.id&&Gg(e,r,i)}))})),i}var zg=jg;function Hg(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach((r=>{if("require"!==r&&"advanced"!==r&&"mediaSource"!==r){var n="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];var o={};"number"==typeof n.ideal?(o[i("min",r)]=n.ideal,t.optional.push(o),(o={})[i("max",r)]=n.ideal,t.optional.push(o)):(o[i("",r)]=n.ideal,t.optional.push(o))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",r)]=n.exact):["min","max"].forEach((e=>{void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,r)]=n[e])}))}})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){var o=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};o((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"==typeof e.video){var a=e.video.facingMode;a=a&&("object"==typeof a?a:{ideal:a});var s,c=t.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||c))if(delete e.video.facingMode,"environment"===a.exact||"environment"===a.ideal?s=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(s=["front"]),s)return r.mediaDevices.enumerateDevices().then((t=>{t=t.filter((e=>"videoinput"===e.kind));var r=t.find((e=>s.some((t=>e.label.toLowerCase().includes(t)))));return!r&&t.length&&s.includes("back")&&(r=t[t.length-1]),r&&(e.video.deviceId=a.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),zg("chrome: "+JSON.stringify(e)),i(e)}));e.video=n(e.video)}return zg("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){i(e,(e=>{r.webkitGetUserMedia(e,t,(e=>{n&&n(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){var a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return i(e,(e=>a(e).then((t=>{if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return t}),(e=>Promise.reject(o(e))))))}}}}function Kg(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function $g(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(r=>{var n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.track.id)):{track:r.track};var i=new Event("track");i.track=r.track,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)})),t.stream.getTracks().forEach((r=>{var n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.id)):{track:r};var i=new Event("track");i.track=r,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else Dg(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function Jg(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){var i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};var o=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((e=>{var t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var a=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=a.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Yg(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var[e,r,n]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);var i=function(e){var t={};return e.result().forEach((e=>{var r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{r[t]=e.stat(t)})),t[r.id]=r})),t},o=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){return t.apply(this,[function(e){r(o(i(e)))},e])}return new Promise(((e,r)=>{t.apply(this,[function(t){e(o(i(t)))},r])})).then(r,n)}}}function Qg(e){if("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((t=>Wg(t,e.track,!0)))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=n.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),Dg(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then((t=>Wg(t,e.track,!1)))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,r,n,o=arguments[0];return this.getSenders().forEach((e=>{e.track===o&&(t?n=!0:t=e)})),this.getReceivers().forEach((e=>(e.track===o&&(r?n=!0:r=e),e.track===o))),n||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}}}function Xg(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{var t=this.getSenders().find((t=>t.track===e));if(t)throw new DOMException("Track already exists.","InvalidAccessError")}));var t=this.getSenders();r.apply(this,arguments);var n=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(n)};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{var r=this._shimmedLocalStreams[t].indexOf(e);-1!==r&&this._shimmedLocalStreams[t].splice(r,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),i.apply(this,arguments)}}function Zg(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Xg(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{var t=this.getSenders().find((t=>t.track===e));if(t)throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}n.apply(this,[t])};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var i=this.getSenders().find((e=>e.track===t));if(i)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var o=this._streams[r.id];if(o)o.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{var a=new e.MediaStream([t]);this._streams[r.id]=a,this._reverseStreams[a.id]=r,this.addStream(a)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n={[t](){var e=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[t=>{var r=s(this,t);e[0].apply(null,[r])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):r.apply(this,arguments).then((e=>s(this,e)))}};e.RTCPeerConnection.prototype[t]=n[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){var e=a.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");var t;if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},Object.keys(this._streams).forEach((r=>{this._streams[r].getTracks().find((t=>e.track===t))&&(t=this._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function s(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}}function ey(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}))}function ty(e,t){Dg(e,"negotiationneeded",(e=>{var r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var ry=Object.freeze({__proto__:null,shimMediaStream:Kg,shimOnTrack:$g,shimGetSendersWithDtmf:Jg,shimGetStats:Yg,shimSenderReceiverGetStats:Qg,shimAddTrackRemoveTrackWithNative:Xg,shimAddTrackRemoveTrack:Zg,shimPeerConnection:ey,fixNegotiationNeeded:ty,shimGetUserMedia:Hg,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((t=>{var n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}});function ny(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){Bg("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},o=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"==typeof e&&"object"==typeof e.audio&&(e=JSON.parse(JSON.stringify(e)),i(e.audio,"autoGainControl","mozAutoGainControl"),i(e.audio,"noiseSuppression","mozNoiseSuppression")),o(e)},n&&n.prototype.getSettings){var a=n.prototype.getSettings;n.prototype.getSettings=function(){var e=a.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var s=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"==typeof e&&(e=JSON.parse(JSON.stringify(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}}function iy(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function oy(e,t){if("object"==typeof e&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}));var r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var[e,i,o]=arguments;return n.apply(this,[e||null]).then((e=>{if(t.version<53&&!i)try{e.forEach((e=>{e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,n)=>{e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(i,o)}}}function ay(e){if("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}}function sy(e){if("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),Dg(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function cy(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){Bg("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function uy(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function ly(e){if("object"==typeof e&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]);var r=(e=[...e]).length>0;r&&e.forEach((e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var n=t.apply(this,arguments);if(r){var{sender:i}=n,o=i.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e,i.sendEncodings=e,this.setParametersPromises.push(i.setParameters(o).then((()=>{delete i.sendEncodings})).catch((()=>{delete i.sendEncodings}))))}return n})}}function dy(e){if("object"==typeof e&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function fy(e){if("object"==typeof e&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}}function hy(e){if("object"==typeof e&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}}var py=Object.freeze({__proto__:null,shimOnTrack:iy,shimPeerConnection:oy,shimSenderGetStats:ay,shimReceiverGetStats:sy,shimRemoveStream:cy,shimRTCDataChannel:uy,shimAddTransceiver:ly,shimGetParameters:dy,shimCreateOffer:fy,shimCreateAnswer:hy,shimGetUserMedia:ny,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){var n=new DOMException("getDisplayMedia without video constraints is undefined");return n.name="NotFoundError",n.code=8,Promise.reject(n)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}});function vy(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((r=>t.call(this,r,e))),e.getVideoTracks().forEach((r=>t.call(this,r,e)))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n&&n.forEach((e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);var t=this._localStreams.indexOf(e);if(-1!==t){this._localStreams.splice(t,1);var r=e.getTracks();this.getSenders().forEach((e=>{r.includes(e.track)&&this.removeTrack(e)}))}})}}function my(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach((e=>{if(this._remoteStreams||(this._remoteStreams=[]),!this._remoteStreams.includes(e)){this._remoteStreams.push(e);var t=new Event("addstream");t.stream=e,this.dispatchEvent(t)}}))})}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((t=>{if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}}))}),t.apply(e,arguments)}}}function gy(e){if("object"==typeof e&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i};var s=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){var n=a.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=s}}function yy(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var r=t.mediaDevices,n=r.getUserMedia.bind(r);t.mediaDevices.getUserMedia=e=>n(by(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function by(e){return e&&void 0!==e.video?Object.assign({},e,{video:Vg(e.video)}):e}function Ey(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var n=[],i=0;i<e.iceServers.length;i++){var o=e.iceServers[i];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(Bg("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,n.push(o)):n.push(e.iceServers[i])}e.iceServers=n}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}}function Sy(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function _y(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var r=this.getTransceivers().find((e=>"audio"===e.receiver.track.kind));!1===e.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!==e.offerToReceiveAudio||r||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var n=this.getTransceivers().find((e=>"video"===e.receiver.track.kind));!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function wy(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Ry=Object.freeze({__proto__:null,shimLocalStreamsAPI:vy,shimRemoteStreamsAPI:my,shimCallbacksAPI:gy,shimGetUserMedia:yy,shimConstraints:by,shimRTCIceServerUrls:Ey,shimTrackEventTransceiver:Sy,shimCreateOfferLegacy:_y,shimAudioContext:wy}),Cy={exports:{}};!function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((e=>e.trim()))},t.splitSections=function(e){return e.split("\nm=").map(((e,t)=>(t>0?"m="+e:e).trim()+"\r\n"))},t.getDescription=function(e){var r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){var r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((e=>0===e.indexOf(r)))},t.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:void 0===r[t[n]]&&(r[t[n]]=t[n+1])}return r},t.writeCandidate=function(e){var t=[];t.push(e.foundation);var r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,r={},n=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<n.length;i++)r[(t=n[i].trim().split("="))[0].trim()]=t[1];return r},t.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var n=[];Object.keys(e.parameters).forEach((t=>{void 0!==e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((e=>{t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((e=>parseInt(e,10)))}},t.getMid=function(e){var r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((e=>{r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){var n=t.matchPrefix(e+r,"a=ice-ufrag:")[0],i=t.matchPrefix(e+r,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substr(12),password:i.substr(10)}:null},t.writeIceParameters=function(e){var t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=t.splitLines(e)[0].split(" "),i=3;i<n.length;i++){var o=n[i],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=t.parseRtpMap(a),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((e=>{r.headerExtensions.push(t.parseExtmap(e))})),r},t.writeRtpDescription=function(e,r){var n="";n+="m="+e+" ",n+=r.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=r.codecs.map((e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType)).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((e=>{n+=t.writeRtpMap(e),n+=t.writeFmtp(e),n+=t.writeRtcpFb(e)}));var i=0;return r.codecs.forEach((e=>{e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach((e=>{n+=t.writeExtmap(e)})),n},t.parseRtpEncodingParameters=function(e){var r,n=[],i=t.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),a=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute)),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substr(17).split(" ").map((e=>parseInt(e,10)))));u.length>0&&u[0].length>1&&u[0][0]===c&&(r=u[0][1]),i.codecs.forEach((e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&r&&(t.rtx={ssrc:r}),n.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},n.push(t))}})),0===n.length&&c&&n.push({ssrc:c});var l=t.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substr(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substr(5),10)*.95-16e3:void 0,n.forEach((e=>{e.maxBitrate=l}))),n},t.parseRtcpParameters=function(e){var r={},n=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute))[0];n&&(r.cname=n.value,r.ssrc=n.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=i.length>0,r.compound=0===i.length;var o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.writeRtcpParameters=function(e){var t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){var r,n=t.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(r=n[0].substr(7).split(" "))[0],track:r[1]};var i=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"msid"===e.attribute));return i.length>0?{stream:(r=i[0].value.split(" "))[0],track:r[1]}:void 0},t.parseSctpDescription=function(e){var r,n=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(r=parseInt(i[0].substr(19),10)),isNaN(r)&&(r=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:n.fmt,maxMessageSize:r};var a=t.matchPrefix(e,"a=sctpmap:");if(a.length>0){var s=a[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:r}}},t.writeSctpDescription=function(e,t){var r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,n){var i=void 0!==r?r:2;return"v=0\r\no="+(n||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,r){for(var n=t.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){var r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var r=t.splitLines(e),n=0;n<r.length;n++)if(r[n].length<2||"="!==r[n].charAt(1))return!1;return!0},e.exports=t}(Cy);var Ty=Cy.exports,xy=jv({__proto__:null,default:Ty},[Cy.exports]);function ky(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var r=new t(e),n=Ty.parseCandidate(e.candidate),i=Object.assign(r,n);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,Dg(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}}function Iy(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(e){if(!e||!e.sdp)return!1;var t=Ty.splitSections(e.sdp);return t.shift(),t.some((e=>{var t=Ty.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))}(arguments[0])){var n,i=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var r=parseInt(t[1],10);return r!=r?-1:r}(arguments[0]),o=(c=i,u=65536,"firefox"===t.browser&&(u=t.version<57?-1===c?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),u),a=function(e,r){var n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);var i=Ty.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n}(arguments[0],i);n=0===o&&0===a?Number.POSITIVE_INFINITY:0===o||0===a?Math.max(o,a):Math.min(o,a);var s={};Object.defineProperty(s,"maxMessageSize",{get:()=>n}),this._sctp=s}var c,u;return r.apply(this,arguments)}}}function Ay(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return r(e,this),e},Dg(e,"datachannel",(e=>(r(e.channel,e.target),e)))}function r(e,t){var r=e.send;e.send=function(){var n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}}function Oy(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((e=>{var r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}}function Ly(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var n=t.sdp.split("\n").filter((e=>"a=extmap-allow-mixed"!==e.trim())).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return r.apply(this,arguments)}}}function My(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function Ny(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return r.apply(this,arguments);if(!(e={type:e.type,sdp:e.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}return e.sdp||"offer"!==e.type&&"answer"!==e.type?r.apply(this,[e]):("offer"===e.type?this.createOffer:this.createAnswer).apply(this).then((e=>r.apply(this,[e])))})}}var Py,Dy,Fy=Object.freeze({__proto__:null,shimRTCIceCandidate:ky,shimMaxMessageSize:Iy,shimSendThrowTypeError:Ay,shimConnectionState:Oy,removeExtmapAllowMixed:Ly,shimAddIceCandidateNullOrEmpty:My,shimParameterlessSetLocalDescription:Ny});!function(){var{window:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},r=jg,n=function(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var{navigator:r}=e;if(r.mozGetUserMedia)t.browser="firefox",t.version=Pg(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=Pg(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=Pg(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),i={browserDetails:n,commonShim:Fy,extractVersion:Pg,disableLog:Fg,disableWarnings:Ug,sdp:xy};switch(n.browser){case"chrome":if(!ry||!ey||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),i;if(null===n.version)return r("Chrome shim can not determine version, not shimming."),i;r("adapter.js shimming chrome."),i.browserShim=ry,My(e,n),Ny(e),Hg(e,n),Kg(e),ey(e,n),$g(e),Zg(e,n),Jg(e),Yg(e),Qg(e),ty(e,n),ky(e),Oy(e),Iy(e,n),Ay(e),Ly(e,n);break;case"firefox":if(!py||!oy||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),i;r("adapter.js shimming firefox."),i.browserShim=py,My(e,n),Ny(e),ny(e,n),oy(e,n),iy(e),cy(e),ay(e),sy(e),uy(e),ly(e),dy(e),fy(e),hy(e),ky(e),Oy(e),Iy(e,n),Ay(e);break;case"safari":if(!Ry||!t.shimSafari)return r("Safari shim is not included in this adapter release."),i;r("adapter.js shimming safari."),i.browserShim=Ry,My(e,n),Ny(e),Ey(e),_y(e),gy(e),vy(e),my(e),Sy(e),yy(e),wy(e),ky(e),Iy(e,n),Ay(e),Ly(e,n);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window}),function(e){e.Audio="audio",e.Video="video"}(Py||(Py={})),function(e){e.IceGatheringStateChange="icegatheringstatechange",e.IceCandidate="icecandidate",e.IceCandidateError="icecandidateerror",e.PeerConnectionStateChange="peerconnectionstatechange",e.IceConnectionStateChange="iceconnectionstatechange",e.CreateOfferOnSuccess="createofferonsuccess",e.CreateAnswerOnSuccess="createansweronsuccess",e.SetLocalDescriptionOnSuccess="setlocaldescriptiononsuccess",e.SetRemoteDescriptionOnSuccess="setremotedescriptiononsuccess"}(Dy||(Dy={}));class Uy extends Og{constructor(e){super(),this.iceCandidates=[],Hv.log("PeerConnection init"),this.pc=function(e){return new RTCPeerConnection(e)}(e),this.connectionStateHandler=new Lg((()=>({connectionState:this.pc.connectionState,iceState:this.pc.iceConnectionState}))),this.connectionStateHandler.on(Lg.Events.PeerConnectionStateChanged,(e=>{this.emit(Uy.Events.PeerConnectionStateChange,e)})),this.connectionStateHandler.on(Lg.Events.IceConnectionStateChanged,(e=>{this.emit(Uy.Events.IceConnectionStateChange,e)})),this.pc.oniceconnectionstatechange=()=>this.connectionStateHandler.onIceConnectionStateChange(),this.pc.onconnectionstatechange=()=>this.connectionStateHandler.onPeerConnectionStateChange(),this.pc.onicegatheringstatechange=e=>{this.emit(Uy.Events.IceGatheringStateChange,e)},this.pc.onicecandidate=e=>{e.candidate&&this.iceCandidates.push(e.candidate),this.emit(Uy.Events.IceCandidate,e)},this.pc.onicecandidateerror=e=>{this.emit(Uy.Events.IceCandidateError,e)}}getUnderlyingRTCPeerConnection(){return this.pc}getConnectionState(){return this.connectionStateHandler.getConnectionState()}getPeerConnectionState(){return this.connectionStateHandler.getPeerConnectionState()}getIceConnectionState(){return this.connectionStateHandler.getIceConnectionState()}getIceCandidates(){return this.iceCandidates}addTrack(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return this.pc.addTrack(e,...r)}addTransceiver(e,t){return this.pc.addTransceiver(e,t)}removeTrack(e){this.pc.removeTrack(e)}createDataChannel(e,t){return this.pc.createDataChannel(e,t)}createAnswer(e){return Bv(this,void 0,void 0,(function*(){return this.pc.createAnswer(e).then((e=>(this.emit(Uy.Events.CreateAnswerOnSuccess,e),e)))}))}createOffer(e){return Bv(this,void 0,void 0,(function*(){return this.pc.createOffer(e).then((e=>(this.emit(Uy.Events.CreateOfferOnSuccess,e),e)))}))}setLocalDescription(e){return Bv(this,void 0,void 0,(function*(){var t;return dg.isFirefox()&&(null===(t=null==e?void 0:e.sdp)||void 0===t||t.split(/(\r\n|\r|\n)/).filter((e=>e.startsWith("m"))).forEach((e=>{if(e.trim().split(" ").length<4)throw new Error("Invalid media line ".concat(e,", expected at least 4 fields"))}))),this.pc.setLocalDescription(e).then((()=>{e&&this.emit(Uy.Events.SetLocalDescriptionOnSuccess,e)}))}))}setRemoteDescription(e){return Bv(this,void 0,void 0,(function*(){return this.pc.setRemoteDescription(e).then((()=>{this.emit(Uy.Events.SetRemoteDescriptionOnSuccess,e)}))}))}close(){this.pc.close()}getLocalDescription(){return this.pc.localDescription}getRemoteDescription(){return this.pc.remoteDescription}getSenders(){return this.pc.getSenders()}getTransceivers(){return this.pc.getTransceivers()}getStats(e){return this.pc.getStats(e)}get iceGatheringState(){return this.pc.iceGatheringState}getCurrentConnectionType(){return Bv(this,void 0,void 0,(function*(){var e;if(!("connected"===this.pc.iceConnectionState||"completed"===this.pc.iceConnectionState))throw new Error("Ice connection is not established");var t=new Set,r=[];(yield this.pc.getStats()).forEach((e=>{var n;"candidate-pair"===e.type&&"succeeded"===(null===(n=e.state)||void 0===n?void 0:n.toLowerCase())&&t.add(e.localCandidateId),"local-candidate"===e.type&&r.push(e)}));var n=r.find((e=>t.has(e.id)));return n?n.relayProtocol?"TURN-".concat(n.relayProtocol.toUpperCase()):null===(e=n.protocol)||void 0===e?void 0:e.toUpperCase():"unknown"}))}}Uy.Events=Dy;var jy="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==pv?pv:"undefined"!=typeof self?self:{},By={exports:{}};!function(e){!function(t){var r,n={};n.VERSION="1.6.1";var i={},o=function(e,t){return function(){return t.apply(e,arguments)}},a=function(){var e,t,r=arguments,n=r[0];for(t=1;t<r.length;t++)for(e in r[t])!(e in n)&&r[t].hasOwnProperty(e)&&(n[e]=r[t][e]);return n},s=function(e,t){return{value:e,name:t}};n.TRACE=s(1,"TRACE"),n.DEBUG=s(2,"DEBUG"),n.INFO=s(3,"INFO"),n.TIME=s(4,"TIME"),n.WARN=s(5,"WARN"),n.ERROR=s(8,"ERROR"),n.OFF=s(99,"OFF");var c=function(e){this.context=e,this.setLevel(e.filterLevel),this.log=this.info};c.prototype={setLevel:function(e){e&&"value"in e&&(this.context.filterLevel=e)},getLevel:function(){return this.context.filterLevel},enabledFor:function(e){var t=this.context.filterLevel;return e.value>=t.value},trace:function(){this.invoke(n.TRACE,arguments)},debug:function(){this.invoke(n.DEBUG,arguments)},info:function(){this.invoke(n.INFO,arguments)},warn:function(){this.invoke(n.WARN,arguments)},error:function(){this.invoke(n.ERROR,arguments)},time:function(e){"string"==typeof e&&e.length>0&&this.invoke(n.TIME,[e,"start"])},timeEnd:function(e){"string"==typeof e&&e.length>0&&this.invoke(n.TIME,[e,"end"])},invoke:function(e,t){r&&this.enabledFor(e)&&r(t,a({level:e},this.context))}};var u=new c({filterLevel:n.OFF});!function(){var e=n;e.enabledFor=o(u,u.enabledFor),e.trace=o(u,u.trace),e.debug=o(u,u.debug),e.time=o(u,u.time),e.timeEnd=o(u,u.timeEnd),e.info=o(u,u.info),e.warn=o(u,u.warn),e.error=o(u,u.error),e.log=e.info}(),n.setHandler=function(e){r=e},n.setLevel=function(e){for(var t in u.setLevel(e),i)i.hasOwnProperty(t)&&i[t].setLevel(e)},n.getLevel=function(){return u.getLevel()},n.get=function(e){return i[e]||(i[e]=new c(a({name:e},u.context)))},n.createDefaultHandler=function(e){(e=e||{}).formatter=e.formatter||function(e,t){t.name&&e.unshift("["+t.name+"]")};var t={},r=function(e,t){Function.prototype.apply.call(e,console,t)};return"undefined"==typeof console?function(){}:function(i,o){i=Array.prototype.slice.call(i);var a,s=console.log;o.level===n.TIME?(a=(o.name?"["+o.name+"] ":"")+i[0],"start"===i[1]?console.time?console.time(a):t[a]=(new Date).getTime():console.timeEnd?console.timeEnd(a):r(s,[a+": "+((new Date).getTime()-t[a])+"ms"])):(o.level===n.WARN&&console.warn?s=console.warn:o.level===n.ERROR&&console.error?s=console.error:o.level===n.INFO&&console.info?s=console.info:o.level===n.DEBUG&&console.debug?s=console.debug:o.level===n.TRACE&&console.trace&&(s=console.trace),e.formatter(i,o),r(s,i))}},n.useDefaults=function(e){n.setLevel(e&&e.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(e))},n.setDefaults=n.useDefaults,e.exports?e.exports=n:(n._prevLogger=t.Logger,n.noConflict=function(){return t.Logger=n._prevLogger,n},t.Logger=n)}(jy)}(By);var qy,Vy,Gy,Wy,zy=By.exports;function Hy(e,t){return e.type===t.type&&e.value===t.value}function Ky(){return function(e,t){return Math.floor(Math.random()*(t-e+1))+e}(0,8388607)}function $y(e,t){return t<<8|(e===qy.Audio?0:1)}function Jy(e,t){return e===qy.Video&&t===Vy.Main?Wy.VideoMain:e===qy.Video&&t===Vy.Slides?Wy.VideoSlides:e===qy.Audio&&t===Vy.Main?Wy.AudioMain:Wy.AudioSlides}function Yy(e){return[Wy.VideoMain,Wy.VideoSlides].includes(e)?qy.Video:qy.Audio}function Qy(e){return[Wy.VideoMain,Wy.AudioMain].includes(e)?Vy.Main:Vy.Slides}zy.useDefaults({defaultLevel:zy.DEBUG,formatter:(e,t)=>{e.unshift("[".concat(t.name,"] "))}}),function(e){e.Audio="AUDIO",e.Video="VIDEO"}(qy||(qy={})),function(e){e.Main="MAIN",e.Slides="SLIDES"}(Vy||(Vy={})),function(e){e.ActiveSpeaker="active-speaker",e.ReceiverSelected="receiver-selected"}(Gy||(Gy={})),function(e){e.VideoMain="VIDEO-MAIN",e.VideoSlides="VIDEO-SLIDES",e.AudioMain="AUDIO-MAIN",e.AudioSlides="AUDIO-SLIDES"}(Wy||(Wy={}));var Xy,Zy,eb,tb=e=>0===e||Boolean(e);function rb(e,t,r){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n+=1)if(!r(e[n],t[n]))return!1;return!0}class nb{constructor(e,t,r,n,i){this.priority=e,this.crossPriorityDuplication=t,this.crossPolicyDuplication=r,this.preferLiveVideo=n,this.namedMediaGroups=i}toString(){return"ActiveSpeakerInfo(priority=".concat(this.priority,", crossPriorityDuplication=").concat(this.crossPriorityDuplication,", crossPolicyDuplication=").concat(this.crossPolicyDuplication,", preferLiveVideo=").concat(this.preferLiveVideo,"), namedMediaGroups=").concat(this.namedMediaGroups)}}function ib(e){return Boolean("priority"in e&&"crossPriorityDuplication"in e&&"crossPolicyDuplication"in e&&"preferLiveVideo"in e)}class ob{constructor(e,t,r,n,i){this.maxFs=e,this.maxFps=t,this.maxMbps=r,this.maxWidth=n,this.maxHeight=i}}class ab{constructor(e,t){this.payloadType=e,this.h264=t}}function sb(e,t){return e.payloadType===t.payloadType&&function(e,t){return void 0===e||void 0===t?e===t:e.maxFs===t.maxFs&&e.maxFps===t.maxFps&&e.maxMbps===t.maxMbps&&e.maxWidth===t.maxWidth&&e.maxHeight===t.maxHeight}(e.h264,t.h264)}!function(e){e.MediaRequest="mediaRequest",e.MediaRequestAck="mediaRequestAck",e.MediaRequestStatus="mediaRequestStatus",e.MediaRequestStatusAck="mediaRequestStatusAck",e.SourceAdvertisement="sourceAdvertisement",e.SourceAdvertisementAck="sourceAdvertisementAck",e.ActiveSpeakerNotification="activeSpeakerNotification"}(Xy||(Xy={}));class cb{constructor(e,t,r){this.mediaFamily=e,this.mediaContent=t,this.payload=r}toString(){return"JmpMsg(mediaFamily=".concat(this.mediaFamily,", mediaContent=").concat(this.mediaContent,", payload=").concat(this.payload,")")}}function ub(e){var t=e;return Boolean(t.mediaContent&&t.mediaFamily&&t.payload&&function(e){var t=e;return Boolean(t.msgType&&t.payload)}(t.payload))}class lb{constructor(e){this.mediaRequestSeqNum=e}toString(){return"MediaRequestAckMsg(seqNum=".concat(this.mediaRequestSeqNum,")")}}class db{constructor(e,t){this.seqNum=e,this.requests=t}toString(){return"JmpMediaMsg(seqNum=".concat(this.seqNum,", requests=[").concat(this.requests,"])")}}class fb{constructor(e){this.mediaRequestStatusSeqNum=e}toString(){return"MediaRequestStatusAckMsg(seqNum=".concat(this.mediaRequestStatusSeqNum,")")}}function hb(e){if("object"!=typeof e||null===e)return!1;var t=e;return"number"==typeof t.ssrc&&(void 0===t.rtxSsrc||"number"==typeof t.rtxSsrc)&&!("mid"in t)}function pb(e,t){var r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every((r=>e[r]===t[r]))}function vb(e){var t=e;return Boolean(t.id&&function(e){return function(e){if("object"!=typeof e||null===e)return!1;var t=e;return"string"==typeof t.mid&&(void 0===t.rid||"string"==typeof t.rid)&&!("ssrc"in t)}(e)||hb(e)}(t.id)&&["no source","invalid source","live","avatar","bandwidth disabled","away"].includes(t.state))}function mb(e,t){return pb(e.id,t.id)&&e.state===t.state&&e.csi===t.csi}class gb{constructor(e,t){this.seqNum=e,this.streamStates=t}}class yb{constructor(e){this.csi=e}toString(){return"ReceiverSelectedInfo(csi=".concat(this.csi,")")}}function bb(e){return Boolean(e.csi)}function Eb(e,t){if(ib(e))return!!ib(t)&&function(e,t){return e.priority===t.priority&&e.crossPriorityDuplication===t.crossPriorityDuplication&&e.crossPolicyDuplication===t.crossPolicyDuplication&&e.preferLiveVideo===t.preferLiveVideo&&rb(e.namedMediaGroups||[],t.namedMediaGroups||[],Hy)}(e,t);if(bb(e))return!!bb(t)&&function(e,t){return e.csi===t.csi}(e,t);throw new Error("Invalid PolicySpecificInfo")}class Sb{constructor(e){this.sourceAdvertisementSeqNum=e}toString(){return"SourceAdvertisementAckMsg(sourceAdvertisementSeqNum=".concat(this.sourceAdvertisementSeqNum,")")}}class _b{constructor(e,t,r,n,i){this.seqNum=e,this.numTotalSources=t,this.numLiveSources=r,this.namedMediaGroups=n,this.videoContentHint=i}toString(){return"SourceAdvertisement(seqNum=".concat(this.seqNum,", numTotalSources=").concat(this.numTotalSources,", numLiveSources=").concat(this.numLiveSources,", namedMediaGroups=").concat(this.namedMediaGroups,", videoContentHint=").concat(this.videoContentHint)}}class wb{constructor(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];this.policy=e,this.policySpecificInfo=t,this.ids=r,this.maxPayloadBitsPerSecond=n,this.codecInfos=i}toString(){return"Request(policy=".concat(this.policy,", info=").concat(this.policySpecificInfo,", ids=[").concat(this.ids,"], maxPayloadBitsPerSecond=[").concat(this.maxPayloadBitsPerSecond,"], codecInfos=[").concat(this.codecInfos,"])")}}function Rb(e,t){return e.policy===t.policy&&(!!Eb(e.policySpecificInfo,t.policySpecificInfo)&&(!!rb(e.ids,t.ids,pb)&&(e.maxPayloadBitsPerSecond===t.maxPayloadBitsPerSecond&&rb(e.codecInfos,t.codecInfos,sb))))}class Cb{constructor(e,t,r,n,i){this.timerHandle=void 0,this.msg=e,this.numRetransmitsLeft=t,this.retransmitIntervalMs=r,this.transmitCallback=n,this.expirationCallback=i,this.scheduleTimer()}onTimer(){var e;this.numRetransmitsLeft>0?(--this.numRetransmitsLeft,this.transmitCallback(this.msg),this.scheduleTimer()):null===(e=this.expirationCallback)||void 0===e||e.call(this,this.msg)}scheduleTimer(){this.timerHandle=window.setTimeout((()=>this.onTimer()),this.retransmitIntervalMs)}cancel(){this.timerHandle&&clearTimeout(this.timerHandle),this.timerHandle=void 0}}!function(e){e.ActiveSpeaker="active-speaker",e.MediaRequestReceived="media-request-received",e.MediaRequestStatusReceived="media-request-status-received",e.SourceAdvertisementReceived="source-advertisement-received"}(Zy||(Zy={}));class Tb extends rp{constructor(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:250;super(),this.currMediaRequestSeqNum=1,this.currSourceAdvertisementSeqNum=1,this.currMediaRequestStatusSeqNum=1,this.txCallback=void 0,this.lastSentMediaRequest=void 0,this.lastSentMediaRequestAck=void 0,this.lastReceivedMediaRequest=void 0,this.mediaFamily=e,this.mediaContent=t,this.logger=zy.get("JmpSession ".concat(this.mediaFamily,"-").concat(this.mediaContent)),this.maxNumRetransmits=r,this.retransmitIntervalMs=n}getLogger(){return this.logger}sendRequests(e){var t,r=new db(this.currMediaRequestSeqNum,e);this.lastSentMediaRequest&&rb(this.lastSentMediaRequest.msg.requests,e,Rb)?this.logger.info("Duplicate MediaRequest detected and will not be sent: ".concat(r)):(this.sendJmpMsg(Xy.MediaRequest,r),null===(t=this.lastSentMediaRequest)||void 0===t||t.cancel(),this.lastSentMediaRequest=new Cb(r,this.maxNumRetransmits,this.retransmitIntervalMs,(()=>{this.logger.info("Retransmitting previously sent MediaRequest..."),this.sendJmpMsg(Xy.MediaRequest,r)}),(e=>{this.logger.warn("Retransmits for message expired: ".concat(e))})),this.currMediaRequestSeqNum++)}sendSourceAdvertisement(e,t,r,n){var i,o,a,s=new _b(this.currSourceAdvertisementSeqNum,e,t,r,n);this.lastSentSourceAdvertisement&&(o=this.lastSentSourceAdvertisement.msg,a=s,o.numLiveSources===a.numLiveSources&&o.numTotalSources===a.numTotalSources&&rb(o.namedMediaGroups||[],a.namedMediaGroups||[],Hy)&&o.videoContentHint===a.videoContentHint)?this.logger.info("Duplicate SourceAdvertisement detected and will not be sent: ",s):(this.sendJmpMsg(Xy.SourceAdvertisement,s),null===(i=this.lastSentSourceAdvertisement)||void 0===i||i.cancel(),this.lastSentSourceAdvertisement=new Cb(s,this.maxNumRetransmits,this.retransmitIntervalMs,(()=>{this.logger.info("Retransmitting previously sent SourceAdvertisement..."),this.sendJmpMsg(Xy.SourceAdvertisement,s)}),(e=>{this.logger.warn("Retransmits for message expired: ",e)})),this.currSourceAdvertisementSeqNum++)}sendMediaRequestStatus(e){var t,r,n=e.filter((e=>{var t;return null===(t=this.lastReceivedMediaRequest)||void 0===t?void 0:t.requests.some((t=>t.ids.find((t=>pb(t,e.id)))))})),i=new gb(this.currMediaRequestStatusSeqNum,n);(null===(t=this.lastSentMediaRequestStatus)||void 0===t?void 0:t.msg.streamStates)&&rb(n,this.lastSentMediaRequestStatus.msg.streamStates,mb)?this.logger.info("Duplicate MediaRequestStatus detected and will not be sent: ",i):(this.sendJmpMsg(Xy.MediaRequestStatus,i),null===(r=this.lastSentMediaRequestStatus)||void 0===r||r.cancel(),this.lastSentMediaRequestStatus=new Cb(i,this.maxNumRetransmits,this.retransmitIntervalMs,(()=>{this.logger.info("Retransmitting previously sent MediaRequestStatus..."),this.sendJmpMsg(Xy.MediaRequestStatus,i)}),(e=>{this.logger.warn("Retransmits for message expired: ",e)})),this.currMediaRequestStatusSeqNum++)}receive(e){if(e.mediaContent===this.mediaContent&&e.mediaFamily===this.mediaFamily){this.logger.debug("Received JmpMsg",JSON.stringify(e));var t,{payload:r}=e;if(r.msgType===Xy.MediaRequest){var n=r.payload;if(t=n,!Boolean(t.seqNum&&t.requests))return void this.logger.error("Received invalid MediaRequest:",JSON.stringify(n));this.handleIncomingMediaRequest(n)}else if(r.msgType===Xy.MediaRequestAck){var i=r.payload;if(!function(e){return Boolean(e.mediaRequestSeqNum)}(i))return void this.logger.error("Received invalid MediaRequest ACK:",JSON.stringify(i));this.handleIncomingMediaRequestAck(i)}else if(r.msgType===Xy.ActiveSpeakerNotification){var o=r.payload;if(!function(e){var t=e;return Boolean(t.seqNum&&t.csis)}(o))return void this.logger.info("Received invalid Active Speaker Notification:",JSON.stringify(o));this.handleIncomingActiveSpeakerNotification(o)}else if(r.msgType===Xy.SourceAdvertisement){var a=r.payload;if(!function(e){var t=e;return Boolean(t.seqNum&&tb(t.numTotalSources)&&tb(t.numLiveSources))}(a))return void this.logger.error("Received invalid SourceAdvertisementMsg:",JSON.stringify(a));this.handleIncomingSourceAdvertisement(a)}else if(r.msgType===Xy.SourceAdvertisementAck){var s=r.payload;if(!function(e){return Boolean(e.sourceAdvertisementSeqNum)}(s))return void this.logger.error("Received invalid SourceAdvertisementAckMsg:",JSON.stringify(s));this.handleIncomingSourceAdvertisementAck(s)}else if(r.msgType===Xy.MediaRequestStatus){var c=r.payload;if(!function(e){var t=e;return Boolean(t.seqNum)&&t.streamStates&&t.streamStates.every((e=>vb(e)))}(c))return void this.logger.error("Received invalid MediaRequestStatusMsg:",JSON.stringify(c));this.handleIncomingMediaRequestStatus(c)}else if(r.msgType===Xy.MediaRequestStatusAck){var u=r.payload;if(!function(e){return Boolean(e.mediaRequestStatusSeqNum)}(u))return void this.logger.error("Received invalid MediaRequestStatusAckMsg:",JSON.stringify(u));this.handleIncomingMediaRequestStatusAck(u)}else this.logger.error("Received unknown JmpMsg")}else this.logger.error("JmpMsg ".concat(JSON.stringify(e)," sent to incorrect JmpSession"))}setTxCallback(e){this.txCallback=e}close(){var e,t,r;this.logger.info("closing"),null===(e=this.lastSentMediaRequest)||void 0===e||e.cancel(),null===(t=this.lastSentMediaRequestStatus)||void 0===t||t.cancel(),null===(r=this.lastSentSourceAdvertisement)||void 0===r||r.cancel()}sendJmpMsg(e,t){var r,n=new cb(this.mediaFamily,this.mediaContent,{msgType:e,payload:t});null===(r=this.txCallback)||void 0===r||r.call(this,n)}handleIncomingMediaRequest(e){var t;if(this.lastReceivedMediaRequest&&e.seqNum<(null===(t=this.lastReceivedMediaRequest)||void 0===t?void 0:t.seqNum))this.logger.info("Received old MediaRequest, ignoring");else if(this.lastReceivedMediaRequest&&e.seqNum===this.lastReceivedMediaRequest.seqNum)this.lastSentMediaRequestAck?(this.logger.info("Received duplicate MediaRequest, re-sending ACK"),this.sendJmpMsg(Xy.MediaRequestAck,this.lastSentMediaRequestAck)):this.logger.warn("Received duplicate MediaRequest, but there was no ACK previously sent");else{this.logger.info("Received new MediaRequest, sending ACK");var r=new lb(e.seqNum);this.lastReceivedMediaRequest=e,this.lastSentMediaRequestAck=r,this.sendJmpMsg(Xy.MediaRequestAck,r),this.emit(Zy.MediaRequestReceived,e)}}handleIncomingMediaRequestAck(e){var t,r,n;e.mediaRequestSeqNum===(null===(r=null===(t=this.lastSentMediaRequest)||void 0===t?void 0:t.msg)||void 0===r?void 0:r.seqNum)?(this.logger.info("Received ACK for last sent MediaRequest"),null===(n=this.lastSentMediaRequest)||void 0===n||n.cancel()):this.logger.info("Received ACK for old MediaRequest")}handleIncomingActiveSpeakerNotification(e){this.logger.debug("Received Active Speaker Notification:",e),this.emit(Zy.ActiveSpeaker,e)}handleIncomingSourceAdvertisement(e){if(this.lastReceivedSourceAdvertisement&&e.seqNum<this.lastReceivedSourceAdvertisement.seqNum)this.logger.info("Received old SourceAdvertisement, ignoring");else if(this.lastReceivedSourceAdvertisement&&e.seqNum===this.lastReceivedSourceAdvertisement.seqNum)this.lastSentSourceAdvertisementAck?(this.logger.info("Received duplicate SourceAdvertisement, re-sending ACK"),this.sendJmpMsg(Xy.SourceAdvertisementAck,this.lastSentSourceAdvertisementAck)):this.logger.warn("Received duplicate SourceAdvertisement, but there was no ACK previously sent");else{this.logger.info("Received new SourceAdvertisement, sending ACK");var t=new Sb(e.seqNum);this.lastReceivedSourceAdvertisement=e,this.lastSentSourceAdvertisementAck=t,this.sendJmpMsg(Xy.SourceAdvertisementAck,t),this.emit(Zy.SourceAdvertisementReceived,e)}}handleIncomingSourceAdvertisementAck(e){var t,r,n;e.sourceAdvertisementSeqNum===(null===(r=null===(t=this.lastSentSourceAdvertisement)||void 0===t?void 0:t.msg)||void 0===r?void 0:r.seqNum)?(this.logger.info("Received ACK for last sent SourceAdvertisement"),null===(n=this.lastSentSourceAdvertisement)||void 0===n||n.cancel()):this.logger.info("Received ACK for old SourceAdvertisement")}handleIncomingMediaRequestStatus(e){if(this.lastReceivedMediaRequestStatus&&e.seqNum<this.lastReceivedMediaRequestStatus.seqNum)this.logger.info("Received old MediaRequestStatus, ignoring");else if(this.lastReceivedMediaRequestStatus&&e.seqNum===this.lastReceivedMediaRequestStatus.seqNum)this.lastSentMediaRequestStatusAck?(this.logger.info("Received duplicate MediaRequestStatus, re-sending ACK"),this.sendJmpMsg(Xy.MediaRequestStatusAck,this.lastSentMediaRequestStatusAck)):this.logger.warn("Received duplicate MediaRequestStatus, but there was no ACK previously sent");else{this.logger.info("Received new MediaRequestStatus, sending ACK");var t=new fb(e.seqNum);this.lastReceivedMediaRequestStatus=e,this.lastSentMediaRequestStatusAck=t,this.sendJmpMsg(Xy.MediaRequestStatusAck,t),this.emit(Zy.MediaRequestStatusReceived,e)}}handleIncomingMediaRequestStatusAck(e){var t,r,n;e.mediaRequestStatusSeqNum===(null===(r=null===(t=this.lastSentMediaRequestStatus)||void 0===t?void 0:t.msg)||void 0===r?void 0:r.seqNum)?(this.logger.info("Received ACK for last sent MediaRequestStatus"),null===(n=this.lastSentMediaRequestStatus)||void 0===n||n.cancel()):this.logger.info("Received ACK for old MediaRequestStatus")}}!function(e){e.CREATE_OFFER_FAILED="CREATE_OFFER_FAILED",e.SET_ANSWER_FAILED="SET_ANSWER_FAILED",e.OFFER_ANSWER_MISMATCH="OFFER_ANSWER_MISMATCH",e.SDP_MUNGE_FAILED="SDP_MUNGE_FAILED",e.SDP_MUNGE_MISSING_CODECS="SDP_MUNGE_MISSING_CODECS",e.INVALID_STREAM_REQUEST="INVALID_STREAM_REQUEST",e.GET_TRANSCEIVER_FAILED="GET_TRANSCEIVER_FAILED",e.GET_MAX_BITRATE_FAILED="GET_MAX_BITRATE_FAILED",e.GET_PAYLOAD_TYPE_FAILED="GET_PAYLOAD_TYPE_FAILED",e.SET_NMG_FAILED="SET_NMG_FAILED",e.SET_SOURCE_STATE_OVERRIDE_FAILED="SET_SOURCE_STATE_OVERRIDE_FAILED",e.DATA_CHANNEL_SEND_FAILED="DATA_CHANNEL_SEND_FAILED",e.RENEW_PEER_CONNECTION_FAILED="RENEW_PEER_CONNECTION_FAILED"}(eb||(eb={}));class xb{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.type=e,this.message=t}}var kb="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==pv?pv:"undefined"!=typeof self?self:{},Ib={exports:{}};!function(e){!function(t){var r,n={};n.VERSION="1.6.1";var i={},o=function(e,t){return function(){return t.apply(e,arguments)}},a=function(){var e,t,r=arguments,n=r[0];for(t=1;t<r.length;t++)for(e in r[t])!(e in n)&&r[t].hasOwnProperty(e)&&(n[e]=r[t][e]);return n},s=function(e,t){return{value:e,name:t}};n.TRACE=s(1,"TRACE"),n.DEBUG=s(2,"DEBUG"),n.INFO=s(3,"INFO"),n.TIME=s(4,"TIME"),n.WARN=s(5,"WARN"),n.ERROR=s(8,"ERROR"),n.OFF=s(99,"OFF");var c=function(e){this.context=e,this.setLevel(e.filterLevel),this.log=this.info};c.prototype={setLevel:function(e){e&&"value"in e&&(this.context.filterLevel=e)},getLevel:function(){return this.context.filterLevel},enabledFor:function(e){var t=this.context.filterLevel;return e.value>=t.value},trace:function(){this.invoke(n.TRACE,arguments)},debug:function(){this.invoke(n.DEBUG,arguments)},info:function(){this.invoke(n.INFO,arguments)},warn:function(){this.invoke(n.WARN,arguments)},error:function(){this.invoke(n.ERROR,arguments)},time:function(e){"string"==typeof e&&e.length>0&&this.invoke(n.TIME,[e,"start"])},timeEnd:function(e){"string"==typeof e&&e.length>0&&this.invoke(n.TIME,[e,"end"])},invoke:function(e,t){r&&this.enabledFor(e)&&r(t,a({level:e},this.context))}};var u=new c({filterLevel:n.OFF});!function(){var e=n;e.enabledFor=o(u,u.enabledFor),e.trace=o(u,u.trace),e.debug=o(u,u.debug),e.time=o(u,u.time),e.timeEnd=o(u,u.timeEnd),e.info=o(u,u.info),e.warn=o(u,u.warn),e.error=o(u,u.error),e.log=e.info}(),n.setHandler=function(e){r=e},n.setLevel=function(e){for(var t in u.setLevel(e),i)i.hasOwnProperty(t)&&i[t].setLevel(e)},n.getLevel=function(){return u.getLevel()},n.get=function(e){return i[e]||(i[e]=new c(a({name:e},u.context)))},n.createDefaultHandler=function(e){(e=e||{}).formatter=e.formatter||function(e,t){t.name&&e.unshift("["+t.name+"]")};var t={},r=function(e,t){Function.prototype.apply.call(e,console,t)};return"undefined"==typeof console?function(){}:function(i,o){i=Array.prototype.slice.call(i);var a,s=console.log;o.level===n.TIME?(a=(o.name?"["+o.name+"] ":"")+i[0],"start"===i[1]?console.time?console.time(a):t[a]=(new Date).getTime():console.timeEnd?console.timeEnd(a):r(s,[a+": "+((new Date).getTime()-t[a])+"ms"])):(o.level===n.WARN&&console.warn?s=console.warn:o.level===n.ERROR&&console.error?s=console.error:o.level===n.INFO&&console.info?s=console.info:o.level===n.DEBUG&&console.debug?s=console.debug:o.level===n.TRACE&&console.trace&&(s=console.trace),e.formatter(i,o),r(s,i))}},n.useDefaults=function(e){n.setLevel(e&&e.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(e))},n.setDefaults=n.useDefaults,e.exports?e.exports=n:(n._prevLogger=t.Logger,n.noConflict=function(){return t.Logger=n._prevLogger,n},t.Logger=n)}(kb)}(Ib);var Ab,Ob=Ib.exports,Lb=Ob.get("web-client-media-engine");function Mb(e,t){throw Lb.error(t),new xb(e,t)}Lb.setLevel(Ob.DEBUG),function(e){e.H264="video/H264",e.AV1="video/AV1",e.OPUS="audio/opus"}(Ab||(Ab={}));var Nb;!function(e){e[e.NB=12e3]="NB",e[e.WB=2e4]="WB",e[e.FB=4e4]="FB",e[e.FB_MONO_MUSIC=64e3]="FB_MONO_MUSIC",e[e.FB_STEREO_MUSIC=128e3]="FB_STEREO_MUSIC"}(Nb||(Nb={}));var Pb=new Map([[60,99e3],[240,199e3],[576,3e5],[920,64e4],[1296,72e4],[2040,88e4],[3600,25e5],[8160,4e6]]);function Db(e,t){return Object.keys(t).every((r=>{if("clockRate"===r||"name"===r)return e[r]===t[r];if("fmtParams"===r){var n=e[r],i=t[r],o=[...n.keys()].some((e=>"level-asymmetry-allowed"===e&&"1"===i.get(e)&&"1"===n.get(e)));return[...n.keys()].every((e=>i.get(e)&&"profile-level-id"===e?function(e,t,r){var n=Number.parseInt("0x".concat(e),16),i=Number.parseInt("0x".concat(t),16),o=n>>16,a=i>>16,s=(65280&n)>>8,c=(65280&i)>>8;return(o===a&&s===c||66===o&&66===a&&(64&s)==(64&c))&&(!!r||(255&n)<=(255&i))}(n.get(e),i.get(e),o):"packetization-mode"!==e||n.get(e)===i.get(e)))}return!0}))}function Fb(e,t){return 0===t?e:Fb(t,e%t)}function Ub(e,t){var r=Fb(e[0],e[1]),n=e[0]/r,i=e[1]/r,o=Math.sqrt(256*t/(n*i));return Math.max(Math.floor(o),1)*i}function jb(e){e<60&&Mb(eb.GET_MAX_BITRATE_FAILED,"Requested max video frame size cannot be less than 60.");var t=[...Pb.keys()].sort(((e,t)=>t-e)).find((t=>e>=t));return Pb.get(t)}function Bb(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}var qb,Vb,Gb,Wb,zb,Hb,Kb=e=>JSON.parse(JSON.stringify(e)),$b=(e,t)=>e===t||!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&(e.constructor===t.constructor&&(Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(((r,n)=>!!t[n]&&(!!$b(e[n],t[n])&&r)),!0))),Jb=e=>({id:e.id,tracks:e.getTracks().map((e=>({id:e.id,kind:e.kind,label:e.label,enabled:e.enabled,muted:e.muted,readyState:e.readyState})))}),Yb=["type","id","timestamp"],Qb=(e,t)=>{var r=Kb(t);Object.keys(r).forEach((t=>{var n=r[t];e[t]&&Object.keys(n).forEach((i=>{$b(n[i],e[t][i])&&!Yb.includes(i)&&delete r[t][i],(e=>!!Object.keys(e).filter((e=>!Yb.includes(e))).length)(n)||delete r[t]}))}));var n=-1/0;return Object.keys(r).forEach((e=>{var t=r[e];t.timestamp>n&&(n=t.timestamp)})),Object.keys(r).forEach((e=>{var t=r[e];t.timestamp===n&&delete t.timestamp})),r.timestamp=n,r},Xb=e=>[JSON.stringify({value:e,type:"string",id:""})],Zb=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:()=>Promise.resolve(),i={},o=(e,r,n)=>{t({timestamp:n?Math.round(n):Date.now(),name:e,payload:r})};o("rtcConfiguration",Xb(JSON.stringify(e.getConfiguration())));var a=window.RTCPeerConnection;if(e.addEventListener("icecandidate",(e=>{e.candidate&&o("onicecandidate",Xb(JSON.stringify(e.candidate)))})),e.addEventListener("icecandidateerror",(e=>{var{url:t,errorCode:r,errorText:n}=e;o("onicecandidateerror",Xb("[".concat(t,"] ").concat(r,": ").concat(n)))})),e.addEventListener("track",(e=>{o("ontrack",Xb("".concat(e.track.kind,":").concat(e.track.id," ").concat(e.streams.map((e=>"stream:".concat(e.id))).join(" "))))})),e.addEventListener("signalingstatechange",(()=>{o("onsignalingstatechange",Xb(e.signalingState))})),e.addEventListener("iceconnectionstatechange",(()=>{o("oniceconnectionstatechange",Xb(e.iceConnectionState))})),e.addEventListener("icegatheringstatechange",(()=>{o("onicegatheringstatechange",Xb(e.iceGatheringState))})),e.addEventListener("connectionstatechange",(()=>{o("onconnectionstatechange",Xb(e.connectionState))})),e.addEventListener("negotiationneeded",(()=>{o("onnegotiationneeded",Xb("negotiationneeded"))})),e.addEventListener("datachannel",(e=>{o("ondatachannel",Xb("".concat(e.channel.id,": ").concat(e.channel.label)))})),["close"].forEach((e=>{var t=a.prototype[e];t&&(a.prototype[e]=function(){return o("on".concat(e),Xb(e)),t.apply(this,arguments)})})),["createDataChannel"].forEach((e=>{var t=a.prototype[e];t&&(a.prototype[e]=function(){o("on".concat(e),Xb(e));var r=t.apply(this,arguments);return r.addEventListener("open",(()=>{o("ondataChannelOpen",Xb("".concat(r.id,":").concat(r.label)))})),r.addEventListener("close",(()=>{o("ondataChannelClose",Xb("".concat(r.id,":").concat(r.label)))})),r.addEventListener("error",(e=>{var{error:t}=e;o("ondataChannelError",Xb("".concat(r.id,":").concat(r.label,": ").concat(t.errorDetail)))})),r})})),["addStream","removeStream"].forEach((e=>{var t=a.prototype[e];t&&(a.prototype[e]=function(){var r=arguments[0],n=r.getTracks().map((e=>"".concat(e.kind,":").concat(e.id))).join(",");return o("on".concat(e),Xb("".concat(r.id," ").concat(n))),t.apply(this,arguments)})})),["addTrack"].forEach((e=>{var t=a.prototype[e];t&&(a.prototype[e]=function(){var r=arguments[0],n=[].slice.call(arguments,1);return o("on".concat(e),Xb("".concat(r.kind,":").concat(r.id," ").concat(n.map((e=>"stream:".concat(e.id))).join(";")||"-"))),t.apply(this,arguments)})})),["removeTrack"].forEach((e=>{var t=a.prototype[e];t&&(a.prototype[e]=function(){var r=arguments[0].track;return o("on".concat(e),Xb(r?"".concat(r.kind,":").concat(r.id):"null")),t.apply(this,arguments)})})),["createOffer","createAnswer"].forEach((e=>{var t=a.prototype[e];t&&(a.prototype[e]=function(){var r,n=arguments;return 1===arguments.length&&"object"==typeof arguments[0]?r=arguments[0]:3===arguments.length&&"object"==typeof arguments[2]&&(r=arguments[2]),o("on".concat(e),Xb(r||"")),t.apply(this,r?[r]:void 0).then((t=>{if(o("on".concat(e,"OnSuccess"),Xb(t.sdp)),!(n.length>0&&"function"==typeof n[0]))return t;n[0].apply(null,[t])}),(t=>{if(o("on".concat(e,"OnFailure"),Xb(t.toString())),!(n.length>1&&"function"==typeof n[1]))throw t;n[1].apply(null,[t])}))})})),["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((t=>{var r=a.prototype[t];r&&(a.prototype[t]=function(){var n=this,i=arguments;return o("on".concat(t),Xb("addIceCandidate"===t?arguments[0]:arguments[0]?arguments[0].sdp:"undefined")),r.apply(this,[arguments[0]]).then((()=>{var r;if(o("on".concat(t,"OnSuccess"),Xb("success")),t.endsWith("Description")){if(!this.transportEventsPreviouslyAdded){var a=this.getSenders(),s=function(t){if(t.transport&&(t.transport.addEventListener("statechange",(()=>{t&&t.transport&&o("ondtlsStateChange",Xb(t.transport.state))})),t.transport.addEventListener("error",(e=>{o("ondtlsError",Xb(e.error.errorDetail))})),t.transport.iceTransport&&t.transport.iceTransport.addEventListener("selectedcandidatepairchange",(()=>{var e,r,n,i,a,s;if(t.transport&&t.transport.iceTransport){var c=t.transport.iceTransport.getSelectedCandidatePair(),u="".concat(null===(e=null==c?void 0:c.local)||void 0===e?void 0:e.address,":").concat(null===(r=null==c?void 0:c.local)||void 0===r?void 0:r.port,"/").concat(null===(n=null==c?void 0:c.local)||void 0===n?void 0:n.protocol),l="".concat(null===(i=null==c?void 0:c.remote)||void 0===i?void 0:i.address,":").concat(null===(a=null==c?void 0:c.remote)||void 0===a?void 0:a.port,"/").concat(null===(s=null==c?void 0:c.remote)||void 0===s?void 0:s.protocol),d="local: ".concat(u,", remote: ").concat(l);o("onselectedCandidatePairChange",Xb(d))}})),n.transportEventsPreviouslyAdded=!0,"max-bundle"===e.getConfiguration().bundlePolicy))return"break"};for(var c of a){if("break"===s(c))break}}this.sctpEventsPreviouslyAdded||(null===(r=this.sctp)||void 0===r?void 0:r.addEventListener)&&(this.sctp.addEventListener("statechange",(()=>{o("onsctpStateChange",Xb(this.sctp.state))})),this.sctpEventsPreviouslyAdded=!0)}i.length>=2&&"function"==typeof i[1]&&i[1].apply(null,[])}),(e=>{if(o("on".concat(t,"OnFailure"),Xb(e.toString())),!(i.length>=3&&"function"==typeof i[2]))throw e;i[2].apply(null,[e])}))})})),navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){var s=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(){return o("onnavigator.mediaDevices.getUserMedia",Xb(JSON.stringify(arguments[0]))),s.apply(navigator.mediaDevices,arguments).then((e=>(o("onnavigator.mediaDevices.getUserMediaOnSuccess",Xb(JSON.stringify(Jb(e)))),e)),(e=>(o("onnavigator.mediaDevices.getUserMediaOnFailure",Xb(e.name)),Promise.reject(e))))}.bind(navigator.mediaDevices)}if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia){var c=navigator.mediaDevices.getDisplayMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getDisplayMedia=function(){return o("onnavigator.mediaDevices.getDisplayMedia",Xb(JSON.stringify(arguments[0]))),c.apply(navigator.mediaDevices,arguments).then((e=>(o("onnavigator.mediaDevices.getDisplayMediaOnSuccess",Xb(JSON.stringify(Jb(e)))),e)),(e=>(o("onnavigator.mediaDevices.getDisplayMediaOnFailure",Xb(e.name)),Promise.reject(e))))}.bind(navigator.mediaDevices)}var u=function(){var t=ep((function*(){return e.getStats(null).then((e=>{var t=new Map;return e.forEach(((e,r)=>t.set(r,e))),n(t).then((()=>{var e,r=(e=>{if(!e.size)return e;var t={};return e.forEach(((e,r)=>{t[r]=e})),t})(t),n=Kb(r),a=Qb(i,r);return o("stats-report",(e=a,Object.keys(e).filter((e=>"timestamp"!==e)).map((t=>JSON.stringify(e[t])))),a.timestamp!==-1/0?a.timestamp:void 0),i=n,Promise.resolve()}))}))}));return function(){return t.apply(this,arguments)}}(),l=window.setInterval((()=>{"closed"!==e.signalingState?u():window.clearInterval(l)}),r),d=function(){var e=ep((function*(){return u()}));return function(){return e.apply(this,arguments)}}();return{forceStatsReport:d}},eE="\\d+",tE="[!#$%&'*+\\-.^_`{|}~a-zA-Z0-9]+",rE="\\S+",nE=".+";class iE{}class oE extends iE{constructor(e,t){super(),this.bandwidthType=e,this.bandwidth=t}static fromSdpLine(e){if(oE.regex.test(e)){var t=e.match(oE.regex),r=t[1],n=parseInt(t[2],10);return new oE(r,n)}}toSdpLine(){return"b=".concat(this.bandwidthType,":").concat(this.bandwidth)}}qb=oE,oE.BW_TYPE_REGEX="CT|AS|TIAS",oE.regex=new RegExp("^(".concat(qb.BW_TYPE_REGEX,"):(").concat(eE,")"));class aE extends iE{constructor(e){super(),this.mids=e}static fromSdpLine(e){if(aE.regex.test(e)){var t=e.match(aE.regex)[1].split(" ");return new aE(t)}}toSdpLine(){return"a=group:BUNDLE ".concat(this.mids.join(" "))}}aE.regex=new RegExp("^group:BUNDLE (".concat(nE,")"));class sE extends iE{constructor(e,t,r,n,i,o,a,s,c,u){super(),this.foundation=e,this.componentId=t,this.transport=r,this.priority=n,this.connectionAddress=i,this.port=o,this.candidateType=a,this.relAddr=s,this.relPort=c,this.candidateExtensions=u}static fromSdpLine(e){if(sE.regex.test(e)){var t=e.match(sE.regex),r=t[1],n=parseInt(t[2],10),i=t[3],o=parseInt(t[4],10),a=t[5],s=parseInt(t[6],10),c=t[7],u=t[8],l=t[9]?parseInt(t[9],10):void 0,d=t[10];return new sE(r,n,i,o,a,s,c,u,l,d)}}toSdpLine(){var e="";return e+="a=candidate:".concat(this.foundation," ").concat(this.componentId," ").concat(this.transport," ").concat(this.priority," ").concat(this.connectionAddress," ").concat(this.port," typ ").concat(this.candidateType),this.relAddr&&(e+=" raddr ".concat(this.relAddr)),this.relPort&&(e+=" rport ".concat(this.relPort)),this.candidateExtensions&&(e+=" ".concat(this.candidateExtensions)),e}}Vb=sE,sE.ICE_CHARS="[a-zA-Z0-9+/]+",sE.regex=new RegExp("^candidate:(".concat(Vb.ICE_CHARS,") (").concat(eE,") (").concat(rE,") (").concat(eE,") (").concat(rE,") (").concat(eE,") typ (").concat(rE,")(?: raddr (").concat(rE,"))?(?: rport (").concat(eE,"))?(?: (").concat(nE,"))?"));class cE extends iE{constructor(e,t,r){super(),this.netType=e,this.addrType=t,this.ipAddr=r}static fromSdpLine(e){if(cE.regex.test(e)){var t=e.match(cE.regex),r=t[1],n=t[2],i=t[3];return new cE(r,n,i)}}toSdpLine(){return"c=".concat(this.netType," ").concat(this.addrType," ").concat(this.ipAddr)}}cE.regex=new RegExp("^(".concat(rE,") (").concat(rE,") (").concat(rE,")"));class uE extends iE{constructor(e){super(),this.values=e}static fromSdpLine(e){if(uE.regex.test(e)){var t=e.match(uE.regex)[1].split(",");return new uE(t)}}toSdpLine(){return"a=content:".concat(this.values.join(","))}}uE.regex=new RegExp("^content:(".concat(nE,")$"));class lE extends iE{constructor(e){super(),this.direction=e}static fromSdpLine(e){if(lE.regex.test(e)){var t=e.match(lE.regex)[1];return new lE(t)}}toSdpLine(){return"a=".concat(this.direction)}}lE.regex=/^(sendrecv|sendonly|recvonly|inactive)$/;class dE extends iE{constructor(e,t,r,n){super(),this.id=e,this.uri=t,this.direction=r,this.extensionAttributes=n}static fromSdpLine(e){if(dE.regex.test(e)){var t=e.match(dE.regex),r=parseInt(t[1],10),n=t[2],i=t[3],o=t[4];return new dE(r,i,n,o)}}toSdpLine(){var e="";return e+="a=extmap:".concat(this.id),this.direction&&(e+="/".concat(this.direction)),e+=" ".concat(this.uri),this.extensionAttributes&&(e+=" ".concat(this.extensionAttributes)),e}}Gb=dE,dE.EXTMAP_DIRECTION="sendonly|recvonly|sendrecv|inactive",dE.regex=new RegExp("^extmap:(".concat(eE,")(?:/(").concat(Gb.EXTMAP_DIRECTION,"))? (").concat(rE,")(?: (").concat(nE,"))?"));class fE extends iE{constructor(e){super(),this.fingerprint=e}static fromSdpLine(e){if(fE.regex.test(e)){var t=e.match(fE.regex)[1];return new fE(t)}}toSdpLine(){return"a=fingerprint:".concat(this.fingerprint)}}fE.regex=new RegExp("^fingerprint:(".concat(nE,")"));class hE extends iE{constructor(e,t){super(),this.payloadType=e,this.params=t}static fromSdpLine(e){if(hE.regex.test(e)){var t=e.match(hE.regex),r=parseInt(t[1],10),n=t[2];return new hE(r,function(e){e=e.replace(/^a=fmtp:\d+\x20/,"");var t=new Map;return/^\d+([,/-]\d+)+$/.test(e)?(t.set(e,void 0),t):((e=e.replace(/;$/,"")).split(";").forEach((r=>{var n=r&&r.split("=");if(2!==n.length||!n[0]||!n[1])throw new Error("Fmtp params is invalid with ".concat(e));t.set(n[0],n[1])})),t)}(n))}}toSdpLine(){var e=Array.from(this.params.keys()).map((e=>void 0!==this.params.get(e)?"".concat(e,"=").concat(this.params.get(e)):"".concat(e))).join(";");return"a=fmtp:".concat(this.payloadType," ").concat(e)}}hE.regex=new RegExp("^fmtp:(".concat(eE,") (").concat(nE,")"));class pE extends iE{constructor(e){super(),this.options=e}static fromSdpLine(e){if(pE.regex.test(e)){var t=e.match(pE.regex)[1].split(" ");return new pE(t)}}toSdpLine(){return"a=ice-options:".concat(this.options.join(" "))}}pE.regex=new RegExp("^ice-options:(".concat(nE,")$"));class vE extends iE{constructor(e){super(),this.pwd=e}static fromSdpLine(e){if(vE.regex.test(e)){var t=e.match(vE.regex)[1];return new vE(t)}}toSdpLine(){return"a=ice-pwd:".concat(this.pwd)}}vE.regex=new RegExp("^ice-pwd:(".concat(rE,")$"));class mE extends iE{constructor(e){super(),this.ufrag=e}static fromSdpLine(e){if(mE.regex.test(e)){var t=e.match(mE.regex)[1];return new mE(t)}}toSdpLine(){return"a=ice-ufrag:".concat(this.ufrag)}}mE.regex=new RegExp("^ice-ufrag:(".concat(rE,")$"));class gE extends iE{constructor(e){super(),this.maxMessageSize=e}static fromSdpLine(e){if(gE.regex.test(e)){var t=e.match(gE.regex),r=parseInt(t[1],10);return new gE(r)}}toSdpLine(){return"a=max-message-size:".concat(this.maxMessageSize)}}gE.regex=new RegExp("^max-message-size:(".concat(eE,")"));class yE extends iE{constructor(e,t,r,n){super(),this.type=e,this.port=t,this.protocol=r,this.formats=n}static fromSdpLine(e){if(yE.regex.test(e)){var t=e.match(yE.regex),r=t[1],n=parseInt(t[2],10),i=t[3],o=t[4].split(" ");return new yE(r,n,i,o)}}toSdpLine(){return"m=".concat(this.type," ").concat(this.port," ").concat(this.protocol," ").concat(this.formats.join(" "))}}Wb=yE,yE.MEDIA_TYPE="audio|video|application",yE.regex=new RegExp("^(".concat(Wb.MEDIA_TYPE,") (").concat(eE,") (").concat(rE,") (").concat(nE,")"));class bE extends iE{constructor(e){super(),this.mid=e}static fromSdpLine(e){if(bE.regex.test(e)){var t=e.match(bE.regex)[1];return new bE(t)}}toSdpLine(){return"a=mid:".concat(this.mid)}}bE.regex=new RegExp("^mid:(".concat(rE,")$"));class EE extends iE{constructor(e,t,r,n,i,o){super(),this.username=e,this.sessionId=t,this.sessionVersion=r,this.netType=n,this.addrType=i,this.ipAddr=o}static fromSdpLine(e){if(EE.regex.test(e)){var t=e.match(EE.regex),r=t[1],n=t[2],i=parseInt(t[3],10),o=t[4],a=t[5],s=t[6];return new EE(r,n,i,o,a,s)}}toSdpLine(){return"o=".concat(this.username," ").concat(this.sessionId," ").concat(this.sessionVersion," ").concat(this.netType," ").concat(this.addrType," ").concat(this.ipAddr)}}EE.regex=new RegExp("^(".concat(rE,") (").concat(rE,") (").concat(eE,") (").concat(rE,") (").concat(rE,") (").concat(rE,")"));class SE extends iE{constructor(e,t,r){super(),this.id=e,this.direction=t,this.params=r}static fromSdpLine(e){if(SE.regex.test(e)){var t=e.match(SE.regex),r=t[1],n=t[2],i=t[3];return new SE(r,n,i)}}toSdpLine(){var e="";return e+="a=rid:".concat(this.id," ").concat(this.direction),this.params&&(e+=" ".concat(this.params)),e}}zb=SE,SE.RID_ID="[\\w-]+",SE.RID_DIRECTION="\\bsend\\b|\\brecv\\b",SE.regex=new RegExp("^rid:(".concat(zb.RID_ID,") (").concat(zb.RID_DIRECTION,")(?:").concat("\\s","(").concat(nE,"))?"));class _E extends iE{static fromSdpLine(e){if(_E.regex.test(e))return new _E}toSdpLine(){return"a=rtcp-mux"}}_E.regex=/^rtcp-mux$/;class wE extends iE{constructor(e,t){super(),this.payloadType=e,this.feedback=t}static fromSdpLine(e){if(wE.regex.test(e)){var t=e.match(wE.regex),r=parseInt(t[1],10),n=t[2];return new wE(r,n)}}toSdpLine(){return"a=rtcp-fb:".concat(this.payloadType," ").concat(this.feedback)}}wE.regex=new RegExp("^rtcp-fb:(".concat(eE,") (").concat(nE,")"));class RE extends iE{constructor(e,t,r,n){super(),this.payloadType=e,this.encodingName=t,this.clockRate=r,this.encodingParams=n}static fromSdpLine(e){if(RE.regex.test(e)){var t=e.match(RE.regex),r=parseInt(t[1],10),n=t[2],i=parseInt(t[3],10),o=t[4];return new RE(r,n,i,o)}}toSdpLine(){var e="";return e+="a=rtpmap:".concat(this.payloadType," ").concat(this.encodingName,"/").concat(this.clockRate),this.encodingParams&&(e+="/".concat(this.encodingParams)),e}}Hb=RE,RE.NON_SLASH_TOKEN="[^\\s/]+",RE.regex=new RegExp("^rtpmap:(".concat(eE,") (").concat(Hb.NON_SLASH_TOKEN,")/(").concat(Hb.NON_SLASH_TOKEN,")(?:/(").concat(Hb.NON_SLASH_TOKEN,"))?"));class CE extends iE{constructor(e){super(),this.port=e}static fromSdpLine(e){if(CE.regex.test(e)){var t=e.match(CE.regex),r=parseInt(t[1],10);return new CE(r)}}toSdpLine(){return"a=sctp-port:".concat(this.port)}}CE.regex=new RegExp("^sctp-port:(".concat(eE,")"));class TE extends iE{constructor(e){super(),this.info=e}static fromSdpLine(e){if(TE.regex.test(e)){var t=e.match(TE.regex)[1];return new TE(t)}}toSdpLine(){return"i=".concat(this.info)}}TE.regex=new RegExp("(".concat(nE,")"));class xE extends iE{constructor(e){super(),this.name=e}static fromSdpLine(e){if(xE.regex.test(e)){var t=e.match(xE.regex)[1];return new xE(t)}}toSdpLine(){return"s=".concat(this.name)}}xE.regex=new RegExp("^(".concat(nE,")"));class kE extends iE{constructor(e){super(),this.setup=e}static fromSdpLine(e){if(kE.regex.test(e)){var t=e.match(kE.regex)[1];return new kE(t)}}toSdpLine(){return"a=setup:".concat(this.setup)}}kE.regex=/^setup:(actpass|active|passive)$/;class IE{constructor(e,t){this.id=e,this.paused=t}toString(){return this.paused?"~".concat(this.id):this.id}}class AE{constructor(){this.layers=[]}addLayer(e){this.layers.push([e])}addLayerWithAlternatives(e){this.layers.push(e)}get length(){return this.layers.length}get(e){return this.layers[e]}static fromString(e){var t=new AE,r=e.split(";");if(1===r.length&&!r[0].trim())throw new Error("simulcast stream list empty");return r.forEach((e=>{if(!e)throw new Error("simulcast layer list empty");var r=e.split(","),n=[];r.forEach((e=>{if(!e||"~"===e)throw new Error("rid empty");var t="~"===e[0],r=t?e.substring(1):e;n.push(new IE(r,t))})),t.addLayerWithAlternatives(n)})),t}toString(){return this.layers.map((e=>e.map((e=>e.toString())).join(","))).join(";")}}class OE extends iE{constructor(e,t){super(),this.sendLayers=e,this.recvLayers=t}static fromSdpLine(e){if(OE.regex.test(e)){var t,r,n=e.match(OE.regex),i=n[3]&&n[4],o=n[1],a=AE.fromString(n[2]),s=new AE;if(i){if(o===n[3])return;s=AE.fromString(n[4])}return"send"===o?(t=a,r=s):(t=s,r=a),new OE(t,r)}}toSdpLine(){var e="a=simulcast:";return this.sendLayers.length&&(e+="send ".concat(this.sendLayers.toString()),this.recvLayers.length&&(e+=" ")),this.recvLayers.length&&(e+="recv ".concat(this.recvLayers.toString())),e}}OE.regex=new RegExp("^simulcast:(send|recv) (".concat(rE,")(?: (send|recv) (").concat(rE,"))?"));class LE extends iE{constructor(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;super(),this.ssrcId=e,this.attribute=t,this.attributeValue=r,this.attributeData=n}static fromSdpLine(e){if(LE.regex.test(e)){var t=e.match(LE.regex),r=parseInt(t[1],10),n=t[2],i=t[3],o=t[4];return new LE(r,n,i,o)}}toSdpLine(){var e="a=ssrc:".concat(this.ssrcId," ").concat(this.attribute);return this.attributeValue&&(e+=":".concat(this.attributeValue)),this.attributeData&&(e+=" ".concat(this.attributeData)),e}}LE.regex=new RegExp("^ssrc:(".concat(eE,") (").concat(tE,")(?::(").concat(tE,")?(?: (").concat(rE,"))?)?$"));class ME extends iE{constructor(e,t){super(),this.semantics=e,this.ssrcs=t}static fromSdpLine(e){if(ME.regex.test(e)){var t=e.match(ME.regex),r=t[1],n=t[2].split(" ").map((e=>parseInt(e,10)));return new ME(r,n)}}toSdpLine(){return"a=ssrc-group:".concat(this.semantics," ").concat(this.ssrcs.join(" "))}}ME.regex=new RegExp("^ssrc-group:(SIM|FID|FEC) ((?:".concat(eE).concat("\\s","*)+)"));class NE extends iE{constructor(e,t){super(),this.startTime=e,this.stopTime=t}static fromSdpLine(e){if(NE.regex.test(e)){var t=e.match(NE.regex),r=parseInt(t[1],10),n=parseInt(t[2],10);return new NE(r,n)}}toSdpLine(){return"t=".concat(this.startTime," ").concat(this.stopTime)}}NE.regex=new RegExp("^(".concat(eE,") (").concat(eE,")"));class PE extends iE{constructor(e){super(),this.version=e}static fromSdpLine(e){if(PE.regex.test(e)){var t=e.match(PE.regex),r=parseInt(t[1],10);return new PE(r)}}toSdpLine(){return"v=".concat(this.version)}}PE.regex=new RegExp("^(".concat(eE,")$"));class DE extends iE{constructor(e){super(),this.value=e}static fromSdpLine(e){var t=e.match(DE.regex)[1];return new DE(t)}toSdpLine(){return"".concat(this.value)}}DE.regex=new RegExp("(".concat(nE,")"));class FE{constructor(){this.candidates=[]}addLine(e){return e instanceof mE?(this.ufrag=e,!0):e instanceof vE?(this.pwd=e,!0):e instanceof pE?(this.options=e,!0):e instanceof sE&&(this.candidates.push(e),!0)}toLines(){var e=[];return this.ufrag&&e.push(this.ufrag),this.pwd&&e.push(this.pwd),this.options&&e.push(this.options),this.candidates.forEach((t=>e.push(t))),e}}class UE{constructor(e,t,r){this.iceInfo=new FE,this.otherLines=[],this.type=e,this.port=t,this.protocol=r}findOtherLine(e){return this.otherLines.find((t=>t instanceof e))}addLine(e){if(e instanceof aE)throw new Error("Error: bundle group line not allowed in media description");return e instanceof oE?(this.bandwidth=e,!0):e instanceof bE?(this.mid=e.mid,!0):e instanceof fE?(this.fingerprint=e.fingerprint,!0):e instanceof kE?(this.setup=e.setup,!0):e instanceof cE?(this.connection=e,!0):e instanceof uE?(this.content=e,!0):this.iceInfo.addLine(e)}}class jE extends UE{constructor(e){super(e.type,e.port,e.protocol),this.fmts=[],this.fmts=e.formats}toLines(){var e=[];return e.push(new yE(this.type,this.port,this.protocol,this.fmts)),this.connection&&e.push(this.connection),this.bandwidth&&e.push(this.bandwidth),e.push(...this.iceInfo.toLines()),this.fingerprint&&e.push(new fE(this.fingerprint)),this.setup&&e.push(new kE(this.setup)),this.mid&&e.push(new bE(this.mid)),this.content&&e.push(this.content),this.sctpPort&&e.push(new CE(this.sctpPort)),this.maxMessageSize&&e.push(new gE(this.maxMessageSize)),e.push(...this.otherLines),e}addLine(e){if(super.addLine(e))return!0;if(e instanceof yE)throw new Error("Error: tried passing a MediaLine to an existing MediaInfo");return e instanceof CE?(this.sctpPort=e.port,!0):e instanceof gE?(this.maxMessageSize=e.maxMessageSize,!0):(this.otherLines.push(e),!0)}}class BE{constructor(e){this.fmtParams=new Map,this.feedback=[],this.pt=e}addLine(e){if(e instanceof RE)return this.name=e.encodingName,this.clockRate=e.clockRate,this.encodingParams=e.encodingParams,!0;if(e instanceof hE){if(this.fmtParams=new Map([...Array.from(this.fmtParams.entries()),...Array.from(e.params.entries())]),e.params.has("apt")){var t=e.params.get("apt");this.primaryCodecPt=parseInt(t,10)}return!0}return e instanceof wE&&(this.feedback.push(e.feedback),!0)}toLines(){var e=[];return this.name&&this.clockRate&&e.push(new RE(this.pt,this.name,this.clockRate,this.encodingParams)),this.feedback.forEach((t=>{e.push(new wE(this.pt,t))})),this.fmtParams.size>0&&e.push(new hE(this.pt,this.fmtParams)),e}}class qE extends UE{constructor(e){super(e.type,e.port,e.protocol),this.pts=[],this.extMaps=new Map,this.rids=[],this.codecs=new Map,this.rtcpMux=!1,this.ssrcs=[],this.ssrcGroups=[],this.pts=e.formats.map((e=>parseInt(e,10))),this.pts.forEach((e=>this.codecs.set(e,new BE(e))))}toLines(){var e=[];return e.push(new yE(this.type,this.port,this.protocol,this.pts.map((e=>"".concat(e))))),this.connection&&e.push(this.connection),this.bandwidth&&e.push(this.bandwidth),e.push(...this.iceInfo.toLines()),this.fingerprint&&e.push(new fE(this.fingerprint)),this.setup&&e.push(new kE(this.setup)),this.mid&&e.push(new bE(this.mid)),this.rtcpMux&&e.push(new _E),this.content&&e.push(this.content),this.extMaps.forEach((t=>e.push(t))),this.rids.forEach((t=>e.push(t))),this.simulcast&&e.push(this.simulcast),this.direction&&e.push(new lE(this.direction)),this.codecs.forEach((t=>e.push(...t.toLines()))),e.push(...this.ssrcs),e.push(...this.ssrcGroups),e.push(...this.otherLines),e}addLine(e){if(super.addLine(e))return!0;if(e instanceof yE)throw new Error("Error: tried passing a MediaLine to an existing MediaInfo");if(e instanceof lE)return this.direction=e.direction,!0;if(e instanceof dE){if(this.extMaps.has(e.id))throw new Error("Tried to extension with duplicate ID: an extension already exists with ID ".concat(e.id));return this.extMaps.set(e.id,e),!0}if(e instanceof SE)return this.rids.push(e),!0;if(e instanceof _E)return this.rtcpMux=!0,!0;if(e instanceof OE)return this.simulcast=e,!0;if(e instanceof RE||e instanceof hE||e instanceof wE){var t=this.codecs.get(e.payloadType);if(!t)throw new Error("Error: got line for unknown codec: ".concat(e.toSdpLine()));return t.addLine(e),!0}return e instanceof LE?(this.ssrcs.push(e),!0):e instanceof ME?(this.ssrcGroups.push(e),!0):(this.otherLines.push(e),!0)}getCodecByPt(e){return this.codecs.get(e)}removePt(e){var t=[...this.codecs.values()].filter((t=>t.primaryCodecPt===e)).map((e=>e.pt)),r=[e,...t];r.forEach((e=>{this.codecs.delete(e)})),this.pts=this.pts.filter((e=>-1===r.indexOf(e)))}addExtension(e){var{uri:t,direction:r,attributes:n,id:i}=e,o=i||(()=>{for(var e=1;this.extMaps.has(e);)e+=1;return e})();if(this.extMaps.has(o))throw new Error("Extension with ID ".concat(i," already exists"));if(0===o)throw new Error("Extension ID 0 is reserved");this.extMaps.set(o,new dE(o,t,r,n))}}class VE{constructor(){this.groups=[],this.otherLines=[]}addLine(e){return e instanceof PE?(this.version=e,!0):e instanceof EE?(this.origin=e,!0):e instanceof xE?(this.sessionName=e,!0):e instanceof TE?(this.information=e,!0):e instanceof NE?(this.timing=e,!0):e instanceof cE?(this.connection=e,!0):e instanceof oE?(this.bandwidth=e,!0):e instanceof aE?(this.groups.push(e),!0):(this.otherLines.push(e),!0)}toLines(){var e=[];return this.version&&e.push(this.version),this.origin&&e.push(this.origin),this.sessionName&&e.push(this.sessionName),this.information&&e.push(this.information),this.connection&&e.push(this.connection),this.bandwidth&&e.push(this.bandwidth),this.timing&&e.push(this.timing),this.groups&&e.push(...this.groups),e.push(...this.otherLines),e}}class GE{constructor(){this.session=new VE,this.media=[]}get avMedia(){return this.media.filter((e=>e instanceof qE))}toString(){var e=[];return e.push(...this.session.toLines()),this.media.forEach((t=>e.push(...t.toLines()))),"".concat(e.map((e=>e.toSdpLine())).join("\r\n"),"\r\n")}}class WE{constructor(){this.parsers=new Map}addParser(e,t){var r=this.parsers.get(e)||[];r.push(t),this.parsers.set(e,r)}getParsers(e){return this.parsers.get(e)||[]}}var zE=new class extends WE{constructor(){super(),this.addParser("v",PE.fromSdpLine),this.addParser("o",EE.fromSdpLine),this.addParser("c",cE.fromSdpLine),this.addParser("i",TE.fromSdpLine),this.addParser("m",yE.fromSdpLine),this.addParser("s",xE.fromSdpLine),this.addParser("t",NE.fromSdpLine),this.addParser("b",oE.fromSdpLine),this.addParser("a",RE.fromSdpLine),this.addParser("a",wE.fromSdpLine),this.addParser("a",hE.fromSdpLine),this.addParser("a",lE.fromSdpLine),this.addParser("a",dE.fromSdpLine),this.addParser("a",bE.fromSdpLine),this.addParser("a",mE.fromSdpLine),this.addParser("a",vE.fromSdpLine),this.addParser("a",pE.fromSdpLine),this.addParser("a",fE.fromSdpLine),this.addParser("a",kE.fromSdpLine),this.addParser("a",CE.fromSdpLine),this.addParser("a",gE.fromSdpLine),this.addParser("a",_E.fromSdpLine),this.addParser("a",aE.fromSdpLine),this.addParser("a",uE.fromSdpLine),this.addParser("a",SE.fromSdpLine),this.addParser("a",sE.fromSdpLine),this.addParser("a",OE.fromSdpLine),this.addParser("a",LE.fromSdpLine),this.addParser("a",ME.fromSdpLine)}};function HE(e){return e.length>2}function KE(e){var t=function(e,t){var r=[];return e.split(/(\r\n|\r|\n)/).filter(HE).forEach((e=>{var n=e[0],i=e.slice(2),o=t.getParsers(n);for(var a of o){var s=a(i);if(s)return void r.push(s)}var c=DE.fromSdpLine(e);r.push(c)})),r}(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:zE),r=function(e){var t=new GE,r=t.session;return e.forEach((e=>{if(e instanceof yE){var n;if("audio"===e.type||"video"===e.type)n=new qE(e);else{if("application"!==e.type)throw new Error("Unhandled media type: ".concat(e.type));n=new jE(e)}t.media.push(n),r=n}else r.addLine(e)})),t}(t);return r}function $E(e){!function(e,t){(e instanceof GE?e.avMedia:[e]).forEach((e=>{e.codecs.forEach((e=>{e.feedback=e.feedback.filter((e=>e!==t))}))}))}(e,"transport-cc")}function JE(e,t){var r=!1;return e.codecs.forEach((n=>{t(n)||(e.removePt(n.pt),r=!0)})),r}function YE(e,t){var r=t.map((e=>e.toLowerCase()));return JE(e,(e=>!!e.name&&r.includes(e.name.toLowerCase())))}function QE(e,t){var r=t.map((e=>e.toLowerCase()));return function(e,t){var r=e instanceof GE?e.media:[e],n=!1;return r.forEach((e=>{e.iceInfo.candidates=e.iceInfo.candidates.filter((e=>!!t(e)||(n=!0,!1)))})),n}(e,(e=>r.includes(e.transport.toLowerCase())))}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==pv||"undefined"!=typeof self&&self;function XE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ZE={exports:{}};!function(e,t){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=90)}({17:function(e,t,r){t.__esModule=!0,t.default=void 0;var n=r(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||""},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||""},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,r,n){void 0===n&&(n=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(r),a=Math.max(i,o),s=0,c=e.map([t,r],(function(t){var r=a-e.getVersionPrecision(t),n=t+new Array(r+1).join(".0");return e.map(n.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(n&&(s=a-Math.min(i,o)),a-=1;a>=s;){if(c[0][a]>c[1][a])return 1;if(c[0][a]===c[1][a]){if(a===s)return 0;a-=1}else if(c[0][a]<c[1][a])return-1}},e.map=function(e,t){var r,n=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)n.push(t(e[r]));return n},e.find=function(e,t){var r,n;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(r=0,n=e.length;r<n;r+=1){var i=e[r];if(t(i,r))return i}},e.assign=function(e){for(var t,r,n=e,i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var s=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){n[t]=e[t]}))};for(t=0,r=o.length;t<r;t+=1)s();return e},e.getBrowserAlias=function(e){return n.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return n.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,r){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(91))&&n.__esModule?n:{default:n},o=r(18);function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s=function(){function e(){}var t,r,n;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,n=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(r=null)&&a(t.prototype,r),n&&a(t,n),e}();t.default=s,e.exports=t.default},91:function(e,t,r){t.__esModule=!0,t.default=void 0;var n=c(r(92)),i=c(r(93)),o=c(r(94)),a=c(r(95)),s=c(r(17));function c(e){return e&&e.__esModule?e:{default:e}}var u=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=s.default.find(n.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=s.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=s.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=s.default.find(a.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return s.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,r={},n=0,i={},o=0;if(Object.keys(e).forEach((function(t){var a=e[t];"string"==typeof a?(i[t]=a,o+=1):"object"==typeof a&&(r[t]=a,n+=1)})),n>0){var a=Object.keys(r),c=s.default.find(a,(function(e){return t.isOS(e)}));if(c){var u=this.satisfies(r[c]);if(void 0!==u)return u}var l=s.default.find(a,(function(e){return t.isPlatform(e)}));if(l){var d=this.satisfies(r[l]);if(void 0!==d)return d}}if(o>0){var f=Object.keys(i),h=s.default.find(f,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),n=e.toLowerCase(),i=s.default.getBrowserTypeByAlias(n);return t&&i&&(n=i.toLowerCase()),n===r},t.compareVersion=function(e){var t=[0],r=e,n=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(n=!0,r=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(n=!0,r=e.substr(1)),t.indexOf(s.default.compareVersions(i,r,n))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=u,e.exports=t.default},92:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},r=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},r=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},r=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},r=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},r=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},r=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},r=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},r=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},r=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},r=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},r=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},r=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},r=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},r=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},r=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},r=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},r=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},r=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},r=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},r=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},r=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t={name:"Android Browser"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},r=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=i.default.getMacOSVersionName(t),n={name:o.OS_MAP.MacOS,version:t};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=i.default.getAndroidVersionName(t),n={name:o.OS_MAP.Android,version:t};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:o.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},r=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},r=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},r=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},r=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=a,e.exports=t.default}})}(ZE);var eS,tS,rS,nS,iS=XE(ZE.exports);!function(e){e.CHROME="Chrome",e.FIREFOX="Firefox",e.EDGE="Microsoft Edge",e.SAFARI="Safari"}(eS||(eS={})),function(e){e.WINDOWS="Windows",e.MAC="macOS",e.LINUX="Linux"}(tS||(tS={}));class oS{static getBrowserDetails(){return this.browser.getBrowser()}static getOSDetails(){return this.browser.getOS()}static getPlatformDetails(){return this.browser.getPlatform()}static getEngineDetails(){return this.browser.getEngine()}static isChrome(){return this.browser.getBrowserName()===eS.CHROME}static isFirefox(){return this.browser.getBrowserName()===eS.FIREFOX}static isEdge(){return this.browser.getBrowserName()===eS.EDGE}static isSafari(){return this.browser.getBrowserName()===eS.SAFARI}static isWindows(){return this.browser.getOSName()===tS.WINDOWS}static isMac(){return this.browser.getOSName()===tS.MAC}static isLinux(){return this.browser.getOSName()===tS.LINUX}static isVersionGreaterThan(e){var t={[this.browser.getBrowserName()]:">".concat(e)};return this.browser.satisfies(t)}static isVersionGreaterThanOrEqualTo(e){var t={[this.browser.getBrowserName()]:">=".concat(e)};return this.browser.satisfies(t)}static isVersionLessThan(e){var t={[this.browser.getBrowserName()]:"<".concat(e)};return this.browser.satisfies(t)}static isVersionLessThanOrEqualTo(e){var t={[this.browser.getBrowserName()]:"<=".concat(e)};return this.browser.satisfies(t)}static isSubVersionOf(e){var t={[this.browser.getBrowserName()]:"~".concat(e)};return this.browser.satisfies(t)}}oS.browser=iS.getParser(window.navigator.userAgent),function(e){e.CpuPressureStateChange="cpu-pressure-state-change"}(rS||(rS={}));class aS extends rp{constructor(){super(),this.lastCpuPressure=void 0,aS.isPressureObserverSupported()&&(this.observer=new PressureObserver(this.handleStateChange.bind(this)),this.observer&&this.observer.observe("cpu"))}handleStateChange(e){e.forEach((e=>{"cpu"===e.source&&e.state!==this.lastCpuPressure&&(this.lastCpuPressure=e.state,this.emit(rS.CpuPressureStateChange,e.state))}))}getCpuPressure(){return this.lastCpuPressure}static isPressureObserverSupported(){return"PressureObserver"in window}}new aS,function(e){e.NOT_CAPABLE="not capable",e.CAPABLE="capable",e.UNKNOWN="unknown"}(nS||(nS={}));var sS={0:"240",1:"2304",2:"8160"};class cS extends iE{static fromSdpLine(e){if(cS.regex.test(e)){var t=e.match(cS.regex)[1].split(",").filter((e=>e.length));return new cS(t)}}constructor(e){super(),this.versions=e}toSdpLine(){return"a=jmp:".concat(this.versions.join(","))}}cS.regex=/^jmp:((?:v\d+,?)+)/;class uS extends iE{constructor(e){super(),this.streamIdMode=e}static fromSdpLine(e){if(uS.regex.test(e)){var t=e.match(uS.regex)[1];return new uS(t)}}toSdpLine(){return"a=jmp-stream-id-mode:".concat(this.streamIdMode)}}uS.regex=/^jmp-stream-id-mode:(MID-RID|SSRC)$/;class lS extends iE{constructor(e,t){super(),this.source=e,this.csi=t}static fromSdpLine(e){if(lS.regex.test(e)){var t=e.match(lS.regex),r=t[1],n=t[2];return new lS(r,n)}}toSdpLine(){var e="a=jmp-source:".concat(this.source);return this.csi&&(e+=" csi=".concat(this.csi)),e}}function dS(e){return Array.isArray(e)?e.map((e=>dS(e))):e instanceof Map?new Map(e):e instanceof Date?new Date(e.getTime()):e&&"object"==typeof e?Object.getOwnPropertyNames(e).reduce(((t,r)=>(Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r)),t[r]=dS(e[r]),t)),Object.create(Object.getPrototypeOf(e))):e}lS.regex=new RegExp("^jmp-source:(".concat(rE,") (?:csi=(").concat(rE,"))")),zE.addParser("a",cS.fromSdpLine),zE.addParser("a",lS.fromSdpLine),zE.addParser("a",uS.fromSdpLine);var fS=/(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.)(\d{1,3}\b)/g,hS=/(\b[\da-fA-F]{1,4}(:[\da-fA-F]{1,4}){7}\b)/g;function pS(e,t){t.session.groups=e.session.groups,t.media=e.media.map((e=>{e.mid||Mb(eb.OFFER_ANSWER_MISMATCH,"Offer media description is missing MID.");var r=t.media.find((t=>t.mid===e.mid));if(r)return r;e instanceof qE||Mb(eb.OFFER_ANSWER_MISMATCH,"Answer is missing a non-AV media description for MID ".concat(e.mid,"."));var n=t.avMedia.find((t=>t.type===e.type));n||Mb(eb.OFFER_ANSWER_MISMATCH,"Answer has no media description of type ".concat(e.type,", can't generate synthetic answer media description for MID ").concat(e.mid,"."));var i=dS(n);return i.mid=e.mid,i.simulcast=void 0,i.bandwidth=void 0,"sendrecv"!==e.direction&&"sendonly"!==e.direction||(i.direction="recvonly"),"recvonly"===e.direction&&(i.direction="sendonly"),i}))}function vS(e,t,r){if("max-compat"===t){var n=r.get(Wy.AudioMain),i=r.get(Wy.VideoMain),o=r.get(Wy.AudioSlides),a=r.get(Wy.VideoSlides);e.session.groups.splice(0,e.session.groups.length),n&&e.session.groups.push(new aE(n)),i&&e.session.groups.push(new aE(i)),o&&e.session.groups.push(new aE(o)),a&&e.session.groups.push(new aE(a))}}function mS(e){e.iceInfo.candidates=[],e.addLine(new sE("dummy1",1,"udp",3,"0.0.0.0",9,"host")),e.addLine(new sE("dummy2",1,"tcp",2,"0.0.0.0",9,"host")),e.addLine(new sE("dummy3",1,"udp",1,"0.0.0.0",9,"relay"))}function gS(e){var t=e.replace(fS,((e,t)=>"".concat(t,"0")));return t=t.replace(hS,(e=>e.replace(/:[\da-fA-F]{1,4}$/,":0")))}function yS(e){e.extMaps.forEach(((e,t,r)=>{/^urn:ietf:params:rtp-hdrext:sdes:(?:mid|rtp-stream-id|repaired-rtp-stream-id)$/.test(e.uri)&&r.delete(t)}))}function bS(e,t,r){r.forEach(((r,n)=>{[...e.codecs.values()].filter((e=>e.name&&t.includes(e.name))).forEach((e=>{null===r?e.fmtParams.delete(n):e.fmtParams.set(n,"".concat(r))}))}))}function ES(){return Math.floor(4294967295*Math.random())+1}class SS{constructor(){this.streamIds=[],this.customCodecParameters=new Map}reset(){this.streamIds=[]}mungeLocalDescription(e,t){var r;if(YE(e,["h264","opus","rtx"]),t.forceSoftwareEncoder){var n=e=>{var t;if("h264"===(null===(t=e.name)||void 0===t?void 0:t.toLowerCase())){var r=e.fmtParams.get("profile-level-id");return!!r&&/^42[^0]/.test(r)}return!1};[...e.codecs.values()].some(n)?JE(e,(e=>{var t;return"h264"!==(null===(t=e.name)||void 0===t?void 0:t.toLowerCase())||n(e)})):Lb.log("No H.264 CBP present in m-line with MID ".concat(e.mid,", so all H.264 codecs have been retained."))}0===e.codecs.size&&Mb(eb.SDP_MUNGE_MISSING_CODECS,"No codecs present in m-line with MID ".concat(e.mid," after filtering.")),e.rids=[],e.simulcast=void 0,yS(e),t.simulcastEnabled&&function(e){var t="http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00";[...e.extMaps.values()].some((e=>e.uri===t))||e.addExtension({uri:t})}(e);var i=t.simulcastEnabled?3:1;if(!this.streamIds.length)if(e.ssrcs.length){var o=[...new Set(e.ssrcs.map((e=>e.ssrcId)))];e.ssrcGroups.forEach((e=>{e.ssrcs.every((e=>o.includes(e)))||Mb(eb.SDP_MUNGE_FAILED,"SSRC present in SSRC groups is missing from SSRC lines.")}));var a=e.ssrcGroups.filter((e=>"FID"===e.semantics));a.length&&a.length!==i&&Mb(eb.SDP_MUNGE_FAILED,"Expected ".concat(i," RTX SSRC groups, got ").concat(a.length,".")),a.forEach((e=>{this.streamIds.push({ssrc:e.ssrcs[0],rtxSsrc:e.ssrcs[1]})}));var s=null===(r=e.ssrcGroups.find((e=>"SIM"===e.semantics)))||void 0===r?void 0:r.ssrcs;s?(s.length===i&&this.streamIds.every((e=>{var{ssrc:t}=e;return s.includes(t)}))||Mb(eb.SDP_MUNGE_FAILED,"SSRCs in simulcast SSRC group do not match primary SSRCs in RTX SSRC groups."),this.streamIds.sort(((e,t)=>s.indexOf(e.ssrc)-s.indexOf(t.ssrc)))):a.length>1&&Mb(eb.SDP_MUNGE_FAILED,"Multiple RTX SSRC groups but no simulcast SSRC group found."),this.streamIds.length||this.streamIds.push({ssrc:o[0]})}else[...Array(i).keys()].forEach((()=>{var e={ssrc:ES()};t.rtxEnabled&&(e.rtxSsrc=ES()),this.streamIds.push(e)}));e.ssrcs=[],e.ssrcGroups=[],this.streamIds.forEach((r=>{var n=r.ssrc;if(e.addLine(new LE(n,"cname","".concat(n,"-cname"))),e.addLine(new LE(n,"msid","-","".concat(e.mid))),t.rtxEnabled){var{rtxSsrc:i}=r;i&&(e.addLine(new LE(i,"cname","".concat(n,"-cname"))),e.addLine(new LE(i,"msid","-","".concat(e.mid))),e.addLine(new ME("FID",[n,i])))}})),t.simulcastEnabled&&e.addLine(new ME("SIM",this.streamIds.map((e=>e.ssrc)))),bS(e,["H264","opus"],this.customCodecParameters),t.twccDisabled&&$E(e)}mungeLocalDescriptionForRemoteServer(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{injectDummyCandidates:!0};if(function(e,t){t===Vy.Slides&&e.addLine(new uE(["slides"]))}(e,t),function(e,t,r){e.otherLines.find((e=>e instanceof cS))||e.addLine(new cS(["v1"])),e.otherLines.find((e=>e instanceof lS))||e.addLine(new lS(e.mid,t.toString())),e.otherLines.find((e=>e instanceof uS))||e.addLine(new uS(r))}(e,r,"SSRC"),n.injectDummyCandidates&&mS(e),"video"===e.type){var i=e.ssrcGroups.find((e=>"SIM"===e.semantics));i&&i.ssrcs.forEach(((t,r)=>{e.addLine(new LE(t,"fmtp","* max-fs=".concat(sS[r])))}))}}mungeRemoteDescription(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{dtxDisabled:!0};QE(e,["udp","tcp"])&&Lb.log("Some unsupported remote candidates have been removed from mid ".concat(e.mid)),e.bandwidth=void 0,"audio"===e.type&&[...e.codecs.values()].forEach((e=>{e.fmtParams.set("usedtx",t.dtxDisabled?"0":"1")})),bS(e,["H264","opus"],this.customCodecParameters)}getSenderIds(){return this.streamIds}getEncodingIndexForStreamId(e){return this.streamIds.findIndex((t=>pb(t,e)))}setCodecParameters(e){Object.entries(e).forEach((e=>{var[t,r]=e;this.customCodecParameters.set(t,r)}))}deleteCodecParameters(e){e.forEach((e=>{this.customCodecParameters.set(e,null)}))}}var _S,wS={exports:{}},RS="object"==typeof Reflect?Reflect:null,CS=RS&&"function"==typeof RS.apply?RS.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};_S=RS&&"function"==typeof RS.ownKeys?RS.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var TS=Number.isNaN||function(e){return e!=e};function xS(){xS.init.call(this)}wS.exports=xS,wS.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}BS(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&BS(e,"error",t,r)}(e,i,{once:!0})}))},xS.EventEmitter=xS,xS.prototype._events=void 0,xS.prototype._eventsCount=0,xS.prototype._maxListeners=void 0;var kS,IS,AS,OS=10;function LS(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function MS(e){return void 0===e._maxListeners?xS.defaultMaxListeners:e._maxListeners}function NS(e,t,r,n){var i,o,a,s;if(LS(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=MS(e))>0&&a.length>i&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,s=c,console&&console.warn&&console.warn(s)}return e}function PS(){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 DS(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=PS.bind(n);return i.listener=r,n.wrapFn=i,i}function FS(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):jS(i,i.length)}function US(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function jS(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function BS(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(xS,"defaultMaxListeners",{enumerable:!0,get:function(){return OS},set:function(e){if("number"!=typeof e||e<0||TS(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");OS=e}}),xS.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},xS.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||TS(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},xS.prototype.getMaxListeners=function(){return MS(this)},xS.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=i[e];if(void 0===s)return!1;if("function"==typeof s)CS(s,this,t);else{var c=s.length,u=jS(s,c);for(r=0;r<c;++r)CS(u[r],this,t)}return!0},xS.prototype.addListener=function(e,t){return NS(this,e,t,!1)},xS.prototype.on=xS.prototype.addListener,xS.prototype.prependListener=function(e,t){return NS(this,e,t,!0)},xS.prototype.once=function(e,t){return LS(t),this.on(e,DS(this,e,t)),this},xS.prototype.prependOnceListener=function(e,t){return LS(t),this.prependListener(e,DS(this,e,t)),this},xS.prototype.removeListener=function(e,t){var r,n,i,o,a;if(LS(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},xS.prototype.off=xS.prototype.removeListener,xS.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},xS.prototype.listeners=function(e){return FS(this,e,!0)},xS.prototype.rawListeners=function(e){return FS(this,e,!1)},xS.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):US.call(e,t)},xS.prototype.listenerCount=US,xS.prototype.eventNames=function(){return this._eventsCount>0?_S(this._events):[]};class qS extends wS.exports.EventEmitter{}class VS{constructor(){this.customCodecParameters=new Map,this.customRtxCodecParameters=new Map,this.ssrc=ES()}getReceiverId(){return Object.assign({ssrc:this.ssrc},this.rtxSsrc?{rtxSsrc:this.rtxSsrc}:{})}mungeLocalDescription(e,t){YE(e,["h264","opus","rtx"]),0===e.codecs.size&&Mb(eb.SDP_MUNGE_MISSING_CODECS,"No codecs present in m-line with MID ".concat(e.mid," after filtering.")),yS(e),bS(e,["H264","opus"],this.customCodecParameters),bS(e,["rtx"],this.customRtxCodecParameters),t.twccDisabled&&$E(e)}mungeRemoteDescription(e){var t;e.ssrcs.length||(e.addLine(new LE(this.ssrc,"cname","".concat(this.ssrc,"-cname"))),e.addLine(new LE(this.ssrc,"msid","-","".concat(e.mid))),t="rtx",[...e.codecs.values()].some((e=>{var r;return(null===(r=e.name)||void 0===r?void 0:r.toLowerCase())===t.toLowerCase()}))&&(this.rtxSsrc||(this.rtxSsrc=ES()),e.addLine(new LE(this.rtxSsrc,"cname","".concat(this.ssrc,"-cname"))),e.addLine(new LE(this.rtxSsrc,"msid","-","".concat(e.mid))),e.addLine(new ME("FID",[this.ssrc,this.rtxSsrc])))),QE(e,["udp","tcp"])&&Lb.log("Some unsupported remote candidates have been removed from mid ".concat(e.mid)),bS(e,["rtx"],this.customRtxCodecParameters)}setCodecParameters(e){Object.entries(e).forEach((e=>{var[t,r]=e;this.customCodecParameters.set(t,r)}))}setRtxCodecParameters(e){Object.entries(e).forEach((e=>{var[t,r]=e;this.customRtxCodecParameters.set(t,r)}))}reset(){this.ssrc=ES()}}!function(e){e.Multistream="multistream"}(kS||(kS={}));class GS{constructor(e,t){this.msgType=e,this.payload=t}static fromJson(e){return e.msgType&&e.payload?new GS(e.msgType,e.payload):null}}class WS{constructor(){this.currentMid=0,this.midMap=new Map}getNextMid(e){var t=this.currentMid++,r=this.midMap.get(e)||[];return r.push("".concat(t)),this.midMap.set(e,r),"".concat(t)}allocateMidForDatachannel(){this.currentMid+=1}reset(){this.midMap=new Map,this.currentMid=0}getMidMap(){return this.midMap}}!function(e){e[e.NOT_OVERUSED=0]="NOT_OVERUSED",e[e.OVERUSED=1]="OVERUSED"}(IS||(IS={}));class zS{constructor(e){this.monitors=[],this.lastOverallOveruseState=IS.NOT_OVERUSED,this.isRunning=!1,this.overuseUpdateCallback=e}addMonitor(e){this.monitors.push(e),this.isRunning&&e.startMonitoring((()=>this.onMonitorOveruseUpdate()))}start(){this.isRunning=!0,this.monitors.forEach((e=>e.startMonitoring((()=>this.onMonitorOveruseUpdate()))))}stop(){this.isRunning=!1,this.monitors.forEach((e=>e.stopMonitoring()))}onMonitorOveruseUpdate(){var e=this.monitors.map((e=>e.getLastOveruseState())).some((e=>e===IS.OVERUSED))?IS.OVERUSED:IS.NOT_OVERUSED;e!==this.lastOverallOveruseState&&(this.lastOverallOveruseState=e,this.overuseUpdateCallback(e))}}!function(e){e.MediaStarted="media-started",e.MediaStopped="media-stopped",e.MediaEnded="media-ended",e.SourceUpdate="source-update"}(AS||(AS={}));class HS extends qS{constructor(e,t){super(),this._isRequested=!1,this._idGetter=e,this.handleStreamMediaStateChange=this.handleStreamMediaStateChange.bind(this),this.handleStreamEnded=this.handleStreamEnded.bind(this),this._stream=new Ym(new MediaStream([t])),this._sourceState=t.kind===Py.Video?"no source":void 0,this._stream.on(Vm.MediaStateChange,this.handleStreamMediaStateChange),this._stream.on(bm.Ended,this.handleStreamEnded)}handleStreamMediaStateChange(e){e===qm.Stopped?this.emit(AS.MediaStopped):this.emit(AS.MediaStarted)}handleStreamEnded(){this.emit(AS.MediaEnded)}_replaceTrack(e){this._stream.replaceTrack(e)}_updateSource(e,t){e===this._sourceState&&t===this._currentRxCsi||(this._sourceState=e,this._currentRxCsi=t,this.emit(AS.SourceUpdate,e,t))}close(){this._stream.off(Vm.MediaStateChange,this.handleStreamMediaStateChange),this._stream.off(bm.Ended,this.handleStreamEnded)}get id(){return this._idGetter()}get stream(){return this._stream.outputStream}get currentRxCsi(){return this._currentRxCsi}get sourceState(){return this._sourceState}}function KS(){return performance.timeOrigin+performance.now()}HS.Events=AS;class $S{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>Bb(this,void 0,void 0,(function*(){}));this.statsGetter=e,this.statsPreProcessor=t}getStats(){return Bb(this,void 0,void 0,(function*(){var e=yield this.statsGetter(),t=new Map;return e.forEach(((e,r)=>t.set(r,e))),yield this.statsPreProcessor(t),t}))}}class JS{constructor(e){this.twccDisabled=!1,this._rtcRtpTransceiver=e.rtcRtpTransceiver,this.mid=e.mid,this.mediaType=e.mediaType}replaceTransceiver(e){this._rtcRtpTransceiver=e}get receiver(){return this._rtcRtpTransceiver.receiver}get sender(){return this._rtcRtpTransceiver.sender}close(){try{this._rtcRtpTransceiver.stop()}catch(e){if(!(e instanceof DOMException&&"InvalidStateError"===e.name))throw Lb.error("An unexpected error occurred while stopping the RTCRtpTransceiver:",e),e;Lb.warn("Peer connection is already closed, skipping call to RTCRtpTransceiver.stop()")}}}class YS extends JS{constructor(e){super(e),this.metadata={isActiveSpeaker:!1},this.munger=e.munger,this._receiveSlot=new HS((()=>this._rtcRtpTransceiver.mid?this.munger.getReceiverId():null),this._rtcRtpTransceiver.receiver.track)}replaceTransceiver(e){super.replaceTransceiver(e),this._receiveSlot._replaceTrack(e.receiver.track)}close(){super.close(),this._receiveSlot.close()}get receiveSlot(){return this._receiveSlot}getStats(){return Bb(this,void 0,void 0,(function*(){var e=new Map;return(yield this.receiver.getStats()).forEach(((t,r)=>{"inbound-rtp"===t.type&&(t.mid=this.mid,t.csi=this.receiveSlot.currentRxCsi,t.sourceState=this.receiveSlot.sourceState,t.calliopeMediaType=this.mediaType,t.requestedBitrate=this.metadata.requestedBitrate,t.requestedFrameSize=this.metadata.requestedFrameSize,t.requestedFrameRate=this.metadata.requestedFrameRate,t.isRequested=this.receiveSlot._isRequested,t.lastRequestedUpdateTimestamp=this.metadata.lastRequestedUpdateTimestamp,t.isActiveSpeaker=this.metadata.isActiveSpeaker,t.lastActiveSpeakerUpdateTimestamp=this.metadata.lastActiveSpeakerUpdateTimestamp,Object.assign(t,this.receiverId)),e.set(r,t)})),e}))}mungeLocalDescription(e){this.munger.mungeLocalDescription(e,{twccDisabled:this.twccDisabled})}mungeRemoteDescription(e){this.munger.mungeRemoteDescription(e)}get receiverId(){return this.munger.getReceiverId()}resetSdpMunger(){this.munger.reset()}handleRequested(e){var t,r,n,i;this.receiveSlot._isRequested||(this.receiveSlot._isRequested=!0,this.metadata.lastRequestedUpdateTimestamp=KS()),this.metadata.requestedBitrate=e.maxPayloadBitsPerSecond,this.metadata.requestedFrameSize=null===(r=null===(t=e.codecInfos[0])||void 0===t?void 0:t.h264)||void 0===r?void 0:r.maxFs,this.metadata.requestedFrameRate=null===(i=null===(n=e.codecInfos[0])||void 0===n?void 0:n.h264)||void 0===i?void 0:i.maxFps}handleUnrequested(){this.receiveSlot._isRequested&&(this.receiveSlot._isRequested=!1,this.metadata.lastRequestedUpdateTimestamp=KS()),this.metadata.requestedBitrate=void 0,this.metadata.requestedFrameSize=void 0,this.metadata.requestedFrameRate=void 0,this.receiveSlot._updateSource("no source",void 0)}handleActiveSpeakerUpdate(e){this.metadata.isActiveSpeaker!==e&&(this.metadata.isActiveSpeaker=e,this.metadata.lastActiveSpeakerUpdateTimestamp=KS())}setCodecParameters(e){this.munger.setCodecParameters(e)}setRtxCodecParameters(e){this.munger.setRtxCodecParameters(e)}}YS.rid="1";var QS,XS={exports:{}},ZS="object"==typeof Reflect?Reflect:null,e_=ZS&&"function"==typeof ZS.apply?ZS.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};QS=ZS&&"function"==typeof ZS.ownKeys?ZS.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var t_=Number.isNaN||function(e){return e!=e};function r_(){r_.init.call(this)}XS.exports=r_,XS.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}f_(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&f_(e,"error",t,r)}(e,i,{once:!0})}))},r_.EventEmitter=r_,r_.prototype._events=void 0,r_.prototype._eventsCount=0,r_.prototype._maxListeners=void 0;var n_=10;function i_(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function o_(e){return void 0===e._maxListeners?r_.defaultMaxListeners:e._maxListeners}function a_(e,t,r,n){var i,o,a,s;if(i_(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=o_(e))>0&&a.length>i&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,s=c,console&&console.warn&&console.warn(s)}return e}function s_(){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 c_(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=s_.bind(n);return i.listener=r,n.wrapFn=i,i}function u_(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):d_(i,i.length)}function l_(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function d_(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function f_(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(r_,"defaultMaxListeners",{enumerable:!0,get:function(){return n_},set:function(e){if("number"!=typeof e||e<0||t_(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");n_=e}}),r_.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},r_.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||t_(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},r_.prototype.getMaxListeners=function(){return o_(this)},r_.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=i[e];if(void 0===s)return!1;if("function"==typeof s)e_(s,this,t);else{var c=s.length,u=d_(s,c);for(r=0;r<c;++r)e_(u[r],this,t)}return!0},r_.prototype.addListener=function(e,t){return a_(this,e,t,!1)},r_.prototype.on=r_.prototype.addListener,r_.prototype.prependListener=function(e,t){return a_(this,e,t,!0)},r_.prototype.once=function(e,t){return i_(t),this.on(e,c_(this,e,t)),this},r_.prototype.prependOnceListener=function(e,t){return i_(t),this.prependListener(e,c_(this,e,t)),this},r_.prototype.removeListener=function(e,t){var r,n,i,o,a;if(i_(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},r_.prototype.off=r_.prototype.removeListener,r_.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},r_.prototype.listeners=function(e){return u_(this,e,!0)},r_.prototype.rawListeners=function(e){return u_(this,e,!1)},r_.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):l_.call(e,t)},r_.prototype.listenerCount=l_,r_.prototype.eventNames=function(){return this._eventsCount>0?QS(this._events):[]};class h_ extends XS.exports.EventEmitter{}class p_{constructor(){this.emitter=new h_}on(e){this.emitter.on("event",e)}once(e){this.emitter.once("event",e)}off(e){this.emitter.off("event",e)}emit(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.emitter.emit("event",...t)}}var v_,m_="function"==typeof queueMicrotask&&queueMicrotask,g_="function"==typeof setImmediate&&setImmediate,y_="object"==typeof Uv&&"function"==typeof Uv.nextTick;v_=m_?queueMicrotask:g_?setImmediate:y_?Uv.nextTick:function(e){setTimeout(e,0)};var b_,E_=(b_=v_,function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return b_((()=>e(...r)))});function S_(e){return R_(e)?function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=r.pop();return __(e.apply(this,r),i)}:(t=function(t,r){var n;try{n=e.apply(this,t)}catch(e){return r(e)}if(n&&"function"==typeof n.then)return __(n,r);r(null,n)},function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i=r.pop();return t.call(this,r,i)});var t}function __(e,t){return e.then((e=>{w_(t,null,e)}),(e=>{w_(t,e&&e.message?e:new Error(e))}))}function w_(e,t,r){try{e(t,r)}catch(e){E_((e=>{throw e}),e)}}function R_(e){return"AsyncFunction"===e[Symbol.toStringTag]}function C_(e){if("function"!=typeof e)throw new Error("expected a function");return R_(e)?S_(e):e}function T_(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.length;if(!t)throw new Error("arity is undefined");return function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return"function"==typeof n[t-1]?e.apply(this,n):new Promise(((r,i)=>{n[t-1]=function(e){if(e)return i(e);for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];r(n.length>1?n:n[0])},e.apply(this,n)}))}}function x_(e,t,r,n){t=t||[];var i=[],o=0,a=C_(r);return e(t,((e,t,r)=>{var n=o++;a(e,((e,t)=>{i[n]=t,r(e)}))}),(e=>{n(e,i)}))}function k_(e){return e&&"number"==typeof e.length&&e.length>=0&&e.length%1==0}var I_={};function A_(e){function t(){if(null!==e){var t=e;e=null;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}return Object.assign(t,e),t}function O_(e){if(k_(e))return function(e){var t=-1,r=e.length;return function(){return++t<r?{value:e[t],key:t}:null}}(e);var t=function(e){return e[Symbol.iterator]&&e[Symbol.iterator]()}(e);return t?function(e){var t=-1;return function(){var r=e.next();return r.done?null:(t++,{value:r.value,key:t})}}(t):function(e){var t=e?Object.keys(e):[],r=-1,n=t.length;return function i(){var o=t[++r];return"__proto__"===o?i():r<n?{value:e[o],key:o}:null}}(e)}function L_(e){return function(){if(null===e)throw new Error("Callback was already called.");var t=e;e=null;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}function M_(e,t,r,n){var i=!1,o=!1,a=!1,s=0,c=0;function u(){s>=t||a||i||(a=!0,e.next().then((e=>{var{value:t,done:d}=e;if(!o&&!i){if(a=!1,d)return i=!0,void(s<=0&&n(null));s++,r(t,c,l),c++,u()}})).catch(d))}function l(e,t){if(s-=1,!o)return e?d(e):!1===e?(i=!0,void(o=!0)):t===I_||i&&s<=0?(i=!0,n(null)):void u()}function d(e){o||(a=!1,i=!0,n(e))}u()}var N_=e=>(t,r,n)=>{if(n=A_(n),e<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!t)return n(null);if("AsyncGenerator"===t[Symbol.toStringTag])return M_(t,e,r,n);if(function(e){return"function"==typeof e[Symbol.asyncIterator]}(t))return M_(t[Symbol.asyncIterator](),e,r,n);var i=O_(t),o=!1,a=!1,s=0,c=!1;function u(e,t){if(!a)if(s-=1,e)o=!0,n(e);else if(!1===e)o=!0,a=!0;else{if(t===I_||o&&s<=0)return o=!0,n(null);c||l()}}function l(){for(c=!0;s<e&&!o;){var t=i();if(null===t)return o=!0,void(s<=0&&n(null));s+=1,r(t.value,t.key,L_(u))}c=!1}l()};var P_=T_((function(e,t,r,n){return N_(t)(e,C_(r),n)}),4);function D_(e,t,r){r=A_(r);var n=0,i=0,{length:o}=e,a=!1;function s(e,t){!1===e&&(a=!0),!0!==a&&(e?r(e):++i!==o&&t!==I_||r(null))}for(0===o&&r(null);n<o;n++)t(e[n],n,L_(s))}function F_(e,t,r){return P_(e,1/0,t,r)}var U_=T_((function(e,t,r){return(k_(e)?D_:F_)(e,C_(t),r)}),3);var j_=T_((function(e,t,r){return x_(U_,e,t,r)}),3);var B_=T_((function(e,t,r){return P_(e,1,t,r)}),3);T_((function(e,t,r){return x_(B_,e,t,r)}),3);class q_{constructor(){this.head=this.tail=null,this.length=0}removeLink(e){return e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=e.next=null,this.length-=1,e}empty(){for(;this.head;)this.shift();return this}insertAfter(e,t){t.prev=e,t.next=e.next,e.next?e.next.prev=t:this.tail=t,e.next=t,this.length+=1}insertBefore(e,t){t.prev=e.prev,t.next=e,e.prev?e.prev.next=t:this.head=t,e.prev=t,this.length+=1}unshift(e){this.head?this.insertBefore(this.head,e):V_(this,e)}push(e){this.tail?this.insertAfter(this.tail,e):V_(this,e)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){for(var e=this.head;e;)yield e.data,e=e.next}remove(e){for(var t=this.head;t;){var{next:r}=t;e(t)&&this.removeLink(t),t=r}return this}}function V_(e,t){e.length=1,e.head=e.tail=t}function G_(e,t,r){if(null==t)t=1;else if(0===t)throw new RangeError("Concurrency must not be zero");var n=C_(e),i=0,o=[],a={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function s(e,t){return e?t?void(a[e]=a[e].filter((e=>e!==t))):a[e]=[]:Object.keys(a).forEach((e=>a[e]=[]))}function c(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];a[e].forEach((e=>e(...r)))}var u=!1;function l(e,t,r,n){if(null!=n&&"function"!=typeof n)throw new Error("task callback must be a function");var i,o;function a(e){if(e)return r?o(e):i();for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];if(n.length<=1)return i(n[0]);i(n)}v.started=!0;var s=v._createTaskItem(e,r?a:n||a);if(t?v._tasks.unshift(s):v._tasks.push(s),u||(u=!0,E_((()=>{u=!1,v.process()}))),r||!n)return new Promise(((e,t)=>{i=e,o=t}))}function d(e){return function(t){i-=1;for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];for(var s=0,u=e.length;s<u;s++){var l=e[s],d=o.indexOf(l);0===d?o.shift():d>0&&o.splice(d,1),l.callback(t,...n),null!=t&&c("error",t,l.data)}i<=v.concurrency-v.buffer&&c("unsaturated"),v.idle()&&c("drain"),v.process()}}function f(e){return!(0!==e.length||!v.idle())&&(E_((()=>c("drain"))),!0)}var h=e=>t=>{if(!t)return new Promise(((t,r)=>{!function(e,t){a[e].push((function r(){s(e,r),t(...arguments)}))}(e,((e,n)=>{if(e)return r(e);t(n)}))}));s(e),function(e,t){a[e].push(t)}(e,t)},p=!1,v={_tasks:new q_,_createTaskItem:(e,t)=>({data:e,callback:t}),*[Symbol.iterator](){yield*v._tasks[Symbol.iterator]()},concurrency:t,payload:r,buffer:t/4,started:!1,paused:!1,push(e,t){if(Array.isArray(e)){if(f(e))return;return e.map((e=>l(e,!1,!1,t)))}return l(e,!1,!1,t)},pushAsync(e,t){if(Array.isArray(e)){if(f(e))return;return e.map((e=>l(e,!1,!0,t)))}return l(e,!1,!0,t)},kill(){s(),v._tasks.empty()},unshift(e,t){if(Array.isArray(e)){if(f(e))return;return e.map((e=>l(e,!0,!1,t)))}return l(e,!0,!1,t)},unshiftAsync(e,t){if(Array.isArray(e)){if(f(e))return;return e.map((e=>l(e,!0,!0,t)))}return l(e,!0,!0,t)},remove(e){v._tasks.remove(e)},process(){if(!p){for(p=!0;!v.paused&&i<v.concurrency&&v._tasks.length;){var e=[],t=[],r=v._tasks.length;v.payload&&(r=Math.min(r,v.payload));for(var a=0;a<r;a++){var s=v._tasks.shift();e.push(s),o.push(s),t.push(s.data)}i+=1,0===v._tasks.length&&c("empty"),i===v.concurrency&&c("saturated");var u=L_(d(e));n(t,u)}p=!1}},length:()=>v._tasks.length,running:()=>i,workersList:()=>o,idle:()=>v._tasks.length+i===0,pause(){v.paused=!0},resume(){!1!==v.paused&&(v.paused=!1,E_(v.process))}};return Object.defineProperties(v,{saturated:{writable:!1,value:h("saturated")},unsaturated:{writable:!1,value:h("unsaturated")},empty:{writable:!1,value:h("empty")},drain:{writable:!1,value:h("drain")},error:{writable:!1,value:h("error")}}),v}T_((function(e,t,r,n){n=A_(n);var i=C_(r);return B_(e,((e,r,n)=>{i(t,e,((e,r)=>{t=r,n(e)}))}),(e=>n(e,t)))}),4);var W_=T_((function(e,t,r,n){return x_(N_(t),e,r,n)}),4);var z_=T_((function(e,t,r,n){var i=C_(r);return W_(e,t,((e,t)=>{i(e,(function(e){if(e)return t(e);for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return t(e,n)}))}),((e,t)=>{for(var r=[],i=0;i<t.length;i++)t[i]&&(r=r.concat(...t[i]));return n(e,r)}))}),4);function H_(e,t){return(r,n,i,o)=>{var a,s=!1,c=C_(i);r(n,((r,n,i)=>{c(r,((n,o)=>n||!1===n?i(n):e(o)&&!a?(s=!0,a=t(!0,r),i(null,I_)):void i()))}),(e=>{if(e)return o(e);o(null,s?a:t(!1))}))}}function K_(e){return(t,r,n)=>e(t,n)}T_((function(e,t,r){return z_(e,1/0,t,r)}),3),T_((function(e,t,r){return z_(e,1,t,r)}),3),T_((function(e,t,r){return H_((e=>e),((e,t)=>t))(U_,e,t,r)}),3),T_((function(e,t,r,n){return H_((e=>e),((e,t)=>t))(N_(t),e,r,n)}),4),T_((function(e,t,r){return H_((e=>e),((e,t)=>t))(N_(1),e,t,r)}),3),T_((function(e,t,r){r=L_(r);var n,i=C_(e),o=C_(t);function a(e){if(e)return r(e);if(!1!==e){for(var t=arguments.length,i=new Array(t>1?t-1:0),a=1;a<t;a++)i[a-1]=arguments[a];n=i,o(...i,s)}}function s(e,t){return e?r(e):!1!==e?t?void i(a):r(null,...n):void 0}return s(null,!0)}),3),T_((function(e,t,r){return U_(e,K_(C_(t)),r)}),3);var $_=T_((function(e,t,r,n){return N_(t)(e,K_(C_(r)),n)}),4);var J_=T_((function(e,t,r){return $_(e,1,t,r)}),3);function Y_(e,t,r,n){var i=new Array(t.length);e(t,((e,t,n)=>{r(e,((e,r)=>{i[t]=!!r,n(e)}))}),(e=>{if(e)return n(e);for(var r=[],o=0;o<t.length;o++)i[o]&&r.push(t[o]);n(null,r)}))}function Q_(e,t,r,n){var i=[];e(t,((e,t,n)=>{r(e,((r,o)=>{if(r)return n(r);o&&i.push({index:t,value:e}),n(r)}))}),(e=>{if(e)return n(e);n(null,i.sort(((e,t)=>e.index-t.index)).map((e=>e.value)))}))}function X_(e,t,r,n){return(k_(t)?Y_:Q_)(e,t,C_(r),n)}function Z_(e,t,r,n){var i=C_(r);return X_(e,t,((e,t)=>{i(e,((e,r)=>{t(e,!r)}))}),n)}function ew(e,t){return Bb(this,void 0,void 0,(function*(){try{yield e(),t()}catch(e){t(e)}}))}T_((function(e,t,r){return H_((e=>!e),(e=>!e))(U_,e,t,r)}),3),T_((function(e,t,r,n){return H_((e=>!e),(e=>!e))(N_(t),e,r,n)}),4),T_((function(e,t,r){return H_((e=>!e),(e=>!e))(B_,e,t,r)}),3),T_((function(e,t,r){return X_(U_,e,t,r)}),3),T_((function(e,t,r,n){return X_(N_(t),e,r,n)}),4),T_((function(e,t,r){return X_(B_,e,t,r)}),3),T_((function(e,t){var r=L_(t),n=C_(function(e){return R_(e)?e:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=r.pop(),o=!0;r.push((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];o?E_((()=>i(...t))):i(...t)})),e.apply(this,r),o=!1}}(e));return function e(t){if(t)return r(t);!1!==t&&n(e)}()}),2),T_((function(e,t,r,n){var i=C_(r);return W_(e,t,((e,t)=>{i(e,((r,n)=>r?t(r):t(r,{key:n,val:e})))}),((e,t)=>{for(var r={},{hasOwnProperty:i}=Object.prototype,o=0;o<t.length;o++)if(t[o]){var{key:a}=t[o],{val:s}=t[o];i.call(r,a)?r[a].push(s):r[a]=[s]}return n(e,r)}))}),4),T_((function(e,t,r,n){n=A_(n);var i={},o=C_(r);return N_(t)(e,((e,t,r)=>{o(e,t,((e,n)=>{if(e)return r(e);i[t]=n,r(e)}))}),(e=>n(e,i)))}),4),y_||g_&&setImmediate,T_(((e,t,r)=>{var n=k_(t)?[]:{};e(t,((e,t,r)=>{C_(e)((function(e){for(var i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];o.length<2&&([o]=o),n[t]=o,r(e)}))}),(e=>r(e,n)))}),3),T_((function(e,t){if(t=A_(t),!Array.isArray(e))return t(new TypeError("First argument to race must be an array of functions"));if(!e.length)return t();for(var r=0,n=e.length;r<n;r++)C_(e[r])(t)}),2),T_((function(e,t,r){return Z_(U_,e,t,r)}),3),T_((function(e,t,r,n){return Z_(N_(t),e,r,n)}),4),T_((function(e,t,r){return Z_(B_,e,t,r)}),3),T_((function(e,t,r){return H_(Boolean,(e=>e))(U_,e,t,r)}),3),T_((function(e,t,r,n){return H_(Boolean,(e=>e))(N_(t),e,r,n)}),4),T_((function(e,t,r){return H_(Boolean,(e=>e))(B_,e,t,r)}),3),T_((function(e,t,r){var n=C_(t);return j_(e,((e,t)=>{n(e,((r,n)=>{if(r)return t(r);t(r,{value:e,criteria:n})}))}),((e,t)=>{if(e)return r(e);r(null,t.sort(i).map((e=>e.value)))}));function i(e,t){var r=e.criteria,n=t.criteria;return r<n?-1:r>n?1:0}}),3),T_((function(e,t){var r,n=null;return J_(e,((e,t)=>{C_(e)((function(e){if(!1===e)return t(e);for(var i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];o.length<2?[r]=o:r=o,n=e,t(e?null:{})}))}),(()=>t(n,r)))})),T_((function(e,t,r){r=L_(r);var n=C_(t),i=C_(e),o=[];function a(e){if(e)return r(e);for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];o=n,!1!==e&&i(s)}function s(e,t){return e?r(e):!1!==e?t?void n(a):r(null,...o):void 0}return i(s)}),3),T_((function(e,t){if(t=A_(t),!Array.isArray(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var r=0;function n(t){C_(e[r++])(...t,L_(i))}function i(i){if(!1!==i){for(var o=arguments.length,a=new Array(o>1?o-1:0),s=1;s<o;s++)a[s-1]=arguments[s];if(i||r===e.length)return t(i,...a);n(a)}}n([])}));class tw{constructor(){this.queue=function(e,t){var r=C_(e);return G_(((e,t)=>{r(e[0],t)}),t,1)}(ew,1)}push(e){return this.queue.pushAsync(e)}empty(){return this.queue.empty()}}var rw;!function(e){e[e.LocalOnly=0]="LocalOnly",e[e.Remote=1]="Remote"}(rw||(rw={}));class nw extends JS{constructor(e){super(e),this.rtxEnabled=!1,this.dtxDisabled=!0,this.streamMuteStateChange=new p_,this.streamReadyStateChanged=new p_,this.streamPublishStateChange=new p_,this.negotiationNeeded=new p_,this.namedMediaGroupsChange=new p_,this.requestedIdEncodingParamsMap=new Map,this.updateSendParametersQueue=new tw,this.sourceStateOverrideChange=new p_,this.metadata={lastRequestedUpdateTimestampsMap:new Map},this.munger=e.munger,this.csi=e.csi,this.direction="sendrecv",this.handleTrackChange=this.handleTrackChange.bind(this),this.handleStreamConstraintsChange=this.handleStreamConstraintsChange.bind(this),this.handleStreamMuteStateChange=this.handleStreamMuteStateChange.bind(this),this.handleStreamEnded=this.handleStreamEnded.bind(this)}replaceSenderSource(e){var t,r;return Bb(this,void 0,void 0,(function*(){var n=null!==(t=null==e?void 0:e.outputStream.getTracks()[0])&&void 0!==t?t:null;(null===(r=this.sender.track)||void 0===r?void 0:r.id)!==(null==n?void 0:n.id)&&(yield this.sender.replaceTrack(n),n?Lb.log("Sender source for ".concat(this.mediaType," replaced with track ID ").concat(n.id)):Lb.log("Sender source for ".concat(this.mediaType," set to null, sender stopped")))}))}handleTrackChange(){return Bb(this,void 0,void 0,(function*(){this.requested&&(yield this.replaceSenderSource(this.publishedStream))}))}handleStreamConstraintsChange(){return Bb(this,void 0,void 0,(function*(){yield this.updateSendParameters(this.requestedIdEncodingParamsMap)}))}handleStreamMuteStateChange(){this.streamMuteStateChange.emit()}handleStreamEnded(){this.streamReadyStateChanged.emit()}get requested(){return this.requestedIdEncodingParamsMap.size>0}replaceTransceiver(e){var t=Object.create(null,{replaceTransceiver:{get:()=>super.replaceTransceiver}});return Bb(this,void 0,void 0,(function*(){t.replaceTransceiver.call(this,e),e.direction=this.direction,this.requested&&(yield this.replaceSenderSource(this.publishedStream))}))}replacePublishedStream(e){return Bb(this,void 0,void 0,(function*(){var t=this.publishedStream;null==t||t.off(Um.OutputTrackChange,this.handleTrackChange),null==t||t.off(Um.ConstraintsChange,this.handleStreamConstraintsChange),null==t||t.off(Um.UserMuteStateChange,this.handleStreamMuteStateChange),null==t||t.off(Um.SystemMuteStateChange,this.handleStreamMuteStateChange),null==t||t.off(bm.Ended,this.handleStreamEnded),this.requested&&(yield this.replaceSenderSource(e)),this.publishedStream=e,null==e||e.on(Um.OutputTrackChange,this.handleTrackChange),null==e||e.on(Um.ConstraintsChange,this.handleStreamConstraintsChange),null==e||e.on(Um.UserMuteStateChange,this.handleStreamMuteStateChange),null==e||e.on(Um.SystemMuteStateChange,this.handleStreamMuteStateChange),null==e||e.on(bm.Ended,this.handleStreamEnded),(!t&&e||t&&!e)&&this.streamPublishStateChange.emit(),t&&e&&(t.muted!==e.muted&&this.streamMuteStateChange.emit(),t.readyState!==e.readyState&&this.streamReadyStateChanged.emit())}))}setNamedMediaGroups(e){this.mediaType!==Wy.AudioMain&&Mb(eb.SET_NMG_FAILED,"Named media groups can only be set for audio."),this.namedMediaGroups=e,this.namedMediaGroupsChange.emit()}publishStream(e){return this.replacePublishedStream(e)}unpublishStream(){return this.replacePublishedStream()}get active(){return"sendrecv"===this._rtcRtpTransceiver.direction}set active(e){this.direction=e?"sendrecv":"inactive",this._rtcRtpTransceiver.direction=this.direction,this._rtcRtpTransceiver.direction!==this._rtcRtpTransceiver.currentDirection&&this.negotiationNeeded.emit(rw.Remote)}getStats(){return Bb(this,void 0,void 0,(function*(){var e=new Map;return(yield this.sender.getStats()).forEach(((t,r)=>{var n,i,o,a,s;if("outbound-rtp"===t.type){t.mid=this.mid,t.csi=this.csi,t.sourceState=this.currentSourceState,t.calliopeMediaType=this.mediaType;var c=this.munger.getSenderIds().find((e=>e.ssrc===t.ssrc));if(c){var u=this.getEncodingIndexForStreamId(c),l=this.requestedIdEncodingParamsMap.get(u);t.requestedBitrate=null==l?void 0:l.maxPayloadBitsPerSecond,t.requestedFrameSize=null==l?void 0:l.maxFs,t.isRequested=!!l,t.lastRequestedUpdateTimestamp=this.metadata.lastRequestedUpdateTimestampsMap.get(u)}var d=null===(i=null===(n=this.publishedStream)||void 0===n?void 0:n.getEffects())||void 0===i?void 0:i[0];(null==d?void 0:d.isEnabled)&&((e=>"noise-reduction-effect"===(null==e?void 0:e.kind))(d)?t.effect={kind:d.kind,noiseReductionMode:"LOW_POWER"}:(e=>"virtual-background-effect"===(null==e?void 0:e.kind))(d)?t.effect={kind:d.kind,virtualBackgroundMode:null===(o=d.options)||void 0===o?void 0:o.mode}:t.effect={kind:d.kind});var f=null===(a=this.publishedStream)||void 0===a?void 0:a.getSettings();(null==f?void 0:f.frameRate)&&(t.targetFrameRate=null==f?void 0:f.frameRate)}else"media-source"===t.type&&(t.calliopeMediaType=this.mediaType,t.trackLabel=null===(s=this.publishedStream)||void 0===s?void 0:s.label);e.set(r,t)})),e}))}updateSendParameters(e){return Bb(this,void 0,void 0,(function*(){return this.updateSendParametersQueue.push((()=>Bb(this,void 0,void 0,(function*(){var t=this.sender.getParameters();t.encodings.forEach(((t,r)=>{var n,i,o=e.get(r);if(t.active=!!o,o){var{maxPayloadBitsPerSecond:a,maxFs:s,maxWidth:c,maxHeight:u}=o,l=function(e,t,r,n,i){if(e&&t&&r){var o=Math.max(t/Ub([e,t],r),1);return n&&i&&(o=Math.max(e/n,t/i,o)),o}}(null===(n=this.publishedStream)||void 0===n?void 0:n.getSettings().width,null===(i=this.publishedStream)||void 0===i?void 0:i.getSettings().height,s,c,u);void 0!==a&&a>=0&&(t.maxBitrate=a),void 0!==l&&l>=1&&(t.scaleResolutionDownBy=l)}})),yield this.sender.setParameters(t),Lb.log("Sender parameters for ".concat(this.mediaType," set to ").concat(JSON.stringify(t)));var r=KS();e.forEach(((e,t)=>{this.requestedIdEncodingParamsMap.has(t)||this.metadata.lastRequestedUpdateTimestampsMap.set(t,r)})),this.requestedIdEncodingParamsMap.forEach(((t,n)=>{e.has(n)||this.metadata.lastRequestedUpdateTimestampsMap.set(n,r)}));var n=this.requested,i=e.size>0;this.requestedIdEncodingParamsMap=e,n!==i&&(yield this.replaceSenderSource(i?this.publishedStream:null))}))))}))}isSimulcastEnabled(){return this.sender.getParameters().encodings.length>1}mungeLocalDescription(e){this.munger.mungeLocalDescription(e,{simulcastEnabled:this.isSimulcastEnabled(),rtxEnabled:this.rtxEnabled,twccDisabled:this.twccDisabled,forceSoftwareEncoder:this.mediaType===Wy.VideoSlides&&(oS.isWindows()||oS.isMac())&&(oS.isChrome()||oS.isEdge())})}mungeLocalDescriptionForRemoteServer(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{injectDummyCandidates:!0};this.munger.mungeLocalDescriptionForRemoteServer(e,Qy(this.mediaType),this.csi,t)}mungeRemoteDescription(e){this.munger.mungeRemoteDescription(e,{dtxDisabled:this.dtxDisabled})}get senderIds(){return this.munger.getSenderIds()}get numActiveSimulcastLayers(){var e;return Yy(this.mediaType)===qy.Video?null===(e=this.publishedStream)||void 0===e?void 0:e.getNumActiveSimulcastLayers():this.publishedStream?0:void 0}getEncodingIndexForStreamId(e){return this.munger.getEncodingIndexForStreamId(e)}resetSdpMunger(){this.munger.reset()}setCodecParameters(e){this.munger.setCodecParameters(e),this.negotiationNeeded.emit(rw.LocalOnly)}deleteCodecParameters(e){this.munger.deleteCodecParameters(e),this.negotiationNeeded.emit(rw.LocalOnly)}setSourceStateOverride(e){Yy(this.mediaType)!==qy.Video&&Mb(eb.SET_SOURCE_STATE_OVERRIDE_FAILED,"Source state can only be overridden for video."),this.sourceStateOverride=e,this.sourceStateOverrideChange.emit()}get currentSourceState(){if(Yy(this.mediaType)===qy.Video)return this.sourceStateOverride?this.sourceStateOverride:this.publishedStream?this.publishedStream.muted?"avatar":"live":"no source"}}class iw{constructor(e){this.sendTransceiver=e}publishStream(e){return Bb(this,void 0,void 0,(function*(){return e===this.sendTransceiver.publishedStream?Promise.resolve():this.sendTransceiver.publishStream(e)}))}unpublishStream(){return Bb(this,void 0,void 0,(function*(){return this.sendTransceiver.publishedStream?this.sendTransceiver.unpublishStream():Promise.resolve()}))}setNamedMediaGroups(e){this.sendTransceiver.setNamedMediaGroups(e)}clearNamedMediaGroups(){this.setNamedMediaGroups([])}get active(){return this.sendTransceiver.active}set active(e){this.sendTransceiver.active=e}setCodecParameters(e){return Bb(this,void 0,void 0,(function*(){this.sendTransceiver.setCodecParameters(e)}))}deleteCodecParameters(e){return Bb(this,void 0,void 0,(function*(){this.sendTransceiver.deleteCodecParameters(e)}))}setSourceStateOverride(e){this.sendTransceiver.setSourceStateOverride(e)}clearSourceStateOverride(){this.sendTransceiver.setSourceStateOverride(void 0)}}var ow;function aw(e){return[Wy.VideoMain,Wy.VideoSlides].includes(e)?Py.Video:Py.Audio}!function(e){e.VideoSourceCountUpdate="video-source-count-update",e.AudioSourceCountUpdate="audio-source-count-update",e.ActiveSpeakerNotification="active-speaker-notification",e.PeerConnectionStateUpdate="peer-connection-state-update",e.IceConnectionStateUpdate="ice-connection-state-update",e.IceGatheringStateUpdate="ice-gathering-state-update",e.NegotiationNeeded="negotiation-needed",e.CreateOfferOnSuccess="createofferonsuccess",e.CreateAnswerOnSuccess="createansweronsuccess",e.SetLocalDescriptionOnSuccess="setlocaldescriptiononsuccess",e.SetRemoteDescriptionOnSuccess="setremotedescriptiononsuccess",e.IceCandidate="icecandidate",e.IceCandidateError="icecandidateerror"}(ow||(ow={}));var sw={disableSimulcast:oS.isFirefox(),bundlePolicy:"max-compat",iceServers:void 0,iceTransportPolicy:"all",disableContentSimulcast:!0,disableAudioTwcc:!0,doFullIce:oS.isFirefox(),stopIceGatheringAfterFirstRelayCandidate:!1,disableAudioMainDtx:!0,preferredStartingBitrateKbps:3e3,metricsCallback:()=>{}};class cw extends qS{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.sendTransceivers=new Map,this.recvTransceivers=new Map,this.jmpSessions=new Map,this.pendingJmpTasks=[],this.overuseUpdateCallback=()=>{},this.midPredictor=new WS,this.offerAnswerQueue=new tw,this.currentCreateOfferId=0,this.metadata={isMediaBypassEdge:!1},this.options=Object.assign(Object.assign({},sw),e),Lb.info("Creating multistream connection with options ".concat(JSON.stringify(this.options))),this.metricsCallback=this.options.metricsCallback,this.initializePeerConnection(),this.overuseStateManager=new zS((e=>this.overuseUpdateCallback(e))),this.overuseStateManager.start(),this.statsManager=new $S((()=>this.pc.getStats()),(e=>this.preProcessStats(e)));var t=Ky(),r=Ky(),n=this.getVideoEncodingOptions(Vy.Main),i=this.getVideoEncodingOptions(Vy.Slides);this.createSendTransceiver(Wy.VideoMain,t,n),this.createSendTransceiver(Wy.AudioMain,t),this.createSendTransceiver(Wy.VideoSlides,r,i),this.createSendTransceiver(Wy.AudioSlides,r)}initializePeerConnection(){this.pc=new Uy({iceServers:this.options.iceServers,bundlePolicy:this.options.bundlePolicy,iceTransportPolicy:this.options.iceTransportPolicy}),this.propagatePeerConnectionEvents(),this.attachMetricsObserver(),this.createDataChannel()}propagatePeerConnectionEvents(){this.pc.on(Uy.Events.PeerConnectionStateChange,(e=>{this.emit(ow.PeerConnectionStateUpdate,e)})),this.pc.on(Uy.Events.IceConnectionStateChange,(e=>{this.emit(ow.IceConnectionStateUpdate,e)})),this.pc.on(Uy.Events.CreateOfferOnSuccess,(e=>{this.emit(ow.CreateOfferOnSuccess,e)})),this.pc.on(Uy.Events.CreateAnswerOnSuccess,(e=>{this.emit(ow.CreateAnswerOnSuccess,e)})),this.pc.on(Uy.Events.SetLocalDescriptionOnSuccess,(e=>{this.emit(ow.SetLocalDescriptionOnSuccess,e)})),this.pc.on(Uy.Events.SetRemoteDescriptionOnSuccess,(e=>{this.emit(ow.SetRemoteDescriptionOnSuccess,e)})),this.pc.on(Uy.Events.IceGatheringStateChange,(()=>{this.emit(ow.IceGatheringStateUpdate,this.getIceGatheringState())})),this.pc.on(Uy.Events.IceCandidate,(e=>{this.emit(ow.IceCandidate,e)})),this.pc.on(Uy.Events.IceCandidateError,(e=>{this.emit(ow.IceCandidateError,e)}))}getConnectionState(){return this.pc.getConnectionState()}getPeerConnectionState(){return this.pc.getPeerConnectionState()}getIceConnectionState(){return this.pc.getIceConnectionState()}getCurrentConnectionType(){return this.pc.getCurrentConnectionType()}getIceGatheringState(){return this.pc.iceGatheringState}getVideoEncodingOptions(e){return(e===Vy.Main?!this.options.disableSimulcast:!this.options.disableContentSimulcast)?[{scaleResolutionDownBy:4,active:!1},{scaleResolutionDownBy:2,active:!1},{active:!1}]:[{active:!1}]}createSendTransceiver(e,t,r){var n;try{n=this.pc.addTransceiver(aw(e),{direction:"sendrecv",sendEncodings:r})}catch(e){throw Lb.error("addTransceiver failed due to : ".concat(e)),e}var i=this.midPredictor.getNextMid(e),o=$y(Yy(e),t),a=new SS,s=new nw({rtcRtpTransceiver:n,mid:i,mediaType:e,munger:a,csi:o}),c={"x-google-start-bitrate":"".concat(this.options.preferredStartingBitrateKbps)};Yy(e)===qy.Video&&(s.rtxEnabled=!0,c=Object.assign(Object.assign({},c),{"max-mbps":"".concat(244800),"max-fs":"".concat(8160)})),s.setCodecParameters(c),s.twccDisabled=Yy(e)===qy.Audio&&this.options.disableAudioTwcc,s.dtxDisabled=e!==Wy.AudioMain||this.options.disableAudioMainDtx,s.active=!1,s.streamMuteStateChange.on((()=>{this.sendSourceAdvertisement(e),this.sendMediaRequestStatus(e)})),s.streamPublishStateChange.on((()=>{this.sendSourceAdvertisement(e),this.sendMediaRequestStatus(e)})),s.streamReadyStateChanged.on((()=>{this.sendSourceAdvertisement(e),this.sendMediaRequestStatus(e)})),s.negotiationNeeded.on((e=>{e===rw.Remote?this.emit(ow.NegotiationNeeded):this.pc.getRemoteDescription()&&this.queueLocalOfferAnswer()})),s.namedMediaGroupsChange.on((()=>{this.sendSourceAdvertisement(e)})),s.sourceStateOverrideChange.on((()=>{this.sendMediaRequestStatus(e)})),this.sendTransceivers.set(e,s),this.createJmpSession(e)}createSendSlot(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.getSendTransceiverOrThrow(e);return r.active=t,new iw(r)}createJmpSession(e){var t=new Tb(Yy(e),Qy(e));t.setTxCallback((e=>{var t;if("open"===(null===(t=this.dataChannel)||void 0===t?void 0:t.readyState)){var r=new GS(kS.Multistream,e),n=JSON.stringify(r);try{Lb.info("Sending JMP message: ".concat(n)),this.dataChannel.send(n)}catch(e){var{bufferedAmount:i,readyState:o}=this.dataChannel,{sctp:a}=this.pc.getUnderlyingRTCPeerConnection(),{maxMessageSize:s,state:c}=a||{};Mb(eb.DATA_CHANNEL_SEND_FAILED,"Sending JMP message failed with error: ".concat(e,",\nMessage size: ").concat(n.length,",\nData Channel State: ").concat(o,",\nData Channel Buffered amount: ").concat(i,",\nSCTP State: ").concat(c,",\nSCTP Max Message Size: ").concat(s))}}else Lb.error("DataChannel not created or not connected. Unable to send JMP message.")}));var r=0,n=0;t.on(Zy.SourceAdvertisementReceived,(t=>{if(Lb.log("SourceAdvertisement received: ".concat(JSON.stringify(t))),t.numTotalSources!==r||t.numLiveSources!==n){r=t.numTotalSources,n=t.numLiveSources;var i=Yy(e)===qy.Video?ow.VideoSourceCountUpdate:ow.AudioSourceCountUpdate;this.emit(i,t.numTotalSources,t.numLiveSources,Qy(e))}else Lb.log("Number of sources was unchanged, ignoring message")})),t.on(Zy.MediaRequestStatusReceived,(e=>{Lb.log("MediaRequestStatus received: ".concat(JSON.stringify(e))),e.streamStates.forEach((e=>{if(hb(e.id)){var t=this.getReceiveSlotById(e.id);t?t._isRequested?t._updateSource(e.state,e.csi):Lb.info("MediaRequestStatus ignored due to transceiver's receive slot unrequested: ".concat(JSON.stringify(e.id)," csi ").concat(e.csi)):Lb.warn("Got MediaRequestStatus for unknown receive slot: ".concat(JSON.stringify(e.id)))}else Lb.error("Received MediaRequestStatus with non-SSRC based stream ID, which is currently not supported: ".concat(JSON.stringify(e.id)))}))})),t.on(Zy.MediaRequestReceived,(t=>{Lb.log("MediaRequest received: ".concat(JSON.stringify(t))),this.updateRequestedStreams(e,t.requests).then((()=>{Yy(e)===qy.Video&&this.sendMediaRequestStatus(e)}))})),t.on(Zy.ActiveSpeaker,(e=>{this.emit(ow.ActiveSpeakerNotification,e.csis),this.recvTransceivers.forEach((t=>{t.forEach((t=>{var{currentRxCsi:r}=t.receiveSlot;if(void 0!==r){var n=e.csis.some((e=>(4294967294&e)==(4294967294&r)));t.handleActiveSpeakerUpdate(n)}}))}))})),this.jmpSessions.set(e,t)}updateRequestedStreams(e,t){var r=this.getSendTransceiverOrThrow(e),n=Yy(e),i=new Map,o=t.filter((e=>bb(e.policySpecificInfo)));return o.length!==t.length&&Lb.warn("Ignoring non-receiver-selected requests"),o.forEach((t=>{var o,a,s,{ids:c,policySpecificInfo:u,codecInfos:l,maxPayloadBitsPerSecond:d}=t;if(c.length>1&&Mb(eb.INVALID_STREAM_REQUEST,"Stream request cannot have more than one ID."),0!==c.length)if(r.csi===u.csi){var f=c[0],h=l[0];if(hb(f))if(r.senderIds.some((e=>pb(f,e)))){var p=r.getEncodingIndexForStreamId(f);if(-1!==p){var v={maxPayloadBitsPerSecond:d};n===qy.Video&&(v.maxFs=null===(o=null==h?void 0:h.h264)||void 0===o?void 0:o.maxFs,v.maxWidth=null===(a=null==h?void 0:h.h264)||void 0===a?void 0:a.maxWidth,v.maxHeight=null===(s=null==h?void 0:h.h264)||void 0===s?void 0:s.maxHeight),i.set(p,v)}else Lb.warn("".concat(e,": Unable to get encoding index for stream ID: ").concat(JSON.stringify(f)))}else Lb.warn("".concat(e,": Unable to find matching stream ID for requested ID: ").concat(JSON.stringify(f)));else Lb.warn("".concat(e,": The stream ID is not a valid SsrcStreamId: ").concat(JSON.stringify(f)))}else Lb.warn("csi in the StreamRequest does not match")})),r.updateSendParameters(i)}createDataChannel(){var e=this.pc.createDataChannel("datachannel",{ordered:!1,maxRetransmits:0});e.onopen=e=>{Lb.info("DataChannel opened:",JSON.stringify(e)),[...this.sendTransceivers.keys()].forEach((e=>{this.sendSourceAdvertisement(e)})),Lb.info("Flushing pending JMP task queue"),this.pendingJmpTasks.forEach((e=>e())),this.pendingJmpTasks=[]},e.onmessage=e=>{var t;try{t=JSON.parse(e.data)}catch(e){return void Lb.error("Error parsing datachannel JSON: ".concat(e))}Lb.debug("DataChannel got msg:",e.data);var r=GS.fromJson(t);if(r){var n=r.payload;if(ub(n)){var i=Jy(n.mediaFamily,n.mediaContent),o=this.jmpSessions.get(i);o?o.receive(n):Lb.error("Unable to find JMP session for media type ".concat(i,"."))}else Lb.error("Received invalid JMP msg: ".concat(JSON.stringify(n)))}else Lb.error("Received invalid datachannel message: ".concat(e))},e.onclose=e=>{Lb.info("DataChannel closed:",JSON.stringify(e))},e.onerror=e=>{Lb.info("DataChannel error:",JSON.stringify(e))},this.dataChannel=e}close(){this.sendTransceivers.forEach((e=>e.close())),this.recvTransceivers.forEach((e=>{e.forEach((e=>e.close()))})),this.jmpSessions.forEach((e=>e.close())),this.pc.close()}sendMediaRequestStatus(e){var t;if(Yy(e)===qy.Video&&this.getSendTransceiverOrThrow(e).requested){var r=this.getVideoStreamStates(Qy(e)),n=()=>{var t;null===(t=this.jmpSessions.get(e))||void 0===t||t.sendMediaRequestStatus(r)};"open"===(null===(t=this.dataChannel)||void 0===t?void 0:t.readyState)?n():this.pendingJmpTasks.push(n)}}sendSourceAdvertisement(e){var t,r,n,i,o=this.getSendTransceiverOrThrow(e),a=!1===(null===(t=o.publishedStream)||void 0===t?void 0:t.muted)&&"live"===(null===(r=o.publishedStream)||void 0===r?void 0:r.readyState)?1:0;if(Yy(e)===qy.Video){var s;if(null===this.getVideoStreamStates(Qy(e)))return;o.publishedStream&&e===Wy.VideoSlides&&(s=o.publishedStream.contentHint),i=()=>{var t,r;null===(t=this.jmpSessions.get(e))||void 0===t||t.sendSourceAdvertisement(1,a,[],"motion"===(r=s)?"motion":"detail"===r?"sharpness":void 0)}}else i=()=>{var t;return null===(t=this.jmpSessions.get(e))||void 0===t?void 0:t.sendSourceAdvertisement(1,a,e===Wy.AudioMain?o.namedMediaGroups:[])};"open"===(null===(n=this.dataChannel)||void 0===n?void 0:n.readyState)?i():this.pendingJmpTasks.push(i)}getVideoStreamStates(e){var t=this.getSendTransceiverOrThrow(Jy(qy.Video,e));return t.senderIds.map((e=>({id:e,state:t.currentSourceState,csi:t.csi})))}createReceiveTransceiver(e){var t=this.pc.addTransceiver(aw(e),{direction:"recvonly"}),r=this.midPredictor.getNextMid(e),n=new VS,i=new YS({rtcRtpTransceiver:t,mid:r,mediaType:e,munger:n});return Yy(e)===qy.Video&&(i.setCodecParameters({"sps-pps-idr-in-keyframe":"1"}),i.setRtxCodecParameters({"rtx-time":e===Wy.VideoMain?"300":"1000"})),i.twccDisabled=Yy(e)===qy.Audio&&this.options.disableAudioTwcc,this.recvTransceivers.set(e,[...this.recvTransceivers.get(e)||[],i]),i}createReceiveSlot(e){return Bb(this,void 0,void 0,(function*(){return(yield this.createReceiveSlots(e,1))[0]}))}createReceiveSlots(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Bb(this,void 0,void 0,(function*(){return new Promise((r=>{this.offerAnswerQueue.push((()=>Bb(this,void 0,void 0,(function*(){for(var n=[],i=0;i<t;i++){var o=this.createReceiveTransceiver(e);n.push(o)}this.pc.getRemoteDescription()&&(yield this.doLocalOfferAnswer());var a=n.map((e=>e.receiveSlot));r(a)}))))}))}))}getIngressPayloadType(e,t){var r,n,i,o=t.split("/")[1],a=null===(r=this.sendTransceivers.get(e))||void 0===r?void 0:r.mid,s=KE(null===(n=this.pc.getLocalDescription())||void 0===n?void 0:n.sdp),c=KE(null===(i=this.pc.getRemoteDescription())||void 0===i?void 0:i.sdp).avMedia.filter((e=>a===e.mid)).map((e=>[...e.codecs.values()])).flat().filter((e=>e.name===o)),u=s.avMedia.filter((e=>a===e.mid)).map((e=>[...e.codecs.values()])).flat().filter((e=>e.name===o));c&&u&&0!==c.length&&0!==u.length||Mb(eb.GET_PAYLOAD_TYPE_FAILED,"Sender codecs or receiver codecs is undefined or empty.");var l=c[0],d=u.find((e=>Db(l,e)));return d&&d.pt||Mb(eb.GET_PAYLOAD_TYPE_FAILED,"Cannot find matching receiver codec for the given mediaType/mimeType."),d.pt}waitForIceGatheringComplete(){return Bb(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{var r=()=>this.pc.getIceCandidates().length>0?e():t(new Error("No ICE candidates gathered."));"complete"===this.pc.iceGatheringState?r():(this.pc.on(Uy.Events.IceCandidate,(e=>{(null===e.candidate||this.options.stopIceGatheringAfterFirstRelayCandidate&&"relay"===e.candidate.type)&&r()})),this.pc.on(Uy.Events.IceGatheringStateChange,(()=>{"complete"===this.pc.iceGatheringState&&r()})))}))}))}createOffer(){return Bb(this,void 0,void 0,(function*(){this.pc.getLocalDescription()||this.midPredictor.allocateMidForDatachannel(),this.setAnswerResolve&&(Lb.info("Canceling previous offer since setAnswer was never called for it"),this.setAnswerResolve(),this.setAnswerResolve=void 0);var e=++this.currentCreateOfferId;return new Promise(((t,r)=>{this.offerAnswerQueue.push((()=>Bb(this,void 0,void 0,(function*(){var n;try{var i=yield this.pc.createOffer();if(i.sdp||Mb(eb.CREATE_OFFER_FAILED,"SDP not found in offer."),i.sdp=this.preProcessLocalOffer(i.sdp),yield this.pc.setLocalDescription(i).then((()=>Bb(this,void 0,void 0,(function*(){Lb.info("this.pc.setLocalDescription() resolved")})))).catch((e=>{var t;Mb(eb.CREATE_OFFER_FAILED,"Error: ".concat(e,". SDP: ").concat(gS(null!==(t=i.sdp)&&void 0!==t?t:"")))})),this.options.doFullIce)try{yield this.waitForIceGatheringComplete()}catch(e){Mb(eb.CREATE_OFFER_FAILED,"".concat(e))}var o=this.prepareLocalOfferForRemoteServer(null===(n=this.pc.getLocalDescription())||void 0===n?void 0:n.sdp);t({type:"offer",sdp:o}),this.currentCreateOfferId>e?Lb.log("Canceling previous offer since createOffer was called while it was being created"):yield new Promise((e=>{this.setAnswerResolve=e}))}catch(e){r(e)}}))))}))}))}setAnswer(e){return Bb(this,void 0,void 0,(function*(){var t=this.preProcessRemoteAnswer(e);return this.setAnswerResolve||Mb(eb.SET_ANSWER_FAILED,"Call to setAnswer without having previously called createOffer."),Lb.info("calling this.pc.setRemoteDescription()"),this.pc.setRemoteDescription({type:"answer",sdp:t}).then((()=>Bb(this,void 0,void 0,(function*(){Lb.info("this.pc.setRemoteDescription() resolved"),this.setAnswerResolve?(this.setAnswerResolve(),this.setAnswerResolve=void 0):Lb.debug("setAnswerResolve function was cleared between setAnswer and result of setRemoteDescription")})))).catch((t=>{Mb(eb.SET_ANSWER_FAILED,"Error: ".concat(t,". SDP: ").concat(gS(e)))}))}))}doLocalOfferAnswer(){var e;return Bb(this,void 0,void 0,(function*(){var t=yield this.pc.createOffer();t.sdp||Mb(eb.CREATE_OFFER_FAILED,"SDP not found in offer."),t.sdp=this.preProcessLocalOffer(t.sdp),yield this.pc.setLocalDescription(t).then((()=>Bb(this,void 0,void 0,(function*(){Lb.info("this.pc.setLocalDescription() resolved")})))).catch((e=>{var r;Mb(eb.CREATE_OFFER_FAILED,"Error: ".concat(e,". SDP: ").concat(gS(null!==(r=t.sdp)&&void 0!==r?r:"")))}));var r=this.preProcessRemoteAnswer(null===(e=this.pc.getRemoteDescription())||void 0===e?void 0:e.sdp);return this.pc.setRemoteDescription({type:"answer",sdp:r}).then((()=>Bb(this,void 0,void 0,(function*(){Lb.info("this.pc.setRemoteDescription() resolved")})))).catch((e=>{Mb(eb.CREATE_OFFER_FAILED,"Error: ".concat(e,". SDP: ").concat(gS(r)))}))}))}queueLocalOfferAnswer(){return Bb(this,void 0,void 0,(function*(){return this.offerAnswerQueue.push((()=>Bb(this,void 0,void 0,(function*(){yield this.doLocalOfferAnswer()}))))}))}preProcessLocalOffer(e){var t=KE(e);return t.avMedia.filter((e=>"recvonly"===e.direction)).forEach((e=>{this.getRecvTransceiverByMidOrThrow(e.mid).mungeLocalDescription(e)})),t.avMedia.filter((e=>"sendrecv"===e.direction||"inactive"===e.direction)).forEach((e=>{this.getSendTransceiverByMidOrThrow(e.mid).mungeLocalDescription(e)})),oS.isFirefox()&&vS(t,this.options.bundlePolicy,this.midPredictor.getMidMap()),t.toString()}prepareLocalOfferForRemoteServer(e){var t,r,n=KE(e),i={injectDummyCandidates:(()=>!this.options.doFullIce||!function(e){return e.media.some((e=>e.iceInfo.candidates.length))}(n))()};if(n.avMedia.filter((e=>"sendrecv"===e.direction||"inactive"===e.direction)).forEach((e=>{this.getSendTransceiverByMidOrThrow(e.mid).mungeLocalDescriptionForRemoteServer(e,i)})),i.injectDummyCandidates&&n.media.filter((e=>e instanceof jE)).forEach((e=>{mS(e)})),oS.isFirefox()&&this.options.doFullIce){var o=this.pc.getIceCandidates();n.media.forEach((e=>{e.iceInfo.candidates=[],o.forEach((t=>{var r=sE.fromSdpLine(t.candidate.toString());r&&e.addLine(r)}))}))}return oS.isFirefox()&&(vS(n,this.options.bundlePolicy,this.midPredictor.getMidMap()),"max-bundle"===this.options.bundlePolicy&&n.media.forEach(((e,t)=>{t>0&&(e.port=n.media[0].port)}))),r=[],(t=n).media=t.media.filter((e=>(e instanceof jE||e instanceof qE&&"recvonly"!==e.direction)&&(r.push(e.mid),!0))),t.session.groups.forEach((e=>{e.mids=e.mids.filter((e=>r.includes(e)))})),n.toString()}preProcessRemoteAnswer(e){var t,r,n=KE(e);return pS(KE(null===(t=this.pc.getLocalDescription())||void 0===t?void 0:t.sdp),n),n.avMedia.filter((e=>"sendonly"===e.direction)).forEach((e=>{this.getRecvTransceiverByMidOrThrow(e.mid).mungeRemoteDescription(e)})),n.avMedia.filter((e=>"sendrecv"===e.direction||"recvonly"===e.direction)).forEach((e=>{this.getSendTransceiverByMidOrThrow(e.mid).mungeRemoteDescription(e)})),n.media.filter((e=>e instanceof jE)).forEach((e=>{QE(e,["udp","tcp"])&&Lb.log("Some unsupported remote candidates have been removed from mid ".concat(e.mid))})),oS.isFirefox()&&vS(n,this.options.bundlePolicy,this.midPredictor.getMidMap()),(null===(r=n.session.information)||void 0===r?void 0:r.info)&&(this.metadata.isMediaBypassEdge=!n.session.information.info.includes("linus")),n.toString()}getSendTransceiverOrThrow(e){var t=this.sendTransceivers.get(e);return t||Mb(eb.GET_TRANSCEIVER_FAILED,"Unable to find send transceiver for media type ".concat(e,".")),t}getSendTransceiverByMidOrThrow(e){var t=[...this.sendTransceivers.values()].find((t=>t.mid===e));return t||Mb(eb.GET_TRANSCEIVER_FAILED,"Unable to find send transceiver with MID ".concat(e,".")),t}getRecvTransceiverByMidOrThrow(e){var t=[...this.recvTransceivers.values()].flat().find((t=>t.mid===e));return t||Mb(eb.GET_TRANSCEIVER_FAILED,"Unable to find recv transceiver with MID ".concat(e,".")),t}requestMedia(e,t){var r,n=()=>{var r,n=this.jmpSessions.get(e);if(n){var i=[];t.forEach((e=>{0!==e.receiveSlots.length?e.receiveSlots.forEach((e=>{e.id||Lb.error("Running stream request task, but ReceiveSlot ID is missing."),i.some((t=>pb(t,e.id)))?Lb.error("Stream id duplicate found ".concat(JSON.stringify(e.id),".")):i.push(e.id)})):Lb.error("Stream request ids cannot be empty.")})),n.sendRequests(t.map((e=>e._toJmpStreamRequest()))),null===(r=this.recvTransceivers.get(e))||void 0===r||r.forEach((e=>{if(i.some((t=>pb(t,e.receiveSlot.id)))){var r=t.find((t=>t.receiveSlots.some((t=>pb(t.id,e.receiveSlot.id)))));e.handleRequested(r)}else e.handleUnrequested()}))}else Lb.error("Unable to find jmp session for ".concat(e))};"open"===(null===(r=this.dataChannel)||void 0===r?void 0:r.readyState)?n():this.pendingJmpTasks.push(n)}renewPeerConnection(e){var t;return Bb(this,void 0,void 0,(function*(){null===(t=this.pc)||void 0===t||t.close();try{e&&(this.options=Object.assign(Object.assign({},this.options),yield e))}catch(e){Mb(eb.RENEW_PEER_CONNECTION_FAILED,"Error while awaiting user options: ".concat(e))}Lb.info("Renewing multistream connection with options ".concat(JSON.stringify(this.options))),this.midPredictor.reset(),this.initializePeerConnection();var r=Ky(),n=Ky();this.sendTransceivers.forEach(((e,t)=>{var i,o=Qy(t),a=o===Vy.Main?r:n,s=this.midPredictor.getNextMid(t);e.replaceTransceiver(this.pc.addTransceiver(aw(t),{direction:"sendrecv",sendEncodings:Yy(t)===qy.Video?this.getVideoEncodingOptions(o):void 0})),e.mid=s,e.csi=$y(Yy(t),a),e.resetSdpMunger(),null===(i=this.jmpSessions.get(t))||void 0===i||i.close(),this.createJmpSession(t)})),this.recvTransceivers.forEach(((e,t)=>{e.forEach((e=>{var r=this.midPredictor.getNextMid(t);e.replaceTransceiver(this.pc.addTransceiver(aw(t),{direction:"recvonly"})),e.mid=r}))}))}))}getReceiveSlotById(e){return[...this.recvTransceivers.values()].flat().map((e=>e.receiveSlot)).find((t=>{var r=t.id||{};return Object.keys(r).length===Object.keys(e).length&&Object.keys(r).every((t=>Object.prototype.hasOwnProperty.call(e,t)&&r[t]===e[t]))}))}getStats(){return this.statsManager.getStats()}getTransceiverStats(){return Bb(this,void 0,void 0,(function*(){var e=[...(yield this.getStats()).values()].find((e=>"peer-connection"===e.type));return((e,t,r)=>Bb(void 0,void 0,void 0,(function*(){var n={audio:{senders:[],receivers:[]},video:{senders:[],receivers:[]},screenShareAudio:{senders:[],receivers:[]},screenShareVideo:{senders:[],receivers:[]}};return yield Promise.all([...e.entries()].map((e=>{var[t,i]=e;return Bb(void 0,void 0,void 0,(function*(){var e,o={report:yield i.getStats(),mid:i.mid,csi:i.csi,currentDirection:"sendonly",localTrackLabel:null===(e=i.publishedStream)||void 0===e?void 0:e.label};r&&r.id&&o.report.set(r.id,r),t===Wy.AudioMain&&n.audio.senders.push(o),t===Wy.VideoMain&&n.video.senders.push(o),t===Wy.AudioSlides&&n.screenShareAudio.senders.push(o),t===Wy.VideoSlides&&n.screenShareVideo.senders.push(o)}))}))),yield Promise.all([...t.entries()].map((e=>{var[t,i]=e;return Bb(void 0,void 0,void 0,(function*(){return Promise.all(i.map((e=>Bb(void 0,void 0,void 0,(function*(){var i,o={report:yield e.getStats(),csi:e.receiveSlot.currentRxCsi,currentDirection:"recvonly",localTrackLabel:null===(i=e.receiveSlot.stream.getTracks()[0])||void 0===i?void 0:i.label};r&&r.id&&o.report.set(r.id,r),t===Wy.AudioMain&&n.audio.receivers.push(o),t===Wy.VideoMain&&n.video.receivers.push(o),t===Wy.AudioSlides&&n.screenShareAudio.receivers.push(o),t===Wy.VideoSlides&&n.screenShareVideo.receivers.push(o)})))))}))}))),n})))(this.sendTransceivers,this.recvTransceivers,e)}))}preProcessStats(e){return Bb(this,void 0,void 0,(function*(){e.forEach((e=>{"peer-connection"===e.type&&(e.isMediaBypassEdge=this.metadata.isMediaBypassEdge)})),yield Promise.all([...this.sendTransceivers.values()].map((t=>Bb(this,void 0,void 0,(function*(){(yield t.getStats()).forEach((t=>{"outbound-rtp"!==t.type&&"media-source"!==t.type||e.set(t.id,t)}))}))))),yield Promise.all([...this.recvTransceivers.values()].map((t=>Bb(this,void 0,void 0,(function*(){yield Promise.all(t.map((t=>Bb(this,void 0,void 0,(function*(){(yield t.getStats()).forEach((t=>{"inbound-rtp"===t.type&&e.set(t.id,t)}))})))))})))))}))}attachMetricsObserver(){this.forceStatsReport=Zb(this.pc.getUnderlyingRTCPeerConnection(),(e=>this.metricsCallback(e)),5e3,(e=>this.preProcessStats(e))).forceStatsReport}forceRtcMetricsCallback(){var e;return null===(e=this.forceStatsReport)||void 0===e?void 0:e.call(this)}setOveruseUpdateCallback(e){this.overuseUpdateCallback=e}getCsiByMediaType(e){var t;return null===(t=this.sendTransceivers.get(e))||void 0===t?void 0:t.csi}getAllCsis(){return{audioMain:this.getCsiByMediaType(Wy.AudioMain),audioSlides:this.getCsiByMediaType(Wy.AudioSlides),videoMain:this.getCsiByMediaType(Wy.VideoMain),videoSlides:this.getCsiByMediaType(Wy.VideoSlides)}}}class uw{constructor(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];this.policy=e,this.policySpecificInfo=t,this.receiveSlots=r,this.maxPayloadBitsPerSecond=n,this.codecInfos=i}_toJmpStreamRequest(){return new wb(this.policy,this.policySpecificInfo,this.receiveSlots.map((e=>e.id)),this.maxPayloadBitsPerSecond,this.codecInfos)}}var lw,dw,fw,hw,pw,vw,mw={info:function(){return console.info(...arguments)},log:function(){return console.log(...arguments)},error:function(){return console.error(...arguments)},warn:function(){return console.warn(...arguments)},trace:function(){return console.trace(...arguments)},debug:function(){return console.debug(...arguments)}},gw=mw,yw=()=>gw,bw=e=>{var t,r=yw();t=(t,n)=>{var i=Array.from(t).map((e=>"object"==typeof e?JSON.stringify(e):e));switch(i.unshift("".concat(e||"",":[").concat(n.name,"]")),n.level.name){case"TRACE":r.trace(...i);break;case"DEBUG":r.debug(...i);break;case"INFO":r.info(...i);break;case"WARN":r.warn(...i);break;case"ERROR":r.error(...i)}},Ob.setHandler(t),zy.setHandler(t),zv.setHandler(t)},Ew=e=>{gw=e||mw,bw()},Sw=e=>e?e.stack?"".concat(e.message,": ").concat(e.stack):"".concat(e):"",_w="\\d+",ww="[!#$%&'*+\\-.^_`{|}~a-zA-Z0-9]+",Rw="\\S+",Cw=".+";class Tw{}class xw extends Tw{constructor(e,t){super(),this.bandwidthType=e,this.bandwidth=t}static fromSdpLine(e){if(xw.regex.test(e)){var t=e.match(xw.regex),r=t[1],n=parseInt(t[2],10);return new xw(r,n)}}toSdpLine(){return"b=".concat(this.bandwidthType,":").concat(this.bandwidth)}}lw=xw,xw.BW_TYPE_REGEX="CT|AS|TIAS",xw.regex=new RegExp("^(".concat(lw.BW_TYPE_REGEX,"):(").concat(_w,")"));class kw extends Tw{constructor(e){super(),this.mids=e}static fromSdpLine(e){if(kw.regex.test(e)){var t=e.match(kw.regex)[1].split(" ");return new kw(t)}}toSdpLine(){return"a=group:BUNDLE ".concat(this.mids.join(" "))}}kw.regex=new RegExp("^group:BUNDLE (".concat(Cw,")"));class Iw extends Tw{constructor(e,t,r,n,i,o,a,s,c,u){super(),this.foundation=e,this.componentId=t,this.transport=r,this.priority=n,this.connectionAddress=i,this.port=o,this.candidateType=a,this.relAddr=s,this.relPort=c,this.candidateExtensions=u}static fromSdpLine(e){if(Iw.regex.test(e)){var t=e.match(Iw.regex),r=t[1],n=parseInt(t[2],10),i=t[3],o=parseInt(t[4],10),a=t[5],s=parseInt(t[6],10),c=t[7],u=t[8],l=t[9]?parseInt(t[9],10):void 0,d=t[10];return new Iw(r,n,i,o,a,s,c,u,l,d)}}toSdpLine(){var e="";return e+="a=candidate:".concat(this.foundation," ").concat(this.componentId," ").concat(this.transport," ").concat(this.priority," ").concat(this.connectionAddress," ").concat(this.port," typ ").concat(this.candidateType),this.relAddr&&(e+=" raddr ".concat(this.relAddr)),this.relPort&&(e+=" rport ".concat(this.relPort)),this.candidateExtensions&&(e+=" ".concat(this.candidateExtensions)),e}}dw=Iw,Iw.ICE_CHARS="[a-zA-Z0-9+/]+",Iw.regex=new RegExp("^candidate:(".concat(dw.ICE_CHARS,") (").concat(_w,") (").concat(Rw,") (").concat(_w,") (").concat(Rw,") (").concat(_w,") typ (").concat(Rw,")(?: raddr (").concat(Rw,"))?(?: rport (").concat(_w,"))?(?: (").concat(Cw,"))?"));class Aw extends Tw{constructor(e,t,r){super(),this.netType=e,this.addrType=t,this.ipAddr=r}static fromSdpLine(e){if(Aw.regex.test(e)){var t=e.match(Aw.regex),r=t[1],n=t[2],i=t[3];return new Aw(r,n,i)}}toSdpLine(){return"c=".concat(this.netType," ").concat(this.addrType," ").concat(this.ipAddr)}}Aw.regex=new RegExp("^(".concat(Rw,") (").concat(Rw,") (").concat(Rw,")"));class Ow extends Tw{constructor(e){super(),this.values=e}static fromSdpLine(e){if(Ow.regex.test(e)){var t=e.match(Ow.regex)[1].split(",");return new Ow(t)}}toSdpLine(){return"a=content:".concat(this.values.join(","))}}Ow.regex=new RegExp("^content:(".concat(Cw,")$"));class Lw extends Tw{constructor(e){super(),this.direction=e}static fromSdpLine(e){if(Lw.regex.test(e)){var t=e.match(Lw.regex)[1];return new Lw(t)}}toSdpLine(){return"a=".concat(this.direction)}}Lw.regex=/^(sendrecv|sendonly|recvonly|inactive)$/;class Mw extends Tw{constructor(e,t,r,n){super(),this.id=e,this.uri=t,this.direction=r,this.extensionAttributes=n}static fromSdpLine(e){if(Mw.regex.test(e)){var t=e.match(Mw.regex),r=parseInt(t[1],10),n=t[2],i=t[3],o=t[4];return new Mw(r,i,n,o)}}toSdpLine(){var e="";return e+="a=extmap:".concat(this.id),this.direction&&(e+="/".concat(this.direction)),e+=" ".concat(this.uri),this.extensionAttributes&&(e+=" ".concat(this.extensionAttributes)),e}}fw=Mw,Mw.EXTMAP_DIRECTION="sendonly|recvonly|sendrecv|inactive",Mw.regex=new RegExp("^extmap:(".concat(_w,")(?:/(").concat(fw.EXTMAP_DIRECTION,"))? (").concat(Rw,")(?: (").concat(Cw,"))?"));class Nw extends Tw{constructor(e){super(),this.fingerprint=e}static fromSdpLine(e){if(Nw.regex.test(e)){var t=e.match(Nw.regex)[1];return new Nw(t)}}toSdpLine(){return"a=fingerprint:".concat(this.fingerprint)}}Nw.regex=new RegExp("^fingerprint:(".concat(Cw,")"));class Pw extends Tw{constructor(e,t){super(),this.payloadType=e,this.params=t}static fromSdpLine(e){if(Pw.regex.test(e)){var t=e.match(Pw.regex),r=parseInt(t[1],10),n=t[2];return new Pw(r,function(e){e=e.replace(/^a=fmtp:\d+\x20/,"");var t=new Map;return/^\d+([,/-]\d+)+$/.test(e)?(t.set(e,void 0),t):((e=e.replace(/;$/,"")).split(";").forEach((r=>{var n=r&&r.split("=");if(2!==n.length||!n[0]||!n[1])throw new Error("Fmtp params is invalid with ".concat(e));t.set(n[0],n[1])})),t)}(n))}}toSdpLine(){var e=Array.from(this.params.keys()).map((e=>void 0!==this.params.get(e)?"".concat(e,"=").concat(this.params.get(e)):"".concat(e))).join(";");return"a=fmtp:".concat(this.payloadType," ").concat(e)}}Pw.regex=new RegExp("^fmtp:(".concat(_w,") (").concat(Cw,")"));class Dw extends Tw{constructor(e){super(),this.options=e}static fromSdpLine(e){if(Dw.regex.test(e)){var t=e.match(Dw.regex)[1].split(" ");return new Dw(t)}}toSdpLine(){return"a=ice-options:".concat(this.options.join(" "))}}Dw.regex=new RegExp("^ice-options:(".concat(Cw,")$"));class Fw extends Tw{constructor(e){super(),this.pwd=e}static fromSdpLine(e){if(Fw.regex.test(e)){var t=e.match(Fw.regex)[1];return new Fw(t)}}toSdpLine(){return"a=ice-pwd:".concat(this.pwd)}}Fw.regex=new RegExp("^ice-pwd:(".concat(Rw,")$"));class Uw extends Tw{constructor(e){super(),this.ufrag=e}static fromSdpLine(e){if(Uw.regex.test(e)){var t=e.match(Uw.regex)[1];return new Uw(t)}}toSdpLine(){return"a=ice-ufrag:".concat(this.ufrag)}}Uw.regex=new RegExp("^ice-ufrag:(".concat(Rw,")$"));class jw extends Tw{constructor(e){super(),this.maxMessageSize=e}static fromSdpLine(e){if(jw.regex.test(e)){var t=e.match(jw.regex),r=parseInt(t[1],10);return new jw(r)}}toSdpLine(){return"a=max-message-size:".concat(this.maxMessageSize)}}jw.regex=new RegExp("^max-message-size:(".concat(_w,")"));class Bw extends Tw{constructor(e,t,r,n){super(),this.type=e,this.port=t,this.protocol=r,this.formats=n}static fromSdpLine(e){if(Bw.regex.test(e)){var t=e.match(Bw.regex),r=t[1],n=parseInt(t[2],10),i=t[3],o=t[4].split(" ");return new Bw(r,n,i,o)}}toSdpLine(){return"m=".concat(this.type," ").concat(this.port," ").concat(this.protocol," ").concat(this.formats.join(" "))}}hw=Bw,Bw.MEDIA_TYPE="audio|video|application",Bw.regex=new RegExp("^(".concat(hw.MEDIA_TYPE,") (").concat(_w,") (").concat(Rw,") (").concat(Cw,")"));class qw extends Tw{constructor(e){super(),this.mid=e}static fromSdpLine(e){if(qw.regex.test(e)){var t=e.match(qw.regex)[1];return new qw(t)}}toSdpLine(){return"a=mid:".concat(this.mid)}}qw.regex=new RegExp("^mid:(".concat(Rw,")$"));class Vw extends Tw{constructor(e,t,r,n,i,o){super(),this.username=e,this.sessionId=t,this.sessionVersion=r,this.netType=n,this.addrType=i,this.ipAddr=o}static fromSdpLine(e){if(Vw.regex.test(e)){var t=e.match(Vw.regex),r=t[1],n=t[2],i=parseInt(t[3],10),o=t[4],a=t[5],s=t[6];return new Vw(r,n,i,o,a,s)}}toSdpLine(){return"o=".concat(this.username," ").concat(this.sessionId," ").concat(this.sessionVersion," ").concat(this.netType," ").concat(this.addrType," ").concat(this.ipAddr)}}Vw.regex=new RegExp("^(".concat(Rw,") (").concat(Rw,") (").concat(_w,") (").concat(Rw,") (").concat(Rw,") (").concat(Rw,")"));class Gw extends Tw{constructor(e,t,r){super(),this.id=e,this.direction=t,this.params=r}static fromSdpLine(e){if(Gw.regex.test(e)){var t=e.match(Gw.regex),r=t[1],n=t[2],i=t[3];return new Gw(r,n,i)}}toSdpLine(){var e="";return e+="a=rid:".concat(this.id," ").concat(this.direction),this.params&&(e+=" ".concat(this.params)),e}}pw=Gw,Gw.RID_ID="[\\w-]+",Gw.RID_DIRECTION="\\bsend\\b|\\brecv\\b",Gw.regex=new RegExp("^rid:(".concat(pw.RID_ID,") (").concat(pw.RID_DIRECTION,")(?:").concat("\\s","(").concat(Cw,"))?"));class Ww extends Tw{static fromSdpLine(e){if(Ww.regex.test(e))return new Ww}toSdpLine(){return"a=rtcp-mux"}}Ww.regex=/^rtcp-mux$/;class zw extends Tw{constructor(e,t){super(),this.payloadType=e,this.feedback=t}static fromSdpLine(e){if(zw.regex.test(e)){var t=e.match(zw.regex),r=parseInt(t[1],10),n=t[2];return new zw(r,n)}}toSdpLine(){return"a=rtcp-fb:".concat(this.payloadType," ").concat(this.feedback)}}zw.regex=new RegExp("^rtcp-fb:(".concat(_w,") (").concat(Cw,")"));class Hw extends Tw{constructor(e,t,r,n){super(),this.payloadType=e,this.encodingName=t,this.clockRate=r,this.encodingParams=n}static fromSdpLine(e){if(Hw.regex.test(e)){var t=e.match(Hw.regex),r=parseInt(t[1],10),n=t[2],i=parseInt(t[3],10),o=t[4];return new Hw(r,n,i,o)}}toSdpLine(){var e="";return e+="a=rtpmap:".concat(this.payloadType," ").concat(this.encodingName,"/").concat(this.clockRate),this.encodingParams&&(e+="/".concat(this.encodingParams)),e}}vw=Hw,Hw.NON_SLASH_TOKEN="[^\\s/]+",Hw.regex=new RegExp("^rtpmap:(".concat(_w,") (").concat(vw.NON_SLASH_TOKEN,")/(").concat(vw.NON_SLASH_TOKEN,")(?:/(").concat(vw.NON_SLASH_TOKEN,"))?"));class Kw extends Tw{constructor(e){super(),this.port=e}static fromSdpLine(e){if(Kw.regex.test(e)){var t=e.match(Kw.regex),r=parseInt(t[1],10);return new Kw(r)}}toSdpLine(){return"a=sctp-port:".concat(this.port)}}Kw.regex=new RegExp("^sctp-port:(".concat(_w,")"));class $w extends Tw{constructor(e){super(),this.info=e}static fromSdpLine(e){if($w.regex.test(e)){var t=e.match($w.regex)[1];return new $w(t)}}toSdpLine(){return"i=".concat(this.info)}}$w.regex=new RegExp("(".concat(Cw,")"));class Jw extends Tw{constructor(e){super(),this.name=e}static fromSdpLine(e){if(Jw.regex.test(e)){var t=e.match(Jw.regex)[1];return new Jw(t)}}toSdpLine(){return"s=".concat(this.name)}}Jw.regex=new RegExp("^(".concat(Cw,")"));class Yw extends Tw{constructor(e){super(),this.setup=e}static fromSdpLine(e){if(Yw.regex.test(e)){var t=e.match(Yw.regex)[1];return new Yw(t)}}toSdpLine(){return"a=setup:".concat(this.setup)}}Yw.regex=/^setup:(actpass|active|passive)$/;class Qw{constructor(e,t){this.id=e,this.paused=t}toString(){return this.paused?"~".concat(this.id):this.id}}class Xw{constructor(){this.layers=[]}addLayer(e){this.layers.push([e])}addLayerWithAlternatives(e){this.layers.push(e)}get length(){return this.layers.length}get(e){return this.layers[e]}static fromString(e){var t=new Xw,r=e.split(";");if(1===r.length&&!r[0].trim())throw new Error("simulcast stream list empty");return r.forEach((e=>{if(!e)throw new Error("simulcast layer list empty");var r=e.split(","),n=[];r.forEach((e=>{if(!e||"~"===e)throw new Error("rid empty");var t="~"===e[0],r=t?e.substring(1):e;n.push(new Qw(r,t))})),t.addLayerWithAlternatives(n)})),t}toString(){return this.layers.map((e=>e.map((e=>e.toString())).join(","))).join(";")}}class Zw extends Tw{constructor(e,t){super(),this.sendLayers=e,this.recvLayers=t}static fromSdpLine(e){if(Zw.regex.test(e)){var t,r,n=e.match(Zw.regex),i=n[3]&&n[4],o=n[1],a=Xw.fromString(n[2]),s=new Xw;if(i){if(o===n[3])return;s=Xw.fromString(n[4])}return"send"===o?(t=a,r=s):(t=s,r=a),new Zw(t,r)}}toSdpLine(){var e="a=simulcast:";return this.sendLayers.length&&(e+="send ".concat(this.sendLayers.toString()),this.recvLayers.length&&(e+=" ")),this.recvLayers.length&&(e+="recv ".concat(this.recvLayers.toString())),e}}Zw.regex=new RegExp("^simulcast:(send|recv) (".concat(Rw,")(?: (send|recv) (").concat(Rw,"))?"));class eR extends Tw{constructor(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;super(),this.ssrcId=e,this.attribute=t,this.attributeValue=r,this.attributeData=n}static fromSdpLine(e){if(eR.regex.test(e)){var t=e.match(eR.regex),r=parseInt(t[1],10),n=t[2],i=t[3],o=t[4];return new eR(r,n,i,o)}}toSdpLine(){var e="a=ssrc:".concat(this.ssrcId," ").concat(this.attribute);return this.attributeValue&&(e+=":".concat(this.attributeValue)),this.attributeData&&(e+=" ".concat(this.attributeData)),e}}eR.regex=new RegExp("^ssrc:(".concat(_w,") (").concat(ww,")(?::(").concat(ww,")?(?: (").concat(Rw,"))?)?$"));class tR extends Tw{constructor(e,t){super(),this.semantics=e,this.ssrcs=t}static fromSdpLine(e){if(tR.regex.test(e)){var t=e.match(tR.regex),r=t[1],n=t[2].split(" ").map((e=>parseInt(e,10)));return new tR(r,n)}}toSdpLine(){return"a=ssrc-group:".concat(this.semantics," ").concat(this.ssrcs.join(" "))}}tR.regex=new RegExp("^ssrc-group:(SIM|FID|FEC) ((?:".concat(_w).concat("\\s","*)+)"));class rR extends Tw{constructor(e,t){super(),this.startTime=e,this.stopTime=t}static fromSdpLine(e){if(rR.regex.test(e)){var t=e.match(rR.regex),r=parseInt(t[1],10),n=parseInt(t[2],10);return new rR(r,n)}}toSdpLine(){return"t=".concat(this.startTime," ").concat(this.stopTime)}}rR.regex=new RegExp("^(".concat(_w,") (").concat(_w,")"));class nR extends Tw{constructor(e){super(),this.version=e}static fromSdpLine(e){if(nR.regex.test(e)){var t=e.match(nR.regex),r=parseInt(t[1],10);return new nR(r)}}toSdpLine(){return"v=".concat(this.version)}}nR.regex=new RegExp("^(".concat(_w,")$"));class iR extends Tw{constructor(e){super(),this.value=e}static fromSdpLine(e){var t=e.match(iR.regex)[1];return new iR(t)}toSdpLine(){return"".concat(this.value)}}iR.regex=new RegExp("(".concat(Cw,")"));class oR{constructor(){this.candidates=[]}addLine(e){return e instanceof Uw?(this.ufrag=e,!0):e instanceof Fw?(this.pwd=e,!0):e instanceof Dw?(this.options=e,!0):e instanceof Iw&&(this.candidates.push(e),!0)}toLines(){var e=[];return this.ufrag&&e.push(this.ufrag),this.pwd&&e.push(this.pwd),this.options&&e.push(this.options),this.candidates.forEach((t=>e.push(t))),e}}class aR{constructor(e,t,r){this.iceInfo=new oR,this.otherLines=[],this.type=e,this.port=t,this.protocol=r}findOtherLine(e){return this.otherLines.find((t=>t instanceof e))}addLine(e){if(e instanceof kw)throw new Error("Error: bundle group line not allowed in media description");return e instanceof xw?(this.bandwidth=e,!0):e instanceof qw?(this.mid=e.mid,!0):e instanceof Nw?(this.fingerprint=e.fingerprint,!0):e instanceof Yw?(this.setup=e.setup,!0):e instanceof Aw?(this.connection=e,!0):e instanceof Ow?(this.content=e,!0):this.iceInfo.addLine(e)}}class sR extends aR{constructor(e){super(e.type,e.port,e.protocol),this.fmts=[],this.fmts=e.formats}toLines(){var e=[];return e.push(new Bw(this.type,this.port,this.protocol,this.fmts)),this.connection&&e.push(this.connection),this.bandwidth&&e.push(this.bandwidth),e.push(...this.iceInfo.toLines()),this.fingerprint&&e.push(new Nw(this.fingerprint)),this.setup&&e.push(new Yw(this.setup)),this.mid&&e.push(new qw(this.mid)),this.content&&e.push(this.content),this.sctpPort&&e.push(new Kw(this.sctpPort)),this.maxMessageSize&&e.push(new jw(this.maxMessageSize)),e.push(...this.otherLines),e}addLine(e){if(super.addLine(e))return!0;if(e instanceof Bw)throw new Error("Error: tried passing a MediaLine to an existing MediaInfo");return e instanceof Kw?(this.sctpPort=e.port,!0):e instanceof jw?(this.maxMessageSize=e.maxMessageSize,!0):(this.otherLines.push(e),!0)}}class cR{constructor(e){this.fmtParams=new Map,this.feedback=[],this.pt=e}addLine(e){if(e instanceof Hw)return this.name=e.encodingName,this.clockRate=e.clockRate,this.encodingParams=e.encodingParams,!0;if(e instanceof Pw){if(this.fmtParams=new Map([...Array.from(this.fmtParams.entries()),...Array.from(e.params.entries())]),e.params.has("apt")){var t=e.params.get("apt");this.primaryCodecPt=parseInt(t,10)}return!0}return e instanceof zw&&(this.feedback.push(e.feedback),!0)}toLines(){var e=[];return this.name&&this.clockRate&&e.push(new Hw(this.pt,this.name,this.clockRate,this.encodingParams)),this.feedback.forEach((t=>{e.push(new zw(this.pt,t))})),this.fmtParams.size>0&&e.push(new Pw(this.pt,this.fmtParams)),e}}class uR extends aR{constructor(e){super(e.type,e.port,e.protocol),this.pts=[],this.extMaps=new Map,this.rids=[],this.codecs=new Map,this.rtcpMux=!1,this.ssrcs=[],this.ssrcGroups=[],this.pts=e.formats.map((e=>parseInt(e,10))),this.pts.forEach((e=>this.codecs.set(e,new cR(e))))}toLines(){var e=[];return e.push(new Bw(this.type,this.port,this.protocol,this.pts.map((e=>"".concat(e))))),this.connection&&e.push(this.connection),this.bandwidth&&e.push(this.bandwidth),e.push(...this.iceInfo.toLines()),this.fingerprint&&e.push(new Nw(this.fingerprint)),this.setup&&e.push(new Yw(this.setup)),this.mid&&e.push(new qw(this.mid)),this.rtcpMux&&e.push(new Ww),this.content&&e.push(this.content),this.extMaps.forEach((t=>e.push(t))),this.rids.forEach((t=>e.push(t))),this.simulcast&&e.push(this.simulcast),this.direction&&e.push(new Lw(this.direction)),this.codecs.forEach((t=>e.push(...t.toLines()))),e.push(...this.ssrcs),e.push(...this.ssrcGroups),e.push(...this.otherLines),e}addLine(e){if(super.addLine(e))return!0;if(e instanceof Bw)throw new Error("Error: tried passing a MediaLine to an existing MediaInfo");if(e instanceof Lw)return this.direction=e.direction,!0;if(e instanceof Mw){if(this.extMaps.has(e.id))throw new Error("Tried to extension with duplicate ID: an extension already exists with ID ".concat(e.id));return this.extMaps.set(e.id,e),!0}if(e instanceof Gw)return this.rids.push(e),!0;if(e instanceof Ww)return this.rtcpMux=!0,!0;if(e instanceof Zw)return this.simulcast=e,!0;if(e instanceof Hw||e instanceof Pw||e instanceof zw){var t=this.codecs.get(e.payloadType);if(!t)throw new Error("Error: got line for unknown codec: ".concat(e.toSdpLine()));return t.addLine(e),!0}return e instanceof eR?(this.ssrcs.push(e),!0):e instanceof tR?(this.ssrcGroups.push(e),!0):(this.otherLines.push(e),!0)}getCodecByPt(e){return this.codecs.get(e)}removePt(e){var t=[...this.codecs.values()].filter((t=>t.primaryCodecPt===e)).map((e=>e.pt)),r=[e,...t];r.forEach((e=>{this.codecs.delete(e)})),this.pts=this.pts.filter((e=>-1===r.indexOf(e)))}addExtension(e){var{uri:t,direction:r,attributes:n,id:i}=e,o=i||(()=>{for(var e=1;this.extMaps.has(e);)e+=1;return e})();if(this.extMaps.has(o))throw new Error("Extension with ID ".concat(i," already exists"));if(0===o)throw new Error("Extension ID 0 is reserved");this.extMaps.set(o,new Mw(o,t,r,n))}}class lR{constructor(){this.groups=[],this.otherLines=[]}addLine(e){return e instanceof nR?(this.version=e,!0):e instanceof Vw?(this.origin=e,!0):e instanceof Jw?(this.sessionName=e,!0):e instanceof $w?(this.information=e,!0):e instanceof rR?(this.timing=e,!0):e instanceof Aw?(this.connection=e,!0):e instanceof xw?(this.bandwidth=e,!0):e instanceof kw?(this.groups.push(e),!0):(this.otherLines.push(e),!0)}toLines(){var e=[];return this.version&&e.push(this.version),this.origin&&e.push(this.origin),this.sessionName&&e.push(this.sessionName),this.information&&e.push(this.information),this.connection&&e.push(this.connection),this.bandwidth&&e.push(this.bandwidth),this.timing&&e.push(this.timing),this.groups&&e.push(...this.groups),e.push(...this.otherLines),e}}class dR{constructor(){this.session=new lR,this.media=[]}get avMedia(){return this.media.filter((e=>e instanceof uR))}toString(){var e=[];return e.push(...this.session.toLines()),this.media.forEach((t=>e.push(...t.toLines()))),"".concat(e.map((e=>e.toSdpLine())).join("\r\n"),"\r\n")}}class fR{constructor(){this.parsers=new Map}addParser(e,t){var r=this.parsers.get(e)||[];r.push(t),this.parsers.set(e,r)}getParsers(e){return this.parsers.get(e)||[]}}var hR,pR,vR,mR=new class extends fR{constructor(){super(),this.addParser("v",nR.fromSdpLine),this.addParser("o",Vw.fromSdpLine),this.addParser("c",Aw.fromSdpLine),this.addParser("i",$w.fromSdpLine),this.addParser("m",Bw.fromSdpLine),this.addParser("s",Jw.fromSdpLine),this.addParser("t",rR.fromSdpLine),this.addParser("b",xw.fromSdpLine),this.addParser("a",Hw.fromSdpLine),this.addParser("a",zw.fromSdpLine),this.addParser("a",Pw.fromSdpLine),this.addParser("a",Lw.fromSdpLine),this.addParser("a",Mw.fromSdpLine),this.addParser("a",qw.fromSdpLine),this.addParser("a",Uw.fromSdpLine),this.addParser("a",Fw.fromSdpLine),this.addParser("a",Dw.fromSdpLine),this.addParser("a",Nw.fromSdpLine),this.addParser("a",Yw.fromSdpLine),this.addParser("a",Kw.fromSdpLine),this.addParser("a",jw.fromSdpLine),this.addParser("a",Ww.fromSdpLine),this.addParser("a",kw.fromSdpLine),this.addParser("a",Ow.fromSdpLine),this.addParser("a",Gw.fromSdpLine),this.addParser("a",Iw.fromSdpLine),this.addParser("a",Zw.fromSdpLine),this.addParser("a",eR.fromSdpLine),this.addParser("a",tR.fromSdpLine)}};function gR(e){return e.length>2}function yR(e){var t=function(e,t){var r=[];return e.split(/(\r\n|\r|\n)/).filter(gR).forEach((e=>{var n=e[0],i=e.slice(2),o=t.getParsers(n);for(var a of o){var s=a(i);if(s)return void r.push(s)}var c=iR.fromSdpLine(e);r.push(c)})),r}(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:mR),r=function(e){var t=new dR,r=t.session;return e.forEach((e=>{if(e instanceof Bw){var n;if("audio"===e.type||"video"===e.type)n=new uR(e);else{if("application"!==e.type)throw new Error("Unhandled media type: ".concat(e.type));n=new sR(e)}t.media.push(n),r=n}else r.addLine(e)})),t}(t);return r}function bR(e,t,r){return{trackOrKind:r||e,direction:t}}function ER(e){for(var t of e.codecs.values()){var r;if("H264"===(null===(r=t.name)||void 0===r?void 0:r.toUpperCase()))return!0}return!1}class SR extends Tw{constructor(e){super(),bp(this,"value",void 0),this.value=e}static fromSdpLine(){}toSdpLine(){return"a=".concat(this.value)}}function _R(e){e.avMedia.forEach((e=>{e.extMaps.clear()}))}function wR(e,t){var r=yR(t);return e.disableRtx&&function(e){e.avMedia.forEach((e=>{var t=[];e.codecs.forEach(((e,r)=>{"rtx"===e.name&&e.primaryCodecPt&&t.push(r)})),t.forEach((t=>e.codecs.delete(t))),e.pts=e.pts.filter((e=>!t.includes(e)))}))}(r),r.toString()}function RR(e,t){var r=yR(t);return e.convertCLineToIPv4&&function(e){var t=e=>{"IP6"===(null==e?void 0:e.addrType)&&(e.addrType="IP4",e.ipAddr="0.0.0.0")};t(e.session.connection),e.media.forEach((e=>{t(e.connection)}))}(r),e.bandwidthLimits&&function(e,t){e.avMedia.forEach((e=>{"audio"===e.type?e.addLine(new xw("TIAS",t.audio)):"video"===e.type&&e.addLine(new xw("TIAS",t.video))}))}(r,e.bandwidthLimits),e.periodicKeyframes&&function(e,t){e.avMedia.forEach((e=>{"video"===e.type&&e.addLine(new SR("periodic-keyframes:".concat(t)))}))}(r,e.periodicKeyframes),e.convertPort9to0&&function(e){e.media.forEach((e=>{9===e.port&&(e.port=0)}))}(r),e.addContentSlides&&function(e){var t=e.avMedia.filter((e=>"video"===e.type));2===t.length&&t[1].addLine(new Ow(["slides"]))}(r),e.disableExtmap&&_R(r),e.h264MaxFs&&function(e,t){var r={10:99,11:396,12:396,13:396,20:396,21:792,22:1620,30:1620,31:3600,32:5120,40:8192,41:8192,42:8704,50:22080,51:36864,52:36864,60:139264,61:139264,62:139264};e.avMedia.forEach((e=>{"video"===e.type&&e.codecs.forEach((e=>{var n;if("H264"===(null===(n=e.name)||void 0===n?void 0:n.toUpperCase())){var i=e.fmtParams.get("profile-level-id");if(i){var o=i.substring(0,4).toLowerCase(),a=parseInt(i.substring(4,6),16);if(!r[a])throw new Error("found unsupported h264 profile level id value in the SDP: ".concat(a));if(r[a]===t)return;if(r[a]<t)return e.fmtParams.set("max-fs","".concat(t)),void e.fmtParams.set("max-mbps","".concat(30*t));var s=Object.keys(r).reverse().find((e=>r[e]===t));if(s){var c=parseInt(s,10).toString(16);return e.fmtParams.set("profile-level-id","".concat(o).concat(c)),void e.fmtParams.set("max-mbps","".concat(30*t))}throw new Error("unsupported maxFsValue: ".concat(t))}}}))}))}(r,e.h264MaxFs),e.copyClineToSessionLevel&&function(e){var t=e.media.find((e=>e.connection));t&&(e.session.connection=t.connection)}(r),r.toString()}function CR(e,t){var r=yR(t);return e.startBitrate&&function(e,t){!function(e,t){e.avMedia.forEach((e=>{"video"===e.type&&e.codecs.forEach((e=>{var r;"H264"===(null===(r=e.name)||void 0===r?void 0:r.toUpperCase())&&t.forEach(((t,r)=>e.fmtParams.set(r,t)))}))}))}(e,new Map([["x-google-start-bitrate",t.toString()]]))}(r,e.startBitrate),e.disableExtmap&&_R(r),function(e){e.media.forEach((e=>{e.iceInfo.candidates=e.iceInfo.candidates.filter((e=>"xtls"!==e.transport.toLowerCase()))}))}(r),r.toString()}function TR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function xR(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?TR(Object(r),!0).forEach((function(t){bp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):TR(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}!function(e){e.ICE_GATHERING_STATE_CHANGED="iceGatheringState:changed",e.PEER_CONNECTION_STATE_CHANGED="peerConnectionState:changed",e.ICE_CONNECTION_STATE_CHANGED="iceConnectionState:changed",e.REMOTE_TRACK_ADDED="remoteTrack:added",e.ROAP_MESSAGE_TO_SEND="roap:messageToSend",e.ROAP_STARTED="roap:started",e.ROAP_FAILURE="roap:failure",e.ROAP_DONE="roap:done",e.DTMF_TONE_CHANGED="dtmfTone:changed",e.ACTIVE_SPEAKERS_CHANGED="activeSpeakers:changed",e.VIDEO_SOURCES_COUNT_CHANGED="videoSourcesCount:changed",e.AUDIO_SOURCES_COUNT_CHANGED="audioSourcesCount:changed",e.REMOTE_SDP_ANSWER_PROCESSED="remoteSdpAnswer:processed",e.REMOTE_SDP_OFFER_PROCESSED="remoteSdpOffer:processed",e.LOCAL_SDP_OFFER_GENERATED="localSdpOffer:processed",e.LOCAL_SDP_ANSWER_GENERATED="localSdpAnswer:processed",e.ICE_CANDIDATE="iceCandidate",e.ICE_CANDIDATE_ERROR="iceCandidate:error"}(hR||(hR={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREENSHARE_VIDEO="screenShareVideo"}(pR||(pR={})),function(e){e.DOUBLECONFLICT="DOUBLECONFLICT",e.CONFLICT="CONFLICT",e.FAILED="FAILED",e.INVALID_STATE="INVALID_STATE",e.NOMATCH="NOMATCH",e.OUT_OF_ORDER="OUT_OF_ORDER",e.REFUSED="REFUSED",e.RETRY="RETRY",e.TIMEOUT="TIMEOUT"}(vR||(vR={}));var kR=[{type:"audio",kind:"audio"},{type:"video",kind:"video"},{type:"screenShareVideo",kind:"video"}];class IR extends cp{constructor(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>{},n=arguments.length>3?arguments[3]:void 0;super(),bp(this,"id",void 0),bp(this,"config",void 0),bp(this,"pc",void 0),bp(this,"localTracks",void 0),bp(this,"transceivers",void 0),bp(this,"mediaDirection",void 0),bp(this,"remoteQualityLevel",void 0),bp(this,"metricsCallback",void 0),bp(this,"forceStatsReport",void 0),this.config=e,this.metricsCallback=r,this.mediaDirection=xR({},t.direction),this.localTracks=xR({},t.localTracks),this.remoteQualityLevel=t.remoteQualityLevel,this.id=n||"MediaConnection",this.transceivers={},this.pc=new window.RTCPeerConnection({iceServers:this.config.iceServers,bundlePolicy:"max-compat"}),this.forceStatsReport=hv(this.pc,(e=>this.metricsCallback(e)),5e3).forceStatsReport,this.pc.ontrack=this.onTrack.bind(this),this.pc.oniceconnectionstatechange=this.onIceConnectionStateChange.bind(this),this.pc.onconnectionstatechange=this.onPeerConnectionStateChange.bind(this),this.pc.addEventListener("icecandidate",(e=>{this.emit(hR.ICE_CANDIDATE,{candidate:e.candidate})})),this.pc.addEventListener("icecandidateerror",(e=>{this.emit(hR.ICE_CANDIDATE_ERROR,{error:e})}))}log(e,t){yw().info("".concat(this.id,":").concat(e," ").concat(t))}warn(e,t){yw().warn("".concat(this.id,":").concat(e," ").concat(t))}error(e,t,r){yw().error("".concat(this.id,":").concat(e," ").concat(t," ").concat(Sw(r)))}createTransceivers(){kR.forEach((e=>{var{type:t,kind:r}=e,n=t,i=t,o=bR(r,this.mediaDirection[n],this.localTracks[n]);this.config.skipInactiveTransceivers&&"inactive"===o.direction||(this.transceivers[i]=this.pc.addTransceiver(o.trackOrKind,{direction:o.direction}))})),this.setupTransceiverListeners()}initializeTransceivers(e){if(this.pc.getTransceivers().length>0)throw this.error("initiateOffer()","SDP negotiation already started"),new Error("SDP negotiation already started");e?this.addLocalTracks():this.createTransceivers()}close(){this.pc.close(),this.pc.ontrack=null,this.pc.oniceconnectionstatechange=null,this.pc.onconnectionstatechange=null,this.pc.onicegatheringstatechange=null,this.pc.onicecandidate=null,this.pc.onicecandidateerror=null}getConfig(){return this.config}getMetricsCallback(){return this.metricsCallback}getSendReceiveOptions(){return{localTracks:this.localTracks,direction:this.mediaDirection,remoteQualityLevel:this.remoteQualityLevel}}updateRemoteQualityLevel(e){return e!==this.remoteQualityLevel&&(this.remoteQualityLevel=e,!0)}updateTransceivers(e){var t=!1;return this.mediaDirection.audio=e.direction.audio,this.mediaDirection.video=e.direction.video,this.mediaDirection.screenShareVideo=e.direction.screenShareVideo,this.identifyTransceivers(),kR.forEach((r=>{var{type:n,kind:i}=r,o=n,a=n,s=e.localTracks[o],c=this.transceivers[a];if(void 0!==s&&s!==this.localTracks[o]&&(this.localTracks[o]=s,c&&(this.log("updateTransceivers()",'replacing sender track on "'.concat(n,'" transceiver')),c.sender.replaceTrack(s))),c){var u=bR(i,this.mediaDirection[o],this.localTracks[o]);c.direction!==u.direction&&(this.log("updateTransceivers()","updating direction to ".concat(u.direction,' on "').concat(n,'" transceiver')),c.direction=u.direction,t=!0)}})),t}updateLocalTracks(e){return this.updateTransceivers({localTracks:e,direction:xR({},this.mediaDirection)})}updateDirection(e){return this.updateTransceivers({localTracks:this.localTracks,direction:e})}update(e){var t=!1;return this.updateRemoteQualityLevel(e.remoteQualityLevel)&&(t=!0),this.updateTransceivers(e)&&(t=!0),t}getPeerConnectionState(){return this.pc.connectionState}getIceConnectionState(){return this.pc.iceConnectionState}getConnectionState(){var e=this.evaluateMediaConnectionState();return this.log("getConnectionState()","called, returning ".concat(e)),e}getIceGatheringState(){return this.pc.iceGatheringState}getStats(){return this.pc.getStats()}getTransceiverStats(){var e=this;return ep((function*(){var t={audio:{senders:[],receivers:[]},video:{senders:[],receivers:[]},screenShareAudio:{senders:[],receivers:[]},screenShareVideo:{senders:[],receivers:[]}},r=function*(r){var n=e.transceivers[r];n&&(yield n.sender.getStats().then((e=>{var i,o;t[r].senders.push({report:e,currentDirection:n.currentDirection,localTrackLabel:null===(i=n.sender)||void 0===i||null===(o=i.track)||void 0===o?void 0:o.label})})),yield n.receiver.getStats().then((e=>{var i,o;t[r].receivers.push({report:e,currentDirection:n.currentDirection,localTrackLabel:null===(i=n.sender)||void 0===i||null===(o=i.track)||void 0===o?void 0:o.label})})))};for(var{type:n}of kR)yield*r(n);return t}))()}insertDTMF(e,t,r){if(!this.transceivers.audio)throw new Error("audio transceiver missing");if(!this.transceivers.audio.sender)throw new Error("this.transceivers.audio.sender is null");if(!this.transceivers.audio.sender.dtmf)throw new Error("this.transceivers.audio.sender.dtmf is null");this.transceivers.audio.sender.dtmf.insertDTMF(e.toUpperCase(),t,r)}setupTransceiverListeners(){var e,t;null!==(e=this.transceivers.audio)&&void 0!==e&&null!==(t=e.sender)&&void 0!==t&&t.dtmf&&(this.transceivers.audio.sender.dtmf.ontonechange=this.onToneChange.bind(this))}onToneChange(e){this.log("onToneChange()",'emitting Event.DTMF_TONE_CHANGED with tone="'.concat(e.tone,'"')),this.emit(hR.DTMF_TONE_CHANGED,{tone:e.tone})}identifyTransceivers(){if(!this.transceivers.audio&&!this.transceivers.video&&!this.transceivers.screenShareVideo){var e=this.pc.getTransceivers();this.log("identifyTransceivers()","transceivers.length=".concat(e.length)),e.forEach(((e,t)=>{this.log("identifyTransceivers()","transceiver[".concat(t,"].mid=").concat(e.mid))})),[this.transceivers.audio,this.transceivers.video,this.transceivers.screenShareVideo]=e,this.setupTransceiverListeners()}}onTrack(e){var t,r,n,i,o,a,s,c,u,l;this.log("onTrack()","callback called: event=".concat(JSON.stringify(e)));var d="0",f="1",h="2",{track:p}=e,v=null;switch(this.identifyTransceivers(),null!==(t=e.transceiver)&&void 0!==t&&t.mid?(this.log("onTrack()","identifying track by event.transceiver.mid"),v=e.transceiver.mid):v=p.id===(null===(r=this.transceivers.audio)||void 0===r||null===(n=r.receiver)||void 0===n||null===(i=n.track)||void 0===i?void 0:i.id)?d:p.id===(null===(o=this.transceivers.video)||void 0===o||null===(a=o.receiver)||void 0===a||null===(s=a.track)||void 0===s?void 0:s.id)?f:p.id===(null===(c=this.transceivers.screenShareVideo)||void 0===c||null===(u=c.receiver)||void 0===u||null===(l=u.track)||void 0===l?void 0:l.id)?h:null,this.log("onTrack()","trackMediaID=".concat(v)),v){case d:this.log("onTrack()","emitting Event.REMOTE_TRACK_ADDED with type=AUDIO"),this.emit(hR.REMOTE_TRACK_ADDED,{type:pR.AUDIO,track:p});break;case f:this.log("onTrack()","emitting Event.REMOTE_TRACK_ADDED with type=VIDEO"),this.emit(hR.REMOTE_TRACK_ADDED,{type:pR.VIDEO,track:p});break;case h:this.log("onTrack()","emitting Event.REMOTE_TRACK_ADDED with type=SCREENSHARE_VIDEO"),this.emit(hR.REMOTE_TRACK_ADDED,{type:pR.SCREENSHARE_VIDEO,track:p});break;default:this.error("onTrack()","failed to match remote track media id: ".concat(v))}}addLocalTracks(){this.log("addLocalTracks()","adding tracks ".concat(JSON.stringify(this.localTracks))),this.localTracks.audio&&this.pc.addTrack(this.localTracks.audio),this.localTracks.video&&this.pc.addTrack(this.localTracks.video),this.localTracks.screenShareVideo&&this.pc.addTrack(this.localTracks.screenShareVideo)}onPeerConnectionStateChange(){this.log("onPeerConnectionStateChange()","callback called: peerConnectionState=".concat(this.pc.connectionState)),this.emit(hR.PEER_CONNECTION_STATE_CHANGED,{state:this.pc.connectionState})}onIceConnectionStateChange(){this.log("onIceConnectionStateChange()","callback called: iceConnectionState=".concat(this.pc.iceConnectionState)),this.emit(hR.ICE_CONNECTION_STATE_CHANGED,{state:this.pc.iceConnectionState})}evaluateMediaConnectionState(){var e,t=this.pc.connectionState,r=this.pc.iceConnectionState,n=[t,r];return e=n.some((e=>"closed"===e))?bg.Closed:n.some((e=>"failed"===e))?bg.Failed:n.some((e=>"disconnected"===e))?bg.Disconnected:n.every((e=>"connected"===e||"completed"===e))?bg.Connected:n.every((e=>"new"===e))?bg.New:bg.Connecting,this.log("evaluateConnectionState","iceConnectionState=".concat(r," rtcPcConnectionState=").concat(t," => mediaConnectionState=").concat(e)),e}createSdpMungingConfig(){if(this.remoteQualityLevel){var e={LOW:1620,MEDIUM:3600,HIGH:8192};if(!e[this.remoteQualityLevel])throw new Error("invalid value for receiveOptions.remoteQualityLevel: ".concat(this.remoteQualityLevel));return this.config.sdpMunging.h264MaxFs&&this.warn("createSdpMungingConfig","conflict: both config.sdpMunging.h264MaxFs and receiveOptions.remoteQualityLevel are set, remoteQualityLevel will override the config"),xR(xR({},this.config.sdpMunging),{},{h264MaxFs:e[this.remoteQualityLevel]})}return this.config.sdpMunging}createLocalOffer(){var e=this.createSdpMungingConfig();return this.pc.createOffer().then((t=>{this.log("createLocalOffer","local SDP offer created");var r={type:t.type,sdp:wR(e,(null==t?void 0:t.sdp)||"")};return this.pc.setLocalDescription(r)})).then((()=>this.waitForIceCandidates())).then((()=>{var t,r=RR(e,(null===(t=this.pc.localDescription)||void 0===t?void 0:t.sdp)||"");return this.emit(hR.LOCAL_SDP_OFFER_GENERATED),{sdp:r}})).catch((e=>{throw e instanceof Zp||e instanceof Qp?e:new nv("createLocalOffer() failure: ".concat(e.message),{cause:e})}))}handleRemoteOffer(e){if(this.log("handleRemoteOffer","called"),!e)return Promise.reject(new ov("SDP missing"));var t=CR(this.config.sdpMunging,e),r=this.createSdpMungingConfig();return this.pc.setRemoteDescription(new window.RTCSessionDescription({type:"offer",sdp:t})).then((()=>this.emit(hR.REMOTE_SDP_OFFER_PROCESSED))).then((()=>this.pc.createAnswer())).then((e=>{var t={type:e.type,sdp:wR(r,(null==e?void 0:e.sdp)||"")};return this.pc.setLocalDescription(t)})).then((()=>this.waitForIceCandidates())).then((()=>{var e,t=RR(r,(null===(e=this.pc.localDescription)||void 0===e?void 0:e.sdp)||"");return this.emit(hR.LOCAL_SDP_ANSWER_GENERATED),{sdp:t}})).catch((e=>{throw e instanceof Zp||e instanceof Qp?e:new ov("handleRemoteOffer() failure: ".concat(e.message),{cause:e})}))}handleRemoteAnswer(e){if(this.log("handleRemoteAnswer","called"),!e)return Promise.reject(new tv("SDP answer missing"));var t=CR(this.config.sdpMunging,e);return this.pc.setRemoteDescription(new window.RTCSessionDescription({type:"answer",sdp:t})).then((e=>(this.emit(hR.REMOTE_SDP_ANSWER_PROCESSED),e))).catch((e=>{throw new tv("handleRemoteAnswer() failure: ".concat(e.message),{cause:e})}))}waitForIceCandidates(){return new Promise(((e,t)=>{var r,n=performance.now(),i=!1,o=()=>{var e;return function(e,t){if(!t)return new Error("SDP is missing");var r=yR(t);for(var n of r.avMedia){if(!n.iceInfo.candidates.length)return new Zp("ice candidates missing for m-line with mid=".concat(n.mid));if(!e.allowPort0&&0===n.port)return new Qp("Found invalid port number 0 at m-line with mid=".concat(n.mid));if(!n.iceInfo.pwd||!n.iceInfo.ufrag)return new Zp("ice ufrag and password not found for m-line with mid=".concat(n.mid));if(e.requireH264&&"video"===n.type&&!ER(n))return new Qp("H264 codec is missing for video media description with mid=".concat(n.mid))}return!1}({allowPort0:!!this.config.sdpMunging.convertPort9to0,requireH264:!!this.config.requireH264},null===(e=this.pc.localDescription)||void 0===e?void 0:e.sdp)},a=()=>{if(!i){var a=performance.now()-n;this.log("waitForIceCandidates()","checking SDP...");var s,c=o();if(c)this.error("waitForIceCandidates()",'SDP not valid after waiting: "'.concat(c.message,'", sdp=').concat(null===(s=this.pc.localDescription)||void 0===s?void 0:s.sdp)),t(c);this.log("waitForIceCandidates()","It took ".concat(a," milliseconds to gather ice candidates")),void 0!==r&&clearTimeout(r),i=!0,this.pc.onicegatheringstatechange=null,this.pc.onicecandidate=null,this.pc.onicecandidateerror=null,e()}};if("complete"===this.pc.iceGatheringState&&!1===o())return this.log("waitForIceCandidates()",'iceGatheringState is already "complete" and local SDP is valid'),void e();this.log("waitForIceCandidates()","waiting for ICE candidates to be gathered..."),this.config.iceCandidatesTimeout&&(r=setTimeout((()=>{i||(this.log("waitForIceCandidates()","timeout of ".concat(this.config.iceCandidatesTimeout," milliseconds reached")),a())}),this.config.iceCandidatesTimeout)),this.pc.onicegatheringstatechange=()=>{this.log("waitForIceCandidates()","iceGatheringState changed to ".concat(this.pc.iceGatheringState)),this.emit(hR.ICE_GATHERING_STATE_CHANGED,{state:this.pc.iceGatheringState}),"complete"===this.pc.iceGatheringState&&a()},this.pc.onicecandidate=e=>{var t,r;null===e.candidate?(this.log("waitForIceCandidates()","evt.candidate === null received"),a()):this.log("waitForIceCandidates()","ICE Candidate(".concat(null===(t=e.candidate)||void 0===t?void 0:t.sdpMLineIndex,"): ").concat(null===(r=e.candidate)||void 0===r?void 0:r.candidate))},this.pc.onicecandidateerror=e=>{var t=e;this.warn("waitForIceCandidates()","onicecandidateerror: address=".concat(t.address," errorCode=").concat(t.errorCode,", errorText=").concat(t.errorText,", url=").concat(t.url))}}))}forceRtcMetricsCallback(){var e;null===(e=this.forceStatsReport)||void 0===e||e.call(this)}}var AR=!0,OR=!0;function LR(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function MR(e,t,r){if(e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);var o=e=>{var t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,o),i.apply(this,[e,o])};var o=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);var n=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}}function NR(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(AR=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function PR(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(OR=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function DR(){if("object"==typeof window){if(AR)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function FR(e,t){OR&&console.warn(e+" is deprecated, please use "+t+" instead.")}function UR(e){return"[object Object]"===Object.prototype.toString.call(e)}function jR(e){return UR(e)?Object.keys(e).reduce((function(t,r){var n=UR(e[r]),i=n?jR(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,{[r]:i})}),{}):e}function BR(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((n=>{n.endsWith("Id")?BR(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((t=>{BR(e,e.get(t),r)}))})))}function qR(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;var o=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((t=>{e.forEach((r=>{r.type===n&&r.trackId===t.id&&BR(e,r,i)}))})),i}var VR=DR;function GR(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach((r=>{if("require"!==r&&"advanced"!==r&&"mediaSource"!==r){var n="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];var o={};"number"==typeof n.ideal?(o[i("min",r)]=n.ideal,t.optional.push(o),(o={})[i("max",r)]=n.ideal,t.optional.push(o)):(o[i("",r)]=n.ideal,t.optional.push(o))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",r)]=n.exact):["min","max"].forEach((e=>{void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,r)]=n[e])}))}})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){var o=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};o((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"==typeof e.video){var a=e.video.facingMode;a=a&&("object"==typeof a?a:{ideal:a});var s,c=t.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||c))if(delete e.video.facingMode,"environment"===a.exact||"environment"===a.ideal?s=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(s=["front"]),s)return r.mediaDevices.enumerateDevices().then((t=>{t=t.filter((e=>"videoinput"===e.kind));var r=t.find((e=>s.some((t=>e.label.toLowerCase().includes(t)))));return!r&&t.length&&s.includes("back")&&(r=t[t.length-1]),r&&(e.video.deviceId=a.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),VR("chrome: "+JSON.stringify(e)),i(e)}));e.video=n(e.video)}return VR("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){i(e,(e=>{r.webkitGetUserMedia(e,t,(e=>{n&&n(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){var a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return i(e,(e=>a(e).then((t=>{if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return t}),(e=>Promise.reject(o(e))))))}}}}function WR(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function zR(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(r=>{var n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.track.id)):{track:r.track};var i=new Event("track");i.track=r.track,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)})),t.stream.getTracks().forEach((r=>{var n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.id)):{track:r};var i=new Event("track");i.track=r,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else MR(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function HR(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){var i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};var o=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((e=>{var t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var a=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=a.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function KR(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var[e,r,n]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);var i=function(e){var t={};return e.result().forEach((e=>{var r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{r[t]=e.stat(t)})),t[r.id]=r})),t},o=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){return t.apply(this,[function(e){r(o(i(e)))},e])}return new Promise(((e,r)=>{t.apply(this,[function(t){e(o(i(t)))},r])})).then(r,n)}}}function $R(e){if("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((t=>qR(t,e.track,!0)))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=n.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),MR(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then((t=>qR(t,e.track,!1)))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,r,n,o=arguments[0];return this.getSenders().forEach((e=>{e.track===o&&(t?n=!0:t=e)})),this.getReceivers().forEach((e=>(e.track===o&&(r?n=!0:r=e),e.track===o))),n||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}}}function JR(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{var t=this.getSenders().find((t=>t.track===e));if(t)throw new DOMException("Track already exists.","InvalidAccessError")}));var t=this.getSenders();r.apply(this,arguments);var n=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(n)};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{var r=this._shimmedLocalStreams[t].indexOf(e);-1!==r&&this._shimmedLocalStreams[t].splice(r,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),i.apply(this,arguments)}}function YR(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return JR(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{var t=this.getSenders().find((t=>t.track===e));if(t)throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}n.apply(this,[t])};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var i=this.getSenders().find((e=>e.track===t));if(i)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var o=this._streams[r.id];if(o)o.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{var a=new e.MediaStream([t]);this._streams[r.id]=a,this._reverseStreams[a.id]=r,this.addStream(a)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n={[t](){var e=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[t=>{var r=s(this,t);e[0].apply(null,[r])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):r.apply(this,arguments).then((e=>s(this,e)))}};e.RTCPeerConnection.prototype[t]=n[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){var e=a.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");var t;if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},Object.keys(this._streams).forEach((r=>{this._streams[r].getTracks().find((t=>e.track===t))&&(t=this._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function s(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}}function QR(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}))}function XR(e,t){MR(e,"negotiationneeded",(e=>{var r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var ZR=Object.freeze({__proto__:null,shimMediaStream:WR,shimOnTrack:zR,shimGetSendersWithDtmf:HR,shimGetStats:KR,shimSenderReceiverGetStats:$R,shimAddTrackRemoveTrackWithNative:JR,shimAddTrackRemoveTrack:YR,shimPeerConnection:QR,fixNegotiationNeeded:XR,shimGetUserMedia:GR,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((t=>{var n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}});function eC(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){FR("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},o=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"==typeof e&&"object"==typeof e.audio&&(e=JSON.parse(JSON.stringify(e)),i(e.audio,"autoGainControl","mozAutoGainControl"),i(e.audio,"noiseSuppression","mozNoiseSuppression")),o(e)},n&&n.prototype.getSettings){var a=n.prototype.getSettings;n.prototype.getSettings=function(){var e=a.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var s=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"==typeof e&&(e=JSON.parse(JSON.stringify(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}}function tC(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function rC(e,t){if("object"==typeof e&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}));var r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var[e,i,o]=arguments;return n.apply(this,[e||null]).then((e=>{if(t.version<53&&!i)try{e.forEach((e=>{e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,n)=>{e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(i,o)}}}function nC(e){if("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}}function iC(e){if("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),MR(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function oC(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){FR("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function aC(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function sC(e){if("object"==typeof e&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]);var r=(e=[...e]).length>0;r&&e.forEach((e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var n=t.apply(this,arguments);if(r){var{sender:i}=n,o=i.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e,i.sendEncodings=e,this.setParametersPromises.push(i.setParameters(o).then((()=>{delete i.sendEncodings})).catch((()=>{delete i.sendEncodings}))))}return n})}}function cC(e){if("object"==typeof e&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function uC(e){if("object"==typeof e&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}}function lC(e){if("object"==typeof e&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}}var dC=Object.freeze({__proto__:null,shimOnTrack:tC,shimPeerConnection:rC,shimSenderGetStats:nC,shimReceiverGetStats:iC,shimRemoveStream:oC,shimRTCDataChannel:aC,shimAddTransceiver:sC,shimGetParameters:cC,shimCreateOffer:uC,shimCreateAnswer:lC,shimGetUserMedia:eC,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){var n=new DOMException("getDisplayMedia without video constraints is undefined");return n.name="NotFoundError",n.code=8,Promise.reject(n)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}});function fC(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((r=>t.call(this,r,e))),e.getVideoTracks().forEach((r=>t.call(this,r,e)))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n&&n.forEach((e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);var t=this._localStreams.indexOf(e);if(-1!==t){this._localStreams.splice(t,1);var r=e.getTracks();this.getSenders().forEach((e=>{r.includes(e.track)&&this.removeTrack(e)}))}})}}function hC(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach((e=>{if(this._remoteStreams||(this._remoteStreams=[]),!this._remoteStreams.includes(e)){this._remoteStreams.push(e);var t=new Event("addstream");t.stream=e,this.dispatchEvent(t)}}))})}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((t=>{if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}}))}),t.apply(e,arguments)}}}function pC(e){if("object"==typeof e&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i};var s=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){var n=a.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=s}}function vC(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var r=t.mediaDevices,n=r.getUserMedia.bind(r);t.mediaDevices.getUserMedia=e=>n(mC(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function mC(e){return e&&void 0!==e.video?Object.assign({},e,{video:jR(e.video)}):e}function gC(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var n=[],i=0;i<e.iceServers.length;i++){var o=e.iceServers[i];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(FR("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,n.push(o)):n.push(e.iceServers[i])}e.iceServers=n}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}}function yC(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function bC(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var r=this.getTransceivers().find((e=>"audio"===e.receiver.track.kind));!1===e.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!==e.offerToReceiveAudio||r||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var n=this.getTransceivers().find((e=>"video"===e.receiver.track.kind));!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function EC(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var SC=Object.freeze({__proto__:null,shimLocalStreamsAPI:fC,shimRemoteStreamsAPI:hC,shimCallbacksAPI:pC,shimGetUserMedia:vC,shimConstraints:mC,shimRTCIceServerUrls:gC,shimTrackEventTransceiver:yC,shimCreateOfferLegacy:bC,shimAudioContext:EC}),_C={exports:{}};!function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((e=>e.trim()))},t.splitSections=function(e){return e.split("\nm=").map(((e,t)=>(t>0?"m="+e:e).trim()+"\r\n"))},t.getDescription=function(e){var r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){var r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((e=>0===e.indexOf(r)))},t.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:void 0===r[t[n]]&&(r[t[n]]=t[n+1])}return r},t.writeCandidate=function(e){var t=[];t.push(e.foundation);var r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,r={},n=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<n.length;i++)r[(t=n[i].trim().split("="))[0].trim()]=t[1];return r},t.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var n=[];Object.keys(e.parameters).forEach((t=>{void 0!==e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((e=>{t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((e=>parseInt(e,10)))}},t.getMid=function(e){var r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((e=>{r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){var n=t.matchPrefix(e+r,"a=ice-ufrag:")[0],i=t.matchPrefix(e+r,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substr(12),password:i.substr(10)}:null},t.writeIceParameters=function(e){var t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=t.splitLines(e)[0].split(" "),i=3;i<n.length;i++){var o=n[i],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=t.parseRtpMap(a),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((e=>{r.headerExtensions.push(t.parseExtmap(e))})),r},t.writeRtpDescription=function(e,r){var n="";n+="m="+e+" ",n+=r.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=r.codecs.map((e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType)).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((e=>{n+=t.writeRtpMap(e),n+=t.writeFmtp(e),n+=t.writeRtcpFb(e)}));var i=0;return r.codecs.forEach((e=>{e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach((e=>{n+=t.writeExtmap(e)})),n},t.parseRtpEncodingParameters=function(e){var r,n=[],i=t.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),a=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute)),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substr(17).split(" ").map((e=>parseInt(e,10)))));u.length>0&&u[0].length>1&&u[0][0]===c&&(r=u[0][1]),i.codecs.forEach((e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&r&&(t.rtx={ssrc:r}),n.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},n.push(t))}})),0===n.length&&c&&n.push({ssrc:c});var l=t.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substr(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substr(5),10)*.95-16e3:void 0,n.forEach((e=>{e.maxBitrate=l}))),n},t.parseRtcpParameters=function(e){var r={},n=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute))[0];n&&(r.cname=n.value,r.ssrc=n.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=i.length>0,r.compound=0===i.length;var o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.writeRtcpParameters=function(e){var t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){var r,n=t.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(r=n[0].substr(7).split(" "))[0],track:r[1]};var i=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"msid"===e.attribute));return i.length>0?{stream:(r=i[0].value.split(" "))[0],track:r[1]}:void 0},t.parseSctpDescription=function(e){var r,n=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(r=parseInt(i[0].substr(19),10)),isNaN(r)&&(r=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:n.fmt,maxMessageSize:r};var a=t.matchPrefix(e,"a=sctpmap:");if(a.length>0){var s=a[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:r}}},t.writeSctpDescription=function(e,t){var r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,n){var i=void 0!==r?r:2;return"v=0\r\no="+(n||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,r){for(var n=t.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){var r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var r=t.splitLines(e),n=0;n<r.length;n++)if(r[n].length<2||"="!==r[n].charAt(1))return!1;return!0},e.exports=t}(_C);var wC=_C.exports,RC=Xh({__proto__:null,default:wC},[_C.exports]);function CC(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var r=new t(e),n=wC.parseCandidate(e.candidate),i=Object.assign(r,n);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,MR(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}}function TC(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(e){if(!e||!e.sdp)return!1;var t=wC.splitSections(e.sdp);return t.shift(),t.some((e=>{var t=wC.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))}(arguments[0])){var n,i=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var r=parseInt(t[1],10);return r!=r?-1:r}(arguments[0]),o=(c=i,u=65536,"firefox"===t.browser&&(u=t.version<57?-1===c?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),u),a=function(e,r){var n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);var i=wC.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n}(arguments[0],i);n=0===o&&0===a?Number.POSITIVE_INFINITY:0===o||0===a?Math.max(o,a):Math.min(o,a);var s={};Object.defineProperty(s,"maxMessageSize",{get:()=>n}),this._sctp=s}var c,u;return r.apply(this,arguments)}}}function xC(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return r(e,this),e},MR(e,"datachannel",(e=>(r(e.channel,e.target),e)))}function r(e,t){var r=e.send;e.send=function(){var n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}}function kC(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((e=>{var r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}}function IC(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var n=t.sdp.split("\n").filter((e=>"a=extmap-allow-mixed"!==e.trim())).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return r.apply(this,arguments)}}}function AC(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function OC(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return r.apply(this,arguments);if(!(e={type:e.type,sdp:e.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}return e.sdp||"offer"!==e.type&&"answer"!==e.type?r.apply(this,[e]):("offer"===e.type?this.createOffer:this.createAnswer).apply(this).then((e=>r.apply(this,[e])))})}}var LC=Object.freeze({__proto__:null,shimRTCIceCandidate:CC,shimMaxMessageSize:TC,shimSendThrowTypeError:xC,shimConnectionState:kC,removeExtmapAllowMixed:IC,shimAddIceCandidateNullOrEmpty:AC,shimParameterlessSetLocalDescription:OC});!function(){var{window:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},r=DR,n=function(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var{navigator:r}=e;if(r.mozGetUserMedia)t.browser="firefox",t.version=LR(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=LR(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=LR(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),i={browserDetails:n,commonShim:LC,extractVersion:LR,disableLog:NR,disableWarnings:PR,sdp:RC};switch(n.browser){case"chrome":if(!ZR||!QR||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),i;if(null===n.version)return r("Chrome shim can not determine version, not shimming."),i;r("adapter.js shimming chrome."),i.browserShim=ZR,AC(e,n),OC(e),GR(e,n),WR(e),QR(e,n),zR(e),YR(e,n),HR(e),KR(e),$R(e),XR(e,n),CC(e),kC(e),TC(e,n),xC(e),IC(e,n);break;case"firefox":if(!dC||!rC||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),i;r("adapter.js shimming firefox."),i.browserShim=dC,AC(e,n),OC(e),eC(e,n),rC(e,n),tC(e),oC(e),nC(e),iC(e),aC(e),sC(e),cC(e),uC(e),lC(e),CC(e),kC(e),TC(e,n),xC(e);break;case"safari":if(!SC||!t.shimSafari)return r("Safari shim is not included in this adapter release."),i;r("adapter.js shimming safari."),i.browserShim=SC,AC(e,n),OC(e),gC(e),bC(e),pC(e),fC(e),hC(e),yC(e),vC(e),EC(e),CC(e),TC(e,n),xC(e),IC(e,n);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var MC,NC,PC=function(){return PC=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},PC.apply(this,arguments)};function DC(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function FC(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function UC(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function jC(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}!function(e){e.Start="xstate.start",e.Stop="xstate.stop",e.Raise="xstate.raise",e.Send="xstate.send",e.Cancel="xstate.cancel",e.NullEvent="",e.Assign="xstate.assign",e.After="xstate.after",e.DoneState="done.state",e.DoneInvoke="done.invoke",e.Log="xstate.log",e.Init="xstate.init",e.Invoke="xstate.invoke",e.ErrorExecution="error.execution",e.ErrorCommunication="error.communication",e.ErrorPlatform="error.platform",e.ErrorCustom="xstate.error",e.Update="xstate.update",e.Pure="xstate.pure",e.Choose="xstate.choose"}(MC||(MC={})),function(e){e.Parent="#_parent",e.Internal="#_internal"}(NC||(NC={}));var BC=MC.Start,qC=MC.Stop,VC=MC.Raise,GC=MC.Send,WC=MC.Cancel,zC=MC.NullEvent,HC=MC.Assign;MC.After,MC.DoneState;var KC=MC.Log,$C=MC.Init,JC=MC.Invoke;MC.ErrorExecution;var YC,QC=MC.ErrorPlatform,XC=MC.ErrorCustom,ZC=MC.Update,eT=MC.Choose,tT=MC.Pure,rT={},nT="xstate.guard",iT="production"===Uv.env.NODE_ENV;function oT(e,t,r){void 0===r&&(r=".");var n=cT(e,r),i=cT(t,r);return CT(i)?!!CT(n)&&i===n:CT(n)?n in i:Object.keys(n).every((function(e){return e in i&&oT(n[e],i[e])}))}function aT(e){try{return CT(e)||"number"==typeof e?"".concat(e):e.type}catch(e){throw new Error("Events must be strings or objects with a string event.type property.")}}function sT(e,t){try{return wT(e)?e:e.toString().split(t)}catch(t){throw new Error("'".concat(e,"' is not a valid state path."))}}function cT(e,t){return"object"==typeof(r=e)&&"value"in r&&"context"in r&&"event"in r&&"_event"in r?e.value:wT(e)?uT(e):"string"!=typeof e?e:uT(sT(e,t));var r}function uT(e){if(1===e.length)return e[0];for(var t={},r=t,n=0;n<e.length-1;n++)n===e.length-2?r[e[n]]=e[n+1]:(r[e[n]]={},r=r[e[n]]);return t}function lT(e,t){for(var r={},n=Object.keys(e),i=0;i<n.length;i++){var o=n[i];r[o]=t(e[o],o,e,i)}return r}function dT(e,t,r){var n,i,o={};try{for(var a=FC(Object.keys(e)),s=a.next();!s.done;s=a.next()){var c=s.value,u=e[c];r(u)&&(o[c]=t(u,c,e))}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return o}var fT=function(e){return function(t){var r,n,i=t;try{for(var o=FC(e),a=o.next();!a.done;a=o.next()){i=i[a.value]}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}};function hT(e){return e?CT(e)?[[e]]:pT(Object.keys(e).map((function(t){var r=e[t];return"string"==typeof r||r&&Object.keys(r).length?hT(e[t]).map((function(e){return[t].concat(e)})):[[t]]}))):[[]]}function pT(e){var t;return(t=[]).concat.apply(t,jC([],UC(e),!1))}function vT(e){return wT(e)?e:[e]}function mT(e){return void 0===e?[]:vT(e)}function gT(e,t,r){var n,i;if(RT(e))return e(t,r.data);var o={};try{for(var a=FC(Object.keys(e)),s=a.next();!s.done;s=a.next()){var c=s.value,u=e[c];RT(u)?o[c]=u(t,r.data):o[c]=u}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return o}function yT(e){return e instanceof Promise||!(null===e||!RT(e)&&"object"!=typeof e||!RT(e.then))}function bT(e,t){var r,n,i=UC([[],[]],2),o=i[0],a=i[1];try{for(var s=FC(e),c=s.next();!c.done;c=s.next()){var u=c.value;t(u)?o.push(u):a.push(u)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return[o,a]}function ET(e,t){return lT(e.states,(function(e,r){if(e){var n=(CT(t)?void 0:t[r])||(e?e.current:void 0);if(n)return{current:n,states:ET(e,n)}}}))}function ST(e,t,r,n){iT||_T(!!e,"Attempting to update undefined context");var i=e?r.reduce((function(e,r){var i,o,a=r.assignment,s={state:n,action:r,_event:t},c={};if(RT(a))c=a(e,t.data,s);else try{for(var u=FC(Object.keys(a)),l=u.next();!l.done;l=u.next()){var d=l.value,f=a[d];c[d]=RT(f)?f(e,t.data,s):f}}catch(e){i={error:e}}finally{try{l&&!l.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}return Object.assign({},e,c)}),e):e;return i}var _T=function(){};function wT(e){return Array.isArray(e)}function RT(e){return"function"==typeof e}function CT(e){return"string"==typeof e}function TT(e,t){if(e)return CT(e)?{type:nT,name:e,predicate:t?t[e]:void 0}:RT(e)?{type:nT,name:e.name,predicate:e}:e}iT||(_T=function(e,t){var r=e instanceof Error?e:void 0;if((r||!e)&&void 0!==console){var n=["Warning: ".concat(t)];r&&n.push(r),console.warn.apply(console,n)}});var xT=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function kT(e){return!!e&&"__xstatenode"in e}function IT(e,t){return CT(e)||"number"==typeof e?PC({type:e},t):e}function AT(e,t){if(!CT(e)&&"$$type"in e&&"scxml"===e.$$type)return e;var r=IT(e);return PC({name:r.type,data:r,$$type:"scxml",type:"external"},t)}function OT(e,t){return vT(t).map((function(t){return void 0===t||"string"==typeof t||kT(t)?{target:t,event:e}:PC(PC({},t),{event:e})}))}function LT(e,t,r,n,i){var o=e.options.guards,a={state:i,cond:t,_event:n};if(t.type===nT)return((null==o?void 0:o[t.name])||t.predicate)(r,n.data,a);var s=null==o?void 0:o[t.type];if(!s)throw new Error("Guard '".concat(t.type,"' is not implemented on machine '").concat(e.id,"'."));return s(r,n.data,a)}function MT(e){return"string"==typeof e?{type:e}:e}function NT(e,t,r){var n=function(){},i="object"==typeof e,o=i?e:null;return{next:((i?e.next:e)||n).bind(o),error:((i?e.error:t)||n).bind(o),complete:((i?e.complete:r)||n).bind(o)}}function PT(e,t){return"".concat(e,":invocation[").concat(t,"]")}(YC={})[xT]=function(){return this},YC[Symbol.observable]=function(){return this};var DT=AT({type:$C});function FT(e,t){return t&&t[e]||void 0}function UT(e,t){var r;if(CT(e)||"number"==typeof e)r=RT(n=FT(e,t))?{type:e,exec:n}:n||{type:e,exec:void 0};else if(RT(e))r={type:e.name||e.toString(),exec:e};else{var n;if(RT(n=FT(e.type,t)))r=PC(PC({},e),{exec:n});else if(n){var i=n.type||e.type;r=PC(PC(PC({},n),e),{type:i})}else r=e}return r}var jT=function(e,t){return e?(wT(e)?e:[e]).map((function(e){return UT(e,t)})):[]};function BT(e){var t=UT(e);return PC(PC({id:CT(e)?e:t.id},t),{type:t.type})}function qT(e){return CT(e)?{type:VC,event:e}:VT(e,{to:NC.Internal})}function VT(e,t){return{to:t?t.to:void 0,type:GC,event:RT(e)?e:IT(e),delay:t?t.delay:void 0,id:t&&void 0!==t.id?t.id:RT(e)?e.name:aT(e)}}function GT(e,t){var r="".concat(MC.DoneState,".").concat(e),n={type:r,data:t,toString:function(){return r}};return n}function WT(e,t){var r="".concat(MC.DoneInvoke,".").concat(e),n={type:r,data:t,toString:function(){return r}};return n}function zT(e,t){var r="".concat(MC.ErrorPlatform,".").concat(e),n={type:r,data:t,toString:function(){return r}};return n}function HT(e,t,r,n,i,o,a){void 0===a&&(a=!1);var s=UC(a?[[],i]:bT(i,(function(e){return e.type===HC})),2),c=s[0],u=s[1],l=c.length?ST(r,n,c,t):r,d=a?[r]:void 0,f=pT(u.map((function(r){var i;switch(r.type){case VC:return{type:VC,_event:AT(r.event)};case GC:var s=function(e,t,r,n){var i,o={_event:r},a=AT(RT(e.event)?e.event(t,r.data,o):e.event);if(CT(e.delay)){var s=n&&n[e.delay];i=RT(s)?s(t,r.data,o):s}else i=RT(e.delay)?e.delay(t,r.data,o):e.delay;var c=RT(e.to)?e.to(t,r.data,o):e.to;return PC(PC({},e),{to:c,_event:a,event:a.data,delay:i})}(r,l,n,e.options.delays);return iT||_T(!CT(r.delay)||"number"==typeof s.delay,"No delay reference for delay expression '".concat(r.delay,"' was found on machine '").concat(e.id,"'")),s.to!==NC.Internal&&(null==o||o(s,l,n)),s;case KC:var c=function(e,t,r){return PC(PC({},e),{value:CT(e.expr)?e.expr:e.expr(t,r.data,{_event:r})})}(r,l,n);return null==o||o(c,l,n),c;case eT:if(!(p=null===(i=r.conds.find((function(r){var i=TT(r.cond,e.options.guards);return!i||LT(e,i,l,n,o?void 0:t)})))||void 0===i?void 0:i.actions))return[];var u=UC(HT(e,t,l,n,jT(mT(p),e.options.actions),o,a),2),f=u[0],h=u[1];return l=h,null==d||d.push(l),f;case tT:var p;if(!(p=r.get(l,n.data)))return[];var v=UC(HT(e,t,l,n,jT(mT(p),e.options.actions),o,a),2),m=v[0],g=v[1];return l=g,null==d||d.push(l),m;case qC:c=function(e,t,r){var n=RT(e.activity)?e.activity(t,r.data):e.activity,i="string"==typeof n?{id:n}:n;return{type:MC.Stop,activity:i}}(r,l,n);return null==o||o(c,l,n),c;case HC:l=ST(l,n,[r],o?void 0:t),null==d||d.push(l);break;default:var y=UT(r,e.options.actions),b=y.exec;if(o)o(y,l,n);else if(b&&d){var E=d.length-1;y=PC(PC({},y),{exec:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];b.apply(void 0,jC([d[E]],UC(t),!1))}})}return y}})).filter((function(e){return!!e})));return[f,l]}var KT=function(e,t){return t(e)};function $T(e){var t;return(t={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:e}}})[xT]=function(){return this},t}function JT(e,t,r){var n=$T(t);if(n.deferred=!0,kT(e)){var i=n.state=KT(void 0,(function(){return(r?e.withContext(r):e).initialState}));n.getSnapshot=function(){return i}}return n}var YT=function(e){return"atomic"===e.type||"final"===e.type};function QT(e){return Object.keys(e.states).map((function(t){return e.states[t]}))}function XT(e){return QT(e).filter((function(e){return"history"!==e.type}))}function ZT(e){var t=[e];return YT(e)?t:t.concat(pT(XT(e).map(ZT)))}function ex(e,t){var r,n,i,o,a,s,c,u,l=rx(new Set(e)),d=new Set(t);try{for(var f=FC(d),h=f.next();!h.done;h=f.next())for(var p=(w=h.value).parent;p&&!d.has(p);)d.add(p),p=p.parent}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}var v=rx(d);try{for(var m=FC(d),g=m.next();!g.done;g=m.next()){if("compound"!==(w=g.value).type||v.get(w)&&v.get(w).length){if("parallel"===w.type)try{for(var y=(a=void 0,FC(XT(w))),b=y.next();!b.done;b=y.next()){var E=b.value;d.has(E)||(d.add(E),l.get(E)?l.get(E).forEach((function(e){return d.add(e)})):E.initialStateNodes.forEach((function(e){return d.add(e)})))}}catch(e){a={error:e}}finally{try{b&&!b.done&&(s=y.return)&&s.call(y)}finally{if(a)throw a.error}}}else l.get(w)?l.get(w).forEach((function(e){return d.add(e)})):w.initialStateNodes.forEach((function(e){return d.add(e)}))}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=m.return)&&o.call(m)}finally{if(i)throw i.error}}try{for(var S=FC(d),_=S.next();!_.done;_=S.next()){var w;for(p=(w=_.value).parent;p&&!d.has(p);)d.add(p),p=p.parent}}catch(e){c={error:e}}finally{try{_&&!_.done&&(u=S.return)&&u.call(S)}finally{if(c)throw c.error}}return d}function tx(e,t){var r=t.get(e);if(!r)return{};if("compound"===e.type){var n=r[0];if(!n)return{};if(YT(n))return n.key}var i={};return r.forEach((function(e){i[e.key]=tx(e,t)})),i}function rx(e){var t,r,n=new Map;try{for(var i=FC(e),o=i.next();!o.done;o=i.next()){var a=o.value;n.has(a)||n.set(a,[]),a.parent&&(n.has(a.parent)||n.set(a.parent,[]),n.get(a.parent).push(a))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n}function nx(e,t){return tx(e,rx(ex([e],t)))}function ix(e,t){return Array.isArray(e)?e.some((function(e){return e===t})):e instanceof Set&&e.has(t)}function ox(e,t){return"compound"===t.type?XT(t).some((function(t){return"final"===t.type&&ix(e,t)})):"parallel"===t.type&&XT(t).every((function(t){return ox(e,t)}))}function ax(e){return new Set(pT(e.map((function(e){return e.tags}))))}function sx(e,t){if(e===t)return!0;if(void 0===e||void 0===t)return!1;if(CT(e)||CT(t))return e===t;var r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every((function(r){return sx(e[r],t[r])}))}var cx=function(){function e(e){var t,r,n=this;this.actions=[],this.activities=rT,this.meta={},this.events=[],this.value=e.value,this.context=e.context,this._event=e._event,this._sessionid=e._sessionid,this.event=this._event.data,this.historyValue=e.historyValue,this.history=e.history,this.actions=e.actions||[],this.activities=e.activities||rT,this.meta=(void 0===(r=e.configuration)&&(r=[]),r.reduce((function(e,t){return void 0!==t.meta&&(e[t.id]=t.meta),e}),{})),this.events=e.events||[],this.matches=this.matches.bind(this),this.toStrings=this.toStrings.bind(this),this.configuration=e.configuration,this.transitions=e.transitions,this.children=e.children,this.done=!!e.done,this.tags=null!==(t=Array.isArray(e.tags)?new Set(e.tags):e.tags)&&void 0!==t?t:new Set,this.machine=e.machine,Object.defineProperty(this,"nextEvents",{get:function(){return function(e){return jC([],UC(new Set(pT(jC([],UC(e.map((function(e){return e.ownEvents}))),!1)))),!1)}(n.configuration)}})}return e.from=function(t,r){return t instanceof e?t.context!==r?new e({value:t.value,context:r,_event:t._event,_sessionid:null,historyValue:t.historyValue,history:t.history,actions:[],activities:t.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):t:new e({value:t,context:r,_event:DT,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},e.create=function(t){return new e(t)},e.inert=function(t,r){if(t instanceof e){if(!t.actions.length)return t;var n=DT;return new e({value:t.value,context:r,_event:n,_sessionid:null,historyValue:t.historyValue,history:t.history,activities:t.activities,configuration:t.configuration,transitions:[],children:{}})}return e.from(t,r)},e.prototype.toStrings=function(e,t){var r=this;if(void 0===e&&(e=this.value),void 0===t&&(t="."),CT(e))return[e];var n=Object.keys(e);return n.concat.apply(n,jC([],UC(n.map((function(n){return r.toStrings(e[n],t).map((function(e){return n+t+e}))}))),!1))},e.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var t=e.tags;e.machine;var r=DC(e,["configuration","transitions","tags","machine"]);return PC(PC({},r),{tags:Array.from(t)})},e.prototype.matches=function(e){return oT(e,this.value)},e.prototype.hasTag=function(e){return this.tags.has(e)},e.prototype.can=function(e){var t;iT&&_T(!!this.machine,"state.can(...) used outside of a machine-created State object; this will always return false.");var r=null===(t=this.machine)||void 0===t?void 0:t.getTransitionData(this,e);return!!(null==r?void 0:r.transitions.length)&&r.transitions.some((function(e){return void 0!==e.target||e.actions.length}))},e}(),ux={deferEvents:!1},lx=function(){function e(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=PC(PC({},ux),e)}return e.prototype.initialize=function(e){if(this.initialized=!0,e){if(!this.options.deferEvents)return void this.schedule(e);this.process(e)}this.flushEvents()},e.prototype.schedule=function(e){if(this.initialized&&!this.processingEvent){if(0!==this.queue.length)throw new Error("Event queue should be empty when it is not processing events");this.process(e),this.flushEvents()}else this.queue.push(e)},e.prototype.clear=function(){this.queue=[]},e.prototype.flushEvents=function(){for(var e=this.queue.shift();e;)this.process(e),e=this.queue.shift()},e.prototype.process=function(e){this.processingEvent=!0;try{e()}catch(e){throw this.clear(),e}finally{this.processingEvent=!1}},e}(),dx=new Map,fx=0,hx=function(){return"x:".concat(fx++)},px=function(e,t){return dx.set(e,t),e},vx=function(e){return dx.get(e)},mx=function(e){dx.delete(e)};function gx(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==pv?pv:void(iT||console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues"))}function yx(e){if(gx()){var t=function(){var e=gx();if(e&&"__xstate__"in e)return e.__xstate__}();t&&t.register(e)}}function bx(e,t){void 0===t&&(t={});var r=e.initialState,n=new Set,i=[],o=!1,a=function(e){var t;return PC(((t={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}})[xT]=function(){return this},t),e)}({id:t.id,send:function(t){i.push(t),function(){if(!o){for(o=!0;i.length>0;){var t=i.shift();r=e.transition(r,t,s),n.forEach((function(e){return e.next(r)}))}o=!1}}()},getSnapshot:function(){return r},subscribe:function(e,t,i){var o=NT(e,t,i);return n.add(o),o.next(r),{unsubscribe:function(){n.delete(o)}}}}),s={parent:t.parent,self:a,id:t.id||"anonymous",observers:n};return r=e.start?e.start(s):r,a}var Ex,Sx={sync:!1,autoForward:!1};!function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(Ex||(Ex={}));var _x=function(){function e(t,r){var n=this;void 0===r&&(r=e.defaultOptions),this.machine=t,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=Ex.NotStarted,this.children=new Map,this.forwardTo=new Set,this.init=this.start,this.send=function(e,t){if(wT(e))return n.batch(e),n.state;var r=AT(IT(e,t));if(n.status===Ex.Stopped)return iT||_T(!1,'Event "'.concat(r.name,'" was sent to stopped service "').concat(n.machine.id,'". This service has already reached its final state, and will not transition.\nEvent: ').concat(JSON.stringify(r.data))),n.state;if(n.status!==Ex.Running&&!n.options.deferEvents)throw new Error('Event "'.concat(r.name,'" was sent to uninitialized service "').concat(n.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.\nEvent: ').concat(JSON.stringify(r.data)));return n.scheduler.schedule((function(){n.forward(r);var e=n.nextState(r);n.update(e,r)})),n._state},this.sendTo=function(e,t){var r,i=n.parent&&(t===NC.Parent||n.parent.id===t),o=i?n.parent:CT(t)?n.children.get(t)||vx(t):(r=t)&&"function"==typeof r.send?t:void 0;if(o)"machine"in o?(n.status!==Ex.Stopped||n.parent!==o||n.state.done)&&o.send(PC(PC({},e),{name:e.name===XC?"".concat(zT(n.id)):e.name,origin:n.sessionId})):o.send(e.data);else{if(!i)throw new Error("Unable to send event to child '".concat(t,"' from service '").concat(n.id,"'."));iT||_T(!1,"Service '".concat(n.id,"' has no parent: unable to send event ").concat(e.type))}},this._exec=function(e,t,r,i){void 0===i&&(i=n.machine.options.actions);var o=e.exec||FT(e.type,i),a=RT(o)?o:o?o.exec:e.exec;if(a)try{return a(t,r.data,n.machine.config.predictableActionArguments?{action:e,_event:r}:{action:e,state:n.state,_event:r})}catch(e){throw n.parent&&n.parent.send({type:"xstate.error",data:e}),e}switch(e.type){case GC:var s=e;if("number"==typeof s.delay)return void n.defer(s);s.to?n.sendTo(s._event,s.to):n.send(s._event);break;case WC:n.cancel(e.sendId);break;case BC:if(n.status!==Ex.Running)return;var c=e.activity;if(!n.machine.config.predictableActionArguments&&!n.state.activities[c.id||c.type])break;if(c.type===MC.Invoke){var u=MT(c.src),l=n.machine.options.services?n.machine.options.services[u.type]:void 0,d=c.id,f=c.data;iT||_T(!("forward"in c),"`forward` property is deprecated (found in invocation of '".concat(c.src,"' in in machine '").concat(n.machine.id,"'). ")+"Please use `autoForward` instead.");var h="autoForward"in c?c.autoForward:!!c.forward;if(!l)return void(iT||_T(!1,"No service found for invocation '".concat(c.src,"' in machine '").concat(n.machine.id,"'.")));var p=f?gT(f,t,r):void 0;if("string"==typeof l)return;var v=RT(l)?l(t,r.data,{data:p,src:u,meta:c.meta}):l;if(!v)return;var m=void 0;kT(v)&&(v=p?v.withContext(p):v,m={autoForward:h}),n.spawn(v,d,m)}else n.spawnActivity(c);break;case qC:n.stopChild(e.activity.id);break;case KC:var g=e.label,y=e.value;g?n.logger(g,y):n.logger(y);break;default:iT||_T(!1,"No implementation found for action type '".concat(e.type,"'"))}};var i=PC(PC({},e.defaultOptions),r),o=i.clock,a=i.logger,s=i.parent,c=i.id,u=void 0!==c?c:t.id;this.id=u,this.logger=a,this.clock=o,this.parent=s,this.options=i,this.scheduler=new lx({deferEvents:this.options.deferEvents}),this.sessionId=hx()}return Object.defineProperty(e.prototype,"initialState",{get:function(){var e=this;return this._initialState?this._initialState:KT(this,(function(){return e._initialState=e.machine.initialState,e._initialState}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return iT||_T(this.status!==Ex.NotStarted,"Attempted to read state from uninitialized service '".concat(this.id,"'. Make sure the service is started first.")),this._state},enumerable:!1,configurable:!0}),e.prototype.execute=function(e,t){var r,n;try{for(var i=FC(e.actions),o=i.next();!o.done;o=i.next()){var a=o.value;this.exec(a,e,t)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},e.prototype.update=function(e,t){var r,n,i,o,a,s,c,u,l=this;if(e._sessionid=this.sessionId,this._state=e,this.machine.config.predictableActionArguments&&t!==DT||!this.options.execute||this.execute(this.state),this.children.forEach((function(e){l.state.children[e.id]=e})),this.devTools&&this.devTools.send(t.data,e),e.event)try{for(var d=FC(this.eventListeners),f=d.next();!f.done;f=d.next()){(0,f.value)(e.event)}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}try{for(var h=FC(this.listeners),p=h.next();!p.done;p=h.next()){(0,p.value)(e,e.event)}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}try{for(var v=FC(this.contextListeners),m=v.next();!m.done;m=v.next()){(0,m.value)(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(e){a={error:e}}finally{try{m&&!m.done&&(s=v.return)&&s.call(v)}finally{if(a)throw a.error}}if(this.state.done){var g=e.configuration.find((function(e){return"final"===e.type&&e.parent===l.machine})),y=g&&g.doneData?gT(g.doneData,e.context,t):void 0;try{for(var b=FC(this.doneListeners),E=b.next();!E.done;E=b.next()){(0,E.value)(WT(this.id,y))}}catch(e){c={error:e}}finally{try{E&&!E.done&&(u=b.return)&&u.call(b)}finally{if(c)throw c.error}}this._stop()}},e.prototype.onTransition=function(e){return this.listeners.add(e),this.status===Ex.Running&&e(this.state,this.state.event),this},e.prototype.subscribe=function(e,t,r){var n=this,i=NT(e,t,r);this.listeners.add(i.next),this.status!==Ex.NotStarted&&i.next(this.state);var o=function e(){n.doneListeners.delete(e),n.stopListeners.delete(e),i.complete()};return this.status===Ex.Stopped?i.complete():(this.onDone(o),this.onStop(o)),{unsubscribe:function(){n.listeners.delete(i.next),n.doneListeners.delete(o),n.stopListeners.delete(o)}}},e.prototype.onEvent=function(e){return this.eventListeners.add(e),this},e.prototype.onSend=function(e){return this.sendListeners.add(e),this},e.prototype.onChange=function(e){return this.contextListeners.add(e),this},e.prototype.onStop=function(e){return this.stopListeners.add(e),this},e.prototype.onDone=function(e){return this.doneListeners.add(e),this},e.prototype.off=function(e){return this.listeners.delete(e),this.eventListeners.delete(e),this.sendListeners.delete(e),this.stopListeners.delete(e),this.doneListeners.delete(e),this.contextListeners.delete(e),this},e.prototype.start=function(e){var t=this;if(this.status===Ex.Running)return this;this.machine._init(),px(this.sessionId,this),this.initialized=!0,this.status=Ex.Running;var r=void 0===e?this.initialState:KT(this,(function(){return"object"==typeof(r=e)&&null!==r&&"value"in r&&"_event"in r?t.machine.resolveState(e):t.machine.resolveState(cx.from(e,t.machine.context));var r}));return this.options.devTools&&this.attachDev(),this.scheduler.initialize((function(){t.update(r,DT)})),this},e.prototype._stop=function(){var e,t,r,n,i,o,a,s,c,u;try{for(var l=FC(this.listeners),d=l.next();!d.done;d=l.next()){var f=d.value;this.listeners.delete(f)}}catch(t){e={error:t}}finally{try{d&&!d.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}try{for(var h=FC(this.stopListeners),p=h.next();!p.done;p=h.next()){(f=p.value)(),this.stopListeners.delete(f)}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}try{for(var v=FC(this.contextListeners),m=v.next();!m.done;m=v.next()){f=m.value;this.contextListeners.delete(f)}}catch(e){i={error:e}}finally{try{m&&!m.done&&(o=v.return)&&o.call(v)}finally{if(i)throw i.error}}try{for(var g=FC(this.doneListeners),y=g.next();!y.done;y=g.next()){f=y.value;this.doneListeners.delete(f)}}catch(e){a={error:e}}finally{try{y&&!y.done&&(s=g.return)&&s.call(g)}finally{if(a)throw a.error}}if(!this.initialized)return this;this.initialized=!1,this.status=Ex.Stopped,this._initialState=void 0;try{for(var b=FC(Object.keys(this.delayedEventsMap)),E=b.next();!E.done;E=b.next()){var S=E.value;this.clock.clearTimeout(this.delayedEventsMap[S])}}catch(e){c={error:e}}finally{try{E&&!E.done&&(u=b.return)&&u.call(b)}finally{if(c)throw c.error}}this.scheduler.clear(),this.scheduler=new lx({deferEvents:this.options.deferEvents})},e.prototype.stop=function(){var e=this,t=this.scheduler;return this._stop(),t.schedule((function(){var t=AT({type:"xstate.stop"}),r=KT(e,(function(){var r=pT(jC([],UC(e.state.configuration),!1).sort((function(e,t){return t.order-e.order})).map((function(t){return jT(t.onExit,e.machine.options.actions)}))),n=UC(HT(e.machine,e.state,e.state.context,t,r,e.machine.config.predictableActionArguments?e._exec:void 0,e.machine.config.predictableActionArguments||e.machine.config.preserveActionOrder),2),i=n[0],o=n[1],a=new cx({value:e.state.value,context:o,_event:t,_sessionid:e.sessionId,historyValue:void 0,history:e.state,actions:i.filter((function(e){return e.type!==VC&&(e.type!==GC||!!e.to&&e.to!==NC.Internal)})),activities:{},events:[],configuration:[],transitions:[],children:{},done:e.state.done,tags:e.state.tags,machine:e.machine});return a.changed=!0,a}));e.update(r,t),e.children.forEach((function(e){RT(e.stop)&&e.stop()})),e.children.clear(),mx(e.sessionId)})),this},e.prototype.batch=function(e){var t=this;if(this.status===Ex.NotStarted&&this.options.deferEvents)iT||_T(!1,"".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'" and are deferred. Make sure .start() is called for this service.\nEvent: ').concat(JSON.stringify(event)));else if(this.status!==Ex.Running)throw new Error("".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.'));this.scheduler.schedule((function(){var r,n,i=t.state,o=!1,a=[],s=function(e){var r=AT(e);t.forward(r),i=KT(t,(function(){return t.machine.transition(i,r)})),a.push.apply(a,jC([],UC(i.actions.map((function(e){return r=i,n=(t=e).exec,PC(PC({},t),{exec:void 0!==n?function(){return n(r.context,r.event,{action:t,state:r,_event:r._event})}:void 0});var t,r,n}))),!1)),o=o||!!i.changed};try{for(var c=FC(e),u=c.next();!u.done;u=c.next()){s(u.value)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}i.changed=o,i.actions=a,t.update(i,AT(e[e.length-1]))}))},e.prototype.sender=function(e){return this.send.bind(this,e)},e.prototype._nextState=function(e){var t=this,r=AT(e);if(0===r.name.indexOf(QC)&&!this.state.nextEvents.some((function(e){return 0===e.indexOf(QC)})))throw r.data.data;return KT(this,(function(){return t.machine.transition(t.state,r,void 0,t.machine.config.predictableActionArguments?t._exec:void 0)}))},e.prototype.nextState=function(e){return this._nextState(e)},e.prototype.forward=function(e){var t,r;try{for(var n=FC(this.forwardTo),i=n.next();!i.done;i=n.next()){var o=i.value,a=this.children.get(o);if(!a)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(o,"'."));a.send(e)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},e.prototype.defer=function(e){var t=this;this.delayedEventsMap[e.id]=this.clock.setTimeout((function(){e.to?t.sendTo(e._event,e.to):t.send(e._event)}),e.delay)},e.prototype.cancel=function(e){this.clock.clearTimeout(this.delayedEventsMap[e]),delete this.delayedEventsMap[e]},e.prototype.exec=function(e,t,r){void 0===r&&(r=this.machine.options.actions),this._exec(e,t.context,t._event,r)},e.prototype.removeChild=function(e){var t;this.children.delete(e),this.forwardTo.delete(e),null===(t=this.state)||void 0===t||delete t.children[e]},e.prototype.stopChild=function(e){var t=this.children.get(e);t&&(this.removeChild(e),RT(t.stop)&&t.stop())},e.prototype.spawn=function(e,t,r){if(this.status!==Ex.Running)return JT(e,t);if(yT(e))return this.spawnPromise(Promise.resolve(e),t);if(RT(e))return this.spawnCallback(e,t);if(function(e){try{return"function"==typeof e.send}catch(e){return!1}}(i=e)&&"id"in i)return this.spawnActor(e,t);if(function(e){try{return"subscribe"in e&&RT(e.subscribe)}catch(e){return!1}}(e))return this.spawnObservable(e,t);if(kT(e))return this.spawnMachine(e,PC(PC({},r),{id:t}));if(null!==(n=e)&&"object"==typeof n&&"transition"in n&&"function"==typeof n.transition)return this.spawnBehavior(e,t);throw new Error('Unable to spawn entity "'.concat(t,'" of type "').concat(typeof e,'".'));var n,i},e.prototype.spawnMachine=function(t,r){var n=this;void 0===r&&(r={});var i=new e(t,PC(PC({},this.options),{parent:this,id:r.id||t.id})),o=PC(PC({},Sx),r);o.sync&&i.onTransition((function(e){n.send(ZC,{state:e,id:i.id})}));var a=i;return this.children.set(i.id,a),o.autoForward&&this.forwardTo.add(i.id),i.onDone((function(e){n.removeChild(i.id),n.send(AT(e,{origin:i.id}))})).start(),a},e.prototype.spawnBehavior=function(e,t){var r=bx(e,{id:t,parent:this});return this.children.set(t,r),r},e.prototype.spawnPromise=function(e,t){var r,n,i=this,o=!1;e.then((function(e){o||(n=e,i.removeChild(t),i.send(AT(WT(t,e),{origin:t})))}),(function(e){if(!o){i.removeChild(t);var r=zT(t,e);try{i.send(AT(r,{origin:t}))}catch(n){!function(e,t,r){if(!iT){var n=e.stack?" Stacktrace was '".concat(e.stack,"'"):"";if(e===t)console.error("Missing onError handler for invocation '".concat(r,"', error was '").concat(e,"'.").concat(n));else{var i=t.stack?" Stacktrace was '".concat(t.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(r,"'. ")+"Original error: '".concat(e,"'. ").concat(n," Current error is '").concat(t,"'.").concat(i))}}}(e,n,t),i.devTools&&i.devTools.send(r,i.state),i.machine.strict&&i.stop()}}}));var a=((r={id:t,send:function(){},subscribe:function(t,r,n){var i=NT(t,r,n),o=!1;return e.then((function(e){o||(i.next(e),o||i.complete())}),(function(e){o||i.error(e)})),{unsubscribe:function(){return o=!0}}},stop:function(){o=!0},toJSON:function(){return{id:t}},getSnapshot:function(){return n}})[xT]=function(){return this},r);return this.children.set(t,a),a},e.prototype.spawnCallback=function(e,t){var r,n,i,o=this,a=!1,s=new Set,c=new Set;try{i=e((function(e){n=e,c.forEach((function(t){return t(e)})),a||o.send(AT(e,{origin:t}))}),(function(e){s.add(e)}))}catch(e){this.send(zT(t,e))}if(yT(i))return this.spawnPromise(i,t);var u=((r={id:t,send:function(e){return s.forEach((function(t){return t(e)}))},subscribe:function(e){var t=NT(e);return c.add(t.next),{unsubscribe:function(){c.delete(t.next)}}},stop:function(){a=!0,RT(i)&&i()},toJSON:function(){return{id:t}},getSnapshot:function(){return n}})[xT]=function(){return this},r);return this.children.set(t,u),u},e.prototype.spawnObservable=function(e,t){var r,n,i=this,o=e.subscribe((function(e){n=e,i.send(AT(e,{origin:t}))}),(function(e){i.removeChild(t),i.send(AT(zT(t,e),{origin:t}))}),(function(){i.removeChild(t),i.send(AT(WT(t),{origin:t}))})),a=((r={id:t,send:function(){},subscribe:function(t,r,n){return e.subscribe(t,r,n)},stop:function(){return o.unsubscribe()},getSnapshot:function(){return n},toJSON:function(){return{id:t}}})[xT]=function(){return this},r);return this.children.set(t,a),a},e.prototype.spawnActor=function(e,t){return this.children.set(t,e),e},e.prototype.spawnActivity=function(e){var t=this.machine.options&&this.machine.options.activities?this.machine.options.activities[e.type]:void 0;if(t){var r=t(this.state.context,e);this.spawnEffect(e.id,r)}else iT||_T(!1,"No implementation found for activity '".concat(e.type,"'"))},e.prototype.spawnEffect=function(e,t){var r;this.children.set(e,((r={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:t||void 0,getSnapshot:function(){},toJSON:function(){return{id:e}}})[xT]=function(){return this},r))},e.prototype.attachDev=function(){var e=gx();if(this.options.devTools&&e){if(e.__REDUX_DEVTOOLS_EXTENSION__){var t="object"==typeof this.options.devTools?this.options.devTools:void 0;this.devTools=e.__REDUX_DEVTOOLS_EXTENSION__.connect(PC(PC({name:this.id,autoPause:!0,stateSanitizer:function(e){return{value:e.value,context:e.context,actions:e.actions}}},t),{features:PC({jump:!1,skip:!1},t?t.features:void 0)}),this.machine),this.devTools.init(this.state)}yx(this)}},e.prototype.toJSON=function(){return{id:this.id}},e.prototype[xT]=function(){return this},e.prototype.getSnapshot=function(){return this.status===Ex.NotStarted?this.initialState:this._state},e.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(e){function t(t,r){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e,t){return setTimeout(e,t)})),clearTimeout:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){return clearTimeout(e)}))},logger:console.log.bind(console),devTools:!1},e.interpret=wx,e}();function wx(e,t){return new _x(e,t)}function Rx(e){if("string"==typeof e){var t={type:e,toString:function(){return e}};return t}return e}function Cx(e){return PC(PC({type:JC},e),{toJSON:function(){e.onDone,e.onError;var t=DC(e,["onDone","onError"]);return PC(PC({},t),{type:JC,src:Rx(e.src)})}})}var Tx="",xx="*",kx={},Ix=function(e){return"#"===e[0]},Ax=function(){function e(t,r,n,i){var o,a=this;void 0===n&&(n="context"in t?t.context:void 0),this.config=t,this._context=n,this.order=-1,this.__xstatenode=!0,this.__cache={events:void 0,relativeValue:new Map,initialStateValue:void 0,initialState:void 0,on:void 0,transitions:void 0,candidates:{},delayedTransitions:void 0},this.idMap={},this.tags=[],this.options=Object.assign({actions:{},guards:{},services:{},activities:{},delays:{}},r),this.parent=null==i?void 0:i.parent,this.key=this.config.key||(null==i?void 0:i.key)||this.config.id||"(machine)",this.machine=this.parent?this.parent.machine:this,this.path=this.parent?this.parent.path.concat(this.key):[],this.delimiter=this.config.delimiter||(this.parent?this.parent.delimiter:"."),this.id=this.config.id||jC([this.machine.key],UC(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:null!==(o=this.config.schema)&&void 0!==o?o:{},this.description=this.config.description,iT||_T(!("parallel"in this.config),'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel?"Replace with `type: 'parallel'`":"Use `type: '".concat(this.type,"'`")," in the config for state node '").concat(this.id,"' instead.")),this.initial=this.config.initial,this.states=this.config.states?lT(this.config.states,(function(t,r){var n,i=new e(t,{},void 0,{parent:a,key:r});return Object.assign(a.idMap,PC(((n={})[i.id]=i,n),i.idMap)),i})):kx;var s=0;!function e(t){var r,n;t.order=s++;try{for(var i=FC(QT(t)),o=i.next();!o.done;o=i.next()){e(o.value)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}(this),this.history=!0===this.config.history?"shallow":this.config.history||!1,this._transient=!!this.config.always||!!this.config.on&&(Array.isArray(this.config.on)?this.config.on.some((function(e){return e.event===Tx})):Tx in this.config.on),this.strict=!!this.config.strict,this.onEntry=mT(this.config.entry||this.config.onEntry).map((function(e){return UT(e)})),this.onExit=mT(this.config.exit||this.config.onExit).map((function(e){return UT(e)})),this.meta=this.config.meta,this.doneData="final"===this.type?this.config.data:void 0,this.invoke=mT(this.config.invoke).map((function(e,t){var r,n;if(kT(e)){var i=PT(a.id,t);return a.machine.options.services=PC(((r={})[i]=e,r),a.machine.options.services),Cx({src:i,id:i})}if(CT(e.src)){i=e.id||PT(a.id,t);return Cx(PC(PC({},e),{id:i,src:e.src}))}if(kT(e.src)||RT(e.src)){i=e.id||PT(a.id,t);return a.machine.options.services=PC(((n={})[i]=e.src,n),a.machine.options.services),Cx(PC(PC({id:i},e),{src:i}))}var o=e.src;return Cx(PC(PC({id:PT(a.id,t)},e),{src:o}))})),this.activities=mT(this.config.activities).concat(this.invoke).map((function(e){return BT(e)})),this.transition=this.transition.bind(this),this.tags=mT(this.config.tags)}return e.prototype._init=function(){this.__cache.transitions||ZT(this).forEach((function(e){return e.on}))},e.prototype.withConfig=function(t,r){var n=this.options,i=n.actions,o=n.activities,a=n.guards,s=n.services,c=n.delays;return new e(this.config,{actions:PC(PC({},i),t.actions),activities:PC(PC({},o),t.activities),guards:PC(PC({},a),t.guards),services:PC(PC({},s),t.services),delays:PC(PC({},c),t.delays)},null!=r?r:this.context)},e.prototype.withContext=function(t){return new e(this.config,this.options,t)},Object.defineProperty(e.prototype,"context",{get:function(){return RT(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"definition",{get:function(){return{id:this.id,key:this.key,version:this.version,context:this.context,type:this.type,initial:this.initial,history:this.history,states:lT(this.states,(function(e){return e.definition})),on:this.on,transitions:this.transitions,entry:this.onEntry,exit:this.onExit,activities:this.activities||[],meta:this.meta,order:this.order||-1,data:this.doneData,invoke:this.invoke,description:this.description,tags:this.tags}},enumerable:!1,configurable:!0}),e.prototype.toJSON=function(){return this.definition},Object.defineProperty(e.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var e=this.transitions;return this.__cache.on=e.reduce((function(e,t){return e[t.eventType]=e[t.eventType]||[],e[t.eventType].push(t),e}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),e.prototype.getCandidates=function(e){if(this.__cache.candidates[e])return this.__cache.candidates[e];var t=e===Tx,r=this.transitions.filter((function(r){var n=r.eventType===e;return t?n:n||r.eventType===xx}));return this.__cache.candidates[e]=r,r},e.prototype.getDelayedTransitions=function(){var e=this,t=this.config.after;if(!t)return[];var r=function(t,r){var n=function(e,t){var r=t?"#".concat(t):"";return"".concat(MC.After,"(").concat(e,")").concat(r)}(RT(t)?"".concat(e.id,":delay[").concat(r,"]"):t,e.id);return e.onEntry.push(VT(n,{delay:t})),e.onExit.push({type:WC,sendId:n}),n},n=wT(t)?t.map((function(e,t){var n=r(e.delay,t);return PC(PC({},e),{event:n})})):pT(Object.keys(t).map((function(e,n){var i=t[e],o=CT(i)?{target:i}:i,a=isNaN(+e)?e:+e,s=r(a,n);return mT(o).map((function(e){return PC(PC({},e),{event:s,delay:a})}))})));return n.map((function(t){var r=t.delay;return PC(PC({},e.formatTransition(t)),{delay:r})}))},e.prototype.getStateNodes=function(e){var t,r=this;if(!e)return[];var n=e instanceof cx?e.value:cT(e,this.delimiter);if(CT(n)){var i=this.getStateNode(n).initial;return void 0!==i?this.getStateNodes(((t={})[n]=i,t)):[this,this.states[n]]}var o=Object.keys(n),a=[this];return a.push.apply(a,jC([],UC(pT(o.map((function(e){return r.getStateNode(e).getStateNodes(n[e])})))),!1)),a},e.prototype.handles=function(e){var t=aT(e);return this.events.includes(t)},e.prototype.resolveState=function(e){var t=e instanceof cx?e:cx.create(e),r=Array.from(ex([],this.getStateNodes(t.value)));return new cx(PC(PC({},t),{value:this.resolve(t.value),configuration:r,done:ox(r,this),tags:ax(r),machine:this.machine}))},e.prototype.transitionLeafNode=function(e,t,r){var n=this.getStateNode(e).next(t,r);return n&&n.transitions.length?n:this.next(t,r)},e.prototype.transitionCompoundNode=function(e,t,r){var n=Object.keys(e),i=this.getStateNode(n[0])._transition(e[n[0]],t,r);return i&&i.transitions.length?i:this.next(t,r)},e.prototype.transitionParallelNode=function(e,t,r){var n,i,o={};try{for(var a=FC(Object.keys(e)),s=a.next();!s.done;s=a.next()){var c=s.value,u=e[c];if(u){var l=this.getStateNode(c)._transition(u,t,r);l&&(o[c]=l)}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}var d=Object.keys(o).map((function(e){return o[e]})),f=pT(d.map((function(e){return e.transitions})));if(!d.some((function(e){return e.transitions.length>0})))return this.next(t,r);var h=pT(d.map((function(e){return e.entrySet}))),p=pT(Object.keys(o).map((function(e){return o[e].configuration})));return{transitions:f,entrySet:h,exitSet:pT(d.map((function(e){return e.exitSet}))),configuration:p,source:t,actions:pT(Object.keys(o).map((function(e){return o[e].actions})))}},e.prototype._transition=function(e,t,r){return CT(e)?this.transitionLeafNode(e,t,r):1===Object.keys(e).length?this.transitionCompoundNode(e,t,r):this.transitionParallelNode(e,t,r)},e.prototype.getTransitionData=function(e,t){return this._transition(e.value,e,AT(t))},e.prototype.next=function(e,t){var r,n,i,o=this,a=t.name,s=[],c=[];try{for(var u=FC(this.getCandidates(a)),l=u.next();!l.done;l=u.next()){var d=l.value,f=d.cond,h=d.in,p=e.context,v=!h||(CT(h)&&Ix(h)?e.matches(cT(this.getStateNodeById(h).path,this.delimiter)):oT(cT(h,this.delimiter),fT(this.path.slice(0,-2))(e.value))),m=!1;try{m=!f||LT(this.machine,f,p,t,e)}catch(e){throw new Error("Unable to evaluate guard '".concat(f.name||f.type,"' in transition for event '").concat(a,"' in state node '").concat(this.id,"':\n").concat(e.message))}if(m&&v){void 0!==d.target&&(c=d.target),s.push.apply(s,jC([],UC(d.actions),!1)),i=d;break}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}if(i){if(!c.length)return{transitions:[i],entrySet:[],exitSet:[],configuration:e.value?[this]:[],source:e,actions:s};var g=pT(c.map((function(t){return o.getRelativeStateNodes(t,e.historyValue)}))),y=!!i.internal,b=[];return y||c.forEach((function(e){b.push.apply(b,jC([],UC(o.getExternalReentryNodes(e)),!1))})),{transitions:[i],entrySet:b,exitSet:y?[]:[this],configuration:g,source:e,actions:s}}},e.prototype.getExternalReentryNodes=function(e){for(var t=[],r=UC(e.order>this.order?[e,this]:[this,e],2),n=r[0],i=r[1];n&&n!==i;)t.push(n),n=n.parent;return n!==i?[]:(t.push(i),t)},e.prototype.getActions=function(e,t,r,n,i,o){var a,s,c,u,l=ex([],o?this.getStateNodes(o.value):[this]);try{for(var d=FC(e),f=d.next();!f.done;f=d.next()){ix(l,v=f.value)&&!ix(r.entrySet,v.parent)||r.entrySet.push(v)}}catch(e){a={error:e}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(a)throw a.error}}try{for(var h=FC(l),p=h.next();!p.done;p=h.next()){var v;ix(e,v=p.value)&&!ix(r.exitSet,v.parent)||r.exitSet.push(v)}}catch(e){c={error:e}}finally{try{p&&!p.done&&(u=h.return)&&u.call(h)}finally{if(c)throw c.error}}var m=pT(r.entrySet.map((function(e){var t=[];if("final"!==e.type)return t;var o=e.parent;if(!o.parent)return t;t.push(GT(e.id,e.doneData),GT(o.id,e.doneData?gT(e.doneData,n,i):void 0));var a=o.parent;return"parallel"===a.type&&XT(a).every((function(e){return ox(r.configuration,e)}))&&t.push(GT(a.id)),t})));r.exitSet.sort((function(e,t){return t.order-e.order})),r.entrySet.sort((function(e,t){return e.order-t.order}));var g=new Set(r.entrySet),y=new Set(r.exitSet),b=UC([pT(Array.from(g).map((function(e){return jC(jC([],UC(e.activities.map((function(e){return function(e){var t=BT(e);return{type:MC.Start,activity:t,exec:void 0}}(e)}))),!1),UC(e.onEntry),!1)}))).concat(m.map(qT)),pT(Array.from(y).map((function(e){return jC(jC([],UC(e.onExit),!1),UC(e.activities.map((function(e){return function(e){var t=RT(e)?e:BT(e);return{type:MC.Stop,activity:t,exec:void 0}}(e)}))),!1)})))],2),E=b[0],S=b[1],_=jT(S.concat(r.actions).concat(E),this.machine.options.actions);if(t){var w=jT(pT(jC([],UC(e),!1).sort((function(e,t){return t.order-e.order})).map((function(e){return e.onExit}))),this.machine.options.actions).filter((function(e){return e.type!==VC&&(e.type!==GC||!!e.to&&e.to!==NC.Internal)}));return _.concat(w)}return _},e.prototype.transition=function(e,t,r,n){void 0===e&&(e=this.initialState);var i,o,a=AT(t);if(e instanceof cx)i=void 0===r?e:this.resolveState(cx.from(e,r));else{var s=CT(e)?this.resolve(uT(this.getResolvedPath(e))):this.resolve(e),c=null!=r?r:this.machine.context;i=this.resolveState(cx.from(s,c))}if(!iT&&a.name===xx)throw new Error("An event cannot have the wildcard type ('".concat(xx,"')"));if(this.strict&&!this.events.includes(a.name)&&(o=a.name,!/^(done|error)\./.test(o)))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(a.name,"'"));var u=this._transition(i.value,i,a)||{transitions:[],configuration:[],entrySet:[],exitSet:[],source:i,actions:[]},l=ex([],this.getStateNodes(i.value)),d=u.configuration.length?ex(l,u.configuration):l;return u.configuration=jC([],UC(d),!1),this.resolveTransition(u,i,i.context,n,a)},e.prototype.resolveRaisedTransition=function(e,t,r,n){var i,o=e.actions;return(e=this.transition(e,t,void 0,n))._event=r,e.event=r.data,(i=e.actions).unshift.apply(i,jC([],UC(o),!1)),e},e.prototype.resolveTransition=function(e,t,r,n,i){var o,a,s=this;void 0===i&&(i=DT);var c=e.configuration,u=!t||e.transitions.length>0,l=u?e.configuration:t?t.configuration:[],d=ox(l,this),f=u?nx(this.machine,c):void 0,h=t?t.historyValue?t.historyValue:e.source?this.machine.historyValue(t.value):void 0:void 0,p=this.getActions(new Set(l),d,e,r,i,t),v=t?PC({},t.activities):{};try{for(var m=FC(p),g=m.next();!g.done;g=m.next()){var y=g.value;y.type===BC?v[y.activity.id||y.activity.type]=y:y.type===qC&&(v[y.activity.id||y.activity.type]=!1)}}catch(e){o={error:e}}finally{try{g&&!g.done&&(a=m.return)&&a.call(m)}finally{if(o)throw o.error}}var b,E,S=UC(HT(this,t,r,i,p,n,this.machine.config.predictableActionArguments||this.machine.config.preserveActionOrder),2),_=S[0],w=S[1],R=UC(bT(_,(function(e){return e.type===VC||e.type===GC&&e.to===NC.Internal})),2),C=R[0],T=R[1],x=_.filter((function(e){var t;return e.type===BC&&(null===(t=e.activity)||void 0===t?void 0:t.type)===JC})),k=x.reduce((function(e,t){return e[t.activity.id]=function(e,t,r,n){var i,o=MT(e.src),a=null===(i=null==t?void 0:t.options.services)||void 0===i?void 0:i[o.type],s=e.data?gT(e.data,r,n):void 0,c=a?JT(a,e.id,s):$T(e.id);return c.meta=e,c}(t.activity,s.machine,w,i),e}),t?PC({},t.children):{}),I=new cx({value:f||t.value,context:w,_event:i,_sessionid:t?t._sessionid:null,historyValue:f?h?(b=h,E=f,{current:E,states:ET(b,E)}):void 0:t?t.historyValue:void 0,history:!f||e.source?t:void 0,actions:f?T:[],activities:f?v:t?t.activities:{},events:[],configuration:l,transitions:e.transitions,children:k,done:d,tags:ax(l),machine:this}),A=r!==w;I.changed=i.name===ZC||A;var O=I.history;O&&delete O.history;var L=!d&&(this._transient||c.some((function(e){return e._transient})));if(!(u||L&&i.name!==Tx))return I;var M=I;if(!d)for(L&&(M=this.resolveRaisedTransition(M,{type:zC},i,n));C.length;){var N=C.shift();M=this.resolveRaisedTransition(M,N._event,i,n)}var P=M.changed||(O?!!M.actions.length||A||typeof O.value!=typeof M.value||!sx(M.value,O.value):void 0);return M.changed=P,M.history=O,M},e.prototype.getStateNode=function(e){if(Ix(e))return this.machine.getStateNodeById(e);if(!this.states)throw new Error("Unable to retrieve child state '".concat(e,"' from '").concat(this.id,"'; no child states exist."));var t=this.states[e];if(!t)throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"));return t},e.prototype.getStateNodeById=function(e){var t=Ix(e)?e.slice(1):e;if(t===this.id)return this;var r=this.machine.idMap[t];if(!r)throw new Error("Child state node '#".concat(t,"' does not exist on machine '").concat(this.id,"'"));return r},e.prototype.getStateNodeByPath=function(e){if("string"==typeof e&&Ix(e))try{return this.getStateNodeById(e.slice(1))}catch(e){}for(var t=sT(e,this.delimiter).slice(),r=this;t.length;){var n=t.shift();if(!n.length)break;r=r.getStateNode(n)}return r},e.prototype.resolve=function(e){var t,r=this;if(!e)return this.initialStateValue||kx;switch(this.type){case"parallel":return lT(this.initialStateValue,(function(t,n){return t?r.getStateNode(n).resolve(e[n]||t):kx}));case"compound":if(CT(e)){var n=this.getStateNode(e);return"parallel"===n.type||"compound"===n.type?((t={})[e]=n.initialStateValue,t):e}return Object.keys(e).length?lT(e,(function(e,t){return e?r.getStateNode(t).resolve(e):kx})):this.initialStateValue||{};default:return e||kx}},e.prototype.getResolvedPath=function(e){if(Ix(e)){var t=this.machine.idMap[e.slice(1)];if(!t)throw new Error("Unable to find state node '".concat(e,"'"));return t.path}return sT(e,this.delimiter)},Object.defineProperty(e.prototype,"initialStateValue",{get:function(){var e,t;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;if("parallel"===this.type)t=dT(this.states,(function(e){return e.initialStateValue||kx}),(function(e){return!("history"===e.type)}));else if(void 0!==this.initial){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));t=YT(this.states[this.initial])?this.initial:((e={})[this.initial]=this.states[this.initial].initialStateValue,e)}else t={};return this.__cache.initialStateValue=t,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),e.prototype.getInitialState=function(e,t){this._init();var r=this.getStateNodes(e);return this.resolveTransition({configuration:r,entrySet:jC([],UC(r),!1),exitSet:[],transitions:[],source:void 0,actions:[]},void 0,null!=t?t:this.machine.context,void 0)},Object.defineProperty(e.prototype,"initialState",{get:function(){var e=this.initialStateValue;if(!e)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){var e;if("history"===this.type){var t=this.config;e=CT(t.target)&&Ix(t.target)?uT(this.machine.getStateNodeById(t.target).path.slice(this.path.length-1)):t.target}return e},enumerable:!1,configurable:!0}),e.prototype.getRelativeStateNodes=function(e,t,r){return void 0===r&&(r=!0),r?"history"===e.type?e.resolveHistory(t):e.initialStateNodes:[e]},Object.defineProperty(e.prototype,"initialStateNodes",{get:function(){var e=this;return YT(this)?[this]:"compound"!==this.type||this.initial?pT(hT(this.initialStateValue).map((function(t){return e.getFromRelativePath(t)}))):(iT||_T(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this])},enumerable:!1,configurable:!0}),e.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var t=UC(e),r=t[0],n=t.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(r,"' from node with no states"));var i=this.getStateNode(r);if("history"===i.type)return i.resolveHistory();if(!this.states[r])throw new Error("Child state '".concat(r,"' does not exist on '").concat(this.id,"'"));return this.states[r].getFromRelativePath(n)},e.prototype.historyValue=function(e){if(Object.keys(this.states).length)return{current:e||this.initialStateValue,states:dT(this.states,(function(t,r){if(!e)return t.historyValue();var n=CT(e)?void 0:e[r];return t.historyValue(n||t.initialStateValue)}),(function(e){return!e.history}))}},e.prototype.resolveHistory=function(e){var t=this;if("history"!==this.type)return[this];var r=this.parent;if(!e){var n=this.target;return n?pT(hT(n).map((function(e){return r.getFromRelativePath(e)}))):r.initialStateNodes}var i,o,a=(i=r.path,o="states",function(e){var t,r,n=e;try{for(var a=FC(i),s=a.next();!s.done;s=a.next()){var c=s.value;n=n[o][c]}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return n})(e).current;return CT(a)?[r.getStateNode(a)]:pT(hT(a).map((function(e){return"deep"===t.history?r.getFromRelativePath(e):[r.states[e[0]]]})))},Object.defineProperty(e.prototype,"stateIds",{get:function(){var e=this,t=pT(Object.keys(this.states).map((function(t){return e.states[t].stateIds})));return[this.id].concat(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"events",{get:function(){var e,t,r,n;if(this.__cache.events)return this.__cache.events;var i=this.states,o=new Set(this.ownEvents);if(i)try{for(var a=FC(Object.keys(i)),s=a.next();!s.done;s=a.next()){var c=i[s.value];if(c.states)try{for(var u=(r=void 0,FC(c.events)),l=u.next();!l.done;l=u.next()){var d=l.value;o.add("".concat(d))}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(o)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ownEvents",{get:function(){var e=new Set(this.transitions.filter((function(e){return!(!e.target&&!e.actions.length&&e.internal)})).map((function(e){return e.eventType})));return Array.from(e)},enumerable:!1,configurable:!0}),e.prototype.resolveTarget=function(e){var t=this;if(void 0!==e)return e.map((function(e){if(!CT(e))return e;var r=e[0]===t.delimiter;if(r&&!t.parent)return t.getStateNodeByPath(e.slice(1));var n=r?t.key+e:e;if(!t.parent)return t.getStateNodeByPath(n);try{return t.parent.getStateNodeByPath(n)}catch(e){throw new Error("Invalid transition definition for state node '".concat(t.id,"':\n").concat(e.message))}}))},e.prototype.formatTransition=function(e){var t=this,r=function(e){if(void 0!==e&&""!==e)return mT(e)}(e.target),n="internal"in e?e.internal:!r||r.some((function(e){return CT(e)&&e[0]===t.delimiter})),i=this.machine.options.guards,o=this.resolveTarget(r),a=PC(PC({},e),{actions:jT(mT(e.actions)),cond:TT(e.cond,i),target:o,source:this,internal:n,eventType:e.event,toJSON:function(){return PC(PC({},a),{target:a.target?a.target.map((function(e){return"#".concat(e.id)})):void 0,source:"#".concat(t.id)})}});return a},e.prototype.formatTransitions=function(){var e,t,r,n=this;if(this.config.on)if(Array.isArray(this.config.on))r=this.config.on;else{var i=this.config.on,o=xx,a=i[o],s=void 0===a?[]:a,c=DC(i,["*"]);r=pT(Object.keys(c).map((function(e){iT||e!==Tx||_T(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(n.id,'".'));var t=OT(e,c[e]);return iT||function(e,t,r){var n=r.slice(0,-1).some((function(e){return!("cond"in e)&&!("in"in e)&&(CT(e.target)||kT(e.target))})),i=t===Tx?"the transient event":"event '".concat(t,"'");_T(!n,"One or more transitions for ".concat(i," on state '").concat(e.id,"' are unreachable. ")+"Make sure that the default transition is the last one defined.")}(n,e,t),t})).concat(OT(xx,s)))}else r=[];var u=this.config.always?OT("",this.config.always):[],l=this.config.onDone?OT(String(GT(this.id)),this.config.onDone):[];iT||_T(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var d=pT(this.invoke.map((function(e){var t=[];return e.onDone&&t.push.apply(t,jC([],UC(OT(String(WT(e.id)),e.onDone)),!1)),e.onError&&t.push.apply(t,jC([],UC(OT(String(zT(e.id)),e.onError)),!1)),t}))),f=this.after,h=pT(jC(jC(jC(jC([],UC(l),!1),UC(d),!1),UC(r),!1),UC(u),!1).map((function(e){return mT(e).map((function(e){return n.formatTransition(e)}))})));try{for(var p=FC(f),v=p.next();!v.done;v=p.next()){var m=v.value;h.push(m)}}catch(t){e={error:t}}finally{try{v&&!v.done&&(t=p.return)&&t.call(p)}finally{if(e)throw e.error}}return h},e}(),Ox=!1;var Lx=function(e){return{type:HC,assignment:e}};function Mx(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Nx(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Mx(Object(r),!0).forEach((function(t){bp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mx(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Px=4294967294;class Dx extends cp{constructor(e,t,r,n,i){super(),bp(this,"id",void 0),bp(this,"createLocalOfferCallback",void 0),bp(this,"handleRemoteOfferCallback",void 0),bp(this,"handleRemoteAnswerCallback",void 0),bp(this,"stateMachine",void 0),bp(this,"initiateOfferPromises",void 0),this.id=n||"ROAP",this.createLocalOfferCallback=e,this.handleRemoteOfferCallback=t,this.handleRemoteAnswerCallback=r,this.initiateOfferPromises=[];var o=function(e,t){return iT||e.predictableActionArguments||Ox||(Ox=!0,console.warn("It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html")),new Ax(e,t)}({tsTypes:{},schema:{context:{},events:{},services:{}},preserveActionOrder:!0,id:"roap",initial:"idle",context:{seq:i||0,pendingLocalOffer:!1,isHandlingOfferRequest:!1,retryCounter:0,isOkInTransaction:true},states:{browserError:{onEntry:(e,t)=>{this.error("FSM","browserError state onEntry: context=".concat(JSON.stringify(e),":"),t.data),this.emit(hR.ROAP_FAILURE,t.data)}},remoteError:{onEntry:(e,t)=>{this.log("FSM","remoteError state onEntry called, emitting MediaConnectionEventNames.ROAP_FAILURE"),this.emit(hR.ROAP_FAILURE,t.data)}},idle:{always:{cond:"isPendingLocalOffer",actions:["increaseSeq","sendStartedEvent"],target:"creatingLocalOffer"},on:{INITIATE_OFFER:{actions:["increaseSeq","sendStartedEvent"],target:"creatingLocalOffer"},REMOTE_OFFER_ARRIVED:[{cond:"isSameSeq",actions:"sendOutOfOrderError"},{actions:["updateSeq","sendStartedEvent"],target:"settingRemoteOffer"}],REMOTE_OFFER_REQUEST_ARRIVED:[{cond:"isSameSeq",actions:"sendOutOfOrderError"},{actions:["updateSeq","setOfferRequestFlag","sendStartedEvent"],target:"creatingLocalOffer"}],REMOTE_ANSWER_ARRIVED:[{cond:"isSameSeq",actions:"sendRoapOKMessage"},{actions:"sendInvalidStateError"}],REMOTE_OK_ARRIVED:{actions:"sendInvalidStateError"}}},creatingLocalOffer:{invoke:{src:"createLocalOffer",onDone:[{cond:"isPendingLocalOffer",target:"creatingLocalOffer"},{cond:"isHandlingOfferRequest",actions:["sendRoapOfferResponseMessage","resolvePendingInitiateOfferPromises"],target:"waitingForAnswer"},{actions:["sendRoapOfferMessage","resolvePendingInitiateOfferPromises"],target:"waitingForAnswer"}],onError:{actions:"rejectPendingInitiateOfferPromises",target:"browserError"}},onEntry:["resetPendingLocalOffer"],on:{INITIATE_OFFER:{actions:"enqueueNewOfferCreation"},REMOTE_OFFER_ARRIVED:[{actions:"handleGlare"}],REMOTE_OFFER_REQUEST_ARRIVED:[{cond:"isHandlingOfferRequest",actions:"ignoreDuplicate"},{actions:"handleGlare"}],REMOTE_ANSWER_ARRIVED:{actions:"sendInvalidStateError"},REMOTE_OK_ARRIVED:{actions:"sendInvalidStateError"}}},waitingForAnswer:{on:{REMOTE_ANSWER_ARRIVED:[{actions:["resetRetryCounter","updateSeq","updateIsOkInTransaction"],target:"settingRemoteAnswer"}],INITIATE_OFFER:{actions:"enqueueNewOfferCreation"},REMOTE_OFFER_ARRIVED:{actions:"handleGlare"},REMOTE_OFFER_REQUEST_ARRIVED:[{cond:"isHandlingOfferRequest",actions:"ignoreDuplicate"},{actions:"handleGlare"}],REMOTE_OK_ARRIVED:{actions:"sendInvalidStateError"},ERROR_ARRIVED:[{cond:"shouldErrorTriggerOfferRetry",actions:["increaseSeq","increaseRetryCounter"],target:"creatingLocalOffer"},{cond:"isSameSeq",target:"remoteError"}]}},settingRemoteAnswer:{invoke:{src:"handleRemoteAnswer",onDone:[{cond:"isOkInTransaction",actions:["sendRoapOKMessage","resetOfferRequestFlag","sendDoneEvent"],target:"idle"},{actions:["resetOfferRequestFlag","sendDoneEvent"],target:"idle"}],onError:{actions:"sendGenericError",target:"browserError"}},on:{INITIATE_OFFER:{actions:"enqueueNewOfferCreation"},REMOTE_OFFER_ARRIVED:[{cond:"isOkInTransaction",actions:"sendInvalidStateError"},{actions:"sendRetryStateError"}],REMOTE_OFFER_REQUEST_ARRIVED:[{cond:"isOkInTransaction",actions:"sendInvalidStateError"},{actions:"sendRetryStateError"}],REMOTE_ANSWER_ARRIVED:[{cond:"isSameSeq",actions:"ignoreDuplicate"},{actions:"sendInvalidStateError"}],REMOTE_OK_ARRIVED:{actions:"sendInvalidStateError"}}},settingRemoteOffer:{invoke:{src:"handleRemoteOffer",onDone:{actions:["resetOkInTransaction","sendRoapAnswerMessage"],target:"waitingForOK"},onError:{actions:"sendGenericError",target:"browserError"}},on:{INITIATE_OFFER:{actions:"enqueueNewOfferCreation"},REMOTE_OFFER_ARRIVED:[{cond:"isSameSeq",actions:"ignoreDuplicate"},{actions:"sendRetryAfterError"}],REMOTE_OFFER_REQUEST_ARRIVED:{actions:"sendInvalidStateError"},REMOTE_ANSWER_ARRIVED:{actions:"sendInvalidStateError"},REMOTE_OK_ARRIVED:{actions:"sendInvalidStateError"}}},waitingForOK:{on:{REMOTE_OK_ARRIVED:[{actions:["updateSeq","sendDoneEvent"],target:"idle"}],INITIATE_OFFER:{actions:"enqueueNewOfferCreation"},REMOTE_OFFER_ARRIVED:[{cond:"isSameSeq",actions:"ignoreDuplicate"},{actions:"sendInvalidStateError"}],REMOTE_OFFER_REQUEST_ARRIVED:{actions:"sendInvalidStateError"},REMOTE_ANSWER_ARRIVED:{actions:"sendInvalidStateError"},ERROR_ARRIVED:{cond:"isSameSeq",target:"remoteError"}}}}},{services:{createLocalOffer:()=>this.createLocalOfferCallback(),handleRemoteAnswer:(e,t)=>this.handleRemoteAnswerCallback(t.sdp),handleRemoteOffer:(e,t)=>this.handleRemoteOfferCallback(t.sdp)},actions:{enqueueNewOfferCreation:Lx((e=>Nx(Nx({},e),{},{pendingLocalOffer:!0}))),resetPendingLocalOffer:Lx((e=>Nx(Nx({},e),{},{pendingLocalOffer:!1}))),increaseSeq:Lx((e=>Nx(Nx({},e),{},{seq:e.seq+1}))),updateSeq:Lx(((e,t)=>Nx(Nx({},e),{},{seq:t.seq}))),increaseRetryCounter:Lx((e=>Nx(Nx({},e),{},{retryCounter:e.retryCounter+1}))),resetRetryCounter:Lx((e=>Nx(Nx({},e),{},{retryCounter:0}))),setOfferRequestFlag:Lx((e=>Nx(Nx({},e),{},{isHandlingOfferRequest:!0}))),resetOfferRequestFlag:Lx((e=>Nx(Nx({},e),{},{isHandlingOfferRequest:!1}))),handleGlare:(e,t)=>{t.tieBreaker===Px?this.sendErrorMessage(t.seq,vR.DOUBLECONFLICT):this.sendErrorMessage(t.seq,vR.CONFLICT)},sendRoapOfferMessage:(e,t)=>this.sendRoapOfferMessage(e.seq,t.data.sdp),sendRoapOfferResponseMessage:(e,t)=>this.sendRoapOfferResponseMessage(e.seq,t.data.sdp),sendRoapOKMessage:e=>this.sendRoapOkMessage(e.seq),sendRoapAnswerMessage:(e,t)=>this.sendRoapAnswerMessage(e.seq,t.data.sdp),sendStartedEvent:()=>this.sendStartedEvent(),sendDoneEvent:()=>this.sendDoneEvent(),sendGenericError:e=>this.sendErrorMessage(e.seq,vR.FAILED),sendInvalidStateError:(e,t)=>this.sendErrorMessage(t.seq,vR.INVALID_STATE),sendRetryStateError:(e,t)=>this.sendErrorMessage(t.seq,vR.RETRY),sendOutOfOrderError:(e,t)=>this.sendErrorMessage(t.seq,vR.OUT_OF_ORDER),sendRetryAfterError:(e,t)=>this.sendErrorMessage(t.seq,vR.FAILED,{retryAfter:Math.floor(11*Math.random())}),ignoreDuplicate:(e,t)=>this.log("FSM","ignoring duplicate roap message ".concat(t.type," with seq=").concat(t.seq)),resolvePendingInitiateOfferPromises:()=>this.resolvePendingInitiateOfferPromises(),rejectPendingInitiateOfferPromises:(e,t)=>this.rejectPendingInitiateOfferPromises(t.data),updateIsOkInTransaction:Lx(((e,t)=>{var r;return Nx(Nx({},e),{},{isOkInTransaction:!(null!==(r=t.headers)&&void 0!==r&&r.includes("noOkInTransaction"))})})),resetOkInTransaction:Lx((e=>Nx(Nx({},e),{},{isOkInTransaction:true})))},guards:{isPendingLocalOffer:e=>e.pendingLocalOffer,isHandlingOfferRequest:e=>e.isHandlingOfferRequest,isSameSeq:(e,t)=>t.seq===e.seq&&(this.log("FSM","incoming roap message seq is same as current context seq: ".concat(t.seq)),!0),shouldErrorTriggerOfferRetry:(e,t)=>{if([vR.DOUBLECONFLICT,vR.INVALID_STATE,vR.OUT_OF_ORDER,vR.RETRY].includes(t.errorType)){if(t.seq===e.seq&&e.retryCounter<2)return this.log("FSM","retryable error message received with matching seq and retryCounter ".concat(e.retryCounter," < ").concat(2)),!0;t.seq!==e.seq?this.log("FSM","ignoring error message with wrong seq: ".concat(t.seq," !== ").concat(e.seq)):this.log("FSM","reached max retries: retryCounter=".concat(e.retryCounter))}return!1},isOkInTransaction:e=>e.isOkInTransaction}});this.stateMachine=wx(o).onTransition(((e,t)=>this.log("onTransition","state=".concat(e.value,", event=").concat(JSON.stringify(t))))).start()}log(e,t){yw().info("".concat(this.id,":").concat(e," ").concat(t))}error(e,t,r){yw().error("".concat(this.id,":").concat(e," ").concat(t," ").concat(Sw(r)))}sendRoapOfferMessage(e,t){this.log("sendRoapOfferMessage","emitting ROAP OFFER"),this.emit(hR.ROAP_MESSAGE_TO_SEND,{roapMessage:{seq:e,messageType:"OFFER",sdp:t,tieBreaker:Px}})}sendRoapOfferResponseMessage(e,t){this.log("sendRoapOfferResponseMessage","emitting ROAP OFFER RESPONSE"),this.emit(hR.ROAP_MESSAGE_TO_SEND,{roapMessage:{seq:e,messageType:"OFFER_RESPONSE",sdp:t}})}sendRoapOkMessage(e){this.log("sendRoapOkMessage","emitting ROAP OK"),this.emit(hR.ROAP_MESSAGE_TO_SEND,{roapMessage:{seq:e,messageType:"OK"}})}sendRoapAnswerMessage(e,t){this.log("sendRoapAnswerMessage","emitting ROAP ANSWER"),this.emit(hR.ROAP_MESSAGE_TO_SEND,{roapMessage:{seq:e,messageType:"ANSWER",sdp:t}})}sendDoneEvent(){this.log("sendDoneEvent","emitting ROAP DONE"),this.emit(hR.ROAP_DONE)}sendStartedEvent(){this.log("sendStartedEvent","emitting ROAP STARTED"),this.emit(hR.ROAP_STARTED)}sendErrorMessage(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{retryAfter:n}=r;this.log("sendErrorMessage","emitting ROAP ERROR (".concat(t,")")),this.emit(hR.ROAP_MESSAGE_TO_SEND,{roapMessage:{seq:e,messageType:"ERROR",errorType:t,retryAfter:n}})}getStateMachine(){return this.stateMachine}initiateOffer(){return new Promise(((e,t)=>{this.initiateOfferPromises.push({resolve:e,reject:t}),this.stateMachine.send("INITIATE_OFFER")}))}resolvePendingInitiateOfferPromises(){for(;this.initiateOfferPromises.length>0;){var e=this.initiateOfferPromises.shift();null==e||e.resolve()}}rejectPendingInitiateOfferPromises(e){for(;this.initiateOfferPromises.length>0;){var t=this.initiateOfferPromises.shift();null==t||t.reject(e)}}validateIncomingRoapMessage(e){var t,{errorType:r,messageType:n,seq:i}=e,o=!0;return i<this.stateMachine.state.context.seq&&(o=!1,"ERROR"!==n?(t=vR.OUT_OF_ORDER,this.error("validateIncomingRoapMessage","received roap message ".concat(n," with seq too low: ").concat(i," < ").concat(this.stateMachine.state.context.seq))):this.error("validateIncomingRoapMessage","received ERROR message ".concat(r," with seq too low: ").concat(i," < ").concat(this.stateMachine.state.context.seq,", ignoring it"))),{isValid:o,errorToSend:t}}roapMessageReceived(e){var{errorCause:t,errorType:r,headers:n,messageType:i,sdp:o,seq:a,tieBreaker:s}=e,{isValid:c,errorToSend:u}=this.validateIncomingRoapMessage(e);if(c)switch(i){case"ANSWER":this.stateMachine.send("REMOTE_ANSWER_ARRIVED",{sdp:o,seq:a,headers:n});break;case"OFFER":this.stateMachine.send("REMOTE_OFFER_ARRIVED",{sdp:o,seq:a,tieBreaker:s});break;case"OFFER_REQUEST":this.stateMachine.send("REMOTE_OFFER_REQUEST_ARRIVED",{seq:a,tieBreaker:s});break;case"OK":this.stateMachine.send("REMOTE_OK_ARRIVED",{sdp:o,seq:a});break;case"ERROR":this.error("roapMessageReceived","Error received: seq=".concat(a," type=").concat(r," cause=").concat(t)),r===vR.CONFLICT&&this.error("roapMessageReceived","CONFLICT error type received - this should never happen, because we use the tieBreaker value ".concat(Px)),this.stateMachine.send("ERROR_ARRIVED",{seq:a,errorType:r});break;case"OFFER_RESPONSE":this.error("roapMessageReceived","Received unexpected OFFER_RESPONSE: seq=".concat(a));break;default:throw this.error("roapMessageReceived()","unsupported messageType: ".concat(i)),new Error("unhandled messageType")}else u&&this.sendErrorMessage(a,u)}stop(){this.stateMachine.stop()}getSeq(){return this.stateMachine.state.context.seq}}function Fx(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ux(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Fx(Object(r),!0).forEach((function(t){bp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fx(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class jx extends cp{constructor(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:()=>{},i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:()=>{},o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:()=>{};super(),bp(this,"id",void 0),bp(this,"debugId",void 0),bp(this,"mediaConnection",void 0),bp(this,"roap",void 0),bp(this,"sdpNegotiationStarted",void 0),bp(this,"closeCallback",void 0),bp(this,"sendMetricsCallback",void 0),this.debugId=r,this.id=r||"RoapMediaConnection",this.sdpNegotiationStarted=!1,bw(r),this.log("constructor()","config: ".concat(JSON.stringify(e),", options: ").concat(JSON.stringify(t))),this.mediaConnection=this.createMediaConnection({mediaConnectionConfig:e,options:t,metricsCallback:n,debugId:r}),this.roap=this.createRoap(r),this.closeCallback=i,this.sendMetricsCallback=o}log(e,t){yw().info("".concat(this.id,":").concat(e," ").concat(t))}error(e,t,r){yw().error("".concat(this.id,":").concat(e," ").concat(t," ").concat(Sw(r)))}forwardEvent(e,t){var r=this;e.on(t,(function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];r.emit(t,...n)}))}createMediaConnection(e){var{mediaConnectionConfig:t,options:r,metricsCallback:n,debugId:i}=e,o=new IR(t,r,n,i);return o.on(hR.REMOTE_TRACK_ADDED,this.onRemoteTrack.bind(this)),this.forwardEvent(o,hR.PEER_CONNECTION_STATE_CHANGED),this.forwardEvent(o,hR.ICE_CONNECTION_STATE_CHANGED),this.forwardEvent(o,hR.REMOTE_SDP_ANSWER_PROCESSED),this.forwardEvent(o,hR.REMOTE_SDP_OFFER_PROCESSED),this.forwardEvent(o,hR.LOCAL_SDP_ANSWER_GENERATED),this.forwardEvent(o,hR.LOCAL_SDP_OFFER_GENERATED),this.forwardEvent(o,hR.DTMF_TONE_CHANGED),this.forwardEvent(o,hR.ICE_GATHERING_STATE_CHANGED),this.forwardEvent(o,hR.ICE_CANDIDATE),this.forwardEvent(o,hR.ICE_CANDIDATE_ERROR),o}createRoap(e,t){var r=new Dx(this.createLocalOffer.bind(this),this.handleRemoteOffer.bind(this),this.handleRemoteAnswer.bind(this),e,t);return r.on(hR.ROAP_MESSAGE_TO_SEND,(e=>this.emit(hR.ROAP_MESSAGE_TO_SEND,e))),r.on(hR.ROAP_STARTED,(()=>this.emit(hR.ROAP_STARTED))),r.on(hR.ROAP_DONE,(()=>this.emit(hR.ROAP_DONE))),r.on(hR.ROAP_FAILURE,(e=>this.emit(hR.ROAP_FAILURE,e))),r}initiateOffer(){return this.log("initiateOffer()","called"),this.sdpNegotiationStarted?(this.error("initiateOffer()","SDP negotiation already started"),Promise.reject(new Error("SDP negotiation already started"))):(this.mediaConnection.initializeTransceivers(!1),this.sdpNegotiationStarted=!0,this.roap.initiateOffer())}close(){this.log("close()","called"),this.closeMediaConnection(),this.stopRoapSession(),this.closeCallback()}forceRtcMetricsSend(){var e=this;return ep((function*(){var t;yield null===(t=e.mediaConnection)||void 0===t?void 0:t.forceRtcMetricsCallback(),e.sendMetricsCallback()}))()}closeMediaConnection(){this.mediaConnection.close(),this.mediaConnection.removeAllListeners()}stopRoapSession(){this.roap.stop(),this.roap.removeAllListeners()}reconnect(e){var t=arguments,r=this;return ep((function*(){var n=!(t.length>1&&void 0!==t[1])||t[1];r.log("reconnect()","initiated");var i=r.mediaConnection.getSendReceiveOptions(),o=r.roap.getSeq(),a=r.mediaConnection.getMetricsCallback();r.stopRoapSession(),r.closeMediaConnection(),r.sdpNegotiationStarted=!1;var s=yield e;r.log("reconnect()","iceServers: ".concat(JSON.stringify(s)));var c=Ux(Ux({},r.mediaConnection.getConfig()),{},{iceServers:s});return r.mediaConnection=r.createMediaConnection({mediaConnectionConfig:c,options:i,metricsCallback:a,debugId:r.debugId}),r.roap=r.createRoap(r.debugId,o),n?r.initiateOffer():Promise.resolve()}))()}updateLocalTracks(e){return this.log("updateLocalTracks()","called with ".concat(JSON.stringify(e))),this.mediaConnection.updateLocalTracks(e)?(this.log("updateLocalTracks()","triggering offer..."),this.roap.initiateOffer()):Promise.resolve()}updateDirection(e){return this.log("updateDirection()","called with ".concat(JSON.stringify(e))),this.mediaConnection.updateDirection(e)?(this.log("updateDirection()","triggering offer..."),this.roap.initiateOffer()):Promise.resolve()}updateRemoteQualityLevel(e){return this.log("updateRemoteQualityLevel()","called with ".concat(e)),this.mediaConnection.updateRemoteQualityLevel(e)?(this.log("updateRemoteQualityLevel()","triggering offer..."),this.roap.initiateOffer()):Promise.resolve()}update(e){return this.log("update()","called with ".concat(JSON.stringify(e))),this.mediaConnection.update(e)?(this.log("update()","triggering offer..."),this.roap.initiateOffer()):Promise.resolve()}getPeerConnectionState(){return this.mediaConnection.getPeerConnectionState()}getIceConnectionState(){return this.mediaConnection.getIceConnectionState()}getConnectionState(){return this.mediaConnection.getConnectionState()}getIceGatheringState(){return this.mediaConnection.getIceGatheringState()}getStats(){return this.mediaConnection.getStats()}getTransceiverStats(){return this.mediaConnection.getTransceiverStats()}insertDTMF(e,t,r){this.log("insertDTMF()",'called with tones="'.concat(e,'", duration=').concat(t,", interToneGap=").concat(r)),this.mediaConnection.insertDTMF(e,t,r)}roapMessageReceived(e){this.log("roapMessageReceived()","called with messageType=".concat(e.messageType,", seq=").concat(e.seq)),this.sdpNegotiationStarted||("OFFER"===e.messageType&&(this.sdpNegotiationStarted=!0,this.mediaConnection.initializeTransceivers(!0)),"OFFER_REQUEST"===e.messageType&&(this.sdpNegotiationStarted=!0,this.mediaConnection.initializeTransceivers(!1))),this.roap.roapMessageReceived(e)}onRemoteTrack(e){this.emit(hR.REMOTE_TRACK_ADDED,e)}createLocalOffer(){return this.mediaConnection.createLocalOffer()}handleRemoteOffer(e){return this.mediaConnection.handleRemoteOffer(e)}handleRemoteAnswer(e){return this.mediaConnection.handleRemoteAnswer(e)}}function Bx(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function qx(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Bx(Object(r),!0).forEach((function(t){bp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bx(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class Vx extends cp{constructor(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:()=>{},i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:()=>{};super(),bp(this,"id",void 0),bp(this,"debugId",void 0),bp(this,"multistreamConnection",void 0),bp(this,"roap",void 0),bp(this,"sdpNegotiationStarted",!1),bp(this,"closeCallback",void 0),bp(this,"sendMetricsCallback",void 0),this.debugId=t,this.id=t||"MultistreamRoapMediaConnection",bw(t),this.log("constructor()","config: ".concat(JSON.stringify(e))),this.multistreamConnection=this.createMultistreamConnection(e,r),this.roap=this.createRoap(t),this.closeCallback=n,this.sendMetricsCallback=i}log(e,t){yw().info("".concat(this.id,":").concat(e," ").concat(t))}warn(e,t){yw().warn("".concat(this.id,":").concat(e," ").concat(t))}error(e,t,r){yw().error("".concat(this.id,":").concat(e," ").concat(t," ").concat(Sw(r)))}createMultistreamConnection(e,t){this.log("createMultistreamConnection()","called");var r=new cw(qx(qx({},e),{},{metricsCallback:t}));return r.on(ow.ActiveSpeakerNotification,(e=>{this.emit(hR.ACTIVE_SPEAKERS_CHANGED,e)})),r.on(ow.AudioSourceCountUpdate,((e,t,r)=>{this.emit(hR.AUDIO_SOURCES_COUNT_CHANGED,e,t,r)})),r.on(ow.VideoSourceCountUpdate,((e,t,r)=>{this.emit(hR.VIDEO_SOURCES_COUNT_CHANGED,e,t,r)})),r.on(ow.PeerConnectionStateUpdate,(e=>{this.emit(hR.PEER_CONNECTION_STATE_CHANGED,{state:e})})),r.on(ow.IceConnectionStateUpdate,(e=>{this.emit(hR.ICE_CONNECTION_STATE_CHANGED,{state:e})})),r.on(ow.IceGatheringStateUpdate,(e=>{this.emit(hR.ICE_GATHERING_STATE_CHANGED,{state:e})})),r.on(ow.NegotiationNeeded,(()=>{this.onNegotiationNeeded()})),r.on(ow.IceCandidate,(e=>{this.emit(hR.ICE_CANDIDATE,{candidate:e.candidate})})),r.on(ow.IceCandidateError,(e=>{this.emit(hR.ICE_CANDIDATE_ERROR,{error:e})})),r}createRoap(e,t){var r=new Dx(this.createLocalOffer.bind(this),this.handleRemoteOffer.bind(this),this.handleRemoteAnswer.bind(this),e,t);return r.on(hR.ROAP_MESSAGE_TO_SEND,(e=>this.emit(hR.ROAP_MESSAGE_TO_SEND,e))),r.on(hR.ROAP_STARTED,(()=>this.emit(hR.ROAP_STARTED))),r.on(hR.ROAP_DONE,(()=>this.emit(hR.ROAP_DONE))),r.on(hR.ROAP_FAILURE,(e=>this.emit(hR.ROAP_FAILURE,e))),r}onNegotiationNeeded(){return this.log("onNegotiationNeeded()","called"),this.sdpNegotiationStarted?this.roap.initiateOffer():Promise.resolve()}initiateOffer(){return this.log("initiateOffer()","called"),this.sdpNegotiationStarted?(this.error("initiateOffer()","SDP negotiation already started"),Promise.reject(new Error("SDP negotiation already started"))):(this.sdpNegotiationStarted=!0,this.roap.initiateOffer())}close(){this.log("close()","called"),this.closeMediaConnection(),this.stopRoapSession(),this.closeCallback()}forceRtcMetricsSend(){var e=this;return ep((function*(){var t;yield null===(t=e.multistreamConnection)||void 0===t?void 0:t.forceRtcMetricsCallback(),e.sendMetricsCallback()}))()}closeMediaConnection(){this.multistreamConnection.close(),this.multistreamConnection.removeAllListeners()}stopRoapSession(){this.roap.stop(),this.roap.removeAllListeners()}reconnect(e){var t=arguments,r=this;return ep((function*(){var n=!(t.length>1&&void 0!==t[1])||t[1];r.log("reconnect()","initiated");var i=r.roap.getSeq();r.stopRoapSession(),r.sdpNegotiationStarted=!1;var o=Promise.resolve(e).then((e=>({iceServers:e}))).catch((()=>{throw new Error("Failed to collect user options for reconnect")}));return yield r.multistreamConnection.renewPeerConnection(o),r.roap=r.createRoap(r.debugId,i),n?r.initiateOffer():Promise.resolve()}))()}getConnectionState(){var e=this.multistreamConnection.getConnectionState();return this.log("getConnectionState()","called, returning ".concat(e)),e}getPeerConnectionState(){return this.multistreamConnection.getPeerConnectionState()}getIceConnectionState(){return this.multistreamConnection.getIceConnectionState()}getStats(){return this.multistreamConnection.getStats()}getTransceiverStats(){return this.multistreamConnection.getTransceiverStats()}roapMessageReceived(e){if(this.log("roapMessageReceived()","called with messageType=".concat(e.messageType,", seq=").concat(e.seq)),!this.sdpNegotiationStarted&&"OFFER"===e.messageType)throw new Error("incoming first offer is not supported by MultistreamRoapMediaConnection");this.roap.roapMessageReceived(e)}createSendSlot(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.log("createSendSlot()","called with mediaType=".concat(e,", active=").concat(t)),this.multistreamConnection.createSendSlot(e,t)}createReceiveSlot(e){return this.log("createReceiveSlot()","called"),this.multistreamConnection.createReceiveSlot(e)}requestMedia(e,t){return this.log("requestMedia()","called"),this.multistreamConnection.requestMedia(e,t)}createLocalOffer(){return this.log("createLocalOffer()","calling this.multistreamConnection.createOffer"),this.multistreamConnection.createOffer().then((e=>e.sdp?(this.emit(hR.LOCAL_SDP_OFFER_GENERATED),{sdp:e.sdp}):Promise.reject(new nv("empty local SDP")))).catch((e=>{throw new nv("createLocalOffer() failure: ".concat(e.message),{cause:e})}))}handleRemoteOffer(){return Promise.reject(new ov("remote offers not supported by WCME"))}waitForIceCandidates(){return this.log("waitForIceCandidates()","called"),new Promise(((e,t)=>{if("complete"!==this.multistreamConnection.getIceGatheringState()){var r,n=t=>{"complete"===t&&(this.multistreamConnection.removeListener(ow.IceGatheringStateUpdate,n),clearTimeout(r),e())};r=setTimeout((()=>{this.multistreamConnection.removeListener(ow.IceGatheringStateUpdate,n),t(new Error("Timed out waiting for ice candidates gathering"))}),5e3),this.multistreamConnection.addListener(ow.IceGatheringStateUpdate,n)}else e()}))}handleRemoteAnswer(e){var t=this;return ep((function*(){if(t.log("handleRemoteAnswer()","called: sdp=".concat(e?"non-empty":"empty")),e){try{yield t.waitForIceCandidates()}catch(e){var{message:r}=e;t.warn("handleRemoteAnswer()","".concat(r))}var n=CR({},e);return t.log("handleRemoteAnswer()","calling this.multistreamConnection.setAnswer"),t.multistreamConnection.setAnswer(n).then((e=>(t.log("handleRemoteAnswer()","this.multistreamConnection.setAnswer resolved"),t.emit(hR.REMOTE_SDP_ANSWER_PROCESSED),e))).catch((e=>{throw t.log("handleRemoteAnswer()","this.multistreamConnection.setAnswer failed"),new tv("handleRemoteAnswer() failure: ".concat(e.message),{cause:e})}))}return Promise.reject(new tv("empty answer"))}))()}getIceGatheringState(){return this.multistreamConnection.getIceGatheringState()}}var Gx=av,Wx=function(e){if(!e.match(/^([0-9]{1,3}\.){3}[0-9]{1,3}$/))return!1;var t=e.split(".");for(var r of t){if(Number(r)>255)return!1}return!0},zx=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;if("::"===(e=e.toLowerCase()))return!0;if(!e.match(/^([0-9a-f]{0,4}:?){2,8}$/))return!1;if(":"===e[e.length-1]&&":"!==e[e.length-2])return!1;if(e.split("::").length>2)return!1;if(1===e.split("::").length&&e.split(":").length!==t)return!1;if(2===e.split("::").length){var r=e.split("::")[1];r=r.split(":");for(var n=0;n<r.length-1;n++)if(""===r[n])return!1}return!0},Hx=function(e){var[t,r]=ek(e);return zx(t,6)&&Wx(r)},Kx=function(e,t){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"0";e.length<t;)e+=r;return e},$x=function(e,t){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"0";e.length<t;)e=r+e;return e},Jx=function(e,t){for(var r=[];e.length>0;){var n=e.substring(0,t);r.push(n),e=e.substring(t)}return r},Yx=function(e){return Number(e).toString(2)},Qx=function(e){return parseInt(e,2)},Xx=function(e){return e.split(".").map((e=>$x(Yx(e),8))).join("")},Zx=function(e){return e.toString(16)},ek=function(e){var t=e.lastIndexOf(":"),r=e.substring(0,t),n=e.substring(t+1);return":"===r[r.length-1]&&(r+=":"),[r,n]},tk=function(e){var[t,r]=ek(e),[n,i]=t.split("::");for(n=n.split(":"),i=void 0!==i?i.split(":"):[];n.length+i.length<6;)n.push("0");for(var o=n.concat(i),a=0;a<o.length;a++)0===o[a].length&&(o[a]="0");var s=o.map((e=>parseInt(e,16))).map((e=>$x(Yx(e),16)));return s.join("")+Xx(r)},rk=function(e){return Jx(e,8).map(Qx).join(".")},nk=function(e){var t=function(e){for(var t=e.split(":"),r=0,n=null,i=!1,o=0,a=null,s=0;s<t.length;s++)i?"0"===t[s]?o++:(o>r&&(r=o,n=a),i=!1,o=0,a=null):"0"===t[s]&&(i=!0,o=1,a=s);return null!==a&&o>r&&(r=o,n=a),r<2?e:t.slice(0,n).join(":")+"::"+t.slice(n+r).join(":")}(Jx(e,16).map(Qx).map(Zx).join(":"));return t},ik=function(e,t){var r=function(e){var[t,r]=e.split("::");for(t=t.split(":"),r=void 0!==r?r.split(":"):[];t.length+r.length<8;)t.push("0");for(var n=t.concat(r),i=0;i<n.length;i++)0===n[i].length&&(n[i]="0");var o=n.map((e=>parseInt(e,16))).map((e=>$x(Yx(e),16)));return o.join("")}(e),n=r.substring(0,t),i=Kx(n,128);return nk(i)},ok=function(e,t){var r=tk(e).substring(0,t);return function(e){var t=e.substring(0,96),r=e.substring(96),n=nk(t),i=rk(r),o=n;return":"!==o[o.length-1]&&(o+=":"),o+i}(Kx(r,128))},ak=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:24;if("string"!=typeof e)return null;var n=function(e){return Wx(e)?"IPv4":zx(e)?"IPv6":Hx(e)?"IPv6_4":"None"}(e=e.trim().toLowerCase());return"IPv4"===n?function(e,t){var r=Xx(e).substring(0,t),n=Kx(r,32);return rk(n)}(e,t):"IPv6"===n?ik(e,r):"IPv6_4"===n?function(e){return Hx(e)&&(!tk(e).substring(0,96).includes("1")||!tk(e).substring(0,80).includes("1")&&!tk(e).substring(80,96).includes("0"))}(e)?ok(e,t+96):ok(e,r):null};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==pv||"undefined"!=typeof self&&self;function sk(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ck={exports:{}};!function(e,t){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=90)}({17:function(e,t,r){t.__esModule=!0,t.default=void 0;var n=r(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||""},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||""},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,r,n){void 0===n&&(n=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(r),a=Math.max(i,o),s=0,c=e.map([t,r],(function(t){var r=a-e.getVersionPrecision(t),n=t+new Array(r+1).join(".0");return e.map(n.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(n&&(s=a-Math.min(i,o)),a-=1;a>=s;){if(c[0][a]>c[1][a])return 1;if(c[0][a]===c[1][a]){if(a===s)return 0;a-=1}else if(c[0][a]<c[1][a])return-1}},e.map=function(e,t){var r,n=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)n.push(t(e[r]));return n},e.find=function(e,t){var r,n;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(r=0,n=e.length;r<n;r+=1){var i=e[r];if(t(i,r))return i}},e.assign=function(e){for(var t,r,n=e,i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var s=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){n[t]=e[t]}))};for(t=0,r=o.length;t<r;t+=1)s();return e},e.getBrowserAlias=function(e){return n.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return n.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,r){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(91))&&n.__esModule?n:{default:n},o=r(18);function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s=function(){function e(){}var t,r,n;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,n=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(r=null)&&a(t.prototype,r),n&&a(t,n),e}();t.default=s,e.exports=t.default},91:function(e,t,r){t.__esModule=!0,t.default=void 0;var n=c(r(92)),i=c(r(93)),o=c(r(94)),a=c(r(95)),s=c(r(17));function c(e){return e&&e.__esModule?e:{default:e}}var u=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=s.default.find(n.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=s.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=s.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=s.default.find(a.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return s.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,r={},n=0,i={},o=0;if(Object.keys(e).forEach((function(t){var a=e[t];"string"==typeof a?(i[t]=a,o+=1):"object"==typeof a&&(r[t]=a,n+=1)})),n>0){var a=Object.keys(r),c=s.default.find(a,(function(e){return t.isOS(e)}));if(c){var u=this.satisfies(r[c]);if(void 0!==u)return u}var l=s.default.find(a,(function(e){return t.isPlatform(e)}));if(l){var d=this.satisfies(r[l]);if(void 0!==d)return d}}if(o>0){var f=Object.keys(i),h=s.default.find(f,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),n=e.toLowerCase(),i=s.default.getBrowserTypeByAlias(n);return t&&i&&(n=i.toLowerCase()),n===r},t.compareVersion=function(e){var t=[0],r=e,n=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(n=!0,r=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(n=!0,r=e.substr(1)),t.indexOf(s.default.compareVersions(i,r,n))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=u,e.exports=t.default},92:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},r=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},r=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},r=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},r=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},r=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},r=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},r=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},r=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},r=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},r=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},r=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},r=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},r=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},r=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},r=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},r=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},r=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},r=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},r=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},r=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},r=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t={name:"Android Browser"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},r=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=i.default.getMacOSVersionName(t),n={name:o.OS_MAP.MacOS,version:t};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=i.default.getAndroidVersionName(t),n={name:o.OS_MAP.Android,version:t};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:o.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},r=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},r=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},r=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},r=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=a,e.exports=t.default}})}(ck);var uk,lk,dk,fk=sk(ck.exports);!function(e){e.CHROME="Chrome",e.FIREFOX="Firefox",e.EDGE="Microsoft Edge",e.SAFARI="Safari"}(uk||(uk={})),function(e){e.WINDOWS="Windows",e.MAC="macOS",e.LINUX="Linux"}(lk||(lk={})),fk.getParser(window.navigator.userAgent);class hk{static getNumLogicalCores(){return navigator.hardwareConcurrency}}!function(e){e.CpuPressureStateChange="cpu-pressure-state-change"}(dk||(dk={}));class pk extends rp{constructor(){super(),this.lastCpuPressure=void 0,pk.isPressureObserverSupported()&&(this.observer=new PressureObserver(this.handleStateChange.bind(this)),this.observer&&this.observer.observe("cpu"))}handleStateChange(e){e.forEach((e=>{"cpu"===e.source&&e.state!==this.lastCpuPressure&&(this.lastCpuPressure=e.state,this.emit(dk.CpuPressureStateChange,e.state))}))}getCpuPressure(){return this.lastCpuPressure}static isPressureObserverSupported(){return"PressureObserver"in window}}var vk,mk=new pk;class gk{static isPressureObserverSupported(){return pk.isPressureObserverSupported()}static getCpuPressure(){if(gk.isPressureObserverSupported())return mk.getCpuPressure()}static onCpuPressureChange(e){if(gk.isPressureObserverSupported()){mk.on(dk.CpuPressureStateChange,e);var t=gk.getCpuPressure();void 0!==t&&e(t)}}static offCpuPressureChange(e){gk.isPressureObserverSupported()&&mk.off(dk.CpuPressureStateChange,e)}static getNumLogicalCores(){return navigator.hardwareConcurrency}}!function(e){e.NOT_CAPABLE="not capable",e.CAPABLE="capable",e.UNKNOWN="unknown"}(vk||(vk={}));var yk,bk,Ek=6e4,Sk="0.0.0.0",_k="unknown";!function(e){e.NONE="AUDIO_BACKGROUND_NOISE_REDUCTION_NONE",e.LOW_POWER="AUDIO_BACKGROUND_NOISE_REDUCTION_LOW_POWER"}(yk||(yk={})),function(e){e.NONE="VIDEO_BACKGROUND_AUGMENT_NONE",e.BLUR="VIDEO_BACKGROUND_AUGMENT_BLUR",e.REPLACE_IMAGE="VIDEO_BACKGROUND_AUGMENT_REPLACE_IMAGE",e.REPLACE_VIDEO="VIDEO_BACKGROUND_AUGMENT_REPLACE_VIDEO"}(bk||(bk={}));var wk,Rk,Ck={intervalNumber:0,intervalMetadata:{},audioTransmit:[],audioReceive:[],videoTransmit:[],videoReceive:[]},Tk={isMain:!0,mariFecEnabled:!1,mariQosEnabled:!1,multistreamEnabled:!0,direction:"inactive"},xk={common:Tk,fecPackets:0,fecBitrate:0,rtpPackets:0,rtpBitrate:0,rtpHopByHopLost:0,mediaHopByHopLost:0,rtpRecovered:0,rtcpPackets:0,rtcpBitrate:0,stunPackets:0,stunBitrate:0,dtlsPackets:0,dtlsBitrate:0,transportType:"UDP",maxBitrate:0,srtpUnprotectErrors:0},kk={ssci:0,rtpPackets:0,rtpEndToEndLost:0,concealedFrames:0,maxConcealRunLength:0,receivedBitrate:0,requestedBitrate:0,optimalBitrate:0,csi:[],codec:""},Ik={common:kk},Ak={common:Tk,fecPackets:0,fecBitrate:0,rtpPackets:0,rtpBitrate:0,rtcpPackets:0,rtcpBitrate:0,stunPackets:0,stunBitrate:0,dtlsPackets:0,dtlsBitrate:0,transportType:"UDP",maxBitrate:0,availableBitrate:0,queueDelay:0},Ok={ssci:0,rtpPackets:0,transmittedBitrate:0,requestedBitrate:0,codec:""},Lk={common:Ok},Mk={common:kk,receivedFrameSize:0,requestedFrameSize:0,optimalFrameSize:0,receivedHeight:0,receivedWidth:0,receivedKeyFrames:0,requestedKeyFrames:0,h264CodecProfile:"BP"},Nk={common:Ok,transmittedFrameSize:0,requestedFrameSize:0,transmittedHeight:0,transmittedWidth:0,transmittedKeyFrames:0,requestedKeyFrames:0,localConfigurationChanges:0,remoteConfigurationChanges:0,h264CodecProfile:"BP"},Pk=e=>0===e.length?0:Math.max(...e),Dk=e=>0===e.length?0:Math.min(...e),Fk=e=>0===e.length?0:e.reduce(((e,t)=>e+t))/e.length,Uk=(e,t)=>0===t?0:8*e/(t/1e3),jk=(e,t)=>0===t?0:100*e/(t/1e3),Bk=e=>{var t=new Map;return e.forEach((e=>{e.report.forEach(((e,r)=>t.set(r,e)))})),t},qk=(e,t,r)=>{var n;return null===(n=e.get(t))||void 0===n?void 0:n[r]},Vk=(e,t,r)=>{var n;return e.forEach((e=>{e.type===t&&void 0!==e[r]&&(n=e[r])})),n},Gk=(e,t,r)=>{var n=[];return e.forEach((e=>{e.type===t&&void 0!==e[r]&&n.push(e[r])})),n},Wk=(e,t,r)=>{var n=0;return e.forEach((e=>{if(e.type===t&&void 0!==e[r]){var i=e[r];if("number"!=typeof i)throw Error("Attempted to get sum of property ".concat(r," which is not a number"));n+=i}})),n},zk=e=>{var t,r=null!==(t=Vk(e,"inbound-rtp","transportId"))&&void 0!==t?t:Vk(e,"outbound-rtp","transportId");if(r){var n=qk(e,r,"selectedCandidatePairId");if(n)return n}for(var[i,o]of e)if("candidate-pair"===o.type&&o.selected)return i},Hk=(e,t)=>{var r=zk(e);if(r)return qk(e,r,"local"===t?"localCandidateId":"remoteCandidateId")},Kk=e=>{var t=Hk(e,"local");if(t){var r=qk(e,t,"relayProtocol");if(r)return r.toUpperCase();var n=qk(e,t,"protocol");if(n)return n.toUpperCase()}},$k=e=>{var t,r=0;return e.forEach((e=>{"media-source"===e.type&&e.trackLabel&&e.timestamp>r&&(t=e.trackLabel,r=e.timestamp)})),t},Jk=(e,t)=>{var r=qk(e,t,"codecId");if(r){var n=qk(e,r,"mimeType");if(n)return n.split("/")[1]}},Yk=(e,t)=>{var r=qk(e,t,"codecId");if(r){var n=qk(e,r,"sdpFmtpLine");if(n){var i,o=null===(i=n.match(/profile-level-id=([0-9A-Fa-f]{6})/))||void 0===i?void 0:i[1];if(o){var a=o.substring(0,2);if("42"===a)return"BP";if("64"===a)return"CHP"}}}},Qk=e=>{var t,r=e.isRequestedArray;return null!==(t=null==r?void 0:r.some((e=>!0===e)))&&void 0!==t&&t},Xk=e=>{var t,r=e.sourceStateArray;return null!==(t=null==r?void 0:r.some((e=>"live"===e)))&&void 0!==t&&t},Zk=(e,t)=>{var r=e=>16*Math.ceil(e/16);return r(e)*r(t)/256};class eI{constructor(e){bp(this,"currentIntervalStats",new Map),bp(this,"previousIntervalStats",new Map),bp(this,"isMain",void 0),bp(this,"multistreamEnabled",void 0),bp(this,"direction",void 0),bp(this,"mediaKind",void 0),this.isMain=e.isMain,this.multistreamEnabled=e.multistreamEnabled,this.direction=e.direction,this.mediaKind=e.mediaKind}updateCurrentIntervalStats(e){0!==e.size?(e.forEach(((e,t)=>{var r=this.currentIntervalStats.get(t),n=(t,n)=>{var i,o=null!==(i=null==r?void 0:r[t])&&void 0!==i?i:[];void 0!==n&&o.push(n),o.length>0&&(e[t]=o)};if("inbound-rtp"===e.type){var i,o,a,s,c,u,l;n("isRequestedArray",e.isRequested),n("sourceStateArray",e.sourceState),n("jitterArray",e.jitter);var d=null!==(i=e.jitterBufferDelay)&&void 0!==i?i:0,f=null!==(o=null==r?void 0:r.jitterBufferDelay)&&void 0!==o?o:0,h=null!==(a=e.jitterBufferEmittedCount)&&void 0!==a?a:0,p=null!==(s=null==r?void 0:r.jitterBufferEmittedCount)&&void 0!==s?s:0,v=0;if(h-p>0){var m=d-f,g=h-p;v=Math.round(m/g*1e3)}n("jitterBufferDelayPerEmitArray",v),n("requestedBitrateArray",e.requestedBitrate),n("csiArray",e.csi);var y=null!==(c=null==r?void 0:r.rtpPacketSizeArray)&&void 0!==c?c:[],b=null!==(u=e.bytesReceived)&&void 0!==u?u:0,E=null!==(l=e.packetsReceived)&&void 0!==l?l:0;if(E>0){var S=Math.round(b/E);y.push(S)}if(e.rtpPacketSizeArray=y,"video"===this.mediaKind){var _,w,R,C,T,x,k,I,A,O,L,M,N,P,D,F,U,j,B=null!==(_=e.requestedFrameSize)&&void 0!==_?_:0,q=null!==(w=null==r?void 0:r.maxRequestedFrameSize)&&void 0!==w?w:0,V=B>=q;e.maxRequestedFrameSize=V?B:q,e.maxRequestedBitrateForMaxRequestedFrameSize=V?Math.max(null!==(R=e.requestedBitrate)&&void 0!==R?R:0,null!==(C=null==r?void 0:r.maxRequestedBitrateForMaxRequestedFrameSize)&&void 0!==C?C:0):null==r?void 0:r.maxRequestedBitrateForMaxRequestedFrameSize;var G=null!==(T=null==r?void 0:r.bytesReceived)&&void 0!==T?T:0;e.maxBitrateForMaxRequestedFrameSize=V?Math.max(Uk(b-G,5e3),null!==(x=null==r?void 0:r.maxBitrateForMaxRequestedFrameSize)&&void 0!==x?x:0):null==r?void 0:r.maxBitrateForMaxRequestedFrameSize,e.maxRequestedFrameRateForMaxRequestedFrameSize=V?Math.max(null!==(k=e.requestedFrameRate)&&void 0!==k?k:0,null!==(I=null==r?void 0:r.maxRequestedFrameRateForMaxRequestedFrameSize)&&void 0!==I?I:0):null==r?void 0:r.maxRequestedFrameRateForMaxRequestedFrameSize;var W=null!==(A=e.framesReceived)&&void 0!==A?A:0,z=null!==(O=null==r?void 0:r.framesReceived)&&void 0!==O?O:0;e.maxReceivedFrameRateForMaxRequestedFrameSize=V?Math.max(jk(W-z,5e3),null!==(L=null==r?void 0:r.maxReceivedFrameRateForMaxRequestedFrameSize)&&void 0!==L?L:0):null==r?void 0:r.maxReceivedFrameRateForMaxRequestedFrameSize;var H=null!==(M=e.framesDecoded)&&void 0!==M?M:0,K=null!==(N=null==r?void 0:r.framesDecoded)&&void 0!==N?N:0;e.maxDecodedFrameRateForMaxRequestedFrameSize=V?Math.max(jk(H-K,5e3),null!==(P=null==r?void 0:r.maxDecodedFrameRateForMaxRequestedFrameSize)&&void 0!==P?P:0):null==r?void 0:r.maxDecodedFrameRateForMaxRequestedFrameSize;var $=null!==(D=e.frameHeight)&&void 0!==D?D:0,J=null!==(F=e.frameWidth)&&void 0!==F?F:0,Y=Zk(J,$),Q=null!==(U=null==r?void 0:r.maxFrameSizeHeightForMaxRequestedFrameSize)&&void 0!==U?U:0,X=null!==(j=null==r?void 0:r.maxFrameSizeWidthForMaxRequestedFrameSize)&&void 0!==j?j:0,Z=Zk(X,Q);V&&Y>=Z?(e.maxFrameSizeHeightForMaxRequestedFrameSize=$,e.maxFrameSizeWidthForMaxRequestedFrameSize=J):(e.maxFrameSizeHeightForMaxRequestedFrameSize=null==r?void 0:r.maxFrameSizeHeightForMaxRequestedFrameSize,e.maxFrameSizeWidthForMaxRequestedFrameSize=null==r?void 0:r.maxFrameSizeWidthForMaxRequestedFrameSize)}}else if("outbound-rtp"===e.type){var ee,te,re;n("isRequestedArray",e.isRequested),n("sourceStateArray",e.sourceState),n("requestedBitrateArray",e.requestedBitrate);var ne=null==r?void 0:r.lastUsedEffect,ie=null==e?void 0:e.effect;e.lastUsedEffect=null!=ie?ie:ne;var oe=null!==(ee=null==r?void 0:r.rtpPacketSizeArray)&&void 0!==ee?ee:[],ae=null!==(te=e.bytesSent)&&void 0!==te?te:0,se=null!==(re=e.packetsSent)&&void 0!==re?re:0;if(se>0){var ce=Math.round(ae/se);oe.push(ce)}if(e.rtpPacketSizeArray=oe,"video"===this.mediaKind){var ue,le,de,fe,he,pe,ve,me,ge,ye,be,Ee,Se,_e,we,Re=null!==(ue=e.requestedFrameSize)&&void 0!==ue?ue:0,Ce=null!==(le=null==r?void 0:r.maxRequestedFrameSize)&&void 0!==le?le:0,Te=Re>=Ce;e.maxRequestedFrameSize=Te?Re:Ce,e.maxRequestedBitrateForMaxRequestedFrameSize=Te?Math.max(null!==(de=e.requestedBitrate)&&void 0!==de?de:0,null!==(fe=null==r?void 0:r.maxRequestedBitrateForMaxRequestedFrameSize)&&void 0!==fe?fe:0):null==r?void 0:r.maxRequestedBitrateForMaxRequestedFrameSize;var xe=null!==(he=null==r?void 0:r.bytesSent)&&void 0!==he?he:0;e.maxBitrateForMaxRequestedFrameSize=Te?Math.max(Uk(ae-xe,5e3),null!==(pe=null==r?void 0:r.maxBitrateForMaxRequestedFrameSize)&&void 0!==pe?pe:0):null==r?void 0:r.maxBitrateForMaxRequestedFrameSize,e.maxRequestedFrameRateForMaxRequestedFrameSize=Te?Math.max(null!==(ve=e.requestedFrameRate)&&void 0!==ve?ve:0,null!==(me=null==r?void 0:r.maxRequestedFrameRateForMaxRequestedFrameSize)&&void 0!==me?me:0):null==r?void 0:r.maxRequestedFrameRateForMaxRequestedFrameSize;var ke=null!==(ge=e.framesSent)&&void 0!==ge?ge:0,Ie=null!==(ye=null==r?void 0:r.framesSent)&&void 0!==ye?ye:0;e.maxTransmittedFrameRateForMaxRequestedFrameSize=Te?Math.max(jk(ke-Ie,5e3),null!==(be=null==r?void 0:r.maxTransmittedFrameRateForMaxRequestedFrameSize)&&void 0!==be?be:0):null==r?void 0:r.maxTransmittedFrameRateForMaxRequestedFrameSize;var Ae=null!==(Ee=e.frameHeight)&&void 0!==Ee?Ee:0,Oe=null!==(Se=e.frameWidth)&&void 0!==Se?Se:0,Le=Zk(Oe,Ae),Me=null!==(_e=null==r?void 0:r.maxFrameSizeHeightForMaxRequestedFrameSize)&&void 0!==_e?_e:0,Ne=null!==(we=null==r?void 0:r.maxFrameSizeWidthForMaxRequestedFrameSize)&&void 0!==we?we:0,Pe=Zk(Ne,Me);Te&&Le>=Pe?(e.maxFrameSizeHeightForMaxRequestedFrameSize=Ae,e.maxFrameSizeWidthForMaxRequestedFrameSize=Oe):(e.maxFrameSizeHeightForMaxRequestedFrameSize=null==r?void 0:r.maxFrameSizeHeightForMaxRequestedFrameSize,e.maxFrameSizeWidthForMaxRequestedFrameSize=null==r?void 0:r.maxFrameSizeWidthForMaxRequestedFrameSize)}}else"remote-inbound-rtp"===e.type?(n("roundTripTimeArray",e.roundTripTime),n("fractionLostArray",e.fractionLost),n("jitterArray",e.jitter)):"candidate-pair"===e.type&&n("availableOutgoingBitrateArray",e.availableOutgoingBitrate)})),this.currentIntervalStats=e):yw().debug("MqeBuilder#updateCurrentIntervalStats --\x3e Stats map is empty, nothing to update for ".concat(this.direction," ").concat(this.mediaKind," ").concat(this.isMain?"main":"slides","."))}reset(){this.previousIntervalStats=new Map,this.currentIntervalStats=new Map}resetForNextInterval(){this.previousIntervalStats=new Map(this.currentIntervalStats),this.currentIntervalStats.forEach((e=>{"inbound-rtp"===e.type?(delete e.isRequestedArray,delete e.sourceStateArray,delete e.jitterArray,delete e.jitterBufferDelayPerEmitArray,delete e.requestedBitrateArray,delete e.csiArray,delete e.maxRequestedFrameSize,delete e.maxRequestedBitrateForMaxRequestedFrameSize,delete e.maxBitrateForMaxRequestedFrameSize,delete e.maxRequestedFrameRateForMaxRequestedFrameSize,delete e.maxReceivedFrameRateForMaxRequestedFrameSize,delete e.maxDecodedFrameRateForMaxRequestedFrameSize,delete e.maxFrameSizeHeightForMaxRequestedFrameSize,delete e.maxFrameSizeWidthForMaxRequestedFrameSize,delete e.rtpPacketSizeArray):"outbound-rtp"===e.type?(delete e.isRequestedArray,delete e.sourceStateArray,delete e.requestedBitrateArray,delete e.lastUsedEffect,delete e.maxRequestedFrameSize,delete e.maxRequestedBitrateForMaxRequestedFrameSize,delete e.maxBitrateForMaxRequestedFrameSize,delete e.maxRequestedFrameRateForMaxRequestedFrameSize,delete e.maxTransmittedFrameRateForMaxRequestedFrameSize,delete e.maxFrameSizeHeightForMaxRequestedFrameSize,delete e.maxFrameSizeWidthForMaxRequestedFrameSize,delete e.rtpPacketSizeArray):"remote-inbound-rtp"===e.type?(delete e.roundTripTimeArray,delete e.fractionLostArray,delete e.jitterArray):"candidate-pair"===e.type&&delete e.availableOutgoingBitrateArray}))}buildMqeIntervalSessionCommon(){var e,t=structuredClone(Tk),r=this.currentIntervalStats;return t.isMain=this.isMain,t.mariFecEnabled=!1,t.mariRtxEnabled=!1,t.mariQosEnabled=!1,t.mariLiteEnabled=!1,t.multistreamEnabled=this.multistreamEnabled,t.direction=this.direction,t.isMediaBypassEdge=null!==(e=Vk(r,"peer-connection","isMediaBypassEdge"))&&void 0!==e&&e,t}buildMqeIntervalSessionReceive(){var e,t=structuredClone(xk);t.common=this.buildMqeIntervalSessionCommon();var r=this.currentIntervalStats,n=this.previousIntervalStats,i=Wk(r,"inbound-rtp","fecPacketsReceived"),o=Wk(n,"inbound-rtp","fecPacketsReceived");t.fecPackets=i-o;var a=Wk(r,"inbound-rtp","retransmittedPacketsReceived"),s=Wk(n,"inbound-rtp","retransmittedPacketsReceived");t.rtxPackets=a-s;var c=Wk(r,"inbound-rtp","retransmittedBytesReceived"),u=Wk(n,"inbound-rtp","retransmittedBytesReceived");t.rtxBitrate=Uk(c-u,Ek);var l=Wk(r,"inbound-rtp","packetsReceived"),d=Wk(n,"inbound-rtp","packetsReceived");t.rtpPackets=l-d-t.rtxPackets;var f=Wk(r,"inbound-rtp","bytesReceived"),h=Wk(n,"inbound-rtp","bytesReceived");t.rtpBitrate=Uk(f-h,Ek)-t.rtxBitrate;var p=Wk(r,"inbound-rtp","packetsLost"),v=Wk(n,"inbound-rtp","packetsLost");t.rtpHopByHopLost=p-v,t.mediaHopByHopLost=p-v;var m=Wk(r,"inbound-rtp","fecPacketsDiscarded"),g=Wk(n,"inbound-rtp","fecPacketsDiscarded");t.rtpRecovered=t.fecPackets-(m-g);var y=null!==(e=Kk(r))&&void 0!==e?e:"UDP";t.transportType=y;var b=Gk(r,"inbound-rtp","rtpPacketSizeArray").flat();return t.mediaPacketSize={meanRtpPacketSize:Math.round(Fk(b)),maxRtpPacketSize:Math.round(Pk(b)),minRtpPacketSize:Math.round(Dk(b))},t}buildMqeIntervalStreamReceiveAudio(e){var t=structuredClone(Ik);return t.common=this.buildMqeIntervalStreamReceiveCommon(e),t}buildMqeIntervalStreamReceiveVideo(e){var t,r,n,i,o,a,s,c,u,l,d=structuredClone(Mk);d.common=this.buildMqeIntervalStreamReceiveCommon(e);var f=this.currentIntervalStats,h=this.previousIntervalStats,p=null!==(t=qk(f,e,"maxFrameSizeHeightForMaxRequestedFrameSize"))&&void 0!==t?t:0,v=null!==(r=qk(f,e,"maxFrameSizeWidthForMaxRequestedFrameSize"))&&void 0!==r?r:0;d.receivedFrameSize=Zk(v,p);var m=null!==(n=qk(f,e,"maxRequestedFrameSize"))&&void 0!==n?n:0;d.requestedFrameSize=m,d.optimalFrameSize=m,d.receivedHeight=p,d.receivedWidth=v;var g=null!==(i=qk(f,e,"keyFramesDecoded"))&&void 0!==i?i:0,y=null!==(o=qk(h,e,"keyFramesDecoded"))&&void 0!==o?o:0;d.receivedKeyFrames=g-y;var b=null!==(a=qk(f,e,"firCount"))&&void 0!==a?a:0,E=null!==(s=qk(h,e,"firCount"))&&void 0!==s?s:0,S=null!==(c=qk(f,e,"pliCount"))&&void 0!==c?c:0,_=null!==(u=qk(h,e,"pliCount"))&&void 0!==u?u:0;if(d.requestedKeyFrames=b-E+(S-_),this.multistreamEnabled){var w,R,C=null!==(w=qk(f,e,"isActiveSpeaker"))&&void 0!==w&&w,T=null!==(R=qk(f,e,"lastActiveSpeakerUpdateTimestamp"))&&void 0!==R?R:0;d.isActiveSpeaker=C||T>performance.timeOrigin+performance.now()-Ek}var x=null!==(l=Yk(f,e))&&void 0!==l?l:"BP";return d.h264CodecProfile=x,d}buildMqeIntervalStreamReceiveCommon(e){var t,r,n,i,o,a,s,c,u,l,d,f,h,p=structuredClone(kk),v=this.currentIntervalStats,m=this.previousIntervalStats,g=null!==(t=qk(v,e,"packetsReceived"))&&void 0!==t?t:0,y=null!==(r=qk(m,e,"packetsReceived"))&&void 0!==r?r:0,b=null!==(n=qk(v,e,"retransmittedPacketsReceived"))&&void 0!==n?n:0,E=null!==(i=qk(m,e,"retransmittedPacketsReceived"))&&void 0!==i?i:0;p.rtpPackets=g-y-(b-E);var S=null!==(o=qk(v,e,"packetsLost"))&&void 0!==o?o:0,_=null!==(a=qk(m,e,"packetsLost"))&&void 0!==a?a:0;if(p.rtpEndToEndLost=S-_,"audio"===this.mediaKind){var w,R,C,T,x,k=null!==(w=qk(v,e,"concealedSamples"))&&void 0!==w?w:0,I=null!==(R=qk(m,e,"concealedSamples"))&&void 0!==R?R:0,A=null!==(C=qk(v,e,"silentConcealedSamples"))&&void 0!==C?C:0,O=null!==(T=qk(m,e,"silentConcealedSamples"))&&void 0!==T?T:0,L=null!==(x=Vk(v,"codec","clockRate"))&&void 0!==x?x:0;p.concealedFrames=((e,t)=>{if(t<0)throw new Error("Clock rate cannot be negative: ".concat(t));return 0===t?0:e/t*1e3})(k-I-(A-O),L)}if("video"===this.mediaKind){var M,N,P,D,F,U=null!==(M=qk(v,e,"totalFreezesDuration"))&&void 0!==M?M:0,j=null!==(N=qk(m,e,"totalFreezesDuration"))&&void 0!==N?N:0;p.concealedFrames=1e3*(U-j);var B=null!==(P=qk(v,e,"maxReceivedFrameRateForMaxRequestedFrameSize"))&&void 0!==P?P:0;p.receivedFrameRate=B;var q=null!==(D=qk(v,e,"maxDecodedFrameRateForMaxRequestedFrameSize"))&&void 0!==D?D:0;p.renderedFrameRate=q;var V=null!==(F=qk(v,e,"maxRequestedFrameRateForMaxRequestedFrameSize"))&&void 0!==F?F:0;p.requestedFrameRate=V,p.optimalFrameRate=V}var G=null!==(s=qk(v,e,"jitterBufferDelayPerEmitArray"))&&void 0!==s?s:[];p.jitterBufferDelay={minDelay:Dk(G),meanDelay:Math.round(Fk(G)),maxDelay:Pk(G)};var W=null!==(c=qk(v,e,"jitterArray"))&&void 0!==c?c:[];p.meanRtpJitter=1e3*Fk(W),p.maxRtpJitter=1e3*Pk(W);var z=null!==(u=qk(v,e,"bytesReceived"))&&void 0!==u?u:0,H=null!==(l=qk(m,e,"bytesReceived"))&&void 0!==l?l:0,K=null!==(d=qk(v,e,"retransmittedBytesReceived"))&&void 0!==d?d:0,$=null!==(f=qk(m,e,"retransmittedBytesReceived"))&&void 0!==f?f:0;if(p.receivedBitrate=Uk(z-H-(K-$),Ek),"audio"===this.mediaKind){var J,Y=null!==(J=qk(v,e,"requestedBitrateArray"))&&void 0!==J?J:[];p.requestedBitrate=Pk(Y),p.optimalBitrate=Pk(Y)}else{var Q,X=null!==(Q=qk(v,e,"maxRequestedBitrateForMaxRequestedFrameSize"))&&void 0!==Q?Q:0;p.requestedBitrate=X,p.optimalBitrate=X}var Z=qk(v,e,"csiArray");Z&&Z.length>0&&(p.csi=Z.filter(((e,t)=>Z.indexOf(e)===t)));var ee=null!==(h=Jk(v,e))&&void 0!==h?h:"audio"===this.mediaKind?"opus":"H264";return p.codec=ee,p}buildMqeIntervalSessionTransmit(){var e,t,r=structuredClone(Ak);r.common=this.buildMqeIntervalSessionCommon();var n=this.currentIntervalStats,i=this.previousIntervalStats,o=Wk(n,"outbound-rtp","retransmittedPacketsSent"),a=Wk(i,"outbound-rtp","retransmittedPacketsSent");r.rtxPackets=o-a;var s=Wk(n,"outbound-rtp","retransmittedBytesSent"),c=Wk(i,"outbound-rtp","retransmittedBytesSent");r.rtxBitrate=Uk(s-c,Ek);var u=Wk(n,"outbound-rtp","packetsSent"),l=Wk(i,"outbound-rtp","packetsSent");r.rtpPackets=u-l-r.rtxPackets;var d=Wk(n,"outbound-rtp","bytesSent"),f=Wk(i,"outbound-rtp","bytesSent");r.rtpBitrate=Uk(d-f,Ek)-r.rtxBitrate;var h=null!==(e=Kk(n))&&void 0!==e?e:"UDP";r.transportType=h;var p=null!==(t=(e=>{var t=zk(e);if(t)return qk(e,t,"availableOutgoingBitrateArray")})(n))&&void 0!==t?t:[];r.availableBitrate=Dk(p),r.queueDelay=0;var v=Gk(n,"remote-inbound-rtp","roundTripTimeArray").flat();r.meanRoundTripTime=1e3*Fk(v),r.maxRoundTripTime=1e3*Pk(v);var m=Gk(n,"remote-inbound-rtp","fractionLostArray").flat();r.maxRemoteLossRate=100*Pk(m),r.meanRemoteLossRate=100*Fk(m);var g=Gk(n,"remote-inbound-rtp","jitterArray").flat();r.maxRemoteJitter=1e3*Pk(g),r.meanRemoteJitter=1e3*Fk(g);var y=Gk(n,"outbound-rtp","rtpPacketSizeArray").flat();return r.mediaPacketSize={meanRtpPacketSize:Math.round(Fk(y)),maxRtpPacketSize:Math.round(Pk(y)),minRtpPacketSize:Math.round(Dk(y))},r}buildMqeIntervalStreamTransmitAudio(e){var t=structuredClone(Lk);t.common=this.buildMqeIntervalStreamTransmitCommon(e);var r=this.currentIntervalStats,n=qk(r,e,"lastUsedEffect");return"noise-reduction-effect"===(null==n?void 0:n.kind)?t.backgroundNoiseReductionMode=yk.LOW_POWER:t.backgroundNoiseReductionMode=yk.NONE,t}buildMqeIntervalStreamTransmitVideo(e){var t,r,n,i,o,a,s,c,u,l,d=structuredClone(Nk);d.common=this.buildMqeIntervalStreamTransmitCommon(e);var f=this.currentIntervalStats,h=this.previousIntervalStats,p=null!==(t=qk(f,e,"maxFrameSizeHeightForMaxRequestedFrameSize"))&&void 0!==t?t:0,v=null!==(r=qk(f,e,"maxFrameSizeWidthForMaxRequestedFrameSize"))&&void 0!==r?r:0;d.transmittedFrameSize=Zk(v,p);var m=null!==(n=qk(f,e,"maxRequestedFrameSize"))&&void 0!==n?n:0;d.requestedFrameSize=m,d.transmittedHeight=p,d.transmittedWidth=v;var g=null!==(i=qk(f,e,"keyFramesEncoded"))&&void 0!==i?i:0,y=null!==(o=qk(h,e,"keyFramesEncoded"))&&void 0!==o?o:0;d.transmittedKeyFrames=g-y;var b=null!==(a=qk(f,e,"firCount"))&&void 0!==a?a:0,E=null!==(s=qk(h,e,"firCount"))&&void 0!==s?s:0,S=null!==(c=qk(f,e,"pliCount"))&&void 0!==c?c:0,_=null!==(u=qk(h,e,"pliCount"))&&void 0!==u?u:0;d.requestedKeyFrames=b-E+(S-_),d.localConfigurationChanges=0;var w=null!==(l=Yk(f,e))&&void 0!==l?l:"BP";d.h264CodecProfile=w;var R=qk(f,e,"lastUsedEffect");return"virtual-background-effect"===(null==R?void 0:R.kind)&&"virtualBackgroundMode"in R?"BLUR"===R.virtualBackgroundMode?d.backgroundAugmentationType=bk.BLUR:"IMAGE"===R.virtualBackgroundMode?d.backgroundAugmentationType=bk.REPLACE_IMAGE:"VIDEO"===R.virtualBackgroundMode?d.backgroundAugmentationType=bk.REPLACE_VIDEO:d.backgroundAugmentationType=bk.NONE:d.backgroundAugmentationType=bk.NONE,d}buildMqeIntervalStreamTransmitCommon(e){var t,r,n,i,o,a,s,c,u,l=structuredClone(Ok),d=this.currentIntervalStats,f=this.previousIntervalStats,h=null!==(t=qk(d,e,"packetsSent"))&&void 0!==t?t:0,p=null!==(r=qk(f,e,"packetsSent"))&&void 0!==r?r:0,v=null!==(n=qk(d,e,"retransmittedPacketsSent"))&&void 0!==n?n:0,m=null!==(i=qk(f,e,"retransmittedPacketsSent"))&&void 0!==i?i:0;if(l.rtpPackets=h-p-(v-m),"video"===this.mediaKind){var g,y,b=null!==(g=qk(d,e,"maxTransmittedFrameRateForMaxRequestedFrameSize"))&&void 0!==g?g:0;l.transmittedFrameRate=b;var E=null!==(y=qk(d,e,"maxRequestedFrameRateForMaxRequestedFrameSize"))&&void 0!==y?y:0;l.requestedFrames=E}var S=null!==(o=qk(d,e,"bytesSent"))&&void 0!==o?o:0,_=null!==(a=qk(f,e,"bytesSent"))&&void 0!==a?a:0,w=null!==(s=qk(d,e,"retransmittedBytesSent"))&&void 0!==s?s:0,R=null!==(c=qk(f,e,"retransmittedBytesSent"))&&void 0!==c?c:0;if(l.transmittedBitrate=Uk(S-_-(w-R),Ek),"audio"===this.mediaKind){var C,T=null!==(C=qk(d,e,"requestedBitrateArray"))&&void 0!==C?C:[];l.requestedBitrate=Pk(T)}else{var x,k=null!==(x=qk(d,e,"maxRequestedBitrateForMaxRequestedFrameSize"))&&void 0!==x?x:0;l.requestedBitrate=k}var I=null!==(u=Jk(d,e))&&void 0!==u?u:"audio"===this.mediaKind?"opus":"H264";l.codec=I;var A=qk(d,e,"csi");return A&&(l.csi=[A]),l}}function tI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function rI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?tI(Object(r),!0).forEach((function(t){bp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class nI extends eI{constructor(e){super(rI(rI({},e),{},{direction:"recvonly",mediaKind:"audio"}))}buildMqe(){var e={common:this.buildMqeIntervalSessionReceive(),streams:[]};return this.currentIntervalStats.forEach(((t,r)=>{"inbound-rtp"!==t.type||this.multistreamEnabled&&!Qk(t)||e.streams.push(this.buildMqeIntervalStreamReceiveAudio(r))})),e}}function iI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function oI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?iI(Object(r),!0).forEach((function(t){bp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class aI extends eI{constructor(e){super(oI(oI({},e),{},{direction:"recvonly",mediaKind:"video"}))}buildMqe(){var e={common:this.buildMqeIntervalSessionReceive(),streams:[]};return this.currentIntervalStats.forEach(((t,r)=>{"inbound-rtp"===t.type&&(!this.multistreamEnabled||Qk(t)&&Xk(t))&&e.streams.push(this.buildMqeIntervalStreamReceiveVideo(r))})),e}}function sI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function cI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?sI(Object(r),!0).forEach((function(t){bp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class uI extends eI{constructor(e){super(cI(cI({},e),{},{direction:"sendonly",mediaKind:"audio"}))}buildMqe(){var e={common:this.buildMqeIntervalSessionTransmit(),streams:[]};return this.currentIntervalStats.forEach(((t,r)=>{"outbound-rtp"!==t.type||this.multistreamEnabled&&!Qk(t)||e.streams.push(this.buildMqeIntervalStreamTransmitAudio(r))})),e}}function lI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function dI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?lI(Object(r),!0).forEach((function(t){bp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class fI extends eI{constructor(e){super(dI(dI({},e),{},{direction:"sendonly",mediaKind:"video"}))}buildMqe(){var e={common:this.buildMqeIntervalSessionTransmit(),streams:[]};return this.currentIntervalStats.forEach(((t,r)=>{"outbound-rtp"===t.type&&(!this.multistreamEnabled||Qk(t)&&Xk(t))&&e.streams.push(this.buildMqeIntervalStreamTransmitVideo(r))})),e}}function hI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function pI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?hI(Object(r),!0).forEach((function(t){bp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}!function(e){e.MEDIA_QUALITY="MEDIA_QUALITY",e.LOCAL_MEDIA_STARTED="LOCAL_MEDIA_STARTED",e.LOCAL_MEDIA_STOPPED="LOCAL_MEDIA_STOPPED",e.REMOTE_MEDIA_STARTED="REMOTE_MEDIA_STARTED",e.REMOTE_MEDIA_STOPPED="REMOTE_MEDIA_STOPPED"}(wk||(wk={})),function(e){e.NETWORK_QUALITY="NETWORK_QUALITY"}(Rk||(Rk={}));class vI extends cp{constructor(e){var{config:t,networkQualityMonitor:r,isMultistream:n=!1}=e;super(),bp(this,"config",void 0),bp(this,"lastEmittedStartStopEvents",{}),bp(this,"previousTransceiverStats",void 0),bp(this,"meetingMediaStatus",void 0),bp(this,"statsInterval",void 0),bp(this,"mqeInterval",void 0),bp(this,"mqeSentCount",0),bp(this,"networkQualityMonitor",void 0),bp(this,"mediaConnection",null),bp(this,"statsStarted",!1),bp(this,"mqeIntervalSessionReceiveAudioMainBuilder",void 0),bp(this,"mqeIntervalSessionReceiveAudioSlidesBuilder",void 0),bp(this,"mqeIntervalSessionTransmitAudioMainBuilder",void 0),bp(this,"mqeIntervalSessionTransmitAudioSlidesBuilder",void 0),bp(this,"mqeIntervalSessionReceiveVideoMainBuilder",void 0),bp(this,"mqeIntervalSessionReceiveVideoSlidesBuilder",void 0),bp(this,"mqeIntervalSessionTransmitVideoMainBuilder",void 0),bp(this,"mqeIntervalSessionTransmitVideoSlidesBuilder",void 0),bp(this,"intervalMetadata",{systemCpuArray:[]}),bp(this,"emitStartStopEvents",((e,t,r,n)=>{var i,o;void 0===t&&(t=0),void 0===r&&(r=0),this.lastEmittedStartStopEvents[e]||(this.lastEmittedStartStopEvents[e]={});var a,s=n?null===(i=this.lastEmittedStartStopEvents[e])||void 0===i?void 0:i.local:null===(o=this.lastEmittedStartStopEvents[e])||void 0===o?void 0:o.remote;if(r-t>0?a=n?wk.LOCAL_MEDIA_STARTED:wk.REMOTE_MEDIA_STARTED:r!==t||s!==wk.LOCAL_MEDIA_STARTED&&s!==wk.REMOTE_MEDIA_STARTED||(a=n?wk.LOCAL_MEDIA_STOPPED:wk.REMOTE_MEDIA_STOPPED),a&&s!==a){var c=this.lastEmittedStartStopEvents[e];n?c.local=a:c.remote=a,this.emit(a,{mediaType:e})}})),this.config=t,this.networkQualityMonitor=r,this.mqeIntervalSessionReceiveAudioMainBuilder=new nI({isMain:!0,multistreamEnabled:n}),this.mqeIntervalSessionReceiveAudioSlidesBuilder=new nI({isMain:!1,multistreamEnabled:n}),this.mqeIntervalSessionTransmitAudioMainBuilder=new uI({isMain:!0,multistreamEnabled:n}),this.mqeIntervalSessionTransmitAudioSlidesBuilder=new uI({isMain:!1,multistreamEnabled:n}),this.mqeIntervalSessionReceiveVideoMainBuilder=new aI({isMain:!0,multistreamEnabled:n}),this.mqeIntervalSessionReceiveVideoSlidesBuilder=new aI({isMain:!1,multistreamEnabled:n}),this.mqeIntervalSessionTransmitVideoMainBuilder=new fI({isMain:!0,multistreamEnabled:n}),this.mqeIntervalSessionTransmitVideoSlidesBuilder=new fI({isMain:!1,multistreamEnabled:n})}get builders(){return[this.mqeIntervalSessionReceiveAudioMainBuilder,this.mqeIntervalSessionReceiveAudioSlidesBuilder,this.mqeIntervalSessionTransmitAudioMainBuilder,this.mqeIntervalSessionTransmitAudioSlidesBuilder,this.mqeIntervalSessionReceiveVideoMainBuilder,this.mqeIntervalSessionReceiveVideoSlidesBuilder,this.mqeIntervalSessionTransmitVideoMainBuilder,this.mqeIntervalSessionTransmitVideoSlidesBuilder]}getLocalIpAddress(){for(var e of this.builders){var t=Hk(e.currentIntervalStats,"local");if(t){var r=qk(e.currentIntervalStats,t,"candidateType"),n=qk(e.currentIntervalStats,t,"address");if("host"===r)return n;if("prflx"===r)return qk(e.currentIntervalStats,t,"relayProtocol")?n:qk(e.currentIntervalStats,t,"relatedAddress")}}}getNetworkType(){for(var e of this.builders){var t=Hk(e.currentIntervalStats,"local");if(t)return qk(e.currentIntervalStats,t,"networkType")}}get shareVideoEncoderImplementation(){return Vk(this.mqeIntervalSessionTransmitVideoSlidesBuilder.currentIntervalStats,"outbound-rtp","encoderImplementation")}get peerReflexiveIp(){for(var e of this.builders){var t=Array.from(e.currentIntervalStats.values()).find((e=>"local-candidate"===e.type&&"prflx"===e.candidateType));if(t)return t.address}}get remoteMediaIp(){for(var e of this.builders){var t=Hk(e.currentIntervalStats,"remote");if(t)return qk(e.currentIntervalStats,t,"address")}}updateMediaStatus(e){var t,r;this.meetingMediaStatus={actual:pI(pI({},null===(t=this.meetingMediaStatus)||void 0===t?void 0:t.actual),null==e?void 0:e.actual),expected:pI(pI({},null===(r=this.meetingMediaStatus)||void 0===r?void 0:r.expected),null==e?void 0:e.expected)},yw().info("StatsAnalyzer#updateMediaStatus --\x3e Meeting media status: ".concat(JSON.stringify(this.meetingMediaStatus)))}sendMqeData(){var e,t,r,n,i;yw().debug("StatsAnalyzer#sendMqeData --\x3e Building MQE...");var o,a,s=structuredClone(Ck);s.intervalMetadata={maskedPeerReflexiveIP:null!==(e=ak(null!==(t=this.peerReflexiveIp)&&void 0!==t?t:Sk,28,96))&&void 0!==e?e:Sk,remoteMediaIP:null!==(r=this.remoteMediaIp)&&void 0!==r?r:Sk,peripherals:[{name:"speaker",information:_k},{name:"microphone",information:null!==(n=$k(this.mqeIntervalSessionTransmitAudioMainBuilder.currentIntervalStats))&&void 0!==n?n:_k},{name:"camera",information:null!==(i=$k(this.mqeIntervalSessionTransmitVideoMainBuilder.currentIntervalStats))&&void 0!==i?i:_k}],cpuInfo:{description:"NA",numberOfCores:hk.getNumLogicalCores()||1,architecture:_k},systemMaximumCPU:this.intervalMetadata.systemCpuArray.length>0?Pk(this.intervalMetadata.systemCpuArray):void 0,systemAverageCPU:this.intervalMetadata.systemCpuArray.length>0?(o=Fk(this.intervalMetadata.systemCpuArray),a=[5,25,50,75],a.reduce(((e,t)=>Math.abs(t-o)<Math.abs(e-o)?t:e))):void 0,screenResolution:window.screen.width*window.screen.height/256,screenWidth:window.screen.width,screenHeight:window.screen.height,appWindowSize:window.innerWidth*window.innerHeight/256,appWindowWidth:window.innerWidth,appWindowHeight:window.innerHeight},s.audioReceive.push(this.mqeIntervalSessionReceiveAudioMainBuilder.buildMqe()),s.audioReceive.push(this.mqeIntervalSessionReceiveAudioSlidesBuilder.buildMqe()),s.audioTransmit.push(this.mqeIntervalSessionTransmitAudioMainBuilder.buildMqe()),s.audioTransmit.push(this.mqeIntervalSessionTransmitAudioSlidesBuilder.buildMqe()),s.videoReceive.push(this.mqeIntervalSessionReceiveVideoMainBuilder.buildMqe()),s.videoReceive.push(this.mqeIntervalSessionReceiveVideoSlidesBuilder.buildMqe()),s.videoTransmit.push(this.mqeIntervalSessionTransmitVideoMainBuilder.buildMqe()),s.videoTransmit.push(this.mqeIntervalSessionTransmitVideoSlidesBuilder.buildMqe()),this.builders.forEach((e=>e.resetForNextInterval())),this.intervalMetadata={systemCpuArray:[]},s.intervalNumber=this.mqeSentCount,this.mqeSentCount+=1,yw().debug("StatsAnalyzer#sendMqeData --\x3e Sending MQE..."),this.emit(wk.MEDIA_QUALITY,{data:s})}startAnalyzer(e){var t=this;return ep((function*(){t.statsStarted?yw().info("StatsAnalyzer#startAnalyzer --\x3e StatsAnalyzer already started."):(t.statsStarted=!0,t.mediaConnection=e,yield t.getStatsAndUpdate(),t.sendMqeData(),t.statsInterval=setInterval((()=>{t.getStatsAndUpdate()}),t.config.analyzerInterval),t.mqeInterval=setInterval((()=>{t.sendMqeData()}),Ek))}))()}stopAnalyzer(){var e=this;return ep((function*(){var t=e.mqeInterval&&e.statsInterval;e.statsInterval&&(clearInterval(e.statsInterval),e.statsInterval=void 0),e.mqeInterval&&(clearInterval(e.mqeInterval),e.mqeInterval=void 0),e.statsStarted=!1,t&&(yw().info("StatsAnalyzer#stopAnalyzer --\x3e Sending one last MQE..."),yield e.getStatsAndUpdate(),e.sendMqeData(),e.mediaConnection=null,e.builders.forEach((e=>e.reset())))}))()}getStatsAndUpdate(){var e=this;return ep((function*(){if(e.mediaConnection)if(e.mediaConnection&&e.mediaConnection.getConnectionState()===bg.Failed)yw().info("StatsAnalyzer#getStatsAndUpdate --\x3e Media connection is in failed state.");else{yw().debug("StatsAnalyzer#getStatsAndUpdate --\x3e Collecting stats...");var t=yield e.mediaConnection.getTransceiverStats();e.mqeIntervalSessionReceiveAudioMainBuilder.updateCurrentIntervalStats(Bk(t.audio.receivers)),e.mqeIntervalSessionReceiveAudioSlidesBuilder.updateCurrentIntervalStats(Bk(t.screenShareAudio.receivers)),e.mqeIntervalSessionTransmitAudioMainBuilder.updateCurrentIntervalStats(Bk(t.audio.senders)),e.mqeIntervalSessionTransmitAudioSlidesBuilder.updateCurrentIntervalStats(Bk(t.screenShareAudio.senders)),e.mqeIntervalSessionReceiveVideoMainBuilder.updateCurrentIntervalStats(Bk(t.video.receivers)),e.mqeIntervalSessionReceiveVideoSlidesBuilder.updateCurrentIntervalStats(Bk(t.screenShareVideo.receivers)),e.mqeIntervalSessionTransmitVideoMainBuilder.updateCurrentIntervalStats(Bk(t.video.senders)),e.mqeIntervalSessionTransmitVideoSlidesBuilder.updateCurrentIntervalStats(Bk(t.screenShareVideo.senders));var r=gk.getCpuPressure();r&&e.intervalMetadata.systemCpuArray.push((e=>{switch(e){case"nominal":return 5;case"fair":default:return 25;case"serious":return 50;case"critical":return 75}})(r)),e.monitorStats(t),yw().debug("StatsAnalyzer#getStatsAndUpdate --\x3e Finished collecting stats.")}}))()}monitorStats(e){var t,r,n,i,o,a,s,c,u,l,d,f,h,p,v,m,g,y=(e,t)=>{var r=Gk(t,"remote-inbound-rtp","roundTripTime"),n=Gk(t,"remote-inbound-rtp","jitter"),i=Gk(t,"remote-inbound-rtp","fractionLost");this.networkQualityMonitor.determineUplinkNetworkQuality({mediaType:e,roundTripTime:Fk(r),jitter:Fk(n),fractionLost:Fk(i)})};if(null!==(t=this.meetingMediaStatus)&&void 0!==t&&t.expected.sendAudio){var b=Bk(e.audio.senders);if(this.previousTransceiverStats){var E=Bk(this.previousTransceiverStats.audio.senders),S=Wk(b,"outbound-rtp","packetsSent");if(S===Wk(E,"outbound-rtp","packetsSent")&&yw().info("StatsAnalyzer#monitorStats --\x3e No audio packets sent, last packets sent count: ".concat(S,".")),void 0!==Vk(b,"media-source","totalAudioEnergy")){var _=Wk(b,"media-source","totalAudioEnergy");_===Wk(E,"media-source","totalAudioEnergy")&&yw().info("StatsAnalyzer#monitorStats --\x3e No audio energy, last total audio energy: ".concat(_,"."))}if(void 0!==Vk(b,"media-source","audioLevel"))0===Wk(b,"media-source","audioLevel")&&yw().info("StatsAnalyzer#monitorStats --\x3e Audio level is 0.")}y("audio",b)}if(null!==(r=this.meetingMediaStatus)&&void 0!==r&&r.expected.sendVideo){var w=Bk(e.video.senders);if(this.previousTransceiverStats){var R=Bk(this.previousTransceiverStats.video.senders),C=Wk(w,"outbound-rtp","packetsSent");C===Wk(R,"outbound-rtp","packetsSent")&&yw().info("StatsAnalyzer#monitorStats --\x3e No video packets sent, last packets sent count: ".concat(C,"."));var T=Wk(w,"outbound-rtp","framesEncoded");T===Wk(R,"outbound-rtp","framesEncoded")&&yw().info("StatsAnalyzer#monitorStats --\x3e No video frames encoded, last frames encoded count: ".concat(T,"."));var x=Wk(w,"outbound-rtp","framesSent");x===Wk(R,"outbound-rtp","framesSent")&&yw().info("StatsAnalyzer#monitorStats --\x3e No video frames sent, last frames sent count: ".concat(x,"."))}y("video",w)}if(null!==(n=this.meetingMediaStatus)&&void 0!==n&&n.expected.receiveVideo){var k=Bk(e.video.receivers);if(this.previousTransceiverStats)if(Gk(k,"inbound-rtp","sourceState").includes("live")){var I=Bk(this.previousTransceiverStats.video.receivers),A=Wk(k,"inbound-rtp","packetsReceived");A===Wk(I,"inbound-rtp","packetsReceived")&&yw().info("StatsAnalyzer#monitorStats --\x3e No video packets received, last packets received count: ".concat(A,"."));var O=Wk(k,"inbound-rtp","framesDecoded");O===Wk(I,"inbound-rtp","framesDecoded")&&yw().info("StatsAnalyzer#monitorStats --\x3e No video frames decoded, last frames decoded count: ".concat(O,"."));var L=Wk(k,"inbound-rtp","framesReceived");L===Wk(I,"inbound-rtp","framesReceived")&&yw().info("StatsAnalyzer#monitorStats --\x3e No video frames received, last frames received count: ".concat(L,"."));var M=Wk(k,"inbound-rtp","framesDropped");M-Wk(I,"inbound-rtp","framesDropped")>10&&yw().info("StatsAnalyzer#monitorStats --\x3e Too many video frames dropped, total frames dropped count: ".concat(M,"."))}}if(null!==(i=this.meetingMediaStatus)&&void 0!==i&&i.expected.sendShare){var N=Bk(e.screenShareVideo.senders);if(this.previousTransceiverStats){var P=Bk(this.previousTransceiverStats.screenShareVideo.senders),D=Wk(N,"outbound-rtp","packetsSent");D===Wk(P,"outbound-rtp","packetsSent")&&yw().info("StatsAnalyzer#monitorStats --\x3e No share packets sent, last packets sent count: ".concat(D,"."));var F=Wk(N,"outbound-rtp","framesEncoded");F===Wk(P,"outbound-rtp","framesEncoded")&&yw().info("StatsAnalyzer#monitorStats --\x3e No share frames encoded, last frames encoded count: ".concat(F,"."));var U=Wk(N,"outbound-rtp","framesSent");U===Wk(P,"outbound-rtp","framesSent")&&yw().info("StatsAnalyzer#monitorStats --\x3e No share frames sent, last frames sent count: ".concat(U,"."))}y("share",N)}if(null!==(o=this.meetingMediaStatus)&&void 0!==o&&o.expected.receiveShare){var j=Bk(e.screenShareVideo.receivers);if(this.previousTransceiverStats)if(Gk(j,"inbound-rtp","sourceState").includes("live")){var B=Bk(this.previousTransceiverStats.screenShareVideo.receivers),q=Wk(j,"inbound-rtp","packetsReceived");q===Wk(B,"inbound-rtp","packetsReceived")&&yw().info("StatsAnalyzer#monitorStats --\x3e No share packets received, last packets received count: ".concat(q,"."));var V=Wk(j,"inbound-rtp","framesDecoded");V===Wk(B,"inbound-rtp","framesDecoded")&&yw().info("StatsAnalyzer#monitorStats --\x3e No share frames decoded, last frames decoded count: ".concat(V,"."));var G=Wk(j,"inbound-rtp","framesReceived");G===Wk(B,"inbound-rtp","framesReceived")&&yw().info("StatsAnalyzer#monitorStats --\x3e No share frames received, last frames received count: ".concat(G,"."));var W=Wk(j,"inbound-rtp","framesDropped");W-Wk(B,"inbound-rtp","framesDropped")>10&&yw().info("StatsAnalyzer#monitorStats --\x3e Too many share frames dropped, total frames dropped count: ".concat(W,"."))}}this.emitStartStopEvents("audio",Wk(Bk(null!==(a=null===(s=this.previousTransceiverStats)||void 0===s?void 0:s.audio.senders)&&void 0!==a?a:[]),"outbound-rtp","packetsSent"),Wk(Bk(e.audio.senders),"outbound-rtp","packetsSent"),!0),this.emitStartStopEvents("audio",Wk(Bk(null!==(c=null===(u=this.previousTransceiverStats)||void 0===u?void 0:u.audio.receivers)&&void 0!==c?c:[]),"inbound-rtp","packetsReceived"),Wk(Bk(e.audio.receivers),"inbound-rtp","packetsReceived"),!1),this.emitStartStopEvents("video",Wk(Bk(null!==(l=null===(d=this.previousTransceiverStats)||void 0===d?void 0:d.video.senders)&&void 0!==l?l:[]),"outbound-rtp","framesSent"),Wk(Bk(e.video.senders),"outbound-rtp","framesSent"),!0),this.emitStartStopEvents("video",Wk(Bk(null!==(f=null===(h=this.previousTransceiverStats)||void 0===h?void 0:h.video.receivers)&&void 0!==f?f:[]),"inbound-rtp","framesDecoded"),Wk(Bk(e.video.receivers),"inbound-rtp","framesDecoded"),!1),this.emitStartStopEvents("share",Wk(Bk(null!==(p=null===(v=this.previousTransceiverStats)||void 0===v?void 0:v.screenShareVideo.senders)&&void 0!==p?p:[]),"outbound-rtp","framesSent"),Wk(Bk(e.screenShareVideo.senders),"outbound-rtp","framesSent"),!0),this.emitStartStopEvents("share",Wk(Bk(null!==(m=null===(g=this.previousTransceiverStats)||void 0===g?void 0:g.screenShareVideo.receivers)&&void 0!==m?m:[]),"inbound-rtp","framesDecoded"),Wk(Bk(e.screenShareVideo.receivers),"inbound-rtp","framesDecoded"),!1),this.previousTransceiverStats=e}}class mI extends cp{constructor(e){super(),bp(this,"config",void 0),bp(this,"frequencyTypes",void 0),bp(this,"indicatorTypes",void 0),bp(this,"networkQualityScore",void 0),bp(this,"networkQualityStatus",void 0),this.config=e,this.indicatorTypes=Object.freeze({PACKETLOSS:"packetLoss",LATENCY:"latency",JITTER:"jitter"}),this.frequencyTypes=Object.freeze({UPLINK:"uplink",DOWNLINK:"downlink"}),this.networkQualityScore=1,this.networkQualityStatus={[this.frequencyTypes.UPLINK]:{}}}emitNetworkQuality(e){this.emit(Rk.NETWORK_QUALITY,{mediaType:e,networkQualityScore:this.networkQualityScore})}updateNetworkQualityStatus(e){this.emitNetworkQuality(e),this.networkQualityScore=1}determineUplinkNetworkQuality(e){var{mediaType:t,roundTripTime:r,jitter:n,fractionLost:i}=e,o=1e3*r,a=1e3*n,s=100*i,{JITTER:c,PACKETLOSS:u,LATENCY:l}=this.indicatorTypes,{UPLINK:d}=this.frequencyTypes,f=e=>void 0===e?null:e;null!==t&&(this.networkQualityStatus[d][t]||(this.networkQualityStatus[d][t]={}),this.networkQualityStatus[d][t][u]={acceptable:(()=>!(void 0!==this.config.videoPacketLossRatioThreshold&&s>this.config.videoPacketLossRatioThreshold&&(this.networkQualityScore=0,1)))(),value:f(s)},this.networkQualityStatus[d][t][l]={acceptable:(()=>!(void 0!==this.config.rttThreshold&&o>this.config.rttThreshold&&(this.networkQualityScore=0,1)))(),value:f(r)},this.networkQualityStatus[d][t][c]={acceptable:(()=>!(void 0!==this.config.jitterThreshold&&a>this.config.jitterThreshold&&(this.networkQualityScore=0,1)))(),value:f(n)},this.updateNetworkQualityStatus(t))}get networkQualityStats(){var{UPLINK:e}=this.frequencyTypes;return this.networkQualityStatus[e]}}var gI,yI={createAudioTrack:function(e){return jp.apply(this,arguments)},createVideoTrack:function(e){return Bp.apply(this,arguments)},createContentTrack:function(e){return qp.apply(this,arguments)},getCameras:Dp,getMicrophones:Fp,getSpeakers:Up,on:function(e,t){return Wp.apply(this,arguments)},off:(e,t)=>{mp.debug({mediaType:lp,action:"off()",description:"Called ".concat(e," with ").concat(t," listener")}),Mp.off(e,t)},Effects:{BNR:{enableBNR:function(e){return $p.apply(this,arguments)},disableBNR:function(){mp.debug({mediaType:fp,action:"disableBNR()",description:"Called"});try{if(mp.info({mediaType:fp,action:"disableBNR()",description:"Checking if BNR is enabled before disabling"}),!Hp.isModuleAdded){var e=new Error("Can not disable as BNR is not enabled");throw mp.error({mediaType:fp,action:"disableBNR()",description:"Can not disable as BNR is not enabled"}),e}mp.info({mediaType:fp,action:"disableBNR()",description:"Using existing AudioWorkletNode for disabling BNR"}),Hp.workletNode.port.postMessage("DISPOSE"),mp.info({mediaType:fp,action:"disableBNR()",description:"Obtaining raw media stream track and removing bnr context"});var t=Hp.sourceNode.mediaStream,[r]=null==t?void 0:t.getAudioTracks();return Hp.isModuleAdded=!1,delete Hp.workletNode,delete Hp.audioContext,delete Hp.sourceNode,delete Hp.destinationStream,delete Hp.destinationTrack,r}catch(e){throw mp.error({mediaType:fp,action:"disableBNR()",description:"Error in disableBNR",error:e}),e}}}}},bI={exports:{}},EI="object"==typeof Reflect?Reflect:null,SI=EI&&"function"==typeof EI.apply?EI.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};gI=EI&&"function"==typeof EI.ownKeys?EI.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var _I=Number.isNaN||function(e){return e!=e};function wI(){wI.init.call(this)}bI.exports=wI,bI.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}PI(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&PI(e,"error",t,r)}(e,i,{once:!0})}))},wI.EventEmitter=wI,wI.prototype._events=void 0,wI.prototype._eventsCount=0,wI.prototype._maxListeners=void 0;var RI,CI,TI=10;function xI(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function kI(e){return void 0===e._maxListeners?wI.defaultMaxListeners:e._maxListeners}function II(e,t,r,n){var i,o,a,s;if(xI(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=kI(e))>0&&a.length>i&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,s=c,console&&console.warn&&console.warn(s)}return e}function AI(){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 OI(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=AI.bind(n);return i.listener=r,n.wrapFn=i,i}function LI(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):NI(i,i.length)}function MI(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function NI(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function PI(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(wI,"defaultMaxListeners",{enumerable:!0,get:function(){return TI},set:function(e){if("number"!=typeof e||e<0||_I(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");TI=e}}),wI.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},wI.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||_I(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},wI.prototype.getMaxListeners=function(){return kI(this)},wI.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=i[e];if(void 0===s)return!1;if("function"==typeof s)SI(s,this,t);else{var c=s.length,u=NI(s,c);for(r=0;r<c;++r)SI(u[r],this,t)}return!0},wI.prototype.addListener=function(e,t){return II(this,e,t,!1)},wI.prototype.on=wI.prototype.addListener,wI.prototype.prependListener=function(e,t){return II(this,e,t,!0)},wI.prototype.once=function(e,t){return xI(t),this.on(e,OI(this,e,t)),this},wI.prototype.prependOnceListener=function(e,t){return xI(t),this.prependListener(e,OI(this,e,t)),this},wI.prototype.removeListener=function(e,t){var r,n,i,o,a;if(xI(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},wI.prototype.off=wI.prototype.removeListener,wI.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},wI.prototype.listeners=function(e){return LI(this,e,!0)},wI.prototype.rawListeners=function(e){return LI(this,e,!1)},wI.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):MI.call(e,t)},wI.prototype.listenerCount=MI,wI.prototype.eventNames=function(){return this._eventsCount>0?gI(this._events):[]};class DI extends bI.exports.EventEmitter{}class FI{constructor(){this.emitter=new DI}on(e){this.emitter.on("event",e)}once(e){this.emitter.once("event",e)}off(e){this.emitter.off("event",e)}emit(...e){this.emitter.emit("event",...e)}}function UI(e){return class extends e{on(e,t){this[e].on(t)}once(e,t){this[e].once(t)}off(e,t){this[e].off(t)}}}function jI(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var BI=function(e){return e.ServerMuted="muted:byServer",e}({}),qI=function(e){return e.ServerMuted="muted:byServer",e}({});RI=BI.ServerMuted;var VI=function(e){Je(r,e);var t=jI(r);function r(){var e;ne(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return C(Ye(e=t.call.apply(t,[this].concat(i))),"unmuteAllowed",!0),C(Ye(e),RI,new FI),e}return oe(r,[{key:"setUnmuteAllowed",value:function(e){this.unmuteAllowed=e}},{key:"isUnmuteAllowed",value:function(){return this.unmuteAllowed}},{key:"setUserMuted",value:function(e){if(!e&&!this.isUnmuteAllowed())throw new Error("Unmute is not allowed");return Qh(Ze(r.prototype),"setUserMuted",this).call(this,e)}},{key:"setServerMuted",value:function(e,t){e!==this.userMuted&&(this.setUserMuted(e),this[BI.ServerMuted].emit(e,t))}}]),r}($m);CI=qI.ServerMuted;var GI=function(e){Je(r,e);var t=jI(r);function r(){var e;ne(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return C(Ye(e=t.call.apply(t,[this].concat(i))),"unmuteAllowed",!0),C(Ye(e),CI,new FI),e}return oe(r,[{key:"setUnmuteAllowed",value:function(e){this.unmuteAllowed=e}},{key:"isUnmuteAllowed",value:function(){return this.unmuteAllowed}},{key:"setUserMuted",value:function(e){if(!e&&!this.isUnmuteAllowed())throw new Error("Unmute is not allowed");return Qh(Ze(r.prototype),"setUserMuted",this).call(this,e)}},{key:"setServerMuted",value:function(e,t){e!==this.userMuted&&(this.setUserMuted(e),this[qI.ServerMuted].emit(e,t))}}]),r}(Hm),WI=UI(VI);UI(GI);function zI(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}let HI;"function"==typeof SuppressedError&&SuppressedError;const KI=new Uint8Array(16);function $I(){if(!HI&&(HI="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!HI))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return HI(KI)}const JI=[];for(let e=0;e<256;++e)JI.push((e+256).toString(16).slice(1));var YI={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function QI(e,t,r){if(YI.randomUUID&&!t&&!e)return YI.randomUUID();const n=(e=e||{}).random||(e.rng||$I)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return function(e,t=0){return JI[e[t+0]]+JI[e[t+1]]+JI[e[t+2]]+JI[e[t+3]]+"-"+JI[e[t+4]]+JI[e[t+5]]+"-"+JI[e[t+6]]+JI[e[t+7]]+"-"+JI[e[t+8]]+JI[e[t+9]]+"-"+JI[e[t+10]]+JI[e[t+11]]+JI[e[t+12]]+JI[e[t+13]]+JI[e[t+14]]+JI[e[t+15]]}(n)}var XI,ZI="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==__webpack_require__.g?__webpack_require__.g:"undefined"!=typeof self?self:{},eA={exports:{}},tA="object"==typeof Reflect?Reflect:null,rA=tA&&"function"==typeof tA.apply?tA.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};XI=tA&&"function"==typeof tA.ownKeys?tA.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var nA=Number.isNaN||function(e){return e!=e};function iA(){iA.init.call(this)}eA.exports=iA,eA.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}pA(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&pA(e,"error",t,r)}(e,i,{once:!0})}))},iA.EventEmitter=iA,iA.prototype._events=void 0,iA.prototype._eventsCount=0,iA.prototype._maxListeners=void 0;var oA=10;function aA(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function sA(e){return void 0===e._maxListeners?iA.defaultMaxListeners:e._maxListeners}function cA(e,t,r,n){var i,o,a,s;if(aA(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=sA(e))>0&&a.length>i&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,s=c,console&&console.warn&&console.warn(s)}return e}function uA(){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 lA(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=uA.bind(n);return i.listener=r,n.wrapFn=i,i}function dA(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):hA(i,i.length)}function fA(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function hA(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function pA(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(iA,"defaultMaxListeners",{enumerable:!0,get:function(){return oA},set:function(e){if("number"!=typeof e||e<0||nA(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");oA=e}}),iA.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},iA.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||nA(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},iA.prototype.getMaxListeners=function(){return sA(this)},iA.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=i[e];if(void 0===s)return!1;if("function"==typeof s)rA(s,this,t);else{var c=s.length,u=hA(s,c);for(r=0;r<c;++r)rA(u[r],this,t)}return!0},iA.prototype.addListener=function(e,t){return cA(this,e,t,!1)},iA.prototype.on=iA.prototype.addListener,iA.prototype.prependListener=function(e,t){return cA(this,e,t,!0)},iA.prototype.once=function(e,t){return aA(t),this.on(e,lA(this,e,t)),this},iA.prototype.prependOnceListener=function(e,t){return aA(t),this.prependListener(e,lA(this,e,t)),this},iA.prototype.removeListener=function(e,t){var r,n,i,o,a;if(aA(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},iA.prototype.off=iA.prototype.removeListener,iA.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},iA.prototype.listeners=function(e){return dA(this,e,!0)},iA.prototype.rawListeners=function(e){return dA(this,e,!1)},iA.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):fA.call(e,t)},iA.prototype.listenerCount=fA,iA.prototype.eventNames=function(){return this._eventsCount>0?XI(this._events):[]};class vA extends eA.exports.EventEmitter{}var mA={exports:{}};!function(e){!function(t){var r,n={};n.VERSION="1.6.1";var i={},o=function(e,t){return function(){return t.apply(e,arguments)}},a=function(){var e,t,r=arguments,n=r[0];for(t=1;t<r.length;t++)for(e in r[t])!(e in n)&&r[t].hasOwnProperty(e)&&(n[e]=r[t][e]);return n},s=function(e,t){return{value:e,name:t}};n.TRACE=s(1,"TRACE"),n.DEBUG=s(2,"DEBUG"),n.INFO=s(3,"INFO"),n.TIME=s(4,"TIME"),n.WARN=s(5,"WARN"),n.ERROR=s(8,"ERROR"),n.OFF=s(99,"OFF");var c=function(e){this.context=e,this.setLevel(e.filterLevel),this.log=this.info};c.prototype={setLevel:function(e){e&&"value"in e&&(this.context.filterLevel=e)},getLevel:function(){return this.context.filterLevel},enabledFor:function(e){var t=this.context.filterLevel;return e.value>=t.value},trace:function(){this.invoke(n.TRACE,arguments)},debug:function(){this.invoke(n.DEBUG,arguments)},info:function(){this.invoke(n.INFO,arguments)},warn:function(){this.invoke(n.WARN,arguments)},error:function(){this.invoke(n.ERROR,arguments)},time:function(e){"string"==typeof e&&e.length>0&&this.invoke(n.TIME,[e,"start"])},timeEnd:function(e){"string"==typeof e&&e.length>0&&this.invoke(n.TIME,[e,"end"])},invoke:function(e,t){r&&this.enabledFor(e)&&r(t,a({level:e},this.context))}};var u=new c({filterLevel:n.OFF});!function(){var e=n;e.enabledFor=o(u,u.enabledFor),e.trace=o(u,u.trace),e.debug=o(u,u.debug),e.time=o(u,u.time),e.timeEnd=o(u,u.timeEnd),e.info=o(u,u.info),e.warn=o(u,u.warn),e.error=o(u,u.error),e.log=e.info}(),n.setHandler=function(e){r=e},n.setLevel=function(e){for(var t in u.setLevel(e),i)i.hasOwnProperty(t)&&i[t].setLevel(e)},n.getLevel=function(){return u.getLevel()},n.get=function(e){return i[e]||(i[e]=new c(a({name:e},u.context)))},n.createDefaultHandler=function(e){(e=e||{}).formatter=e.formatter||function(e,t){t.name&&e.unshift("["+t.name+"]")};var t={},r=function(e,t){Function.prototype.apply.call(e,console,t)};return"undefined"==typeof console?function(){}:function(i,o){i=Array.prototype.slice.call(i);var a,s=console.log;o.level===n.TIME?(a=(o.name?"["+o.name+"] ":"")+i[0],"start"===i[1]?console.time?console.time(a):t[a]=(new Date).getTime():console.timeEnd?console.timeEnd(a):r(s,[a+": "+((new Date).getTime()-t[a])+"ms"])):(o.level===n.WARN&&console.warn?s=console.warn:o.level===n.ERROR&&console.error?s=console.error:o.level===n.INFO&&console.info?s=console.info:o.level===n.DEBUG&&console.debug?s=console.debug:o.level===n.TRACE&&console.trace&&(s=console.trace),e.formatter(i,o),r(s,i))}},n.useDefaults=function(e){n.setLevel(e&&e.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(e))},n.setDefaults=n.useDefaults,e.exports?e.exports=n:(n._prevLogger=t.Logger,n.noConflict=function(){return t.Logger=n._prevLogger,n},t.Logger=n)}(ZI)}(mA);var gA=mA.exports;const yA=gA.get("web-media-effects"),bA=gA.createDefaultHandler({formatter:(e,t)=>{e.unshift(t.name)}});var EA,SA,_A;gA.setHandler(bA),function(e){e.Prod="prod",e.Int="int"}(EA||(EA={})),function(e){e.Idle="idle",e.Init="init",e.Disabled="disabled",e.Enabled="enabled",e.Disposed="disposed",e.Error="error"}(SA||(SA={})),function(e){e.TrackUpdated="track-updated",e.Enabled="enabled",e.Disabled="disabled",e.Disposed="disposed"}(_A||(_A={}));class wA extends vA{constructor(){super(),this.state=SA.Idle,this.id=QI(),this.isEnabled=!1;const e=this.constructor;if(void 0===e.kind)throw new Error("base effect: derived class must define a static 'kind' property.");this.kind=e.kind}get underlyingStream(){return this.getUnderlyingStream()}get inputTrack(){var e;return null===(e=this.inputStream)||void 0===e?void 0:e.getTracks()[0]}getOutputTrack(){return this.outputTrack}getOutputStream(){return this.outputStream}getUnderlyingStream(){return yA.warn("getUnderlyingStream() is deprecated and will be removed in a future major release. Please use getOutputStream() instead."),this.getOutputStream()}preloadAssets(){return zI(this,void 0,void 0,(function*(){}))}load(e){return zI(this,void 0,void 0,(function*(){if(!e)throw new Error("base effect: track is a required parameter");if(e instanceof MediaStream)return this.loadMediaStream(e);if(e instanceof MediaStreamTrack)return this.loadMediaStreamTrack(e);throw this.isEnabled=!1,new Error("base effect: invalid argument type")}))}loadMediaStream(e){return zI(this,void 0,void 0,(function*(){if(yield this.loadMedia(e.getTracks()[0],e),!this.outputStream)throw new Error("base effect: load failed to create output stream");return this.outputStream}))}loadMediaStreamTrack(e){return zI(this,void 0,void 0,(function*(){if(yield this.loadMedia(e),!this.outputTrack)throw new Error("base effect: load failed to create output track");return this.outputTrack}))}loadMedia(e,t){return zI(this,void 0,void 0,(function*(){this.outputTrack=e,t?(this.inputStream=t,this.outputStream=new MediaStream,this.outputStream.addTrack(this.outputTrack)):this.inputStream=new MediaStream([e])}))}replaceInputTrack(e){return zI(this,void 0,void 0,(function*(){if(!e)throw new Error("base effect: track is a required parameter");this.inputStream&&this.inputTrack&&this.inputStream.removeTrack(this.inputTrack),this.inputStream&&this.inputStream.addTrack(e)}))}enable(){return zI(this,void 0,void 0,(function*(){if(!this.effectTrack)throw new Error("base effect: effect track is undefined");this.isEnabled=!0,this.outputTrack=this.effectTrack,this.emit(_A.Enabled),this.emit(_A.TrackUpdated,this.effectTrack)}))}disable(){return zI(this,void 0,void 0,(function*(){if(!this.inputTrack)throw new Error("base effect: input track is undefined");this.isEnabled=!1,this.outputTrack=this.inputTrack,this.emit(_A.Disabled),this.emit(_A.TrackUpdated,this.inputTrack)}))}dispose(){var e;return zI(this,void 0,void 0,(function*(){null===(e=this.effectTrack)||void 0===e||e.stop(),delete this.outputTrack,delete this.effectTrack,this.emit(_A.Disposed)}))}setEnabled(e){return zI(this,void 0,void 0,(function*(){e?yield this.enable():yield this.disable()}))}}class RA extends wA{}class CA extends wA{constructor(e){super(),this.audioContext=e||new AudioContext}updateAudioContext(e){this.audioContext=e}}const TA={maxGain:2,rampTime:1};var xA;(class extends CA{constructor(e){super(e.audioContext),this.gainValue=1,this.options=Object.assign(Object.assign({},TA),e),yA.log("GainEffect init",{options:this.options})}loadMediaStream(e){const t=Object.create(null,{loadMediaStream:{get:()=>super.loadMediaStream}});return zI(this,void 0,void 0,(function*(){if(yield t.loadMediaStream.call(this,e),this.outputStream=yield this.createOutputStream(),!this.outputStream)throw new Error("gain effect: failed to create output stream");return this.outputStream.getAudioTracks()[0].enabled=e.getTracks()[0].enabled,this.outputStream}))}loadMediaStreamTrack(e){const t=Object.create(null,{loadMediaStreamTrack:{get:()=>super.loadMediaStreamTrack}});return zI(this,void 0,void 0,(function*(){if(yield t.loadMediaStreamTrack.call(this,e),[this.outputTrack]=(yield this.createOutputStream()).getTracks(),!this.outputTrack)throw new Error("gain effect: failed to create output track");return this.outputTrack}))}createOutputStream(){return zI(this,void 0,void 0,(function*(){if(!this.inputStream)throw new Error("gain effect: failed to create input stream");const e=this.audioContext.createMediaStreamSource(this.inputStream);this.gainNode=new GainNode(this.audioContext),e.connect(this.gainNode);const t=this.audioContext.createMediaStreamDestination();return this.gainNode.connect(t),[this.effectTrack]=t.stream.getTracks(),t.stream}))}setGainValue(e){e>this.options.maxGain&&(e=this.options.maxGain),this.gainValue=e,this.gainNode.gain.linearRampToValueAtTime(e,this.audioContext.currentTime+this.options.rampTime)}enable(){const e=Object.create(null,{enable:{get:()=>super.enable}});return zI(this,void 0,void 0,(function*(){this.gainNode.gain.linearRampToValueAtTime(this.gainValue,this.audioContext.currentTime+this.options.rampTime),yield e.enable.call(this)}))}disable(){const e=Object.create(null,{disable:{get:()=>super.disable}});return zI(this,void 0,void 0,(function*(){this.gainNode.gain.linearRampToValueAtTime(1,this.audioContext.currentTime+this.options.rampTime),yield e.disable.call(this)}))}dispose(){const e=Object.create(null,{dispose:{get:()=>super.dispose}});return zI(this,void 0,void 0,(function*(){this.gainNode.disconnect(),yield e.dispose.call(this)}))}}).kind="gain-effect",function(e){e.Legacy="LEGACY",e.Worklet="WORKLET"}(xA||(xA={}));const kA=Object.freeze({mode:xA.Worklet,avoidSimd:!1,authToken:""}),IA=(e=>{const t=new Map;function r(...r){return zI(this,void 0,void 0,(function*(){const n=JSON.stringify(r),i=t.get(n);if(void 0!==i)return i;const o=yield e.apply(this,r),a=yield fetch(o),s=URL.createObjectURL(yield a.blob());return t.set(n,s),s}))}return r.clearCache=()=>{t.clear()},r})(((e,t,r)=>zI(void 0,void 0,void 0,(function*(){return((e,t,r)=>{const n=r===EA.Int?"https://models-auth.us-east-2.int.infra.intelligence.webex.com/generate":"https://models-auth.intelligence.webex.com/generate",i={items:Array.isArray(e)?e:[e]},o={method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(i)};return fetch(n,o).then((e=>{if(!e.ok)throw e;return e.json()}))})(e,t,r).then((e=>{var t,r;return null===(r=null===(t=e.items)||void 0===t?void 0:t[0])||void 0===r?void 0:r.url})).catch((()=>{throw new Error("Fetching signed url failed. Please check the auth token and try again.")}))}))));var AA;!function(e){e.Pending="pending",e.Resolved="resolved",e.Rejected="rejected"}(AA||(AA={}));class OA{constructor(e){this.state=AA.Pending,this.promise=null!=e?e:new Promise(((e,t)=>{this.resolve=t=>{this.state=AA.Resolved,e(t)},this.reject=e=>{this.state=AA.Rejected,t(e)}}))}}const LA=(e,t)=>Object.fromEntries(Object.entries(t).filter((t=>t[0]!==e)));class MA extends CA{constructor(e){super(null==e?void 0:e.audioContext),this.isReady=!1,this.disableFuture=new OA,this.enableFuture=new OA,this.options=Object.assign(Object.assign({},kA),e),yA.log("noise reduction: init effect",LA("authToken",this.options))}get isLoaded(){return!!this.loadFuture}fetchUrl(e){return zI(this,void 0,void 0,(function*(){let t=e;if(!this.options.authToken)throw new Error("noise reduction: auth token is required");return!this.options.avoidSimd&&(yield MA.supportsSimd())&&(t=e.replace(".js",".simd.js")),IA(t,this.options.authToken,this.options.env).catch((e=>{throw new Error(`noise reduction: ${e.message}`)}))}))}loadMediaStream(e){const t=Object.create(null,{loadMedia:{get:()=>super.loadMedia}});return zI(this,void 0,void 0,(function*(){yA.log("noise reduction: load stream",e);const[r]=e.getAudioTracks();if(!r)throw new Error("noise reduction: load stream failed, no audio track found");if(yield t.loadMedia.call(this,r,e),this.outputStream=yield this.createOutputStream(),!this.outputStream)throw new Error("noise reduction: failed to create output stream");return this.outputStream.getAudioTracks()[0].enabled=r.enabled,this.outputStream}))}loadMediaStreamTrack(e){const t=Object.create(null,{loadMediaStreamTrack:{get:()=>super.loadMediaStreamTrack}});return zI(this,void 0,void 0,(function*(){if(yield t.loadMediaStreamTrack.call(this,e),[this.outputTrack]=(yield this.createOutputStream()).getTracks(),!this.outputTrack)throw new Error("noise reduction: failed to create output track");return this.outputTrack}))}createOutputStream(){var e;return zI(this,void 0,void 0,(function*(){if(!this.inputStream)throw new Error("noise reduction: failed to create input stream");const t=this.audioContext.createMediaStreamDestination();return[this.effectTrack]=t.stream.getTracks(),this.loadFuture?this.loadFuture.promise:(this.loadFuture=new OA,yield null===(e=this.disposeFuture)||void 0===e?void 0:e.promise,this.disposeFuture=new OA,this.options.mode===xA.Legacy?this.loadLegacy(this.inputStream,t):this.loadWorklet(this.inputStream,t))}))}preloadAssets(){return zI(this,void 0,void 0,(function*(){const e=performance.now();yA.log("noise reduction: preloading assets",this.options.mode);try{yield this.ensureProcessorLoaded();const t=performance.now(),r=Math.round(t-e)/1e3;yA.log(`noise reduction: preload completed in ${r} seconds`)}catch(e){throw yA.error("noise reduction: preload failed:",e),e}}))}ensureProcessorLoaded(){return zI(this,void 0,void 0,(function*(){if(this.processorLoadFuture)yield this.processorLoadFuture.promise;else if(!this.isReady){this.processorLoadFuture=new OA;try{this.options.mode===xA.Worklet?yield this.fetchAndLoadWorkletProcessor():this.options.mode===xA.Legacy&&(yield this.fetchAndLoadLegacyProcessor()),this.processorLoadFuture.resolve()}catch(e){throw this.processorLoadFuture.reject(e),this.processorLoadFuture=void 0,e}}}))}fetchAndLoadWorkletProcessor(){var e,t;return zI(this,void 0,void 0,(function*(){const r="denoise/processors/2.4.2/noise-reduction-processor.worklet.js";let n;n=this.options.workletProcessorUrl?this.options.workletProcessorUrl:this.options.baseUrl?`${this.options.baseUrl}/${r}`:yield this.fetchUrl(r),yA.log("noise reduction: fetch worklet processor",n),yA.log("noise reduction: add worklet processor to audio context"),yield null===(t=null===(e=this.audioContext)||void 0===e?void 0:e.audioWorklet)||void 0===t?void 0:t.addModule(n)}))}fetchAndLoadLegacyProcessor(){return zI(this,void 0,void 0,(function*(){const e="denoise/processors/2.4.2/noise-reduction-processor.legacy.js";let t;var r;t=this.options.legacyProcessorUrl?this.options.legacyProcessorUrl:this.options.baseUrl?`${this.options.baseUrl}/${e}`:yield this.fetchUrl(e),yA.log("noise reduction: fetch legacy processor url",t),yA.log("noise reduction: append legacy processor to global scope"),yield(r=t,zI(void 0,void 0,void 0,(function*(){return new Promise(((e,t)=>{var n;const i=document.getElementsByTagName("script")[0],o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src=r,o.onload=e,o.onerror=t,null===(n=i.parentNode)||void 0===n||n.insertBefore(o,i)}))})))}))}loadWorklet(e,t){return zI(this,void 0,void 0,(function*(){if(!this.loadFuture)throw new Error("noise reduction: the load future was not initialized correctly");yA.log("noise reduction: load worklet");try{if(yield this.ensureProcessorLoaded(),!AudioWorkletNode)throw new Error("noise reduction: `AudioWorkletNode` unavailable in current scope");yA.log("noise reduction: attach worklet processor"),this.workletNode=new AudioWorkletNode(this.audioContext,"noise-reduction-worklet-processor"),this.workletNode.port.onmessage=e=>{var r,n,i;switch(yA.log(`noise reduction: worklet processor ${e.data.type.toLowerCase()}`),e.data.type){case MA.Events.Ready:this.isReady=!0,null===(r=this.loadFuture)||void 0===r||r.resolve(t.stream);break;case MA.Events.Disabled:this.handleDisabled();break;case MA.Events.Enabled:this.handleEnabled();break;case MA.Events.Disposed:this.isEnabled=!1,this.isReady=!1,null===(n=this.disposeFuture)||void 0===n||n.resolve(),this.emit(_A.Disposed);break;case MA.Events.Error:{const t=new Error(`noise reduction: worklet processor error, "${e.data.payload}"`);null===(i=this.loadFuture)||void 0===i||i.reject(t),yA.error(t);break}default:yA.warn("noise reduction: worklet processor unhandled message",e.data)}},this.workletNode.connect(t),this.sourceNode=this.audioContext.createMediaStreamSource(e),this.sourceNode.connect(this.workletNode)}catch(e){const t=e instanceof Error?e.message:e;this.loadFuture.reject(new Error(`noise reduction: failed to load worklet processor: ${t}`))}return this.loadFuture.promise}))}loadLegacy(e,t){return zI(this,void 0,void 0,(function*(){if(!this.loadFuture)throw new Error("noise reduction: the load future was not initialized correctly");yA.log("noise reduction: load legacy");try{yield this.ensureProcessorLoaded(),this.legacyProcessor=new window.WebMediaEffects.NoiseReductionLegacyProcessor(this.audioContext.sampleRate);const r={16e3:256,32e3:512,48e3:512}[this.audioContext.sampleRate];this.legacyScriptNode=this.audioContext.createScriptProcessor(r,1,1),this.legacyScriptNode.connect(t),this.legacyScriptNode.onaudioprocess=this.legacyProcessor.processAudioChunk,this.sourceNode=this.audioContext.createMediaStreamSource(e),this.sourceNode.connect(this.legacyScriptNode),this.isReady=!0,this.loadFuture.resolve(t.stream)}catch(e){this.loadFuture.reject(new Error("noise reduction: failed to load legacy processor"))}return this.loadFuture.promise}))}enable(){var e,t;return zI(this,void 0,void 0,(function*(){if(yA.log("noise reduction: enable effect"),!this.isReady)throw new Error("noise reduction: not setup or ready");return this.enableFuture=new OA,null===(e=this.workletNode)||void 0===e||e.port.postMessage("ENABLE"),null===(t=this.legacyProcessor)||void 0===t||t.setEnabled(!0).then((()=>this.handleEnabled())),this.enableFuture.promise}))}disable(){var e,t;return zI(this,void 0,void 0,(function*(){if(yA.log("noise reduction: disable effect"),!this.isReady)throw new Error("noise reduction: not setup or ready");return this.disableFuture=new OA,null===(e=this.workletNode)||void 0===e||e.port.postMessage("DISABLE"),null===(t=this.legacyProcessor)||void 0===t||t.setEnabled(!1).then((()=>this.handleDisabled())),this.disableFuture.promise}))}dispose(){const e=Object.create(null,{dispose:{get:()=>super.dispose}});var t,r,n,i,o,a,s;return zI(this,void 0,void 0,(function*(){yA.log("noise reduction: dispose effect"),this.loadFuture&&(yield this.loadFuture.promise,this.loadFuture=void 0,null===(t=this.workletNode)||void 0===t||t.port.postMessage("DISPOSE"),null===(r=this.legacyProcessor)||void 0===r||r.dispose().then(null===(n=this.disposeFuture)||void 0===n?void 0:n.resolve),yield null===(i=this.disposeFuture)||void 0===i?void 0:i.promise,null===(o=this.workletNode)||void 0===o||o.disconnect(),null===(a=this.legacyScriptNode)||void 0===a||a.disconnect(),null===(s=this.sourceNode)||void 0===s||s.disconnect(),yield e.dispose.call(this),yA.log("noise reduction: effect disposed"))}))}handleDisabled(){const e=Object.create(null,{disable:{get:()=>super.disable}});return zI(this,void 0,void 0,(function*(){yield e.disable.call(this),this.disableFuture.resolve()}))}handleEnabled(){const e=Object.create(null,{enable:{get:()=>super.enable}});return zI(this,void 0,void 0,(function*(){yield e.enable.call(this),this.enableFuture.resolve()}))}updateSampleRate(e){const t=[16e3,32e3,48e3];if(!t.includes(e))throw new Error(`noise reduction: unsupported sample rate ${e}Hz, must be one of ${t.join(", ")}Hz`);if(this.isReady||this.loadFuture)throw new Error("noise reduction: cannot update sample rate after effect is loaded or loading");if(this.audioContext.sampleRate!==e){yA.log(`noise reduction: updating sample rate to ${e}Hz`);try{this.audioContext.close().catch((e=>{yA.warn("noise reduction: error closing audio context",e)}));const t=new AudioContext({sampleRate:e});this.processorLoadFuture=void 0,super.updateAudioContext(t),yA.log(`noise reduction: sample rate updated to ${e}Hz`)}catch(e){const t=e instanceof Error?e.message:String(e);throw yA.error(`noise reduction: failed to update sample rate: ${t}`),new Error(`noise reduction: failed to update sample rate: ${t}`)}}else yA.log(`noise reduction: sample rate already at ${e}Hz`)}updateAudioContext(e){const t=Object.create(null,{updateAudioContext:{get:()=>super.updateAudioContext}});var r,n,i;return zI(this,void 0,void 0,(function*(){yA.log("noise reduction: updating audio context");const o=this.isLoaded,a=this.isReady,s=this.isEnabled,c=this.inputStream;if(o||a){yA.log("noise reduction: disposing current pipeline"),null===(r=this.workletNode)||void 0===r||r.disconnect(),null===(n=this.legacyScriptNode)||void 0===n||n.disconnect(),null===(i=this.sourceNode)||void 0===i||i.disconnect(),this.isReady=!1,this.processorLoadFuture=void 0;const a=this.loadFuture;this.loadFuture=void 0;try{t.updateAudioContext.call(this,e),yA.log("noise reduction: audio context updated successfully"),o&&c&&(yA.log("noise reduction: reloading effect with new audio context"),yield this.loadMediaStream(c),s&&(yield this.enable()),a&&this.outputStream&&a.resolve(this.outputStream))}catch(e){const t=e instanceof Error?e.message:String(e);throw yA.error(`noise reduction: failed to update audio context: ${t}`),a&&a.reject(new Error(`noise reduction: failed to update audio context: ${t}`)),e}}else yA.log("noise reduction: simple audio context update (not loaded yet)"),t.updateAudioContext.call(this,e)}))}}MA.kind="noise-reduction-effect",MA.supportsSimd=()=>zI(void 0,void 0,void 0,(function*(){return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]))})),MA.Events={Ready:"READY",Disabled:"DISABLED",Disposed:"DISPOSED",Enabled:"ENABLED",Error:"ERROR"};!function(e){const t=new Map}((function(e){const[t,r,n,i,o]=e,a=(o-5)/3;return{batchSize:t,numAnchors:r,gridHeight:n,gridWidth:i,numBoxCoords:4,numLandmarks:3*a,numKeypoints:a,indexOfConfidence:4+3*a}}));var NA,PA,DA,FA;!function(e){e.TurnOn="turn-on",e.TurnOff="turn-off"}(NA||(NA={})),function(e){e.Idle="idle",e.Off="off",e.On="on"}(PA||(PA={})),function(e){e.On="on",e.Off="off",e.StateChange="state-change"}(DA||(DA={})),function(e){e.Off="off",e.Conservative="conservative",e.Aggressive="aggressive"}(FA||(FA={}));FA.Off,FA.Conservative,FA.Aggressive;var UA,jA;!function(e){e.Initial="initial",e.HighMotion="high-motion",e.TimeForced="time-forced",e.SkipIntervalElapsed="skip-interval-elapsed"}(UA||(UA={})),function(e){e.Off="off",e.Conservative="conservative",e.Aggressive="aggressive"}(jA||(jA={}));jA.Off,jA.Conservative,jA.Aggressive;var BA,qA;!function(e){e.Idle="idle",e.Init="init",e.Lagging="lagging",e.Low="low",e.Ok="ok"}(BA||(BA={})),function(e){e.RateOk="rate-ok",e.RateLow="rate-low",e.RateLagging="rate-lagging"}(qA||(qA={}));const VA={onnxVersion:"1.20.1",modelVersion:"0.7.7.2",workerFile:"segmentation.js",baseUrls:{int:"https://models.int.infra.intelligence.webex.com",prod:"https://models.intelligence.webex.com"},basePaths:{models:"ladon/models",wasm:"ladon/wasm",workers:"ladon/workers"},blurStrengths:{weak:{kernelSize:9,sigma:2},moderate:{kernelSize:15,sigma:6},strong:{kernelSize:25,sigma:11},stronger:{kernelSize:37,sigma:17},strongest:{kernelSize:49,sigma:23}},modelQualities:{tiny:{modelFile:"tiny-640x360.onnx",inputSize:{width:640,height:360},outputSize:{width:640,height:360},upscaleSize:{width:640,height:360},generationIntervalMs:48,modelRank:4},low:{modelFile:"low-640x360.onnx",inputSize:{width:640,height:360},outputSize:{width:640,height:360},upscaleSize:{width:640,height:360},generationIntervalMs:48,modelRank:4},medium:{modelFile:"medium-640x360.onnx",inputSize:{width:640,height:360},outputSize:{width:640,height:360},upscaleSize:{width:640,height:360},generationIntervalMs:36,modelRank:4},high:{modelFile:"medium-640x360.onnx",inputSize:{width:640,height:360},outputSize:{width:640,height:360},upscaleSize:{width:640,height:360},generationIntervalMs:24,modelRank:4},ultra:{modelFile:"medium-640x360.onnx",inputSize:{width:640,height:360},outputSize:{width:640,height:360},upscaleSize:{width:640,height:360},generationIntervalMs:0,modelRank:4}},modelUrlTemplate:"${BASE_PATH_MODELS}/${MODEL_VERSION}/${MODEL_FILE}",wasmPathTemplate:"${BASE_PATH_WASM}/${ONNX_VERSION}/",workerUrlTemplate:"${BASE_PATH_WORKERS}/${LIB_VERSION}/${WORKER_FILE}"};class GA{constructor(e="prod"){this.env=e,this.config={}}setBaseUrl(e){return this.config.baseUrl=e.replace(/\/+$/,""),this}setWasmUri(e){return this.config.wasmUri=e,this}setAssetUrlResolver(e){return this.config.assetUrlResolver=e,this}setExecutionProviders(e){return"string"==typeof e&&(e=[e]),this.config.executionProviders=e,this}setInputSize(e,t){return this.config.input={height:e,width:t},this}setInputConfig(e){return this.config.input={...e},this}setRenderConfig(e){return this.config.render={...e},this}setRenderType(e){return this.config.render?this.config.render.type=e:this.config.render={type:e},this}setRenderHorizontalMirror(e){if(!this.config.render)throw new Error("Render config must be set before setting horizontal mirror.");return this.config.render.horizontalMirror=e,this}setBlurStrength(e){var t;const r=GA.getBlurConfig(e,null==(t=this.config.render)?void 0:t.horizontalMirror);return this.config.render={...this.config.render,...r},this}setBlurKernelSize(e){if(!this.config.render||"blur"!==this.config.render.type)throw new Error("Render config must be of type blur to set blur properties.");return this.config.render.kernelSize=e,this}setBlurSigma(e){if(!this.config.render||"blur"!==this.config.render.type)throw new Error("Render config must be of type blur to set blur properties.");return this.config.render.sigma=e,this}setReplacementBackground(e){if(!this.config.render||"replacement"!==this.config.render.type)throw new Error("Render config must be of type replacement to set replacement properties.");return this.config.render.background=e,this}setReplacementStatic(e){if(!this.config.render||"replacement"!==this.config.render.type)throw new Error("Render config must be of type replacement to set replacement properties.");return this.config.render.static=e,this}setMaskConfig(e){return this.config.mask={...e},this}setMaskGenerator(e){"worker"!==e&&console.warn('[ladon-ts] Mask generator must be "worker". "local" is deprecated.');return this.getMaskConfig().generator=e,this}setMaskGenerationIntervalMs(e){return this.getMaskConfig().generationIntervalMs=e,this}setMaskModelRank(e){return this.getMaskConfig().modelRank=e,this}setMaskModelUri(e){return this.getMaskConfig().modelUri=e,this}setMaskWorkerUri(e){return this.getMaskConfig().workerUri=e,this}setMaskInputSize(e,t){return this.getMaskConfig().inputSize={height:e,width:t},this}setMaskOutputSize(e,t){return this.getMaskConfig().outputSize={height:e,width:t},this}setMaskUpscaleSize(e,t){return this.getMaskConfig().upscaleSize={height:e,width:t},this}setMaskQuality(e){const{modelQualities:t}=VA,r=this.getMaskConfig(),n=e.toLowerCase(),i=t[n];if(!i)throw new Error(`[ladon-ts] - unknown quality option: ${e}`);return r.qualityKey=n,Object.assign(r,i),this}build(e=!0){const t=this.resolveBaseUrl(),r=this.resolveModelUri(),n=this.resolveWasmUri(),i=this.resolveWorkerUri(),o=this.config.input,a=this.config.render,s=this.config.mask,c=this.config.executionProviders,u=this.config.assetUrlResolver;if(!s)throw new Error("Mask configuration must be set before building the configuration.");const l={assetUrlResolver:u,executionProviders:c,baseUrl:t,wasmUri:n,mask:{generator:s.generator,generationIntervalMs:s.generationIntervalMs,modelRank:s.modelRank,inputSize:s.inputSize,outputSize:s.outputSize,upscaleSize:s.upscaleSize,modelUri:r,workerUri:i}};if(e){if(!o)throw new Error("Input must be set before building the configuration.");if(!a)throw new Error("Render must be set before building the configuration.");return{...l,input:o,render:a}}return l}getMaskConfig(){return this.config.mask||(this.config.mask={}),this.config.mask}resolveBaseUrl(){return this.config.baseUrl||VA.baseUrls[this.env]}resolveModelUri(){var e;if(null!=(e=this.config.mask)&&e.modelUri)return this.config.mask.modelUri;const t=this.getMaskConfig();if(!t.qualityKey)throw new Error("[ladon-ts] No quality set, cannot infer modelFile.");return this.resolveTemplate(VA.modelUrlTemplate,{BASE_PATH_MODELS:VA.basePaths.models,MODEL_VERSION:VA.modelVersion,MODEL_FILE:VA.modelQualities[t.qualityKey].modelFile})}resolveWasmUri(){return this.config.wasmUri?this.config.wasmUri:this.resolveTemplate(VA.wasmPathTemplate,{BASE_PATH_WASM:VA.basePaths.wasm,ONNX_VERSION:VA.onnxVersion})}resolveWorkerUri(){var e;return null!=(e=this.config.mask)&&e.workerUri?this.config.mask.workerUri:this.resolveTemplate(VA.workerUrlTemplate,{BASE_PATH_WORKERS:VA.basePaths.workers,LIB_VERSION:GA.getLibVersion(),WORKER_FILE:VA.workerFile})}resolveTemplate(e,t){return e.replace(/\$\{([A-Z_]+)\}/g,((e,r)=>{if(!t[r])throw new Error(`Missing value for template variable: ${r}`);return t[r]}))}static getBlurConfig(e,t){const r=e.toLowerCase(),n=VA.blurStrengths[r];if(!n)throw new Error(`[ladon-ts] Unknown blur strength: ${e}`);return{type:"blur",horizontalMirror:t,...n}}static getPassthroughConfig(e){return{type:"passthrough",horizontalMirror:e}}static getLibVersion(){return"5.5.1"}}var WA=(e=>(e.TINY="TINY",e.LOW="LOW",e.MEDIUM="MEDIUM",e.HIGH="HIGH",e.ULTRA="ULTRA",e))(WA||{}),zA=(e=>(e.WEAK="WEAK",e.MODERATE="MODERATE",e.STRONG="STRONG",e.STRONGER="STRONGER",e.STRONGEST="STRONGEST",e))(zA||{});function HA(e,t,r){const n=e.createShader(t);if(!n)throw new Error("[ladon-ts] - error creating shader");if(e.shaderSource(n,r),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS)){const t=e.getShaderInfoLog(n)??"unknown error compiling shader.";throw new Error("[ladon-ts] - "+t)}return n}function KA(e,t,r){const n=e.createProgram();if(!n)throw new Error("[ladon-ts] - error creating GPU program");if(e.attachShader(n,t),e.attachShader(n,r),e.linkProgram(n),!e.getProgramParameter(n,e.LINK_STATUS)){const t=e.getProgramInfoLog(n)??"unknown error linking program.";throw new Error("[ladon-ts] - "+t)}return n}const $A=new class{constructor(){this.resolvedUriCache=new Map}async resolveUri(e,t){if(!t)throw new Error("Asset URI is undefined.");if(this.resolvedUriCache.has(t))return this.resolvedUriCache.get(t);let r;if(function(e){if(e.startsWith("blob:"))return!0;try{return new URL(e),!0}catch{return!1}}(t)?r=t:t.match(/\.[a-z0-9]+$/i)?"function"==typeof e.assetUrlResolver&&(r=await e.assetUrlResolver(t,e)):r=((e,t)=>!t||e.startsWith("http")?new URL(e).href:e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t)(t,e.baseUrl),!r)throw new Error(`Failed to resolve asset URI: ${t}`);return this.resolvedUriCache.set(t,r),r}};const JA=new class{async initializeWorker(e){if(typeof Worker>"u")throw new Error("[ladon-ts] web workers are not supported in this environment");const t=await $A.resolveUri(e,e.mask.workerUri),r=await(await fetch(t,{cache:"force-cache"})).text();return this.workerUrl=URL.createObjectURL(new Blob([r],{type:"text/javascript"})),new Worker(this.workerUrl,{type:"module"})}terminateWorker(){this.worker&&(this.worker.terminate(),this.worker=void 0)}async preloadWorker(e){const t=await this.prepareWorkerConfig(e);this.worker=await this.initializeWorker(t),this.worker.postMessage({type:"preload",config:t})}getWorker(){return this.worker}getWorkerUrl(){return this.workerUrl}async prepareWorkerConfig(e){const t={...{...e,mask:{...e.mask,modelUri:await $A.resolveUri(e,e.mask.modelUri),workerUri:await $A.resolveUri(e,e.mask.workerUri)},wasmUri:await $A.resolveUri(e,e.wasmUri)},assetUrlResolver:void 0};return JSON.parse(JSON.stringify(t))}};class YA{constructor(e){this.config=e,this.newMask=!0,this.lastMask=new Float32Array(this.config.mask.outputSize.height*this.config.mask.outputSize.width),this.lastResult={data:this.lastMask,facesAndLandmarks:{data:new Float32Array(0),dims:[]},gesture:new Float32Array(0),motion:0,timestamp:0,warm:!1}}async getLadonOutput(e){const t={data:this.lastMask,facesAndLandmarks:this.lastResult.facesAndLandmarks,gesture:this.lastResult.gesture,motion:this.lastResult.motion,timestamp:this.lastResult.timestamp,warm:this.newMask};return this.newMask=!1,t}async load(){const e=await JA.prepareWorkerConfig(this.config);if(this.worker=JA.getWorker(),this.worker??(this.worker=await JA.initializeWorker(e)),!this.worker)throw new Error("[ladon-ts] - worker is not defined.");this.worker.onmessage=e=>{if("log"===e.data.type){const{message:t,severity:r}=e.data,n=`[ladon-ts] Message received from worker: ${t}`;switch(r){case"warn":console.warn(n);break;case"error":console.error(n);break;default:console.log(n)}}else if("generated"===e.data.status)this.lastMask=e.data.mask,this.lastResult={data:e.data.mask,facesAndLandmarks:e.data.facesAndLandmarks,gesture:e.data.gesture,motion:e.data.motion,timestamp:e.data.timestamp,warm:!0},this.newMask=!0;else{const e=JA.getWorkerUrl();e&&URL.revokeObjectURL(e),null==r||r()}};const t={baseUrl:e.baseUrl,input:e.input,mask:e.mask,wasmUri:e.wasmUri,render:{type:"passthrough"}};let r;return this.worker.postMessage({type:"init",config:t}),new Promise((e=>{r=e}))}isLoaded(){return!!this.worker}async postRender(e,t){if(!this.worker)throw new Error("[ladon-ts] - worker is not defined.");this.worker.postMessage({type:"generate",image:e,timestamp:t},[e.buffer])}destroy(){JA.terminateWorker()}}class QA{constructor(e,t){this.output_canvas=e,this.config=t,this.verts=new Float32Array([-1,-1,0,-1,1,0,1,1,0,1,1,0,1,-1,0,-1,-1,0]),this.vertex_shader_src="#version 300 es\n\nin vec4 position;\n\nvoid main() {\n gl_Position = position;\n}\n",this.fragment_shader_header="#version 300 es\nprecision highp float;\n\nout vec4 outColor;\n\nuniform sampler2D u_image;\nuniform sampler2D u_mask;\nuniform vec2 u_resolution;\n",this.shared_shader_functions="\nfloat get_mask(vec2 uv) {\n float maskValue = texture(u_mask, uv).r;\n return smoothstep(0.0, 1.0, maskValue);\n}\n";const r=this.output_canvas.getContext("webgl2",{antialias:!0});if(r)this.gl=r;else{const e=this.output_canvas.getContext("2d");if(!e)throw new Error("[ladon-ts] - output canvas context must be webgl2 or 2d");this.output_canvas_2d=e,this.intermediate_canvas=document.createElement("canvas"),this.intermediate_canvas.height=this.config.input.height,this.intermediate_canvas.width=this.config.input.width;const t=this.intermediate_canvas.getContext("webgl2",{antialias:!0});if(!t)throw new Error("[ladon-ts] - error getting output context webgl");this.gl=t}this.initTexturesAndBuffers()}initTexturesAndBuffers(){this.image_texture=this.createTexture(this.gl.RGBA,this.config.input.width,this.config.input.height),this.mask_texture=this.createTexture(this.gl.R8,this.config.mask.upscaleSize.width,this.config.mask.upscaleSize.height);const e=this.gl.createVertexArray();if(!e)throw new Error("[ladon-ts] - error creating vertex array");this.gl.bindVertexArray(e);const t=this.gl.createBuffer();if(!t)throw new Error("[ladon-ts] - error creating buffer");this.gl.bindBuffer(this.gl.ARRAY_BUFFER,t),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.verts,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(0,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(0),this.gl.viewport(0,0,this.config.input.width,this.config.input.height)}createTexture(e,t,r,n=(()=>{this.gl.texImage2D(this.gl.TEXTURE_2D,0,e,t,r,0,e===this.gl.RGBA?this.gl.RGBA:this.gl.RED,this.gl.UNSIGNED_BYTE,null)})){const i=this.gl.createTexture();if(!i)throw new Error("[ladon-ts] - error creating texture");return this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),n(),this.gl.bindTexture(this.gl.TEXTURE_2D,null),i}getUVCalculation(){return this.config.render.horizontalMirror?"vec2 st = vec2(1.0 - gl_FragCoord.x / u_resolution.x, 1.0 - gl_FragCoord.y / u_resolution.y);":"vec2 st = vec2(gl_FragCoord.x / u_resolution.x, 1.0 - gl_FragCoord.y / u_resolution.y);"}setSharedUniforms(e){const t=this.gl.getUniformLocation(e,"u_resolution");if(!t)throw new Error('[ladon-ts] - error finding "u_resolution" uniform');this.gl.uniform2f(t,this.config.input.width,this.config.input.height);const r=this.gl.getUniformLocation(e,"u_image");if(!r)throw new Error('[ladon-ts] - error finding "u_image" uniform');this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.image_texture),this.gl.uniform1i(r,0);const n=this.gl.getUniformLocation(e,"u_mask");n&&(this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,this.mask_texture),this.gl.uniform1i(n,1))}uploadVideoStream(e){this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.image_texture),e instanceof HTMLVideoElement?this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e):this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.config.input.width,this.config.input.height,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e)}uploadMask(e){if(null!=e&&e.warm){const t=function(e,t,r,n,i){const o=new Uint8ClampedArray(n*i);if(t===n&&r===i){for(let t=0;t<e.length;t++)o[t]=Math.min(Math.max(e[t],0),255);return o}const a=(t-1)/(n-1),s=(r-1)/(i-1);for(let c=0;c<i;c++)for(let i=0;i<n;i++){const u=a*i,l=s*c,d=Math.floor(u),f=Math.floor(l),h=Math.min(Math.ceil(u),t-1),p=Math.min(Math.ceil(l),r-1),v=u-d,m=l-f,g=e[f*t+d]*(1-v)*(1-m)+e[f*t+h]*v*(1-m)+e[p*t+d]*(1-v)*m+e[p*t+h]*v*m;o[c*n+i]=Math.min(Math.max(g,0),255)}return o}(e.data,this.config.mask.outputSize.width,this.config.mask.outputSize.height,this.config.mask.upscaleSize.width,this.config.mask.upscaleSize.height);this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,this.mask_texture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.R8,this.config.mask.upscaleSize.width,this.config.mask.upscaleSize.height,0,this.gl.RED,this.gl.UNSIGNED_BYTE,t)}}postDraw(){this.output_canvas_2d&&this.intermediate_canvas&&this.output_canvas_2d.drawImage(this.intermediate_canvas,0,0,this.config.input.width,this.config.input.height)}}class XA extends QA{constructor(e,t){if(super(e,t),this.output_canvas=e,this.config=t,this.fragment_shader_common=`#version 300 es\nprecision highp float;\n\n#define KERNEL_SIZE ${this.config.render.kernelSize}\n#define HORIZONTAL vec2(1.0, 0.0)\n#define VERTICAL vec2(0.0, 1.0)\n\nout vec4 outColor;\n\nuniform sampler2D u_image;\nuniform sampler2D u_mask;\nuniform vec2 u_resolution;\nuniform float u_kernel[KERNEL_SIZE];\n\n// Function to retrieve the mask value\nfloat get_mask(vec2 st) {\n return texture(u_mask, st).r;\n}\n\n// Get the inverse of the masked area\nfloat get_inv_mask(vec2 st) {\n return 1.0 - get_mask(st);\n}\n\n// Blurring function\nvec3 blur(sampler2D src, vec2 uv, vec2 direction) {\n vec4 accum = vec4(0.0);\n vec2 step = direction / u_resolution;\n int offset = (KERNEL_SIZE - 1) / 2;\n\n float weightSum = 0.0;\n for (int i = 0; i < KERNEL_SIZE; i++) {\n vec2 sampleUV = uv + step * float(i - offset);\n vec4 sampleTex = texture(src, sampleUV);\n float weight = u_kernel[i];\n accum += sampleTex * weight;\n weightSum += weight;\n }\n\n weightSum = max(weightSum, 0.001); // Avoid division by zero\n return accum.rgb / weightSum;\n}\n`,this.fragment_shader_pass_1_src=this.fragment_shader_common+"\nvoid main() {\n vec2 st = gl_FragCoord.xy / u_resolution;\n outColor = vec4(blur(u_image, st, HORIZONTAL), 1.0);\n}\n",this.fragment_shader_pass_2_src=this.fragment_shader_common+`\nuniform sampler2D u_blur;\n\nvoid main() {\n ${this.getUVCalculation()};\n\n vec3 blurred = blur(u_blur, st, VERTICAL);\n vec3 original = texture(u_image, st).rgb;\n float mask = get_inv_mask(st); // Use inverse mask to blur background, not user\n\n // Correct blending based on the mask\n vec3 color = mix(original, blurred, mask); // Ensure mask properly determines blur influence on background\n outColor = vec4(color, 1.0);\n}\n`,this.config.render.kernelSize%2==0)throw new Error("[ladon-ts] - kernel_size must be odd");{const e=HA(this.gl,this.gl.VERTEX_SHADER,this.vertex_shader_src),t=HA(this.gl,this.gl.FRAGMENT_SHADER,this.fragment_shader_pass_1_src);this.program_1=KA(this.gl,e,t),this.gl.useProgram(this.program_1);const r=this.gl.createFramebuffer();if(!r)throw new Error("[ladon-ts] - error creating framebuffer");this.framebuffer=r;const n=this.gl.createTexture();if(!n)throw new Error("[ladon-ts] - error creating output texture");this.transfer_texture=n,this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.framebuffer),this.gl.bindTexture(this.gl.TEXTURE_2D,this.transfer_texture),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.config.input.width,this.config.input.height,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,this.transfer_texture,0),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),this.setSharedUniforms(this.program_1);const i=this.gl.getUniformLocation(this.program_1,"u_kernel");if(!i)throw new Error('[ladon-ts] - error finding "u_kernel" uniform');this.gl.uniform1fv(i,this.getBlurKernel())}{const e=HA(this.gl,this.gl.VERTEX_SHADER,this.vertex_shader_src),t=HA(this.gl,this.gl.FRAGMENT_SHADER,this.fragment_shader_pass_2_src);this.program_2=KA(this.gl,e,t),this.gl.useProgram(this.program_2);const r=this.gl.getUniformLocation(this.program_2,"u_blur");if(!r)throw new Error('[ladon-ts] - error finding "u_blur" uniform');this.u_blur=r,this.gl.activeTexture(this.gl.TEXTURE2),this.gl.bindTexture(this.gl.TEXTURE_2D,this.transfer_texture),this.gl.uniform1i(this.u_blur,2),this.setSharedUniforms(this.program_2);const n=this.gl.getUniformLocation(this.program_2,"u_kernel");if(!n)throw new Error('[ladon-ts] - error finding "u_kernel" uniform');this.gl.uniform1fv(n,this.getBlurKernel())}}async render(e,t){this.uploadVideoStream(e),this.uploadMask(t),this.gl.useProgram(this.program_1),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.framebuffer),this.gl.drawArrays(this.gl.TRIANGLES,0,this.verts.length/3),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),this.gl.useProgram(this.program_2),this.gl.drawArrays(this.gl.TRIANGLES,0,this.verts.length/3),this.postDraw()}async load(){}destroy(){}getBlurKernel(){const e=[];let t=0;for(let r=0;r<this.config.render.kernelSize;r++){let n=r-(this.config.render.kernelSize-1)/2;n=Math.exp(-(n**2)/this.config.render.sigma**2),e.push(n),t+=n}for(let r=0;r<this.config.render.kernelSize;r++)e[r]=e[r]/t;return new Float32Array(e)}}class ZA extends QA{constructor(e,t){super(e,t),this.output_canvas=e,this.config=t,this.fragment_shader=`#version 300 es\nprecision highp float;\n\nout vec4 outColor;\n\nuniform sampler2D u_image;\nuniform vec2 u_resolution;\n\n\nvoid main() {\n ${this.getUVCalculation()}\n\n outColor = vec4(texture(u_image, st).rgb, 1.0);\n}\n`;const r=HA(this.gl,this.gl.VERTEX_SHADER,this.vertex_shader_src),n=HA(this.gl,this.gl.FRAGMENT_SHADER,this.fragment_shader);this.program=KA(this.gl,r,n),this.gl.useProgram(this.program),this.setSharedUniforms(this.program)}async render(e){this.uploadVideoStream(e),this.gl.useProgram(this.program),this.gl.drawArrays(this.gl.TRIANGLES,0,this.verts.length/3),this.postDraw()}async load(){}destroy(){}}class eO extends QA{constructor(e,t){super(e,t),this.output_canvas=e,this.config=t;const r=this.config.render.background.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("[ladon-ts] - could not get background canvas context 2d");this.background_canvas_ctx=r,this.fragment_shader=this.buildFragmentShader();const n=HA(this.gl,this.gl.VERTEX_SHADER,this.vertex_shader_src),i=HA(this.gl,this.gl.FRAGMENT_SHADER,this.fragment_shader);this.program=KA(this.gl,n,i),this.gl.useProgram(this.program),this.setSharedUniforms(this.program),this.setupBackgroundTexture()}buildFragmentShader(){return`${this.fragment_shader_header}\n \nuniform sampler2D u_background;\n\n${this.shared_shader_functions}\n\nvoid main() {\n ${this.getUVCalculation()}\n\n vec3 background = texture(u_background, st).rgb;\n vec3 image = texture(u_image, st).rgb;\n float mask = get_mask(st);\n\n vec3 color = mix(background, image, mask);\n outColor = vec4(color, 1.0);\n}`}setupBackgroundTexture(){const e=this.background_canvas_ctx.getImageData(0,0,this.config.render.background.width,this.config.render.background.height);this.background_texture=this.createTexture(this.gl.RGBA,this.config.render.background.width,this.config.render.background.height,(()=>{this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,e.width,e.height,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e.data)}));const t=this.gl.getUniformLocation(this.program,"u_background");if(!t)throw new Error('[ladon-ts] - error finding "u_background" uniform');this.gl.activeTexture(this.gl.TEXTURE2),this.gl.bindTexture(this.gl.TEXTURE_2D,this.background_texture),this.gl.uniform1i(t,2)}async render(e,t){if(this.uploadVideoStream(e),this.uploadMask(t),!this.config.render.static){const e=this.background_canvas_ctx.getImageData(0,0,this.config.render.background.width,this.config.render.background.height).data;this.gl.activeTexture(this.gl.TEXTURE2),this.gl.bindTexture(this.gl.TEXTURE_2D,this.background_texture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.config.render.background.width,this.config.render.background.height,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e)}this.gl.useProgram(this.program),this.gl.drawArrays(this.gl.TRIANGLES,0,this.verts.length/3),this.postDraw()}async load(){}destroy(){}}class tO{constructor(e,t,r,n){this.inputCanvas=e,this.outputCanvas=t,this.config=r,this.videoElement=n,this.loaded=!1,this.frameQueue=[],this.maskQueue=[];const i=this.inputCanvas.getContext("2d",{alpha:!1,willReadFrequently:!0});if(!i)throw new Error("[ladon-ts] - error getting input context 2d");this.inputCanvasCtx=i}async onFrame(e,t=!0){if(!this.generator||!this.renderer)throw new Error("[ladon-ts] - pipeline is not loaded.");const r=this.getInputFrameData(t);if(r instanceof Uint8ClampedArray?((!this.frameDataBuffer||this.frameDataBuffer.length!==r.length)&&(this.frameDataBuffer=new Uint8ClampedArray(r.length)),this.frameDataBuffer.set(r),this.frameQueue.push({timestamp:e,frameData:this.frameDataBuffer})):this.frameQueue.push({timestamp:e,frameData:r}),t||!this.lastMaskResult){const t=r,n=this.getMaskImageData(t),i=await this.generator.getLadonOutput(n,e);this.maskQueue.push({timestamp:i.timestamp,maskResult:i}),this.lastMaskResult=i,await this.renderSyncedFrameAndMask(),await this.generator.postRender(n,e)}else this.maskQueue.push({timestamp:e,maskResult:this.lastMaskResult}),await this.renderSyncedFrameAndMask();return this.createInferenceResult(e,t)}async renderSyncedFrameAndMask(){for(var e;this.frameQueue.length>0&&this.maskQueue.length>0;){const t=this.frameQueue[0],r=this.maskQueue[0];t.timestamp===r.timestamp?(await(null==(e=this.renderer)?void 0:e.render(t.frameData,r.maskResult)),this.frameQueue.shift(),this.maskQueue.shift()):t.timestamp<r.timestamp?this.frameQueue.shift():this.maskQueue.shift()}}getInputFrameData(e){return e||!this.videoElement?this.inputCanvasCtx.getImageData(0,0,this.config.input.width,this.config.input.height).data:this.videoElement}getMaskImageData(e){const t=this.config.mask.inputSize,r=this.config.input;return t.width===r.width&&t.height===r.height?e:((e,t,r,n,i)=>{const o=new Uint8ClampedArray(n*i*4),a=t/n,s=r/i,c=4*t;let u=0;for(let t=0;t<i;t++){const r=Math.floor(t*s)*c;for(let t=0;t<n;t++){const n=r+4*Math.floor(t*a);o[u++]=e[n],o[u++]=e[n+1],o[u++]=e[n+2],o[u++]=e[n+3]}}return o})(e,r.width,r.height,t.width,t.height)}createInferenceResult(e,t){return this.lastMaskResult?{facesAndLandmarks:this.lastMaskResult.facesAndLandmarks,gesture:this.lastMaskResult.gesture,motion:this.lastMaskResult.motion,skipped:!t,timestamp:e}:{facesAndLandmarks:{data:new Float32Array(0),dims:[]},gesture:new Float32Array(0),motion:0,skipped:!0,timestamp:e}}isLoaded(){return this.loaded}async load(){switch(this.config.render.type){case"blur":this.renderer=new XA(this.outputCanvas,this.config);break;case"passthrough":this.renderer=new ZA(this.outputCanvas,this.config);break;case"replacement":this.renderer=new eO(this.outputCanvas,this.config);break;default:throw new Error("[ladon-ts] - renderer not implemented.")}await this.renderer.load(),this.generator=new YA(this.config),await this.generator.load(),this.loaded=!0}resetQueues(){this.frameQueue=[],this.maskQueue=[]}reset(){this.resetQueues(),this.lastMaskResult=void 0}destroy(){var e,t;this.reset(),null==(e=this.generator)||e.destroy(),null==(t=this.renderer)||t.destroy(),this.frameDataBuffer=void 0}}var rO={exports:{}};!function(e,t){!function(e){var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,i=536870912,o=2*i,a=function(e,t){return function(r){var a=t.get(r),s=void 0===a?r.size:a<o?a+1:0;if(!r.has(s))return e(r,s);if(r.size<i){for(;r.has(s);)s=Math.floor(Math.random()*o);return e(r,s)}if(r.size>n)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(s);)s=Math.floor(Math.random()*n);return e(r,s)}},s=new WeakMap,c=r(s),u=a(c,s),l=t(u);e.addUniqueNumber=l,e.generateUniqueNumber=u}(t)}(0,rO.exports);const nO=((e,t)=>{let r=null;return()=>{if(null!==r)return r;const n=new Blob([t],{type:"application/javascript; charset=utf-8"}),i=URL.createObjectURL(n);return r=e(i),setTimeout((()=>URL.revokeObjectURL(i))),r}})((e=>{const t=new Map([[0,()=>{}]]),r=new Map([[0,()=>{}]]),n=new Map,i=new Worker(e);i.addEventListener("message",(({data:e})=>{if(void 0!==(i=e).method&&"call"===i.method){const{params:{timerId:i,timerType:o}}=e;if("interval"===o){const e=t.get(i);if(void 0===typeof e)throw new Error("The timer is in an undefined state.");if("number"==typeof e){const t=n.get(e);if(void 0===t||t.timerId!==i||t.timerType!==o)throw new Error("The timer is in an undefined state.")}else"function"==typeof e&&e()}else if("timeout"===o){const e=r.get(i);if(void 0===typeof e)throw new Error("The timer is in an undefined state.");if("number"==typeof e){const t=n.get(e);if(void 0===t||t.timerId!==i||t.timerType!==o)throw new Error("The timer is in an undefined state.")}else"function"==typeof e&&(e(),r.delete(i))}}else{if(!(e=>"number"==typeof e.id&&"boolean"==typeof e.result)(e)){const{error:{message:t}}=e;throw new Error(t)}{const{id:i}=e,o=n.get(i);if(void 0===o)throw new Error("The timer is in an undefined state.");const{timerId:a,timerType:s}=o;n.delete(i),"interval"===s?t.delete(a):r.delete(a)}}var i}));return{clearInterval:e=>{if("function"==typeof t.get(e)){const r=rO.exports.generateUniqueNumber(n);n.set(r,{timerId:e,timerType:"interval"}),t.set(e,r),i.postMessage({id:r,method:"clear",params:{timerId:e,timerType:"interval"}})}},clearTimeout:e=>{if("function"==typeof r.get(e)){const t=rO.exports.generateUniqueNumber(n);n.set(t,{timerId:e,timerType:"timeout"}),r.set(e,t),i.postMessage({id:t,method:"clear",params:{timerId:e,timerType:"timeout"}})}},setInterval:(e,r=0)=>{const n=rO.exports.generateUniqueNumber(t);return t.set(n,(()=>{e(),"function"==typeof t.get(n)&&i.postMessage({id:null,method:"set",params:{delay:r,now:performance.timeOrigin+performance.now(),timerId:n,timerType:"interval"}})})),i.postMessage({id:null,method:"set",params:{delay:r,now:performance.timeOrigin+performance.now(),timerId:n,timerType:"interval"}}),n},setTimeout:(e,t=0)=>{const n=rO.exports.generateUniqueNumber(r);return r.set(n,e),i.postMessage({id:null,method:"set",params:{delay:t,now:performance.timeOrigin+performance.now(),timerId:n,timerType:"timeout"}}),n}}}),'(()=>{"use strict";const e=new Map,t=new Map,r=t=>{const r=e.get(t);return void 0!==r&&(clearTimeout(r),e.delete(t),!0)},s=e=>{const r=t.get(e);return void 0!==r&&(clearTimeout(r),t.delete(e),!0)},o=(e,t)=>{const r=performance.now(),s=e+t-r-performance.timeOrigin;return{expected:r+s,remainingDelay:s}},i=(e,t,r,s)=>{const o=r-performance.now();o>0?e.set(t,setTimeout(i,o,e,t,r,s)):(e.delete(t),postMessage({id:null,method:"call",params:{timerId:t,timerType:s}}))};addEventListener("message",(n=>{let{data:a}=n;try{if("clear"===a.method){const{id:e,params:{timerId:t,timerType:o}}=a;if("interval"===o)postMessage({id:e,result:r(t)});else{if("timeout"!==o)throw new Error(\'The given type "\'.concat(o,\'" is not supported\'));postMessage({id:e,result:s(t)})}}else{if("set"!==a.method)throw new Error(\'The given method "\'.concat(a.method,\'" is not supported\'));{const{params:{delay:r,now:s,timerId:n,timerType:m}}=a;if("interval"===m)((t,r,s)=>{const{expected:n,remainingDelay:a}=o(t,s);e.set(r,setTimeout(i,a,e,r,n,"interval"))})(r,n,s);else{if("timeout"!==m)throw new Error(\'The given type "\'.concat(m,\'" is not supported\'));((e,r,s)=>{const{expected:n,remainingDelay:a}=o(e,s);t.set(r,setTimeout(i,a,t,r,n,"timeout"))})(r,n,s)}}}}catch(e){postMessage({error:{message:e.message},id:a.id,result:null})}}))})();'),iO=e=>nO().clearTimeout(e);class oO{constructor(){this.plugins=new Map,this.effect=null}register(e,t){this.plugins.has(e)?yA.warn(`plugin manager: plugin with name ${e} already registered.`):this.plugins.set(e,t)}initialize(e){yA.info("plugin manager: initializing plugins"),this.effect=e,this.plugins.forEach(((t,r)=>{t.isInitialized?yA.warn(`plugin manager: "${r}" plugin already initialized.`):t.initialize(e)}))}dispose(){this.effect?(this.getPlugins().forEach((e=>e.dispose(this.effect))),this.plugins.clear(),this.effect=null):yA.warn("plugin manager: dispose called before effect is initialized.")}getPlugin(e){return this.plugins.get(e)}getPlugins(){return this.plugins}}const aO=(e,t,r,n=(()=>String(1e17*Math.random()))(),i=!1)=>{(()=>{const e="web-media-effects-styles";let t=document.getElementById(e);t||(t=document.createElement("style"),t.id=e,t.textContent="\n .web-media-effects-hidden {\n bottom: 0;\n opacity: 0;\n position: fixed;\n z-index: -2147483647;\n height: 0px;\n width: 0px;\n }\n ",document.head.appendChild(t))})();const o=`web-media-effects-${e}-${n}`;let a=document.getElementById(o);return a||(a=document.createElement(e),a.id=o,a.classList.add("web-media-effects-hidden"),a.setAttribute("height",t.toString()),a.setAttribute("width",r.toString()),i&&document.body.appendChild(a)),a},sO=(e,t,r,n)=>aO("canvas",e,t,r,n),cO=()=>{var e;return null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.matchMedia)||void 0===e?void 0:e.call(globalThis,"(orientation: portrait)")},uO=(e,t)=>{const{height:r,width:n}=e,{height:i,width:o}=t,a=t.getContext("2d");a&&(a.clearRect(0,0,o,i),a.drawImage(e,0,0,n,r,0,0,o,i))},lO=(e,t=!1,r=!1)=>({type:"replacement",horizontalMirror:r,background:e,static:!t});var dO;!function(e){e.Blur="BLUR",e.Image="IMAGE",e.Video="VIDEO",e.Passthrough="PASSTHROUGH"}(dO||(dO={}));const fO=Object.freeze({mode:dO.Blur,blurStrength:zA.STRONG,generator:"worker",quality:WA.LOW,authToken:"",mirror:!1,canvasResolutionScaling:1}),hO=e=>LA("authToken",e);class pO extends RA{constructor(e){super(),this.defaultOptions=fO,this.uniqueId=Date.now(),this.lastFrameTime=0,this.frameInterval=1e3/24,this.restoreEffectOnTrackEnable=!1,this.pluginManager=new oO,this.beforeInferenceCallbacks=[],this.afterInferenceCallbacks=[],this.configBuilder=new GA,this.handleOrientationChange=e=>{const t=e.matches;if(!this.trackSettings)throw new Error("virtual background: unable to determine input track settings");let{height:r,width:n}=this.trackSettings;r&&n?(yA.log("virtual background: orientation change detected",{height:r,width:n}),(t&&r<n||!t&&r>n)&&([r,n]=[n,r]),yA.log("virtual background: orientation changed to "+(t?"portrait":"landscape"),{height:r,width:n}),[this.videoEl,this.inputEl,this.outputEl,this.backgroundEl].forEach((e=>{r&&(null==e||e.setAttribute("height",r.toString())),n&&(null==e||e.setAttribute("width",n.toString()))}))):yA.log("virtual background: orientation change detected but unknown height or width",{height:r,width:n})},this.registerPlugin=(e,t)=>{yA.log("virtual background: registering plugin",e,t),this.pluginManager.register(e,t)},this.initializePlugins=()=>{yA.log("virtual background: initializing plugins"),this.pluginManager.initialize(this)},this.getPlugin=e=>this.pluginManager.getPlugin(e),this.getPluginManager=()=>this.pluginManager,this.options=Object.assign(Object.assign({},fO),e),yA.log("virtual background: init effect",hO(this.options)),this.loadModel=this.loadModel.bind(this),this.handleFrame=this.handleFrame.bind(this),this.handleOrientationChange=this.handleOrientationChange.bind(this),this.handleVideoLoadedMetadata=this.handleVideoLoadedMetadata.bind(this),this.handleVideoResize=this.handleVideoResize.bind(this),this.handleAssetUrlResolver=this.handleAssetUrlResolver.bind(this),this.handleVisibilityChange=this.handleVisibilityChange.bind(this)}get isReady(){var e;return!!(null===(e=this.model)||void 0===e?void 0:e.isLoaded())}get isLoaded(){return!!this.loadFuture}get frameRate(){var e,t,r;return null!==(r=null!==(e=this.options.frameRate)&&void 0!==e?e:null===(t=this.trackSettings)||void 0===t?void 0:t.frameRate)&&void 0!==r?r:24}preloadAssets(){return zI(this,void 0,void 0,(function*(){const e=performance.now();if(this.preloadFuture)yield this.preloadFuture.promise;else{this.preloadFuture=new OA,yA.log("virtual background: preloading assets");try{this.configureBuilder();const t=this.configBuilder.build(!1);yA.log("virtual background: preload configuration",t),yield(async e=>{await JA.preloadWorker(e)})(t);const r=performance.now(),n=Math.round(r-e)/1e3;yA.log(`virtual background: preload completed in ${n} seconds`),this.preloadFuture.resolve()}catch(e){throw this.preloadFuture.reject(e),this.preloadFuture=void 0,e}}}))}loadMediaStream(e){const t=Object.create(null,{loadMedia:{get:()=>super.loadMedia}});return zI(this,void 0,void 0,(function*(){yA.log("virtual background: load stream",e);const[r]=e.getVideoTracks();if(!r)throw new Error("virtual background: load stream failed, no video track found");if(yield t.loadMedia.call(this,r,e),yield this.loadDomAndModel(),!this.outputStream)throw new Error("virtual background: failed to create output stream");return yA.log("virtual background: setting new track enabled state",r.enabled),this.outputStream.getVideoTracks()[0].enabled=r.enabled,this.outputStream}))}loadMediaStreamTrack(e){const t=Object.create(null,{loadMedia:{get:()=>super.loadMedia}});return zI(this,void 0,void 0,(function*(){if(yA.log("virtual background: load track",e),t.loadMedia.call(this,e),yield this.loadDomAndModel(),!this.outputTrack)throw new Error("virtual background: failed to create output track");return this.outputTrack}))}loadDomAndModel(){var e,t,r,n;return zI(this,void 0,void 0,(function*(){if(!this.inputStream)throw new Error("virtual background: failed to create input stream");if(!this.loadFuture){if(this.loadFuture=new OA,yield null===(e=this.disposeFuture)||void 0===e?void 0:e.promise,this.disposeFuture=new OA,this.trackSettings=null===(t=this.inputTrack)||void 0===t?void 0:t.getSettings(),!this.trackSettings)throw new Error("virtual background: unable to determine input track settings");if(this.setupDom(this.trackSettings.height,this.trackSettings.width),this.detectQuirks(),yield this.loadModel(),!this.videoEl)throw new Error("virtual background: unable to create input video element");this.videoEl.srcObject=this.inputStream,yA.log(`virtual background: capturing output stream at frameRate = ${this.frameRate}`);const i=null===(r=this.outputEl)||void 0===r?void 0:r.captureStream(this.frameRate);this.effectTrack=null==i?void 0:i.getVideoTracks()[0],this.frameInterval=1e3/this.frameRate,this.requestFrame="visible"===document.visibilityState?this.requestAnimationFrameWrapper:this.setTimeoutWrapper,this.setupVisibilityChange();try{this.lastFrameTime=performance.now(),null===(n=this.requestFrame)||void 0===n||n.call(this),this.loadFuture.resolve()}catch(e){throw this.loadFuture.reject(e),e}}return this.loadFuture.promise}))}setupVisibilityChange(){this.options.preventBackgroundThrottling&&(yA.log("virtual background: adding visibility change listener to prevent throttling"),document.addEventListener("visibilitychange",this.handleVisibilityChange))}handleVisibilityChange(){this.clearTimers(),this.requestFrame="visible"===document.visibilityState?this.requestAnimationFrameWrapper:this.setTimeoutWrapper,this.requestFrame()}requestAnimationFrameWrapper(){this.timerId&&cancelAnimationFrame(this.timerId),this.timerId=requestAnimationFrame(this.handleFrame)}setTimeoutWrapper(){this.timerId&&iO(this.timerId),this.timerId=((...e)=>nO().setTimeout(...e))(this.handleFrame,this.frameInterval)}clearTimers(){this.timerId&&(cancelAnimationFrame(this.timerId),iO(this.timerId))}configureBuilder(){var e,t,r,n,i,o,a,s;const c=this.options.env===EA.Int?"int":"prod";this.configBuilder=new GA(c),this.configBuilder.setMaskQuality(this.options.quality).setMaskGenerator(this.options.generator).setAssetUrlResolver(this.handleAssetUrlResolver),this.options.baseUrl&&this.configBuilder.setBaseUrl(this.options.baseUrl);const u=this.options.modelOverrides;if(u){if((null===(e=u.inputSize)||void 0===e?void 0:e.height)&&(null===(t=u.inputSize)||void 0===t?void 0:t.width)){const{height:e,width:t}=u.inputSize;this.configBuilder.setMaskInputSize(e,t)}if((null===(r=u.outputSize)||void 0===r?void 0:r.height)&&(null===(n=u.outputSize)||void 0===n?void 0:n.width)){const{height:e,width:t}=u.outputSize;this.configBuilder.setMaskOutputSize(e,t)}if((null===(i=u.upscaleSize)||void 0===i?void 0:i.height)&&(null===(o=u.upscaleSize)||void 0===o?void 0:o.width)){const{height:e,width:t}=u.upscaleSize;this.configBuilder.setMaskUpscaleSize(e,t)}u.modelRank&&this.configBuilder.setMaskModelRank(u.modelRank),u.workerUri&&this.configBuilder.setMaskWorkerUri(u.workerUri),u.executionProviders&&this.configBuilder.setExecutionProviders(u.executionProviders),u.modelUri&&this.configBuilder.setMaskModelUri(u.modelUri)}(null===(a=this.trackSettings)||void 0===a?void 0:a.height)&&(null===(s=this.trackSettings)||void 0===s?void 0:s.width)&&this.configBuilder.setInputSize(this.trackSettings.height,this.trackSettings.width),yA.log("virtual background: configuration builder set",this.configBuilder)}createPipeline(e){return zI(this,void 0,void 0,(function*(){return yA.log("virtual background: creating pipeline",e),new Promise((t=>{if(!this.outputEl||!this.inputEl)throw new Error("virtual background: unable to create pipeline");this.configureBuilder(),this.configBuilder.setRenderConfig(e);const r=this.configBuilder.build();yA.log("virtual background: pipeline created",r),t(new tO(this.inputEl,this.outputEl,r,this.videoEl))}))}))}loadModel(){var e,t;return zI(this,void 0,void 0,(function*(){let r;switch(yA.log("virtual background: loading model with mode:",this.options.mode),this.options.mode){case dO.Blur:if(!this.options.blurStrength)throw new Error("virtual background: missing `blurStrength` option");r=GA.getBlurConfig(this.options.blurStrength,this.options.mirror);break;case dO.Image:{if(!this.options.bgImageUrl)throw new Error("virtual background: missing `bgImageUrl` option");if(!this.backgroundEl)throw new Error("virtual background: missing hidden background element");const e=yield(n=this.options.bgImageUrl,new Promise(((e,t)=>{const r=new Image;r.onload=()=>{e(r)},r.onerror=e=>t(e),r.src=n,r.crossOrigin="anonymous"})));r=lO(this.backgroundEl,!1,this.options.mirror),uO(e,this.backgroundEl);break}case dO.Video:if(!this.options.bgVideoUrl)throw new Error("virtual background: missing `bgVideoUrl` option");if(!this.backgroundEl)throw new Error("virtual background: missing hidden background element");r=lO(this.backgroundEl,!0,this.options.mirror),this.virtualVideoEl=yield(e=>new Promise(((t,r)=>{const n=aO("video",0,0,void 0,!0);n.onloadeddata=()=>{n.height=n.videoHeight,n.width=n.videoWidth,t(n)},n.onerror=()=>r(),n.autoplay=!0,n.playsInline=!0,n.loop=!0,n.muted=!0,n.src=e,n.crossOrigin="anonymous"})))(this.options.bgVideoUrl);break;case dO.Passthrough:r=GA.getPassthroughConfig(this.options.mirror);break;default:throw new Error("virtual background: invalid options supplied to the effect")}var n;return yield null===(e=this.model)||void 0===e?void 0:e.destroy(),this.model=yield this.createPipeline(r),null===(t=this.model)||void 0===t?void 0:t.load()}))}handleFrame(e=performance.now()){var t,r,n;return zI(this,void 0,void 0,(function*(){const i=e-this.lastFrameTime,o=Date.now();if(i<this.frameInterval)null===(t=this.requestFrame)||void 0===t||t.call(this);else{this.lastFrameTime+=this.frameInterval;try{if(!this.isReady)return;if(yield this.manageEffectRestoration(),!this.isEnabled)return;const{canvasToProcess:e,shouldInfer:t}=yield this.executeBeforeInferenceCallbacks(o);e&&t&&this.prepareInputCanvas(e),this.lastFrame=yield null===(r=this.model)||void 0===r?void 0:r.onFrame(o,t),yield this.executeAfterInferenceCallbacks(o)}catch(e){yA.log("virtual background: issue rendering frame",e)}null===(n=this.requestFrame)||void 0===n||n.call(this)}}))}manageEffectRestoration(){var e,t,r,n;return zI(this,void 0,void 0,(function*(){const i=(null===(e=this.inputTrack)||void 0===e?void 0:e.enabled)&&!(null===(t=this.inputTrack)||void 0===t?void 0:t.muted);if(!this.restoreEffectOnTrackEnable||i)return this.restoreEffectOnTrackEnable&&i?(yA.log("virtual background: re-enabling effect as the track is now enabled"),this.restoreEffectOnTrackEnable=!1,void(yield this.enable())):void(this.isEnabled&&!i&&(yA.log("virtual background: input track disabled; disabling effect"),this.restoreEffectOnTrackEnable=!0,yield this.disable(),null===(n=this.requestFrame)||void 0===n||n.call(this)));null===(r=this.requestFrame)||void 0===r||r.call(this)}))}prepareInputCanvas(e){var t;if(!this.videoEl)throw new Error("virtual background: missing hidden video element");if(!this.inputEl)throw new Error("virtual background: missing input canvas element");if(!this.offscreenCanvas)throw new Error("virtual background: missing offscreen canvas element");if(uO(this.videoEl,this.offscreenCanvas),this.options.mode===dO.Video){if(!this.virtualVideoEl)throw new Error("virtual background: no background video element");if(!this.backgroundEl)throw new Error("virtual background: no background element");uO(this.virtualVideoEl,this.backgroundEl)}null===(t=this.inputCanvasContext)||void 0===t||t.drawImage(e,0,0,this.inputEl.width,this.inputEl.height)}executeBeforeInferenceCallbacks(e){return zI(this,void 0,void 0,(function*(){let t=this.offscreenCanvas,r=!0;if(this.beforeInferenceCallbacks.length)try{yield this.beforeInferenceCallbacks.reduce(((n,i)=>zI(this,void 0,void 0,(function*(){if(yield n,this.lastFrame){const n=yield i(e,this.lastFrame,t);r&&(r=n.shouldInfer),t=n.modifiedCanvas||t}}))),Promise.resolve())}catch(e){yA.log("virtual background: issue invoking before inference callbacks",e)}return{canvasToProcess:t,shouldInfer:r}}))}executeAfterInferenceCallbacks(e){return zI(this,void 0,void 0,(function*(){try{this.afterInferenceCallbacks.forEach((t=>t(e,this.lastFrame)))}catch(e){yA.log("virtual background: issue invoking after inference callbacks",e)}}))}setupDom(e,t){var r;if(yA.log("virtual background: setting up dom with dimension",{height:e,width:t}),!e||!t)throw new Error(`virtual background: missing dimensions: height=${e}, width=${t})`);const n=null!==(r=this.options.canvasResolutionScaling)&&void 0!==r?r:1,i=Math.floor(Number(e)*n),o=Math.floor(Number(t)*n);this.uniqueId=Date.now(),this.videoEl=((e,t,r)=>aO("video",e,t,r))(e,t,this.uniqueId.toString()),this.inputEl=sO(e,t,`input-${this.uniqueId}`),this.outputEl=sO(e,t,`output-${this.uniqueId}`,!0),this.backgroundEl=sO(e,t,`background-${this.uniqueId}`),this.offscreenCanvas=sO(i,o,`offscreen-${this.uniqueId}`),this.inputCanvasContext=this.inputEl.getContext("2d",{willReadFrequently:!0}),this.videoEl.setAttribute("autoplay",""),this.videoEl.setAttribute("playsinline",""),this.videoEl.setAttribute("muted",""),this.videoEl.addEventListener("loadedmetadata",this.handleVideoLoadedMetadata),this.videoEl.addEventListener("resize",this.handleVideoResize,!1)}detectQuirks(){var e,t;if(null===(e=this.inputEl)||void 0===e||e.getContext("2d",{willReadFrequently:!0}),null===(t=this.outputEl)||void 0===t||t.getContext("webgl2",{antialias:!0}),(()=>{var e,t,r;return Boolean(["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.navigator)||void 0===e?void 0:e.platform)||(null===(r=null===(t=null===globalThis||void 0===globalThis?void 0:globalThis.navigator)||void 0===t?void 0:t.userAgent)||void 0===r?void 0:r.includes("Mac"))&&"ontouchend"in(null===globalThis||void 0===globalThis?void 0:globalThis.document))})()){const e=cO();this.handleOrientationChange(e),null==e||e.addEventListener("change",this.handleOrientationChange)}}handleVideoLoadedMetadata(){var e;return zI(this,void 0,void 0,(function*(){yield null===(e=this.videoEl)||void 0===e?void 0:e.play()}))}handleVideoResize(){var e,t;return zI(this,void 0,void 0,(function*(){yield null===(e=this.loadFuture)||void 0===e?void 0:e.promise;const r=this.trackSettings,n=null===(t=this.inputTrack)||void 0===t?void 0:t.getSettings();((null==n?void 0:n.width)&&(null==r?void 0:r.width)&&(null==n?void 0:n.width)!==(null==r?void 0:r.width)||(null==n?void 0:n.height)&&(null==r?void 0:r.height)&&(null==n?void 0:n.height)!==(null==r?void 0:r.height))&&(yA.log("virtual background: video resize detected",{oldSettings:r,newSettings:n}),yield this.updateSize(n.width,n.height))}))}handleAssetUrlResolver(e,t){return zI(this,void 0,void 0,(function*(){if(yA.log("virtual background: resolving asset url",e,t),t.baseUrl){const r=`${t.baseUrl}/${e}`;return yA.log("virtual background: using base url override as asset url",r),r}if(!this.options.authToken)throw new Error("virtual background: missing `authToken` for fetching signed model url");return IA(e,this.options.authToken,this.options.env)}))}enable(){const e=Object.create(null,{enable:{get:()=>super.enable}});var t,r,n,i,o,a,s;return zI(this,void 0,void 0,(function*(){if((null===(t=this.loadFuture)||void 0===t?void 0:t.state)===AA.Rejected)return yA.warn("virtual background: model load failed, cannot enable effect"),!1;if((null===(r=this.loadFuture)||void 0===r?void 0:r.state)===AA.Pending&&(yield null===(n=this.loadFuture)||void 0===n?void 0:n.promise),yA.log("virtual background: enabling effect"),this.isReady&&this.effectTrack&&this.inputTrack)try{return yield e.enable.call(this),null===(i=this.model)||void 0===i||i.reset(),null===(o=this.outputStream)||void 0===o||o.removeTrack(this.inputTrack),null===(a=this.outputStream)||void 0===a||a.addTrack(this.effectTrack),null===(s=this.requestFrame)||void 0===s||s.call(this),!0}catch(e){throw this.isEnabled=!1,e}return!1}))}disable(){const e=Object.create(null,{disable:{get:()=>super.disable}});var t,r,n,i,o,a;return zI(this,void 0,void 0,(function*(){if((null===(t=this.loadFuture)||void 0===t?void 0:t.state)===AA.Rejected&&yA.warn("virtual background: model load failed, disabling effect anyway"),(null===(r=this.loadFuture)||void 0===r?void 0:r.state)===AA.Pending&&(yield null===(n=this.loadFuture)||void 0===n?void 0:n.promise),yA.log("virtual background: disabling effect"),this.isReady&&this.effectTrack&&this.inputTrack)try{return yield e.disable.call(this),this.clearTimers(),null===(i=this.model)||void 0===i||i.reset(),null===(o=this.outputStream)||void 0===o||o.removeTrack(this.effectTrack),null===(a=this.outputStream)||void 0===a||a.addTrack(this.inputTrack),!0}catch(e){throw this.isEnabled=!0,e}return!1}))}dispose(){const e=Object.create(null,{dispose:{get:()=>super.dispose}});var t,r,n,i,o,a,s,c,u,l,d,f,h,p;return zI(this,void 0,void 0,(function*(){yA.log("virtual background: disposing effect"),(null===(t=this.loadFuture)||void 0===t?void 0:t.state)===AA.Rejected?yA.warn("virtual background: model load failed, cleaning up resources"):(null===(r=this.loadFuture)||void 0===r?void 0:r.state)===AA.Pending?this.loadFuture.reject(new Error("virtual background: loading interrupted by dispose")):(null===(n=this.loadFuture)||void 0===n?void 0:n.state)===AA.Resolved&&(yield this.loadFuture.promise,this.emit(_A.Disposed)),yield this.disable(),yield null===(i=this.model)||void 0===i?void 0:i.destroy(),this.getPluginManager().dispose(),null===(o=cO())||void 0===o||o.removeEventListener("change",this.handleOrientationChange),null===(a=this.videoEl)||void 0===a||a.removeEventListener("loadedmetadata",this.handleVideoLoadedMetadata),null===(s=this.videoEl)||void 0===s||s.removeEventListener("resize",this.handleVideoResize),document.removeEventListener("visibilitychange",this.handleVisibilityChange),null===(c=this.inputEl)||void 0===c||c.remove(),null===(u=this.outputEl)||void 0===u||u.remove(),null===(l=this.videoEl)||void 0===l||l.remove(),null===(d=this.backgroundEl)||void 0===d||d.remove(),null===(f=this.virtualVideoEl)||void 0===f||f.remove(),delete this.requestFrame,delete this.model,delete this.inputEl,delete this.outputEl,delete this.videoEl,delete this.backgroundEl,delete this.virtualVideoEl;try{yield e.dispose.call(this),null===(h=this.disposeFuture)||void 0===h||h.resolve()}catch(e){throw null===(p=this.disposeFuture)||void 0===p||p.reject(e),e}this.loadFuture=void 0}))}addBeforeInferenceCallback(e){this.beforeInferenceCallbacks.push(e)}addAfterInferenceCallback(e){this.afterInferenceCallbacks.push(e)}removeBeforeInferenceCallback(e){this.beforeInferenceCallbacks=this.beforeInferenceCallbacks.filter((t=>t!==e))}removeAfterInferenceCallback(e){this.afterInferenceCallbacks=this.afterInferenceCallbacks.filter((t=>t!==e))}setOnFrameProcessedCallback(e){yA.warn("virtual background: deprecated method, use addBeforeInferenceCallback instead"),this.addAfterInferenceCallback(e)}updateOptions(e){var t,r;return zI(this,void 0,void 0,(function*(){if((null===(t=this.loadFuture)||void 0===t?void 0:t.state)===AA.Pending)try{yield this.loadFuture.promise}catch(e){yA.warn("virtual background: previous loading failed, continuing with update",e)}Object.keys(e).forEach((t=>{var r;this.options[t]=null!==(r=e[t])&&void 0!==r?r:this.options[t]})),void 0!==this.options.preventBackgroundThrottling&&(document.removeEventListener("visibilitychange",this.handleVisibilityChange),this.setupVisibilityChange()),yA.log("virtual background: reloading effect with options",hO(this.options)),this.loadFuture=new OA;try{this.configureBuilder(),yield this.loadModel(),this.loadFuture.resolve(),null===(r=this.requestFrame)||void 0===r||r.call(this)}catch(e){throw this.loadFuture.reject(e),e}}))}updateSize(e,t){var r,n;return zI(this,void 0,void 0,(function*(){if((null===(r=this.loadFuture)||void 0===r?void 0:r.state)===AA.Pending)try{yield this.loadFuture.promise}catch(e){yA.warn("virtual background: previous loading failed, continuing with size update",e)}this.videoEl&&(this.videoEl.width=e,this.videoEl.height=t),this.inputEl&&(this.inputEl.width=e,this.inputEl.height=t),this.outputEl&&(this.outputEl.width=e,this.outputEl.height=t),this.backgroundEl&&(this.backgroundEl.width=e,this.backgroundEl.height=t),this.trackSettings&&(this.trackSettings.width=e,this.trackSettings.height=t),yA.log("virtual background: updating size",{width:e,height:t}),this.loadFuture=new OA;try{yield this.loadModel(),this.loadFuture.resolve(),null===(n=this.requestFrame)||void 0===n||n.call(this)}catch(e){throw this.loadFuture.reject(e),e}}))}}pO.kind="virtual-background-effect",pO.BlurStrength=zA,pO.Quality=WA;var vO,mO,gO,yO,bO,EO="identity",SO="scim",_O="v2/Users?filter=",wO="https://webexapis.com",RO="https://integration.webexapis.com",CO=("".concat(RO,"/v1/uc/config"),"".concat(wO,"/v1/uc/config"),"invoking"),TO=__webpack_require__(31795);!function(e){e.OPERATIONAL="operational",e.BEHAVIORAL="behavioral"}(vO||(vO={})),function(e){e.BNR_ENABLED="web-calling-sdk-bnr-enabled",e.BNR_DISABLED="web-calling-sdk-bnr-disabled",e.CALL="web-calling-sdk-callcontrol",e.CALL_ERROR="web-calling-sdk-callcontrol-error",e.MEDIA="web-calling-sdk-media",e.MEDIA_ERROR="web-calling-sdk-media-error",e.REGISTRATION="web-calling-sdk-registration",e.REGISTRATION_ERROR="web-calling-sdk-registration-error",e.VOICEMAIL="web-calling-sdk-voicemail",e.VOICEMAIL_ERROR="web-calling-sdk-voicemail-error",e.UPLOAD_LOGS_SUCCESS="web-calling-sdk-upload-logs-success",e.UPLOAD_LOGS_FAILED="web-calling-sdk-upload-logs-failed"}(mO||(mO={})),function(e){e.REGISTER="register",e.DEREGISTER="deregister",e.KEEPALIVE_FAILURE="keepaliveFailure"}(gO||(gO={})),function(e){e.BLIND="TRANSFER_BLIND",e.CONSULT="TRANSFER_CONSULT"}(yO||(yO={})),function(e){e.GET_VOICEMAILS="get_voicemails",e.GET_VOICEMAIL_CONTENT="get_voicemail_content",e.GET_VOICEMAIL_SUMMARY="get_voicemail_summary",e.MARK_READ="mark_read",e.MARK_UNREAD="mark_unread",e.DELETE="delete",e.TRANSCRIPT="transcript"}(bO||(bO={}));var xO,kO,IO,AO="upload_logs",OO="unknown",LO="webex-calling",MO="".concat(LO,"/").concat("beta"),NO="calls",PO="cisco-device-url",DO="devices",FO={"rtp-rxstat":{Dur:0,Pkt:0,Oct:0,LatePkt:0,LostPkt:0,AvgJit:0,VQMetrics:{VoRxCodec:"unknown",VoPktSizeMs:0,maxJitter:0,VoOneWayDelayMs:0,networkType:"unknown",hwType:"unknown"}},"rtp-txstat":{Dur:0,Pkt:0,Oct:0,VQMetrics:{VoTxCodec:"unknown",rtpBitRate:0}}},UO="callhold",jO="spark-user-agent",BO="/api/v1",qO="/calling/web/",VO=/[\d\s()*#+.-]+/,GO="CallerId",WO="utils",zO="CallingClient",HO="line",KO="call",$O="callManager",JO="metric",YO="register",QO="codecId",XO=1e3,ZO="attemptRegistrationWithServers",eL="getMobiusServers",tL="startKeepaliveTimer",rL="executeFailback",nL="handle429Retry",iL="startFailoverTimer",oL="callsClearedHandler",aL="noise-reduction-effect",sL="constructor",cL="createCall",uL="handleIncomingCallSetup",lL="handleOutgoingCallSetup",dL="handleCallHold",fL="handleCallResume",hL="handleIncomingCallProgress",pL="handleIncomingRoapOfferRequest",vL="handleOutgoingCallAlerting",mL="handleIncomingCallConnect",gL="handleOutgoingCallConnect",yL="handleOutgoingCallDisconnect",bL="handleCallEstablished",EL="handleUnknownState",SL="handleTimeout",_L="handleRoapEstablished",wL="handleRoapError",RL="handleOutgoingRoapOffer",CL="handleOutgoingRoapAnswer",TL="handleIncomingRoapOffer",xL="handleIncomingRoapAnswer",kL="forceSendStatsReport",IL="updateActiveMobius",AL="dequeueWsEvents",OL="updateLine",LL="setCallId",ML="answer",NL="dial",PL="getCallStats",DL="postMedia",FL="mediaRoapEventsListener",UL="handleMidCallEvent",jL="end",BL="sendDigit",qL="mute",VL="updateMedia",GL="register",WL="deregister",zL="lineEmitter",HL="makeCall",KL="incomingCallListener",$L="setMobiusServers",JL="handleConnectionRestoration",YL="reconnectOnFailure",QL="detectNetworkChange",XL="getClientRegionInfo",ZL="getMobiusServers",eM="registerCallsClearedListener",tM="callsClearedHandler",rM="registerSessionsListener",nM="createLine";!function(e){e.MAIN="CALLING_SDK",e.FILE="file",e.METHOD="method",e.EVENT="event",e.MESSAGE="message",e.ERROR="error"}(xO||(xO={})),function(e){e[e.error=1]="error",e[e.warn=2]="warn",e[e.log=3]="log",e[e.info=4]="info",e[e.trace=5]="trace"}(kO||(kO={})),function(e){e.ERROR="error",e.WARN="warn",e.INFO="info",e.LOG="log",e.TRACE="trace"}(IO||(IO={}));var iM=kO.error,oM=console,aM=function(e,t){switch(t){case IO.INFO:oM.info(e);break;case IO.LOG:oM.log(e);break;case IO.WARN:oM.warn(e);break;case IO.ERROR:oM.error(e);break;case IO.TRACE:oM.trace(e)}},sM=function(e,t){var r=(new Date).toUTCString();return"".concat(LO,": ").concat(r,": ").concat(t,": ").concat(xO.FILE,":").concat(e.file," - ").concat(xO.METHOD,":").concat(e.method)};const cM={log:function(e,t){iM>=kO.log&&aM("".concat(sM(t,"[LOG]")," - ").concat(xO.MESSAGE,":").concat(e),IO.LOG)},error:function(e,t){iM>=kO.error&&aM("".concat(sM(t,"[ERROR]")," - !").concat(xO.ERROR,"!").concat(xO.MESSAGE,":").concat(e.message),IO.ERROR)},info:function(e,t){iM>=kO.info&&aM("".concat(sM(t,"[INFO]")," - ").concat(xO.MESSAGE,":").concat(e),IO.INFO)},warn:function(e,t){iM>=kO.warn&&aM("".concat(sM(t,"[WARN]")," - ").concat(xO.MESSAGE,":").concat(e),IO.WARN)},trace:function(e,t){iM>=kO.trace&&aM("".concat(sM(t,"[TRACE]")," - ").concat(xO.MESSAGE,":").concat(e),IO.TRACE)},setLogger:function(e,t){switch(e){case IO.WARN:iM=kO.warn;break;case IO.LOG:iM=kO.log;break;case IO.INFO:iM=kO.info;break;case IO.TRACE:iM=kO.trace;break;default:iM=kO.error}var r="Logger initialized for module: ".concat(t," with level: ").concat(iM);aM("".concat(sM({file:"logger.ts",method:"setLogger"},"")," - ").concat(xO.MESSAGE,":").concat(r),IO.INFO)},getLogLevel:function(){var e;switch(iM){case kO.warn:e=IO.WARN;break;case kO.log:e=IO.LOG;break;case kO.info:e=IO.INFO;break;case kO.trace:e=IO.TRACE;break;default:e=IO.ERROR}return e},setWebexLogger:function(e){e&&(oM=e)}};var uM,lM=__webpack_require__(34155),dM=function(){function e(t,r){ne(this,e),C(this,"webex",void 0),C(this,"deviceInfo",void 0),C(this,"serviceIndicator",void 0),cM.info("Initializing metric manager...",{file:JO}),this.webex=t,this.serviceIndicator=r}return oe(e,[{key:"submitUploadLogsMetric",value:function(e,t,r,n,i,o,a,s){var c;switch(e){case mO.UPLOAD_LOGS_SUCCESS:var u,l,d,f,h,p;c={tags:{action:t,device_id:null===(u=this.deviceInfo)||void 0===u||null===(l=u.device)||void 0===l?void 0:l.deviceId,service_indicator:this.serviceIndicator},fields:{device_url:null===(d=this.deviceInfo)||void 0===d||null===(f=d.device)||void 0===f?void 0:f.clientDeviceUri,mobius_url:null===(h=this.deviceInfo)||void 0===h||null===(p=h.device)||void 0===p?void 0:p.uri,calling_sdk_version:"3.8.1-next.22",correlation_id:o,tracking_id:n,feedback_id:i,call_id:s},type:r};break;case mO.UPLOAD_LOGS_FAILED:var v,m,g,y,b,E;c={tags:{action:t,device_id:null===(v=this.deviceInfo)||void 0===v||null===(m=v.device)||void 0===m?void 0:m.deviceId,service_indicator:this.serviceIndicator},fields:{device_url:null===(g=this.deviceInfo)||void 0===g||null===(y=g.device)||void 0===y?void 0:y.clientDeviceUri,mobius_url:null===(b=this.deviceInfo)||void 0===b||null===(E=b.device)||void 0===E?void 0:E.uri,calling_sdk_version:"3.8.1-next.22",correlation_id:o,tracking_id:n,feedback_id:i,error:a,call_id:s},type:r}}c&&this.webex.internal.metrics.submitClientMetrics(e,c)}},{key:"setDeviceInfo",value:function(e){this.deviceInfo=e}},{key:"submitRegistrationMetric",value:function(e,t,r,n,i,o,a,s){var c;switch(e){case mO.REGISTRATION:var u,l,d,f,h,p;c={tags:{action:t,device_id:null===(u=this.deviceInfo)||void 0===u||null===(l=u.device)||void 0===l?void 0:l.deviceId,service_indicator:this.serviceIndicator},fields:{device_url:null===(d=this.deviceInfo)||void 0===d||null===(f=d.device)||void 0===f?void 0:f.clientDeviceUri,mobius_url:null===(h=this.deviceInfo)||void 0===h||null===(p=h.device)||void 0===p?void 0:p.uri,calling_sdk_version:"3.8.1-next.22",reg_source:n,server_type:i,trackingId:o},type:r};break;case mO.REGISTRATION_ERROR:var v,m,g,y,b,E;if(s)c={tags:{action:t,device_id:null===(v=this.deviceInfo)||void 0===v||null===(m=v.device)||void 0===m?void 0:m.deviceId,service_indicator:this.serviceIndicator},fields:{device_url:null===(g=this.deviceInfo)||void 0===g||null===(y=g.device)||void 0===y?void 0:y.clientDeviceUri,mobius_url:null===(b=this.deviceInfo)||void 0===b||null===(E=b.device)||void 0===E?void 0:E.uri,calling_sdk_version:"3.8.1-next.22",reg_source:n,server_type:i,trackingId:o,keepalive_count:a,error:s.getError().message,error_type:s.getError().type},type:r};break;default:cM.warn("Invalid metric name received. Rejecting request to submit metric.",{file:JO,method:this.submitRegistrationMetric.name})}c&&this.webex.internal.metrics.submitClientMetrics(e,c)}},{key:"submitCallMetric",value:function(e,t,r,n,i,o){var a;switch(e){case mO.CALL:var s,c,u,l,d,f;a={tags:{action:t,device_id:null===(s=this.deviceInfo)||void 0===s||null===(c=s.device)||void 0===c?void 0:c.deviceId,service_indicator:this.serviceIndicator},fields:{device_url:null===(u=this.deviceInfo)||void 0===u||null===(l=u.device)||void 0===l?void 0:l.clientDeviceUri,mobius_url:null===(d=this.deviceInfo)||void 0===d||null===(f=d.device)||void 0===f?void 0:f.uri,calling_sdk_version:"3.8.1-next.22",call_id:n,correlation_id:i},type:r};break;case mO.CALL_ERROR:var h,p,v,m,g,y;if(o)a={tags:{action:t,device_id:null===(h=this.deviceInfo)||void 0===h||null===(p=h.device)||void 0===p?void 0:p.deviceId,service_indicator:this.serviceIndicator},fields:{device_url:null===(v=this.deviceInfo)||void 0===v||null===(m=v.device)||void 0===m?void 0:m.clientDeviceUri,mobius_url:null===(g=this.deviceInfo)||void 0===g||null===(y=g.device)||void 0===y?void 0:y.uri,calling_sdk_version:"3.8.1-next.22",call_id:n,correlation_id:i,error:o.getCallError().message,error_type:o.getCallError().type},type:r};break;default:cM.warn("Invalid metric name received. Rejecting request to submit metric.",{file:JO,method:this.submitCallMetric.name})}a&&this.webex.internal.metrics.submitClientMetrics(e,a)}},{key:"submitMediaMetric",value:function(e,t,r,n,i,o,a,s){var c;switch(e){case mO.MEDIA:var u,l,d,f,h,p;c={tags:{action:t,device_id:null===(u=this.deviceInfo)||void 0===u||null===(l=u.device)||void 0===l?void 0:l.deviceId,service_indicator:this.serviceIndicator},fields:{device_url:null===(d=this.deviceInfo)||void 0===d||null===(f=d.device)||void 0===f?void 0:f.clientDeviceUri,mobius_url:null===(h=this.deviceInfo)||void 0===h||null===(p=h.device)||void 0===p?void 0:p.uri,calling_sdk_version:"3.8.1-next.22",call_id:n,correlation_id:i,local_media_details:o,remote_media_details:a},type:r};break;case mO.MEDIA_ERROR:var v,m,g,y,b,E;if(s)c={tags:{action:t,device_id:null===(v=this.deviceInfo)||void 0===v||null===(m=v.device)||void 0===m?void 0:m.deviceId,service_indicator:this.serviceIndicator},fields:{device_url:null===(g=this.deviceInfo)||void 0===g||null===(y=g.device)||void 0===y?void 0:y.clientDeviceUri,mobius_url:null===(b=this.deviceInfo)||void 0===b||null===(E=b.device)||void 0===E?void 0:E.uri,calling_sdk_version:"3.8.1-next.22",call_id:n,correlation_id:i,local_media_details:o,remote_media_details:a,error:s.getCallError().message,error_type:s.getCallError().type},type:r};break;default:cM.warn("Invalid metric name received. Rejecting request to submit metric.",{file:JO,method:this.submitMediaMetric.name})}c&&this.webex.internal.metrics.submitClientMetrics(e,c)}},{key:"submitVoicemailMetric",value:function(e,t,r,n,i,o){var a;switch(e){case mO.VOICEMAIL:var s,c,u,l;a={tags:{action:t,device_id:null===(s=this.deviceInfo)||void 0===s||null===(c=s.device)||void 0===c?void 0:c.deviceId,message_id:n},fields:{device_url:null===(u=this.deviceInfo)||void 0===u||null===(l=u.device)||void 0===l?void 0:l.clientDeviceUri,calling_sdk_version:void 0!==lM?"3.8.1-next.22":OO},type:r};break;case mO.VOICEMAIL_ERROR:var d,f,h,p;a={tags:{action:t,device_id:null===(d=this.deviceInfo)||void 0===d||null===(f=d.device)||void 0===f?void 0:f.deviceId,message_id:n,error:i,status_code:o},fields:{device_url:null===(h=this.deviceInfo)||void 0===h||null===(p=h.device)||void 0===p?void 0:p.clientDeviceUri,calling_sdk_version:void 0!==lM?"3.8.1-next.22":OO},type:r};break;default:cM.warn("Invalid metric name received. Rejecting request to submit metric.",{file:JO,method:this.submitVoicemailMetric.name})}a&&this.webex.internal.metrics.submitClientMetrics(e,a)}},{key:"submitBNRMetric",value:function(e,t,r,n){var i,o,a,s,c,u,l;e===mO.BNR_ENABLED||e===mO.BNR_DISABLED?i={tags:{device_id:null===(o=this.deviceInfo)||void 0===o||null===(a=o.device)||void 0===a?void 0:a.deviceId,service_indicator:this.serviceIndicator},fields:{device_url:null===(s=this.deviceInfo)||void 0===s||null===(c=s.device)||void 0===c?void 0:c.clientDeviceUri,mobius_url:null===(u=this.deviceInfo)||void 0===u||null===(l=u.device)||void 0===l?void 0:l.uri,calling_sdk_version:"3.8.1-next.22",call_id:r,correlation_id:n},type:t}:cM.warn("Invalid metric name received. Rejecting request to submit metric.",{file:JO,method:this.submitBNRMetric.name});i&&this.webex.internal.metrics.submitClientMetrics(e,i)}}]),e}(),fM=function(e,t){return!uM&&e&&(uM=new dM(e,t)),uM};var hM,pM,vM,mM,gM;function yM(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}!function(e){e.CALL_CONTROL="call_control",e.MEDIA="media"}(hM||(hM={})),function(e){e.CALL_ERROR="call_error",e.DEFAULT="default_error",e.BAD_REQUEST="bad_request",e.FORBIDDEN_ERROR="forbidden",e.NOT_FOUND="not_found",e.REGISTRATION_ERROR="registration_error",e.SERVICE_UNAVAILABLE="service_unavailable",e.TIMEOUT="timeout",e.TOKEN_ERROR="token_error",e.TOO_MANY_REQUESTS="too_many_requests",e.SERVER_ERROR="server_error"}(pM||(pM={})),function(e){e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.DEVICE_NOT_FOUND=404]="DEVICE_NOT_FOUND",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS"}(vM||(vM={})),function(e){e[e.INVALID_STATUS_UPDATE=111]="INVALID_STATUS_UPDATE",e[e.DEVICE_NOT_REGISTERED=112]="DEVICE_NOT_REGISTERED",e[e.CALL_NOT_FOUND=113]="CALL_NOT_FOUND",e[e.ERROR_PROCESSING=114]="ERROR_PROCESSING",e[e.USER_BUSY=115]="USER_BUSY",e[e.PARSING_ERROR=116]="PARSING_ERROR",e[e.TIMEOUT_ERROR=117]="TIMEOUT_ERROR",e[e.NOT_ACCEPTABLE=118]="NOT_ACCEPTABLE",e[e.CALL_REJECTED=119]="CALL_REJECTED",e[e.NOT_AVAILABLE=120]="NOT_AVAILABLE"}(mM||(mM={})),function(e){e[e.DEVICE_LIMIT_EXCEEDED=101]="DEVICE_LIMIT_EXCEEDED",e[e.DEVICE_CREATION_DISABLED=102]="DEVICE_CREATION_DISABLED",e[e.DEVICE_CREATION_FAILED=103]="DEVICE_CREATION_FAILED"}(gM||(gM={}));var bM=function(e){Je(r,e);var t=yM(r);function r(e,n,i){var o;return ne(this,r),C(Ye(o=t.call(this,e)),"type",void 0),C(Ye(o),"context",void 0),o.type=i||pM.DEFAULT,o.context=n,o}return oe(r)}(tt(Error));function EM(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var SM,_M,wM,RM,CM,TM,xM,kM,IM,AM,OM,LM=function(e){Je(r,e);var t=EM(r);function r(e,n,i,o,a){var s;return ne(this,r),C(Ye(s=t.call(this,e,n,i)),"correlationId",void 0),C(Ye(s),"errorLayer",void 0),s.correlationId=o,s.errorLayer=a,s}return oe(r,[{key:"setCallError",value:function(e){this.message=e.message,this.correlationId=e.correlationId,this.context=e.context,this.type=e.type}},{key:"getCallError",value:function(){return{message:this.message,context:this.context,type:this.type,correlationId:this.correlationId,errorLayer:this.errorLayer}}}]),r}(bM),MM=function(e,t,r,n,i){return new LM(e,t,r,n,i)};function NM(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}!function(e){e.MOBIUS="mobius",e.JANUS="janus"}(SM||(SM={})),function(e){e.GET="GET",e.POST="POST",e.PATCH="PATCH",e.PUT="PUT",e.DELETE="DELETE"}(_M||(_M={})),function(e){e.IDLE="IDLE",e.ACTIVE="active",e.INACTIVE="inactive"}(wM||(wM={})),function(e){e.WXC="WEBEX_CALLING",e.BWRKS="BROADWORKS_CALLING",e.UCM="UCM_CALLING",e.INVALID="Calling backend is currently not supported"}(RM||(RM={})),function(e){e.URI="uri",e.TEL="tel"}(CM||(CM={})),function(e){e.INBOUND="inbound",e.OUTBOUND="outbound"}(TM||(TM={})),function(e){e.ASC="ASC",e.DESC="DESC",e.DEFAULT="DESC"}(xM||(xM={})),function(e){e.END_TIME="endTime",e.DEFAULT="endTime",e.START_TIME="startTime"}(kM||(kM={})),function(e){e.CALLING="calling",e.CONTACT_CENTER="contactcenter",e.GUEST_CALLING="guestcalling"}(IM||(IM={})),function(e){e.PEOPLE="PEOPLE",e.ORGANIZATION="ORGANIZATION"}(AM||(AM={})),function(e){e.START_KEEPALIVE="START_KEEPALIVE",e.CLEAR_KEEPALIVE="CLEAR_KEEPALIVE",e.KEEPALIVE_SUCCESS="KEEPALIVE_SUCCESS",e.KEEPALIVE_FAILURE="KEEPALIVE_FAILURE"}(OM||(OM={}));var PM,DM,FM=function(e){Je(r,e);var t=NM(r);function r(e,n,i,o){var a;return ne(this,r),C(Ye(a=t.call(this,e,n,i)),"status",wM.INACTIVE),a.status=o,a}return oe(r,[{key:"setError",value:function(e){this.message=e.message,this.context=e.context,this.type=e.type}},{key:"getError",value:function(){return{message:this.message,context:this.context,type:this.type}}}]),r}(bM),UM=function(e,t,r,n){return new FM(e,t,r,n)},jM=__webpack_require__(27392),BM=__webpack_require__.n(jM),qM=function(){function e(){ne(this,e)}return oe(e,[{key:"setWebex",value:function(e){if(PM)throw new Error("You cannot set the SDKConnector instance more than once");var t=function(e){return e.canAuthorize?e.ready?e.internal.mercury?{error:void 0,success:!0}:{error:new Error("webex.internal.mercury is not available"),success:!1}:{error:new Error("webex.ready is not true"),success:!1}:{error:new Error("webex.canAuthorize is not true"),success:!1}}(e),r=t.error,n=t.success;if(r)throw r;if(!n)throw new Error("An unknown error occurred setting up the webex instance.");DM=e,PM=this}},{key:"get",value:function(){return PM}},{key:"getWebex",value:function(){return DM}},{key:"request",value:function(e){return PM.getWebex().request(e)}},{key:"registerListener",value:function(e,t){PM.getWebex().internal.mercury.on(e,(function(e){t(e)}))}},{key:"unregisterListener",value:function(e){PM.getWebex().internal.mercury.off(e)}}]),e}();const VM=BM()(new qM);function GM(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var WM=function(e){Je(r,e);var t=GM(r);function r(e,n,i,o){var a;return ne(this,r),C(Ye(a=t.call(this,e,n,i)),"status",wM.INACTIVE),a.status=o,a}return oe(r,[{key:"setError",value:function(e){this.message=e.message,this.context=e.context,this.type=e.type,this.status=e.status}},{key:"getError",value:function(){return{message:this.message,context:this.context,type:this.type,status:this.status}}}]),r}(bM),zM=function(e,t,r,n){return new WM(e,t,r,n)};function HM(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function KM(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?HM(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):HM(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}function $M(e,t){var r=void 0!==Yr()&&e[Xr()]||e["@@iterator"];if(!r){if(en()(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return JM(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return $r()(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return JM(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function JM(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function YM(e,t){var r,n,i={file:WO,method:YM.name},o=[],a=[];if(null!=e&&null!==(r=e.primary)&&void 0!==r&&r.uris){cM.info("Adding Primary uris",i);var s,c=$M(e.primary.uris);try{for(c.s();!(s=c.n()).done;){var u=s.value;o.push("".concat(u).concat(qO))}}catch(e){c.e(e)}finally{c.f()}}if(null!=e&&null!==(n=e.backup)&&void 0!==n&&n.uris){cM.info("Adding Backup uris",i);var l,d=$M(e.backup.uris);try{for(d.s();!(l=d.n()).done;){var f=l.value;a.push("".concat(f).concat(qO))}}catch(e){d.e(e)}finally{d.f()}}cM.info("Adding Default uri",i),o.length||a.length?a.push("".concat(t).concat(qO)):o.push("".concat(t).concat(qO));for(var h=[],p=[],v=0;v<o.length;v+=1)-1===h.indexOf(o[v])&&h.push(o[v]);for(var m=0;m<a.length;m+=1)-1===p.indexOf(a[m])&&p.push(a[m]);return{primary:h,backup:p}}function QM(e,t,r,n,i){var o={};o.context=e,o.type=t,o.message=r,o.correlationId=n,i.setCallError(o)}function XM(e,t,r,n,i){var o={};o.context=e,o.type=t,o.message=r,o.status=n,i.setError(o)}function ZM(e,t,r,n){var i={};i.context=e,i.type=t,i.message=r,n.setError(i)}function eN(e,t){var r=zM("",{},pM.DEFAULT,wM.INACTIVE);XM(t,pM.SERVICE_UNAVAILABLE,"An unknown error occurred. Wait a moment and try again. Please contact the administrator if the problem persists.",wM.INACTIVE,r),e(r)}function tN(e,t,r,n,i){return rN.apply(this,arguments)}function rN(){return(rN=_e(Re().mark((function e(t,r,n,i,o){var a,s,c,u,l,d,f,h,p,v,m;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=zM("",{},pM.DEFAULT,wM.INACTIVE),s=Number(t.statusCode),c=!1,cM.warn("Status code: -> ".concat(s),n),e.t0=s,e.next=e.t0===vM.BAD_REQUEST?7:e.t0===vM.UNAUTHORIZED?12:e.t0===vM.DEVICE_NOT_FOUND?17:e.t0===vM.TOO_MANY_REQUESTS?22:e.t0===vM.INTERNAL_SERVER_ERROR?27:e.t0===vM.SERVICE_UNAVAILABLE?31:e.t0===vM.FORBIDDEN?35:70;break;case 7:return c=!0,cM.warn("400 Bad Request",n),XM(n,pM.BAD_REQUEST,"Invalid input. Please verify the required parameters, sign out and then sign back in with the valid data",wM.INACTIVE,a),r(a,c),e.abrupt("break",73);case 12:return c=!0,cM.warn("401 Unauthorized",n),XM(n,pM.TOKEN_ERROR,"User is unauthorized due to an expired token. Sign out, then sign back in.",wM.INACTIVE,a),r(a,c),e.abrupt("break",73);case 17:return c=!0,cM.warn("404 Device Not Found",n),XM(n,pM.NOT_FOUND,"Webex Calling is unable to find your device. Sign out, then sign back in",wM.INACTIVE,a),r(a,c),e.abrupt("break",73);case 22:return cM.warn("429 Too Many Requests",n),XM(n,pM.TOO_MANY_REQUESTS,"Server is handling too many request at the time. Wait a moment and try again",wM.INACTIVE,a),u=n.method||"handleErrors",i&&t.headers&&(l=Number(t.headers["retry-after"]),i(l,u)),e.abrupt("break",73);case 27:return cM.warn("500 Internal Server Error",n),XM(n,pM.SERVER_ERROR,"An unknown error occurred while placing the request. Wait a moment and try again.",wM.INACTIVE,a),r(a,c),e.abrupt("break",73);case 31:return cM.warn("503 Service Unavailable",n),XM(n,pM.SERVICE_UNAVAILABLE,"An error occurred on the server while processing the request. Wait a moment and try again.",wM.INACTIVE,a),r(a,c),e.abrupt("break",73);case 35:if(cM.warn("403 Forbidden",n),d=t.body){e.next=42;break}return cM.warn("Error response has no body, throwing default error",n),XM(n,pM.FORBIDDEN_ERROR,"An unauthorized action has been received. This action has been blocked. Please contact the administrator if this persists.",wM.INACTIVE,a),r(a,c),e.abrupt("return",c);case 42:f=Number(d.errorCode),cM.warn("Error code found : ".concat(f),n),e.t1=f,e.next=e.t1===gM.DEVICE_LIMIT_EXCEEDED?47:e.t1===gM.DEVICE_CREATION_DISABLED?54:e.t1===gM.DEVICE_CREATION_FAILED?60:65;break;case 47:if("User device limit exceeded",cM.warn("User device limit exceeded",n),!o){e.next=53;break}return h=n.method||"handleErrors",e.next=53,o(d,h);case 53:return e.abrupt("break",69);case 54:return p="User is not configured for WebRTC calling. Please contact the administrator to resolve this issue.",c=!0,XM(n,pM.FORBIDDEN_ERROR,p,wM.INACTIVE,a),cM.warn(p,n),r(a,!0),e.abrupt("break",69);case 60:return v="An unknown error occurred while provisioning the device. Wait a moment and try again.",XM(n,pM.FORBIDDEN_ERROR,v,wM.INACTIVE,a),cM.warn(v,n),r(a,c),e.abrupt("break",69);case 65:m="An unknown error occurred. Wait a moment and try again. Please contact the administrator if the problem persists.",XM(n,pM.FORBIDDEN_ERROR,m,wM.INACTIVE,a),cM.warn(m,n),r(a,c);case 69:return e.abrupt("break",73);case 70:XM(n,pM.DEFAULT,"Unknown error",wM.INACTIVE,a),cM.warn("Unknown Error",n),r(a,c);case 73:return e.abrupt("return",c);case 74:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function nN(e,t,r){return iN.apply(this,arguments)}function iN(){return(iN=_e(Re().mark((function e(t,r,n){var i,o,a;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=UM("",{},pM.DEFAULT,wM.INACTIVE),o=Number(t.statusCode),a=!1,cM.warn("Status code: -> ".concat(o),n),e.t0=o,e.next=e.t0===vM.UNAUTHORIZED?7:e.t0===vM.INTERNAL_SERVER_ERROR?12:16;break;case 7:return a=!0,cM.warn("401 Unauthorized",n),ZM(n,pM.TOKEN_ERROR,"User is unauthorized due to an expired token.",i),r(i,a),e.abrupt("break",19);case 12:return cM.warn("500 Internal Server Error",n),ZM(n,pM.SERVER_ERROR,"An unknown error occurred while placing the request. Wait a moment and try again.",i),r(i,a),e.abrupt("break",19);case 16:ZM(n,pM.DEFAULT,"Unknown error",i),cM.warn("Unknown Error",n),r(i,a);case 19:return e.next=21,mN();case 21:return e.abrupt("return",a);case 22:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oN(e,t,r,n,i,o,a){return aN.apply(this,arguments)}function aN(){return(aN=_e(Re().mark((function e(t,r,n,i,o,a,s){var c,u,l,d,f,h,p;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u=MM("",c={file:s,method:a},pM.DEFAULT,"",r),l=Number(o.statusCode),cM.warn("Status code: ->".concat(l),c),e.t0=l,e.next=e.t0===vM.UNAUTHORIZED?7:e.t0===vM.FORBIDDEN||e.t0===vM.SERVICE_UNAVAILABLE?11:e.t0===vM.DEVICE_NOT_FOUND?48:e.t0===vM.INTERNAL_SERVER_ERROR?52:56;break;case 7:return cM.warn("401 Unauthorized",c),QM(c,pM.TOKEN_ERROR,"User is unauthorized due to an expired token. Sign out, then sign back in.",i,u),t(u),e.abrupt("break",57);case 11:if(d=o.body){e.next=17;break}return cM.warn("Error response has no body, throwing default error",c),QM(c,403===o.statusCode?pM.FORBIDDEN_ERROR:pM.SERVICE_UNAVAILABLE,403===o.statusCode?"An unauthorized action has been received. This action has been blocked. Please contact the administrator if this persists.":"An error occurred on the server while processing the request. Wait a moment and try again.",i,u),t(u),e.abrupt("return");case 17:if(!(o.headers&&"retry-after"in o.headers&&n)){e.next=22;break}return f=Number(o.headers["retry-after"]),cM.warn("Retry Interval received: ".concat(f),c),n(f),e.abrupt("return");case 22:h=Number(d.errorCode),e.t1=h,e.next=e.t1===mM.INVALID_STATUS_UPDATE?26:e.t1===mM.DEVICE_NOT_REGISTERED?28:e.t1===mM.CALL_NOT_FOUND?30:e.t1===mM.ERROR_PROCESSING?32:e.t1===mM.USER_BUSY?34:e.t1===mM.PARSING_ERROR?36:e.t1===mM.NOT_ACCEPTABLE?38:e.t1===mM.CALL_REJECTED?40:e.t1===mM.NOT_AVAILABLE?42:44;break;case 26:return p="An invalid status update has been received for the call. Wait a moment and try again.",e.abrupt("break",45);case 28:return p="The client has unregistered. Please wait for the client to register before attempting the call. If error persists, sign out, sign back in and attempt the call.",e.abrupt("break",45);case 30:return p="Call is not found on the server. Wait a moment and try again.",e.abrupt("break",45);case 32:return p="An error occurred while processing the call on the server. Wait a moment and try again.",e.abrupt("break",45);case 34:return p="Called user is busy.",e.abrupt("break",45);case 36:return p="An error occurred while parsing the provided information. Wait a moment and try again.",e.abrupt("break",45);case 38:return p="An error occurred on the server while accepting the call. Wait a moment and try again. Please contact the administrator if this persists.",e.abrupt("break",45);case 40:return p="Call rejected by the server. Wait a moment and try again. Please contact the administrator if this persists.",e.abrupt("break",45);case 42:return p="Calling services not available. Wait a moment and try again. Please contact the administrator if this persists.",e.abrupt("break",45);case 44:p="An unknown error occurred. Wait a moment and try again.";case 45:return QM(c,403===o.statusCode?pM.FORBIDDEN_ERROR:pM.SERVICE_UNAVAILABLE,p,i,u),t(u),e.abrupt("break",57);case 48:return cM.warn("404 Call Not Found",c),QM(c,pM.NOT_FOUND,"Call is no longer active. Wait a moment and try again.",i,u),t(u),e.abrupt("break",57);case 52:return cM.warn("500 Internal Server Error",c),QM(c,pM.SERVER_ERROR,"An unknown error occurred in the call. Wait a moment and try again.",i,u),t(u),e.abrupt("break",57);case 56:cM.warn("Unknown Error",c);case 57:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function sN(e,t){return cN.apply(this,arguments)}function cN(){return(cN=_e(Re().mark((function e(t,r){var n,i,o,a,s,c,u,l,d,f,h;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Number(t.statusCode),i="FAILURE",e.t0=n,e.next=e.t0===vM.BAD_REQUEST?5:e.t0===vM.UNAUTHORIZED?8:e.t0===vM.FORBIDDEN?11:e.t0===vM.DEVICE_NOT_FOUND?14:e.t0===vM.REQUEST_TIMEOUT?17:e.t0===vM.NOT_IMPLEMENTED?20:e.t0===vM.INTERNAL_SERVER_ERROR?23:e.t0===vM.SERVICE_UNAVAILABLE?26:29;break;case 5:return cM.warn("400 Bad request",r),o={statusCode:400,data:{error:"400 Bad request"},message:i},e.abrupt("return",o);case 8:return cM.warn("401 User is unauthorised, possible token expiry",r),a={statusCode:401,data:{error:"User is unauthorised, possible token expiry"},message:i},e.abrupt("return",a);case 11:return cM.warn("403 User request is forbidden",r),s={statusCode:403,data:{error:"User request is forbidden"},message:i},e.abrupt("return",s);case 14:return cM.warn("404 User info not found",r),c={statusCode:404,data:{error:"User info not found"},message:i},e.abrupt("return",c);case 17:return cM.warn("408 Request to the server timedout",r),u={statusCode:408,data:{error:"Request to the server timedout"},message:i},e.abrupt("return",u);case 20:return cM.warn("501 Not Implemented error occurred",r),l={statusCode:501,data:{error:"Method is not implemented at the backend"},message:i},e.abrupt("return",l);case 23:return cM.warn("500 Internal server error occurred",r),d={statusCode:500,data:{error:"Internal server error occurred"},message:i},e.abrupt("return",d);case 26:return cM.warn("503 Unable to establish a connection with the server",r),f={statusCode:503,data:{error:"Unable to establish a connection with the server"},message:i},e.abrupt("return",f);case 29:return cM.warn("".concat(n||422," Exception has occurred"),r),h={statusCode:n||422,data:{error:"".concat(n||422," Exception has occurred")},message:i},e.abrupt("return",h);case 32:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function uN(e){if(!e||-1!==navigator.userAgent.indexOf("Firefox"))return cM.info("RTCStatsReport is null, adding dummy stats",{file:WO,method:uN.name}),FO;try{var t,r,n,i,o={},a={},s={},c={},u={},d={},f=0,h=0,p=0,v=0,m="",g=0;d.maxJitter=0,d.VoPktSizeMs=20,e.forEach((function(e){l()(e).forEach((function(l){if("timestamp"!==l)if(t&&"type"!==l)if(r&&"id"!==l)if(r&&-1!==r.indexOf("RTCIceCandidatePair_"))"localCandidateId"===l&&(a[r]=e[l]);else if(r&&-1!==r.indexOf("RTCIceCandidate_"))"networkType"===l&&(o[r]=e[l]);else if(!r||-1===r.indexOf("CIT01_")&&-1===r.indexOf("COT01_")&&-1===r.indexOf("RTCCodec_")){if(t&&"remote-inbound-rtp"===t)switch(l){case"totalRoundTripTime":p=e[l];break;case"roundTripTimeMeasurements":v=e[l]}else if(t&&"inbound-rtp"===t)switch(l){case QO:n=e[l];break;case"packetsReceived":c.Pkt=e[l];break;case"bytesReceived":c.Oct=e[l];break;case"packetsDiscarded":c.LatePkt=e[l];break;case"packetsLost":c.LostPkt=e[l];break;case"jitterBufferDelay":f=e[l];break;case"jitterBufferEmittedCount":h=e[l]}else if(t&&"transport"===t){if("selectedCandidatePairId"===l)m=e[l]}else if(t&&"outbound-rtp"===t)switch(l){case QO:i=e[l];break;case"packetsSent":u.Pkt=e[l];break;case"bytesSent":u.Oct=e[l];break;case"targetBitrate":g=e[l]}else if(t&&"media-source"===t&&"totalSamplesDuration"===l)c.Dur=e[l],u.Dur=e[l]}else"mimeType"===l&&(s[r]=e[l]);else r=e[l];else t=e[l]}))})),d.VoOneWayDelayMs=0!==v?p/(2*v):0,d.hwType="".concat(TO.os,"/").concat(TO.name,"-").concat(TO.version),d.networkType=o[a[m]],c.AvgJit=f/h,d.VoRxCodec=s[n].split("/")[1];var y={};y.VoTxCodec=s[i].split("/")[1],y.rtpBitRate=g;var b={};return c.VQMetrics=d,u.VQMetrics=y,b["rtp-rxstat"]=c,b["rtp-txstat"]=u,cM.log(Cr()(b),{file:WO,method:uN.name}),b}catch(e){return cM.warn("Caught error while parsing RTP stats, ".concat(e),{file:WO,method:uN.name}),FO}}function lN(e){return dN.apply(this,arguments)}function dN(){return dN=_e(Re().mark((function e(t){var r,n,i,o;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return cM.info("Starting resolution for filter:- ".concat(t),{file:WO,method:"scimQuery"}),r=VM.getWebex(),n=!r.internal.device.url.includes("-int"),i="".concat(n?wO:RO,"/").concat(EO,"/").concat(SO,"/").concat(r.internal.device.orgId,"/").concat(_O),o=i+encodeURIComponent(t),e.abrupt("return",r.request({uri:o,method:_M.GET,headers:C(C({},PO,r.internal.device.url),jO,MO)}));case 8:case"end":return e.stop()}}),e)}))),dN.apply(this,arguments)}function fN(e){return hN.apply(this,arguments)}function hN(){return hN=_e(Re().mark((function e(t){var r,n,i,o,a,s,c,u,l,d,f;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i={},e.prev=1,e.next=4,lN(t);case 4:o=e.sent,n=o.body,cM.info("Number of records found for this user :- ".concat(n.totalResults),{file:WO,method:"resolveCallerIdDisplay"}),e.next=13;break;case 9:e.prev=9,e.t0=e.catch(1),a=e.t0,cM.warn("Error response: - ".concat(a.statusCode),{file:WO,method:"resolveCallerIdDisplay"});case 13:return null!==(r=n)&&void 0!==r&&r.totalResults&&n.totalResults>0&&(l=n.Resources[0],i.name=l.displayName,(d=(null===(s=l.phoneNumbers)||void 0===s?void 0:s.find((function(e){return e.primary})))||(null===(c=l.phoneNumbers)||void 0===c?void 0:c.find((function(e){return"work"===e.type.toLowerCase()}))))?i.num=d.value:l.phoneNumbers&&l.phoneNumbers.length>0&&(cM.info("Failure to resolve caller information. Setting number as caller ID",{file:WO,method:"resolveCallerIdDisplay"}),i.num=l.phoneNumbers[0].value),f=null===(u=l.photos)||void 0===u?void 0:u.find((function(e){return"thumbnail"===e.type})),i.avatarSrc=f?f.value:"unknown",i.id=l.id),e.abrupt("return",i);case 15:case"end":return e.stop()}}),e,null,[[1,9]])}))),hN.apply(this,arguments)}function pN(e){var t,r=Fr()(IM).join(", ").replace(/,([^,]*)$/," and$1");if(t=e.indicator,!Fr()(IM).some((function(e){return e===t})))throw new Error("Invalid service indicator, Allowed values are: ".concat(r));if(!function(e){var t=e.domain;return t?/^[a-z0-9]+([-.]{1}[a-z0-9]+)*\.[a-z]{2,6}$/i.test(t):e.indicator===IM.CALLING||e.indicator===IM.GUEST_CALLING}(e))throw new Error("Invalid service domain.")}function vN(e){try{if(((e=(e=e.replace(/\r\n|\r/g,"\n")).replace(/^[ \t]+/gm,"")).match(/c=IN IP6 [\da-f:.]+/gi)||[]).length>0){cM.info("Modifying SDP for IPv4 compatibility",{file:WO,method:vN.name});var t=e.match(/a=candidate:\d+ \d+ \w+ \d+ ([\d.]+) \d+ typ \w+/),r=(null==t?void 0:t[1])||"192.1.1.1";if(e=e.replace(/c=IN IP6 [\da-f:.]+/gi,"c=IN IP4 ".concat(r)),!t){var n=!1;e=e.replace(/(a=candidate:(\d+) (\d+) (\w+) (\d+) ([\da-f:.]+) (\d+) typ (\w+)[^\n]*)/g,(function(e,t,i,o,a,s,c,u,l){if(!n&&c.includes(":")){n=!0;var d=(jr()(i,10)+1).toString();return"".concat(t,"\n")+"a=candidate:".concat(d," ").concat(o," ").concat(a," ").concat(s," ").concat(r," ").concat(u," typ ").concat(l," generation 0 network-id 1 network-cost 10")}return e}))}}return e}catch(t){return cM.warn("Error modifying SDP for IPv4 compatibility: ".concat(t),{file:WO,method:vN.name}),e}}function mN(){return gN.apply(this,arguments)}function gN(){return gN=_e(Re().mark((function e(){var t,r,n,i,o,a,s=arguments;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:{},r=s.length>1&&void 0!==s[1]&&s[1],n=VM.getWebex(),i=crypto.randomUUID(),e.prev=4,e.next=7,n.internal.support.submitLogs(KM(KM({},t),{},{feedbackId:i}),void 0,{type:"diff"});case 7:return o=e.sent,cM.info("Logs uploaded successfully with feedbackId: ".concat(i),{file:WO,method:"uploadLogs"}),fM().submitUploadLogsMetric(mO.UPLOAD_LOGS_SUCCESS,AO,vO.BEHAVIORAL,null==o?void 0:o.trackingid,i,null==t?void 0:t.correlationId),e.abrupt("return",KM(KM(KM(KM({trackingid:o.trackingid},o.url?{url:o.url}:{}),o.userId?{userId:o.userId}:{}),o.correlationId?{correlationId:o.correlationId}:{}),{},{feedbackId:i}));case 13:if(e.prev=13,e.t0=e.catch(4),a=new Error("Failed to upload Logs ".concat(e.t0)),cM.error(a,{file:WO,method:"uploadLogs"}),fM().submitUploadLogsMetric(mO.UPLOAD_LOGS_FAILED,AO,vO.BEHAVIORAL,i,null==t?void 0:t.correlationId,a.message),!r){e.next=20;break}throw e.t0;case 20:return e.abrupt("return",void 0);case 21:case"end":return e.stop()}}),e,null,[[4,13]])}))),gN.apply(this,arguments)}var yN;!function(e){e.ADDRESS_INFO="addressInfo",e.AVATAR_URL="avatarURL",e.COMPANY="companyName",e.DISPLAY_NAME="displayName",e.EMAILS="emails",e.FIRST_NAME="firstName",e.LAST_NAME="lastName",e.PHONE_NUMBERS="phoneNumbers",e.SIP_ADDRESSES="sipAddresses",e.TITLE="title"}(yN||(yN={}));var bN,EN;!function(e){e.CUSTOM="CUSTOM",e.CLOUD="CLOUD"}(bN||(bN={})),function(e){e.NORMAL="NORMAL",e.EXTERNAL="EXTERNAL"}(EN||(EN={}));new Error("timeout while waiting for mutex to become available"),new Error("mutex already locked");const SN=new Error("request for lock canceled");var _N=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};class wN{constructor(e,t=SN){this._value=e,this._cancelError=t,this._weightedQueues=[],this._weightedWaiters=[]}acquire(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise(((t,r)=>{this._weightedQueues[e-1]||(this._weightedQueues[e-1]=[]),this._weightedQueues[e-1].push({resolve:t,reject:r}),this._dispatch()}))}runExclusive(e,t=1){return _N(this,void 0,void 0,(function*(){const[r,n]=yield this.acquire(t);try{return yield e(r)}finally{n()}}))}waitForUnlock(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((t=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),this._weightedWaiters[e-1].push(t),this._dispatch()}))}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatch()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatch()}cancel(){this._weightedQueues.forEach((e=>e.forEach((e=>e.reject(this._cancelError))))),this._weightedQueues=[]}_dispatch(){var e;for(let t=this._value;t>0;t--){const r=null===(e=this._weightedQueues[t-1])||void 0===e?void 0:e.shift();if(!r)continue;const n=this._value,i=t;this._value-=t,t=this._value+1,r.resolve([n,this._newReleaser(i)])}this._drainUnlockWaiters()}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){for(let e=this._value;e>0;e--)this._weightedWaiters[e-1]&&(this._weightedWaiters[e-1].forEach((e=>e())),this._weightedWaiters[e-1]=[])}}var RN=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};class CN{constructor(e){this._semaphore=new wN(1,e)}acquire(){return RN(this,void 0,void 0,(function*(){const[,e]=yield this._semaphore.acquire();return e}))}runExclusive(e){return this._semaphore.runExclusive((()=>e()))}isLocked(){return this._semaphore.isLocked()}waitForUnlock(){return this._semaphore.waitForUnlock()}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}function TN(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var xN,kN,IN,AN,ON,LN,MN,NN,PN,DN,FN,UN,jN=function(e){Je(r,e);var t=TN(r);function r(){return ne(this,r),t.apply(this,arguments)}return oe(r,[{key:"emit",value:function(e){for(var t,n=(new Date).toUTCString(),i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return cM.info("".concat(n," ").concat(xO.EVENT,": ").concat(e.toString()," - event emitted with parameters -> ").concat(o," = "),{file:"Events/impl/index.ts",method:"emit"}),(t=Qh(Ze(r.prototype),"emit",this)).call.apply(t,[this,e].concat(o))}},{key:"on",value:function(e,t){return Qh(Ze(r.prototype),"on",this).call(this,e,t)}},{key:"off",value:function(e,t){return Qh(Ze(r.prototype),"off",this).call(this,e,t)}}]),r}(qe());!function(e){e.CONNECTING="connecting",e.ERROR="error",e.RECONNECTED="reconnected",e.RECONNECTING="reconnecting",e.REGISTERED="registered",e.UNREGISTERED="unregistered",e.INCOMING_CALL="line:incoming_call"}(xN||(xN={})),function(e){e.CB_VOICEMESSAGE_CONTENT_GET="call_back_voicemail_content_get",e.CALL_HISTORY_USER_SESSION_INFO="callHistory:user_recent_sessions",e.CALL_HISTORY_USER_VIEWED_SESSIONS="callHistory:user_viewed_sessions",e.CALL_HISTORY_USER_SESSIONS_DELETED="callHistory:user_sessions_deleted"}(kN||(kN={})),function(e){e.INCOMING_CALL="incoming_call"}(IN||(IN={})),function(e){e.ERROR="callingClient:error",e.OUTGOING_CALL="callingClient:outgoing_call",e.USER_SESSION_INFO="callingClient:user_recent_sessions",e.ALL_CALLS_CLEARED="callingClient:all_calls_cleared"}(AN||(AN={})),function(e){e.ALERTING="alerting",e.CALL_ERROR="call_error",e.CALLER_ID="caller_id",e.CONNECT="connect",e.DISCONNECT="disconnect",e.ESTABLISHED="established",e.HELD="held",e.HOLD_ERROR="hold_error",e.PROGRESS="progress",e.REMOTE_MEDIA="remote_media",e.RESUME_ERROR="resume_error",e.RESUMED="resumed",e.TRANSFER_ERROR="transfer_error"}(ON||(ON={})),function(e){e.HOLD="hold",e.RESUME="resume",e.DIVERT="divert",e.TRANSFER="transfer",e.PARK="park"}(LN||(LN={})),function(e){e.HELD="HELD",e.CONNECTED="CONNECTED"}(MN||(MN={})),function(e){e.ANSWERED="Answered",e.CANCELED="Canceled",e.INITIATED="Initiated",e.MISSED="MISSED"}(NN||(NN={})),function(e){e.SPARK="SPARK",e.WEBEX_CALLING="WEBEXCALLING"}(PN||(PN={})),function(e){e.SERVER_EVENT_INCLUSIVE="event:mobius",e.CALL_SESSION_EVENT_INCLUSIVE="event:janus.user_recent_sessions",e.CALL_SESSION_EVENT_LEGACY="event:janus.user_sessions",e.CALL_SESSION_EVENT_VIEWED="event:janus.user_viewed_sessions",e.CALL_SESSION_EVENT_DELETED="event:janus.user_sessions_deleted"}(DN||(DN={})),function(e){e.ROAP_MESSAGE_TO_SEND="roap:messageToSend",e.MEDIA_TYPE_AUDIO="audio"}(FN||(FN={})),function(e){e.HELD="held",e.REMOTE_HELD="remoteheld",e.CONNECTED="connected"}(UN||(UN={}));var BN,qN,VN,GN,WN,zN,HN,KN,$N,JN;!function(e){e.CALL_PROGRESS="callprogress",e.CALL_CONNECTED="callconnected",e.CALL_DISCONNECTED="callconnected",e.CALL_INFO="callinfo",e.CALL="call",e.ROAP="ROAP"}(BN||(BN={})),function(e){e.CALL_SETUP="mobius.call",e.CALL_PROGRESS="mobius.callprogress",e.CALL_CONNECTED="mobius.callconnected",e.CALL_MEDIA="mobius.media",e.CALL_DISCONNECTED="mobius.calldisconnected"}(qN||(qN={})),function(e){e.OFFER="OFFER",e.ANSWER="ANSWER",e.OFFER_REQUEST="OFFER_REQUEST",e.OK="OK",e.ERROR="ERROR"}(VN||(VN={})),function(e){e[e.BUSY=115]="BUSY",e[e.NORMAL=0]="NORMAL",e[e.MEDIA_INACTIVITY=131]="MEDIA_INACTIVITY"}(GN||(GN={})),function(e){e.BUSY="User Busy.",e.NORMAL="Normal Disconnect.",e.MEDIA_INACTIVITY="Media Inactivity."}(WN||(WN={})),function(e){e.CALL_INFO="callInfo",e.CALL_STATE="callState"}(zN||(zN={})),function(e){e.ANSWER="ANSWER",e.OK="OK",e.OFFER="OFFER",e.ERROR="ERROR",e.OFFER_RESPONSE="OFFER_RESPONSE"}(HN||(HN={})),function(e){e.PROCEEDING="sig_proceeding",e.PROGRESS="sig_progress",e.ALERTING="sig_alerting",e.CONNECTED="sig_connected"}(KN||(KN={})),function(e){e.BLIND="BLIND",e.CONSULT="CONSULT"}($N||($N={})),function(e){e.USER="user_mute",e.SYSTEM="system_mute"}(JN||(JN={}));var YN=function(){return YN=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},YN.apply(this,arguments)};function QN(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function XN(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ZN(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function eP(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}var tP,rP={},nP="xstate.guard",iP=!0;function oP(e,t,r){void 0===r&&(r=".");var n=cP(e,r),i=cP(t,r);return CP(i)?!!CP(n)&&i===n:CP(n)?n in i:Object.keys(n).every((function(e){return e in i&&oP(n[e],i[e])}))}function aP(e){try{return CP(e)||"number"==typeof e?"".concat(e):e.type}catch(e){throw new Error("Events must be strings or objects with a string event.type property.")}}function sP(e,t){try{return wP(e)?e:e.toString().split(t)}catch(t){throw new Error("'".concat(e,"' is not a valid state path."))}}function cP(e,t){return"object"==typeof(r=e)&&"value"in r&&"context"in r&&"event"in r&&"_event"in r?e.value:wP(e)?uP(e):"string"!=typeof e?e:uP(sP(e,t));var r}function uP(e){if(1===e.length)return e[0];for(var t={},r=t,n=0;n<e.length-1;n++)n===e.length-2?r[e[n]]=e[n+1]:(r[e[n]]={},r=r[e[n]]);return t}function lP(e,t){for(var r={},n=Object.keys(e),i=0;i<n.length;i++){var o=n[i];r[o]=t(e[o],o,e,i)}return r}function dP(e,t,r){var n,i,o={};try{for(var a=XN(Object.keys(e)),s=a.next();!s.done;s=a.next()){var c=s.value,u=e[c];r(u)&&(o[c]=t(u,c,e))}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return o}var fP=function(e){return function(t){var r,n,i=t;try{for(var o=XN(e),a=o.next();!a.done;a=o.next()){i=i[a.value]}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}};function hP(e){return e?CP(e)?[[e]]:pP(Object.keys(e).map((function(t){var r=e[t];return"string"==typeof r||r&&Object.keys(r).length?hP(e[t]).map((function(e){return[t].concat(e)})):[[t]]}))):[[]]}function pP(e){var t;return(t=[]).concat.apply(t,eP([],ZN(e),!1))}function vP(e){return wP(e)?e:[e]}function mP(e){return void 0===e?[]:vP(e)}function gP(e,t,r){var n,i;if(RP(e))return e(t,r.data);var o={};try{for(var a=XN(Object.keys(e)),s=a.next();!s.done;s=a.next()){var c=s.value,u=e[c];RP(u)?o[c]=u(t,r.data):o[c]=u}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return o}function yP(e){return e instanceof Promise||!(null===e||!RP(e)&&"object"!=typeof e||!RP(e.then))}function bP(e,t){var r,n,i=ZN([[],[]],2),o=i[0],a=i[1];try{for(var s=XN(e),c=s.next();!c.done;c=s.next()){var u=c.value;t(u)?o.push(u):a.push(u)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return[o,a]}function EP(e,t){return lP(e.states,(function(e,r){if(e){var n=(CP(t)?void 0:t[r])||(e?e.current:void 0);if(n)return{current:n,states:EP(e,n)}}}))}function SP(e,t,r,n){iP||_P(!!e,"Attempting to update undefined context");var i=e?r.reduce((function(e,r){var i,o,a=r.assignment,s={state:n,action:r,_event:t},c={};if(RP(a))c=a(e,t.data,s);else try{for(var u=XN(Object.keys(a)),l=u.next();!l.done;l=u.next()){var d=l.value,f=a[d];c[d]=RP(f)?f(e,t.data,s):f}}catch(e){i={error:e}}finally{try{l&&!l.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}return Object.assign({},e,c)}),e):e;return i}var _P=function(){};function wP(e){return Array.isArray(e)}function RP(e){return"function"==typeof e}function CP(e){return"string"==typeof e}function TP(e,t){if(e)return CP(e)?{type:nP,name:e,predicate:t?t[e]:void 0}:RP(e)?{type:nP,name:e.name,predicate:e}:e}iP||(_P=function(e,t){var r=e instanceof Error?e:void 0;if((r||!e)&&void 0!==console){var n=["Warning: ".concat(t)];r&&n.push(r),console.warn.apply(console,n)}});var xP=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();(tP={})[xP]=function(){return this},tP[Symbol.observable]=function(){return this};function kP(e){return!!e&&"__xstatenode"in e}var IP,AP;function OP(e,t){return CP(e)||"number"==typeof e?YN({type:e},t):e}function LP(e,t){if(!CP(e)&&"$$type"in e&&"scxml"===e.$$type)return e;var r=OP(e);return YN({name:r.type,data:r,$$type:"scxml",type:"external"},t)}function MP(e,t){return vP(t).map((function(t){return void 0===t||"string"==typeof t||kP(t)?{target:t,event:e}:YN(YN({},t),{event:e})}))}function NP(e,t,r,n,i){var o=e.options.guards,a={state:i,cond:t,_event:n};if(t.type===nP)return((null==o?void 0:o[t.name])||t.predicate)(r,n.data,a);var s=null==o?void 0:o[t.type];if(!s)throw new Error("Guard '".concat(t.type,"' is not implemented on machine '").concat(e.id,"'."));return s(r,n.data,a)}function PP(e){return"string"==typeof e?{type:e}:e}function DP(e,t,r){if("object"==typeof e)return e;var n=function(){};return{next:e,error:t||n,complete:r||n}}function FP(e,t){return"".concat(e,":invocation[").concat(t,"]")}!function(e){e.Start="xstate.start",e.Stop="xstate.stop",e.Raise="xstate.raise",e.Send="xstate.send",e.Cancel="xstate.cancel",e.NullEvent="",e.Assign="xstate.assign",e.After="xstate.after",e.DoneState="done.state",e.DoneInvoke="done.invoke",e.Log="xstate.log",e.Init="xstate.init",e.Invoke="xstate.invoke",e.ErrorExecution="error.execution",e.ErrorCommunication="error.communication",e.ErrorPlatform="error.platform",e.ErrorCustom="xstate.error",e.Update="xstate.update",e.Pure="xstate.pure",e.Choose="xstate.choose"}(IP||(IP={})),function(e){e.Parent="#_parent",e.Internal="#_internal"}(AP||(AP={}));var UP=function(e){return"atomic"===e.type||"final"===e.type};function jP(e){return Object.keys(e.states).map((function(t){return e.states[t]}))}function BP(e){var t=[e];return UP(e)?t:t.concat(pP(jP(e).map(BP)))}function qP(e,t){var r,n,i,o,a,s,c,u,l=GP(new Set(e)),d=new Set(t);try{for(var f=XN(d),h=f.next();!h.done;h=f.next())for(var p=(w=h.value).parent;p&&!d.has(p);)d.add(p),p=p.parent}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}var v=GP(d);try{for(var m=XN(d),g=m.next();!g.done;g=m.next()){if("compound"!==(w=g.value).type||v.get(w)&&v.get(w).length){if("parallel"===w.type)try{for(var y=(a=void 0,XN(jP(w))),b=y.next();!b.done;b=y.next()){var E=b.value;"history"!==E.type&&(d.has(E)||(d.add(E),l.get(E)?l.get(E).forEach((function(e){return d.add(e)})):E.initialStateNodes.forEach((function(e){return d.add(e)}))))}}catch(e){a={error:e}}finally{try{b&&!b.done&&(s=y.return)&&s.call(y)}finally{if(a)throw a.error}}}else l.get(w)?l.get(w).forEach((function(e){return d.add(e)})):w.initialStateNodes.forEach((function(e){return d.add(e)}))}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=m.return)&&o.call(m)}finally{if(i)throw i.error}}try{for(var S=XN(d),_=S.next();!_.done;_=S.next()){var w;for(p=(w=_.value).parent;p&&!d.has(p);)d.add(p),p=p.parent}}catch(e){c={error:e}}finally{try{_&&!_.done&&(u=S.return)&&u.call(S)}finally{if(c)throw c.error}}return d}function VP(e,t){var r=t.get(e);if(!r)return{};if("compound"===e.type){var n=r[0];if(!n)return{};if(UP(n))return n.key}var i={};return r.forEach((function(e){i[e.key]=VP(e,t)})),i}function GP(e){var t,r,n=new Map;try{for(var i=XN(e),o=i.next();!o.done;o=i.next()){var a=o.value;n.has(a)||n.set(a,[]),a.parent&&(n.has(a.parent)||n.set(a.parent,[]),n.get(a.parent).push(a))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n}function WP(e,t){return VP(e,GP(qP([e],t)))}function zP(e,t){return Array.isArray(e)?e.some((function(e){return e===t})):e instanceof Set&&e.has(t)}function HP(e,t){return"compound"===t.type?jP(t).some((function(t){return"final"===t.type&&zP(e,t)})):"parallel"===t.type&&jP(t).every((function(t){return HP(e,t)}))}function KP(e){return new Set(pP(e.map((function(e){return e.tags}))))}var $P=IP.Start,JP=IP.Stop,YP=IP.Raise,QP=IP.Send,XP=IP.Cancel,ZP=IP.NullEvent,eD=IP.Assign,tD=(IP.After,IP.DoneState,IP.Log),rD=IP.Init,nD=IP.Invoke,iD=(IP.ErrorExecution,IP.ErrorPlatform),oD=IP.ErrorCustom,aD=IP.Update,sD=IP.Choose,cD=IP.Pure,uD=LP({type:rD});function lD(e,t){return t&&t[e]||void 0}function dD(e,t){var r;if(CP(e)||"number"==typeof e)r=RP(n=lD(e,t))?{type:e,exec:n}:n||{type:e,exec:void 0};else if(RP(e))r={type:e.name||e.toString(),exec:e};else{var n;if(RP(n=lD(e.type,t)))r=YN(YN({},e),{exec:n});else if(n){var i=n.type||e.type;r=YN(YN(YN({},n),e),{type:i})}else r=e}return r}var fD=function(e,t){return e?(wP(e)?e:[e]).map((function(e){return dD(e,t)})):[]};function hD(e){var t=dD(e);return YN(YN({id:CP(e)?e:t.id},t),{type:t.type})}function pD(e){return CP(e)?{type:YP,event:e}:vD(e,{to:AP.Internal})}function vD(e,t){return{to:t?t.to:void 0,type:QP,event:RP(e)?e:OP(e),delay:t?t.delay:void 0,id:t&&void 0!==t.id?t.id:RP(e)?e.name:aP(e)}}function mD(e,t){var r="".concat(IP.DoneState,".").concat(e),n={type:r,data:t,toString:function(){return r}};return n}function gD(e,t){var r="".concat(IP.DoneInvoke,".").concat(e),n={type:r,data:t,toString:function(){return r}};return n}function yD(e,t){var r="".concat(IP.ErrorPlatform,".").concat(e),n={type:r,data:t,toString:function(){return r}};return n}function bD(e,t,r,n,i,o){void 0===o&&(o=!1);var a=ZN(o?[[],i]:bP(i,(function(e){return e.type===eD})),2),s=a[0],c=a[1],u=s.length?SP(r,n,s,t):r,l=o?[r]:void 0,d=pP(c.map((function(r){var i;switch(r.type){case YP:return{type:YP,_event:LP(r.event)};case QP:var a=function(e,t,r,n){var i,o={_event:r},a=LP(RP(e.event)?e.event(t,r.data,o):e.event);if(CP(e.delay)){var s=n&&n[e.delay];i=RP(s)?s(t,r.data,o):s}else i=RP(e.delay)?e.delay(t,r.data,o):e.delay;var c=RP(e.to)?e.to(t,r.data,o):e.to;return YN(YN({},e),{to:c,_event:a,event:a.data,delay:i})}(r,u,n,e.options.delays);return iP||_P(!CP(r.delay)||"number"==typeof a.delay,"No delay reference for delay expression '".concat(r.delay,"' was found on machine '").concat(e.id,"'")),a;case tD:return function(e,t,r){return YN(YN({},e),{value:CP(e.expr)?e.expr:e.expr(t,r.data,{_event:r})})}(r,u,n);case sD:if(!(f=null===(i=r.conds.find((function(r){var i=TP(r.cond,e.options.guards);return!i||NP(e,i,u,n,t)})))||void 0===i?void 0:i.actions))return[];var s=ZN(bD(e,t,u,n,fD(mP(f),e.options.actions),o),2),c=s[0],d=s[1];return u=d,null==l||l.push(u),c;case cD:var f;if(!(f=r.get(u,n.data)))return[];var h=ZN(bD(e,t,u,n,fD(mP(f),e.options.actions),o),2),p=h[0],v=h[1];return u=v,null==l||l.push(u),p;case JP:return function(e,t,r){var n=RP(e.activity)?e.activity(t,r.data):e.activity,i="string"==typeof n?{id:n}:n;return{type:IP.Stop,activity:i}}(r,u,n);case eD:u=SP(u,n,[r],t),null==l||l.push(u);break;default:var m=dD(r,e.options.actions),g=m.exec;if(g&&l){var y=l.length-1;m=YN(YN({},m),{exec:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];g.apply(void 0,eP([l[y]],ZN(t),!1))}})}return m}})).filter((function(e){return!!e})));return[d,u]}function ED(e,t){if(e===t)return!0;if(void 0===e||void 0===t)return!1;if(CP(e)||CP(t))return e===t;var r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every((function(r){return ED(e[r],t[r])}))}function SD(e){return"object"==typeof e&&null!==e&&("value"in e&&"_event"in e)}var _D=function(){function e(e){var t,r,n=this;this.actions=[],this.activities=rP,this.meta={},this.events=[],this.value=e.value,this.context=e.context,this._event=e._event,this._sessionid=e._sessionid,this.event=this._event.data,this.historyValue=e.historyValue,this.history=e.history,this.actions=e.actions||[],this.activities=e.activities||rP,this.meta=(void 0===(r=e.configuration)&&(r=[]),r.reduce((function(e,t){return void 0!==t.meta&&(e[t.id]=t.meta),e}),{})),this.events=e.events||[],this.matches=this.matches.bind(this),this.toStrings=this.toStrings.bind(this),this.configuration=e.configuration,this.transitions=e.transitions,this.children=e.children,this.done=!!e.done,this.tags=null!==(t=Array.isArray(e.tags)?new Set(e.tags):e.tags)&&void 0!==t?t:new Set,this.machine=e.machine,Object.defineProperty(this,"nextEvents",{get:function(){return function(e){return eP([],ZN(new Set(pP(eP([],ZN(e.map((function(e){return e.ownEvents}))),!1)))),!1)}(n.configuration)}})}return e.from=function(t,r){return t instanceof e?t.context!==r?new e({value:t.value,context:r,_event:t._event,_sessionid:null,historyValue:t.historyValue,history:t.history,actions:[],activities:t.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):t:new e({value:t,context:r,_event:uD,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},e.create=function(t){return new e(t)},e.inert=function(t,r){if(t instanceof e){if(!t.actions.length)return t;var n=uD;return new e({value:t.value,context:r,_event:n,_sessionid:null,historyValue:t.historyValue,history:t.history,activities:t.activities,configuration:t.configuration,transitions:[],children:{}})}return e.from(t,r)},e.prototype.toStrings=function(e,t){var r=this;if(void 0===e&&(e=this.value),void 0===t&&(t="."),CP(e))return[e];var n=Object.keys(e);return n.concat.apply(n,eP([],ZN(n.map((function(n){return r.toStrings(e[n],t).map((function(e){return n+t+e}))}))),!1))},e.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var t=e.tags;e.machine;var r=QN(e,["configuration","transitions","tags","machine"]);return YN(YN({},r),{tags:Array.from(t)})},e.prototype.matches=function(e){return oP(e,this.value)},e.prototype.hasTag=function(e){return this.tags.has(e)},e.prototype.can=function(e){var t;iP&&_P(!!this.machine,"state.can(...) used outside of a machine-created State object; this will always return false.");var r=null===(t=this.machine)||void 0===t?void 0:t.getTransitionData(this,e);return!!(null==r?void 0:r.transitions.length)&&r.transitions.some((function(e){return void 0!==e.target||e.actions.length}))},e}(),wD=[],RD=function(e,t){wD.push(e);var r=t(e);return wD.pop(),r};function CD(e){var t;return(t={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:e}}})[xP]=function(){return this},t}function TD(e,t,r,n){var i,o=PP(e.src),a=null===(i=null==t?void 0:t.options.services)||void 0===i?void 0:i[o.type],s=e.data?gP(e.data,r,n):void 0,c=a?function(e,t,r){var n=CD(t);if(n.deferred=!0,kP(e)){var i=n.state=RD(void 0,(function(){return(r?e.withContext(r):e).initialState}));n.getSnapshot=function(){return i}}return n}(a,e.id,s):CD(e.id);return c.meta=e,c}function xD(e){if("string"==typeof e){var t={type:e,toString:function(){return e}};return t}return e}function kD(e){return YN(YN({type:nD},e),{toJSON:function(){e.onDone,e.onError;var t=QN(e,["onDone","onError"]);return YN(YN({},t),{type:nD,src:xD(e.src)})}})}var ID="",AD="*",OD={},LD=function(e){return"#"===e[0]},MD=function(){function e(t,r,n,i){var o,a=this;void 0===n&&(n="context"in t?t.context:void 0),this.config=t,this._context=n,this.order=-1,this.__xstatenode=!0,this.__cache={events:void 0,relativeValue:new Map,initialStateValue:void 0,initialState:void 0,on:void 0,transitions:void 0,candidates:{},delayedTransitions:void 0},this.idMap={},this.tags=[],this.options=Object.assign({actions:{},guards:{},services:{},activities:{},delays:{}},r),this.parent=null==i?void 0:i.parent,this.key=this.config.key||(null==i?void 0:i.key)||this.config.id||"(machine)",this.machine=this.parent?this.parent.machine:this,this.path=this.parent?this.parent.path.concat(this.key):[],this.delimiter=this.config.delimiter||(this.parent?this.parent.delimiter:"."),this.id=this.config.id||eP([this.machine.key],ZN(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:null!==(o=this.config.schema)&&void 0!==o?o:{},this.description=this.config.description,iP||_P(!("parallel"in this.config),'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel?"Replace with `type: 'parallel'`":"Use `type: '".concat(this.type,"'`")," in the config for state node '").concat(this.id,"' instead.")),this.initial=this.config.initial,this.states=this.config.states?lP(this.config.states,(function(t,r){var n,i=new e(t,{},void 0,{parent:a,key:r});return Object.assign(a.idMap,YN(((n={})[i.id]=i,n),i.idMap)),i})):OD;var s=0;!function e(t){var r,n;t.order=s++;try{for(var i=XN(jP(t)),o=i.next();!o.done;o=i.next()){e(o.value)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}(this),this.history=!0===this.config.history?"shallow":this.config.history||!1,this._transient=!!this.config.always||!!this.config.on&&(Array.isArray(this.config.on)?this.config.on.some((function(e){return e.event===ID})):ID in this.config.on),this.strict=!!this.config.strict,this.onEntry=mP(this.config.entry||this.config.onEntry).map((function(e){return dD(e)})),this.onExit=mP(this.config.exit||this.config.onExit).map((function(e){return dD(e)})),this.meta=this.config.meta,this.doneData="final"===this.type?this.config.data:void 0,this.invoke=mP(this.config.invoke).map((function(e,t){var r,n;if(kP(e)){var i=FP(a.id,t);return a.machine.options.services=YN(((r={})[i]=e,r),a.machine.options.services),kD({src:i,id:i})}if(CP(e.src)){i=e.id||FP(a.id,t);return kD(YN(YN({},e),{id:i,src:e.src}))}if(kP(e.src)||RP(e.src)){i=e.id||FP(a.id,t);return a.machine.options.services=YN(((n={})[i]=e.src,n),a.machine.options.services),kD(YN(YN({id:i},e),{src:i}))}var o=e.src;return kD(YN(YN({id:FP(a.id,t)},e),{src:o}))})),this.activities=mP(this.config.activities).concat(this.invoke).map((function(e){return hD(e)})),this.transition=this.transition.bind(this),this.tags=mP(this.config.tags)}return e.prototype._init=function(){this.__cache.transitions||BP(this).forEach((function(e){return e.on}))},e.prototype.withConfig=function(t,r){var n=this.options,i=n.actions,o=n.activities,a=n.guards,s=n.services,c=n.delays;return new e(this.config,{actions:YN(YN({},i),t.actions),activities:YN(YN({},o),t.activities),guards:YN(YN({},a),t.guards),services:YN(YN({},s),t.services),delays:YN(YN({},c),t.delays)},null!=r?r:this.context)},e.prototype.withContext=function(t){return new e(this.config,this.options,t)},Object.defineProperty(e.prototype,"context",{get:function(){return RP(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"definition",{get:function(){return{id:this.id,key:this.key,version:this.version,context:this.context,type:this.type,initial:this.initial,history:this.history,states:lP(this.states,(function(e){return e.definition})),on:this.on,transitions:this.transitions,entry:this.onEntry,exit:this.onExit,activities:this.activities||[],meta:this.meta,order:this.order||-1,data:this.doneData,invoke:this.invoke,description:this.description,tags:this.tags}},enumerable:!1,configurable:!0}),e.prototype.toJSON=function(){return this.definition},Object.defineProperty(e.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var e=this.transitions;return this.__cache.on=e.reduce((function(e,t){return e[t.eventType]=e[t.eventType]||[],e[t.eventType].push(t),e}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),e.prototype.getCandidates=function(e){if(this.__cache.candidates[e])return this.__cache.candidates[e];var t=e===ID,r=this.transitions.filter((function(r){var n=r.eventType===e;return t?n:n||r.eventType===AD}));return this.__cache.candidates[e]=r,r},e.prototype.getDelayedTransitions=function(){var e=this,t=this.config.after;if(!t)return[];var r=function(t,r){var n=function(e,t){var r=t?"#".concat(t):"";return"".concat(IP.After,"(").concat(e,")").concat(r)}(RP(t)?"".concat(e.id,":delay[").concat(r,"]"):t,e.id);return e.onEntry.push(vD(n,{delay:t})),e.onExit.push({type:XP,sendId:n}),n},n=wP(t)?t.map((function(e,t){var n=r(e.delay,t);return YN(YN({},e),{event:n})})):pP(Object.keys(t).map((function(e,n){var i=t[e],o=CP(i)?{target:i}:i,a=isNaN(+e)?e:+e,s=r(a,n);return mP(o).map((function(e){return YN(YN({},e),{event:s,delay:a})}))})));return n.map((function(t){var r=t.delay;return YN(YN({},e.formatTransition(t)),{delay:r})}))},e.prototype.getStateNodes=function(e){var t,r=this;if(!e)return[];var n=e instanceof _D?e.value:cP(e,this.delimiter);if(CP(n)){var i=this.getStateNode(n).initial;return void 0!==i?this.getStateNodes(((t={})[n]=i,t)):[this,this.states[n]]}var o=Object.keys(n),a=[this];return a.push.apply(a,eP([],ZN(pP(o.map((function(e){return r.getStateNode(e).getStateNodes(n[e])})))),!1)),a},e.prototype.handles=function(e){var t=aP(e);return this.events.includes(t)},e.prototype.resolveState=function(e){var t=e instanceof _D?e:_D.create(e),r=Array.from(qP([],this.getStateNodes(t.value)));return new _D(YN(YN({},t),{value:this.resolve(t.value),configuration:r,done:HP(r,this),tags:KP(r),machine:this.machine}))},e.prototype.transitionLeafNode=function(e,t,r){var n=this.getStateNode(e).next(t,r);return n&&n.transitions.length?n:this.next(t,r)},e.prototype.transitionCompoundNode=function(e,t,r){var n=Object.keys(e),i=this.getStateNode(n[0])._transition(e[n[0]],t,r);return i&&i.transitions.length?i:this.next(t,r)},e.prototype.transitionParallelNode=function(e,t,r){var n,i,o={};try{for(var a=XN(Object.keys(e)),s=a.next();!s.done;s=a.next()){var c=s.value,u=e[c];if(u){var l=this.getStateNode(c)._transition(u,t,r);l&&(o[c]=l)}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}var d=Object.keys(o).map((function(e){return o[e]})),f=pP(d.map((function(e){return e.transitions})));if(!d.some((function(e){return e.transitions.length>0})))return this.next(t,r);var h=pP(d.map((function(e){return e.entrySet}))),p=pP(Object.keys(o).map((function(e){return o[e].configuration})));return{transitions:f,entrySet:h,exitSet:pP(d.map((function(e){return e.exitSet}))),configuration:p,source:t,actions:pP(Object.keys(o).map((function(e){return o[e].actions})))}},e.prototype._transition=function(e,t,r){return CP(e)?this.transitionLeafNode(e,t,r):1===Object.keys(e).length?this.transitionCompoundNode(e,t,r):this.transitionParallelNode(e,t,r)},e.prototype.getTransitionData=function(e,t){return this._transition(e.value,e,LP(t))},e.prototype.next=function(e,t){var r,n,i,o=this,a=t.name,s=[],c=[];try{for(var u=XN(this.getCandidates(a)),l=u.next();!l.done;l=u.next()){var d=l.value,f=d.cond,h=d.in,p=e.context,v=!h||(CP(h)&&LD(h)?e.matches(cP(this.getStateNodeById(h).path,this.delimiter)):oP(cP(h,this.delimiter),fP(this.path.slice(0,-2))(e.value))),m=!1;try{m=!f||NP(this.machine,f,p,t,e)}catch(e){throw new Error("Unable to evaluate guard '".concat(f.name||f.type,"' in transition for event '").concat(a,"' in state node '").concat(this.id,"':\n").concat(e.message))}if(m&&v){void 0!==d.target&&(c=d.target),s.push.apply(s,eP([],ZN(d.actions),!1)),i=d;break}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}if(i){if(!c.length)return{transitions:[i],entrySet:[],exitSet:[],configuration:e.value?[this]:[],source:e,actions:s};var g=pP(c.map((function(t){return o.getRelativeStateNodes(t,e.historyValue)}))),y=!!i.internal,b=y?[]:pP(g.map((function(e){return o.nodesFromChild(e)})));return{transitions:[i],entrySet:b,exitSet:y?[]:[this],configuration:g,source:e,actions:s}}},e.prototype.nodesFromChild=function(e){if(e.escapes(this))return[];for(var t=[],r=e;r&&r!==this;)t.push(r),r=r.parent;return t.push(this),t},e.prototype.escapes=function(e){if(this===e)return!1;for(var t=this.parent;t;){if(t===e)return!1;t=t.parent}return!0},e.prototype.getActions=function(e,t,r,n){var i,o,a,s,c=qP([],n?this.getStateNodes(n.value):[this]),u=e.configuration.length?qP(c,e.configuration):c;try{for(var l=XN(u),d=l.next();!d.done;d=l.next()){zP(c,p=d.value)||e.entrySet.push(p)}}catch(e){i={error:e}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}try{for(var f=XN(c),h=f.next();!h.done;h=f.next()){var p;zP(u,p=h.value)&&!zP(e.exitSet,p.parent)||e.exitSet.push(p)}}catch(e){a={error:e}}finally{try{h&&!h.done&&(s=f.return)&&s.call(f)}finally{if(a)throw a.error}}var v=pP(e.entrySet.map((function(n){var i=[];if("final"!==n.type)return i;var o=n.parent;if(!o.parent)return i;i.push(mD(n.id,n.doneData),mD(o.id,n.doneData?gP(n.doneData,t,r):void 0));var a=o.parent;return"parallel"===a.type&&jP(a).every((function(t){return HP(e.configuration,t)}))&&i.push(mD(a.id)),i})));e.exitSet.sort((function(e,t){return t.order-e.order})),e.entrySet.sort((function(e,t){return e.order-t.order}));var m=new Set(e.entrySet),g=new Set(e.exitSet),y=ZN([pP(Array.from(m).map((function(e){return eP(eP([],ZN(e.activities.map((function(e){return function(e){var t=hD(e);return{type:IP.Start,activity:t,exec:void 0}}(e)}))),!1),ZN(e.onEntry),!1)}))).concat(v.map(pD)),pP(Array.from(g).map((function(e){return eP(eP([],ZN(e.onExit),!1),ZN(e.activities.map((function(e){return function(e){var t=RP(e)?e:hD(e);return{type:IP.Stop,activity:t,exec:void 0}}(e)}))),!1)})))],2),b=y[0],E=y[1];return fD(E.concat(e.actions).concat(b),this.machine.options.actions)},e.prototype.transition=function(e,t,r){void 0===e&&(e=this.initialState);var n,i,o=LP(t);if(e instanceof _D)n=void 0===r?e:this.resolveState(_D.from(e,r));else{var a=CP(e)?this.resolve(uP(this.getResolvedPath(e))):this.resolve(e),s=null!=r?r:this.machine.context;n=this.resolveState(_D.from(a,s))}if(!iP&&o.name===AD)throw new Error("An event cannot have the wildcard type ('".concat(AD,"')"));if(this.strict&&!this.events.includes(o.name)&&(i=o.name,!/^(done|error)\./.test(i)))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(o.name,"'"));var c=this._transition(n.value,n,o)||{transitions:[],configuration:[],entrySet:[],exitSet:[],source:n,actions:[]},u=qP([],this.getStateNodes(n.value)),l=c.configuration.length?qP(u,c.configuration):u;return c.configuration=eP([],ZN(l),!1),this.resolveTransition(c,n,n.context,o)},e.prototype.resolveRaisedTransition=function(e,t,r){var n,i=e.actions;return(e=this.transition(e,t))._event=r,e.event=r.data,(n=e.actions).unshift.apply(n,eP([],ZN(i),!1)),e},e.prototype.resolveTransition=function(e,t,r,n){var i,o,a=this;void 0===n&&(n=uD);var s=e.configuration,c=!t||e.transitions.length>0,u=c?WP(this.machine,s):void 0,l=t?t.historyValue?t.historyValue:e.source?this.machine.historyValue(t.value):void 0:void 0,d=this.getActions(e,r,n,t),f=t?YN({},t.activities):{};try{for(var h=XN(d),p=h.next();!p.done;p=h.next()){var v=p.value;v.type===$P?f[v.activity.id||v.activity.type]=v:v.type===JP&&(f[v.activity.id||v.activity.type]=!1)}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}var m,g,y=ZN(bD(this,t,r,n,d,this.machine.config.preserveActionOrder),2),b=y[0],E=y[1],S=ZN(bP(b,(function(e){return e.type===YP||e.type===QP&&e.to===AP.Internal})),2),_=S[0],w=S[1],R=b.filter((function(e){var t;return e.type===$P&&(null===(t=e.activity)||void 0===t?void 0:t.type)===nD})),C=R.reduce((function(e,t){return e[t.activity.id]=TD(t.activity,a.machine,E,n),e}),t?YN({},t.children):{}),T=c?e.configuration:t?t.configuration:[],x=HP(T,this),k=new _D({value:u||t.value,context:E,_event:n,_sessionid:t?t._sessionid:null,historyValue:u?l?(m=l,g=u,{current:g,states:EP(m,g)}):void 0:t?t.historyValue:void 0,history:!u||e.source?t:void 0,actions:u?w:[],activities:u?f:t?t.activities:{},events:[],configuration:T,transitions:e.transitions,children:C,done:x,tags:null==t?void 0:t.tags,machine:this}),I=r!==E;k.changed=n.name===aD||I;var A=k.history;A&&delete A.history;var O=!x&&(this._transient||s.some((function(e){return e._transient})));if(!(c||O&&n.name!==ID))return k;var L=k;if(!x)for(O&&(L=this.resolveRaisedTransition(L,{type:ZP},n));_.length;){var M=_.shift();L=this.resolveRaisedTransition(L,M._event,n)}var N=L.changed||(A?!!L.actions.length||I||typeof A.value!=typeof L.value||!ED(L.value,A.value):void 0);return L.changed=N,L.history=A,L.tags=KP(L.configuration),L},e.prototype.getStateNode=function(e){if(LD(e))return this.machine.getStateNodeById(e);if(!this.states)throw new Error("Unable to retrieve child state '".concat(e,"' from '").concat(this.id,"'; no child states exist."));var t=this.states[e];if(!t)throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"));return t},e.prototype.getStateNodeById=function(e){var t=LD(e)?e.slice(1):e;if(t===this.id)return this;var r=this.machine.idMap[t];if(!r)throw new Error("Child state node '#".concat(t,"' does not exist on machine '").concat(this.id,"'"));return r},e.prototype.getStateNodeByPath=function(e){if("string"==typeof e&&LD(e))try{return this.getStateNodeById(e.slice(1))}catch(e){}for(var t=sP(e,this.delimiter).slice(),r=this;t.length;){var n=t.shift();if(!n.length)break;r=r.getStateNode(n)}return r},e.prototype.resolve=function(e){var t,r=this;if(!e)return this.initialStateValue||OD;switch(this.type){case"parallel":return lP(this.initialStateValue,(function(t,n){return t?r.getStateNode(n).resolve(e[n]||t):OD}));case"compound":if(CP(e)){var n=this.getStateNode(e);return"parallel"===n.type||"compound"===n.type?((t={})[e]=n.initialStateValue,t):e}return Object.keys(e).length?lP(e,(function(e,t){return e?r.getStateNode(t).resolve(e):OD})):this.initialStateValue||{};default:return e||OD}},e.prototype.getResolvedPath=function(e){if(LD(e)){var t=this.machine.idMap[e.slice(1)];if(!t)throw new Error("Unable to find state node '".concat(e,"'"));return t.path}return sP(e,this.delimiter)},Object.defineProperty(e.prototype,"initialStateValue",{get:function(){var e,t;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;if("parallel"===this.type)t=dP(this.states,(function(e){return e.initialStateValue||OD}),(function(e){return!("history"===e.type)}));else if(void 0!==this.initial){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));t=UP(this.states[this.initial])?this.initial:((e={})[this.initial]=this.states[this.initial].initialStateValue,e)}else t={};return this.__cache.initialStateValue=t,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),e.prototype.getInitialState=function(e,t){this._init();var r=this.getStateNodes(e);return this.resolveTransition({configuration:r,entrySet:r,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,null!=t?t:this.machine.context,void 0)},Object.defineProperty(e.prototype,"initialState",{get:function(){var e=this.initialStateValue;if(!e)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){var e;if("history"===this.type){var t=this.config;e=CP(t.target)&&LD(t.target)?uP(this.machine.getStateNodeById(t.target).path.slice(this.path.length-1)):t.target}return e},enumerable:!1,configurable:!0}),e.prototype.getRelativeStateNodes=function(e,t,r){return void 0===r&&(r=!0),r?"history"===e.type?e.resolveHistory(t):e.initialStateNodes:[e]},Object.defineProperty(e.prototype,"initialStateNodes",{get:function(){var e=this;return UP(this)?[this]:"compound"!==this.type||this.initial?pP(hP(this.initialStateValue).map((function(t){return e.getFromRelativePath(t)}))):(iP||_P(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this])},enumerable:!1,configurable:!0}),e.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var t=ZN(e),r=t[0],n=t.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(r,"' from node with no states"));var i=this.getStateNode(r);if("history"===i.type)return i.resolveHistory();if(!this.states[r])throw new Error("Child state '".concat(r,"' does not exist on '").concat(this.id,"'"));return this.states[r].getFromRelativePath(n)},e.prototype.historyValue=function(e){if(Object.keys(this.states).length)return{current:e||this.initialStateValue,states:dP(this.states,(function(t,r){if(!e)return t.historyValue();var n=CP(e)?void 0:e[r];return t.historyValue(n||t.initialStateValue)}),(function(e){return!e.history}))}},e.prototype.resolveHistory=function(e){var t=this;if("history"!==this.type)return[this];var r=this.parent;if(!e){var n=this.target;return n?pP(hP(n).map((function(e){return r.getFromRelativePath(e)}))):r.initialStateNodes}var i,o,a=(i=r.path,o="states",function(e){var t,r,n=e;try{for(var a=XN(i),s=a.next();!s.done;s=a.next()){var c=s.value;n=n[o][c]}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return n})(e).current;return CP(a)?[r.getStateNode(a)]:pP(hP(a).map((function(e){return"deep"===t.history?r.getFromRelativePath(e):[r.states[e[0]]]})))},Object.defineProperty(e.prototype,"stateIds",{get:function(){var e=this,t=pP(Object.keys(this.states).map((function(t){return e.states[t].stateIds})));return[this.id].concat(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"events",{get:function(){var e,t,r,n;if(this.__cache.events)return this.__cache.events;var i=this.states,o=new Set(this.ownEvents);if(i)try{for(var a=XN(Object.keys(i)),s=a.next();!s.done;s=a.next()){var c=i[s.value];if(c.states)try{for(var u=(r=void 0,XN(c.events)),l=u.next();!l.done;l=u.next()){var d=l.value;o.add("".concat(d))}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(o)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ownEvents",{get:function(){var e=new Set(this.transitions.filter((function(e){return!(!e.target&&!e.actions.length&&e.internal)})).map((function(e){return e.eventType})));return Array.from(e)},enumerable:!1,configurable:!0}),e.prototype.resolveTarget=function(e){var t=this;if(void 0!==e)return e.map((function(e){if(!CP(e))return e;var r=e[0]===t.delimiter;if(r&&!t.parent)return t.getStateNodeByPath(e.slice(1));var n=r?t.key+e:e;if(!t.parent)return t.getStateNodeByPath(n);try{return t.parent.getStateNodeByPath(n)}catch(e){throw new Error("Invalid transition definition for state node '".concat(t.id,"':\n").concat(e.message))}}))},e.prototype.formatTransition=function(e){var t=this,r=function(e){if(void 0!==e&&""!==e)return mP(e)}(e.target),n="internal"in e?e.internal:!r||r.some((function(e){return CP(e)&&e[0]===t.delimiter})),i=this.machine.options.guards,o=this.resolveTarget(r),a=YN(YN({},e),{actions:fD(mP(e.actions)),cond:TP(e.cond,i),target:o,source:this,internal:n,eventType:e.event,toJSON:function(){return YN(YN({},a),{target:a.target?a.target.map((function(e){return"#".concat(e.id)})):void 0,source:"#".concat(t.id)})}});return a},e.prototype.formatTransitions=function(){var e,t,r,n=this;if(this.config.on)if(Array.isArray(this.config.on))r=this.config.on;else{var i=this.config.on,o=AD,a=i[o],s=void 0===a?[]:a,c=QN(i,["*"]);r=pP(Object.keys(c).map((function(e){iP||e!==ID||_P(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(n.id,'".'));var t=MP(e,c[e]);return iP||function(e,t,r){var n=r.slice(0,-1).some((function(e){return!("cond"in e)&&!("in"in e)&&(CP(e.target)||kP(e.target))})),i=t===ID?"the transient event":"event '".concat(t,"'");_P(!n,"One or more transitions for ".concat(i," on state '").concat(e.id,"' are unreachable. ")+"Make sure that the default transition is the last one defined.")}(n,e,t),t})).concat(MP(AD,s)))}else r=[];var u=this.config.always?MP("",this.config.always):[],l=this.config.onDone?MP(String(mD(this.id)),this.config.onDone):[];iP||_P(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var d=pP(this.invoke.map((function(e){var t=[];return e.onDone&&t.push.apply(t,eP([],ZN(MP(String(gD(e.id)),e.onDone)),!1)),e.onError&&t.push.apply(t,eP([],ZN(MP(String(yD(e.id)),e.onError)),!1)),t}))),f=this.after,h=pP(eP(eP(eP(eP([],ZN(l),!1),ZN(d),!1),ZN(r),!1),ZN(u),!1).map((function(e){return mP(e).map((function(e){return n.formatTransition(e)}))})));try{for(var p=XN(f),v=p.next();!v.done;v=p.next()){var m=v.value;h.push(m)}}catch(t){e={error:t}}finally{try{v&&!v.done&&(t=p.return)&&t.call(p)}finally{if(e)throw e.error}}return h},e}();function ND(e,t){return new MD(e,t)}var PD={deferEvents:!1},DD=function(){function e(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=YN(YN({},PD),e)}return e.prototype.initialize=function(e){if(this.initialized=!0,e){if(!this.options.deferEvents)return void this.schedule(e);this.process(e)}this.flushEvents()},e.prototype.schedule=function(e){if(this.initialized&&!this.processingEvent){if(0!==this.queue.length)throw new Error("Event queue should be empty when it is not processing events");this.process(e),this.flushEvents()}else this.queue.push(e)},e.prototype.clear=function(){this.queue=[]},e.prototype.flushEvents=function(){for(var e=this.queue.shift();e;)this.process(e),e=this.queue.shift()},e.prototype.process=function(e){this.processingEvent=!0;try{e()}catch(e){throw this.clear(),e}finally{this.processingEvent=!1}},e}(),FD=new Map,UD=0,jD=function(){return"x:".concat(UD++)},BD=function(e,t){return FD.set(e,t),e},qD=function(e){return FD.get(e)},VD=function(e){FD.delete(e)};function GD(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==__webpack_require__.g?__webpack_require__.g:void(iP||console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues"))}function WD(e){if(GD()){var t=function(){var e=GD();if(e&&"__xstate__"in e)return e.__xstate__}();t&&t.register(e)}}function zD(e,t){void 0===t&&(t={});var r=e.initialState,n=new Set,i=[],o=!1,a=function(e){var t;return YN(((t={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}})[xP]=function(){return this},t),e)}({id:t.id,send:function(t){i.push(t),function(){if(!o){for(o=!0;i.length>0;){var t=i.shift();r=e.transition(r,t,s),n.forEach((function(e){return e.next(r)}))}o=!1}}()},getSnapshot:function(){return r},subscribe:function(e,t,i){var o=DP(e,t,i);return n.add(o),o.next(r),{unsubscribe:function(){n.delete(o)}}}}),s={parent:t.parent,self:a,id:t.id||"anonymous",observers:n};return r=e.start?e.start(s):r,a}var HD,KD={sync:!1,autoForward:!1};!function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(HD||(HD={}));var $D,JD=function(){function e(t,r){var n=this;void 0===r&&(r=e.defaultOptions),this.machine=t,this.scheduler=new DD,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=HD.NotStarted,this.children=new Map,this.forwardTo=new Set,this.init=this.start,this.send=function(e,t){if(wP(e))return n.batch(e),n.state;var r=LP(OP(e,t));if(n.status===HD.Stopped)return iP||_P(!1,'Event "'.concat(r.name,'" was sent to stopped service "').concat(n.machine.id,'". This service has already reached its final state, and will not transition.\nEvent: ').concat(JSON.stringify(r.data))),n.state;if(n.status!==HD.Running&&!n.options.deferEvents)throw new Error('Event "'.concat(r.name,'" was sent to uninitialized service "').concat(n.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.\nEvent: ').concat(JSON.stringify(r.data)));return n.scheduler.schedule((function(){n.forward(r);var e=n.nextState(r);n.update(e,r)})),n._state},this.sendTo=function(e,t){var r,i=n.parent&&(t===AP.Parent||n.parent.id===t),o=i?n.parent:CP(t)?n.children.get(t)||qD(t):(r=t)&&"function"==typeof r.send?t:void 0;if(o)"machine"in o?o.send(YN(YN({},e),{name:e.name===oD?"".concat(yD(n.id)):e.name,origin:n.sessionId})):o.send(e.data);else{if(!i)throw new Error("Unable to send event to child '".concat(t,"' from service '").concat(n.id,"'."));iP||_P(!1,"Service '".concat(n.id,"' has no parent: unable to send event ").concat(e.type))}};var i=YN(YN({},e.defaultOptions),r),o=i.clock,a=i.logger,s=i.parent,c=i.id,u=void 0!==c?c:t.id;this.id=u,this.logger=a,this.clock=o,this.parent=s,this.options=i,this.scheduler=new DD({deferEvents:this.options.deferEvents}),this.sessionId=jD()}return Object.defineProperty(e.prototype,"initialState",{get:function(){var e=this;return this._initialState?this._initialState:RD(this,(function(){return e._initialState=e.machine.initialState,e._initialState}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return iP||_P(this.status!==HD.NotStarted,"Attempted to read state from uninitialized service '".concat(this.id,"'. Make sure the service is started first.")),this._state},enumerable:!1,configurable:!0}),e.prototype.execute=function(e,t){var r,n;try{for(var i=XN(e.actions),o=i.next();!o.done;o=i.next()){var a=o.value;this.exec(a,e,t)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},e.prototype.update=function(e,t){var r,n,i,o,a,s,c,u,l=this;if(e._sessionid=this.sessionId,this._state=e,this.options.execute&&this.execute(this.state),this.children.forEach((function(e){l.state.children[e.id]=e})),this.devTools&&this.devTools.send(t.data,e),e.event)try{for(var d=XN(this.eventListeners),f=d.next();!f.done;f=d.next()){(0,f.value)(e.event)}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}try{for(var h=XN(this.listeners),p=h.next();!p.done;p=h.next()){(0,p.value)(e,e.event)}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}try{for(var v=XN(this.contextListeners),m=v.next();!m.done;m=v.next()){(0,m.value)(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(e){a={error:e}}finally{try{m&&!m.done&&(s=v.return)&&s.call(v)}finally{if(a)throw a.error}}var g=HP(e.configuration||[],this.machine);if(this.state.configuration&&g){var y=e.configuration.find((function(e){return"final"===e.type&&e.parent===l.machine})),b=y&&y.doneData?gP(y.doneData,e.context,t):void 0;try{for(var E=XN(this.doneListeners),S=E.next();!S.done;S=E.next()){(0,S.value)(gD(this.id,b))}}catch(e){c={error:e}}finally{try{S&&!S.done&&(u=E.return)&&u.call(E)}finally{if(c)throw c.error}}this.stop()}},e.prototype.onTransition=function(e){return this.listeners.add(e),this.status===HD.Running&&e(this.state,this.state.event),this},e.prototype.subscribe=function(e,t,r){var n,i=this;if(!e)return{unsubscribe:function(){}};var o=r;return"function"==typeof e?n=e:(n=e.next.bind(e),o=e.complete.bind(e)),this.listeners.add(n),this.status===HD.Running&&n(this.state),o&&this.onDone(o),{unsubscribe:function(){n&&i.listeners.delete(n),o&&i.doneListeners.delete(o)}}},e.prototype.onEvent=function(e){return this.eventListeners.add(e),this},e.prototype.onSend=function(e){return this.sendListeners.add(e),this},e.prototype.onChange=function(e){return this.contextListeners.add(e),this},e.prototype.onStop=function(e){return this.stopListeners.add(e),this},e.prototype.onDone=function(e){return this.doneListeners.add(e),this},e.prototype.off=function(e){return this.listeners.delete(e),this.eventListeners.delete(e),this.sendListeners.delete(e),this.stopListeners.delete(e),this.doneListeners.delete(e),this.contextListeners.delete(e),this},e.prototype.start=function(e){var t=this;if(this.status===HD.Running)return this;this.machine._init(),BD(this.sessionId,this),this.initialized=!0,this.status=HD.Running;var r=void 0===e?this.initialState:RD(this,(function(){return SD(e)?t.machine.resolveState(e):t.machine.resolveState(_D.from(e,t.machine.context))}));return this.options.devTools&&this.attachDev(),this.scheduler.initialize((function(){t.update(r,uD)})),this},e.prototype.stop=function(){var e,t,r,n,i,o,a,s,c,u,l=this;try{for(var d=XN(this.listeners),f=d.next();!f.done;f=d.next()){var h=f.value;this.listeners.delete(h)}}catch(t){e={error:t}}finally{try{f&&!f.done&&(t=d.return)&&t.call(d)}finally{if(e)throw e.error}}try{for(var p=XN(this.stopListeners),v=p.next();!v.done;v=p.next()){(h=v.value)(),this.stopListeners.delete(h)}}catch(e){r={error:e}}finally{try{v&&!v.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}try{for(var m=XN(this.contextListeners),g=m.next();!g.done;g=m.next()){h=g.value;this.contextListeners.delete(h)}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=m.return)&&o.call(m)}finally{if(i)throw i.error}}try{for(var y=XN(this.doneListeners),b=y.next();!b.done;b=y.next()){h=b.value;this.doneListeners.delete(h)}}catch(e){a={error:e}}finally{try{b&&!b.done&&(s=y.return)&&s.call(y)}finally{if(a)throw a.error}}if(!this.initialized)return this;eP([],ZN(this.state.configuration),!1).sort((function(e,t){return t.order-e.order})).forEach((function(e){var t,r;try{for(var n=XN(e.definition.exit),i=n.next();!i.done;i=n.next()){var o=i.value;l.exec(o,l.state)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}})),this.children.forEach((function(e){RP(e.stop)&&e.stop()}));try{for(var E=XN(Object.keys(this.delayedEventsMap)),S=E.next();!S.done;S=E.next()){var _=S.value;this.clock.clearTimeout(this.delayedEventsMap[_])}}catch(e){c={error:e}}finally{try{S&&!S.done&&(u=E.return)&&u.call(E)}finally{if(c)throw c.error}}return this.scheduler.clear(),this.initialized=!1,this.status=HD.Stopped,VD(this.sessionId),this},e.prototype.batch=function(e){var t=this;if(this.status===HD.NotStarted&&this.options.deferEvents)iP||_P(!1,"".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'" and are deferred. Make sure .start() is called for this service.\nEvent: ').concat(JSON.stringify(event)));else if(this.status!==HD.Running)throw new Error("".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.'));this.scheduler.schedule((function(){var r,n,i=t.state,o=!1,a=[],s=function(e){var r=LP(e);t.forward(r),i=RD(t,(function(){return t.machine.transition(i,r)})),a.push.apply(a,eP([],ZN(i.actions.map((function(e){return r=i,n=(t=e).exec,YN(YN({},t),{exec:void 0!==n?function(){return n(r.context,r.event,{action:t,state:r,_event:r._event})}:void 0});var t,r,n}))),!1)),o=o||!!i.changed};try{for(var c=XN(e),u=c.next();!u.done;u=c.next()){s(u.value)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}i.changed=o,i.actions=a,t.update(i,LP(e[e.length-1]))}))},e.prototype.sender=function(e){return this.send.bind(this,e)},e.prototype.nextState=function(e){var t=this,r=LP(e);if(0===r.name.indexOf(iD)&&!this.state.nextEvents.some((function(e){return 0===e.indexOf(iD)})))throw r.data.data;return RD(this,(function(){return t.machine.transition(t.state,r)}))},e.prototype.forward=function(e){var t,r;try{for(var n=XN(this.forwardTo),i=n.next();!i.done;i=n.next()){var o=i.value,a=this.children.get(o);if(!a)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(o,"'."));a.send(e)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},e.prototype.defer=function(e){var t=this;this.delayedEventsMap[e.id]=this.clock.setTimeout((function(){e.to?t.sendTo(e._event,e.to):t.send(e._event)}),e.delay)},e.prototype.cancel=function(e){this.clock.clearTimeout(this.delayedEventsMap[e]),delete this.delayedEventsMap[e]},e.prototype.exec=function(e,t,r){void 0===r&&(r=this.machine.options.actions);var n=t.context,i=t._event,o=e.exec||lD(e.type,r),a=RP(o)?o:o?o.exec:e.exec;if(a)try{return a(n,i.data,{action:e,state:this.state,_event:i})}catch(e){throw this.parent&&this.parent.send({type:"xstate.error",data:e}),e}switch(e.type){case QP:var s=e;if("number"==typeof s.delay)return void this.defer(s);s.to?this.sendTo(s._event,s.to):this.send(s._event);break;case XP:this.cancel(e.sendId);break;case $P:if(this.status!==HD.Running)return;var c=e.activity;if(!this.state.activities[c.id||c.type])break;if(c.type===IP.Invoke){var u=PP(c.src),l=this.machine.options.services?this.machine.options.services[u.type]:void 0,d=c.id,f=c.data;iP||_P(!("forward"in c),"`forward` property is deprecated (found in invocation of '".concat(c.src,"' in in machine '").concat(this.machine.id,"'). ")+"Please use `autoForward` instead.");var h="autoForward"in c?c.autoForward:!!c.forward;if(!l)return void(iP||_P(!1,"No service found for invocation '".concat(c.src,"' in machine '").concat(this.machine.id,"'.")));var p=f?gP(f,n,i):void 0;if("string"==typeof l)return;var v=RP(l)?l(n,i.data,{data:p,src:u,meta:c.meta}):l;if(!v)return;var m=void 0;kP(v)&&(v=p?v.withContext(p):v,m={autoForward:h}),this.spawn(v,d,m)}else this.spawnActivity(c);break;case JP:this.stopChild(e.activity.id);break;case tD:var g=e.label,y=e.value;g?this.logger(g,y):this.logger(y);break;default:iP||_P(!1,"No implementation found for action type '".concat(e.type,"'"))}},e.prototype.removeChild=function(e){var t;this.children.delete(e),this.forwardTo.delete(e),null===(t=this.state)||void 0===t||delete t.children[e]},e.prototype.stopChild=function(e){var t=this.children.get(e);t&&(this.removeChild(e),RP(t.stop)&&t.stop())},e.prototype.spawn=function(e,t,r){if(yP(e))return this.spawnPromise(Promise.resolve(e),t);if(RP(e))return this.spawnCallback(e,t);if(function(e){try{return"function"==typeof e.send}catch(e){return!1}}(i=e)&&"id"in i)return this.spawnActor(e,t);if(function(e){try{return"subscribe"in e&&RP(e.subscribe)}catch(e){return!1}}(e))return this.spawnObservable(e,t);if(kP(e))return this.spawnMachine(e,YN(YN({},r),{id:t}));if(null!==(n=e)&&"object"==typeof n&&"transition"in n&&"function"==typeof n.transition)return this.spawnBehavior(e,t);throw new Error('Unable to spawn entity "'.concat(t,'" of type "').concat(typeof e,'".'));var n,i},e.prototype.spawnMachine=function(t,r){var n=this;void 0===r&&(r={});var i=new e(t,YN(YN({},this.options),{parent:this,id:r.id||t.id})),o=YN(YN({},KD),r);o.sync&&i.onTransition((function(e){n.send(aD,{state:e,id:i.id})}));var a=i;return this.children.set(i.id,a),o.autoForward&&this.forwardTo.add(i.id),i.onDone((function(e){n.removeChild(i.id),n.send(LP(e,{origin:i.id}))})).start(),a},e.prototype.spawnBehavior=function(e,t){var r=zD(e,{id:t,parent:this});return this.children.set(t,r),r},e.prototype.spawnPromise=function(e,t){var r,n,i=this,o=!1;e.then((function(e){o||(n=e,i.removeChild(t),i.send(LP(gD(t,e),{origin:t})))}),(function(e){if(!o){i.removeChild(t);var r=yD(t,e);try{i.send(LP(r,{origin:t}))}catch(n){!function(e,t,r){if(!iP){var n=e.stack?" Stacktrace was '".concat(e.stack,"'"):"";if(e===t)console.error("Missing onError handler for invocation '".concat(r,"', error was '").concat(e,"'.").concat(n));else{var i=t.stack?" Stacktrace was '".concat(t.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(r,"'. ")+"Original error: '".concat(e,"'. ").concat(n," Current error is '").concat(t,"'.").concat(i))}}}(e,n,t),i.devTools&&i.devTools.send(r,i.state),i.machine.strict&&i.stop()}}}));var a=((r={id:t,send:function(){},subscribe:function(t,r,n){var i=DP(t,r,n),o=!1;return e.then((function(e){o||(i.next(e),o||i.complete())}),(function(e){o||i.error(e)})),{unsubscribe:function(){return o=!0}}},stop:function(){o=!0},toJSON:function(){return{id:t}},getSnapshot:function(){return n}})[xP]=function(){return this},r);return this.children.set(t,a),a},e.prototype.spawnCallback=function(e,t){var r,n,i,o=this,a=!1,s=new Set,c=new Set;try{i=e((function(e){n=e,c.forEach((function(t){return t(e)})),a||o.send(LP(e,{origin:t}))}),(function(e){s.add(e)}))}catch(e){this.send(yD(t,e))}if(yP(i))return this.spawnPromise(i,t);var u=((r={id:t,send:function(e){return s.forEach((function(t){return t(e)}))},subscribe:function(e){var t=DP(e);return c.add(t.next),{unsubscribe:function(){c.delete(t.next)}}},stop:function(){a=!0,RP(i)&&i()},toJSON:function(){return{id:t}},getSnapshot:function(){return n}})[xP]=function(){return this},r);return this.children.set(t,u),u},e.prototype.spawnObservable=function(e,t){var r,n,i=this,o=e.subscribe((function(e){n=e,i.send(LP(e,{origin:t}))}),(function(e){i.removeChild(t),i.send(LP(yD(t,e),{origin:t}))}),(function(){i.removeChild(t),i.send(LP(gD(t),{origin:t}))})),a=((r={id:t,send:function(){},subscribe:function(t,r,n){return e.subscribe(t,r,n)},stop:function(){return o.unsubscribe()},getSnapshot:function(){return n},toJSON:function(){return{id:t}}})[xP]=function(){return this},r);return this.children.set(t,a),a},e.prototype.spawnActor=function(e,t){return this.children.set(t,e),e},e.prototype.spawnActivity=function(e){var t=this.machine.options&&this.machine.options.activities?this.machine.options.activities[e.type]:void 0;if(t){var r=t(this.state.context,e);this.spawnEffect(e.id,r)}else iP||_P(!1,"No implementation found for activity '".concat(e.type,"'"))},e.prototype.spawnEffect=function(e,t){var r;this.children.set(e,((r={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:t||void 0,getSnapshot:function(){},toJSON:function(){return{id:e}}})[xP]=function(){return this},r))},e.prototype.attachDev=function(){var e=GD();if(this.options.devTools&&e){if(e.__REDUX_DEVTOOLS_EXTENSION__){var t="object"==typeof this.options.devTools?this.options.devTools:void 0;this.devTools=e.__REDUX_DEVTOOLS_EXTENSION__.connect(YN(YN({name:this.id,autoPause:!0,stateSanitizer:function(e){return{value:e.value,context:e.context,actions:e.actions}}},t),{features:YN({jump:!1,skip:!1},t?t.features:void 0)}),this.machine),this.devTools.init(this.state)}WD(this)}},e.prototype.toJSON=function(){return{id:this.id}},e.prototype[xP]=function(){return this},e.prototype.getSnapshot=function(){return this.status===HD.NotStarted?this.initialState:this._state},e.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(e,t){return setTimeout(e,t)},clearTimeout:function(e){return clearTimeout(e)}},logger:console.log.bind(console),devTools:!1},e.interpret=YD,e}();function YD(e,t){return new JD(e,t)}var QD=new Uint8Array(16);function XD(){if(!$D&&!($D="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return $D(QD)}const ZD=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const eF=function(e){return"string"==typeof e&&ZD.test(e)};for(var tF=[],rF=0;rF<256;++rF)tF.push((rF+256).toString(16).substr(1));const nF=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(tF[e[t+0]]+tF[e[t+1]]+tF[e[t+2]]+tF[e[t+3]]+"-"+tF[e[t+4]]+tF[e[t+5]]+"-"+tF[e[t+6]]+tF[e[t+7]]+"-"+tF[e[t+8]]+tF[e[t+9]]+"-"+tF[e[t+10]]+tF[e[t+11]]+tF[e[t+12]]+tF[e[t+13]]+tF[e[t+14]]+tF[e[t+15]]).toLowerCase();if(!eF(r))throw TypeError("Stringified UUID is invalid");return r};const iF=function(e,t,r){var n=(e=e||{}).random||(e.rng||XD)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return nF(n)};var oF=function(){function e(t,r){ne(this,e),C(this,"webex",void 0),C(this,"callerInfo",void 0),C(this,"sdkConnector",void 0),C(this,"emitter",void 0),this.sdkConnector=VM,this.callerInfo={},this.sdkConnector.getWebex()||VM.setWebex(t),this.webex=this.sdkConnector.getWebex(),this.emitter=r}var t,r;return oe(e,[{key:"resolveCallerId",value:(r=_e(Re().mark((function e(t){var r,n;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fN(t);case 2:r=e.sent,n=!1,r.name&&this.callerInfo.name!==r.name&&(cM.info("Updating Name after resolution",{file:GO,method:"resolveCallerId"}),this.callerInfo.name=r.name,n=!0),r.num&&this.callerInfo.num!==r.num&&(cM.info("Updating Number after resolution",{file:GO,method:"resolveCallerId"}),this.callerInfo.num=r.num,n=!0),this.callerInfo.avatarSrc&&this.callerInfo.avatarSrc===r.avatarSrc||(cM.info("Updating Avatar Id after resolution",{file:GO,method:"resolveCallerId"}),this.callerInfo.avatarSrc=r.avatarSrc,n=!0),this.callerInfo.id&&this.callerInfo.id===r.id||(cM.info("Updating User Id after resolution",{file:GO,method:"resolveCallerId"}),this.callerInfo.id=r.id,n=!0),n&&this.emitter(this.callerInfo);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"parseRemotePartyInfo",value:(t=_e(Re().mark((function e(t){var r,n;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:(r=t.split(";").slice(-1)[0]).includes("externalId")?(n=r.split("=")[1],cM.info("externalId retrieved: ".concat(n),{file:GO,method:"parseRemotePartyInfo"}),this.resolveCallerId('id eq "'.concat(n,'"'))):cM.warn("externalId not found!",{file:GO,method:"parseRemotePartyInfo"});case 2:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"parseSipUri",value:function(e){var t={},r=e.split("<")[0].replace(/"/g,"");r?t.name=r.trim():cM.warn("Name field not found!",{file:GO,method:"parseSipUri"});var n=e.split("@")[0].replace(/"/g,""),i=n.substring(n.indexOf(":")+1,n.length),o=i.match(VO);return o&&o[0].length===i.length?t.num=i:cM.warn("Number field not found!",{file:GO,method:"parseSipUri"}),t}},{key:"fetchCallerDetails",value:function(e){if(this.callerInfo.id=void 0,this.callerInfo.avatarSrc=void 0,this.callerInfo.name=void 0,this.callerInfo.num=void 0,"p-asserted-identity"in e){cM.info("Parsing p-asserted-identity within remote party information",{file:GO,method:"fetchCallerDetails"});var t=this.parseSipUri(e["p-asserted-identity"]);this.callerInfo.name=t.name,this.callerInfo.num=t.num}if(e.from){cM.info("Parsing from header within the remote party information",{file:GO,method:"fetchCallerDetails"});var r=this.parseSipUri(e.from);!this.callerInfo.name&&r.name&&(cM.info("Updating name field from From header",{file:GO,method:"fetchCallerDetails"}),this.callerInfo.name=r.name),!this.callerInfo.num&&r.num&&(cM.info("Updating number field from From header",{file:GO,method:"fetchCallerDetails"}),this.callerInfo.num=r.num)}return(this.callerInfo.name||this.callerInfo.num)&&this.emitter(this.callerInfo),"x-broadworks-remote-party-info"in e&&(cM.info("Parsing x-broadworks-remote-party-info within remote party information",{file:GO,method:"fetchCallerDetails"}),this.parseRemotePartyInfo(e["x-broadworks-remote-party-info"])),this.callerInfo}}]),e}();function aF(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function sF(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?aF(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):aF(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}function cF(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var uF,lF=function(e){Je(R,e);var t,r,n,i,o,a,s,c,u,l,d,f,h,p,v,m,g,y,b,E,S,_,w=cF(R);function R(e,t,r,n,i,o,a,s){var c;ne(this,R),C(Ye(c=w.call(this)),"sdkConnector",void 0),C(Ye(c),"webex",void 0),C(Ye(c),"destination",void 0),C(Ye(c),"direction",void 0),C(Ye(c),"callId",void 0),C(Ye(c),"correlationId",void 0),C(Ye(c),"deviceId",void 0),C(Ye(c),"lineId",void 0),C(Ye(c),"disconnectReason",void 0),C(Ye(c),"callStateMachine",void 0),C(Ye(c),"mediaStateMachine",void 0),C(Ye(c),"seq",void 0),C(Ye(c),"mediaConnection",void 0),C(Ye(c),"earlyMedia",void 0),C(Ye(c),"connected",void 0),C(Ye(c),"mediaInactivity",void 0),C(Ye(c),"callerInfo",void 0),C(Ye(c),"localRoapMessage",void 0),C(Ye(c),"mobiusUrl",void 0),C(Ye(c),"remoteRoapMessage",void 0),C(Ye(c),"deleteCb",void 0),C(Ye(c),"callerId",void 0),C(Ye(c),"sessionTimer",void 0),C(Ye(c),"supplementaryServicesTimer",void 0),C(Ye(c),"muted",void 0),C(Ye(c),"held",void 0),C(Ye(c),"metricManager",void 0),C(Ye(c),"broadworksCorrelationInfo",void 0),C(Ye(c),"serviceIndicator",void 0),C(Ye(c),"mediaNegotiationCompleted",void 0),C(Ye(c),"receivedRoapOKSeq",void 0),C(Ye(c),"localAudioStream",void 0),C(Ye(c),"rtcMetrics",void 0),C(Ye(c),"forceSendStatsReport",function(){var e=_e(Re().mark((function e(t){var r,n,i,o,a;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.callFrom,n={file:KO,method:kL},e.prev=2,e.next=5,c.mediaConnection.forceRtcMetricsSend();case 5:cM.info("Successfully uploaded available webrtc telemetry statistics",n),cM.info("callFrom: ".concat(r),n),e.next=17;break;case 9:return e.prev=9,e.t0=e.catch(2),i=e.t0,o=sN(i,n),a=new Error("Failed to upload webrtc telemetry statistics. ".concat(o)),cM.error(a,n),e.next=17,mN({correlationId:c.correlationId,callId:c.callId});case 17:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(t){return e.apply(this,arguments)}}()),C(Ye(c),"getDirection",(function(){return c.direction})),C(Ye(c),"getCallId",(function(){return c.callId})),C(Ye(c),"getCorrelationId",(function(){return c.correlationId})),C(Ye(c),"setCallId",(function(e){c.callId=e,c.rtcMetrics.updateCallId(e),cM.info("Setting callId : ".concat(c.callId," for correlationId: ").concat(c.correlationId),{file:KO,method:LL}),c.callId=e,c.rtcMetrics.updateCallId(e)})),C(Ye(c),"getDisconnectReason",(function(){return c.disconnectReason})),C(Ye(c),"post",function(){var e=_e(Re().mark((function e(t){var r;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={device:{deviceId:c.deviceId,correlationId:c.correlationId},localMedia:{roap:t,mediaId:iF()}},e.abrupt("return",c.webex.request({uri:"".concat(c.mobiusUrl).concat(DO,"/").concat(c.deviceId,"/").concat("call"),method:_M.POST,service:SM.MOBIUS,headers:C(C({},PO,c.webex.internal.device.url),jO,MO),body:c.destination?sF(sF({},r),{},{callee:{type:c.destination.type,address:c.destination.address}}):r}));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),C(Ye(c),"onEffectEnabled",(function(){c.metricManager.submitBNRMetric(mO.BNR_ENABLED,vO.BEHAVIORAL,c.callId,c.correlationId)})),C(Ye(c),"onEffectDisabled",(function(){c.metricManager.submitBNRMetric(mO.BNR_DISABLED,vO.BEHAVIORAL,c.callId,c.correlationId)})),C(Ye(c),"updateTrack",(function(e){c.mediaConnection.updateLocalTracks({audio:e})})),C(Ye(c),"registerEffectListener",(function(e){if(c.localAudioStream){var t=c.localAudioStream.getEffectByKind(aL);t===e&&(t.on(_A.Enabled,c.onEffectEnabled),t.on(_A.Disabled,c.onEffectDisabled))}})),C(Ye(c),"getCallerInfo",(function(){return c.callerInfo})),C(Ye(c),"end",(function(){cM.info("".concat(CO),{file:KO,method:jL}),c.sendCallStateMachineEvt({type:"E_SEND_CALL_DISCONNECT"})})),C(Ye(c),"doHoldResume",(function(){c.held?c.sendCallStateMachineEvt({type:"E_CALL_RESUME"}):c.sendCallStateMachineEvt({type:"E_CALL_HOLD"})})),C(Ye(c),"mute",(function(e,t){cM.info("".concat(CO," with: ").concat(t||"user mute"),{file:KO,method:qL}),e?t===JN.SYSTEM?e.userMuted?cM.info("Call is muted by the user already - ".concat(c.getCorrelationId(),"."),{file:KO,method:qL}):c.muted=e.systemMuted:e.systemMuted?cM.info("Call is muted on the system - ".concat(c.getCorrelationId(),"."),{file:KO,method:qL}):(e.setUserMuted(!c.muted),c.muted=!c.muted):cM.warn("Did not find a local stream while muting the call ".concat(c.getCorrelationId(),"."),{file:KO,method:qL})})),C(Ye(c),"updateMedia",(function(e){var t=e.outputStream.getAudioTracks()[0];if(t)try{c.mediaConnection.updateLocalTracks({audio:t}),c.unregisterListeners(),c.registerListeners(e),c.localAudioStream=e}catch(e){cM.warn("Unable to update media on call ".concat(c.getCorrelationId(),". Error: ").concat(e.message),{file:KO,method:VL})}else cM.warn("Did not find a local track while updating media for call ".concat(c.getCorrelationId(),". Will not update media"),{file:KO,method:VL})})),c.destination=s,c.direction=r,c.sdkConnector=VM,c.deviceId=n,c.serviceIndicator=a,c.lineId=i,c.sdkConnector.getWebex()||VM.setWebex(t),c.webex=c.sdkConnector.getWebex(),c.metricManager=fM(c.webex,c.serviceIndicator),c.callId="".concat("DefaultLocalId","_").concat(iF()),c.correlationId=iF(),c.deleteCb=o,c.connected=!1,c.mediaInactivity=!1,c.held=!1,c.earlyMedia=!1,c.callerInfo={},c.localRoapMessage={},c.mobiusUrl=e,c.receivedRoapOKSeq=0,c.mediaNegotiationCompleted=!1,cM.info("Webex Calling Url:- ".concat(c.mobiusUrl),{file:KO,method:sL}),c.seq=1,c.callerId=function(e,t){return new oF(e,t)}(t,(function(e){c.callerInfo=e;var t={correlationId:c.correlationId,callerId:c.callerInfo};c.emit(ON.CALLER_ID,t)})),c.remoteRoapMessage=null,c.disconnectReason={code:GN.NORMAL,cause:WN.NORMAL},c.rtcMetrics=new Cu(c.webex,{callId:c.callId},c.correlationId);var u=ND({schema:{context:{},events:{}},id:"call-state",initial:"S_IDLE",context:{},states:{S_IDLE:{on:{E_RECV_CALL_SETUP:{target:"S_RECV_CALL_SETUP",actions:["incomingCallSetup"]},E_SEND_CALL_SETUP:{target:"S_SEND_CALL_SETUP",actions:["outgoingCallSetup"]},E_RECV_CALL_DISCONNECT:{target:"S_RECV_CALL_DISCONNECT",actions:["incomingCallDisconnect"]},E_SEND_CALL_DISCONNECT:{target:"S_SEND_CALL_DISCONNECT",actions:["outgoingCallDisconnect"]},E_UNKNOWN:{target:"S_UNKNOWN",actions:["unknownState"]}}},S_RECV_CALL_SETUP:{after:{1e4:{target:"S_CALL_CLEARED",actions:["triggerTimeout"]}},on:{E_SEND_CALL_ALERTING:{target:"S_SEND_CALL_PROGRESS",actions:["outgoingCallAlerting"]},E_RECV_CALL_DISCONNECT:{target:"S_RECV_CALL_DISCONNECT",actions:["incomingCallDisconnect"]},E_SEND_CALL_DISCONNECT:{target:"S_SEND_CALL_DISCONNECT",actions:["outgoingCallDisconnect"]},E_UNKNOWN:{target:"S_UNKNOWN",actions:["unknownState"]}}},S_SEND_CALL_SETUP:{after:{1e4:{target:"S_CALL_CLEARED",actions:["triggerTimeout"]}},on:{E_RECV_CALL_PROGRESS:{target:"S_RECV_CALL_PROGRESS",actions:["incomingCallProgress"]},E_RECV_CALL_CONNECT:{target:"S_RECV_CALL_CONNECT",actions:["incomingCallConnect"]},E_RECV_CALL_DISCONNECT:{target:"S_RECV_CALL_DISCONNECT",actions:["incomingCallDisconnect"]},E_SEND_CALL_DISCONNECT:{target:"S_SEND_CALL_DISCONNECT",actions:["outgoingCallDisconnect"]},E_UNKNOWN:{target:"S_UNKNOWN",actions:["unknownState"]}}},S_RECV_CALL_PROGRESS:{after:{6e4:{target:"S_CALL_CLEARED",actions:["triggerTimeout"]}},on:{E_RECV_CALL_CONNECT:{target:"S_RECV_CALL_CONNECT",actions:["incomingCallConnect"]},E_RECV_CALL_DISCONNECT:{target:"S_RECV_CALL_DISCONNECT",actions:["incomingCallDisconnect"]},E_SEND_CALL_DISCONNECT:{target:"S_SEND_CALL_DISCONNECT",actions:["outgoingCallDisconnect"]},E_RECV_CALL_PROGRESS:{target:"S_RECV_CALL_PROGRESS",actions:["incomingCallProgress"]},E_UNKNOWN:{target:"S_UNKNOWN",actions:["unknownState"]}}},S_SEND_CALL_PROGRESS:{after:{6e4:{target:"S_CALL_CLEARED",actions:["triggerTimeout"]}},on:{E_SEND_CALL_CONNECT:{target:"S_SEND_CALL_CONNECT",actions:["outgoingCallConnect"]},E_RECV_CALL_DISCONNECT:{target:"S_RECV_CALL_DISCONNECT",actions:["incomingCallDisconnect"]},E_SEND_CALL_DISCONNECT:{target:"S_SEND_CALL_DISCONNECT",actions:["outgoingCallDisconnect"]},E_UNKNOWN:{target:"S_UNKNOWN",actions:["unknownState"]}}},S_RECV_CALL_CONNECT:{after:{1e4:{target:"S_CALL_CLEARED",actions:["triggerTimeout"]}},on:{E_CALL_ESTABLISHED:{target:"S_CALL_ESTABLISHED",actions:["callEstablished"]},E_RECV_CALL_DISCONNECT:{target:"S_RECV_CALL_DISCONNECT",actions:["incomingCallDisconnect"]},E_SEND_CALL_DISCONNECT:{target:"S_SEND_CALL_DISCONNECT",actions:["outgoingCallDisconnect"]},E_UNKNOWN:{target:"S_UNKNOWN",actions:["unknownState"]}}},S_SEND_CALL_CONNECT:{after:{1e4:{target:"S_CALL_CLEARED",actions:["triggerTimeout"]}},on:{E_CALL_ESTABLISHED:{target:"S_CALL_ESTABLISHED",actions:["callEstablished"]},E_RECV_CALL_DISCONNECT:{target:"S_RECV_CALL_DISCONNECT",actions:["incomingCallDisconnect"]},E_SEND_CALL_DISCONNECT:{target:"S_SEND_CALL_DISCONNECT",actions:["outgoingCallDisconnect"]},E_UNKNOWN:{target:"S_UNKNOWN",actions:["unknownState"]}}},S_CALL_HOLD:{on:{E_RECV_CALL_DISCONNECT:{target:"S_RECV_CALL_DISCONNECT",actions:["incomingCallDisconnect"]},E_SEND_CALL_DISCONNECT:{target:"S_SEND_CALL_DISCONNECT",actions:["outgoingCallDisconnect"]},E_CALL_ESTABLISHED:{target:"S_CALL_ESTABLISHED",actions:["callEstablished"]},E_UNKNOWN:{target:"S_UNKNOWN",actions:["unknownState"]}}},S_CALL_RESUME:{on:{E_RECV_CALL_DISCONNECT:{target:"S_RECV_CALL_DISCONNECT",actions:["incomingCallDisconnect"]},E_SEND_CALL_DISCONNECT:{target:"S_SEND_CALL_DISCONNECT",actions:["outgoingCallDisconnect"]},E_CALL_ESTABLISHED:{target:"S_CALL_ESTABLISHED",actions:["callEstablished"]},E_UNKNOWN:{target:"S_UNKNOWN",actions:["unknownState"]}}},S_CALL_ESTABLISHED:{on:{E_CALL_HOLD:{target:"S_CALL_HOLD",actions:["initiateCallHold"]},E_CALL_RESUME:{target:"S_CALL_RESUME",actions:["initiateCallResume"]},E_RECV_CALL_DISCONNECT:{target:"S_RECV_CALL_DISCONNECT",actions:["incomingCallDisconnect"]},E_SEND_CALL_DISCONNECT:{target:"S_SEND_CALL_DISCONNECT",actions:["outgoingCallDisconnect"]},E_CALL_ESTABLISHED:{target:"S_CALL_ESTABLISHED",actions:["callEstablished"]},E_UNKNOWN:{target:"S_UNKNOWN",actions:["unknownState"]}}},S_RECV_CALL_DISCONNECT:{on:{E_CALL_CLEARED:"S_CALL_CLEARED"}},S_SEND_CALL_DISCONNECT:{on:{E_CALL_CLEARED:"S_CALL_CLEARED"}},S_UNKNOWN:{on:{E_CALL_CLEARED:"S_CALL_CLEARED"}},S_ERROR:{on:{E_CALL_CLEARED:"S_CALL_CLEARED"}},S_CALL_CLEARED:{type:"final"}}},{actions:{incomingCallSetup:function(e,t){return c.handleIncomingCallSetup(t)},outgoingCallSetup:function(e,t){return c.handleOutgoingCallSetup(t)},incomingCallProgress:function(e,t){return c.handleIncomingCallProgress(t)},outgoingCallAlerting:function(e,t){return c.handleOutgoingCallAlerting(t)},incomingCallConnect:function(e,t){return c.handleIncomingCallConnect(t)},outgoingCallConnect:function(e,t){return c.handleOutgoingCallConnect(t)},callEstablished:function(e,t){return c.handleCallEstablished(t)},initiateCallHold:function(e,t){return c.handleCallHold(t)},initiateCallResume:function(e,t){return c.handleCallResume(t)},incomingCallDisconnect:function(e,t){return c.handleIncomingCallDisconnect(t)},outgoingCallDisconnect:function(e,t){return c.handleOutgoingCallDisconnect(t)},unknownState:function(e,t){return c.handleUnknownState(t)},triggerTimeout:function(){return c.handleTimeout()}}}),l=ND({schema:{context:{},events:{}},id:"roap-state",initial:"S_ROAP_IDLE",context:{},states:{S_ROAP_IDLE:{on:{E_RECV_ROAP_OFFER_REQUEST:{target:"S_RECV_ROAP_OFFER_REQUEST",actions:["incomingRoapOfferRequest"]},E_RECV_ROAP_OFFER:{target:"S_RECV_ROAP_OFFER",actions:["incomingRoapOffer"]},E_SEND_ROAP_OFFER:{target:"S_SEND_ROAP_OFFER",actions:["outgoingRoapOffer"]}}},S_RECV_ROAP_OFFER_REQUEST:{on:{E_SEND_ROAP_OFFER:{target:"S_SEND_ROAP_OFFER",actions:["outgoingRoapOffer"]},E_ROAP_OK:{target:"S_ROAP_OK",actions:["roapEstablished"]},E_ROAP_ERROR:{target:"S_ROAP_ERROR",actions:["roapError"]}}},S_RECV_ROAP_OFFER:{on:{E_SEND_ROAP_ANSWER:{target:"S_SEND_ROAP_ANSWER",actions:["outgoingRoapAnswer"]},E_ROAP_OK:{target:"S_ROAP_OK",actions:["roapEstablished"]},E_ROAP_ERROR:{target:"S_ROAP_ERROR",actions:["roapError"]}}},S_SEND_ROAP_OFFER:{on:{E_RECV_ROAP_ANSWER:{target:"S_RECV_ROAP_ANSWER",actions:["incomingRoapAnswer"]},E_SEND_ROAP_ANSWER:{target:"S_SEND_ROAP_ANSWER",actions:["outgoingRoapAnswer"]},E_SEND_ROAP_OFFER:{target:"S_SEND_ROAP_OFFER",actions:["outgoingRoapOffer"]},E_ROAP_ERROR:{target:"S_ROAP_ERROR",actions:["roapError"]}}},S_RECV_ROAP_ANSWER:{on:{E_ROAP_OK:{target:"S_ROAP_OK",actions:["roapEstablished"]},E_ROAP_ERROR:{target:"S_ROAP_ERROR",actions:["roapError"]}}},S_SEND_ROAP_ANSWER:{on:{E_RECV_ROAP_OFFER_REQUEST:{target:"S_RECV_ROAP_OFFER_REQUEST",actions:["incomingRoapOfferRequest"]},E_RECV_ROAP_OFFER:{target:"S_RECV_ROAP_OFFER",actions:["incomingRoapOffer"]},E_ROAP_OK:{target:"S_ROAP_OK",actions:["roapEstablished"]},E_SEND_ROAP_ANSWER:{target:"S_SEND_ROAP_ANSWER",actions:["outgoingRoapAnswer"]},E_ROAP_ERROR:{target:"S_ROAP_ERROR",actions:["roapError"]}}},S_ROAP_OK:{on:{E_RECV_ROAP_OFFER_REQUEST:{target:"S_RECV_ROAP_OFFER_REQUEST",actions:["incomingRoapOfferRequest"]},E_RECV_ROAP_OFFER:{target:"S_RECV_ROAP_OFFER",actions:["incomingRoapOffer"]},E_ROAP_OK:{target:"S_ROAP_OK",actions:["roapEstablished"]},E_SEND_ROAP_OFFER:{target:"S_SEND_ROAP_OFFER",actions:["outgoingRoapOffer"]},E_ROAP_ERROR:{target:"S_ROAP_ERROR",actions:["roapError"]},E_ROAP_TEARDOWN:{target:"S_ROAP_TEARDOWN"}}},S_ROAP_ERROR:{on:{E_ROAP_TEARDOWN:{target:"S_ROAP_TEARDOWN"},E_RECV_ROAP_OFFER_REQUEST:{target:"S_RECV_ROAP_OFFER_REQUEST",actions:["incomingRoapOfferRequest"]},E_RECV_ROAP_OFFER:{target:"S_RECV_ROAP_OFFER",actions:["incomingRoapOffer"]},E_RECV_ROAP_ANSWER:{target:"S_RECV_ROAP_ANSWER",actions:["incomingRoapAnswer"]},E_ROAP_OK:{target:"S_ROAP_OK",actions:["roapEstablished"]}}},S_ROAP_TEARDOWN:{type:"final"}}},{actions:{incomingRoapOffer:function(e,t){return c.handleIncomingRoapOffer(e,t)},incomingRoapAnswer:function(e,t){return c.handleIncomingRoapAnswer(e,t)},incomingRoapOfferRequest:function(e,t){return c.handleIncomingRoapOfferRequest(e,t)},outgoingRoapOffer:function(e,t){return c.handleOutgoingRoapOffer(e,t)},outgoingRoapAnswer:function(e,t){return c.handleOutgoingRoapAnswer(e,t)},roapEstablished:function(e,t){return c.handleRoapEstablished(e,t)},roapError:function(e,t){return c.handleRoapError(e,t)}}});return c.callStateMachine=YD(u).onTransition((function(e,t){cM.log("Call StateMachine:- state=".concat(e.value,", event=").concat(Cr()(t.type)),{file:KO,method:sL}),"S_UNKNOWN"!==e.value&&c.metricManager.submitCallMetric(mO.CALL,e.value.toString(),vO.BEHAVIORAL,c.callId,c.correlationId,void 0)})).start(),c.mediaStateMachine=YD(l).onTransition((function(e,t){var r;(cM.log("Media StateMachine:- state=".concat(e.value,", event=").concat(Cr()(t.type)),{file:KO,method:sL}),"S_ROAP_ERROR"!==e.value)&&c.metricManager.submitMediaMetric(mO.MEDIA,e.value.toString(),vO.BEHAVIORAL,c.callId,c.correlationId,c.localRoapMessage.sdp,null===(r=c.remoteRoapMessage)||void 0===r?void 0:r.sdp,void 0)})).start(),c.muted=!1,c}return oe(R,[{key:"isMuted",value:function(){return this.muted}},{key:"isConnected",value:function(){return this.connected}},{key:"isHeld",value:function(){return this.held}},{key:"handleIncomingCallSetup",value:function(e){cM.info("".concat(CO," with: ").concat(this.getCorrelationId()),{file:KO,method:uL}),this.sendCallStateMachineEvt({type:"E_SEND_CALL_ALERTING"})}},{key:"handleOutgoingCallSetup",value:(_=_e(Re().mark((function e(t){var r,n,i,o,a=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return cM.info("".concat(CO," with: ").concat(this.getCorrelationId()),{file:KO,method:lL}),r=t.data,e.prev=2,e.next=5,this.post(r);case 5:n=e.sent,cM.info("Response: ".concat(Cr()(n)),{file:KO,method:lL}),cM.info("Response code: ".concat(n.statusCode),{file:KO,method:lL}),this.setCallId(n.body.callId),cM.log("Call setup successful for callId: ".concat(n.body.callId),{file:KO,method:this.handleOutgoingCallSetup.name}),e.next=20;break;case 12:return e.prev=12,e.t0=e.catch(2),i=new Error("Failed to setup the call: ".concat(e.t0)),cM.error(i,{file:KO,method:lL}),o=e.t0,oN((function(e){a.emit(ON.CALL_ERROR,e),a.submitCallErrorMetric(e),a.sendCallStateMachineEvt({type:"E_UNKNOWN",data:o})}),hM.CALL_CONTROL,(function(e){}),this.getCorrelationId(),o,lL,KO),e.next=20,mN({correlationId:this.correlationId,callId:this.callId});case 20:case"end":return e.stop()}}),e,this,[[2,12]])}))),function(e){return _.apply(this,arguments)})},{key:"handleCallHold",value:(S=_e(Re().mark((function e(t){var r,n,i,o=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return cM.info("".concat(CO," with: ").concat(this.getCorrelationId()),{file:KO,method:dL}),e.prev=1,e.next=4,this.postSSRequest(void 0,LN.HOLD);case 4:r=e.sent,cM.log("Response code: ".concat(r.statusCode),{file:KO,method:dL}),!1===this.isHeld()&&(this.supplementaryServicesTimer=setTimeout(_e(Re().mark((function e(){var t,r;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t={file:KO,method:dL},cM.warn("Hold response timed out",{file:KO,method:dL}),r=MM("An error occurred while placing the call on hold. Wait a moment and try again.",t,pM.TIMEOUT,o.getCorrelationId(),hM.CALL_CONTROL),o.emit(ON.HOLD_ERROR,r),o.submitCallErrorMetric(r);case 5:case"end":return e.stop()}}),e)}))),1e4)),e.next=17;break;case 9:return e.prev=9,e.t0=e.catch(1),n=new Error("Failed to put the call on hold: ".concat(e.t0)),cM.error(n,{file:KO,method:dL}),i=e.t0,oN((function(e){o.emit(ON.HOLD_ERROR,e),o.submitCallErrorMetric(e),o.sendCallStateMachineEvt({type:"E_CALL_ESTABLISHED",data:i})}),hM.CALL_CONTROL,(function(e){}),this.getCorrelationId(),i,dL,KO),e.next=17,mN({correlationId:this.correlationId,callId:this.callId});case 17:case"end":return e.stop()}}),e,this,[[1,9]])}))),function(e){return S.apply(this,arguments)})},{key:"handleCallResume",value:(E=_e(Re().mark((function e(t){var r,n,i,o=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return cM.info("".concat(CO," with: ").concat(this.getCorrelationId()),{file:KO,method:fL}),e.prev=1,e.next=4,this.postSSRequest(void 0,LN.RESUME);case 4:r=e.sent,cM.log("Response code: ".concat(r.statusCode),{file:KO,method:this.handleCallResume.name}),!0===this.isHeld()&&(this.supplementaryServicesTimer=setTimeout(_e(Re().mark((function e(){var t,r;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t={file:KO,method:o.handleCallResume.name},cM.warn("Resume response timed out",{file:KO,method:o.handleCallResume.name}),r=MM("An error occurred while resuming the call. Wait a moment and try again.",t,pM.TIMEOUT,o.getCorrelationId(),hM.CALL_CONTROL),o.emit(ON.RESUME_ERROR,r),o.submitCallErrorMetric(r);case 5:case"end":return e.stop()}}),e)}))),1e4)),e.next=17;break;case 9:return e.prev=9,e.t0=e.catch(1),n=new Error("Failed to resume the call: ".concat(e.t0)),cM.error(n,{file:KO,method:this.handleCallResume.name}),i=e.t0,oN((function(e){o.emit(ON.RESUME_ERROR,e),o.submitCallErrorMetric(e),o.sendCallStateMachineEvt({type:"E_CALL_ESTABLISHED",data:i})}),hM.CALL_CONTROL,(function(e){}),this.getCorrelationId(),i,this.handleOutgoingCallSetup.name,KO),e.next=17,mN({correlationId:this.correlationId,callId:this.callId});case 17:case"end":return e.stop()}}),e,this,[[1,9]])}))),function(e){return E.apply(this,arguments)})},{key:"handleIncomingCallProgress",value:function(e){var t;cM.info("".concat(CO," with: ").concat(this.getCorrelationId()),{file:KO,method:hL});var r=e.data;null!=r&&null!==(t=r.callProgressData)&&void 0!==t&&t.inbandMedia?(cM.log("Inband media present. Setting Early Media flag",{file:KO,method:this.handleIncomingCallProgress.name}),this.earlyMedia=!0):cM.log("Inband media not present.",{file:KO,method:this.handleIncomingCallProgress.name}),null!=r&&r.callerId&&(cM.info("Processing Caller-Id data",{file:KO,method:this.handleIncomingCallProgress.name}),this.startCallerIdResolution(r.callerId)),this.emit(ON.PROGRESS,this.correlationId)}},{key:"handleIncomingRoapOfferRequest",value:function(e,t){cM.info("".concat(CO," with: ").concat(this.getCorrelationId()),{file:KO,method:pL});var r=t.data;this.mediaConnection?this.receivedRoapOKSeq===r.seq-2?(cM.info("Waiting for Roap OK, buffer the remote Offer Request for later handling",{file:KO,method:this.handleIncomingRoapOfferRequest.name}),this.remoteRoapMessage=r):(r.seq=this.seq+1,this.seq=r.seq,this.mediaConnection.roapMessageReceived(r)):(cM.info("Media connection is not up, buffer the remote Offer Request for later handling",{file:KO,method:this.handleIncomingRoapOfferRequest.name}),this.seq=r.seq,cM.info("Setting Sequence No: ".concat(this.seq),{file:KO,method:this.handleIncomingRoapOfferRequest.name}),this.remoteRoapMessage=r)}},{key:"handleOutgoingCallAlerting",value:(b=_e(Re().mark((function e(t){var r,n,i,o=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return cM.info("".concat(CO," with: ").concat(this.getCorrelationId()),{file:KO,method:vL}),e.prev=1,e.next=4,this.patch(KN.ALERTING);case 4:r=e.sent,cM.log("PATCH response: ".concat(r.statusCode),{file:KO,method:this.handleOutgoingCallAlerting.name}),e.next=16;break;case 8:return e.prev=8,e.t0=e.catch(1),n=new Error("Failed to signal call progression: ".concat(e.t0)),cM.error(n,{file:KO,method:this.handleOutgoingCallAlerting.name}),i=e.t0,oN((function(e){o.emit(ON.CALL_ERROR,e),o.submitCallErrorMetric(e),o.sendCallStateMachineEvt({type:"E_UNKNOWN",data:i})}),hM.CALL_CONTROL,(function(e){}),this.getCorrelationId(),i,this.handleOutgoingCallAlerting.name,KO),e.next=16,mN({correlationId:this.correlationId,callId:this.callId});case 16:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e){return b.apply(this,arguments)})},{key:"handleIncomingCallConnect",value:function(e){cM.info("".concat(CO," with: ").concat(this.getCorrelationId()),{file:KO,method:mL}),this.emit(ON.CONNECT,this.correlationId),(this.earlyMedia||this.mediaNegotiationCompleted)&&(this.mediaNegotiationCompleted=!1,this.sendCallStateMachineEvt({type:"E_CALL_ESTABLISHED"}))}},{key:"handleOutgoingCallConnect",value:(y=_e(Re().mark((function e(t){var r,n,i,o=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(cM.info("".concat(CO," with: ").concat(this.getCorrelationId()),{file:KO,method:gL}),this.remoteRoapMessage){e.next=4;break}return cM.warn("Offer not yet received from remote end... Exiting",{file:KO,method:this.handleOutgoingCallConnect.name}),e.abrupt("return");case 4:return e.prev=4,this.mediaConnection.roapMessageReceived(this.remoteRoapMessage),e.next=8,this.patch(KN.CONNECTED);case 8:r=e.sent,cM.log("PATCH response: ".concat(r.statusCode),{file:KO,method:this.handleOutgoingCallConnect.name}),e.next=20;break;case 12:return e.prev=12,e.t0=e.catch(4),n=new Error("Failed to connect the call: ".concat(e.t0)),cM.error(n,{file:KO,method:this.handleOutgoingCallConnect.name}),i=e.t0,oN((function(e){o.emit(ON.CALL_ERROR,e),o.submitCallErrorMetric(e),o.sendCallStateMachineEvt({type:"E_UNKNOWN",data:i})}),hM.CALL_CONTROL,(function(e){}),this.getCorrelationId(),i,this.handleOutgoingCallConnect.name,KO),e.next=20,mN({correlationId:this.correlationId,callId:this.callId});case 20:case"end":return e.stop()}}),e,this,[[4,12]])}))),function(e){return y.apply(this,arguments)})},{key:"handleIncomingCallDisconnect",value:(g=_e(Re().mark((function e(t){var r;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return cM.info("".concat(CO," with: ").concat(this.getCorrelationId()),{file:KO,method:yL}),this.setDisconnectReason(),e.prev=2,e.next=5,this.delete();case 5:r=e.sent,cM.log("Response code: ".concat(r.statusCode),{file:KO,method:yL}),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),cM.warn("Failed to delete the call",{file:KO,method:yL});case 12:this.deleteCb(this.correlationId),this.unregisterListeners(),this.sessionTimer&&clearInterval(this.sessionTimer),this.mediaConnection&&(this.mediaConnection.close(),cM.info("Closing media channel",{file:KO,method:yL})),this.sendMediaStateMachineEvt({type:"E_ROAP_TEARDOWN"}),this.sendCallStateMachineEvt({type:"E_CALL_CLEARED"}),this.emit(ON.DISCONNECT,this.correlationId);case 19:case"end":return e.stop()}}),e,this,[[2,9]])}))),function(e){return g.apply(this,arguments)})},{key:"handleOutgoingCallDisconnect",value:(m=_e(Re().mark((function e(t){var r;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return cM.info("".concat(CO," with: ").concat(this.getCorrelationId()),{file:KO,method:yL}),this.setDisconnectReason(),e.prev=2,e.next=5,this.delete();case 5:r=e.sent,cM.log("Response code: ".concat(r.statusCode),{file:KO,method:yL}),cM.log("Call disconnected successfully: ".concat(this.correlationId),{file:KO,method:yL}),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(2),cM.warn("Failed to delete the call",{file:KO,method:yL});case 13:this.deleteCb(this.correlationId),this.unregisterListeners(),this.sessionTimer&&clearInterval(this.sessionTimer),this.mediaConnection&&(this.mediaConnection.close(),cM.info("Closing media channel",{file:KO,method:yL})),this.sendMediaStateMachineEvt({type:"E_ROAP_TEARDOWN"}),this.sendCallStateMachineEvt({type:"E_CALL_CLEARED"});case 19:case"end":return e.stop()}}),e,this,[[2,10]])}))),function(e){return m.apply(this,arguments)})},{key:"handleCallEstablished",value:function(e){var t=this;cM.info("".concat(CO," with: ").concat(this.getCorrelationId()),{file:KO,method:bL}),this.emit(ON.ESTABLISHED,this.correlationId),this.earlyMedia=!1,this.connected=!0,this.sessionTimer&&(cM.log("Resetting session timer",{file:KO,method:bL}),clearInterval(this.sessionTimer)),this.sessionTimer=setInterval(_e(Re().mark((function e(){var r;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.postStatus();case 3:e.sent,cM.info("Session refresh successful",{file:KO,method:bL}),e.next=14;break;case 7:return e.prev=7,e.t0=e.catch(0),r=e.t0,t.sessionTimer&&clearInterval(t.sessionTimer),oN((function(e){t.emit(ON.CALL_ERROR,e),t.submitCallErrorMetric(e)}),hM.CALL_CONTROL,(function(e){setTimeout((function(){t.postStatus(),t.sendCallStateMachineEvt({type:"E_CALL_ESTABLISHED"})}),1e3*e)}),t.getCorrelationId(),r,t.handleCallEstablished.name,KO),e.next=14,mN({correlationId:t.correlationId,callId:t.callId});case 14:case"end":return e.stop()}}),e,null,[[0,7]])}))),6e5)}},{key:"handleUnknownState",value:(v=_e(Re().mark((function e(t){var r,n;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return cM.info("".concat(CO," with: ").concat(this.getCorrelationId()),{file:KO,method:EL}),null!=(r=t.data)&&r.media||cM.warn("Call failed due to signalling issue",{file:KO,method:EL}),e.prev=3,this.setDisconnectReason(),e.next=7,this.delete();case 7:n=e.sent,cM.log("handleOutgoingCallDisconnect: Response code: ".concat(n.statusCode),{file:KO,method:EL}),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(3),cM.warn("Failed to delete the call",{file:KO,method:EL});case 14:this.deleteCb(this.correlationId),this.sessionTimer&&clearInterval(this.sessionTimer),this.mediaConnection&&(this.mediaConnection.close(),cM.info("Closing media channel",{file:KO,method:EL})),this.sendMediaStateMachineEvt({type:"E_ROAP_TEARDOWN"}),this.sendCallStateMachineEvt({type:"E_CALL_CLEARED"});case 19:case"end":return e.stop()}}),e,this,[[3,11]])}))),function(e){return v.apply(this,arguments)})},{key:"getEmitterCallback",value:function(e){var t=this;return function(r){switch(t.callStateMachine.state.value){case"S_CALL_HOLD":return t.emit(ON.HOLD_ERROR,r),t.supplementaryServicesTimer&&(clearTimeout(t.supplementaryServicesTimer),t.supplementaryServicesTimer=void 0),t.submitCallErrorMetric(r),void t.sendCallStateMachineEvt({type:"E_CALL_ESTABLISHED",data:e});case"S_CALL_RESUME":return t.emit(ON.RESUME_ERROR,r),t.submitCallErrorMetric(r),void t.sendCallStateMachineEvt({type:"E_CALL_ESTABLISHED",data:e});default:t.emit(ON.CALL_ERROR,r),t.submitCallErrorMetric(r),t.connected||t.sendMediaStateMachineEvt({type:"E_ROAP_ERROR",data:e})}}}},{key:"handleRoapEstablished",value:(p=_e(Re().mark((function e(t,r){var n,i,o,a,s,c=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(cM.info("".concat(CO," with: ").concat(this.getCorrelationId()),{file:KO,method:_L}),n=r.data,i=n.received,o=n.message,this.receivedRoapOKSeq=o.seq,i){e.next=24;break}return cM.info("Sending Media Ok to the remote End",{file:KO,method:_L}),e.prev=5,"S_RECV_CALL_PROGRESS"!==this.callStateMachine.state.value&&"S_SEND_CALL_SETUP"!==this.callStateMachine.state.value||(cM.info("Media negotiation completed before call connect. Setting media negotiation completed flag.",{file:KO,method:_L}),this.mediaNegotiationCompleted=!0),o.seq=this.seq,e.next=10,this.postMedia(o);case 10:a=e.sent,cM.log("Response code: ".concat(a.statusCode),{file:KO,method:_L}),this.earlyMedia||this.mediaNegotiationCompleted||this.sendCallStateMachineEvt({type:"E_CALL_ESTABLISHED"}),e.next=22;break;case 15:return e.prev=15,e.t0=e.catch(5),cM.warn("Failed to process MediaOk request",{file:KO,method:_L}),s=e.t0,oN(this.getEmitterCallback(s),hM.MEDIA,(function(e){c.connected&&setTimeout((function(){c.sendMediaStateMachineEvt({type:"E_ROAP_OK",data:r.data})}),1e3*e)}),this.getCorrelationId(),s,this.handleRoapEstablished.name,KO),e.next=22,mN({correlationId:this.correlationId,callId:this.callId});case 22:e.next=29;break;case 24:cM.info("Notifying internal-media-core about ROAP OK message",{file:KO,method:_L}),o.seq=this.seq,this.mediaConnection&&this.mediaConnection.roapMessageReceived(o),this.earlyMedia||this.sendCallStateMachineEvt({type:"E_CALL_ESTABLISHED"}),this.remoteRoapMessage&&this.remoteRoapMessage.seq>this.seq&&("OFFER_REQUEST"===this.remoteRoapMessage.messageType?this.sendMediaStateMachineEvt({type:"E_RECV_ROAP_OFFER_REQUEST",data:this.remoteRoapMessage}):"OFFER"===this.remoteRoapMessage.messageType&&this.sendMediaStateMachineEvt({type:"E_RECV_ROAP_OFFER",data:this.remoteRoapMessage}));case 29:case"end":return e.stop()}}),e,this,[[5,15]])}))),function(e,t){return p.apply(this,arguments)})},{key:"handleRoapError",value:(h=_e(Re().mark((function e(t,r){var n,i,o,a=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(cM.info("".concat(CO," with: ").concat(this.getCorrelationId()),{file:KO,method:wL}),!(n=r.data)){e.next=17;break}return e.prev=3,e.next=6,this.postMedia(n);case 6:i=e.sent,cM.info("Response code: ".concat(i.statusCode),{file:KO,method:wL}),e.next=17;break;case 10:return e.prev=10,e.t0=e.catch(3),cM.warn("Failed to communicate ROAP error to Webex Calling",{file:KO,method:wL}),o=e.t0,oN((function(e){a.emit(ON.CALL_ERROR,e),a.submitCallErrorMetric(e)}),hM.MEDIA,(function(e){}),this.getCorrelationId(),o,this.handleRoapError.name,KO),e.next=17,mN({correlationId:this.correlationId,callId:this.callId});case 17:this.connected||(cM.warn("Call failed due to media issue",{file:KO,method:wL}),this.sendCallStateMachineEvt({type:"E_UNKNOWN",data:{media:!0}}));case 18:case"end":return e.stop()}}),e,this,[[3,10]])}))),function(e,t){return h.apply(this,arguments)})},{key:"handleOutgoingRoapOffer",value:(f=_e(Re().mark((function e(t,r){var n,i,o,a=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(cM.info("".concat(CO," with: ").concat(this.getCorrelationId()),{file:KO,method:RL}),null!=(n=r.data)&&n.sdp){e.next=6;break}return cM.info("Initializing Offer...",{file:KO,method:this.handleOutgoingRoapOffer.name}),this.mediaConnection.initiateOffer(),e.abrupt("return");case 6:return e.prev=6,e.next=9,this.postMedia(n);case 9:i=e.sent,cM.log("handleOutgoingRoapOffer: Response code: ".concat(i.statusCode),{file:KO,method:this.handleOutgoingRoapOffer.name}),e.next=20;break;case 13:return e.prev=13,e.t0=e.catch(6),cM.warn("Failed to process MediaOk request",{file:KO,method:this.handleOutgoingRoapOffer.name}),o=e.t0,oN(this.getEmitterCallback(o),hM.MEDIA,(function(e){a.connected&&setTimeout((function(){a.sendMediaStateMachineEvt({type:"E_SEND_ROAP_OFFER",data:r.data})}),1e3*e)}),this.getCorrelationId(),o,this.handleOutgoingRoapOffer.name,KO),e.next=20,mN({correlationId:this.correlationId,callId:this.callId});case 20:case"end":return e.stop()}}),e,this,[[6,13]])}))),function(e,t){return f.apply(this,arguments)})},{key:"handleOutgoingRoapAnswer",value:(d=_e(Re().mark((function e(t,r){var n,i,o,a=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return cM.info("".concat(CO," with: ").concat(this.getCorrelationId()),{file:KO,method:CL}),n=r.data,e.prev=2,n.seq=this.seq,e.next=6,this.postMedia(n);case 6:i=e.sent,cM.log("handleOutgoingRoapAnswer: Response code: ".concat(i.statusCode),{file:KO,method:this.handleOutgoingRoapAnswer.name}),e.next=17;break;case 10:return e.prev=10,e.t0=e.catch(2),cM.warn("Failed to send MediaAnswer request",{file:KO,method:this.handleOutgoingRoapAnswer.name}),o=e.t0,oN(this.getEmitterCallback(o),hM.MEDIA,(function(e){a.connected&&setTimeout((function(){a.sendMediaStateMachineEvt({type:"E_SEND_ROAP_ANSWER",data:r.data})}),1e3*e)}),this.getCorrelationId(),o,this.handleOutgoingRoapAnswer.name,KO),e.next=17,mN({correlationId:this.correlationId,callId:this.callId});case 17:case"end":return e.stop()}}),e,this,[[2,10]])}))),function(e,t){return d.apply(this,arguments)})},{key:"handleIncomingRoapOffer",value:function(e,t){cM.info("".concat(CO," with: ").concat(this.getCorrelationId()),{file:KO,method:TL});var r=t.data;this.remoteRoapMessage=r,this.mediaConnection?this.receivedRoapOKSeq===r.seq-2?(cM.info("Waiting for Roap OK, buffer the remote offer for later handling",{file:KO,method:this.handleIncomingRoapOffer.name}),this.remoteRoapMessage=r):(cM.info("Handling new offer...",{file:KO,method:this.handleIncomingRoapOffer.name}),this.seq=r.seq,this.mediaConnection&&this.mediaConnection.roapMessageReceived(r)):(cM.info("Media connection is not up, buffer the remote offer for later handling",{file:KO,method:this.handleIncomingRoapOffer.name}),this.seq=r.seq,cM.info("Setting Sequence No: ".concat(this.seq),{file:KO,method:this.handleIncomingRoapOffer.name}))}},{key:"handleIncomingRoapAnswer",value:function(e,t){cM.info("".concat(CO," with: ").concat(this.getCorrelationId()),{file:KO,method:xL});var r=t.data;this.remoteRoapMessage=r,r.seq=this.seq,this.mediaConnection&&this.mediaConnection.roapMessageReceived(r)}},{key:"initMediaConnection",value:function(e,t){var r=this,n=new jx({skipInactiveTransceivers:!0,iceServers:[],iceCandidatesTimeout:3e3,sdpMunging:{convertPort9to0:!0,addContentSlides:!1,copyClineToSessionLevel:!0}},{localTracks:{audio:e},direction:{audio:"sendrecv",video:"inactive",screenShareVideo:"inactive"}},t||"WebexCallSDK-".concat(this.correlationId),(function(e){return r.rtcMetrics.addMetrics(e)}),(function(){return r.rtcMetrics.closeMetrics()}),(function(){return r.rtcMetrics.sendMetricsInQueue()}));this.mediaConnection=n}},{key:"sendCallStateMachineEvt",value:function(e){this.callStateMachine.send(e)}},{key:"sendMediaStateMachineEvt",value:function(e){this.mediaStateMachine.send(e)}},{key:"setDisconnectReason",value:function(){this.mediaInactivity?(this.disconnectReason.code=GN.MEDIA_INACTIVITY,this.disconnectReason.cause=WN.MEDIA_INACTIVITY):this.connected||this.direction===TM.OUTBOUND?(this.disconnectReason.code=GN.NORMAL,this.disconnectReason.cause=WN.NORMAL):(this.disconnectReason.code=GN.BUSY,this.disconnectReason.cause=WN.BUSY)}},{key:"answer",value:(l=_e(Re().mark((function e(t){var r;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(cM.info("".concat(CO," with stream"),{file:KO,method:ML}),this.localAudioStream=t,r=t.outputStream.getAudioTracks()[0]){e.next=8;break}return cM.warn("Did not find a local track while answering the call ".concat(this.getCorrelationId()),{file:KO,method:ML}),this.mediaInactivity=!0,this.sendCallStateMachineEvt({type:"E_SEND_CALL_DISCONNECT"}),e.abrupt("return");case 8:r.enabled=!0,this.mediaConnection||(this.initMediaConnection(r),this.mediaRoapEventsListener(),this.mediaTrackListener(),this.registerListeners(t)),"S_SEND_CALL_PROGRESS"===this.callStateMachine.state.value?this.sendCallStateMachineEvt({type:"E_SEND_CALL_CONNECT"}):cM.warn("Call cannot be answered because the state is : ".concat(this.callStateMachine.state.value),{file:KO,method:ML});case 11:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"dial",value:(u=_e(Re().mark((function e(t){var r;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(cM.info("".concat(CO," with stream"),{file:KO,method:NL}),this.localAudioStream=t,r=t.outputStream.getAudioTracks()[0]){e.next=8;break}return cM.warn("Did not find a local track while dialing the call ".concat(this.getCorrelationId()),{file:KO,method:NL}),this.deleteCb(this.getCorrelationId()),this.emit(ON.DISCONNECT,this.getCorrelationId()),e.abrupt("return");case 8:r.enabled=!0,this.mediaConnection||(this.initMediaConnection(r),this.mediaRoapEventsListener(),this.mediaTrackListener(),this.registerListeners(t)),"S_ROAP_IDLE"===this.mediaStateMachine.state.value?this.sendMediaStateMachineEvt({type:"E_SEND_ROAP_OFFER"}):cM.warn("Call cannot be dialed because the state is already : ".concat(this.mediaStateMachine.state.value),{file:KO,method:NL});case 11:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"patch",value:(c=_e(Re().mark((function e(t){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return cM.info("Send a PATCH for ".concat(t," to Webex Calling"),{file:KO,method:this.patch.name}),e.abrupt("return",this.webex.request({uri:"".concat(this.mobiusUrl).concat(DO,"/").concat(this.deviceId,"/").concat(NO,"/").concat(this.callId),method:_M.PATCH,service:SM.MOBIUS,headers:C(C({},PO,this.webex.internal.device.url),jO,MO),body:{device:{deviceId:this.deviceId,correlationId:this.correlationId},callId:this.callId,callState:t,inbandMedia:!1}}));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"postSSRequest",value:(s=_e(Re().mark((function e(t,r){var n,i;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n={uri:"".concat(this.mobiusUrl).concat("services"),method:_M.POST,service:SM.MOBIUS,headers:C(C({},PO,this.webex.internal.device.url),jO,MO),body:{device:{deviceId:this.deviceId,correlationId:this.correlationId},callId:this.callId}},e.t0=r,e.next=e.t0===LN.HOLD?4:e.t0===LN.RESUME?6:e.t0===LN.TRANSFER?8:12;break;case 4:return n.uri="".concat(n.uri,"/").concat(UO,"/").concat("hold"),e.abrupt("break",13);case 6:return n.uri="".concat(n.uri,"/").concat(UO,"/").concat("resume"),e.abrupt("break",13);case 8:return n.uri="".concat(n.uri,"/").concat("calltransfer","/").concat("commit"),(i=t).destination?(tr()(n.body,{blindTransferContext:i}),tr()(n.body,{transferType:$N.BLIND})):i.transferToCallId&&(tr()(n.body,{consultTransferContext:i}),tr()(n.body,{transferType:$N.CONSULT})),e.abrupt("break",13);case 12:cM.warn("Unknown type for PUT request: ".concat(r),{file:KO,method:this.postSSRequest.name});case 13:return e.abrupt("return",this.webex.request(n));case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"postStatus",value:(a=_e(Re().mark((function e(){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.webex.request({uri:"".concat(this.mobiusUrl).concat(DO,"/").concat(this.deviceId,"/").concat(NO,"/").concat(this.callId,"/").concat("status"),method:_M.POST,service:SM.MOBIUS,headers:C(C({},PO,this.webex.internal.device.url),jO,MO),body:{device:{deviceId:this.deviceId,correlationId:this.correlationId},callId:this.callId}}));case 1:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"completeTransfer",value:(o=_e(Re().mark((function e(t,r,n){var i,o,a,s,c=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t!==$N.BLIND||!n){e.next=18;break}return cM.info("Initiating Blind transfer with : ".concat(n),{file:KO,method:this.completeTransfer.name}),i={transferorCallId:this.getCallId(),destination:n},e.prev=3,e.next=6,this.postSSRequest(i,LN.TRANSFER);case 6:this.metricManager.submitCallMetric(mO.CALL,yO.BLIND,vO.BEHAVIORAL,this.getCallId(),this.getCorrelationId(),void 0),e.next=16;break;case 9:return e.prev=9,e.t0=e.catch(3),cM.warn("Blind Transfer failed for correlationId ".concat(this.getCorrelationId()),{file:KO,method:this.completeTransfer.name}),o=e.t0,oN((function(e){c.emit(ON.TRANSFER_ERROR,e),c.submitCallErrorMetric(e,yO.BLIND)}),hM.CALL_CONTROL,(function(e){}),this.getCorrelationId(),o,this.completeTransfer.name,KO),e.next=16,mN({correlationId:this.correlationId,callId:this.callId});case 16:e.next=37;break;case 18:if(t!==$N.CONSULT||!r){e.next=36;break}return cM.info("Initiating Consult transfer between : ".concat(this.callId," and ").concat(r),{file:KO,method:this.completeTransfer.name}),a={transferorCallId:this.getCallId(),transferToCallId:r},e.prev=21,e.next=24,this.postSSRequest(a,LN.TRANSFER);case 24:this.metricManager.submitCallMetric(mO.CALL,yO.CONSULT,vO.BEHAVIORAL,this.getCallId(),this.getCorrelationId(),void 0),e.next=34;break;case 27:return e.prev=27,e.t1=e.catch(21),cM.warn("Consult Transfer failed for correlationId ".concat(this.getCorrelationId()),{file:KO,method:this.completeTransfer.name}),s=e.t1,oN((function(e){c.emit(ON.TRANSFER_ERROR,e),c.submitCallErrorMetric(e,yO.CONSULT)}),hM.CALL_CONTROL,(function(e){}),this.getCorrelationId(),s,this.completeTransfer.name,KO),e.next=34,mN({correlationId:this.correlationId,callId:this.callId});case 34:e.next=37;break;case 36:cM.warn("Invalid information received, transfer failed for correlationId: ".concat(this.getCorrelationId()),{file:KO,method:this.completeTransfer.name});case 37:case"end":return e.stop()}}),e,this,[[3,9],[21,27]])}))),function(e,t,r){return o.apply(this,arguments)})},{key:"getCallStats",value:(i=_e(Re().mark((function e(){var t;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.mediaConnection.getStats();case 3:t=e.sent,e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),cM.warn("Stats collection failed, using dummy stats",{file:KO,method:PL});case 9:return e.abrupt("return",uN(t));case 10:case"end":return e.stop()}}),e,this,[[0,6]])}))),function(){return i.apply(this,arguments)})},{key:"postMedia",value:(n=_e(Re().mark((function e(t){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return cM.log("Posting message to Webex Calling",{file:KO,method:DL}),e.abrupt("return",this.webex.request({uri:"".concat(this.mobiusUrl).concat(DO,"/").concat(this.deviceId,"/").concat(NO,"/").concat(this.callId,"/").concat("media"),method:_M.POST,service:SM.MOBIUS,headers:C(C({},PO,this.webex.internal.device.url),jO,MO),body:{device:{deviceId:this.deviceId,correlationId:this.correlationId},callId:this.callId,localMedia:{roap:t,mediaId:iF()}}}));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"mediaRoapEventsListener",value:function(){var e=this;this.mediaConnection.on(hR.ROAP_MESSAGE_TO_SEND,function(){var t=_e(Re().mark((function t(r){var n,i,o,a;return Re().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:cM.info("ROAP message to send (rcv from MEDIA-SDK) :\n \n type: ".concat(null===(n=r.roapMessage)||void 0===n?void 0:n.messageType,", seq: ").concat(r.roapMessage.seq," , version: ").concat(r.roapMessage.version),{file:KO,method:FL}),cM.info("SDP message to send : \n ".concat(null===(i=r.roapMessage)||void 0===i?void 0:i.sdp),{file:KO,method:FL}),t.t0=r.roapMessage.messageType,t.next=t.t0===HN.OK?5:t.t0===HN.OFFER?8:t.t0===HN.ANSWER?16:t.t0===HN.ERROR?20:t.t0===HN.OFFER_RESPONSE?22:26;break;case 5:return o={received:!1,message:r.roapMessage},e.sendMediaStateMachineEvt({type:"E_ROAP_OK",data:o}),t.abrupt("break",26);case 8:return cM.info("before modifying sdp: ".concat(r.roapMessage.sdp),{file:KO,method:e.mediaRoapEventsListener.name}),r.roapMessage.sdp=vN(r.roapMessage.sdp),a=r.roapMessage.sdp.replace(/^m=(video) (?:\d+) /gim,"m=$1 0 "),cM.info("after modification sdp: ".concat(a),{file:KO,method:e.mediaRoapEventsListener.name}),r.roapMessage.sdp=a,e.localRoapMessage=r.roapMessage,e.sendCallStateMachineEvt({type:"E_SEND_CALL_SETUP",data:r.roapMessage}),t.abrupt("break",26);case 16:return r.roapMessage.sdp=vN(r.roapMessage.sdp),e.localRoapMessage=r.roapMessage,e.sendMediaStateMachineEvt({type:"E_SEND_ROAP_ANSWER",data:r.roapMessage}),t.abrupt("break",26);case 20:return e.sendMediaStateMachineEvt({type:"E_ROAP_ERROR",data:r.roapMessage}),t.abrupt("break",26);case 22:return r.roapMessage.sdp=vN(r.roapMessage.sdp),e.localRoapMessage=r.roapMessage,e.sendMediaStateMachineEvt({type:"E_SEND_ROAP_OFFER",data:r.roapMessage}),t.abrupt("break",26);case 26:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},{key:"mediaTrackListener",value:function(){var e=this;this.mediaConnection.on(hR.REMOTE_TRACK_ADDED,(function(t){t.type===FN.MEDIA_TYPE_AUDIO&&e.emit(ON.REMOTE_MEDIA,t.track)}))}},{key:"unregisterListeners",value:function(){if(this.localAudioStream){var e=this.localAudioStream.getEffectByKind(aL);e&&(e.off(_A.Enabled,this.onEffectEnabled),e.off(_A.Disabled,this.onEffectDisabled)),this.localAudioStream.off(Um.EffectAdded,this.registerEffectListener),this.localAudioStream.off(Um.OutputTrackChange,this.updateTrack)}}},{key:"registerListeners",value:function(e){e.on(Um.OutputTrackChange,this.updateTrack),e.on(Um.EffectAdded,this.registerEffectListener);var t=e.getEffectByKind(aL);t&&(t.on(_A.Enabled,this.onEffectEnabled),t.on(_A.Disabled,this.onEffectDisabled),t.isEnabled&&this.onEffectEnabled())}},{key:"delete",value:(r=_e(Re().mark((function e(){var t;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getCallStats();case 2:return t=e.sent,e.abrupt("return",this.webex.request({uri:"".concat(this.mobiusUrl).concat(DO,"/").concat(this.deviceId,"/").concat(NO,"/").concat(this.callId),method:_M.DELETE,service:SM.MOBIUS,headers:C(C({},PO,this.webex.internal.device.url),jO,MO),body:{device:{deviceId:this.deviceId,correlationId:this.correlationId},callId:this.callId,metrics:t,causecode:this.disconnectReason.code,cause:this.disconnectReason.cause}}));case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"submitCallErrorMetric",value:function(e,t){var r;e.getCallError().errorLayer===hM.CALL_CONTROL?this.metricManager.submitCallMetric(mO.CALL_ERROR,t||this.callStateMachine.state.value.toString(),vO.BEHAVIORAL,this.callId,this.correlationId,e):this.metricManager.submitMediaMetric(mO.MEDIA_ERROR,this.mediaStateMachine.state.value.toString(),vO.BEHAVIORAL,this.callId,this.correlationId,this.localRoapMessage.sdp,null===(r=this.remoteRoapMessage)||void 0===r?void 0:r.sdp,e)}},{key:"handleMidCallEvent",value:function(e){var t=e.eventType,r=e.eventData;switch(t){case zN.CALL_INFO:cM.log("Received Midcall CallInfo Event for correlationId : ".concat(this.correlationId),{file:KO,method:UL});var n=r;this.startCallerIdResolution(n.callerId);break;case zN.CALL_STATE:cM.log("Received Midcall call event for correlationId : ".concat(this.correlationId),{file:KO,method:UL});var i=r;switch(i.callState){case MN.HELD:cM.log("Call is successfully held : ".concat(this.correlationId),{file:KO,method:UL}),this.emit(ON.HELD,this.correlationId),this.held=!0,this.supplementaryServicesTimer&&(clearTimeout(this.supplementaryServicesTimer),this.supplementaryServicesTimer=void 0);break;case MN.CONNECTED:cM.log("Call is successfully resumed : ".concat(this.correlationId),{file:KO,method:UL}),this.emit(ON.RESUMED,this.correlationId),this.held=!1,this.supplementaryServicesTimer&&(clearTimeout(this.supplementaryServicesTimer),this.supplementaryServicesTimer=void 0);break;default:cM.warn("Unknown Supplementary service state: ".concat(i.callState," for correlationId : ").concat(this.correlationId),{file:KO,method:UL})}break;default:cM.warn("Unknown Midcall type: ".concat(t," for correlationId : ").concat(this.correlationId),{file:KO,method:UL})}}},{key:"startCallerIdResolution",value:function(e){this.callerInfo=this.callerId.fetchCallerDetails(e)}},{key:"sendDigit",value:function(e){cM.info("".concat(CO," with: ").concat(e),{file:KO,method:BL});try{this.mediaConnection.insertDTMF(e)}catch(e){cM.warn("Unable to send digit on call: ".concat(e.message),{file:KO,method:BL})}}},{key:"setBroadworksCorrelationInfo",value:function(e){this.broadworksCorrelationInfo=e}},{key:"getBroadworksCorrelationInfo",value:function(){return this.broadworksCorrelationInfo}},{key:"getCallRtpStats",value:function(){return this.getCallStats()}},{key:"handleTimeout",value:(t=_e(Re().mark((function e(){var t;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return cM.warn("Call timed out",{file:KO,method:SL}),this.deleteCb(this.getCorrelationId()),this.emit(ON.DISCONNECT,this.getCorrelationId()),e.next=5,this.delete();case 5:t=e.sent,cM.log("Response code: ".concat(t.statusCode),{file:KO,method:SL});case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),R}(jN);function dF(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var fF=function(e){Je(r,e);var t=dF(r);function r(e,n){var i;return ne(this,r),C(Ye(i=t.call(this)),"sdkConnector",void 0),C(Ye(i),"webex",void 0),C(Ye(i),"callCollection",void 0),C(Ye(i),"activeMobiusUrl",void 0),C(Ye(i),"serviceIndicator",void 0),C(Ye(i),"lineDict",void 0),C(Ye(i),"createCall",(function(e,t,r,n){cM.info("".concat(CO," with ").concat(e,", ").concat(t," and ").concat(r),{file:$O,method:cL}),cM.log("Creating call object",{});var o=function(e,t,r,n,i,o,a,s){return new lF(e,t,r,n,i,o,a,s)}(i.activeMobiusUrl,i.webex,e,t,r,(function(e){delete i.callCollection[e];var t=l()(i.getActiveCalls()).length;cM.info("DELETE:: Deleted corelationId: ".concat(o.getCorrelationId()," from CallManager, Number of call records :- ").concat(t),{}),0===t&&(i.emit(AN.ALL_CALLS_CLEARED),cM.log("All calls have been cleared",{file:$O,method:cL}))}),i.serviceIndicator,n);return i.callCollection[o.getCorrelationId()]=o,cM.log("New call created with correlationId: ".concat(o.getCorrelationId()),{}),cM.info("ADD:: Added corelationId: ".concat(o.getCorrelationId()," to CallManager , Number of call records now:- ").concat(l()(i.getActiveCalls()).length),{}),o})),C(Ye(i),"getCall",(function(e){return i.callCollection[e]})),C(Ye(i),"getActiveCalls",(function(){return i.callCollection})),i.sdkConnector=VM,i.serviceIndicator=n,i.sdkConnector.getWebex()||VM.setWebex(e),i.lineDict={},i.webex=i.sdkConnector.getWebex(),i.callCollection={},i.activeMobiusUrl="",i.listenForWsEvents(),i}return oe(r,[{key:"updateActiveMobius",value:function(e){this.activeMobiusUrl=e,cM.log("Successfully updated active Mobius URL to: ".concat(e),{file:$O,method:IL})}},{key:"listenForWsEvents",value:function(){var e=this;this.sdkConnector.registerListener("event:mobius",function(){var t=_e(Re().mark((function t(r){return Re().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.dequeueWsEvents(r);case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),cM.info("Successfully registered listener for Mobius events",{file:$O,method:rM})}},{key:"dequeueWsEvents",value:function(e){var t=this;cM.info("".concat(CO," with event ").concat(e),{file:$O,method:AL});var r=e,n=r.data,i=n.callId,o=n.correlationId;switch(r.data.eventType){case qN.CALL_SETUP:if(cM.log("Received call Setup message for call: ".concat(i),{file:$O,method:AL}),r.data.midCallService)return void r.data.midCallService.forEach((function(e){var r=t.getCall(o);r?r.handleMidCallEvent(e):cM.info("Dropping midcall event of type: ".concat(e.eventType," as it doesn't match with any existing call"),{file:$O,method:AL})}));var a,s=l()(this.callCollection).find((function(e){return t.callCollection[e].getCallId()===i}));if(s)cM.info("Found the call Object with a matching callId: ".concat(i," from our records with correlationId: ").concat(s),{file:$O,method:AL}),a=this.getCall(s);else{var c=this.getLineId(r.data.deviceId);a=this.createCall(TM.INBOUND,r.data.deviceId,c,{}),cM.log("New incoming call created with correlationId from Call Setup message: ".concat(a.getCorrelationId()),{file:$O,method:AL}),a.setCallId(i),r.data.broadworksCorrelationInfo&&(cM.info("Found broadworksCorrelationInfo: ".concat(r.data.broadworksCorrelationInfo),{file:$O,method:AL}),a.setBroadworksCorrelationInfo(r.data.broadworksCorrelationInfo))}r.data.callerId&&(cM.info("Processing Caller-Id data",{file:$O,method:AL}),a.startCallerIdResolution(r.data.callerId)),this.emit(IN.INCOMING_CALL,a),a.sendCallStateMachineEvt({type:"E_RECV_CALL_SETUP",data:r.data});break;case qN.CALL_PROGRESS:cM.log("Received call progress mobiusEvent for call: ".concat(o),{file:$O,method:AL}),this.getCall(o).sendCallStateMachineEvt({type:"E_RECV_CALL_PROGRESS",data:r.data});break;case qN.CALL_MEDIA:var u;if(cM.log("Received call media mobiusEvent for call: ".concat(o),{file:$O,method:AL}),o)u=this.getCall(o);else{var d=l()(this.callCollection).find((function(e){return t.callCollection[e].getCallId()===i}));if(d)cM.info("Found the call Object with a matching callId: ".concat(i," from our records with correlationId: ").concat(d),{file:$O,method:AL}),u=this.getCall(d);else{var f=this.getLineId(r.data.deviceId);u=this.createCall(TM.INBOUND,r.data.deviceId,f,{}),cM.log("New incoming call created with correlationId from ROAP Message: ".concat(u.getCorrelationId()),{file:$O,method:AL}),u.setCallId(i)}}if(u){var h,p,v,m,g;cM.info("SDP from mobius ".concat(null===(h=r.data.message)||void 0===h?void 0:h.sdp),{file:$O,method:AL}),cM.log("ROAP message from mobius with type: ".concat(null===(p=r.data.message)||void 0===p?void 0:p.messageType,", seq: ").concat(null===(v=r.data.message)||void 0===v?void 0:v.seq," , version: ").concat(null===(m=r.data.message)||void 0===m?void 0:m.version),{file:$O,method:AL});var y=null===(g=r.data.message)||void 0===g?void 0:g.messageType;switch(y){case VN.OFFER:cM.log("Received OFFER",{file:$O,method:AL}),u.sendMediaStateMachineEvt({type:"E_RECV_ROAP_OFFER",data:r.data.message});break;case VN.ANSWER:cM.log("Received ANSWER",{file:$O,method:AL}),u.sendMediaStateMachineEvt({type:"E_RECV_ROAP_ANSWER",data:r.data.message});break;case VN.OFFER_REQUEST:cM.log("Received OFFER_REQUEST",{file:$O,method:AL}),u.sendMediaStateMachineEvt({type:"E_RECV_ROAP_OFFER_REQUEST",data:r.data.message});break;case VN.OK:cM.log("Received OK",{file:$O,method:AL});var b={received:!0,message:r.data.message};u.sendMediaStateMachineEvt({type:"E_ROAP_OK",data:b});break;case VN.ERROR:cM.log("Received Error...",{file:$O,method:AL});break;default:cM.log("Unknown Media mobiusEvent: ".concat(y," "),{file:$O,method:AL})}}else cM.info("CorrelationId: ".concat(o," doesn't exist , discarding.."),{file:$O,method:AL});break;case qN.CALL_CONNECTED:cM.log("Received call connect for call: ".concat(o),{file:$O,method:AL}),this.getCall(o).sendCallStateMachineEvt({type:"E_RECV_CALL_CONNECT",data:r.data});break;case qN.CALL_DISCONNECTED:cM.log("Received call disconnect for call: ".concat(o),{file:$O,method:AL});var E=this.getCall(o);E&&E.sendCallStateMachineEvt({type:"E_RECV_CALL_DISCONNECT"});break;default:cM.log("Unknown Call Event mobiusEvent: ".concat(r.data.eventType),{file:$O,method:AL})}}},{key:"updateLine",value:function(e,t){this.lineDict[e]=t,cM.log("Successfully updated line for deviceId: ".concat(e),{file:$O,method:OL})}},{key:"getLineId",value:function(e){return this.lineDict[e].lineId}}]),r}(jN),hF=function(e,t){return uF||(uF=new fF(e,t)),uF};function pF(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function vF(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,pF(e,t,"get"))}function mF(e,t,r){return function(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}(e,pF(e,t,"set"),r),r}function gF(e,t){var r=void 0!==Yr()&&e[Xr()]||e["@@iterator"];if(!r){if(en()(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return yF(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return $r()(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return yF(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function yF(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function bF(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function EF(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?bF(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):bF(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}var SF=function(){function e(t,r,n,i,o,a){ne(this,e),C(this,"sdkConnector",void 0),C(this,"webex",void 0),C(this,"userId",""),C(this,"serviceData",void 0),C(this,"failback429RetryAttempts",void 0),C(this,"registrationStatus",void 0),C(this,"failbackTimer",void 0),C(this,"activeMobiusUrl",void 0),C(this,"rehomingIntervalMin",void 0),C(this,"rehomingIntervalMax",void 0),C(this,"mutex",void 0),C(this,"metricManager",void 0),C(this,"lineEmitter",void 0),C(this,"callManager",void 0),C(this,"deviceInfo",{}),C(this,"primaryMobiusUris",void 0),C(this,"backupMobiusUris",void 0),C(this,"registerRetry",!1),C(this,"reconnectPending",!1),C(this,"jwe",void 0),C(this,"isCCFlow",!1),C(this,"failoverImmediately",!1),C(this,"retryAfter",void 0),C(this,"scheduled429Retry",!1),C(this,"webWorker",void 0),this.jwe=a,this.sdkConnector=VM,this.serviceData=r,this.isCCFlow=r.indicator===IM.CONTACT_CENTER,this.sdkConnector.getWebex()||VM.setWebex(t),this.webex=this.sdkConnector.getWebex(),this.userId=this.webex.internal.device.userId,this.registrationStatus=wM.IDLE,this.failback429RetryAttempts=0,cM.setLogger(o,YO),this.rehomingIntervalMin=60,this.rehomingIntervalMax=120,this.mutex=n,this.callManager=hF(this.webex,r.indicator),this.metricManager=fM(this.webex,r.indicator),this.lineEmitter=i,this.primaryMobiusUris=[],this.backupMobiusUris=[]}var t,r,n,i,o,a,s,c,u,d,f,h,p,v;return oe(e,[{key:"getActiveMobiusUrl",value:function(){return this.activeMobiusUrl}},{key:"setActiveMobiusUrl",value:function(e){cM.info("".concat(CO," with ").concat(e),{method:IL,file:YO}),this.activeMobiusUrl=e,this.callManager.updateActiveMobius(e)}},{key:"setMobiusServers",value:function(e,t){cM.log(CO,{method:$L,file:YO}),this.primaryMobiusUris=e,this.backupMobiusUris=t}},{key:"deleteRegistration",value:(v=_e(Re().mark((function e(t,r,n){var i,o;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.t0=fetch,e.t1="".concat(t).concat(DO,"/").concat(r),e.t2=_M.DELETE,e.t3=C,e.t4=C,e.t5=C,e.t6=C({},PO,n),e.next=10,this.webex.credentials.getUserToken();case 10:return e.t7=e.sent,e.t8=(0,e.t5)(e.t6,"Authorization",e.t7),e.t9="".concat("webex-web-client","_").concat(iF()),e.t10=(0,e.t4)(e.t8,"trackingId",e.t9),e.t11=jO,e.t12=MO,e.t13=(0,e.t3)(e.t10,e.t11,e.t12),e.t14={method:e.t2,headers:e.t13},e.next=20,(0,e.t0)(e.t1,e.t14);case 20:o=e.sent,e.next=26;break;case 23:e.prev=23,e.t15=e.catch(0),cM.warn("Delete failed with Mobius ".concat(e.t15),{file:YO,method:WL});case 26:return this.setStatus(wM.INACTIVE),this.lineEmitter(xN.UNREGISTERED),e.abrupt("return",null===(i=o)||void 0===i?void 0:i.json());case 29:case"end":return e.stop()}}),e,this,[[0,23]])}))),function(e,t,r){return v.apply(this,arguments)})},{key:"postRegistration",value:(p=_e(Re().mark((function e(t){var r;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={userId:this.userId,clientDeviceUri:this.webex.internal.device.url,serviceData:this.jwe?EF(EF({},this.serviceData),{},{jwe:this.jwe}):this.serviceData},e.abrupt("return",this.webex.request({uri:"".concat(t,"device"),method:_M.POST,headers:C(C({},PO,r.clientDeviceUri),jO,MO),body:r,service:SM.MOBIUS}));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"restorePreviousRegistration",value:(h=_e(Re().mark((function e(t){var r;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!1,!this.activeMobiusUrl){e.next=5;break}return e.next=4,this.attemptRegistrationWithServers(t,[this.activeMobiusUrl]);case 4:r=e.sent;case 5:return e.abrupt("return",r);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"handle429Retry",value:(f=_e(Re().mark((function e(t,r){var n;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r!==rL){e.next=17;break}if(!(this.failback429RetryAttempts>=5)){e.next=3;break}return e.abrupt("return");case 3:return this.clearFailbackTimer(),this.failback429RetryAttempts+=1,cM.log("Received 429 while rehoming, 429 retry count : ".concat(this.failback429RetryAttempts),{file:YO,method:nL}),n=this.getRegRetryInterval(this.failback429RetryAttempts),this.startFailbackTimer(n),this.scheduled429Retry=!0,e.next=11,this.restorePreviousRegistration(nL);case 11:if(e.sent||this.isDeviceRegistered()){e.next=15;break}return e.next=15,this.restartRegistration(nL);case 15:e.next=18;break;case 17:this.retryAfter=t;case 18:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"getRegRetryInterval",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return 30+Math.pow(2,e)+Math.floor((9001*Math.random()+XO)/XO)}},{key:"startFailoverTimer",value:(d=_e(Re().mark((function e(){var t,r,n,i,o,a,s=this,c=arguments;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=c.length>0&&void 0!==c[0]?c[0]:1,r=c.length>1&&void 0!==c[1]?c[1]:0,n={file:YO,method:iL},i=this.getRegRetryInterval(t),r+i>114&&(i-=r+i-114),null!=this.retryAfter&&i<this.retryAfter&&(this.failoverImmediately=this.retryAfter+r>114),!(i>30)||this.failoverImmediately){e.next=14;break}a=Math.floor(Ln()()/1e3),null!=this.retryAfter&&(i=Math.max(i,this.retryAfter)),setTimeout(_e(Re().mark((function e(){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.mutex.runExclusive(_e(Re().mark((function e(){var n;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.attemptRegistrationWithServers(iL);case 2:if(o=e.sent,n=Math.floor(Ln()()/1e3),o||s.isDeviceRegistered()){e.next=7;break}return e.next=7,s.startFailoverTimer(t+1,r+(n-a));case 7:case"end":return e.stop()}}),e)}))));case 2:case"end":return e.stop()}}),e)}))),i*XO),cM.log("Scheduled retry with primary in ".concat(i," seconds, number of attempts : ").concat(t),n),e.next=26;break;case 14:if(!this.backupMobiusUris.length){e.next=23;break}return cM.info("Failing over to backup servers.",n),this.failoverImmediately=!1,e.next=19,this.attemptRegistrationWithServers(iL,this.backupMobiusUris);case 19:(o=e.sent)||this.isDeviceRegistered()||(i=this.getRegRetryInterval(),null!=this.retryAfter&&this.retryAfter<60&&(i=i<this.retryAfter?this.retryAfter:i),setTimeout(_e(Re().mark((function e(){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.mutex.runExclusive(_e(Re().mark((function e(){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.attemptRegistrationWithServers(iL,s.backupMobiusUris);case 2:if((o=e.sent)||s.isDeviceRegistered()){e.next=7;break}return e.next=6,mN();case 6:eN((function(e){s.lineEmitter(xN.ERROR,void 0,e)}),n);case 7:case"end":return e.stop()}}),e)}))));case 2:case"end":return e.stop()}}),e)}))),i*XO),cM.log("Scheduled retry with backup servers in ".concat(i," seconds."),n)),e.next=26;break;case 23:return e.next=25,mN();case 25:eN((function(e){s.lineEmitter(xN.ERROR,void 0,e)}),n);case 26:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"clearFailbackTimer",value:function(){this.failbackTimer&&(clearTimeout(this.failbackTimer),this.failbackTimer=void 0)}},{key:"isPrimaryActive",value:(u=_e(Re().mark((function e(){var t,r,n,i,o;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=gF(this.primaryMobiusUris),e.prev=1,r.s();case 3:if((n=r.n()).done){e.next=23;break}return i=n.value,e.prev=5,o=i.replace(qO,"/"),e.next=9,this.webex.request({uri:"".concat(o,"ping"),method:_M.GET,headers:C(C({},PO,this.webex.internal.device.url),jO,MO),service:SM.MOBIUS});case 9:if(200!==e.sent.statusCode){e.next=15;break}return cM.info("Ping successful for primary Mobius: ".concat(i),{file:YO,method:rL}),t="up",e.abrupt("break",23);case 15:e.next=21;break;case 17:e.prev=17,e.t0=e.catch(5),cM.warn("Ping failed for primary Mobius: ".concat(i," with error: ").concat(e.t0),{file:YO,method:rL}),t="down";case 21:e.next=3;break;case 23:e.next=28;break;case 25:e.prev=25,e.t1=e.catch(1),r.e(e.t1);case 28:return e.prev=28,r.f(),e.finish(28);case 31:return e.abrupt("return","up"===t);case 32:case"end":return e.stop()}}),e,this,[[1,25,28,31],[5,17]])}))),function(){return u.apply(this,arguments)})},{key:"isFailbackRequired",value:function(){return this.isDeviceRegistered()&&-1===this.primaryMobiusUris.indexOf(this.activeMobiusUrl)}},{key:"getFailbackInterval",value:function(){return Math.floor(Math.random()*(this.rehomingIntervalMax-this.rehomingIntervalMin+1)+this.rehomingIntervalMin)}},{key:"initiateFailback",value:function(){if(this.isFailbackRequired()){if(!this.failbackTimer){this.failback429RetryAttempts=0;var e=this.getFailbackInterval();this.startFailbackTimer(60*e)}}else this.failback429RetryAttempts=0,this.clearFailbackTimer()}},{key:"startFailbackTimer",value:function(e){var t=this;this.failbackTimer=setTimeout(_e(Re().mark((function e(){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t.executeFailback());case 1:case"end":return e.stop()}}),e)}))),e*XO),cM.log("Failback scheduled after ".concat(e," seconds."),{file:YO,method:this.startFailbackTimer.name})}},{key:"executeFailback",value:(c=_e(Re().mark((function e(){var t=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.mutex.runExclusive(_e(Re().mark((function e(){var r,n;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.isFailbackRequired()){e.next=31;break}return e.next=3,t.isPrimaryActive();case 3:if(r=e.sent,0!==l()(t.callManager.getActiveCalls()).length||!r){e.next=28;break}return cM.info("Attempting failback to primary.",{file:YO,method:t.executeFailback.name}),e.next=8,t.deregister();case 8:return e.next=10,t.attemptRegistrationWithServers(rL);case 10:if(n=e.sent,!(t.scheduled429Retry||n||t.isDeviceRegistered())){e.next=13;break}return e.abrupt("return");case 13:return e.next=15,t.restorePreviousRegistration(rL);case 15:if(!e.sent){e.next=19;break}return t.clearFailbackTimer(),e.abrupt("return");case 19:if(t.isDeviceRegistered()){e.next=24;break}return e.next=22,t.restartRegistration(t.executeFailback.name);case 22:e.next=26;break;case 24:t.failbackTimer=void 0,t.initiateFailback();case 26:e.next=31;break;case 28:cM.info("Active calls present or primary Mobius is down, deferring failback to next cycle.",{file:YO,method:t.executeFailback.name}),t.failbackTimer=void 0,t.initiateFailback();case 31:case"end":return e.stop()}}),e)}))));case 2:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"setIntervalValues",value:function(e){-1!==this.primaryMobiusUris.indexOf(this.activeMobiusUrl)&&(this.rehomingIntervalMin=null!=e&&e.rehomingIntervalMin?e.rehomingIntervalMin:60,this.rehomingIntervalMax=null!=e&&e.rehomingIntervalMax?e.rehomingIntervalMax:120)}},{key:"getDeviceInfo",value:function(){return this.deviceInfo}},{key:"isDeviceRegistered",value:function(){return this.registrationStatus===wM.ACTIVE}},{key:"getStatus",value:function(){return this.registrationStatus}},{key:"setStatus",value:function(e){this.registrationStatus=e}},{key:"restartRegistration",value:(s=_e(Re().mark((function e(t){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.clearFailbackTimer(),this.failback429RetryAttempts=0,e.next=4,this.attemptRegistrationWithServers(t,this.primaryMobiusUris);case 4:if(e.sent||this.isDeviceRegistered()){e.next=8;break}return e.next=8,this.startFailoverTimer();case 8:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"handleConnectionRestoration",value:(a=_e(Re().mark((function e(t){var r=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return cM.info(CO,{method:JL,file:YO}),e.next=3,this.mutex.runExclusive(_e(Re().mark((function e(){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=14;break}if(cM.log("Mercury connection is up again, re-registering with Webex Calling if needed",{file:YO,method:r.handleConnectionRestoration.name}),r.clearKeepaliveTimer(),!r.isDeviceRegistered()){e.next=6;break}return e.next=6,r.deregister();case 6:if(!r.activeMobiusUrl){e.next=13;break}return e.next=9,r.restorePreviousRegistration(r.handleConnectionRestoration.name);case 9:if(e.sent||r.isDeviceRegistered()){e.next=13;break}return e.next=13,r.restartRegistration(r.handleConnectionRestoration.name);case 13:t=!1;case 14:case"end":return e.stop()}}),e)}))));case 3:return e.abrupt("return",t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"restoreRegistrationCallBack",value:function(){var e=this;return function(){var t=_e(Re().mark((function t(r,n){var i,o;return Re().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i={file:YO,method:n},e.isRegRetry()){t.next=17;break}if(cM.info("Registration restoration in progress.",i),!e.getExistingDevice(r)){t.next=14;break}return e.setRegRetry(!0),t.next=8,e.deregister();case 8:return t.next=10,e.restorePreviousRegistration(n);case 10:return o=t.sent,e.setRegRetry(!1),e.isDeviceRegistered()&&cM.info("Registration restored successfully.",i),t.abrupt("return",o);case 14:e.lineEmitter(xN.UNREGISTERED),t.next=18;break;case 17:e.lineEmitter(xN.UNREGISTERED);case 18:return t.abrupt("return",!1);case 19:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()}},{key:"triggerRegistration",value:(o=_e(Re().mark((function e(){var t;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this.primaryMobiusUris.length>0)){e.next=7;break}return e.next=3,this.attemptRegistrationWithServers("triggerRegistration",this.primaryMobiusUris);case 3:if(t=e.sent,this.isDeviceRegistered()||t){e.next=7;break}return e.next=7,this.startFailoverTimer();case 7:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"attemptRegistrationWithServers",value:(i=_e(Re().mark((function e(t){var r,n,i,o,a,s=this,c=arguments;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=c.length>1&&void 0!==c[1]?c[1]:this.primaryMobiusUris,n=!1,this.retryAfter=void 0,!this.failoverImmediately){e.next=5;break}return e.abrupt("return",n);case 5:if(!this.isDeviceRegistered()){e.next=8;break}return cM.info("[".concat(t,"] : Device already registered with : ").concat(this.activeMobiusUrl),{file:YO,method:ZO}),e.abrupt("return",n);case 8:i=gF(r),e.prev=9,a=Re().mark((function e(){var r,i,a,c,u,l,d,f,h;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=o.value,a=(s.primaryMobiusUris.includes(i)?"PRIMARY":(null===(r=s.backupMobiusUris)||void 0===r?void 0:r.includes(i))&&"BACKUP")||"UNKNOWN",e.prev=2,n=!1,s.registrationStatus=wM.INACTIVE,s.lineEmitter(xN.CONNECTING),cM.info("[".concat(t,"] : Mobius url to contact: ").concat(i),{file:YO,method:ZO}),e.next=9,s.postRegistration(i);case 9:return f=e.sent,s.deviceInfo=f.body,s.registrationStatus=wM.ACTIVE,s.lineEmitter(xN.REGISTERED,f.body),cM.log("Registration successful for deviceId: ".concat(null===(c=s.deviceInfo.device)||void 0===c?void 0:c.deviceId," userId: ").concat(s.userId),{file:YO,method:GL}),s.setActiveMobiusUrl(i),s.setIntervalValues(s.deviceInfo),s.metricManager.setDeviceInfo(s.deviceInfo),s.metricManager.submitRegistrationMetric(mO.REGISTRATION,gO.REGISTER,vO.BEHAVIORAL,t,a,null!==(u=null===(l=f.headers)||void 0===l?void 0:l.trackingid)&&void 0!==u?u:"",void 0,void 0),s.startKeepaliveTimer(null===(d=s.deviceInfo.device)||void 0===d?void 0:d.uri,s.deviceInfo.keepaliveInterval,a),s.initiateFailback(),e.abrupt("return",0);case 23:return e.prev=23,e.t0=e.catch(2),h=e.t0,e.next=28,tN(h,(function(e,r){var n,i;r?s.lineEmitter(xN.ERROR,void 0,e):s.lineEmitter(xN.UNREGISTERED),s.metricManager.submitRegistrationMetric(mO.REGISTRATION_ERROR,gO.REGISTER,vO.BEHAVIORAL,t,a,null!==(n=null===(i=h.headers)||void 0===i?void 0:i.trackingid)&&void 0!==n?n:"",void 0,e)}),{method:t,file:YO},(function(e,t){return s.handle429Retry(e,t)}),s.restoreRegistrationCallBack());case 28:if(n=e.sent,s.registrationStatus!==wM.ACTIVE){e.next=32;break}return cM.info("[".concat(t,"] : Device is already restored, active mobius url: ").concat(s.activeMobiusUrl),{file:YO,method:s.attemptRegistrationWithServers.name}),e.abrupt("return",0);case 32:if(!n){e.next=35;break}return s.setStatus(wM.INACTIVE),e.abrupt("return",0);case 35:case"end":return e.stop()}}),e,null,[[2,23]])})),i.s();case 12:if((o=i.n()).done){e.next=19;break}return e.delegateYield(a(),"t0",14);case 14:if(0!==e.t0){e.next=17;break}return e.abrupt("break",19);case 17:e.next=12;break;case 19:e.next=24;break;case 21:e.prev=21,e.t1=e.catch(9),i.e(e.t1);case 24:return e.prev=24,i.f(),e.finish(24);case 27:return e.abrupt("return",n);case 28:case"end":return e.stop()}}),e,this,[[9,21,24,27]])}))),function(e){return i.apply(this,arguments)})},{key:"startKeepaliveTimer",value:(n=_e(Re().mark((function e(t,r,n){var i,o=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.clearKeepaliveTimer(),i=this.isCCFlow?4:5,e.next=4,this.mutex.runExclusive(_e(Re().mark((function e(){var a,s,c;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!o.isDeviceRegistered()){e.next=5;break}return e.next=3,o.webex.credentials.getUserToken();case 3:a=e.sent,o.webWorker||(s=new Blob(["/* eslint-env worker */\n\nconst uuid = () => {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n};\n\n// Enum values from the original imports\nconst HTTP_METHODS = {\n GET: 'GET',\n POST: 'POST',\n PUT: 'PUT',\n DELETE: 'DELETE',\n PATCH: 'PATCH',\n};\n\nconst WorkerMessageType = {\n START_KEEPALIVE: 'START_KEEPALIVE',\n CLEAR_KEEPALIVE: 'CLEAR_KEEPALIVE',\n KEEPALIVE_SUCCESS: 'KEEPALIVE_SUCCESS',\n KEEPALIVE_FAILURE: 'KEEPALIVE_FAILURE',\n};\n\nlet keepaliveTimer;\n\nconst messageHandler = (event) => {\n const {type} = event.data;\n\n const postKeepAlive = async (accessToken, deviceUrl, url) => {\n const response = await fetch(`${url}/status`, {\n method: HTTP_METHODS.POST,\n headers: {\n 'cisco-device-url': deviceUrl,\n 'spark-user-agent': 'webex-calling/beta',\n Authorization: `${accessToken}`,\n trackingId: `web_worker_${uuid()}`,\n },\n });\n\n if (!response.ok) {\n throw new Error(`Keepalive failed with status: ${response.status}`);\n }\n\n return response;\n };\n\n if (type === WorkerMessageType.START_KEEPALIVE) {\n let keepAliveRetryCount = 0;\n const {accessToken, deviceUrl, interval, retryCountThreshold, url} = event.data;\n\n if (keepaliveTimer) {\n clearInterval(keepaliveTimer);\n keepaliveTimer = undefined;\n }\n\n keepaliveTimer = setInterval(async () => {\n if (keepAliveRetryCount < retryCountThreshold) {\n try {\n const res = await postKeepAlive(accessToken, deviceUrl, url);\n const statusCode = res.status;\n if (keepAliveRetryCount > 0) {\n self.postMessage({\n type: WorkerMessageType.KEEPALIVE_SUCCESS,\n statusCode,\n });\n }\n keepAliveRetryCount = 0;\n } catch (err) {\n keepAliveRetryCount += 1;\n self.postMessage({\n type: WorkerMessageType.KEEPALIVE_FAILURE,\n err,\n keepAliveRetryCount,\n });\n }\n }\n }, interval * 1000);\n }\n\n if (type === WorkerMessageType.CLEAR_KEEPALIVE) {\n if (keepaliveTimer) {\n clearInterval(keepaliveTimer);\n keepaliveTimer = undefined;\n }\n }\n};\n\nself.addEventListener('message', messageHandler);\n"],{type:"application/javascript"}),c=URL.createObjectURL(s),o.webWorker=new Worker(c),URL.revokeObjectURL(c),o.webWorker.postMessage({type:OM.START_KEEPALIVE,accessToken:String(a),deviceUrl:String(o.webex.internal.device.url),interval:r,retryCountThreshold:i,url:t}),o.webWorker.onmessage=function(){var e=_e(Re().mark((function e(t){var r,a,s;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r={file:YO,method:o.startKeepaliveTimer.name},t.data.type===OM.KEEPALIVE_SUCCESS&&(cM.info("Sent Keepalive, status: ".concat(t.data.statusCode),r),o.lineEmitter(xN.RECONNECTED)),t.data.type!==OM.KEEPALIVE_FAILURE){e.next=20;break}return a=t.data.err,cM.warn("Keep-alive missed ".concat(t.data.keepAliveRetryCount," times. Status -> ").concat(a.statusCode," "),r),e.next=7,tN(a,(function(e,r){var i,s;r&&o.lineEmitter(xN.ERROR,void 0,e),o.metricManager.submitRegistrationMetric(mO.REGISTRATION,gO.KEEPALIVE_FAILURE,vO.BEHAVIORAL,tL,n,null!==(i=null===(s=a.headers)||void 0===s?void 0:s.trackingid)&&void 0!==i?i:"",t.data.keepAliveRetryCount,e)}),{method:tL,file:YO});case 7:if(!((s=e.sent)||t.data.keepAliveRetryCount>=i)){e.next=19;break}if(o.failoverImmediately=o.isCCFlow,o.setStatus(wM.INACTIVE),o.clearKeepaliveTimer(),o.clearFailbackTimer(),o.lineEmitter(xN.UNREGISTERED),s){e.next=17;break}return e.next=17,o.reconnectOnFailure(tL);case 17:e.next=20;break;case 19:o.lineEmitter(xN.RECONNECTING);case 20:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 5:case"end":return e.stop()}}),e)}))));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"clearKeepaliveTimer",value:function(){this.webWorker&&(this.webWorker.postMessage({type:OM.CLEAR_KEEPALIVE}),this.webWorker.terminate(),this.webWorker=void 0)}},{key:"isReconnectPending",value:function(){return this.reconnectPending}},{key:"deregister",value:(r=_e(Re().mark((function e(){var t,r;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.deleteRegistration(this.activeMobiusUrl,null===(t=this.deviceInfo.device)||void 0===t?void 0:t.deviceId,null===(r=this.deviceInfo.device)||void 0===r?void 0:r.clientDeviceUri);case 3:cM.log("Registration successfully deregistered",{file:YO,method:WL}),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),cM.warn("Delete failed with Mobius: ".concat(e.t0),{file:YO,method:WL});case 9:this.clearKeepaliveTimer(),this.setStatus(wM.INACTIVE);case 11:case"end":return e.stop()}}),e,this,[[0,6]])}))),function(){return r.apply(this,arguments)})},{key:"isRegRetry",value:function(){return this.registerRetry}},{key:"setRegRetry",value:function(e){this.registerRetry=e}},{key:"getExistingDevice",value:function(e){if(e.devices&&e.devices.length>0){this.deviceInfo={userId:e.userId,device:e.devices[0],keepaliveInterval:30,rehomingIntervalMax:120,rehomingIntervalMin:60};var t="".concat(DO,"/").concat(e.devices[0].deviceId),r=e.devices[0].uri.replace(t,"");return this.setActiveMobiusUrl(r),this.registrationStatus=wM.ACTIVE,!0}return!1}},{key:"reconnectOnFailure",value:(t=_e(Re().mark((function e(t){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(cM.info(CO,{method:YL,file:YO}),this.reconnectPending=!1,this.isDeviceRegistered()){e.next=14;break}if(0!==l()(this.callManager.getActiveCalls()).length){e.next=12;break}return e.next=6,this.restorePreviousRegistration(t);case 6:if(e.sent||this.isDeviceRegistered()){e.next=10;break}return e.next=10,this.restartRegistration(t);case 10:e.next=14;break;case 12:this.reconnectPending=!0,cM.info("Active call(s) present, deferred reconnect till call cleanup.",{file:YO,method:YL});case 14:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}();function _F(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}function wF(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var RF=new(se()),CF=new(se()),TF=new(se()),xF=new(se()),kF=new(se()),IF=function(e){Je(i,e);var t,r,n=_F(i);function i(e,t,r,o,a,s,c,u,l,d,f){var h;return ne(this,i),wF(Ye(h=n.call(this)),RF,{writable:!0,value:void 0}),wF(Ye(h),CF,{writable:!0,value:void 0}),wF(Ye(h),TF,{writable:!0,value:void 0}),C(Ye(h),"registration",void 0),C(Ye(h),"userId",void 0),C(Ye(h),"clientDeviceUri",void 0),C(Ye(h),"lineId",void 0),C(Ye(h),"mobiusDeviceId",void 0),C(Ye(h),"mobiusUri",void 0),C(Ye(h),"phoneNumber",void 0),C(Ye(h),"extension",void 0),C(Ye(h),"sipAddresses",[]),C(Ye(h),"voicemail",void 0),C(Ye(h),"lastSeen",void 0),C(Ye(h),"keepaliveInterval",void 0),C(Ye(h),"callKeepaliveInterval",void 0),C(Ye(h),"rehomingIntervalMin",void 0),C(Ye(h),"rehomingIntervalMax",void 0),C(Ye(h),"voicePortalNumber",void 0),C(Ye(h),"voicePortalExtension",void 0),C(Ye(h),"callManager",void 0),C(Ye(h),"serviceData",void 0),wF(Ye(h),xF,{writable:!0,value:void 0}),wF(Ye(h),kF,{writable:!0,value:void 0}),C(Ye(h),"lineEmitter",(function(e,t,r){switch(cM.info(CO,{file:HO,method:zL}),e){case xN.REGISTERED:t&&(h.normalizeLine(t),h.emit(e,Ye(h)));break;case xN.UNREGISTERED:case xN.RECONNECTED:case xN.RECONNECTING:h.emit(e);break;case xN.ERROR:r&&h.emit(e,r)}})),C(Ye(h),"getStatus",(function(){return h.registration.getStatus()})),C(Ye(h),"getDeviceId",(function(){var e;return null===(e=h.registration.getDeviceInfo().device)||void 0===e?void 0:e.deviceId})),C(Ye(h),"makeCall",(function(e){var t,r;if(cM.info(CO,{file:HO,method:HL}),e){var n=e.address.match(VO);if(n&&n[0].length===e.address.length){var i,o,a=e.address.replace(/[^[*+]\d#]/gi,"").replace(/\s+/gi,"").replace(/-/gi,""),s={type:e.type,address:"tel:".concat(a)};t=h.callManager.createCall(TM.OUTBOUND,null===(i=h.registration.getDeviceInfo().device)||void 0===i?void 0:i.deviceId,h.lineId,s),cM.log("New call created, callId: ".concat(null===(o=t)||void 0===o?void 0:o.getCallId()),{file:HO,method:HL})}else{cM.warn("Invalid phone number detected",{file:HO,method:HL});var c=new WM("An invalid phone number was detected. Check the number and try again.",{},pM.CALL_ERROR,wM.ACTIVE);h.emit(xN.ERROR,c)}return t}if(h.serviceData.indicator===IM.GUEST_CALLING)return t=h.callManager.createCall(TM.OUTBOUND,null===(r=h.registration.getDeviceInfo().device)||void 0===r?void 0:r.deviceId,h.lineId),cM.info("New guest call created, callId: ".concat(t.getCallId()),{file:HO,method:HL}),t})),C(Ye(h),"getCall",(function(e){return h.callManager.getCall(e)})),h.lineId=iF(),h.userId=e,h.clientDeviceUri=t,h.phoneNumber=l,h.extension=d,h.voicemail=f,mF(Ye(h),TF,VM),mF(Ye(h),RF,vF(Ye(h),TF).getWebex()),mF(Ye(h),CF,r),mF(Ye(h),xF,o),mF(Ye(h),kF,a),h.serviceData=null!=c&&c.indicator?c:{indicator:IM.CALLING,domain:""},pN(h.serviceData),h.registration=function(e,t,r,n,i,o){return new SF(e,t,r,n,i,o)}(vF(Ye(h),RF),h.serviceData,vF(Ye(h),CF),h.lineEmitter,s,u),cM.setLogger(s,HO),h.callManager=hF(vF(Ye(h),RF),h.serviceData.indicator),h.incomingCallListener(),h}return oe(i,[{key:"register",value:(r=_e(Re().mark((function e(){var t=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return cM.info(CO,{file:HO,method:GL}),e.next=3,vF(this,CF).runExclusive(_e(Re().mark((function e(){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.emit(xN.CONNECTING),t.registration.setMobiusServers(vF(t,xF),vF(t,kF)),e.next=4,t.registration.triggerRegistration();case 4:case"end":return e.stop()}}),e)}))));case 3:this.mobiusDeviceId&&this.callManager.updateLine(this.mobiusDeviceId,this);case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"deregister",value:(t=_e(Re().mark((function e(){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return cM.info(CO,{file:HO,method:WL}),e.next=3,this.registration.deregister();case 3:this.registration.setStatus(wM.IDLE);case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"normalizeLine",value:function(e){var t,r=e.device,n=e.keepaliveInterval,i=e.callKeepaliveInterval,o=e.rehomingIntervalMin,a=e.rehomingIntervalMax,s=e.voicePortalNumber,c=e.voicePortalExtension;this.mobiusDeviceId=null==r?void 0:r.deviceId,this.mobiusUri=null==r?void 0:r.uri,this.lastSeen=null==r?void 0:r.lastSeen,this.sipAddresses=null!==(t=null==r?void 0:r.addresses)&&void 0!==t?t:[],this.keepaliveInterval=n,this.callKeepaliveInterval=i,this.rehomingIntervalMin=o,this.rehomingIntervalMax=a,this.voicePortalNumber=s,this.voicePortalExtension=c}},{key:"getLoggingLevel",value:function(){return cM.getLogLevel()}},{key:"getActiveMobiusUrl",value:function(){return this.registration.getActiveMobiusUrl()}},{key:"incomingCallListener",value:function(){var e=this;cM.info(CO,{file:HO,method:KL}),cM.info("Listening for incoming calls... ",{file:HO,method:KL}),this.callManager.on(IN.INCOMING_CALL,(function(t){e.emit(xN.INCOMING_CALL,t)}))}}]),i}(jN);function AF(e,t){var r=void 0!==Yr()&&e[Xr()]||e["@@iterator"];if(!r){if(en()(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return OF(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return $r()(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return OF(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function OF(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function LF(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var MF=function(t){Je(u,t);var r,n,i,o,a,s,c=LF(u);function u(t,r){var n,i,o,a,s,l;(ne(this,u),C(Ye(s=c.call(this)),"sdkConnector",void 0),C(Ye(s),"webex",void 0),C(Ye(s),"mutex",void 0),C(Ye(s),"callManager",void 0),C(Ye(s),"metricManager",void 0),C(Ye(s),"sdkConfig",void 0),C(Ye(s),"primaryMobiusUris",void 0),C(Ye(s),"backupMobiusUris",void 0),C(Ye(s),"mobiusClusters",void 0),C(Ye(s),"mobiusHost",void 0),C(Ye(s),"mediaEngine",void 0),C(Ye(s),"lineDict",{}),C(Ye(s),"callsClearedHandler",_e(Re().mark((function e(){var t;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(cM.info(CO,{file:zO,method:tM}),(t=Fr()(s.lineDict)[0].registration).isDeviceRegistered()){e.next=5;break}return e.next=5,s.mutex.runExclusive(_e(Re().mark((function e(){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.isReconnectPending()){e.next=4;break}return cM.info("All calls cleared, reconnecting",{file:zO,method:oL}),e.next=4,t.reconnectOnFailure(oL);case 4:case"end":return e.stop()}}),e)}))));case 5:case"end":return e.stop()}}),e)})))),s.sdkConnector=VM,s.sdkConnector.getWebex())||(VM.setWebex(t),null!=r&&null!==(l=r.logger)&&void 0!==l&&l.level&&t.logger.config&&(t.logger.config.level=r.logger.level),cM.setWebexLogger(t.logger));s.mutex=new CN,s.webex=s.sdkConnector.getWebex(),s.sdkConfig=r;var d=null!==(n=s.sdkConfig)&&void 0!==n&&null!==(i=n.serviceData)&&void 0!==i&&i.indicator?s.sdkConfig.serviceData:{indicator:IM.CALLING,domain:""},f=null!==(o=s.sdkConfig)&&void 0!==o&&null!==(a=o.logger)&&void 0!==a&&a.level?s.sdkConfig.logger.level:IO.ERROR;cM.setLogger(f,zO),pN(d),s.callManager=hF(s.webex,d.indicator),s.metricManager=fM(s.webex,d.indicator),s.mediaEngine=e;var h={log:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.logger.log(r.join(" : "))},error:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.logger.error(r.join(" : "))},warn:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.logger.warn(r.join(" : "))},info:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.logger.info(r.join(" : "))},trace:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.logger.trace(r.join(" : "))},debug:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.logger.debug(r.join(" : "))}};s.mediaEngine.setLogger(h),s.primaryMobiusUris=[],s.backupMobiusUris=[];var p="";try{p=new URL(s.webex.internal.services._serviceUrls.mobius).host}catch(e){cM.warn("Failed to parse mobius service URL",{file:zO,method:s.constructor.name})}if(s.webex.internal.services._hostCatalog)s.mobiusClusters=p&&s.webex.internal.services._hostCatalog[p]||s.webex.internal.services._hostCatalog["mobius-us-east-1.prod.infra.webex.com"]||s.webex.internal.services._hostCatalog["mobius-eu-central-1.prod.infra.webex.com"]||s.webex.internal.services._hostCatalog["mobius-us-east-1.int.infra.webex.com"]||s.webex.internal.services._hostCatalog["mobius-eu-central-1.int.infra.webex.com"];else{var v=s.webex.internal.services._services.find((function(e){return"mobius"===e.serviceName}));s.mobiusClusters=[v.serviceUrls[0].baseUrl]}return s.mobiusHost="",s.registerSessionsListener(),s.registerCallsClearedListener(),s}return oe(u,[{key:"init",value:(s=_e(Re().mark((function e(){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getMobiusServers();case 2:return e.next=4,this.createLine();case 4:this.detectNetworkChange();case 5:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"detectNetworkChange",value:(a=_e(Re().mark((function e(){var t,r,n=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:cM.info(CO,{file:zO,method:QL}),t=!1,r=Fr()(this.lineDict)[0],setInterval(_e(Re().mark((function e(){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.webex.internal.mercury.connected||t||l()(n.callManager.getActiveCalls()).length||(cM.warn("Network has flapped, waiting for mercury connection to be up",{file:zO,method:QL}),r.registration.clearKeepaliveTimer(),t=!0),!t||!n.webex.internal.mercury.connected){e.next=9;break}if(r.getStatus()===wM.IDLE){e.next=8;break}return e.next=5,r.registration.handleConnectionRestoration(t);case 5:t=e.sent,e.next=9;break;case 8:t=!1;case 9:case"end":return e.stop()}}),e)}))),2e3);case 4:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"getClientRegionInfo",value:(o=_e(Re().mark((function e(){var t,r,n,i,o,a,s=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:cM.info(CO,{file:zO,method:XL}),r={},n=AF(this.mobiusClusters),e.prev=3,o=Re().mark((function e(){var n,o,a,c,u,l;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=i.value).host?s.mobiusHost="https://".concat(n.host).concat(BO):s.mobiusHost=n,e.prev=2,e.next=5,s.webex.request({uri:"".concat(s.mobiusHost).concat(qO).concat("myip"),method:_M.GET,headers:C(C({},PO,s.webex.internal.device.url),jO,MO),service:SM.MOBIUS});case 5:return o=e.sent,a=o.body.ipv4,e.next=9,s.webex.request({uri:"".concat("https://ds.ciscospark.com/v1/region","/").concat(a),method:_M.GET,addAuthHeader:!1,headers:C({},jO,null)});case 9:return c=e.sent,u=c.body,r.clientRegion=null!=u&&u.clientRegion?u.clientRegion:"",r.countryCode=null!=u&&u.countryCode?u.countryCode:"",e.abrupt("return",0);case 16:return e.prev=16,e.t0=e.catch(2),l=new Error("Failed to get client region info: ".concat(e.t0)),cM.error(l,{method:XL,file:zO}),e.next=22,nN(e.t0,(function(t){var r,n;s.metricManager.submitRegistrationMetric(mO.REGISTRATION_ERROR,gO.REGISTER,vO.BEHAVIORAL,eL,"UNKNOWN",null!==(r=null===(n=e.t0.headers)||void 0===n?void 0:n.trackingId)&&void 0!==r?r:"",void 0,t),s.emit(AN.ERROR,t)}),{method:eL,file:zO});case 22:if(t=e.sent,r.clientRegion="",r.countryCode="",!t){e.next=27;break}return e.abrupt("return",{v:r});case 27:case"end":return e.stop()}}),e,null,[[2,16]])})),n.s();case 6:if((i=n.n()).done){e.next=15;break}return e.delegateYield(o(),"t0",8);case 8:if(0!==(a=e.t0)){e.next=11;break}return e.abrupt("break",15);case 11:if(!a){e.next=13;break}return e.abrupt("return",a.v);case 13:e.next=6;break;case 15:e.next=20;break;case 17:e.prev=17,e.t1=e.catch(3),n.e(e.t1);case 20:return e.prev=20,n.f(),e.finish(20);case 23:return e.abrupt("return",r);case 24:case"end":return e.stop()}}),e,this,[[3,17,20,23]])}))),function(){return o.apply(this,arguments)})},{key:"getMobiusServers",value:(i=_e(Re().mark((function e(){var t,r,n,i,o,a,s,c,u,l,d,f,h,p,v,m,g=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(cM.info(CO,{file:zO,method:ZL}),o=!1,null===(t=this.sdkConfig)||void 0===t||null===(r=t.discovery)||void 0===r||!r.country||null===(n=this.sdkConfig)||void 0===n||null===(i=n.discovery)||void 0===i||!i.region){e.next=9;break}cM.log("Updating region and country from the SDK config",{file:zO,method:eL}),a=null===(c=this.sdkConfig)||void 0===c||null===(u=c.discovery)||void 0===u?void 0:u.region,s=null===(l=this.sdkConfig)||void 0===l||null===(d=l.discovery)||void 0===d?void 0:d.country,this.mobiusHost=this.webex.internal.services._serviceUrls.mobius,e.next=15;break;case 9:return cM.log("Updating region and country through Region discovery",{file:zO,method:eL}),e.next=12,this.getClientRegionInfo();case 12:f=e.sent,a=f.clientRegion,s=f.countryCode;case 15:if(!a||!s){e.next=37;break}return cM.log("Found Region: ".concat(a," and country: ").concat(s,", going to fetch Mobius server"),""),e.prev=17,e.next=20,this.webex.request({uri:"".concat(this.mobiusHost).concat(qO,"?regionCode=").concat(a,"&countryCode=").concat(s),method:_M.GET,headers:C(C({},PO,this.webex.internal.device.url),jO,MO),service:SM.MOBIUS});case 20:h=e.sent,cM.log("Mobius Server found for the region",""),p=h.body,v=YM(p,this.mobiusHost),this.primaryMobiusUris=v.primary,this.backupMobiusUris=v.backup,cM.info("Final list of Mobius Servers, primary: ".concat(v.primary," and backup: ").concat(v.backup),""),e.next=35;break;case 29:e.prev=29,e.t0=e.catch(17),m=new Error("Failed to get Mobius servers: ".concat(e.t0)),cM.error(m,{method:ZL,file:zO}),nN(e.t0,(function(t){var r,n;g.metricManager.submitRegistrationMetric(mO.REGISTRATION_ERROR,gO.REGISTER,vO.BEHAVIORAL,eL,"UNKNOWN",null!==(r=null===(n=e.t0.headers)||void 0===n?void 0:n.trackingId)&&void 0!==r?r:"",void 0,t),g.emit(AN.ERROR,t)}),{method:eL,file:zO}),o=!0;case 35:e.next=38;break;case 37:o=!0;case 38:o&&(cM.warn("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers",""),this.mobiusHost="https://".concat(this.mobiusClusters[0].host).concat(BO),this.primaryMobiusUris=["".concat(this.mobiusHost).concat(qO)]);case 39:case"end":return e.stop()}}),e,this,[[17,29]])}))),function(){return i.apply(this,arguments)})},{key:"registerCallsClearedListener",value:function(){cM.info(CO,{file:zO,method:eM}),this.callManager.on(AN.ALL_CALLS_CLEARED,this.callsClearedHandler)}},{key:"getLoggingLevel",value:function(){return cM.getLogLevel()}},{key:"getSDKConnector",value:function(){return this.sdkConnector}},{key:"registerSessionsListener",value:function(){var e=this;cM.info(CO,{file:zO,method:rM}),this.sdkConnector.registerListener(DN.CALL_SESSION_EVENT_INCLUSIVE,function(){var t=_e(Re().mark((function t(r){var n,i;return Re().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!r||!r.data.userSessions.userSessions){t.next=7;break}if(1!==(n=null==r?void 0:r.data.userSessions.userSessions).length){t.next=5;break}if(n[0].sessionType===PN.WEBEX_CALLING){t.next=5;break}return t.abrupt("return");case 5:for(i=0;i<n.length;i+=1)n[i].sessionType!==PN.WEBEX_CALLING&&n.splice(i,1);e.emit(AN.USER_SESSION_INFO,r);case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},{key:"createLine",value:(n=_e(Re().mark((function e(){var t,r,n;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:cM.info(CO,{file:zO,method:nM}),n=new IF(this.webex.internal.device.userId,this.webex.internal.device.url,this.mutex,this.primaryMobiusUris,this.backupMobiusUris,this.getLoggingLevel(),null===(t=this.sdkConfig)||void 0===t?void 0:t.serviceData,null===(r=this.sdkConfig)||void 0===r?void 0:r.jwe),this.lineDict[n.lineId]=n;case 3:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"getLines",value:function(){return this.lineDict}},{key:"getActiveCalls",value:function(){var e={},t=this.callManager.getActiveCalls();return l()(t).forEach((function(r){var n=t[r];e[n.lineId]||(e[n.lineId]=[]),e[n.lineId].push(n)})),e}},{key:"getConnectedCall",value:function(){var e,t=this.callManager.getActiveCalls();return l()(t).forEach((function(r){t[r].isConnected()&&!t[r].isHeld()&&(e=t[r])})),e}},{key:"uploadLogs",value:(r=_e(Re().mark((function e(){var t;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,mN({},!0);case 2:if(t=e.sent){e.next=5;break}throw new Error("Failed to upload logs: No response received.");case 5:return e.abrupt("return",t);case 6:case"end":return e.stop()}}),e)}))),function(){return r.apply(this,arguments)})}]),u}(jN),NF=function(){var e=_e(Re().mark((function e(t,r){var n;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new MF(t,r),e.next=3,n.init();case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}();var PF=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];ne(this,e),C(this,"timer",null),C(this,"startTime",0),C(this,"interval",void 0),C(this,"allowCancelAutoWrapup",!1),this.interval=t,this.allowCancelAutoWrapup=r}return oe(e,[{key:"start",value:function(e){var t=this;Yd.info("AutoWrapup: clear called",{module:"AutoWrapup",method:"clear"}),this.timer&&this.clear(),this.startTime=Ln()(),this.timer=setTimeout((function(){e(),t.timer=null}),this.interval)}},{key:"clear",value:function(){Yd.info("AutoWrapup: clear called",{module:"AutoWrapup",method:"clear"}),this.timer&&(clearTimeout(this.timer),this.timer=null,this.startTime=0)}},{key:"getTimeLeft",value:function(){var e=Ln()()-this.startTime;return Math.max(0,this.interval-e)}},{key:"isRunning",value:function(){return null!==this.timer}},{key:"getTimeLeftSeconds",value:function(){return Math.ceil(this.getTimeLeft()/1e3)}}]),e}();function DF(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function FF(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?DF(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):DF(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}function UF(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var jF,BF=function(e){Je(g,e);var t,r,n,i,o,a,s,c,u,d,f,h,v,m=UF(g);function g(e,t,r,n){var i;return ne(this,g),C(Ye(i=m.call(this)),"contact",void 0),C(Ye(i),"localAudioStream",void 0),C(Ye(i),"webCallingService",void 0),C(Ye(i),"data",void 0),C(Ye(i),"metricsManager",void 0),C(Ye(i),"webCallMap",void 0),C(Ye(i),"wrapupData",void 0),C(Ye(i),"autoWrapup",void 0),C(Ye(i),"handleRemoteMedia",(function(e){i.emit(rh.TASK_MEDIA,e)})),C(Ye(i),"updateTaskData",(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return i.data=t?e:i.reconcileData(i.data,e),i.setupAutoWrapupTimer(),Ye(i)})),i.contact=e,i.data=r,i.webCallingService=t,i.webCallMap={},i.wrapupData=n,i.metricsManager=mf.getInstance(),i.registerWebCallListeners(),i.setupAutoWrapupTimer(),i}return oe(g,[{key:"setupAutoWrapupTimer",value:function(){var e=this;if(this.data.wrapUpRequired&&!this.autoWrapup&&this.wrapupData&&this.wrapupData.wrapUpProps){var t,r,n,i=this.wrapupData.wrapUpProps;if(!i||!1===i.autoWrapup)return void Yd.info("Auto wrap-up is not required for this task",{module:wd,method:Yf,interactionId:this.data.interactionId});var o=null!==(t=null===(r=i.wrapUpReasonList)||void 0===r?void 0:r.find((function(e){return e.isDefault})))&&void 0!==t?t:null===(n=i.wrapUpReasonList)||void 0===n?void 0:n[0];if(!o)return void Yd.error("No wrap-up reason configured",{module:wd,method:Yf});var a=i.autoWrapupInterval;(!a||a<=0)&&Yd.error("Invalid auto wrap-up interval: ".concat(a),{module:wd,method:Yf}),this.autoWrapup=new PF(a,i.allowCancelAutoWrapup),this.autoWrapup.start(_e(Re().mark((function t(){return Re().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return Yd.info("Auto wrap-up timer triggered",{module:wd,method:Yf,interactionId:e.data.interactionId}),t.next=3,e.wrapup({wrapUpReason:o.name,auxCodeId:o.id});case 3:case"end":return t.stop()}}),t)}))))}}},{key:"cancelAutoWrapupTimer",value:function(){var e,t;null===(e=this.autoWrapup)||void 0===e||e.clear(),this.autoWrapup=void 0,Yd.info("Auto wrap-up timer cancelled",{module:wd,method:Qf,interactionId:null===(t=this.data)||void 0===t?void 0:t.interactionId})}},{key:"registerWebCallListeners",value:function(){this.webCallingService.on(ON.REMOTE_MEDIA,this.handleRemoteMedia)}},{key:"unregisterWebCallListeners",value:function(){this.webCallingService.off(ON.REMOTE_MEDIA,this.handleRemoteMedia)}},{key:"reconcileData",value:function(e,t){var r=this;return l()(t).forEach((function(n){t[n]&&"object"===_(t[n])&&!en()(t[n])?e[n]=r.reconcileData(FF({},e[n]),t[n]):e[n]=t[n]})),e}},{key:"accept",value:(v=_e(Re().mark((function e(){var t,r,n,i,o,a;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,Yd.info("Accepting task",{module:wd,method:Mf,interactionId:this.data.interactionId}),this.metricsManager.timeEvent([uf.TASK_ACCEPT_SUCCESS,uf.TASK_ACCEPT_FAILED]),this.data.interaction.mediaType===th){e.next=10;break}return e.next=6,this.contact.accept({interactionId:this.data.interactionId});case 6:return t=e.sent,Yd.log("Task accepted successfully",{module:wd,method:Mf,trackingId:t.trackingId,interactionId:this.data.interactionId}),this.metricsManager.trackEvent(uf.TASK_ACCEPT_SUCCESS,FF({taskId:this.data.interactionId},mf.getCommonTrackingFieldForAQMResponse(this.data)),["operational","behavioral","business"]),e.abrupt("return",t);case 10:if(this.webCallingService.loginOption!==fd){e.next=20;break}return r={audio:!0},e.next=14,navigator.mediaDevices.getUserMedia(r);case 14:n=e.sent,i=n.getAudioTracks()[0],this.localAudioStream=new WI(new MediaStream([i])),this.webCallingService.answerCall(this.localAudioStream,this.data.interactionId),this.metricsManager.trackEvent(uf.TASK_ACCEPT_SUCCESS,FF({taskId:this.data.interactionId},mf.getCommonTrackingFieldForAQMResponse(this.data)),["operational","behavioral","business"]),Yd.log("Task accepted successfully with webrtc calling",{module:wd,method:Mf,interactionId:this.data.interactionId});case 20:return e.abrupt("return",p().resolve());case 23:throw e.prev=23,e.t0=e.catch(0),o=Sf(e.t0,Mf,wd),a=o.error,this.metricsManager.trackEvent(uf.TASK_ACCEPT_FAILED,FF({taskId:this.data.interactionId,error:e.t0.toString()},mf.getCommonTrackingFieldForAQMResponseFailed(e.t0.details)),["operational","behavioral","business"]),a;case 28:case"end":return e.stop()}}),e,this,[[0,23]])}))),function(){return v.apply(this,arguments)})},{key:"toggleMute",value:(h=_e(Re().mark((function e(){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,Yd.info("Toggling mute state",{module:wd,method:Nf,interactionId:this.data.interactionId}),this.webCallingService.muteUnmuteCall(this.localAudioStream),Yd.log("Mute state toggled successfully isCallMuted: ".concat(this.webCallingService.isCallMuted()),{module:wd,method:Nf,interactionId:this.data.interactionId}),e.abrupt("return",p().resolve());case 7:throw e.prev=7,e.t0=e.catch(0),Sf(e.t0,Nf,wd).error;case 11:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(){return h.apply(this,arguments)})},{key:"decline",value:(f=_e(Re().mark((function e(){var t,r;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,Yd.info("Declining task",{module:wd,method:Pf,interactionId:this.data.interactionId}),this.metricsManager.timeEvent([uf.TASK_DECLINE_SUCCESS,uf.TASK_DECLINE_FAILED]),this.webCallingService.declineCall(this.data.interactionId),this.unregisterWebCallListeners(),this.metricsManager.trackEvent(uf.TASK_DECLINE_SUCCESS,{taskId:this.data.interactionId},["operational","behavioral"]),Yd.log("Task declined successfully",{module:wd,method:Pf,interactionId:this.data.interactionId}),e.abrupt("return",p().resolve());case 10:throw e.prev=10,e.t0=e.catch(0),t=Sf(e.t0,Pf,wd),r=t.error,this.metricsManager.trackEvent(uf.TASK_DECLINE_FAILED,FF({taskId:this.data.interactionId,error:e.t0.toString()},mf.getCommonTrackingFieldForAQMResponseFailed(e.t0.details||{})),["operational","behavioral"]),r;case 15:case"end":return e.stop()}}),e,this,[[0,10]])}))),function(){return f.apply(this,arguments)})},{key:"hold",value:(d=_e(Re().mark((function e(){var t,r,n;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,Yd.info("Holding task",{module:wd,method:Df,interactionId:this.data.interactionId}),this.metricsManager.timeEvent([uf.TASK_HOLD_SUCCESS,uf.TASK_HOLD_FAILED]),e.next=5,this.contact.hold({interactionId:this.data.interactionId,data:{mediaResourceId:this.data.mediaResourceId}});case 5:return t=e.sent,this.metricsManager.trackEvent(uf.TASK_HOLD_SUCCESS,FF(FF({},mf.getCommonTrackingFieldForAQMResponse(t)),{},{taskId:this.data.interactionId,mediaResourceId:this.data.mediaResourceId}),["operational","behavioral"]),Yd.log("Task placed on hold successfully",{module:wd,method:Df,trackingId:t.trackingId,interactionId:this.data.interactionId}),e.abrupt("return",t);case 11:throw e.prev=11,e.t0=e.catch(0),r=Sf(e.t0,Df,wd),n=r.error,this.metricsManager.trackEvent(uf.TASK_HOLD_FAILED,FF({taskId:this.data.interactionId,mediaResourceId:this.data.mediaResourceId,error:e.t0.toString()},mf.getCommonTrackingFieldForAQMResponseFailed(e.t0.details||{})),["operational","behavioral"]),n;case 16:case"end":return e.stop()}}),e,this,[[0,11]])}))),function(){return d.apply(this,arguments)})},{key:"resume",value:(u=_e(Re().mark((function e(){var t,r,n,i,o,a,s;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,Yd.info("Resuming task",{module:wd,method:Ff,interactionId:this.data.interactionId}),t=this.data.interaction.mainInteractionId,r=this.data.interaction.media[t].mediaResourceId,this.metricsManager.timeEvent([uf.TASK_RESUME_SUCCESS,uf.TASK_RESUME_FAILED]),e.next=7,this.contact.unHold({interactionId:this.data.interactionId,data:{mediaResourceId:r}});case 7:return n=e.sent,this.metricsManager.trackEvent(uf.TASK_RESUME_SUCCESS,FF({taskId:this.data.interactionId,mainInteractionId:t,mediaResourceId:r},mf.getCommonTrackingFieldForAQMResponse(n)),["operational","behavioral"]),Yd.log("Task resumed successfully",{module:wd,method:Ff,trackingId:n.trackingId,interactionId:this.data.interactionId}),e.abrupt("return",n);case 13:throw e.prev=13,e.t0=e.catch(0),o=Sf(e.t0,Ff,wd),a=o.error,s=null===(i=this.data.interaction)||void 0===i?void 0:i.mainInteractionId,this.metricsManager.trackEvent(uf.TASK_RESUME_FAILED,FF({taskId:this.data.interactionId,mainInteractionId:s,mediaResourceId:s?this.data.interaction.media[s].mediaResourceId:""},mf.getCommonTrackingFieldForAQMResponseFailed(e.t0.details||{})),["operational","behavioral"]),a;case 19:case"end":return e.stop()}}),e,this,[[0,13]])}))),function(){return u.apply(this,arguments)})},{key:"end",value:(c=_e(Re().mark((function e(){var t,r,n;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,Yd.info("Ending task",{module:wd,method:Uf,interactionId:this.data.interactionId}),this.metricsManager.timeEvent([uf.TASK_END_SUCCESS,uf.TASK_END_FAILED]),e.next=5,this.contact.end({interactionId:this.data.interactionId});case 5:return t=e.sent,this.metricsManager.trackEvent(uf.TASK_END_SUCCESS,FF({taskId:this.data.interactionId},mf.getCommonTrackingFieldForAQMResponse(t)),["operational","behavioral","business"]),Yd.log("Task ended successfully",{module:wd,method:Uf,trackingId:t.trackingId,interactionId:this.data.interactionId}),e.abrupt("return",t);case 11:throw e.prev=11,e.t0=e.catch(0),r=Sf(e.t0,Uf,wd),n=r.error,this.metricsManager.trackEvent(uf.TASK_END_FAILED,FF({taskId:this.data.interactionId},mf.getCommonTrackingFieldForAQMResponseFailed(e.t0.details||{})),["operational","behavioral","business"]),n;case 16:case"end":return e.stop()}}),e,this,[[0,11]])}))),function(){return c.apply(this,arguments)})},{key:"wrapup",value:(s=_e(Re().mark((function e(t){var r,n,i;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.cancelAutoWrapupTimer(),Yd.info("Wrapping up task",{module:wd,method:jf,interactionId:this.data.interactionId}),this.metricsManager.timeEvent([uf.TASK_WRAPUP_SUCCESS,uf.TASK_WRAPUP_FAILED]),this.data){e.next=6;break}throw new Error("No task data available");case 6:if(t.auxCodeId&&0!==t.auxCodeId.length){e.next=8;break}throw new Error("AuxCodeId is required");case 8:if(t.wrapUpReason&&0!==t.wrapUpReason.length){e.next=10;break}throw new Error("WrapUpReason is required");case 10:return e.next=12,this.contact.wrapup({interactionId:this.data.interactionId,data:t});case 12:return r=e.sent,this.metricsManager.trackEvent(uf.TASK_WRAPUP_SUCCESS,FF({taskId:this.data.interactionId,wrapUpCode:t.auxCodeId,wrapUpReason:t.wrapUpReason},mf.getCommonTrackingFieldForAQMResponse(r)),["operational","behavioral","business"]),Yd.log("Task wrapped up successfully",{module:wd,method:jf,trackingId:r.trackingId,interactionId:this.data.interactionId}),e.abrupt("return",r);case 18:throw e.prev=18,e.t0=e.catch(0),n=Sf(e.t0,jf,wd),i=n.error,this.metricsManager.trackEvent(uf.TASK_WRAPUP_FAILED,FF({taskId:this.data.interactionId,wrapUpCode:t.auxCodeId,wrapUpReason:t.wrapUpReason},mf.getCommonTrackingFieldForAQMResponseFailed(e.t0.details||{})),["operational","behavioral","business"]),i;case 23:case"end":return e.stop()}}),e,this,[[0,18]])}))),function(e){return s.apply(this,arguments)})},{key:"pauseRecording",value:(a=_e(Re().mark((function e(){var t,r,n;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,Yd.info("Pausing recording",{module:wd,method:Bf,interactionId:this.data.interactionId}),this.metricsManager.timeEvent([uf.TASK_PAUSE_RECORDING_SUCCESS,uf.TASK_PAUSE_RECORDING_FAILED]),e.next=5,this.contact.pauseRecording({interactionId:this.data.interactionId});case 5:return t=e.sent,this.metricsManager.trackEvent(uf.TASK_PAUSE_RECORDING_SUCCESS,FF({taskId:this.data.interactionId},mf.getCommonTrackingFieldForAQMResponse(t)),["operational","behavioral","business"]),Yd.log("Recording paused successfully",{module:wd,method:Bf,trackingId:t.trackingId,interactionId:this.data.interactionId}),e.abrupt("return",t);case 11:throw e.prev=11,e.t0=e.catch(0),r=Sf(e.t0,Bf,wd),n=r.error,this.metricsManager.trackEvent(uf.TASK_PAUSE_RECORDING_FAILED,FF({taskId:this.data.interactionId,error:e.t0.toString()},mf.getCommonTrackingFieldForAQMResponseFailed(e.t0.details||{})),["operational","behavioral","business"]),n;case 16:case"end":return e.stop()}}),e,this,[[0,11]])}))),function(){return a.apply(this,arguments)})},{key:"resumeRecording",value:(o=_e(Re().mark((function e(t){var r,n,i,o;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,Yd.info("Resuming recording",{module:wd,method:qf,interactionId:this.data.interactionId}),this.metricsManager.timeEvent([uf.TASK_RESUME_RECORDING_SUCCESS,uf.TASK_RESUME_RECORDING_FAILED]),null!==(r=t)&&void 0!==r||(t={autoResumed:!1}),e.next=6,this.contact.resumeRecording({interactionId:this.data.interactionId,data:t});case 6:return n=e.sent,this.metricsManager.trackEvent(uf.TASK_RESUME_RECORDING_SUCCESS,FF({taskId:this.data.interactionId},mf.getCommonTrackingFieldForAQMResponse(n)),["operational","behavioral","business"]),Yd.log("Recording resumed successfully",{module:wd,method:qf,trackingId:n.trackingId,interactionId:this.data.interactionId}),e.abrupt("return",n);case 12:throw e.prev=12,e.t0=e.catch(0),i=Sf(e.t0,qf,wd),o=i.error,this.metricsManager.trackEvent(uf.TASK_RESUME_RECORDING_FAILED,FF({taskId:this.data.interactionId,error:e.t0.toString()},mf.getCommonTrackingFieldForAQMResponseFailed(e.t0.details||{})),["operational","behavioral","business"]),o;case 17:case"end":return e.stop()}}),e,this,[[0,12]])}))),function(e){return o.apply(this,arguments)})},{key:"consult",value:(i=_e(Re().mark((function e(t){var r,n,i;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,Yd.info("Starting consult",{module:wd,method:Vf,interactionId:this.data.interactionId}),this.metricsManager.timeEvent([uf.TASK_CONSULT_START_SUCCESS,uf.TASK_CONSULT_START_FAILED]),e.next=5,this.contact.consult({interactionId:this.data.interactionId,data:t});case 5:return r=e.sent,this.metricsManager.trackEvent(uf.TASK_CONSULT_START_SUCCESS,FF({taskId:this.data.interactionId,destination:t.to,destinationType:t.destinationType},mf.getCommonTrackingFieldForAQMResponse(r)),["operational","behavioral","business"]),Yd.log("Consult started successfully to ".concat(t.to),{module:wd,method:Vf,trackingId:r.trackingId,interactionId:this.data.interactionId}),e.abrupt("return",r);case 11:throw e.prev=11,e.t0=e.catch(0),n=Sf(e.t0,Vf,wd),i=n.error,this.metricsManager.trackEvent(uf.TASK_CONSULT_START_FAILED,FF({taskId:this.data.interactionId,destination:t.to,destinationType:t.destinationType,error:e.t0.toString()},mf.getCommonTrackingFieldForAQMResponseFailed(e.t0.details||{})),["operational","behavioral","business"]),i;case 16:case"end":return e.stop()}}),e,this,[[0,11]])}))),function(e){return i.apply(this,arguments)})},{key:"endConsult",value:(n=_e(Re().mark((function e(t){var r,n,i;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,Yd.info("Ending consult",{module:wd,method:Gf,interactionId:this.data.interactionId}),this.metricsManager.timeEvent([uf.TASK_CONSULT_END_SUCCESS,uf.TASK_CONSULT_END_FAILED]),e.next=5,this.contact.consultEnd({interactionId:this.data.interactionId,data:t});case 5:return r=e.sent,this.metricsManager.trackEvent(uf.TASK_CONSULT_END_SUCCESS,FF({taskId:this.data.interactionId},mf.getCommonTrackingFieldForAQMResponse(r)),["operational","behavioral","business"]),Yd.log("Consult ended successfully",{module:wd,method:Gf,trackingId:r.trackingId,interactionId:this.data.interactionId}),e.abrupt("return",r);case 11:throw e.prev=11,e.t0=e.catch(0),n=Sf(e.t0,Gf,wd),i=n.error,this.metricsManager.trackEvent(uf.TASK_CONSULT_END_FAILED,FF({taskId:this.data.interactionId,error:e.t0.toString()},mf.getCommonTrackingFieldForAQMResponseFailed(e.t0.details||{})),["operational","behavioral","business"]),i;case 16:case"end":return e.stop()}}),e,this,[[0,11]])}))),function(e){return n.apply(this,arguments)})},{key:"transfer",value:(r=_e(Re().mark((function e(t){var r,n,i;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,Yd.info("Transferring task to ".concat(t.to),{module:wd,method:Wf,interactionId:this.data.interactionId}),this.metricsManager.timeEvent([uf.TASK_TRANSFER_SUCCESS,uf.TASK_TRANSFER_FAILED]),t.destinationType!==Xf){e.next=9;break}return e.next=6,this.contact.vteamTransfer({interactionId:this.data.interactionId,data:t});case 6:r=e.sent,e.next=12;break;case 9:return e.next=11,this.contact.blindTransfer({interactionId:this.data.interactionId,data:t});case 11:r=e.sent;case 12:return this.metricsManager.trackEvent(uf.TASK_TRANSFER_SUCCESS,FF({taskId:this.data.interactionId,destination:t.to,destinationType:t.destinationType,isConsultTransfer:!1},mf.getCommonTrackingFieldForAQMResponse(r)),["operational","behavioral","business"]),Yd.log("Task transferred successfully to ".concat(t.to),{module:wd,method:Wf,trackingId:r.trackingId,interactionId:this.data.interactionId}),e.abrupt("return",r);case 17:throw e.prev=17,e.t0=e.catch(0),n=Sf(e.t0,Wf,wd),i=n.error,this.metricsManager.trackEvent(uf.TASK_TRANSFER_FAILED,FF({taskId:this.data.interactionId,destination:t.to,destinationType:t.destinationType,isConsultTransfer:!1,error:e.t0.toString()},mf.getCommonTrackingFieldForAQMResponseFailed(e.t0.details||{})),["operational","behavioral","business"]),i;case 22:case"end":return e.stop()}}),e,this,[[0,17]])}))),function(e){return r.apply(this,arguments)})},{key:"consultTransfer",value:(t=_e(Re().mark((function e(t){var r,n,i;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,Yd.info("Initiating consult transfer to ".concat(t.to),{module:wd,method:zf,interactionId:this.data.interactionId}),t.destinationType!==eh){e.next=6;break}if(this.data.destAgentId){e.next=5;break}throw new Error("No agent has accepted this queue consult yet");case 5:t={to:this.data.destAgentId,destinationType:Zf};case 6:return e.next=8,this.contact.consultTransfer({interactionId:this.data.interactionId,data:t});case 8:return r=e.sent,this.metricsManager.trackEvent(uf.TASK_TRANSFER_SUCCESS,FF({taskId:this.data.interactionId,destination:t.to,destinationType:t.destinationType,isConsultTransfer:!0},mf.getCommonTrackingFieldForAQMResponse(r)),["operational","behavioral","business"]),Yd.log("Consult transfer completed successfully to ".concat(t.to),{module:wd,method:zf,trackingId:r.trackingId,interactionId:this.data.interactionId}),e.abrupt("return",r);case 14:throw e.prev=14,e.t0=e.catch(0),n=Sf(e.t0,zf,wd),i=n.error,this.metricsManager.trackEvent(uf.TASK_TRANSFER_FAILED,FF({taskId:this.data.interactionId,destination:t.to,destinationType:t.destinationType,isConsultTransfer:!0,error:e.t0.toString()},mf.getCommonTrackingFieldForAQMResponseFailed(e.t0.details||{})),["operational","behavioral","business"]),i;case 19:case"end":return e.stop()}}),e,this,[[0,14]])}))),function(e){return t.apply(this,arguments)})}]),g}(qe());function qF(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function VF(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?qF(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):qF(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}function GF(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var WF=function(e){Je(r,e);var t=GF(r);function r(e,n,i){var o;return ne(this,r),C(Ye(o=t.call(this)),"call",void 0),C(Ye(o),"contact",void 0),C(Ye(o),"taskCollection",void 0),C(Ye(o),"webCallingService",void 0),C(Ye(o),"webSocketManager",void 0),C(Ye(o),"metricsManager",void 0),C(Ye(o),"wrapupData",void 0),C(Ye(o),"handleIncomingWebCall",(function(e){var t=Fr()(o.taskCollection).find((function(e){return"telephony"===e.data.interaction.mediaType}));t&&(o.webCallingService.mapCallToTask(e.getCallId(),t.data.interactionId),Yd.log("Call mapped to task",{module:_d,method:Kf,interactionId:t.data.interactionId}),o.emit(rh.TASK_INCOMING,t)),o.call=e})),C(Ye(o),"getTask",(function(e){return o.taskCollection[e]})),C(Ye(o),"getAllTasks",(function(){return o.taskCollection})),o.contact=e,o.taskCollection={},o.webCallingService=n,o.webSocketManager=i,o.metricsManager=mf.getInstance(),o.registerTaskListeners(),o.registerIncomingCallEvent(),o}return oe(r,[{key:"setWrapupData",value:function(e){this.wrapupData=e}},{key:"registerIncomingCallEvent",value:function(){this.webCallingService.on(xN.INCOMING_CALL,this.handleIncomingWebCall)}},{key:"unregisterIncomingCallEvent",value:function(){this.webCallingService.off(xN.INCOMING_CALL,this.handleIncomingWebCall)}},{key:"registerTaskListeners",value:function(){var e=this;this.webSocketManager.on("message",(function(t){var r,n,i,o,a=JSON.parse(t);if(null!==(r=a.data)&&void 0!==r&&r.type){var s,c;switch(Fr()(Cf).includes(a.data.type)&&(o=e.taskCollection[a.data.interactionId]),Yd.info("Handling task event ".concat(null===(s=a.data)||void 0===s?void 0:s.type),{module:_d,method:$f,interactionId:null===(c=a.data)||void 0===c?void 0:c.interactionId}),a.data.type){case Tf.AGENT_CONTACT:if(e.taskCollection[a.data.interactionId]){Yd.log("Got AGENT_CONTACT: Task already exists in collection",{module:_d,method:$f,interactionId:a.data.interactionId});break}var u,l,d;e.taskCollection[a.data.interactionId]||(Yd.log("Got AGENT_CONTACT : Creating new task in taskManager",{module:_d,method:$f,interactionId:a.data.interactionId}),o=new BF(e.contact,e.webCallingService,VF(VF({},a.data),{},{wrapUpRequired:(null===(u=a.data.interaction)||void 0===u||null===(l=u.participants)||void 0===l||null===(d=l[a.data.agentId])||void 0===d?void 0:d.isWrapUp)||!1}),e.wrapupData),e.taskCollection[a.data.interactionId]=o,"new"===a.data.interaction.state?(Yd.log("Got AGENT_CONTACT for a task with state=new, sending TASK_INCOMING event",{module:_d,method:$f,interactionId:a.data.interactionId}),e.emit(rh.TASK_INCOMING,o)):(Yd.log("Got AGENT_CONTACT for a task with state=".concat(a.data.interaction.state,", sending TASK_HYDRATE event"),{module:_d,method:$f,interactionId:a.data.interactionId}),e.emit(rh.TASK_HYDRATE,o)));break;case Tf.AGENT_CONTACT_RESERVED:o=new BF(e.contact,e.webCallingService,VF(VF({},a.data),{},{isConsulted:!1}),e.wrapupData),e.taskCollection[a.data.interactionId]=o,(e.webCallingService.loginOption!==fd||o.data.interaction.mediaType!==th||e.call)&&e.emit(rh.TASK_INCOMING,o);break;case Tf.AGENT_OFFER_CONTACT:o=e.updateTaskData(o,a.data),Yd.log("Agent offer contact received for task",{module:_d,method:$f,interactionId:null===(n=a.data)||void 0===n?void 0:n.interactionId}),e.emit(rh.TASK_OFFER_CONTACT,o);break;case Tf.AGENT_OUTBOUND_FAILED:o.data&&e.removeTaskFromCollection(o),Yd.log("Agent outbound failed for task",{module:_d,method:$f,interactionId:null===(i=a.data)||void 0===i?void 0:i.interactionId});break;case Tf.AGENT_CONTACT_ASSIGNED:(o=e.updateTaskData(o,a.data)).emit(rh.TASK_ASSIGNED,o);break;case Tf.AGENT_CONTACT_UNASSIGNED:(o=e.updateTaskData(o,VF(VF({},a.data),{},{wrapUpRequired:!0}))).emit(rh.TASK_END,o);break;case Tf.AGENT_CONTACT_OFFER_RONA:case Tf.AGENT_CONTACT_ASSIGN_FAILED:case Tf.AGENT_INVITE_FAILED:o=e.updateTaskData(o,a.data);var f=C(C({},Tf.AGENT_CONTACT_ASSIGN_FAILED,"AGENT_CONTACT_ASSIGN_FAILED"),Tf.AGENT_INVITE_FAILED,"AGENT_INVITE_FAILED")[a.data.type]||"AGENT_RONA";e.metricsManager.trackEvent(uf[f],VF(VF({},mf.getCommonTrackingFieldForAQMResponse(a.data)),{},{taskId:a.data.interactionId,reason:a.data.reason}),["behavioral","operational"]),e.handleTaskCleanup(o),o.emit(rh.TASK_REJECT,a.data.reason);break;case Tf.CONTACT_ENDED:o=e.updateTaskData(o,VF(VF({},a.data),{},{wrapUpRequired:"new"!==a.data.interaction.state})),e.handleTaskCleanup(o),o.emit(rh.TASK_END,o);break;case Tf.AGENT_CONTACT_HELD:(o=e.updateTaskData(o,a.data)).emit(rh.TASK_HOLD,o);break;case Tf.AGENT_CONTACT_UNHELD:(o=e.updateTaskData(o,a.data)).emit(rh.TASK_RESUME,o);break;case Tf.AGENT_VTEAM_TRANSFERRED:(o=e.updateTaskData(o,VF(VF({},a.data),{},{wrapUpRequired:!0}))).emit(rh.TASK_END,o);break;case Tf.AGENT_CTQ_CANCEL_FAILED:(o=e.updateTaskData(o,a.data)).emit(rh.TASK_CONSULT_QUEUE_FAILED,o);break;case Tf.AGENT_CONSULT_CREATED:(o=e.updateTaskData(o,VF(VF({},a.data),{},{isConsulted:!1}))).emit(rh.TASK_CONSULT_CREATED,o);break;case Tf.AGENT_OFFER_CONSULT:(o=e.updateTaskData(o,VF(VF({},a.data),{},{isConsulted:!0}))).emit(rh.TASK_OFFER_CONSULT,o);break;case Tf.AGENT_CONSULTING:(o=e.updateTaskData(o,a.data)).data.isConsulted?o.emit(rh.TASK_CONSULT_ACCEPTED,o):o.emit(rh.TASK_CONSULTING,o);break;case Tf.AGENT_CONSULT_FAILED:o=e.updateTaskData(o,a.data);break;case Tf.AGENT_CONSULT_ENDED:(o=e.updateTaskData(o,a.data)).data.isConsulted&&e.removeTaskFromCollection(o),o.emit(rh.TASK_CONSULT_END,o);break;case Tf.AGENT_CTQ_CANCELLED:(o=e.updateTaskData(o,a.data)).emit(rh.TASK_CONSULT_QUEUE_CANCELLED,o);break;case Tf.AGENT_WRAPUP:(o=e.updateTaskData(o,VF(VF({},a.data),{},{wrapUpRequired:!0}))).emit(rh.TASK_END,o);break;case Tf.AGENT_WRAPPEDUP:o.cancelAutoWrapupTimer(),e.removeTaskFromCollection(o),o.emit(rh.TASK_WRAPPEDUP,o);break;case Tf.CONTACT_RECORDING_PAUSED:(o=e.updateTaskData(o,a.data)).emit(rh.TASK_RECORDING_PAUSED,o);break;case Tf.CONTACT_RECORDING_PAUSE_FAILED:(o=e.updateTaskData(o,a.data)).emit(rh.TASK_RECORDING_PAUSE_FAILED,o);break;case Tf.CONTACT_RECORDING_RESUMED:(o=e.updateTaskData(o,a.data)).emit(rh.TASK_RECORDING_RESUMED,o);break;case Tf.CONTACT_RECORDING_RESUME_FAILED:(o=e.updateTaskData(o,a.data)).emit(rh.TASK_RECORDING_RESUME_FAILED,o)}o&&o.emit(a.data.type,a.data)}}))}},{key:"updateTaskData",value:function(e,t){if(e){null!=t&&t.interactionId||Yd.warn("Received task update with missing interactionId",{module:_d,method:Hf});try{var r=e.updateTaskData(t);return this.taskCollection[t.interactionId]=r,r}catch(r){return Yd.error("Failed to update task",{module:_d,method:Hf,interactionId:t.interactionId}),e}}}},{key:"removeTaskFromCollection",value:function(e){var t;null!=e&&null!==(t=e.data)&&void 0!==t&&t.interactionId&&(delete this.taskCollection[e.data.interactionId],Yd.info("Task removed from collection",{module:_d,method:Jf,interactionId:e.data.interactionId}))}},{key:"handleTaskCleanup",value:function(e){this.webCallingService.loginOption===fd&&"telephony"===e.data.interaction.mediaType&&(e.unregisterWebCallListeners(),this.webCallingService.cleanUpCall()),"new"===e.data.interaction.state&&this.removeTaskFromCollection(e)}}]),r}(qe());function zF(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}jF=WF,C(WF,"taskManager",void 0),C(WF,"getTaskManager",(function(e,t,r){return jF.taskManager||(jF.taskManager=new jF(e,t,r)),jF.taskManager}));var HF=function(e){Je(o,e);var t,r,n,i=zF(o);function o(e){var t;return ne(this,o),C(Ye(t=i.call(this)),"callingClient",void 0),C(Ye(t),"line",void 0),C(Ye(t),"call",void 0),C(Ye(t),"webex",void 0),C(Ye(t),"loginOption",void 0),C(Ye(t),"callTaskMap",void 0),C(Ye(t),"handleMediaEvent",(function(e){t.emit(ON.REMOTE_MEDIA,e)})),C(Ye(t),"handleDisconnectEvent",(function(){t.call.end(),t.cleanUpCall()})),t.webex=e,t.callTaskMap=new(V()),t}return oe(o,[{key:"setLoginOption",value:function(e){this.loginOption=e}},{key:"registerCallListeners",value:function(){this.call.on(ON.REMOTE_MEDIA,this.handleMediaEvent),this.call.on(ON.DISCONNECT,this.handleDisconnectEvent)}},{key:"cleanUpCall",value:function(){if(this.call){this.call.off(ON.REMOTE_MEDIA,this.handleMediaEvent),this.call.off(ON.DISCONNECT,this.handleDisconnectEvent);var e=this.call.getCallId();this.getTaskIdForCall(e)&&this.callTaskMap.delete(e),this.call=null}}},{key:"getRTMSDomain",value:(n=_e(Re().mark((function e(){var t,r;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.webex.internal.services.waitForCatalog("postauth");case 2:return t=this.webex.internal.services.get("wcc-calling-rtms-domain"),e.prev=3,r=new URL(t),e.abrupt("return",r.hostname);case 8:return e.prev=8,e.t0=e.catch(3),Yd.error("Invalid URL from u2c catalogue: ".concat(t," so falling back to default domain"),{module:vd,method:qd}),e.abrupt("return","rtw.prod-us1.rtmsprod.net");case 12:case"end":return e.stop()}}),e,this,[[3,8]])}))),function(){return n.apply(this,arguments)})},{key:"registerWebCallingLine",value:(r=_e(Re().mark((function e(){var t,r,n=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getRTMSDomain();case 2:return t=e.sent,r={logger:{level:IO.INFO},serviceData:{indicator:IM.CONTACT_CENTER,domain:t}},e.next=6,NF(this.webex,r);case 6:return this.callingClient=e.sent,this.line=Fr()(this.callingClient.getLines())[0],this.line.on(xN.UNREGISTERED,(function(){Yd.log("WxCC-SDK: Desktop unregistered successfully",{module:vd,method:Vd})})),this.line.on(xN.INCOMING_CALL,(function(e){n.call=e,n.emit(xN.INCOMING_CALL,e)})),e.abrupt("return",new(p())((function(e,t){var r=setTimeout((function(){t(new Error("WebCallingService Registration timed out"))}),2e4);n.line.on(xN.REGISTERED,(function(t){clearTimeout(r),Yd.log("WxCC-SDK: Desktop registered successfully, mobiusDeviceId: ".concat(t.mobiusDeviceId),{module:vd,method:Vd}),e()})),n.line.register()})));case 11:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"deregisterWebCallingLine",value:(t=_e(Re().mark((function e(){var t;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Yd.log("Deregistering WebCalling line and cleaning up resources",{module:vd,method:Gd}),this.cleanUpCall(),null===(t=this.line)||void 0===t||t.deregister();case 3:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"answerCall",value:function(e,t){if(this.call)try{Yd.info("Call answered: ".concat(t),{module:vd,method:Wd}),this.call.answer(e),this.registerCallListeners()}catch(e){throw Yd.error("Failed to answer call for ".concat(t,". Error: ").concat(e),{module:vd,method:Wd}),e}else Yd.log("Cannot answer a non WebRtc Call: ".concat(t),{module:vd,method:Wd})}},{key:"muteUnmuteCall",value:function(e){this.call?(Yd.info("Call mute or unmute requested!",{module:vd,method:zd}),this.call.mute(e)):Yd.log("Cannot mute a non WebRtc Call",{module:vd,method:zd})}},{key:"isCallMuted",value:function(){return!!this.call&&this.call.isMuted()}},{key:"declineCall",value:function(e){if(this.call)try{Yd.info("Call end requested: ".concat(e),{module:vd,method:Hd}),this.call.end(),this.cleanUpCall()}catch(t){throw Yd.error("Failed to end call: ".concat(e,". Error: ").concat(t),{module:vd,method:Hd}),t}else Yd.log("Cannot end a non WebRtc Call: ".concat(e),{module:vd,method:Hd})}},{key:"mapCallToTask",value:function(e,t){this.callTaskMap.set(e,t)}},{key:"getTaskIdForCall",value:function(e){return this.callTaskMap.get(e)}}]),o}(qe()),KF=["channelsMap"],$F=["channelsMap"],JF=["channelsMap"];function YF(e,t){var r=l()(e);if(xe()){var n=xe()(e);t&&(n=n.filter((function(t){return Ie()(e,t).enumerable}))),r.push.apply(r,n)}return r}function QF(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?YF(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Oe()?Me()(e,Oe()(r)):YF(Object(r)).forEach((function(t){Pe()(e,t,Ie()(r,t))}))}return e}function XF(e){var t=function(){if("undefined"==typeof Reflect||!Ke())return!1;if(Ke().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Ke()(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ze(e);if(t){var i=Ze(this).constructor;r=Ke()(n,arguments,i)}else r=n.apply(this,arguments);return Qe(this,r)}}var ZF=function(e){Je(v,e);var t,r,n,i,o,a,s,c,u,l,d,f,h,p=XF(v);function v(){var e;ne(this,v);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return C(Ye(e=p.call.apply(p,[this].concat(r))),"namespace","cc"),C(Ye(e),"$config",void 0),C(Ye(e),"$webex",void 0),C(Ye(e),"eventEmitter",void 0),C(Ye(e),"agentConfig",void 0),C(Ye(e),"webCallingService",void 0),C(Ye(e),"services",void 0),C(Ye(e),"webexRequest",void 0),C(Ye(e),"taskManager",void 0),C(Ye(e),"metricsManager",void 0),C(Ye(e),"LoggerProxy",Yd),C(Ye(e),"handleIncomingTask",(function(t){e.trigger(rh.TASK_INCOMING,t)})),C(Ye(e),"handleTaskHydrate",(function(t){e.trigger(rh.TASK_HYDRATE,t)})),C(Ye(e),"handleWebsocketMessage",(function(t){var r=JSON.parse(t);if(!r.keepalive&&r.data&&r.data.type&&e.emit(r.data.type,r.data),r.type){switch(Yd.log("Received event: ".concat(r.type),{module:gd,method:Md}),r.type){case Tf.AGENT_MULTI_LOGIN:e.emit($h.AGENT_MULTI_LOGIN,r.data);break;case Tf.AGENT_STATE_CHANGE:e.emit($h.AGENT_STATE_CHANGE,r.data)}if(r.data&&r.data.type)switch(r.data.type){case Tf.AGENT_STATION_LOGIN_SUCCESS:var n,i,o,a,s=r.data,c=s.channelsMap,u=Ql(s,KF),l=QF(QF({},u),{},{mmProfile:{chat:null===(n=c.chat)||void 0===n?void 0:n.length,email:null===(i=c.email)||void 0===i?void 0:i.length,social:null===(o=c.social)||void 0===o?void 0:o.length,telephony:null===(a=c.telephony)||void 0===a?void 0:a.length},notifsTrackingId:r.trackingId});e.webCallingService.setLoginOption(u.deviceType),e.emit($h.AGENT_STATION_LOGIN_SUCCESS,l);break;case Tf.AGENT_RELOGIN_SUCCESS:var d,f,h,p,v=r.data,m=v.channelsMap,g=QF(QF({},Ql(v,$F)),{},{mmProfile:{chat:null===(d=m.chat)||void 0===d?void 0:d.length,email:null===(f=m.email)||void 0===f?void 0:f.length,social:null===(h=m.social)||void 0===h?void 0:h.length,telephony:null===(p=m.telephony)||void 0===p?void 0:p.length},notifsTrackingId:r.trackingId});e.emit($h.AGENT_RELOGIN_SUCCESS,g);break;case Tf.AGENT_STATE_CHANGE_SUCCESS:e.emit($h.AGENT_STATE_CHANGE_SUCCESS,r.data);break;case Tf.AGENT_STATE_CHANGE_FAILED:e.emit($h.AGENT_STATE_CHANGE_FAILED,r.data);break;case Tf.AGENT_STATION_LOGIN_FAILED:e.emit($h.AGENT_STATION_LOGIN_FAILED,r.data);break;case Tf.AGENT_LOGOUT_SUCCESS:e.emit($h.AGENT_LOGOUT_SUCCESS,r.data);break;case Tf.AGENT_LOGOUT_FAILED:e.emit($h.AGENT_LOGOUT_FAILED,r.data);break;case Tf.AGENT_DN_REGISTERED:e.emit($h.AGENT_DN_REGISTERED,r.data)}}})),e.eventEmitter=new(qe()),e.$webex=e.webex,e.$webex.once("ready",(function(){e.$config=e.config,e.webexRequest=Ef.getInstance({webex:e.$webex}),e.services=Kh.getInstance({webex:e.$webex,connectionConfig:e.getConnectionConfig()}),e.services.webSocketManager.on("message",e.handleWebsocketMessage),e.webCallingService=new HF(e.$webex),e.metricsManager=mf.getInstance({webex:e.$webex}),e.taskManager=WF.getTaskManager(e.services.contact,e.webCallingService,e.services.webSocketManager),e.incomingTaskListener(),Yd.initialize(e.$webex.logger)})),e}return oe(v,[{key:"incomingTaskListener",value:function(){this.taskManager.on(rh.TASK_INCOMING,this.handleIncomingTask),this.taskManager.on(rh.TASK_HYDRATE,this.handleTaskHydrate)}},{key:"register",value:(h=_e(Re().mark((function e(){var t;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Yd.info("Starting CC SDK registration",{module:gd,method:Td}),e.prev=1,this.metricsManager.timeEvent([uf.WEBSOCKET_REGISTER_SUCCESS,uf.WEBSOCKET_REGISTER_FAILED]),this.setupEventListeners(),e.next=6,this.connectWebsocket();case 6:return(t=e.sent).dn=t.defaultDn,this.metricsManager.trackEvent(uf.WEBSOCKET_REGISTER_SUCCESS,QF(QF({},mf.getCommonTrackingFieldForAQMResponse(t)),{},{deviceType:t.deviceType||hd}),["operational"]),Yd.log("CC SDK registration completed successfully with agentId: ".concat(t.agentId),{module:gd,method:Td}),e.abrupt("return",t);case 13:throw e.prev=13,e.t0=e.catch(1),this.metricsManager.trackEvent(uf.WEBSOCKET_REGISTER_FAILED,{orgId:e.t0.orgId},["operational"]),Yd.error("Error during register: ".concat(e.t0),{module:gd,method:Td}),this.webexRequest.uploadLogs({correlationId:null===e.t0||void 0===e.t0?void 0:e.t0.trackingId}),e.t0;case 19:case"end":return e.stop()}}),e,this,[[1,13]])}))),function(){return h.apply(this,arguments)})},{key:"deregister",value:(f=_e(Re().mark((function e(){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.metricsManager.timeEvent([uf.WEBSOCKET_DEREGISTER_SUCCESS,uf.WEBSOCKET_DEREGISTER_FAIL]),this.taskManager.off(rh.TASK_INCOMING,this.handleIncomingTask),this.taskManager.off(rh.TASK_HYDRATE,this.handleTaskHydrate),this.taskManager.unregisterIncomingCallEvent(),this.services.webSocketManager.off("message",this.handleWebsocketMessage),this.services.connectionService.off("connectionLost",this.handleConnectionLost),!this.agentConfig.webRtcEnabled||!this.agentConfig.loginVoiceOptions.includes(fd)){e.next=16;break}if(!this.$webex.internal.mercury.connected){e.next=16;break}return this.$webex.internal.mercury.off("online"),this.$webex.internal.mercury.off("offline"),e.next=13,this.$webex.internal.mercury.disconnect();case 13:return e.next=15,this.$webex.internal.device.unregister();case 15:Yd.log("Mercury disconnected successfully",{module:gd,method:xd});case 16:this.services.webSocketManager.isSocketClosed||this.services.webSocketManager.close(!1,"Unregistering the SDK"),this.agentConfig=null,Yd.log("Deregistered successfully",{module:gd,method:xd}),this.metricsManager.trackEvent(uf.WEBSOCKET_DEREGISTER_SUCCESS,{},["operational"]),e.next=27;break;case 22:throw e.prev=22,e.t0=e.catch(0),this.metricsManager.trackEvent(uf.WEBSOCKET_DEREGISTER_FAIL,{error:e.t0.message||"Unknown error"},["operational"]),Yd.error("Error during deregister: ".concat(e.t0),{module:gd,method:xd}),e.t0;case 27:case"end":return e.stop()}}),e,this,[[0,22]])}))),function(){return f.apply(this,arguments)})},{key:"getBuddyAgents",value:(d=_e(Re().mark((function e(t){var r,n;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Yd.info("Fetching buddy agents",{module:gd,method:kd}),e.prev=1,this.metricsManager.timeEvent([uf.FETCH_BUDDY_AGENTS_SUCCESS,uf.FETCH_BUDDY_AGENTS_FAILED]),e.next=5,this.services.agent.buddyAgents({data:QF({agentProfileId:this.agentConfig.agentProfileID},t)});case 5:return r=e.sent,this.metricsManager.trackEvent(uf.FETCH_BUDDY_AGENTS_SUCCESS,QF(QF({},mf.getCommonTrackingFieldForAQMResponse(r)),{},{mediaType:t.mediaType,buddyAgentState:t.state,buddyAgentCount:r.data.agentList.length}),["operational"]),Yd.log("Successfully retrieved ".concat(r.data.agentList.length," buddy agents"),{module:gd,method:kd,trackingId:r.trackingId}),e.abrupt("return",r);case 11:throw e.prev=11,e.t0=e.catch(1),n=e.t0.details,this.metricsManager.trackEvent(uf.FETCH_BUDDY_AGENTS_FAILED,QF(QF({},mf.getCommonTrackingFieldForAQMResponseFailed(n)),{},{mediaType:t.mediaType,buddyAgentState:t.state}),["operational"]),Sf(e.t0,kd,gd).error;case 17:case"end":return e.stop()}}),e,this,[[1,11]])}))),function(e){return d.apply(this,arguments)})},{key:"connectWebsocket",value:(l=_e(Re().mark((function e(){var t=this;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Yd.info("Connecting to websocket",{module:gd,method:Id}),e.prev=1,e.abrupt("return",this.services.webSocketManager.initWebSocket({body:this.getConnectionConfig()}).then(function(){var e=_e(Re().mark((function e(r){var n,i;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.agentId,i=t.$webex.credentials.getOrgId(),e.next=4,t.services.config.getAgentConfig(i,n);case 4:if(t.agentConfig=e.sent,Yd.log("Agent config is fetched successfully",{module:gd,method:Id}),t.taskManager.setWrapupData(t.agentConfig.wrapUpData),t.agentConfig.webRtcEnabled&&t.agentConfig.loginVoiceOptions.includes(fd)&&t.$webex.internal.mercury.connect().then((function(){Yd.log("Authentication: webex.internal.mercury.connect successful",{module:gd,method:Id})})).catch((function(e){Yd.error("Error occurred during mercury.connect() ".concat(e),{module:gd,method:Id})})),!t.$config||!t.$config.allowAutomatedRelogin){e.next=11;break}return e.next=11,t.silentRelogin();case 11:return e.abrupt("return",t.agentConfig);case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()).catch((function(e){throw e})));case 5:throw e.prev=5,e.t0=e.catch(1),Yd.error("Error during register: ".concat(e.t0),{module:gd,method:Id}),e.t0;case 9:case"end":return e.stop()}}),e,this,[[1,5]])}))),function(){return l.apply(this,arguments)})},{key:"stationLogin",value:(u=_e(Re().mark((function e(t){var r,n,i,o,a,s,c,u,l,d,f,h,p;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Yd.info("Starting agent station login",{module:gd,method:Ad}),e.prev=1,this.metricsManager.timeEvent([uf.STATION_LOGIN_SUCCESS,uf.STATION_LOGIN_FAILED]),t.loginOption!==ld||(v=t.dialNumber,/1[0-9]{3}[2-9][0-9]{6}([,]{1,10}[0-9]+){0,1}/.test(v))){e.next=7;break}throw(s=new Error("INVALID_DIAL_NUMBER")).details={data:{reason:"INVALID_DIAL_NUMBER"}},s;case 7:if(c=this.services.agent.stationLogin({data:{dialNumber:t.loginOption===fd?this.agentConfig.agentId:t.dialNumber,teamId:t.teamId,deviceType:t.loginOption,isExtension:t.loginOption===dd,deviceId:this.getDeviceId(t.loginOption,t.dialNumber),roles:["agent"],teamName:hd,siteId:hd,usesOtherDN:!1,auxCodeId:hd}}),!this.agentConfig.webRtcEnabled||t.loginOption!==fd){e.next=11;break}return e.next=11,this.webCallingService.registerWebCallingLine();case 11:return e.next=13,c;case 13:return u=e.sent,l=u.data,d=l.channelsMap,f=Ql(l,JF),this.agentConfig.currentTeamId=u.data.teamId,h=QF(QF({},f),{},{mmProfile:{chat:null===(r=d.chat)||void 0===r?void 0:r.length,email:null===(n=d.email)||void 0===n?void 0:n.length,social:null===(i=d.social)||void 0===i?void 0:i.length,telephony:null===(o=d.telephony)||void 0===o?void 0:o.length},notifsTrackingId:u.trackingId}),this.webCallingService.setLoginOption(t.loginOption),this.metricsManager.trackEvent(uf.STATION_LOGIN_SUCCESS,QF(QF({},mf.getCommonTrackingFieldForAQMResponse(u)),{},{loginType:t.loginOption,status:u.data.status,type:u.data.type,roles:(null===(a=u.data.roles)||void 0===a?void 0:a.join(","))||hd}),["behavioral","business","operational"]),Yd.log("Agent station login completed successfully agentId: ".concat(u.data.agentId," loginOption: ").concat(t.loginOption," teamId: ").concat(t.teamId),{module:gd,method:Ad,trackingId:u.trackingId}),e.abrupt("return",h);case 23:throw e.prev=23,e.t0=e.catch(1),p=e.t0.details,this.metricsManager.trackEvent(uf.STATION_LOGIN_FAILED,QF(QF({},mf.getCommonTrackingFieldForAQMResponseFailed(p)),{},{loginType:t.loginOption}),["behavioral","business","operational"]),e.t0.loginOption=t.loginOption,Sf(e.t0,Ad,gd).error;case 30:case"end":return e.stop()}var v}),e,this,[[1,23]])}))),function(e){return u.apply(this,arguments)})},{key:"stationLogout",value:(c=_e(Re().mark((function e(t){var r,n,i;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Yd.info("Starting agent station logout",{module:gd,method:Od}),e.prev=1,this.metricsManager.timeEvent([uf.STATION_LOGOUT_SUCCESS,uf.STATION_LOGOUT_FAILED]),r=this.services.agent.logout({data:t}),e.next=6,r;case 6:return n=e.sent,this.metricsManager.trackEvent(uf.STATION_LOGOUT_SUCCESS,QF(QF({},mf.getCommonTrackingFieldForAQMResponse(n)),{},{logoutReason:t.logoutReason}),["behavioral","business","operational"]),this.webCallingService&&this.webCallingService.deregisterWebCallingLine(),Yd.log("Agent station logout completed successfully",{module:gd,method:Od,trackingId:n.trackingId}),e.abrupt("return",n);case 13:throw e.prev=13,e.t0=e.catch(1),i=e.t0.details,this.metricsManager.trackEvent(uf.STATION_LOGOUT_FAILED,QF(QF({},mf.getCommonTrackingFieldForAQMResponseFailed(i)),{},{logoutReason:t.logoutReason}),["behavioral","business","operational"]),Sf(e.t0,Od,gd).error;case 19:case"end":return e.stop()}}),e,this,[[1,13]])}))),function(e){return c.apply(this,arguments)})},{key:"getDeviceId",value:function(e,t){return e===dd||e===ld?t:"webrtc-"+this.agentConfig.agentId}},{key:"setAgentState",value:(s=_e(Re().mark((function e(t){var r,n,i,o,a,s,c;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Yd.info("Setting agent state",{module:gd,method:Ld}),e.prev=1,this.metricsManager.timeEvent([uf.AGENT_STATE_CHANGE_SUCCESS,uf.AGENT_STATE_CHANGE_FAILED]),e.next=5,this.services.agent.stateChange({data:QF(QF({},t),{},{agentId:t.agentId||this.agentConfig.agentId})});case 5:return s=e.sent,this.metricsManager.trackEvent(uf.AGENT_STATE_CHANGE_SUCCESS,QF(QF({},mf.getCommonTrackingFieldForAQMResponse(s)),{},{requestedState:t.state,teamId:null!==(r=null===(n=this.agentConfig)||void 0===n||null===(i=n.teams[0])||void 0===i?void 0:i.teamId)&&void 0!==r?r:hd,status:null===(o=s.data)||void 0===o?void 0:o.status,subStatus:null===(a=s.data)||void 0===a?void 0:a.subStatus,auxCodeId:t.auxCodeId,lastStateChangeReason:t.lastStateChangeReason||hd}),["behavioral","business","operational"]),Yd.log("Agent state changed successfully to auxCodeId: ".concat(s.data.auxCodeId),{module:gd,method:Ld,trackingId:s.trackingId}),e.abrupt("return",s);case 11:throw e.prev=11,e.t0=e.catch(1),c=e.t0.details,this.metricsManager.trackEvent(uf.AGENT_STATE_CHANGE_FAILED,QF(QF({},mf.getCommonTrackingFieldForAQMResponseFailed(c)),{},{state:t.state,auxCodeId:t.auxCodeId,lastStateChangeReason:t.lastStateChangeReason||hd}),["behavioral","business","operational"]),Sf(e.t0,Ld,gd).error;case 17:case"end":return e.stop()}}),e,this,[[1,11]])}))),function(e){return s.apply(this,arguments)})},{key:"setupEventListeners",value:function(){this.services.connectionService.on("connectionLost",this.handleConnectionLost.bind(this))}},{key:"getConnectionConfig",value:function(){var e,t,r,n,i,o,a,s;return{force:null===(e=null===(t=this.$config)||void 0===t?void 0:t.force)||void 0===e||e,isKeepAliveEnabled:null!==(r=null===(n=this.$config)||void 0===n?void 0:n.isKeepAliveEnabled)&&void 0!==r&&r,clientType:null!==(i=null===(o=this.$config)||void 0===o?void 0:o.clientType)&&void 0!==i?i:"WebexCCSDK",allowMultiLogin:null===(a=null===(s=this.$config)||void 0===s?void 0:s.allowMultiLogin)||void 0===a||a}}},{key:"handleConnectionLost",value:(a=_e(Re().mark((function e(t){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.isConnectionLost){e.next=4;break}Yd.info("event=handleConnectionLost | Connection lost",{module:gd,method:Nd}),e.next=9;break;case 4:if(!t.isSocketReconnected){e.next=9;break}if(Yd.info("event=handleConnectionReconnect | Connection reconnected attempting to request silent relogin",{module:gd,method:Nd}),!this.$config||!this.$config.allowAutomatedRelogin){e.next=9;break}return e.next=9,this.silentRelogin();case 9:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"silentRelogin",value:(o=_e(Re().mark((function e(){var t,r,n,i,o,a,s,c,u,l,d,f,h,p;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Yd.info("Starting silent relogin process",{module:gd,method:Pd}),e.prev=1,e.next=4,this.services.agent.reload();case 4:return t=e.sent,r=t.data,n=r.agentId,i=r.lastStateChangeReason,o=r.deviceType,a=r.dn,s=r.lastStateChangeTimestamp,c=r.lastIdleCodeChangeTimestamp,u=t.data.auxCodeId,this.agentConfig.lastStateChangeTimestamp=s,this.agentConfig.lastIdleCodeChangeTimestamp=c,this.agentConfig.currentTeamId=t.data.teamId,e.next=12,this.handleDeviceType(o,a);case 12:if("agent-wss-disconnect"!==i){e.next=27;break}return Yd.info("event=requestAutoStateChange | Requesting state change to available on socket reconnect",{module:gd,method:Pd}),l={state:"Available",auxCodeId:u="0",lastStateChangeReason:i,agentId:n},e.prev=16,e.next=19,this.setAgentState(l);case 19:d=e.sent,this.agentConfig.lastStateChangeTimestamp=d.data.lastStateChangeTimestamp,this.agentConfig.lastIdleCodeChangeTimestamp=d.data.lastIdleCodeChangeTimestamp,e.next=27;break;case 24:e.prev=24,e.t0=e.catch(16),Yd.error("event=requestAutoStateChange | Error requesting state change to available on socket reconnect: ".concat(e.t0),{module:gd,method:Pd});case 27:this.agentConfig.lastStateAuxCodeId=u,this.agentConfig.isAgentLoggedIn=!0,this.services.webSocketManager.on("message",this.handleWebsocketMessage),Yd.log("Silent relogin process completed successfully with login Option: ".concat(t.data.deviceType," teamId: ").concat(t.data.teamId),{module:gd,method:Pd,trackingId:t.trackingId}),e.next=40;break;case 33:if(e.prev=33,e.t1=e.catch(1),f=Sf(e.t1,Pd,gd),h=f.reason,p=f.error,"AGENT_NOT_FOUND"!==h){e.next=39;break}return Yd.log("Agent not found during relogin, handling silently",{module:gd,method:Pd}),e.abrupt("return");case 39:throw p;case 40:case"end":return e.stop()}}),e,this,[[1,33],[16,24]])}))),function(){return o.apply(this,arguments)})},{key:"handleDeviceType",value:(i=_e(Re().mark((function e(t,r){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.webCallingService.setLoginOption(t),this.agentConfig.deviceType=t,e.t0=t,e.next=e.t0===fd?5:e.t0===ld||e.t0===dd?15:18;break;case 5:return e.prev=5,e.next=8,this.webCallingService.registerWebCallingLine();case 8:e.next=14;break;case 10:throw e.prev=10,e.t1=e.catch(5),Yd.error("Error registering web calling line: ".concat(e.t1),{module:gd,method:Dd}),e.t1;case 14:return e.abrupt("break",20);case 15:return this.agentConfig.defaultDn=r,this.agentConfig.dn=r,e.abrupt("break",20);case 18:throw Yd.error("Unsupported device type: ".concat(t),{module:gd,method:Dd}),new Error("Unsupported device type: ".concat(t));case 20:case"end":return e.stop()}}),e,this,[[5,10]])}))),function(e,t){return i.apply(this,arguments)})},{key:"startOutdial",value:(n=_e(Re().mark((function e(t){var r,n,i,o;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Yd.info("Starting outbound dial",{module:gd,method:Fd}),e.prev=1,this.metricsManager.timeEvent([uf.TASK_OUTDIAL_SUCCESS,uf.TASK_OUTDIAL_FAILED]),n={destination:t,entryPointId:this.agentConfig.outDialEp,direction:"OUTBOUND",attributes:Rd,mediaType:Cd,outboundType:"OUTDIAL"},e.next=6,this.services.dialer.startOutdial({data:n});case 6:return i=e.sent,this.metricsManager.trackEvent(uf.TASK_OUTDIAL_SUCCESS,QF(QF({},mf.getCommonTrackingFieldForAQMResponse(i)),{},{destination:t,mediaType:Cd}),["behavioral","business","operational"]),Yd.log("Outbound dial completed successfully",{module:gd,method:Fd,trackingId:i.trackingId,interactionId:null===(r=i.data)||void 0===r?void 0:r.interactionId}),e.abrupt("return",i);case 12:throw e.prev=12,e.t0=e.catch(1),o=e.t0.details,this.metricsManager.trackEvent(uf.TASK_OUTDIAL_FAILED,QF(QF({},mf.getCommonTrackingFieldForAQMResponseFailed(o)),{},{destination:t,mediaType:Cd}),["behavioral","business","operational"]),Sf(e.t0,Fd,gd).error;case 18:case"end":return e.stop()}}),e,this,[[1,12]])}))),function(e){return n.apply(this,arguments)})},{key:"getQueues",value:(r=_e(Re().mark((function e(t,r){var n,i,o,a,s=arguments;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=s.length>2&&void 0!==s[2]?s[2]:0,i=s.length>3&&void 0!==s[3]?s[3]:100,Yd.info("Fetching queues",{module:gd,method:Ud}),o=this.$webex.credentials.getOrgId()){e.next=7;break}throw Yd.error("Org ID not found.",{module:gd,method:Ud}),new Error("Org ID not found.");case 7:return e.next=9,this.services.config.getQueues(o,n,i,t,r);case 9:return a=e.sent,Yd.log("Successfully retrieved ".concat(null==a?void 0:a.length," queues"),{module:gd,method:Ud}),e.abrupt("return",a);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"uploadLogs",value:function(){var e=_e(Re().mark((function e(){return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.webexRequest.uploadLogs());case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"updateAgentProfile",value:(t=_e(Re().mark((function e(t){var r,n,i,o,a,s,c,u;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.metricsManager.timeEvent([uf.AGENT_DEVICE_TYPE_UPDATE_SUCCESS,uf.AGENT_DEVICE_TYPE_UPDATE_FAILED]),r="WX_CC_SDK_".concat(od()),Yd.info("starting profile update",{module:gd,method:jd,trackingId:r}),e.prev=3,(null===(n=this.webCallingService)||void 0===n?void 0:n.loginOption)!==t.loginOption||t.teamId!==this.agentConfig.currentTeamId){e.next=9;break}throw i="Will not proceed with device update as new Device type is same as current device type and teamId is same as current teamId",(o=new Error(i)).details={type:"Identical Device Change Failure",orgId:this.$webex.credentials.getOrgId(),trackingId:r,data:{agentId:this.agentConfig.agentId,reasonCode:"R002",reason:i}},o;case 9:return e.next=11,this.stationLogout({logoutReason:"User requested agent device change"});case 11:return a={teamId:t.teamId,loginOption:t.loginOption,dialNumber:t.dialNumber},e.next=14,this.stationLogin(a);case 14:return s=e.sent,this.metricsManager.trackEvent(uf.AGENT_DEVICE_TYPE_UPDATE_SUCCESS,QF(QF({},mf.getCommonTrackingFieldForAQMResponse(s)),{},{loginType:t.loginOption}),["behavioral","business","operational"]),Yd.log("profile updated successfully with ".concat(a.loginOption," teamId: ").concat(a.teamId),{module:gd,method:jd,trackingId:r}),c=QF(QF({},s),{},{type:"AgentDeviceTypeUpdateSuccess"}),e.abrupt("return",c);case 21:throw e.prev=21,e.t0=e.catch(3),u=e.t0.details,this.metricsManager.trackEvent(uf.AGENT_DEVICE_TYPE_UPDATE_FAILED,QF(QF({},mf.getCommonTrackingFieldForAQMResponseFailed(u)),{},{loginType:t.loginOption}),["behavioral","business","operational"]),Yd.error("error updating profile: ".concat(e.t0),{module:gd,method:jd,trackingId:r}),e.t0;case 27:case"end":return e.stop()}}),e,this,[[3,21]])}))),function(e){return t.apply(this,arguments)})}]),v}(dr);Pi("cc",ZF,{config:{cc:{allowMultiLogin:!1,allowAutomatedRelogin:!0,clientType:"WebexCCSDK",isKeepAliveEnabled:!1,force:!0,metrics:{clientName:"WEBEX_JS_SDK",clientType:"WebexCCSDK"}}}});const eU={hydra:"https://api.ciscospark.com/v1",hydraServiceUrl:"https://api.ciscospark.com/v1",credentials:{},device:{validateDomains:!0,ephemeral:!0},storage:{boundedAdapter:lr,unboundedAdapter:lr}};__webpack_require__.g.Buffer||(__webpack_require__.g.Buffer=H.Buffer);var tU=Ni.extend({webex:!0,version:"3.8.1-next.55"});tU.init=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.config=r()({},eU,e.config),new tU(e)};const rU=tU})(),__webpack_exports__=__webpack_exports__.default,__webpack_exports__})()));
|
|
3
|
+
//# sourceMappingURL=contact-center.min.js.map
|