uneeq-js 2.45.0 → 2.46.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -13,14 +13,14 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
15
  ***************************************************************************** */
16
- var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function i(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(0),i=n(23),o=n(58),s=n(4),a=n(41),c=n(13),u=n(33),h=function(t){function e(n,r,i){var s=t.call(this)||this;switch(s.syncErrorValue=null,s.syncErrorThrown=!1,s.syncErrorThrowable=!1,s.isStopped=!1,arguments.length){case 0:s.destination=o.a;break;case 1:if(!n){s.destination=o.a;break}if("object"==typeof n){n instanceof e?(s.syncErrorThrowable=n.syncErrorThrowable,s.destination=n,n.add(s)):(s.syncErrorThrowable=!0,s.destination=new l(s,n));break}default:s.syncErrorThrowable=!0,s.destination=new l(s,n,r,i)}return s}return r.a(e,t),e.prototype[a.a]=function(){return this},e.create=function(t,n,r){var i=new e(t,n,r);return i.syncErrorThrowable=!1,i},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e}(s.a),l=function(t){function e(e,n,r,s){var a,c=t.call(this)||this;c._parentSubscriber=e;var u=c;return Object(i.a)(n)?a=n:n&&(a=n.next,r=n.error,s=n.complete,n!==o.a&&(u=Object.create(n),Object(i.a)(u.unsubscribe)&&c.add(u.unsubscribe.bind(u)),u.unsubscribe=c.unsubscribe.bind(c))),c._context=u,c._next=a,c._error=r,c._complete=s,c}return r.a(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;c.a.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,n=c.a.useDeprecatedSynchronousErrorHandling;if(this._error)n&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)n?(e.syncErrorValue=t,e.syncErrorThrown=!0):Object(u.a)(t),this.unsubscribe();else{if(this.unsubscribe(),n)throw t;Object(u.a)(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var n=function(){return t._complete.call(t._context)};c.a.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),c.a.useDeprecatedSynchronousErrorHandling)throw t;Object(u.a)(t)}},e.prototype.__tryOrSetError=function(t,e,n){if(!c.a.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,n)}catch(e){return c.a.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(Object(u.a)(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(h)},function(t,e,n){"use strict";n.d(e,"a",(function(){return a})),n.d(e,"b",(function(){return c})),n.d(e,"c",(function(){return u}));var r=n(0),i=n(1),o=n(3),s=n(32),a=function(t){function e(e){var n=t.call(this)||this;return n.parent=e,n}return r.a(e,t),e.prototype._next=function(t){this.parent.notifyNext(t)},e.prototype._error=function(t){this.parent.notifyError(t),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(),this.unsubscribe()},e}(i.a),c=(i.a,function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.a(e,t),e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyError=function(t){this.destination.error(t)},e.prototype.notifyComplete=function(){this.destination.complete()},e}(i.a));i.a;function u(t,e){if(!e.closed){if(t instanceof o.a)return t.subscribe(e);var n;try{n=Object(s.a)(t)(e)}catch(t){e.error(t)}return n}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(56),i=n(1),o=n(41),s=n(58);var a=n(20),c=n(39),u=n(13),h=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r=this.operator,a=function(t,e,n){if(t){if(t instanceof i.a)return t;if(t[o.a])return t[o.a]()}return t||e||n?new i.a(t,e,n):new i.a(s.a)}(t,e,n);if(r?a.add(r.call(a,this.source)):a.add(this.source||u.a.useDeprecatedSynchronousErrorHandling&&!a.syncErrorThrowable?this._subscribe(a):this._trySubscribe(a)),u.a.useDeprecatedSynchronousErrorHandling&&a.syncErrorThrowable&&(a.syncErrorThrowable=!1,a.syncErrorThrown))throw a.syncErrorValue;return a},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){u.a.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),Object(r.a)(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=l(e))((function(e,r){var i;i=n.subscribe((function(e){try{t(e)}catch(t){r(t),i&&i.unsubscribe()}}),r,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[a.a]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:Object(c.b)(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=l(t))((function(t,n){var r;e.subscribe((function(t){return r=t}),(function(t){return n(t)}),(function(){return t(r)}))}))},t.create=function(e){return new t(e)},t}();function l(t){if(t||(t=u.a.Promise||Promise),!t)throw new Error("no Promise impl found");return t}},function(t,e,n){"use strict";n.d(e,"a",(function(){return a}));var r=n(7),i=n(55),o=n(23),s=n(42),a=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}var e;return t.prototype.unsubscribe=function(){var e;if(!this.closed){var n=this._parentOrParents,a=this._ctorUnsubscribe,u=this._unsubscribe,h=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof t)n.remove(this);else if(null!==n)for(var l=0;l<n.length;++l){n[l].remove(this)}if(Object(o.a)(u)){a&&(this._unsubscribe=void 0);try{u.call(this)}catch(t){e=t instanceof s.a?c(t.errors):[t]}}if(Object(r.a)(h)){l=-1;for(var f=h.length;++l<f;){var d=h[l];if(Object(i.a)(d))try{d.unsubscribe()}catch(t){e=e||[],t instanceof s.a?e=e.concat(c(t.errors)):e.push(t)}}}if(e)throw new s.a(e)}},t.prototype.add=function(e){var n=e;if(!e)return t.EMPTY;switch(typeof e){case"function":n=new t(e);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof t)){var r=n;(n=new t)._subscriptions=[r]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var i=n._parentOrParents;if(null===i)n._parentOrParents=this;else if(i instanceof t){if(i===this)return n;n._parentOrParents=[i,this]}else{if(-1!==i.indexOf(this))return n;i.push(this)}var o=this._subscriptions;return null===o?this._subscriptions=[n]:o.push(n),n},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var n=e.indexOf(t);-1!==n&&e.splice(n,1)}},t.EMPTY=((e=new t).closed=!0,e),t}();function c(t){return t.reduce((function(t,e){return t.concat(e instanceof s.a?e.errors:e)}),[])}},function(t,e,n){"use strict";n.d(e,"b",(function(){return h})),n.d(e,"a",(function(){return l}));var r=n(0),i=n(3),o=n(1),s=n(4),a=n(21),c=n(74),u=n(41),h=function(t){function e(e){var n=t.call(this,e)||this;return n.destination=e,n}return r.a(e,t),e}(o.a),l=function(t){function e(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return r.a(e,t),e.prototype[u.a]=function(){return new h(this)},e.prototype.lift=function(t){var e=new f(this,this);return e.operator=t,e},e.prototype.next=function(t){if(this.closed)throw new a.a;if(!this.isStopped)for(var e=this.observers,n=e.length,r=e.slice(),i=0;i<n;i++)r[i].next(t)},e.prototype.error=function(t){if(this.closed)throw new a.a;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,n=e.length,r=e.slice(),i=0;i<n;i++)r[i].error(t);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new a.a;this.isStopped=!0;for(var t=this.observers,e=t.length,n=t.slice(),r=0;r<e;r++)n[r].complete();this.observers.length=0},e.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},e.prototype._trySubscribe=function(e){if(this.closed)throw new a.a;return t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){if(this.closed)throw new a.a;return this.hasError?(t.error(this.thrownError),s.a.EMPTY):this.isStopped?(t.complete(),s.a.EMPTY):(this.observers.push(t),new c.a(this,t))},e.prototype.asObservable=function(){var t=new i.a;return t.source=this,t},e.create=function(t,e){return new f(t,e)},e}(i.a),f=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return r.a(e,t),e.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},e.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},e.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},e.prototype._subscribe=function(t){return this.source?this.source.subscribe(t):s.a.EMPTY},e}(l)},function(t,e,n){"use strict";n.d(e,"b",(function(){return i})),n.d(e,"a",(function(){return o}));var r=n(29),i=new(n(27).a)(r.a),o=i},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(0),i=n(1);function o(t,e){return function(n){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new s(t,e))}}var s=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.project,this.thisArg))},t}(),a=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.project=n,i.count=0,i.thisArg=r||i,i}return r.a(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(i.a)},function(t,e,n){"use strict";function r(t){return t&&"function"==typeof t.schedule}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return o}));var r=n(3),i=new r.a((function(t){return t.complete()}));function o(t){return t?function(t){return new r.a((function(e){return t.schedule((function(){return e.complete()}))}))}(t):i}},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(3),i=n(32),o=n(73);function s(t,e){return e?Object(o.a)(t,e):t instanceof r.a?t:new r.a(Object(i.a)(t))}},function(t,e,n){"use strict";n.d(e,"a",(function(){return a}));var r=n(0),i=function(t){function e(e,n,r){var i=t.call(this)||this;return i.parent=e,i.outerValue=n,i.outerIndex=r,i.index=0,i}return r.a(e,t),e.prototype._next=function(t){this.parent.notifyNext(this.outerValue,t,this.outerIndex,this.index++,this)},e.prototype._error=function(t){this.parent.notifyError(t,this),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},e}(n(1).a),o=n(32),s=n(3);function a(t,e,n,r,a){if(void 0===a&&(a=new i(t,n,r)),!a.closed)return e instanceof s.a?e.subscribe(a):Object(o.a)(e)(a)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=!1,i={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack;r=t},get useDeprecatedSynchronousErrorHandling(){return r}}},function(t,e,n){"use strict";function r(t){return t}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(0),i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.a(e,t),e.prototype.notifyNext=function(t,e,n,r,i){this.destination.next(e)},e.prototype.notifyError=function(t,e){this.destination.error(t)},e.prototype.notifyComplete=function(t){this.destination.complete()},e}(n(1).a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(0),i=n(1);function o(t,e){return function(n){return n.lift(new s(t,e))}}var s=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.predicate,this.thisArg))},t}(),a=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.predicate=n,i.thisArg=r,i.count=0,i}return r.a(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(i.a)},function(t,e,n){"use strict";n.d(e,"b",(function(){return r})),n.d(e,"a",(function(){return a}));var r,i=n(10),o=n(36),s=n(50);r||(r={});var a=function(){function t(t,e,n){this.kind=t,this.value=e,this.error=n,this.hasValue="N"===t}return t.prototype.observe=function(t){switch(this.kind){case"N":return t.next&&t.next(this.value);case"E":return t.error&&t.error(this.error);case"C":return t.complete&&t.complete()}},t.prototype.do=function(t,e,n){switch(this.kind){case"N":return t&&t(this.value);case"E":return e&&e(this.error);case"C":return n&&n()}},t.prototype.accept=function(t,e,n){return t&&"function"==typeof t.next?this.observe(t):this.do(t,e,n)},t.prototype.toObservable=function(){switch(this.kind){case"N":return Object(o.a)(this.value);case"E":return Object(s.a)(this.error);case"C":return Object(i.b)()}throw new Error("unexpected notification kind value")},t.createNext=function(e){return void 0!==e?new t("N",e):t.undefinedValueNotification},t.createError=function(e){return new t("E",void 0,e)},t.createComplete=function(){return t.completeNotification},t.completeNotification=new t("C"),t.undefinedValueNotification=new t("N",void 0),t}()},function(t,e,n){"use strict";function r(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}n.d(e,"a",(function(){return i}));var i=r()},function(t,e,n){"use strict";function r(){}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){function t(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return t.prototype=Object.create(Error.prototype),t}()},function(t,e,n){"use strict";function r(t){return"function"==typeof t}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){function t(){return Error.call(this),this.message="no elements in sequence",this.name="EmptyError",this}return t.prototype=Object.create(Error.prototype),t}()},function(t,e,n){"use strict";n.d(e,"b",(function(){return a})),n.d(e,"a",(function(){return h}));var r=n(0),i=n(8),o=n(11),s=n(2);function a(t,e,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),"function"==typeof e?function(r){return r.pipe(a((function(n,r){return Object(o.a)(t(n,r)).pipe(Object(i.a)((function(t,i){return e(n,t,r,i)})))}),n))}:("number"==typeof e&&(n=e),function(e){return e.lift(new c(t,n))})}var c=function(){function t(t,e){void 0===e&&(e=Number.POSITIVE_INFINITY),this.project=t,this.concurrent=e}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.project,this.concurrent))},t}(),u=function(t){function e(e,n,r){void 0===r&&(r=Number.POSITIVE_INFINITY);var i=t.call(this,e)||this;return i.project=n,i.concurrent=r,i.hasCompleted=!1,i.buffer=[],i.active=0,i.index=0,i}return r.a(e,t),e.prototype._next=function(t){this.active<this.concurrent?this._tryNext(t):this.buffer.push(t)},e.prototype._tryNext=function(t){var e,n=this.index++;try{e=this.project(t,n)}catch(t){return void this.destination.error(t)}this.active++,this._innerSub(e)},e.prototype._innerSub=function(t){var e=new s.a(this),n=this.destination;n.add(e);var r=Object(s.c)(t,e);r!==e&&n.add(r)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyComplete=function(){var t=this.buffer;this.active--,t.length>0?this._next(t.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(s.b),h=a},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(3),i=n(75),o=n(57);function s(t,e){return e?Object(o.a)(t,e):new r.a(Object(i.a)(t))}},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(0),i=n(61),o=function(t){function e(n,r){void 0===r&&(r=i.a.now);var o=t.call(this,n,(function(){return e.delegate&&e.delegate!==o?e.delegate.now():r()}))||this;return o.actions=[],o.active=!1,o.scheduled=void 0,o}return r.a(e,t),e.prototype.schedule=function(n,r,i){return void 0===r&&(r=0),e.delegate&&e.delegate!==this?e.delegate.schedule(n,r,i):t.prototype.schedule.call(this,n,r,i)},e.prototype.flush=function(t){var e=this.actions;if(this.active)e.push(t);else{var n;this.active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this.active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(i.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(0),i=n(5),o=n(4),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.value=null,e.hasNext=!1,e.hasCompleted=!1,e}return r.a(e,t),e.prototype._subscribe=function(e){return this.hasError?(e.error(this.thrownError),o.a.EMPTY):this.hasCompleted&&this.hasNext?(e.next(this.value),e.complete(),o.a.EMPTY):t.prototype._subscribe.call(this,e)},e.prototype.next=function(t){this.hasCompleted||(this.value=t,this.hasNext=!0)},e.prototype.error=function(e){this.hasCompleted||t.prototype.error.call(this,e)},e.prototype.complete=function(){this.hasCompleted=!0,this.hasNext&&t.prototype.next.call(this,this.value),t.prototype.complete.call(this)},e}(i.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(0),i=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return r.a(e,t),e.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t;var n=this.id,r=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(r,n,e)),this.pending=!0,this.delay=e,this.id=this.id||this.requestAsyncId(r,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),setInterval(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,e,n){if(void 0===n&&(n=0),null!==n&&this.delay===n&&!1===this.pending)return e;clearInterval(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var n=!1,r=void 0;try{this.work(t)}catch(t){n=!0,r=!!t&&t||new Error(t)}if(n)return this.unsubscribe(),r},e.prototype._unsubscribe=function(){var t=this.id,e=this.scheduler,n=e.actions,r=n.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==r&&n.splice(r,1),null!=t&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null},e}(function(t){function e(e,n){return t.call(this)||this}return r.a(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(n(4).a))},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(7);function i(t){return!Object(r.a)(t)&&t-parseFloat(t)+1>=0}},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(36),i=n(69);function o(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Object(i.a)()(r.a.apply(void 0,t))}},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(75),i=n(33),o=n(18),s=n(20),a=n(76),c=n(77),u=n(55),h=function(t){if(t&&"function"==typeof t[s.a])return h=t,function(t){var e=h[s.a]();if("function"!=typeof e.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return e.subscribe(t)};if(Object(a.a)(t))return Object(r.a)(t);if(Object(c.a)(t))return n=t,function(t){return n.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,i.a),t};if(t&&"function"==typeof t[o.a])return e=t,function(t){for(var n=e[o.a]();;){var r=void 0;try{r=n.next()}catch(e){return t.error(e),t}if(r.done){t.complete();break}if(t.next(r.value),t.closed)break}return"function"==typeof n.return&&t.add((function(){n.return&&n.return()})),t};var e,n,h,l=Object(u.a)(t)?"an invalid object":"'"+t+"'";throw new TypeError("You provided "+l+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")}},function(t,e,n){"use strict";function r(t){setTimeout((function(){throw t}),0)}n.d(e,"a",(function(){return r}))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),e.logger=e.Logger=e.LogType=void 0,function(t){t.debug="debug",t.log="log",t.warn="warn",t.error="error"}(r=e.LogType||(e.LogType={}));class i{constructor(){this.enabled=!1}log(t,...e){this.emitLogMessage(r.log,t,e)}warn(t,...e){this.emitLogMessage(r.warn,t,e)}error(t,...e){this.emitLogMessage(r.error,t,e)}debug(t,...e){this.emitLogMessage(r.debug,t,e)}emitLogMessage(t,e,n){(this.enabled||t===r.error)&&(n.length>0?console[t](e,n):console[t](e))}}e.Logger=i,e.logger=new i},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(9),i=n(26),o=n(57);function s(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[t.length-1];return Object(r.a)(n)?(t.pop(),Object(o.a)(t,n)):Object(i.a)(t)}},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e},s=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||e.hasOwnProperty(n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),n(100);const a=o(n(82)),c=n(84);s(n(63),e);var u=n(84);Object.defineProperty(e,"Uneeq",{enumerable:!0,get:function(){return u.Uneeq}}),s(n(82),e),window.AdapterJS=a,window.Uneeq=c.Uneeq},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var c,u=[],h=!1,l=-1;function f(){h&&c&&(h=!1,c.length?u=c.concat(u):l=-1,u.length&&d())}function d(){if(!h){var t=a(f);h=!0;for(var e=u.length;e;){for(c=u,u=[];++l<e;)c&&c[l].run();l=-1,e=u.length}c=null,h=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function v(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new p(t,e)),1!==u.length||h||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){"use strict";n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return o}));var r=n(14);function i(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return o(t)}function o(t){return 0===t.length?r.a:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}},function(t,e,n){"use strict";n.d(e,"b",(function(){return l})),n.d(e,"a",(function(){return f}));var r=n(0),i=1,o=function(){return Promise.resolve()}(),s={};function a(t){return t in s&&(delete s[t],!0)}var c=function(t){var e=i++;return s[e]=!0,o.then((function(){return a(e)&&t()})),e},u=function(t){a(t)},h=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return r.a(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e.scheduled||(e.scheduled=c(e.flush.bind(e,null))))},e.prototype.recycleAsyncId=function(e,n,r){if(void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);0===e.actions.length&&(u(n),e.scheduled=void 0)},e}(n(29).a),l=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.a(e,t),e.prototype.flush=function(t){this.active=!0,this.scheduled=void 0;var e,n=this.actions,r=-1,i=n.length;t=t||n.shift();do{if(e=t.execute(t.state,t.delay))break}while(++r<i&&(t=n.shift()));if(this.active=!1,e){for(;++r<i&&(t=n.shift());)t.unsubscribe();throw e}},e}(n(27).a))(h),f=l},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}()},function(t,e,n){"use strict";const r={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};r.localCName=r.generateIdentifier(),r.splitLines=function(t){return t.trim().split("\n").map(t=>t.trim())},r.splitSections=function(t){return t.split("\nm=").map((t,e)=>(e>0?"m="+t:t).trim()+"\r\n")},r.getDescription=function(t){const e=r.splitSections(t);return e&&e[0]},r.getMediaSections=function(t){const e=r.splitSections(t);return e.shift(),e},r.matchPrefix=function(t,e){return r.splitLines(t).filter(t=>0===t.indexOf(e))},r.parseCandidate=function(t){let e;e=0===t.indexOf("a=candidate:")?t.substring(12).split(" "):t.substring(10).split(" ");const n={foundation:e[0],component:{1:"rtp",2:"rtcp"}[e[1]]||e[1],protocol:e[2].toLowerCase(),priority:parseInt(e[3],10),ip:e[4],address:e[4],port:parseInt(e[5],10),type:e[7]};for(let t=8;t<e.length;t+=2)switch(e[t]){case"raddr":n.relatedAddress=e[t+1];break;case"rport":n.relatedPort=parseInt(e[t+1],10);break;case"tcptype":n.tcpType=e[t+1];break;case"ufrag":n.ufrag=e[t+1],n.usernameFragment=e[t+1];break;default:void 0===n[e[t]]&&(n[e[t]]=e[t+1])}return n},r.writeCandidate=function(t){const e=[];e.push(t.foundation);const n=t.component;"rtp"===n?e.push(1):"rtcp"===n?e.push(2):e.push(n),e.push(t.protocol.toUpperCase()),e.push(t.priority),e.push(t.address||t.ip),e.push(t.port);const r=t.type;return e.push("typ"),e.push(r),"host"!==r&&t.relatedAddress&&t.relatedPort&&(e.push("raddr"),e.push(t.relatedAddress),e.push("rport"),e.push(t.relatedPort)),t.tcpType&&"tcp"===t.protocol.toLowerCase()&&(e.push("tcptype"),e.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(e.push("ufrag"),e.push(t.usernameFragment||t.ufrag)),"candidate:"+e.join(" ")},r.parseIceOptions=function(t){return t.substr(14).split(" ")},r.parseRtpMap=function(t){let e=t.substr(9).split(" ");const n={payloadType:parseInt(e.shift(),10)};return e=e[0].split("/"),n.name=e[0],n.clockRate=parseInt(e[1],10),n.channels=3===e.length?parseInt(e[2],10):1,n.numChannels=n.channels,n},r.writeRtpMap=function(t){let e=t.payloadType;void 0!==t.preferredPayloadType&&(e=t.preferredPayloadType);const n=t.channels||t.numChannels||1;return"a=rtpmap:"+e+" "+t.name+"/"+t.clockRate+(1!==n?"/"+n:"")+"\r\n"},r.parseExtmap=function(t){const e=t.substr(9).split(" ");return{id:parseInt(e[0],10),direction:e[0].indexOf("/")>0?e[0].split("/")[1]:"sendrecv",uri:e[1]}},r.writeExtmap=function(t){return"a=extmap:"+(t.id||t.preferredId)+(t.direction&&"sendrecv"!==t.direction?"/"+t.direction:"")+" "+t.uri+"\r\n"},r.parseFmtp=function(t){const e={};let n;const r=t.substr(t.indexOf(" ")+1).split(";");for(let t=0;t<r.length;t++)n=r[t].trim().split("="),e[n[0].trim()]=n[1];return e},r.writeFmtp=function(t){let e="",n=t.payloadType;if(void 0!==t.preferredPayloadType&&(n=t.preferredPayloadType),t.parameters&&Object.keys(t.parameters).length){const r=[];Object.keys(t.parameters).forEach(e=>{void 0!==t.parameters[e]?r.push(e+"="+t.parameters[e]):r.push(e)}),e+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return e},r.parseRtcpFb=function(t){const e=t.substr(t.indexOf(" ")+1).split(" ");return{type:e.shift(),parameter:e.join(" ")}},r.writeRtcpFb=function(t){let e="",n=t.payloadType;return void 0!==t.preferredPayloadType&&(n=t.preferredPayloadType),t.rtcpFeedback&&t.rtcpFeedback.length&&t.rtcpFeedback.forEach(t=>{e+="a=rtcp-fb:"+n+" "+t.type+(t.parameter&&t.parameter.length?" "+t.parameter:"")+"\r\n"}),e},r.parseSsrcMedia=function(t){const e=t.indexOf(" "),n={ssrc:parseInt(t.substr(7,e-7),10)},r=t.indexOf(":",e);return r>-1?(n.attribute=t.substr(e+1,r-e-1),n.value=t.substr(r+1)):n.attribute=t.substr(e+1),n},r.parseSsrcGroup=function(t){const e=t.substr(13).split(" ");return{semantics:e.shift(),ssrcs:e.map(t=>parseInt(t,10))}},r.getMid=function(t){const e=r.matchPrefix(t,"a=mid:")[0];if(e)return e.substr(6)},r.parseFingerprint=function(t){const e=t.substr(14).split(" ");return{algorithm:e[0].toLowerCase(),value:e[1].toUpperCase()}},r.getDtlsParameters=function(t,e){return{role:"auto",fingerprints:r.matchPrefix(t+e,"a=fingerprint:").map(r.parseFingerprint)}},r.writeDtlsParameters=function(t,e){let n="a=setup:"+e+"\r\n";return t.fingerprints.forEach(t=>{n+="a=fingerprint:"+t.algorithm+" "+t.value+"\r\n"}),n},r.parseCryptoLine=function(t){const e=t.substr(9).split(" ");return{tag:parseInt(e[0],10),cryptoSuite:e[1],keyParams:e[2],sessionParams:e.slice(3)}},r.writeCryptoLine=function(t){return"a=crypto:"+t.tag+" "+t.cryptoSuite+" "+("object"==typeof t.keyParams?r.writeCryptoKeyParams(t.keyParams):t.keyParams)+(t.sessionParams?" "+t.sessionParams.join(" "):"")+"\r\n"},r.parseCryptoKeyParams=function(t){if(0!==t.indexOf("inline:"))return null;const e=t.substr(7).split("|");return{keyMethod:"inline",keySalt:e[0],lifeTime:e[1],mkiValue:e[2]?e[2].split(":")[0]:void 0,mkiLength:e[2]?e[2].split(":")[1]:void 0}},r.writeCryptoKeyParams=function(t){return t.keyMethod+":"+t.keySalt+(t.lifeTime?"|"+t.lifeTime:"")+(t.mkiValue&&t.mkiLength?"|"+t.mkiValue+":"+t.mkiLength:"")},r.getCryptoParameters=function(t,e){return r.matchPrefix(t+e,"a=crypto:").map(r.parseCryptoLine)},r.getIceParameters=function(t,e){const n=r.matchPrefix(t+e,"a=ice-ufrag:")[0],i=r.matchPrefix(t+e,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substr(12),password:i.substr(10)}:null},r.writeIceParameters=function(t){let e="a=ice-ufrag:"+t.usernameFragment+"\r\na=ice-pwd:"+t.password+"\r\n";return t.iceLite&&(e+="a=ice-lite\r\n"),e},r.parseRtpParameters=function(t){const e={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=r.splitLines(t)[0].split(" ");for(let i=3;i<n.length;i++){const o=n[i],s=r.matchPrefix(t,"a=rtpmap:"+o+" ")[0];if(s){const n=r.parseRtpMap(s),i=r.matchPrefix(t,"a=fmtp:"+o+" ");switch(n.parameters=i.length?r.parseFmtp(i[0]):{},n.rtcpFeedback=r.matchPrefix(t,"a=rtcp-fb:"+o+" ").map(r.parseRtcpFb),e.codecs.push(n),n.name.toUpperCase()){case"RED":case"ULPFEC":e.fecMechanisms.push(n.name.toUpperCase())}}}return r.matchPrefix(t,"a=extmap:").forEach(t=>{e.headerExtensions.push(r.parseExtmap(t))}),e},r.writeRtpDescription=function(t,e){let n="";n+="m="+t+" ",n+=e.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=e.codecs.map(t=>void 0!==t.preferredPayloadType?t.preferredPayloadType:t.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",e.codecs.forEach(t=>{n+=r.writeRtpMap(t),n+=r.writeFmtp(t),n+=r.writeRtcpFb(t)});let i=0;return e.codecs.forEach(t=>{t.maxptime>i&&(i=t.maxptime)}),i>0&&(n+="a=maxptime:"+i+"\r\n"),e.headerExtensions&&e.headerExtensions.forEach(t=>{n+=r.writeExtmap(t)}),n},r.parseRtpEncodingParameters=function(t){const e=[],n=r.parseRtpParameters(t),i=-1!==n.fecMechanisms.indexOf("RED"),o=-1!==n.fecMechanisms.indexOf("ULPFEC"),s=r.matchPrefix(t,"a=ssrc:").map(t=>r.parseSsrcMedia(t)).filter(t=>"cname"===t.attribute),a=s.length>0&&s[0].ssrc;let c;const u=r.matchPrefix(t,"a=ssrc-group:FID").map(t=>t.substr(17).split(" ").map(t=>parseInt(t,10)));u.length>0&&u[0].length>1&&u[0][0]===a&&(c=u[0][1]),n.codecs.forEach(t=>{if("RTX"===t.name.toUpperCase()&&t.parameters.apt){let n={ssrc:a,codecPayloadType:parseInt(t.parameters.apt,10)};a&&c&&(n.rtx={ssrc:c}),e.push(n),i&&(n=JSON.parse(JSON.stringify(n)),n.fec={ssrc:a,mechanism:o?"red+ulpfec":"red"},e.push(n))}}),0===e.length&&a&&e.push({ssrc:a});let h=r.matchPrefix(t,"b=");return h.length&&(h=0===h[0].indexOf("b=TIAS:")?parseInt(h[0].substr(7),10):0===h[0].indexOf("b=AS:")?1e3*parseInt(h[0].substr(5),10)*.95-16e3:void 0,e.forEach(t=>{t.maxBitrate=h})),e},r.parseRtcpParameters=function(t){const e={},n=r.matchPrefix(t,"a=ssrc:").map(t=>r.parseSsrcMedia(t)).filter(t=>"cname"===t.attribute)[0];n&&(e.cname=n.value,e.ssrc=n.ssrc);const i=r.matchPrefix(t,"a=rtcp-rsize");e.reducedSize=i.length>0,e.compound=0===i.length;const o=r.matchPrefix(t,"a=rtcp-mux");return e.mux=o.length>0,e},r.writeRtcpParameters=function(t){let e="";return t.reducedSize&&(e+="a=rtcp-rsize\r\n"),t.mux&&(e+="a=rtcp-mux\r\n"),void 0!==t.ssrc&&t.cname&&(e+="a=ssrc:"+t.ssrc+" cname:"+t.cname+"\r\n"),e},r.parseMsid=function(t){let e;const n=r.matchPrefix(t,"a=msid:");if(1===n.length)return e=n[0].substr(7).split(" "),{stream:e[0],track:e[1]};const i=r.matchPrefix(t,"a=ssrc:").map(t=>r.parseSsrcMedia(t)).filter(t=>"msid"===t.attribute);return i.length>0?(e=i[0].value.split(" "),{stream:e[0],track:e[1]}):void 0},r.parseSctpDescription=function(t){const e=r.parseMLine(t),n=r.matchPrefix(t,"a=max-message-size:");let i;n.length>0&&(i=parseInt(n[0].substr(19),10)),isNaN(i)&&(i=65536);const o=r.matchPrefix(t,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:e.fmt,maxMessageSize:i};const s=r.matchPrefix(t,"a=sctpmap:");if(s.length>0){const t=s[0].substr(10).split(" ");return{port:parseInt(t[0],10),protocol:t[1],maxMessageSize:i}}},r.writeSctpDescription=function(t,e){let n=[];return n="DTLS/SCTP"!==t.protocol?["m="+t.kind+" 9 "+t.protocol+" "+e.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+e.port+"\r\n"]:["m="+t.kind+" 9 "+t.protocol+" "+e.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+e.port+" "+e.protocol+" 65535\r\n"],void 0!==e.maxMessageSize&&n.push("a=max-message-size:"+e.maxMessageSize+"\r\n"),n.join("")},r.generateSessionId=function(){return Math.random().toString().substr(2,21)},r.writeSessionBoilerplate=function(t,e,n){let i;const o=void 0!==e?e:2;i=t||r.generateSessionId();return"v=0\r\no="+(n||"thisisadapterortc")+" "+i+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},r.getDirection=function(t,e){const n=r.splitLines(t);for(let t=0;t<n.length;t++)switch(n[t]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[t].substr(2)}return e?r.getDirection(e):"sendrecv"},r.getKind=function(t){return r.splitLines(t)[0].split(" ")[0].substr(2)},r.isRejected=function(t){return"0"===t.split(" ",2)[1]},r.parseMLine=function(t){const e=r.splitLines(t)[0].substr(2).split(" ");return{kind:e[0],port:parseInt(e[1],10),protocol:e[2],fmt:e.slice(3).join(" ")}},r.parseOLine=function(t){const e=r.matchPrefix(t,"o=")[0].substr(2).split(" ");return{username:e[0],sessionId:e[1],sessionVersion:parseInt(e[2],10),netType:e[3],addressType:e[4],address:e[5]}},r.isValidSDP=function(t){if("string"!=typeof t||0===t.length)return!1;const e=r.splitLines(t);for(let t=0;t<e.length;t++)if(e[t].length<2||"="!==e[t].charAt(1))return!1;return!0},t.exports=r},function(t,e,n){"use strict";(function(t){
16
+ var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function i(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(0),i=n(23),o=n(58),s=n(4),a=n(41),c=n(13),u=n(34),h=function(t){function e(n,r,i){var s=t.call(this)||this;switch(s.syncErrorValue=null,s.syncErrorThrown=!1,s.syncErrorThrowable=!1,s.isStopped=!1,arguments.length){case 0:s.destination=o.a;break;case 1:if(!n){s.destination=o.a;break}if("object"==typeof n){n instanceof e?(s.syncErrorThrowable=n.syncErrorThrowable,s.destination=n,n.add(s)):(s.syncErrorThrowable=!0,s.destination=new l(s,n));break}default:s.syncErrorThrowable=!0,s.destination=new l(s,n,r,i)}return s}return r.a(e,t),e.prototype[a.a]=function(){return this},e.create=function(t,n,r){var i=new e(t,n,r);return i.syncErrorThrowable=!1,i},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e}(s.a),l=function(t){function e(e,n,r,s){var a,c=t.call(this)||this;c._parentSubscriber=e;var u=c;return Object(i.a)(n)?a=n:n&&(a=n.next,r=n.error,s=n.complete,n!==o.a&&(u=Object.create(n),Object(i.a)(u.unsubscribe)&&c.add(u.unsubscribe.bind(u)),u.unsubscribe=c.unsubscribe.bind(c))),c._context=u,c._next=a,c._error=r,c._complete=s,c}return r.a(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;c.a.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,n=c.a.useDeprecatedSynchronousErrorHandling;if(this._error)n&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)n?(e.syncErrorValue=t,e.syncErrorThrown=!0):Object(u.a)(t),this.unsubscribe();else{if(this.unsubscribe(),n)throw t;Object(u.a)(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var n=function(){return t._complete.call(t._context)};c.a.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),c.a.useDeprecatedSynchronousErrorHandling)throw t;Object(u.a)(t)}},e.prototype.__tryOrSetError=function(t,e,n){if(!c.a.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,n)}catch(e){return c.a.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(Object(u.a)(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(h)},function(t,e,n){"use strict";n.d(e,"a",(function(){return a})),n.d(e,"b",(function(){return c})),n.d(e,"c",(function(){return u}));var r=n(0),i=n(1),o=n(3),s=n(33),a=function(t){function e(e){var n=t.call(this)||this;return n.parent=e,n}return r.a(e,t),e.prototype._next=function(t){this.parent.notifyNext(t)},e.prototype._error=function(t){this.parent.notifyError(t),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(),this.unsubscribe()},e}(i.a),c=(i.a,function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.a(e,t),e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyError=function(t){this.destination.error(t)},e.prototype.notifyComplete=function(){this.destination.complete()},e}(i.a));i.a;function u(t,e){if(!e.closed){if(t instanceof o.a)return t.subscribe(e);var n;try{n=Object(s.a)(t)(e)}catch(t){e.error(t)}return n}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(56),i=n(1),o=n(41),s=n(58);var a=n(20),c=n(39),u=n(13),h=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r=this.operator,a=function(t,e,n){if(t){if(t instanceof i.a)return t;if(t[o.a])return t[o.a]()}return t||e||n?new i.a(t,e,n):new i.a(s.a)}(t,e,n);if(r?a.add(r.call(a,this.source)):a.add(this.source||u.a.useDeprecatedSynchronousErrorHandling&&!a.syncErrorThrowable?this._subscribe(a):this._trySubscribe(a)),u.a.useDeprecatedSynchronousErrorHandling&&a.syncErrorThrowable&&(a.syncErrorThrowable=!1,a.syncErrorThrown))throw a.syncErrorValue;return a},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){u.a.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),Object(r.a)(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=l(e))((function(e,r){var i;i=n.subscribe((function(e){try{t(e)}catch(t){r(t),i&&i.unsubscribe()}}),r,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[a.a]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:Object(c.b)(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=l(t))((function(t,n){var r;e.subscribe((function(t){return r=t}),(function(t){return n(t)}),(function(){return t(r)}))}))},t.create=function(e){return new t(e)},t}();function l(t){if(t||(t=u.a.Promise||Promise),!t)throw new Error("no Promise impl found");return t}},function(t,e,n){"use strict";n.d(e,"a",(function(){return a}));var r=n(7),i=n(55),o=n(23),s=n(42),a=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}var e;return t.prototype.unsubscribe=function(){var e;if(!this.closed){var n=this._parentOrParents,a=this._ctorUnsubscribe,u=this._unsubscribe,h=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof t)n.remove(this);else if(null!==n)for(var l=0;l<n.length;++l){n[l].remove(this)}if(Object(o.a)(u)){a&&(this._unsubscribe=void 0);try{u.call(this)}catch(t){e=t instanceof s.a?c(t.errors):[t]}}if(Object(r.a)(h)){l=-1;for(var f=h.length;++l<f;){var d=h[l];if(Object(i.a)(d))try{d.unsubscribe()}catch(t){e=e||[],t instanceof s.a?e=e.concat(c(t.errors)):e.push(t)}}}if(e)throw new s.a(e)}},t.prototype.add=function(e){var n=e;if(!e)return t.EMPTY;switch(typeof e){case"function":n=new t(e);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof t)){var r=n;(n=new t)._subscriptions=[r]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var i=n._parentOrParents;if(null===i)n._parentOrParents=this;else if(i instanceof t){if(i===this)return n;n._parentOrParents=[i,this]}else{if(-1!==i.indexOf(this))return n;i.push(this)}var o=this._subscriptions;return null===o?this._subscriptions=[n]:o.push(n),n},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var n=e.indexOf(t);-1!==n&&e.splice(n,1)}},t.EMPTY=((e=new t).closed=!0,e),t}();function c(t){return t.reduce((function(t,e){return t.concat(e instanceof s.a?e.errors:e)}),[])}},function(t,e,n){"use strict";n.d(e,"b",(function(){return h})),n.d(e,"a",(function(){return l}));var r=n(0),i=n(3),o=n(1),s=n(4),a=n(21),c=n(74),u=n(41),h=function(t){function e(e){var n=t.call(this,e)||this;return n.destination=e,n}return r.a(e,t),e}(o.a),l=function(t){function e(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return r.a(e,t),e.prototype[u.a]=function(){return new h(this)},e.prototype.lift=function(t){var e=new f(this,this);return e.operator=t,e},e.prototype.next=function(t){if(this.closed)throw new a.a;if(!this.isStopped)for(var e=this.observers,n=e.length,r=e.slice(),i=0;i<n;i++)r[i].next(t)},e.prototype.error=function(t){if(this.closed)throw new a.a;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,n=e.length,r=e.slice(),i=0;i<n;i++)r[i].error(t);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new a.a;this.isStopped=!0;for(var t=this.observers,e=t.length,n=t.slice(),r=0;r<e;r++)n[r].complete();this.observers.length=0},e.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},e.prototype._trySubscribe=function(e){if(this.closed)throw new a.a;return t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){if(this.closed)throw new a.a;return this.hasError?(t.error(this.thrownError),s.a.EMPTY):this.isStopped?(t.complete(),s.a.EMPTY):(this.observers.push(t),new c.a(this,t))},e.prototype.asObservable=function(){var t=new i.a;return t.source=this,t},e.create=function(t,e){return new f(t,e)},e}(i.a),f=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return r.a(e,t),e.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},e.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},e.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},e.prototype._subscribe=function(t){return this.source?this.source.subscribe(t):s.a.EMPTY},e}(l)},function(t,e,n){"use strict";n.d(e,"b",(function(){return i})),n.d(e,"a",(function(){return o}));var r=n(29),i=new(n(27).a)(r.a),o=i},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(0),i=n(1);function o(t,e){return function(n){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new s(t,e))}}var s=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.project,this.thisArg))},t}(),a=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.project=n,i.count=0,i.thisArg=r||i,i}return r.a(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(i.a)},function(t,e,n){"use strict";function r(t){return t&&"function"==typeof t.schedule}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return o}));var r=n(3),i=new r.a((function(t){return t.complete()}));function o(t){return t?function(t){return new r.a((function(e){return t.schedule((function(){return e.complete()}))}))}(t):i}},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(3),i=n(33),o=n(73);function s(t,e){return e?Object(o.a)(t,e):t instanceof r.a?t:new r.a(Object(i.a)(t))}},function(t,e,n){"use strict";n.d(e,"a",(function(){return a}));var r=n(0),i=function(t){function e(e,n,r){var i=t.call(this)||this;return i.parent=e,i.outerValue=n,i.outerIndex=r,i.index=0,i}return r.a(e,t),e.prototype._next=function(t){this.parent.notifyNext(this.outerValue,t,this.outerIndex,this.index++,this)},e.prototype._error=function(t){this.parent.notifyError(t,this),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},e}(n(1).a),o=n(33),s=n(3);function a(t,e,n,r,a){if(void 0===a&&(a=new i(t,n,r)),!a.closed)return e instanceof s.a?e.subscribe(a):Object(o.a)(e)(a)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=!1,i={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack;r=t},get useDeprecatedSynchronousErrorHandling(){return r}}},function(t,e,n){"use strict";function r(t){return t}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(0),i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.a(e,t),e.prototype.notifyNext=function(t,e,n,r,i){this.destination.next(e)},e.prototype.notifyError=function(t,e){this.destination.error(t)},e.prototype.notifyComplete=function(t){this.destination.complete()},e}(n(1).a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(0),i=n(1);function o(t,e){return function(n){return n.lift(new s(t,e))}}var s=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.predicate,this.thisArg))},t}(),a=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.predicate=n,i.thisArg=r,i.count=0,i}return r.a(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(i.a)},function(t,e,n){"use strict";n.d(e,"b",(function(){return r})),n.d(e,"a",(function(){return a}));var r,i=n(10),o=n(36),s=n(50);r||(r={});var a=function(){function t(t,e,n){this.kind=t,this.value=e,this.error=n,this.hasValue="N"===t}return t.prototype.observe=function(t){switch(this.kind){case"N":return t.next&&t.next(this.value);case"E":return t.error&&t.error(this.error);case"C":return t.complete&&t.complete()}},t.prototype.do=function(t,e,n){switch(this.kind){case"N":return t&&t(this.value);case"E":return e&&e(this.error);case"C":return n&&n()}},t.prototype.accept=function(t,e,n){return t&&"function"==typeof t.next?this.observe(t):this.do(t,e,n)},t.prototype.toObservable=function(){switch(this.kind){case"N":return Object(o.a)(this.value);case"E":return Object(s.a)(this.error);case"C":return Object(i.b)()}throw new Error("unexpected notification kind value")},t.createNext=function(e){return void 0!==e?new t("N",e):t.undefinedValueNotification},t.createError=function(e){return new t("E",void 0,e)},t.createComplete=function(){return t.completeNotification},t.completeNotification=new t("C"),t.undefinedValueNotification=new t("N",void 0),t}()},function(t,e,n){"use strict";function r(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}n.d(e,"a",(function(){return i}));var i=r()},function(t,e,n){"use strict";function r(){}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){function t(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return t.prototype=Object.create(Error.prototype),t}()},function(t,e,n){"use strict";function r(t){return"function"==typeof t}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){function t(){return Error.call(this),this.message="no elements in sequence",this.name="EmptyError",this}return t.prototype=Object.create(Error.prototype),t}()},function(t,e,n){"use strict";n.d(e,"b",(function(){return a})),n.d(e,"a",(function(){return h}));var r=n(0),i=n(8),o=n(11),s=n(2);function a(t,e,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),"function"==typeof e?function(r){return r.pipe(a((function(n,r){return Object(o.a)(t(n,r)).pipe(Object(i.a)((function(t,i){return e(n,t,r,i)})))}),n))}:("number"==typeof e&&(n=e),function(e){return e.lift(new c(t,n))})}var c=function(){function t(t,e){void 0===e&&(e=Number.POSITIVE_INFINITY),this.project=t,this.concurrent=e}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.project,this.concurrent))},t}(),u=function(t){function e(e,n,r){void 0===r&&(r=Number.POSITIVE_INFINITY);var i=t.call(this,e)||this;return i.project=n,i.concurrent=r,i.hasCompleted=!1,i.buffer=[],i.active=0,i.index=0,i}return r.a(e,t),e.prototype._next=function(t){this.active<this.concurrent?this._tryNext(t):this.buffer.push(t)},e.prototype._tryNext=function(t){var e,n=this.index++;try{e=this.project(t,n)}catch(t){return void this.destination.error(t)}this.active++,this._innerSub(e)},e.prototype._innerSub=function(t){var e=new s.a(this),n=this.destination;n.add(e);var r=Object(s.c)(t,e);r!==e&&n.add(r)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyComplete=function(){var t=this.buffer;this.active--,t.length>0?this._next(t.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(s.b),h=a},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(3),i=n(75),o=n(57);function s(t,e){return e?Object(o.a)(t,e):new r.a(Object(i.a)(t))}},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(0),i=n(61),o=function(t){function e(n,r){void 0===r&&(r=i.a.now);var o=t.call(this,n,(function(){return e.delegate&&e.delegate!==o?e.delegate.now():r()}))||this;return o.actions=[],o.active=!1,o.scheduled=void 0,o}return r.a(e,t),e.prototype.schedule=function(n,r,i){return void 0===r&&(r=0),e.delegate&&e.delegate!==this?e.delegate.schedule(n,r,i):t.prototype.schedule.call(this,n,r,i)},e.prototype.flush=function(t){var e=this.actions;if(this.active)e.push(t);else{var n;this.active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this.active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(i.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(0),i=n(5),o=n(4),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.value=null,e.hasNext=!1,e.hasCompleted=!1,e}return r.a(e,t),e.prototype._subscribe=function(e){return this.hasError?(e.error(this.thrownError),o.a.EMPTY):this.hasCompleted&&this.hasNext?(e.next(this.value),e.complete(),o.a.EMPTY):t.prototype._subscribe.call(this,e)},e.prototype.next=function(t){this.hasCompleted||(this.value=t,this.hasNext=!0)},e.prototype.error=function(e){this.hasCompleted||t.prototype.error.call(this,e)},e.prototype.complete=function(){this.hasCompleted=!0,this.hasNext&&t.prototype.next.call(this,this.value),t.prototype.complete.call(this)},e}(i.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(0),i=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return r.a(e,t),e.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t;var n=this.id,r=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(r,n,e)),this.pending=!0,this.delay=e,this.id=this.id||this.requestAsyncId(r,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),setInterval(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,e,n){if(void 0===n&&(n=0),null!==n&&this.delay===n&&!1===this.pending)return e;clearInterval(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var n=!1,r=void 0;try{this.work(t)}catch(t){n=!0,r=!!t&&t||new Error(t)}if(n)return this.unsubscribe(),r},e.prototype._unsubscribe=function(){var t=this.id,e=this.scheduler,n=e.actions,r=n.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==r&&n.splice(r,1),null!=t&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null},e}(function(t){function e(e,n){return t.call(this)||this}return r.a(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(n(4).a))},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(7);function i(t){return!Object(r.a)(t)&&t-parseFloat(t)+1>=0}},function(t,e,n){"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),e.logger=e.Logger=e.LogType=void 0,function(t){t.debug="debug",t.log="log",t.warn="warn",t.error="error"}(r=e.LogType||(e.LogType={}));class i{constructor(){this.enabled=!1}log(t,...e){this.emitLogMessage(r.log,t,e)}warn(t,...e){this.emitLogMessage(r.warn,t,e)}error(t,...e){this.emitLogMessage(r.error,t,e)}debug(t,...e){this.emitLogMessage(r.debug,t,e)}emitLogMessage(t,e,n){(this.enabled||t===r.error)&&(n.length>0?console[t](e,n):console[t](e))}}e.Logger=i,e.logger=new i},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(36),i=n(69);function o(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Object(i.a)()(r.a.apply(void 0,t))}},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(75),i=n(34),o=n(18),s=n(20),a=n(76),c=n(77),u=n(55),h=function(t){if(t&&"function"==typeof t[s.a])return h=t,function(t){var e=h[s.a]();if("function"!=typeof e.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return e.subscribe(t)};if(Object(a.a)(t))return Object(r.a)(t);if(Object(c.a)(t))return n=t,function(t){return n.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,i.a),t};if(t&&"function"==typeof t[o.a])return e=t,function(t){for(var n=e[o.a]();;){var r=void 0;try{r=n.next()}catch(e){return t.error(e),t}if(r.done){t.complete();break}if(t.next(r.value),t.closed)break}return"function"==typeof n.return&&t.add((function(){n.return&&n.return()})),t};var e,n,h,l=Object(u.a)(t)?"an invalid object":"'"+t+"'";throw new TypeError("You provided "+l+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")}},function(t,e,n){"use strict";function r(t){setTimeout((function(){throw t}),0)}n.d(e,"a",(function(){return r}))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(9),i=n(26),o=n(57);function s(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[t.length-1];return Object(r.a)(n)?(t.pop(),Object(o.a)(t,n)):Object(i.a)(t)}},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e},s=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||e.hasOwnProperty(n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),n(100);const a=o(n(82)),c=n(84);s(n(63),e);var u=n(84);Object.defineProperty(e,"Uneeq",{enumerable:!0,get:function(){return u.Uneeq}}),s(n(82),e),window.AdapterJS=a,window.Uneeq=c.Uneeq},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var c,u=[],h=!1,l=-1;function f(){h&&c&&(h=!1,c.length?u=c.concat(u):l=-1,u.length&&d())}function d(){if(!h){var t=a(f);h=!0;for(var e=u.length;e;){for(c=u,u=[];++l<e;)c&&c[l].run();l=-1,e=u.length}c=null,h=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function v(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new p(t,e)),1!==u.length||h||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){"use strict";n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return o}));var r=n(14);function i(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return o(t)}function o(t){return 0===t.length?r.a:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}},function(t,e,n){"use strict";n.d(e,"b",(function(){return l})),n.d(e,"a",(function(){return f}));var r=n(0),i=1,o=function(){return Promise.resolve()}(),s={};function a(t){return t in s&&(delete s[t],!0)}var c=function(t){var e=i++;return s[e]=!0,o.then((function(){return a(e)&&t()})),e},u=function(t){a(t)},h=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return r.a(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e.scheduled||(e.scheduled=c(e.flush.bind(e,null))))},e.prototype.recycleAsyncId=function(e,n,r){if(void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);0===e.actions.length&&(u(n),e.scheduled=void 0)},e}(n(29).a),l=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.a(e,t),e.prototype.flush=function(t){this.active=!0,this.scheduled=void 0;var e,n=this.actions,r=-1,i=n.length;t=t||n.shift();do{if(e=t.execute(t.state,t.delay))break}while(++r<i&&(t=n.shift()));if(this.active=!1,e){for(;++r<i&&(t=n.shift());)t.unsubscribe();throw e}},e}(n(27).a))(h),f=l},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}()},function(t,e,n){"use strict";const r={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};r.localCName=r.generateIdentifier(),r.splitLines=function(t){return t.trim().split("\n").map(t=>t.trim())},r.splitSections=function(t){return t.split("\nm=").map((t,e)=>(e>0?"m="+t:t).trim()+"\r\n")},r.getDescription=function(t){const e=r.splitSections(t);return e&&e[0]},r.getMediaSections=function(t){const e=r.splitSections(t);return e.shift(),e},r.matchPrefix=function(t,e){return r.splitLines(t).filter(t=>0===t.indexOf(e))},r.parseCandidate=function(t){let e;e=0===t.indexOf("a=candidate:")?t.substring(12).split(" "):t.substring(10).split(" ");const n={foundation:e[0],component:{1:"rtp",2:"rtcp"}[e[1]]||e[1],protocol:e[2].toLowerCase(),priority:parseInt(e[3],10),ip:e[4],address:e[4],port:parseInt(e[5],10),type:e[7]};for(let t=8;t<e.length;t+=2)switch(e[t]){case"raddr":n.relatedAddress=e[t+1];break;case"rport":n.relatedPort=parseInt(e[t+1],10);break;case"tcptype":n.tcpType=e[t+1];break;case"ufrag":n.ufrag=e[t+1],n.usernameFragment=e[t+1];break;default:void 0===n[e[t]]&&(n[e[t]]=e[t+1])}return n},r.writeCandidate=function(t){const e=[];e.push(t.foundation);const n=t.component;"rtp"===n?e.push(1):"rtcp"===n?e.push(2):e.push(n),e.push(t.protocol.toUpperCase()),e.push(t.priority),e.push(t.address||t.ip),e.push(t.port);const r=t.type;return e.push("typ"),e.push(r),"host"!==r&&t.relatedAddress&&t.relatedPort&&(e.push("raddr"),e.push(t.relatedAddress),e.push("rport"),e.push(t.relatedPort)),t.tcpType&&"tcp"===t.protocol.toLowerCase()&&(e.push("tcptype"),e.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(e.push("ufrag"),e.push(t.usernameFragment||t.ufrag)),"candidate:"+e.join(" ")},r.parseIceOptions=function(t){return t.substr(14).split(" ")},r.parseRtpMap=function(t){let e=t.substr(9).split(" ");const n={payloadType:parseInt(e.shift(),10)};return e=e[0].split("/"),n.name=e[0],n.clockRate=parseInt(e[1],10),n.channels=3===e.length?parseInt(e[2],10):1,n.numChannels=n.channels,n},r.writeRtpMap=function(t){let e=t.payloadType;void 0!==t.preferredPayloadType&&(e=t.preferredPayloadType);const n=t.channels||t.numChannels||1;return"a=rtpmap:"+e+" "+t.name+"/"+t.clockRate+(1!==n?"/"+n:"")+"\r\n"},r.parseExtmap=function(t){const e=t.substr(9).split(" ");return{id:parseInt(e[0],10),direction:e[0].indexOf("/")>0?e[0].split("/")[1]:"sendrecv",uri:e[1]}},r.writeExtmap=function(t){return"a=extmap:"+(t.id||t.preferredId)+(t.direction&&"sendrecv"!==t.direction?"/"+t.direction:"")+" "+t.uri+"\r\n"},r.parseFmtp=function(t){const e={};let n;const r=t.substr(t.indexOf(" ")+1).split(";");for(let t=0;t<r.length;t++)n=r[t].trim().split("="),e[n[0].trim()]=n[1];return e},r.writeFmtp=function(t){let e="",n=t.payloadType;if(void 0!==t.preferredPayloadType&&(n=t.preferredPayloadType),t.parameters&&Object.keys(t.parameters).length){const r=[];Object.keys(t.parameters).forEach(e=>{void 0!==t.parameters[e]?r.push(e+"="+t.parameters[e]):r.push(e)}),e+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return e},r.parseRtcpFb=function(t){const e=t.substr(t.indexOf(" ")+1).split(" ");return{type:e.shift(),parameter:e.join(" ")}},r.writeRtcpFb=function(t){let e="",n=t.payloadType;return void 0!==t.preferredPayloadType&&(n=t.preferredPayloadType),t.rtcpFeedback&&t.rtcpFeedback.length&&t.rtcpFeedback.forEach(t=>{e+="a=rtcp-fb:"+n+" "+t.type+(t.parameter&&t.parameter.length?" "+t.parameter:"")+"\r\n"}),e},r.parseSsrcMedia=function(t){const e=t.indexOf(" "),n={ssrc:parseInt(t.substr(7,e-7),10)},r=t.indexOf(":",e);return r>-1?(n.attribute=t.substr(e+1,r-e-1),n.value=t.substr(r+1)):n.attribute=t.substr(e+1),n},r.parseSsrcGroup=function(t){const e=t.substr(13).split(" ");return{semantics:e.shift(),ssrcs:e.map(t=>parseInt(t,10))}},r.getMid=function(t){const e=r.matchPrefix(t,"a=mid:")[0];if(e)return e.substr(6)},r.parseFingerprint=function(t){const e=t.substr(14).split(" ");return{algorithm:e[0].toLowerCase(),value:e[1].toUpperCase()}},r.getDtlsParameters=function(t,e){return{role:"auto",fingerprints:r.matchPrefix(t+e,"a=fingerprint:").map(r.parseFingerprint)}},r.writeDtlsParameters=function(t,e){let n="a=setup:"+e+"\r\n";return t.fingerprints.forEach(t=>{n+="a=fingerprint:"+t.algorithm+" "+t.value+"\r\n"}),n},r.parseCryptoLine=function(t){const e=t.substr(9).split(" ");return{tag:parseInt(e[0],10),cryptoSuite:e[1],keyParams:e[2],sessionParams:e.slice(3)}},r.writeCryptoLine=function(t){return"a=crypto:"+t.tag+" "+t.cryptoSuite+" "+("object"==typeof t.keyParams?r.writeCryptoKeyParams(t.keyParams):t.keyParams)+(t.sessionParams?" "+t.sessionParams.join(" "):"")+"\r\n"},r.parseCryptoKeyParams=function(t){if(0!==t.indexOf("inline:"))return null;const e=t.substr(7).split("|");return{keyMethod:"inline",keySalt:e[0],lifeTime:e[1],mkiValue:e[2]?e[2].split(":")[0]:void 0,mkiLength:e[2]?e[2].split(":")[1]:void 0}},r.writeCryptoKeyParams=function(t){return t.keyMethod+":"+t.keySalt+(t.lifeTime?"|"+t.lifeTime:"")+(t.mkiValue&&t.mkiLength?"|"+t.mkiValue+":"+t.mkiLength:"")},r.getCryptoParameters=function(t,e){return r.matchPrefix(t+e,"a=crypto:").map(r.parseCryptoLine)},r.getIceParameters=function(t,e){const n=r.matchPrefix(t+e,"a=ice-ufrag:")[0],i=r.matchPrefix(t+e,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substr(12),password:i.substr(10)}:null},r.writeIceParameters=function(t){let e="a=ice-ufrag:"+t.usernameFragment+"\r\na=ice-pwd:"+t.password+"\r\n";return t.iceLite&&(e+="a=ice-lite\r\n"),e},r.parseRtpParameters=function(t){const e={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=r.splitLines(t)[0].split(" ");for(let i=3;i<n.length;i++){const o=n[i],s=r.matchPrefix(t,"a=rtpmap:"+o+" ")[0];if(s){const n=r.parseRtpMap(s),i=r.matchPrefix(t,"a=fmtp:"+o+" ");switch(n.parameters=i.length?r.parseFmtp(i[0]):{},n.rtcpFeedback=r.matchPrefix(t,"a=rtcp-fb:"+o+" ").map(r.parseRtcpFb),e.codecs.push(n),n.name.toUpperCase()){case"RED":case"ULPFEC":e.fecMechanisms.push(n.name.toUpperCase())}}}return r.matchPrefix(t,"a=extmap:").forEach(t=>{e.headerExtensions.push(r.parseExtmap(t))}),e},r.writeRtpDescription=function(t,e){let n="";n+="m="+t+" ",n+=e.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=e.codecs.map(t=>void 0!==t.preferredPayloadType?t.preferredPayloadType:t.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",e.codecs.forEach(t=>{n+=r.writeRtpMap(t),n+=r.writeFmtp(t),n+=r.writeRtcpFb(t)});let i=0;return e.codecs.forEach(t=>{t.maxptime>i&&(i=t.maxptime)}),i>0&&(n+="a=maxptime:"+i+"\r\n"),e.headerExtensions&&e.headerExtensions.forEach(t=>{n+=r.writeExtmap(t)}),n},r.parseRtpEncodingParameters=function(t){const e=[],n=r.parseRtpParameters(t),i=-1!==n.fecMechanisms.indexOf("RED"),o=-1!==n.fecMechanisms.indexOf("ULPFEC"),s=r.matchPrefix(t,"a=ssrc:").map(t=>r.parseSsrcMedia(t)).filter(t=>"cname"===t.attribute),a=s.length>0&&s[0].ssrc;let c;const u=r.matchPrefix(t,"a=ssrc-group:FID").map(t=>t.substr(17).split(" ").map(t=>parseInt(t,10)));u.length>0&&u[0].length>1&&u[0][0]===a&&(c=u[0][1]),n.codecs.forEach(t=>{if("RTX"===t.name.toUpperCase()&&t.parameters.apt){let n={ssrc:a,codecPayloadType:parseInt(t.parameters.apt,10)};a&&c&&(n.rtx={ssrc:c}),e.push(n),i&&(n=JSON.parse(JSON.stringify(n)),n.fec={ssrc:a,mechanism:o?"red+ulpfec":"red"},e.push(n))}}),0===e.length&&a&&e.push({ssrc:a});let h=r.matchPrefix(t,"b=");return h.length&&(h=0===h[0].indexOf("b=TIAS:")?parseInt(h[0].substr(7),10):0===h[0].indexOf("b=AS:")?1e3*parseInt(h[0].substr(5),10)*.95-16e3:void 0,e.forEach(t=>{t.maxBitrate=h})),e},r.parseRtcpParameters=function(t){const e={},n=r.matchPrefix(t,"a=ssrc:").map(t=>r.parseSsrcMedia(t)).filter(t=>"cname"===t.attribute)[0];n&&(e.cname=n.value,e.ssrc=n.ssrc);const i=r.matchPrefix(t,"a=rtcp-rsize");e.reducedSize=i.length>0,e.compound=0===i.length;const o=r.matchPrefix(t,"a=rtcp-mux");return e.mux=o.length>0,e},r.writeRtcpParameters=function(t){let e="";return t.reducedSize&&(e+="a=rtcp-rsize\r\n"),t.mux&&(e+="a=rtcp-mux\r\n"),void 0!==t.ssrc&&t.cname&&(e+="a=ssrc:"+t.ssrc+" cname:"+t.cname+"\r\n"),e},r.parseMsid=function(t){let e;const n=r.matchPrefix(t,"a=msid:");if(1===n.length)return e=n[0].substr(7).split(" "),{stream:e[0],track:e[1]};const i=r.matchPrefix(t,"a=ssrc:").map(t=>r.parseSsrcMedia(t)).filter(t=>"msid"===t.attribute);return i.length>0?(e=i[0].value.split(" "),{stream:e[0],track:e[1]}):void 0},r.parseSctpDescription=function(t){const e=r.parseMLine(t),n=r.matchPrefix(t,"a=max-message-size:");let i;n.length>0&&(i=parseInt(n[0].substr(19),10)),isNaN(i)&&(i=65536);const o=r.matchPrefix(t,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:e.fmt,maxMessageSize:i};const s=r.matchPrefix(t,"a=sctpmap:");if(s.length>0){const t=s[0].substr(10).split(" ");return{port:parseInt(t[0],10),protocol:t[1],maxMessageSize:i}}},r.writeSctpDescription=function(t,e){let n=[];return n="DTLS/SCTP"!==t.protocol?["m="+t.kind+" 9 "+t.protocol+" "+e.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+e.port+"\r\n"]:["m="+t.kind+" 9 "+t.protocol+" "+e.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+e.port+" "+e.protocol+" 65535\r\n"],void 0!==e.maxMessageSize&&n.push("a=max-message-size:"+e.maxMessageSize+"\r\n"),n.join("")},r.generateSessionId=function(){return Math.random().toString().substr(2,21)},r.writeSessionBoilerplate=function(t,e,n){let i;const o=void 0!==e?e:2;i=t||r.generateSessionId();return"v=0\r\no="+(n||"thisisadapterortc")+" "+i+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},r.getDirection=function(t,e){const n=r.splitLines(t);for(let t=0;t<n.length;t++)switch(n[t]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[t].substr(2)}return e?r.getDirection(e):"sendrecv"},r.getKind=function(t){return r.splitLines(t)[0].split(" ")[0].substr(2)},r.isRejected=function(t){return"0"===t.split(" ",2)[1]},r.parseMLine=function(t){const e=r.splitLines(t)[0].substr(2).split(" ");return{kind:e[0],port:parseInt(e[1],10),protocol:e[2],fmt:e.slice(3).join(" ")}},r.parseOLine=function(t){const e=r.matchPrefix(t,"o=")[0].substr(2).split(" ");return{username:e[0],sessionId:e[1],sessionVersion:parseInt(e[2],10),netType:e[3],addressType:e[4],address:e[5]}},r.isValidSDP=function(t){if("string"!=typeof t||0===t.length)return!1;const e=r.splitLines(t);for(let t=0;t<e.length;t++)if(e[t].length<2||"="!==e[t].charAt(1))return!1;return!0},t.exports=r},function(t,e,n){"use strict";(function(t){
17
17
  /*!
18
18
  * The buffer module from node.js, for the browser.
19
19
  *
20
20
  * @author Feross Aboukhadijeh <http://feross.org>
21
21
  * @license MIT
22
22
  */
23
- var r=n(101),i=n(102),o=n(103);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=c.prototype:(null===t&&(t=new c(e)),t.length=e),t}function c(t,e,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return u(this,t,e,n)}function u(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);c.TYPED_ARRAY_SUPPORT?(t=e).__proto__=c.prototype:t=f(t,e);return t}(t,e,n,r):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|p(e,n),i=(t=a(t,r)).write(e,n);i!==r&&(t=t.slice(0,i));return t}(t,e,n):function(t,e){if(c.isBuffer(e)){var n=0|d(e.length);return 0===(t=a(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?a(t,0):f(t,e);if("Buffer"===e.type&&o(e.data))return f(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e){if(h(e),t=a(t,e<0?0:0|d(e)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function f(t,e){var n=e.length<0?0:0|d(e.length);t=a(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function d(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function p(t,e){if(c.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(t).length;default:if(r)return B(t).length;e=(""+e).toLowerCase(),r=!0}}function v(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return O(this,e,n);case"utf8":case"utf-8":return E(this,e,n);case"ascii":return R(this,e,n);case"latin1":case"binary":return M(this,e,n);case"base64":return C(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function g(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function m(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=c.from(e,r)),c.isBuffer(e))return 0===e.length?-1:y(t,e,n,r,i);if("number"==typeof e)return e&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,r,i){var o,s=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=n;o<a;o++)if(u(t,o)===u(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===c)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){for(var l=!0,f=0;f<c;f++)if(u(t,o+f)!==u(e,f)){l=!1;break}if(l)return o}return-1}function b(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[n+s]=a}return s}function _(t,e,n,r){return W(B(e,t.length-n),t,n,r)}function w(t,e,n,r){return W(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function S(t,e,n,r){return w(t,e,n,r)}function x(t,e,n,r){return W(V(e),t,n,r)}function T(t,e,n,r){return W(function(t,e){for(var n,r,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function C(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function E(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,s,a,c,u=t[i],h=null,l=u>239?4:u>223?3:u>191?2:1;if(i+l<=n)switch(l){case 1:u<128&&(h=u);break;case 2:128==(192&(o=t[i+1]))&&(c=(31&u)<<6|63&o)>127&&(h=c);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(h=c);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(h=c)}null===h?(h=65533,l=1):h>65535&&(h-=65536,r.push(h>>>10&1023|55296),h=56320|1023&h),r.push(h),i+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=4096));return n}(r)}e.Buffer=c,e.SlowBuffer=function(t){+t!=t&&(t=0);return c.alloc(+t)},e.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),c.poolSize=8192,c._augment=function(t){return t.__proto__=c.prototype,t},c.from=function(t,e,n){return u(null,t,e,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(t,e,n){return function(t,e,n,r){return h(e),e<=0?a(t,e):void 0!==n?"string"==typeof r?a(t,e).fill(n,r):a(t,e).fill(n):a(t,e)}(null,t,e,n)},c.allocUnsafe=function(t){return l(null,t)},c.allocUnsafeSlow=function(t){return l(null,t)},c.isBuffer=function(t){return!(null==t||!t._isBuffer)},c.compare=function(t,e){if(!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},c.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=c.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var s=t[n];if(!c.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i),i+=s.length}return r},c.byteLength=p,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},c.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},c.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},c.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?E(this,0,t):v.apply(this,arguments)},c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},c.prototype.compare=function(t,e,n,r,i){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0),a=Math.min(o,s),u=this.slice(r,i),h=t.slice(e,n),l=0;l<a;++l)if(u[l]!==h[l]){o=u[l],s=h[l];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},c.prototype.indexOf=function(t,e,n){return m(this,t,e,n,!0)},c.prototype.lastIndexOf=function(t,e,n){return m(this,t,e,n,!1)},c.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return _(this,t,e,n);case"ascii":return w(this,t,e,n);case"latin1":case"binary":return S(this,t,e,n);case"base64":return x(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function R(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function M(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function O(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=F(t[o]);return i}function A(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function P(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function k(t,e,n,r,i,o){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function I(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function D(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function N(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(t,e,n,r,o){return o||N(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function L(t,e,n,r,o){return o||N(t,0,n,8),i.write(t,e,n,r,52,8),n+8}c.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=c.prototype;else{var i=e-t;n=new c(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},c.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},c.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},c.prototype.readUInt8=function(t,e){return e||P(t,1,this.length),this[t]},c.prototype.readUInt16LE=function(t,e){return e||P(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function(t,e){return e||P(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function(t,e){return e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function(t,e){return e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},c.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},c.prototype.readInt8=function(t,e){return e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){e||P(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(t,e){e||P(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(t,e){return e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function(t,e){return e||P(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return e||P(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return e||P(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return e||P(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||k(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},c.prototype.writeUIntBE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||k(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},c.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,1,255,0),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},c.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):I(this,t,e,!0),e+2},c.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):I(this,t,e,!1),e+2},c.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):D(this,t,e,!0),e+4},c.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},c.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);k(this,t,e,n,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<n&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},c.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);k(this,t,e,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},c.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,1,127,-128),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):I(this,t,e,!0),e+2},c.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):I(this,t,e,!1),e+2},c.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):D(this,t,e,!0),e+4},c.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},c.prototype.writeFloatLE=function(t,e,n){return j(this,t,e,!0,n)},c.prototype.writeFloatBE=function(t,e,n){return j(this,t,e,!1,n)},c.prototype.writeDoubleLE=function(t,e,n){return L(this,t,e,!0,n)},c.prototype.writeDoubleBE=function(t,e,n){return L(this,t,e,!1,n)},c.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;i>=0;--i)t[i+e]=this[i+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},c.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var s=c.isBuffer(t)?t:B(new c(t,r).toString()),a=s.length;for(o=0;o<n-e;++o)this[o+e]=s[o%a]}return this};var U=/[^+\/0-9A-Za-z-_]/g;function F(t){return t<16?"0"+t.toString(16):t.toString(16)}function B(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function V(t){return r.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(U,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function W(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}}).call(this,n(34))},function(t,e,n){"use strict";var r={};function i(t,e,n){n||(n=Error);var i=function(t){var n,r;function i(n,r,i){return t.call(this,function(t,n,r){return"string"==typeof e?e:e(t,n,r)}(n,r,i))||this}return r=t,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r,i}(n);i.prototype.name=n.name,i.prototype.code=t,r[t]=i}function o(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(t){return String(t)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}i("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(t,e,n){var r,i,s,a;if("string"==typeof e&&(i="not ",e.substr(!s||s<0?0:+s,i.length)===i)?(r="must not be",e=e.replace(/^not /,"")):r="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-e.length,n)===e}(t," argument"))a="The ".concat(t," ").concat(r," ").concat(o(e,"type"));else{var c=function(t,e,n){return"number"!=typeof n&&(n=0),!(n+e.length>t.length)&&-1!==t.indexOf(e,n)}(t,".")?"property":"argument";a='The "'.concat(t,'" ').concat(c," ").concat(r," ").concat(o(e,"type"))}return a+=". Received type ".concat(typeof n)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=r},function(t,e,n){"use strict";(function(e){var r=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=u;var i=n(87),o=n(92);n(59)(u,i);for(var s=r(o.prototype),a=0;a<s.length;a++){var c=s[a];u.prototype[c]||(u.prototype[c]=o.prototype[c])}function u(t){if(!(this instanceof u))return new u(t);i.call(this,t),o.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",h)))}function h(){this._writableState.ended||e.nextTick(l,this)}function l(t){t.end()}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(u.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(u.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this,n(38))},function(t,e,n){"use strict";n.r(e),n.d(e,"Observable",(function(){return r.a})),n.d(e,"ConnectableObservable",(function(){return i.a})),n.d(e,"GroupedObservable",(function(){return o.a})),n.d(e,"observable",(function(){return s.a})),n.d(e,"Subject",(function(){return a.a})),n.d(e,"BehaviorSubject",(function(){return c.a})),n.d(e,"ReplaySubject",(function(){return u.a})),n.d(e,"AsyncSubject",(function(){return h.a})),n.d(e,"asap",(function(){return l.a})),n.d(e,"asapScheduler",(function(){return l.b})),n.d(e,"async",(function(){return f.a})),n.d(e,"asyncScheduler",(function(){return f.b})),n.d(e,"queue",(function(){return d.a})),n.d(e,"queueScheduler",(function(){return d.b})),n.d(e,"animationFrame",(function(){return b})),n.d(e,"animationFrameScheduler",(function(){return y})),n.d(e,"VirtualTimeScheduler",(function(){return _})),n.d(e,"VirtualAction",(function(){return w})),n.d(e,"Scheduler",(function(){return S.a})),n.d(e,"Subscription",(function(){return x.a})),n.d(e,"Subscriber",(function(){return T.a})),n.d(e,"Notification",(function(){return C.a})),n.d(e,"NotificationKind",(function(){return C.b})),n.d(e,"pipe",(function(){return E.a})),n.d(e,"noop",(function(){return R.a})),n.d(e,"identity",(function(){return M.a})),n.d(e,"isObservable",(function(){return O})),n.d(e,"ArgumentOutOfRangeError",(function(){return A.a})),n.d(e,"EmptyError",(function(){return P.a})),n.d(e,"ObjectUnsubscribedError",(function(){return k.a})),n.d(e,"UnsubscriptionError",(function(){return I.a})),n.d(e,"TimeoutError",(function(){return D.a})),n.d(e,"bindCallback",(function(){return F})),n.d(e,"bindNodeCallback",(function(){return W})),n.d(e,"combineLatest",(function(){return G.b})),n.d(e,"concat",(function(){return Y.a})),n.d(e,"defer",(function(){return $.a})),n.d(e,"empty",(function(){return X.b})),n.d(e,"forkJoin",(function(){return Z})),n.d(e,"from",(function(){return J.a})),n.d(e,"fromEvent",(function(){return et})),n.d(e,"fromEventPattern",(function(){return nt})),n.d(e,"generate",(function(){return rt})),n.d(e,"iif",(function(){return ot})),n.d(e,"interval",(function(){return at})),n.d(e,"merge",(function(){return ut.a})),n.d(e,"never",(function(){return lt})),n.d(e,"of",(function(){return ft.a})),n.d(e,"onErrorResumeNext",(function(){return dt})),n.d(e,"pairs",(function(){return pt})),n.d(e,"partition",(function(){return bt})),n.d(e,"race",(function(){return _t.a})),n.d(e,"range",(function(){return wt})),n.d(e,"throwError",(function(){return xt.a})),n.d(e,"timer",(function(){return Tt.a})),n.d(e,"using",(function(){return Ct})),n.d(e,"zip",(function(){return Et.b})),n.d(e,"scheduled",(function(){return Rt.a})),n.d(e,"EMPTY",(function(){return X.a})),n.d(e,"NEVER",(function(){return ht})),n.d(e,"config",(function(){return Mt.a}));var r=n(3),i=n(65),o=n(62),s=n(20),a=n(5),c=n(66),u=n(49),h=n(28),l=n(40),f=n(6),d=n(60),p=n(0),v=n(29),g=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return p.a(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e.scheduled||(e.scheduled=requestAnimationFrame((function(){return e.flush(null)}))))},e.prototype.recycleAsyncId=function(e,n,r){if(void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);0===e.actions.length&&(cancelAnimationFrame(n),e.scheduled=void 0)},e}(v.a),m=n(27),y=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return p.a(e,t),e.prototype.flush=function(t){this.active=!0,this.scheduled=void 0;var e,n=this.actions,r=-1,i=n.length;t=t||n.shift();do{if(e=t.execute(t.state,t.delay))break}while(++r<i&&(t=n.shift()));if(this.active=!1,e){for(;++r<i&&(t=n.shift());)t.unsubscribe();throw e}},e}(m.a))(g),b=y,_=function(t){function e(e,n){void 0===e&&(e=w),void 0===n&&(n=Number.POSITIVE_INFINITY);var r=t.call(this,e,(function(){return r.frame}))||this;return r.maxFrames=n,r.frame=0,r.index=-1,r}return p.a(e,t),e.prototype.flush=function(){for(var t,e,n=this.actions,r=this.maxFrames;(e=n[0])&&e.delay<=r&&(n.shift(),this.frame=e.delay,!(t=e.execute(e.state,e.delay))););if(t){for(;e=n.shift();)e.unsubscribe();throw t}},e.frameTimeFactor=10,e}(m.a),w=function(t){function e(e,n,r){void 0===r&&(r=e.index+=1);var i=t.call(this,e,n)||this;return i.scheduler=e,i.work=n,i.index=r,i.active=!0,i.index=e.index=r,i}return p.a(e,t),e.prototype.schedule=function(n,r){if(void 0===r&&(r=0),!this.id)return t.prototype.schedule.call(this,n,r);this.active=!1;var i=new e(this.scheduler,this.work);return this.add(i),i.schedule(n,r)},e.prototype.requestAsyncId=function(t,n,r){void 0===r&&(r=0),this.delay=t.frame+r;var i=t.actions;return i.push(this),i.sort(e.sortActions),!0},e.prototype.recycleAsyncId=function(t,e,n){void 0===n&&(n=0)},e.prototype._execute=function(e,n){if(!0===this.active)return t.prototype._execute.call(this,e,n)},e.sortActions=function(t,e){return t.delay===e.delay?t.index===e.index?0:t.index>e.index?1:-1:t.delay>e.delay?1:-1},e}(v.a),S=n(61),x=n(4),T=n(1),C=n(17),E=n(39),R=n(19),M=n(14);function O(t){return!!t&&(t instanceof r.a||"function"==typeof t.lift&&"function"==typeof t.subscribe)}var A=n(22),P=n(24),k=n(21),I=n(42),D=n(68),N=n(8),j=n(56),L=n(7),U=n(9);function F(t,e,n){if(e){if(!Object(U.a)(e))return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return F(t,n).apply(void 0,r).pipe(Object(N.a)((function(t){return Object(L.a)(t)?e.apply(void 0,t):e(t)})))};n=e}return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var o,s=this,a={context:s,subject:o,callbackFunc:t,scheduler:n};return new r.a((function(r){if(n){var i={args:e,subscriber:r,params:a};return n.schedule(B,0,i)}if(!o){o=new h.a;try{t.apply(s,e.concat([function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];o.next(t.length<=1?t[0]:t),o.complete()}]))}catch(t){Object(j.a)(o)?o.error(t):console.warn(t)}}return o.subscribe(r)}))}}function B(t){var e=this,n=t.args,r=t.subscriber,i=t.params,o=i.callbackFunc,s=i.context,a=i.scheduler,c=i.subject;if(!c){c=i.subject=new h.a;try{o.apply(s,n.concat([function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.length<=1?t[0]:t;e.add(a.schedule(V,0,{value:r,subject:c}))}]))}catch(t){c.error(t)}}this.add(c.subscribe(r))}function V(t){var e=t.value,n=t.subject;n.next(e),n.complete()}function W(t,e,n){if(e){if(!Object(U.a)(e))return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return W(t,n).apply(void 0,r).pipe(Object(N.a)((function(t){return Object(L.a)(t)?e.apply(void 0,t):e(t)})))};n=e}return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var o={subject:void 0,args:e,callbackFunc:t,scheduler:n,context:this};return new r.a((function(r){var i=o.context,s=o.subject;if(n)return n.schedule(q,0,{params:o,subscriber:r,context:i});if(!s){s=o.subject=new h.a;try{t.apply(i,e.concat([function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t.shift();n?s.error(n):(s.next(t.length<=1?t[0]:t),s.complete())}]))}catch(t){Object(j.a)(s)?s.error(t):console.warn(t)}}return s.subscribe(r)}))}}function q(t){var e=this,n=t.params,r=t.subscriber,i=t.context,o=n.callbackFunc,s=n.args,a=n.scheduler,c=n.subject;if(!c){c=n.subject=new h.a;try{o.apply(i,s.concat([function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.shift();if(r)e.add(a.schedule(z,0,{err:r,subject:c}));else{var i=t.length<=1?t[0]:t;e.add(a.schedule(H,0,{value:i,subject:c}))}}]))}catch(t){this.add(a.schedule(z,0,{err:t,subject:c}))}}this.add(c.subscribe(r))}function H(t){var e=t.value,n=t.subject;n.next(e),n.complete()}function z(t){var e=t.err;t.subject.error(e)}var G=n(51),Y=n(31),$=n(53),X=n(10),K=n(55),J=n(11);function Z(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(1===t.length){var n=t[0];if(Object(L.a)(n))return Q(n,null);if(Object(K.a)(n)&&Object.getPrototypeOf(n)===Object.prototype){var r=Object.keys(n);return Q(r.map((function(t){return n[t]})),r)}}if("function"==typeof t[t.length-1]){var i=t.pop();return Q(t=1===t.length&&Object(L.a)(t[0])?t[0]:t,null).pipe(Object(N.a)((function(t){return i.apply(void 0,t)})))}return Q(t,null)}function Q(t,e){return new r.a((function(n){var r=t.length;if(0!==r)for(var i=new Array(r),o=0,s=0,a=function(a){var c=Object(J.a)(t[a]),u=!1;n.add(c.subscribe({next:function(t){u||(u=!0,s++),i[a]=t},error:function(t){return n.error(t)},complete:function(){++o!==r&&u||(s===r&&n.next(e?e.reduce((function(t,e,n){return t[e]=i[n],t}),{}):i),n.complete())}}))},c=0;c<r;c++)a(c);else n.complete()}))}var tt=n(23);function et(t,e,n,i){return Object(tt.a)(n)&&(i=n,n=void 0),i?et(t,e,n).pipe(Object(N.a)((function(t){return Object(L.a)(t)?i.apply(void 0,t):i(t)}))):new r.a((function(r){!function t(e,n,r,i,o){var s;if(function(t){return t&&"function"==typeof t.addEventListener&&"function"==typeof t.removeEventListener}(e)){var a=e;e.addEventListener(n,r,o),s=function(){return a.removeEventListener(n,r,o)}}else if(function(t){return t&&"function"==typeof t.on&&"function"==typeof t.off}(e)){var c=e;e.on(n,r),s=function(){return c.off(n,r)}}else if(function(t){return t&&"function"==typeof t.addListener&&"function"==typeof t.removeListener}(e)){var u=e;e.addListener(n,r),s=function(){return u.removeListener(n,r)}}else{if(!e||!e.length)throw new TypeError("Invalid event target");for(var h=0,l=e.length;h<l;h++)t(e[h],n,r,i,o)}i.add(s)}(t,e,(function(t){arguments.length>1?r.next(Array.prototype.slice.call(arguments)):r.next(t)}),r,n)}))}function nt(t,e,n){return n?nt(t,e).pipe(Object(N.a)((function(t){return Object(L.a)(t)?n.apply(void 0,t):n(t)}))):new r.a((function(n){var r,i=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.next(1===t.length?t[0]:t)};try{r=t(i)}catch(t){return void n.error(t)}if(Object(tt.a)(e))return function(){return e(i,r)}}))}function rt(t,e,n,i,o){var s,a;if(1==arguments.length){var c=t;a=c.initialState,e=c.condition,n=c.iterate,s=c.resultSelector||M.a,o=c.scheduler}else void 0===i||Object(U.a)(i)?(a=t,s=M.a,o=i):(a=t,s=i);return new r.a((function(t){var r=a;if(o)return o.schedule(it,0,{subscriber:t,iterate:n,condition:e,resultSelector:s,state:r});for(;;){if(e){var i=void 0;try{i=e(r)}catch(e){return void t.error(e)}if(!i){t.complete();break}}var c=void 0;try{c=s(r)}catch(e){return void t.error(e)}if(t.next(c),t.closed)break;try{r=n(r)}catch(e){return void t.error(e)}}}))}function it(t){var e=t.subscriber,n=t.condition;if(!e.closed){if(t.needIterate)try{t.state=t.iterate(t.state)}catch(t){return void e.error(t)}else t.needIterate=!0;if(n){var r=void 0;try{r=n(t.state)}catch(t){return void e.error(t)}if(!r)return void e.complete();if(e.closed)return}var i;try{i=t.resultSelector(t.state)}catch(t){return void e.error(t)}if(!e.closed&&(e.next(i),!e.closed))return this.schedule(t)}}function ot(t,e,n){return void 0===e&&(e=X.a),void 0===n&&(n=X.a),Object($.a)((function(){return t()?e:n}))}var st=n(30);function at(t,e){return void 0===t&&(t=0),void 0===e&&(e=f.a),(!Object(st.a)(t)||t<0)&&(t=0),e&&"function"==typeof e.schedule||(e=f.a),new r.a((function(n){return n.add(e.schedule(ct,t,{subscriber:n,counter:0,period:t})),n}))}function ct(t){var e=t.subscriber,n=t.counter,r=t.period;e.next(n),this.schedule({subscriber:e,counter:n+1,period:r},r)}var ut=n(70),ht=new r.a(R.a);function lt(){return ht}var ft=n(36);function dt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0===t.length)return X.a;var n=t[0],i=t.slice(1);return 1===t.length&&Object(L.a)(n)?dt.apply(void 0,n):new r.a((function(t){var e=function(){return t.add(dt.apply(void 0,i).subscribe(t))};return Object(J.a)(n).subscribe({next:function(e){t.next(e)},error:e,complete:e})}))}function pt(t,e){return e?new r.a((function(n){var r=Object.keys(t),i=new x.a;return i.add(e.schedule(vt,0,{keys:r,index:0,subscriber:n,subscription:i,obj:t})),i})):new r.a((function(e){for(var n=Object.keys(t),r=0;r<n.length&&!e.closed;r++){var i=n[r];t.hasOwnProperty(i)&&e.next([i,t[i]])}e.complete()}))}function vt(t){var e=t.keys,n=t.index,r=t.subscriber,i=t.subscription,o=t.obj;if(!r.closed)if(n<e.length){var s=e[n];r.next([s,o[s]]),i.add(this.schedule({keys:e,index:n+1,subscriber:r,subscription:i,obj:o}))}else r.complete()}var gt=n(78),mt=n(32),yt=n(16);function bt(t,e,n){return[Object(yt.a)(e,n)(new r.a(Object(mt.a)(t))),Object(yt.a)(Object(gt.a)(e,n))(new r.a(Object(mt.a)(t)))]}var _t=n(71);function wt(t,e,n){return void 0===t&&(t=0),new r.a((function(r){void 0===e&&(e=t,t=0);var i=0,o=t;if(n)return n.schedule(St,0,{index:i,count:e,start:t,subscriber:r});for(;;){if(i++>=e){r.complete();break}if(r.next(o++),r.closed)break}}))}function St(t){var e=t.start,n=t.index,r=t.count,i=t.subscriber;n>=r?i.complete():(i.next(e),i.closed||(t.index=n+1,t.start=e+1,this.schedule(t)))}var xt=n(50),Tt=n(72);function Ct(t,e){return new r.a((function(n){var r,i;try{r=t()}catch(t){return void n.error(t)}try{i=e(r)}catch(t){return void n.error(t)}var o=(i?Object(J.a)(i):X.a).subscribe(n);return function(){o.unsubscribe(),r&&r.unsubscribe()}}))}var Et=n(54),Rt=n(73),Mt=n(13)},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(0),i=n(1);function o(){return function(t){return t.lift(new s(t))}}var s=function(){function t(t){this.connectable=t}return t.prototype.call=function(t,e){var n=this.connectable;n._refCount++;var r=new a(t,n),i=e.subscribe(r);return r.closed||(r.connection=n.connect()),i},t}(),a=function(t){function e(e,n){var r=t.call(this,e)||this;return r.connectable=n,r}return r.a(e,t),e.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._refCount;if(e<=0)this.connection=null;else if(t._refCount=e-1,e>1)this.connection=null;else{var n=this.connection,r=t._connection;this.connection=null,!r||n&&r!==n||r.unsubscribe()}}else this.connection=null},e}(i.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(0),i=n(5),o=n(60),s=n(4),a=n(67),c=n(21),u=n(74),h=function(t){function e(e,n,r){void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===n&&(n=Number.POSITIVE_INFINITY);var i=t.call(this)||this;return i.scheduler=r,i._events=[],i._infiniteTimeWindow=!1,i._bufferSize=e<1?1:e,i._windowTime=n<1?1:n,n===Number.POSITIVE_INFINITY?(i._infiniteTimeWindow=!0,i.next=i.nextInfiniteTimeWindow):i.next=i.nextTimeWindow,i}return r.a(e,t),e.prototype.nextInfiniteTimeWindow=function(e){if(!this.isStopped){var n=this._events;n.push(e),n.length>this._bufferSize&&n.shift()}t.prototype.next.call(this,e)},e.prototype.nextTimeWindow=function(e){this.isStopped||(this._events.push(new l(this._getNow(),e)),this._trimBufferThenGetEvents()),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){var e,n=this._infiniteTimeWindow,r=n?this._events:this._trimBufferThenGetEvents(),i=this.scheduler,o=r.length;if(this.closed)throw new c.a;if(this.isStopped||this.hasError?e=s.a.EMPTY:(this.observers.push(t),e=new u.a(this,t)),i&&t.add(t=new a.a(t,i)),n)for(var h=0;h<o&&!t.closed;h++)t.next(r[h]);else for(h=0;h<o&&!t.closed;h++)t.next(r[h].value);return this.hasError?t.error(this.thrownError):this.isStopped&&t.complete(),e},e.prototype._getNow=function(){return(this.scheduler||o.a).now()},e.prototype._trimBufferThenGetEvents=function(){for(var t=this._getNow(),e=this._bufferSize,n=this._windowTime,r=this._events,i=r.length,o=0;o<i&&!(t-r[o].time<n);)o++;return i>e&&(o=Math.max(o,i-e)),o>0&&r.splice(0,o),r},e}(i.a),l=function(){return function(t,e){this.time=t,this.value=e}}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(3);function i(t,e){return e?new r.a((function(n){return e.schedule(o,0,{error:t,subscriber:n})})):new r.a((function(e){return e.error(t)}))}function o(t){var e=t.error;t.subscriber.error(e)}},function(t,e,n){"use strict";n.d(e,"b",(function(){return h})),n.d(e,"a",(function(){return l}));var r=n(0),i=n(9),o=n(7),s=n(15),a=n(12),c=n(26),u={};function h(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=void 0,r=void 0;return Object(i.a)(t[t.length-1])&&(r=t.pop()),"function"==typeof t[t.length-1]&&(n=t.pop()),1===t.length&&Object(o.a)(t[0])&&(t=t[0]),Object(c.a)(t,r).lift(new l(n))}var l=function(){function t(t){this.resultSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new f(t,this.resultSelector))},t}(),f=function(t){function e(e,n){var r=t.call(this,e)||this;return r.resultSelector=n,r.active=0,r.values=[],r.observables=[],r}return r.a(e,t),e.prototype._next=function(t){this.values.push(u),this.observables.push(t)},e.prototype._complete=function(){var t=this.observables,e=t.length;if(0===e)this.destination.complete();else{this.active=e,this.toRespond=e;for(var n=0;n<e;n++){var r=t[n];this.add(Object(a.a)(this,r,void 0,n))}}},e.prototype.notifyComplete=function(t){0==(this.active-=1)&&this.destination.complete()},e.prototype.notifyNext=function(t,e,n){var r=this.values,i=r[n],o=this.toRespond?i===u?--this.toRespond:this.toRespond:0;r[n]=e,0===o&&(this.resultSelector?this._tryResultSelector(r):this.destination.next(r.slice()))},e.prototype._tryResultSelector=function(t){var e;try{e=this.resultSelector.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(s.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(25),i=n(14);function o(t){return void 0===t&&(t=Number.POSITIVE_INFINITY),Object(r.b)(i.a,t)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(3),i=n(11),o=n(10);function s(t){return new r.a((function(e){var n;try{n=t()}catch(t){return void e.error(t)}return(n?Object(i.a)(n):Object(o.b)()).subscribe(e)}))}},function(t,e,n){"use strict";n.d(e,"b",(function(){return u})),n.d(e,"a",(function(){return h}));var r=n(0),i=n(26),o=n(7),s=n(1),a=n(18),c=n(2);function u(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[t.length-1];return"function"==typeof n&&t.pop(),Object(i.a)(t,void 0).lift(new h(n))}var h=function(){function t(t){this.resultSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new l(t,this.resultSelector))},t}(),l=function(t){function e(e,n,r){void 0===r&&(r=Object.create(null));var i=t.call(this,e)||this;return i.resultSelector=n,i.iterators=[],i.active=0,i.resultSelector="function"==typeof n?n:void 0,i}return r.a(e,t),e.prototype._next=function(t){var e=this.iterators;Object(o.a)(t)?e.push(new d(t)):"function"==typeof t[a.a]?e.push(new f(t[a.a]())):e.push(new p(this.destination,this,t))},e.prototype._complete=function(){var t=this.iterators,e=t.length;if(this.unsubscribe(),0!==e){this.active=e;for(var n=0;n<e;n++){var r=t[n];if(r.stillUnsubscribed)this.destination.add(r.subscribe());else this.active--}}else this.destination.complete()},e.prototype.notifyInactive=function(){this.active--,0===this.active&&this.destination.complete()},e.prototype.checkIterators=function(){for(var t=this.iterators,e=t.length,n=this.destination,r=0;r<e;r++){if("function"==typeof(s=t[r]).hasValue&&!s.hasValue())return}var i=!1,o=[];for(r=0;r<e;r++){var s,a=(s=t[r]).next();if(s.hasCompleted()&&(i=!0),a.done)return void n.complete();o.push(a.value)}this.resultSelector?this._tryresultSelector(o):n.next(o),i&&n.complete()},e.prototype._tryresultSelector=function(t){var e;try{e=this.resultSelector.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(s.a),f=function(){function t(t){this.iterator=t,this.nextResult=t.next()}return t.prototype.hasValue=function(){return!0},t.prototype.next=function(){var t=this.nextResult;return this.nextResult=this.iterator.next(),t},t.prototype.hasCompleted=function(){var t=this.nextResult;return Boolean(t&&t.done)},t}(),d=function(){function t(t){this.array=t,this.index=0,this.length=0,this.length=t.length}return t.prototype[a.a]=function(){return this},t.prototype.next=function(t){var e=this.index++,n=this.array;return e<this.length?{value:n[e],done:!1}:{value:null,done:!0}},t.prototype.hasValue=function(){return this.array.length>this.index},t.prototype.hasCompleted=function(){return this.array.length===this.index},t}(),p=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.parent=n,i.observable=r,i.stillUnsubscribed=!0,i.buffer=[],i.isComplete=!1,i}return r.a(e,t),e.prototype[a.a]=function(){return this},e.prototype.next=function(){var t=this.buffer;return 0===t.length&&this.isComplete?{value:null,done:!0}:{value:t.shift(),done:!1}},e.prototype.hasValue=function(){return this.buffer.length>0},e.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},e.prototype.notifyComplete=function(){this.buffer.length>0?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},e.prototype.notifyNext=function(t){this.buffer.push(t),this.parent.checkIterators()},e.prototype.subscribe=function(){return Object(c.c)(this.observable,new c.a(this))},e}(c.b)},function(t,e,n){"use strict";function r(t){return null!==t&&"object"==typeof t}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(1);function i(t){for(;t;){var e=t,n=e.closed,i=e.destination,o=e.isStopped;if(n||o)return!1;t=i&&i instanceof r.a?i:null}return!0}},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(3),i=n(4);function o(t,e){return new r.a((function(n){var r=new i.a,o=0;return r.add(e.schedule((function(){o!==t.length?(n.next(t[o++]),n.closed||r.add(this.schedule())):n.complete()}))),r}))}},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(13),i=n(33),o={closed:!0,next:function(t){},error:function(t){if(r.a.useDeprecatedSynchronousErrorHandling)throw t;Object(i.a)(t)},complete:function(){}}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}},function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"a",(function(){return s}));var r=n(0),i=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return r.a(e,t),e.prototype.schedule=function(e,n){return void 0===n&&(n=0),n>0?t.prototype.schedule.call(this,e,n):(this.delay=n,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,n){return n>0||this.closed?t.prototype.execute.call(this,e,n):this._execute(e,n)},e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0?t.prototype.requestAsyncId.call(this,e,n,r):e.flush(this)},e}(n(29).a),o=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.a(e,t),e}(n(27).a))(i),s=o},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){function t(e,n){void 0===n&&(n=t.now),this.SchedulerAction=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.SchedulerAction(this,t).schedule(n,e)},t.now=function(){return Date.now()},t}()},function(t,e,n){"use strict";n.d(e,"b",(function(){return c})),n.d(e,"a",(function(){return f}));var r=n(0),i=n(1),o=n(4),s=n(3),a=n(5);function c(t,e,n,r){return function(i){return i.lift(new u(t,e,n,r))}}var u=function(){function t(t,e,n,r){this.keySelector=t,this.elementSelector=e,this.durationSelector=n,this.subjectSelector=r}return t.prototype.call=function(t,e){return e.subscribe(new h(t,this.keySelector,this.elementSelector,this.durationSelector,this.subjectSelector))},t}(),h=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;return s.keySelector=n,s.elementSelector=r,s.durationSelector=i,s.subjectSelector=o,s.groups=null,s.attemptedToUnsubscribe=!1,s.count=0,s}return r.a(e,t),e.prototype._next=function(t){var e;try{e=this.keySelector(t)}catch(t){return void this.error(t)}this._group(t,e)},e.prototype._group=function(t,e){var n=this.groups;n||(n=this.groups=new Map);var r,i=n.get(e);if(this.elementSelector)try{r=this.elementSelector(t)}catch(t){this.error(t)}else r=t;if(!i){i=this.subjectSelector?this.subjectSelector():new a.a,n.set(e,i);var o=new f(e,i,this);if(this.destination.next(o),this.durationSelector){var s=void 0;try{s=this.durationSelector(new f(e,i))}catch(t){return void this.error(t)}this.add(s.subscribe(new l(e,i,this)))}}i.closed||i.next(r)},e.prototype._error=function(t){var e=this.groups;e&&(e.forEach((function(e,n){e.error(t)})),e.clear()),this.destination.error(t)},e.prototype._complete=function(){var t=this.groups;t&&(t.forEach((function(t,e){t.complete()})),t.clear()),this.destination.complete()},e.prototype.removeGroup=function(t){this.groups.delete(t)},e.prototype.unsubscribe=function(){this.closed||(this.attemptedToUnsubscribe=!0,0===this.count&&t.prototype.unsubscribe.call(this))},e}(i.a),l=function(t){function e(e,n,r){var i=t.call(this,n)||this;return i.key=e,i.group=n,i.parent=r,i}return r.a(e,t),e.prototype._next=function(t){this.complete()},e.prototype._unsubscribe=function(){var t=this.parent,e=this.key;this.key=this.parent=null,t&&t.removeGroup(e)},e}(i.a),f=function(t){function e(e,n,r){var i=t.call(this)||this;return i.key=e,i.groupSubject=n,i.refCountSubscription=r,i}return r.a(e,t),e.prototype._subscribe=function(t){var e=new o.a,n=this.refCountSubscription,r=this.groupSubject;return n&&!n.closed&&e.add(new d(n)),e.add(r.subscribe(t)),e},e}(s.a),d=function(t){function e(e){var n=t.call(this)||this;return n.parent=e,e.count++,n}return r.a(e,t),e.prototype.unsubscribe=function(){var e=this.parent;e.closed||this.closed||(t.prototype.unsubscribe.call(this),e.count-=1,0===e.count&&e.attemptedToUnsubscribe&&e.unsubscribe())},e}(o.a)},function(t,e,n){"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),e.DigitalHumanUnmuted=e.DigitalHumanPlayedInMutedModeSuccess=e.DigitalHumanFailedToPlay=e.DigitalHumanVideoError=e.ClientPerformanceMessage=e.ClientMediaStreamUpdateMessage=e.OnlineStatusUpdateMessage=e.SessionInfoMessage=e.AvatarRequestIgnored=e.AvatarRequestCompleted=e.SessionErrorMessage=e.WebRtcStatsMessage=e.WebRtcDataMessage=e.SessionLiveMessage=e.WarningMessage=e.RecordingStoppedMessage=e.RecordingStartedMessage=e.DevicePermissionAllowedMessage=e.AvatarTextInputFinishedMessage=e.FinishedSpeakingMessage=e.StartedSpeakingMessage=e.AvatarQuestionMessage=e.InstructionsMessage=e.AvatarAnswerContentMessage=e.AvatarAnswerMessage=e.ConnectionLostMessage=e.VoiceActivityInputModeNotSupportedMessage=e.MicActivityNotSupportedMessage=e.MicActivityMessage=e.MicActivityErrorMessage=e.ServiceUnavailableMessage=e.AvatarUnavailableMessage=e.AvatarAvailableMessage=e.SessionEndedMessage=e.SessionResumedMessage=e.SessionPausedMessage=e.DeviceListUpdatedMessage=e.DeviceErrorMessage=e.SetSpeakerSuccessMessage=e.SetMicSuccessMessage=e.SetCameraSuccessMessage=e.DeviceNotFoundErrorMessage=e.ReadyMessage=e.UneeqMessageType=void 0,function(t){t.Ready="Ready",t.DeviceNotFoundError="DeviceNotFoundError",t.SetCameraSuccess="SetCameraSuccess",t.SetMicSuccess="SetMicSuccess",t.SetSpeakerSuccess="SetSpeakerSuccess",t.SessionPaused="SessionPaused",t.SessionResumed="SessionResumed",t.SessionEnded="SessionEnded",t.AvatarAvailable="AvatarAvailable",t.AvatarUnavailable="AvatarUnavailable",t.ConnectionLost="ConnectionLost",t.ServiceUnavailable="ServiceUnavailable",t.OnlineStatusUpdate="OnlineStatusUpdate",t.MicActivityNotSupported="MicActivityNotSupported",t.VoiceActivityInputModeNotSupported="VoiceActivityInputModeNotSupported",t.MicActivityError="MicActivityError",t.MicActivity="MicActivity",t.DeviceError="DeviceError",t.DeviceListUpdated="DeviceListUpdated",t.AvatarAnswer="AvatarAnswer",t.AvatarAnswerContent="AvatarAnswerContent",t.Instructions="Instructions",t.StartedSpeaking="StartedSpeaking",t.FinishedSpeaking="FinishedSpeaking",t.AvatarTextInputFinished="AvatarTextInputFinished",t.AvatarQuestionText="AvatarQuestionText",t.DevicePermissionAllowed="DevicePermissionAllowed",t.RecordingStarted="RecordingStarted",t.RecordingStopped="RecordingStopped",t.Warning="Warning",t.SessionLive="SessionLive",t.WebRtcData="WebRtcData",t.WebRtcStats="WebRtcStats",t.SessionError="SessionError",t.SessionInfo="SessionInfo",t.AvatarRequestCompleted="AvatarRequestCompleted",t.AvatarRequestIgnored="AvatarRequestIgnored",t.ClientMediaStreamUpdate="ClientMediaStreamUpdate",t.ClientPerformanceMessage="ClientPerformanceMessage",t.DigitalHumanVideoError="DigitalHumanVideoError",t.DigitalHumanFailedToPlay="DigitalHumanFailedToPlay",t.DigitalHumanPlayedInMutedModeSuccess="DigitalHumanPlayedInMutedModeSuccess",t.DigitalHumanUnmuted="DigitalHumanUnmuted"}(r=e.UneeqMessageType||(e.UneeqMessageType={}));e.ReadyMessage=class{constructor(){this.uneeqMessageType=r.Ready}};e.DeviceNotFoundErrorMessage=class{constructor(t,e){this.msg=t,this.deviceId=e,this.uneeqMessageType=r.DeviceNotFoundError}};e.SetCameraSuccessMessage=class{constructor(t){this.deviceId=t,this.uneeqMessageType=r.SetCameraSuccess}};e.SetMicSuccessMessage=class{constructor(t){this.deviceId=t,this.uneeqMessageType=r.SetMicSuccess}};e.SetSpeakerSuccessMessage=class{constructor(t){this.deviceId=t,this.uneeqMessageType=r.SetSpeakerSuccess}};e.DeviceErrorMessage=class{constructor(t){this.error=t,this.uneeqMessageType=r.DeviceError}};e.DeviceListUpdatedMessage=class{constructor(t){this.devices=t,this.uneeqMessageType=r.DeviceListUpdated}};e.SessionPausedMessage=class{constructor(){this.uneeqMessageType=r.SessionPaused}};e.SessionResumedMessage=class{constructor(){this.uneeqMessageType=r.SessionResumed}};e.SessionEndedMessage=class{constructor(){this.uneeqMessageType=r.SessionEnded}};e.AvatarAvailableMessage=class{constructor(){this.uneeqMessageType=r.AvatarAvailable}};e.AvatarUnavailableMessage=class{constructor(){this.uneeqMessageType=r.AvatarUnavailable}};e.ServiceUnavailableMessage=class{constructor(t){this.error=t,this.uneeqMessageType=r.ServiceUnavailable}};e.MicActivityErrorMessage=class{constructor(t){this.error=t,this.uneeqMessageType=r.MicActivityError}};e.MicActivityMessage=class{constructor(t){this.level=t,this.uneeqMessageType=r.MicActivity}};e.MicActivityNotSupportedMessage=class{constructor(){this.uneeqMessageType=r.MicActivityNotSupported}};e.VoiceActivityInputModeNotSupportedMessage=class{constructor(){this.uneeqMessageType=r.VoiceActivityInputModeNotSupported}};e.ConnectionLostMessage=class{constructor(t){this.connectionState=t,this.uneeqMessageType=r.ConnectionLost}};e.AvatarAnswerMessage=class{constructor(t,e,n,i){this.answer=t,this.answerAvatar=e,this.answerSpeech=n,this.transcriptId=i,this.uneeqMessageType=r.AvatarAnswer}};e.AvatarAnswerContentMessage=class{constructor(t,e,n=!1){this.content=t,this.transcriptId=e,this.hasDisplayHtml=n,this.uneeqMessageType=r.AvatarAnswerContent}};e.InstructionsMessage=class{constructor(t){this.instructions=t,this.uneeqMessageType=r.Instructions}};e.AvatarQuestionMessage=class{constructor(t,e){this.question=t,this.transcriptId=e,this.uneeqMessageType=r.AvatarQuestionText}};e.StartedSpeakingMessage=class{constructor(){this.uneeqMessageType=r.StartedSpeaking}};e.FinishedSpeakingMessage=class{constructor(){this.uneeqMessageType=r.FinishedSpeaking}};e.AvatarTextInputFinishedMessage=class{constructor(){this.uneeqMessageType=r.AvatarTextInputFinished}};e.DevicePermissionAllowedMessage=class{constructor(){this.uneeqMessageType=r.DevicePermissionAllowed}};e.RecordingStartedMessage=class{constructor(){this.uneeqMessageType=r.RecordingStarted}};e.RecordingStoppedMessage=class{constructor(){this.uneeqMessageType=r.RecordingStopped}};e.WarningMessage=class{constructor(t){this.msg=t,this.uneeqMessageType=r.Warning}};e.SessionLiveMessage=class{constructor(t,e){this.showLogo=t,this.sessionResumed=e,this.uneeqMessageType=r.SessionLive}};e.WebRtcDataMessage=class{constructor(t){this.data=t,this.uneeqMessageType=r.WebRtcData}};e.WebRtcStatsMessage=class{constructor(t){this.stats=t,this.uneeqMessageType=r.WebRtcStats}};e.SessionErrorMessage=class{constructor(t){this.error=t,this.uneeqMessageType=r.SessionError}};e.AvatarRequestCompleted=class{constructor(t){this.reason=t,this.uneeqMessageType=r.AvatarRequestCompleted}};e.AvatarRequestIgnored=class{constructor(t){this.reason=t,this.uneeqMessageType=r.AvatarRequestIgnored}};e.SessionInfoMessage=class{constructor(t){this.info=t,this.uneeqMessageType=r.SessionInfo}};e.OnlineStatusUpdateMessage=class{constructor(t){this.online=t,this.uneeqMessageType=r.OnlineStatusUpdate}};e.ClientMediaStreamUpdateMessage=class{constructor(t,e,n,i){this.clientStreamingAudio=t,this.clientStreamingVideo=e,this.serverStreamingAudio=n,this.serverStreamingVideo=i,this.uneeqMessageType=r.ClientMediaStreamUpdate}};e.ClientPerformanceMessage=class{constructor(t){this.clientPerformance=t,this.uneeqMessageType=r.ClientPerformanceMessage}};e.DigitalHumanVideoError=class{constructor(t){this.error=t,this.uneeqMessageType=r.DigitalHumanVideoError}};e.DigitalHumanFailedToPlay=class{constructor(){this.uneeqMessageType=r.DigitalHumanFailedToPlay,this.msg="Digital Human failed to play with sound. This most likely occurred because the user has not yet interacted with the page and was blocked due to the browser's autoplay policy. Video will automatically be muted and attempted to be played again."}};e.DigitalHumanPlayedInMutedModeSuccess=class{constructor(){this.uneeqMessageType=r.DigitalHumanPlayedInMutedModeSuccess,this.msg="Digital Human was successfully played in muted mode. After the user interacts with the page you will need to call unmuteDigitalHuman() to unmute the video."}};e.DigitalHumanUnmuted=class{constructor(){this.uneeqMessageType=r.DigitalHumanUnmuted}}},function(t,e,n){(function(t,r){var i;
23
+ var r=n(101),i=n(102),o=n(103);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=c.prototype:(null===t&&(t=new c(e)),t.length=e),t}function c(t,e,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return u(this,t,e,n)}function u(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);c.TYPED_ARRAY_SUPPORT?(t=e).__proto__=c.prototype:t=f(t,e);return t}(t,e,n,r):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|p(e,n),i=(t=a(t,r)).write(e,n);i!==r&&(t=t.slice(0,i));return t}(t,e,n):function(t,e){if(c.isBuffer(e)){var n=0|d(e.length);return 0===(t=a(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?a(t,0):f(t,e);if("Buffer"===e.type&&o(e.data))return f(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e){if(h(e),t=a(t,e<0?0:0|d(e)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function f(t,e){var n=e.length<0?0:0|d(e.length);t=a(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function d(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function p(t,e){if(c.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(t).length;default:if(r)return B(t).length;e=(""+e).toLowerCase(),r=!0}}function v(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return O(this,e,n);case"utf8":case"utf-8":return E(this,e,n);case"ascii":return R(this,e,n);case"latin1":case"binary":return M(this,e,n);case"base64":return C(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function g(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function m(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=c.from(e,r)),c.isBuffer(e))return 0===e.length?-1:y(t,e,n,r,i);if("number"==typeof e)return e&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,r,i){var o,s=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=n;o<a;o++)if(u(t,o)===u(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===c)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){for(var l=!0,f=0;f<c;f++)if(u(t,o+f)!==u(e,f)){l=!1;break}if(l)return o}return-1}function b(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[n+s]=a}return s}function _(t,e,n,r){return W(B(e,t.length-n),t,n,r)}function w(t,e,n,r){return W(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function S(t,e,n,r){return w(t,e,n,r)}function x(t,e,n,r){return W(V(e),t,n,r)}function T(t,e,n,r){return W(function(t,e){for(var n,r,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function C(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function E(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,s,a,c,u=t[i],h=null,l=u>239?4:u>223?3:u>191?2:1;if(i+l<=n)switch(l){case 1:u<128&&(h=u);break;case 2:128==(192&(o=t[i+1]))&&(c=(31&u)<<6|63&o)>127&&(h=c);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(h=c);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(h=c)}null===h?(h=65533,l=1):h>65535&&(h-=65536,r.push(h>>>10&1023|55296),h=56320|1023&h),r.push(h),i+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=4096));return n}(r)}e.Buffer=c,e.SlowBuffer=function(t){+t!=t&&(t=0);return c.alloc(+t)},e.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),c.poolSize=8192,c._augment=function(t){return t.__proto__=c.prototype,t},c.from=function(t,e,n){return u(null,t,e,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(t,e,n){return function(t,e,n,r){return h(e),e<=0?a(t,e):void 0!==n?"string"==typeof r?a(t,e).fill(n,r):a(t,e).fill(n):a(t,e)}(null,t,e,n)},c.allocUnsafe=function(t){return l(null,t)},c.allocUnsafeSlow=function(t){return l(null,t)},c.isBuffer=function(t){return!(null==t||!t._isBuffer)},c.compare=function(t,e){if(!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},c.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=c.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var s=t[n];if(!c.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i),i+=s.length}return r},c.byteLength=p,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},c.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},c.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},c.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?E(this,0,t):v.apply(this,arguments)},c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},c.prototype.compare=function(t,e,n,r,i){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0),a=Math.min(o,s),u=this.slice(r,i),h=t.slice(e,n),l=0;l<a;++l)if(u[l]!==h[l]){o=u[l],s=h[l];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},c.prototype.indexOf=function(t,e,n){return m(this,t,e,n,!0)},c.prototype.lastIndexOf=function(t,e,n){return m(this,t,e,n,!1)},c.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return _(this,t,e,n);case"ascii":return w(this,t,e,n);case"latin1":case"binary":return S(this,t,e,n);case"base64":return x(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function R(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function M(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function O(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=F(t[o]);return i}function A(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function P(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function k(t,e,n,r,i,o){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function I(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function D(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function N(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(t,e,n,r,o){return o||N(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function L(t,e,n,r,o){return o||N(t,0,n,8),i.write(t,e,n,r,52,8),n+8}c.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=c.prototype;else{var i=e-t;n=new c(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},c.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},c.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},c.prototype.readUInt8=function(t,e){return e||P(t,1,this.length),this[t]},c.prototype.readUInt16LE=function(t,e){return e||P(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function(t,e){return e||P(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function(t,e){return e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function(t,e){return e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},c.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},c.prototype.readInt8=function(t,e){return e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){e||P(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(t,e){e||P(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(t,e){return e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function(t,e){return e||P(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return e||P(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return e||P(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return e||P(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||k(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},c.prototype.writeUIntBE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||k(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},c.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,1,255,0),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},c.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):I(this,t,e,!0),e+2},c.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):I(this,t,e,!1),e+2},c.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):D(this,t,e,!0),e+4},c.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},c.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);k(this,t,e,n,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<n&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},c.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);k(this,t,e,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},c.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,1,127,-128),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):I(this,t,e,!0),e+2},c.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):I(this,t,e,!1),e+2},c.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):D(this,t,e,!0),e+4},c.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},c.prototype.writeFloatLE=function(t,e,n){return j(this,t,e,!0,n)},c.prototype.writeFloatBE=function(t,e,n){return j(this,t,e,!1,n)},c.prototype.writeDoubleLE=function(t,e,n){return L(this,t,e,!0,n)},c.prototype.writeDoubleBE=function(t,e,n){return L(this,t,e,!1,n)},c.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;i>=0;--i)t[i+e]=this[i+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},c.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var s=c.isBuffer(t)?t:B(new c(t,r).toString()),a=s.length;for(o=0;o<n-e;++o)this[o+e]=s[o%a]}return this};var U=/[^+\/0-9A-Za-z-_]/g;function F(t){return t<16?"0"+t.toString(16):t.toString(16)}function B(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function V(t){return r.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(U,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function W(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}}).call(this,n(35))},function(t,e,n){"use strict";var r={};function i(t,e,n){n||(n=Error);var i=function(t){var n,r;function i(n,r,i){return t.call(this,function(t,n,r){return"string"==typeof e?e:e(t,n,r)}(n,r,i))||this}return r=t,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r,i}(n);i.prototype.name=n.name,i.prototype.code=t,r[t]=i}function o(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(t){return String(t)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}i("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(t,e,n){var r,i,s,a;if("string"==typeof e&&(i="not ",e.substr(!s||s<0?0:+s,i.length)===i)?(r="must not be",e=e.replace(/^not /,"")):r="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-e.length,n)===e}(t," argument"))a="The ".concat(t," ").concat(r," ").concat(o(e,"type"));else{var c=function(t,e,n){return"number"!=typeof n&&(n=0),!(n+e.length>t.length)&&-1!==t.indexOf(e,n)}(t,".")?"property":"argument";a='The "'.concat(t,'" ').concat(c," ").concat(r," ").concat(o(e,"type"))}return a+=". Received type ".concat(typeof n)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=r},function(t,e,n){"use strict";(function(e){var r=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=u;var i=n(87),o=n(92);n(59)(u,i);for(var s=r(o.prototype),a=0;a<s.length;a++){var c=s[a];u.prototype[c]||(u.prototype[c]=o.prototype[c])}function u(t){if(!(this instanceof u))return new u(t);i.call(this,t),o.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",h)))}function h(){this._writableState.ended||e.nextTick(l,this)}function l(t){t.end()}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(u.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(u.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this,n(38))},function(t,e,n){"use strict";n.r(e),n.d(e,"Observable",(function(){return r.a})),n.d(e,"ConnectableObservable",(function(){return i.a})),n.d(e,"GroupedObservable",(function(){return o.a})),n.d(e,"observable",(function(){return s.a})),n.d(e,"Subject",(function(){return a.a})),n.d(e,"BehaviorSubject",(function(){return c.a})),n.d(e,"ReplaySubject",(function(){return u.a})),n.d(e,"AsyncSubject",(function(){return h.a})),n.d(e,"asap",(function(){return l.a})),n.d(e,"asapScheduler",(function(){return l.b})),n.d(e,"async",(function(){return f.a})),n.d(e,"asyncScheduler",(function(){return f.b})),n.d(e,"queue",(function(){return d.a})),n.d(e,"queueScheduler",(function(){return d.b})),n.d(e,"animationFrame",(function(){return b})),n.d(e,"animationFrameScheduler",(function(){return y})),n.d(e,"VirtualTimeScheduler",(function(){return _})),n.d(e,"VirtualAction",(function(){return w})),n.d(e,"Scheduler",(function(){return S.a})),n.d(e,"Subscription",(function(){return x.a})),n.d(e,"Subscriber",(function(){return T.a})),n.d(e,"Notification",(function(){return C.a})),n.d(e,"NotificationKind",(function(){return C.b})),n.d(e,"pipe",(function(){return E.a})),n.d(e,"noop",(function(){return R.a})),n.d(e,"identity",(function(){return M.a})),n.d(e,"isObservable",(function(){return O})),n.d(e,"ArgumentOutOfRangeError",(function(){return A.a})),n.d(e,"EmptyError",(function(){return P.a})),n.d(e,"ObjectUnsubscribedError",(function(){return k.a})),n.d(e,"UnsubscriptionError",(function(){return I.a})),n.d(e,"TimeoutError",(function(){return D.a})),n.d(e,"bindCallback",(function(){return F})),n.d(e,"bindNodeCallback",(function(){return W})),n.d(e,"combineLatest",(function(){return G.b})),n.d(e,"concat",(function(){return Y.a})),n.d(e,"defer",(function(){return $.a})),n.d(e,"empty",(function(){return X.b})),n.d(e,"forkJoin",(function(){return Z})),n.d(e,"from",(function(){return J.a})),n.d(e,"fromEvent",(function(){return et})),n.d(e,"fromEventPattern",(function(){return nt})),n.d(e,"generate",(function(){return rt})),n.d(e,"iif",(function(){return ot})),n.d(e,"interval",(function(){return at})),n.d(e,"merge",(function(){return ut.a})),n.d(e,"never",(function(){return lt})),n.d(e,"of",(function(){return ft.a})),n.d(e,"onErrorResumeNext",(function(){return dt})),n.d(e,"pairs",(function(){return pt})),n.d(e,"partition",(function(){return bt})),n.d(e,"race",(function(){return _t.a})),n.d(e,"range",(function(){return wt})),n.d(e,"throwError",(function(){return xt.a})),n.d(e,"timer",(function(){return Tt.a})),n.d(e,"using",(function(){return Ct})),n.d(e,"zip",(function(){return Et.b})),n.d(e,"scheduled",(function(){return Rt.a})),n.d(e,"EMPTY",(function(){return X.a})),n.d(e,"NEVER",(function(){return ht})),n.d(e,"config",(function(){return Mt.a}));var r=n(3),i=n(65),o=n(62),s=n(20),a=n(5),c=n(66),u=n(49),h=n(28),l=n(40),f=n(6),d=n(60),p=n(0),v=n(29),g=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return p.a(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e.scheduled||(e.scheduled=requestAnimationFrame((function(){return e.flush(null)}))))},e.prototype.recycleAsyncId=function(e,n,r){if(void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);0===e.actions.length&&(cancelAnimationFrame(n),e.scheduled=void 0)},e}(v.a),m=n(27),y=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return p.a(e,t),e.prototype.flush=function(t){this.active=!0,this.scheduled=void 0;var e,n=this.actions,r=-1,i=n.length;t=t||n.shift();do{if(e=t.execute(t.state,t.delay))break}while(++r<i&&(t=n.shift()));if(this.active=!1,e){for(;++r<i&&(t=n.shift());)t.unsubscribe();throw e}},e}(m.a))(g),b=y,_=function(t){function e(e,n){void 0===e&&(e=w),void 0===n&&(n=Number.POSITIVE_INFINITY);var r=t.call(this,e,(function(){return r.frame}))||this;return r.maxFrames=n,r.frame=0,r.index=-1,r}return p.a(e,t),e.prototype.flush=function(){for(var t,e,n=this.actions,r=this.maxFrames;(e=n[0])&&e.delay<=r&&(n.shift(),this.frame=e.delay,!(t=e.execute(e.state,e.delay))););if(t){for(;e=n.shift();)e.unsubscribe();throw t}},e.frameTimeFactor=10,e}(m.a),w=function(t){function e(e,n,r){void 0===r&&(r=e.index+=1);var i=t.call(this,e,n)||this;return i.scheduler=e,i.work=n,i.index=r,i.active=!0,i.index=e.index=r,i}return p.a(e,t),e.prototype.schedule=function(n,r){if(void 0===r&&(r=0),!this.id)return t.prototype.schedule.call(this,n,r);this.active=!1;var i=new e(this.scheduler,this.work);return this.add(i),i.schedule(n,r)},e.prototype.requestAsyncId=function(t,n,r){void 0===r&&(r=0),this.delay=t.frame+r;var i=t.actions;return i.push(this),i.sort(e.sortActions),!0},e.prototype.recycleAsyncId=function(t,e,n){void 0===n&&(n=0)},e.prototype._execute=function(e,n){if(!0===this.active)return t.prototype._execute.call(this,e,n)},e.sortActions=function(t,e){return t.delay===e.delay?t.index===e.index?0:t.index>e.index?1:-1:t.delay>e.delay?1:-1},e}(v.a),S=n(61),x=n(4),T=n(1),C=n(17),E=n(39),R=n(19),M=n(14);function O(t){return!!t&&(t instanceof r.a||"function"==typeof t.lift&&"function"==typeof t.subscribe)}var A=n(22),P=n(24),k=n(21),I=n(42),D=n(68),N=n(8),j=n(56),L=n(7),U=n(9);function F(t,e,n){if(e){if(!Object(U.a)(e))return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return F(t,n).apply(void 0,r).pipe(Object(N.a)((function(t){return Object(L.a)(t)?e.apply(void 0,t):e(t)})))};n=e}return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var o,s=this,a={context:s,subject:o,callbackFunc:t,scheduler:n};return new r.a((function(r){if(n){var i={args:e,subscriber:r,params:a};return n.schedule(B,0,i)}if(!o){o=new h.a;try{t.apply(s,e.concat([function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];o.next(t.length<=1?t[0]:t),o.complete()}]))}catch(t){Object(j.a)(o)?o.error(t):console.warn(t)}}return o.subscribe(r)}))}}function B(t){var e=this,n=t.args,r=t.subscriber,i=t.params,o=i.callbackFunc,s=i.context,a=i.scheduler,c=i.subject;if(!c){c=i.subject=new h.a;try{o.apply(s,n.concat([function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.length<=1?t[0]:t;e.add(a.schedule(V,0,{value:r,subject:c}))}]))}catch(t){c.error(t)}}this.add(c.subscribe(r))}function V(t){var e=t.value,n=t.subject;n.next(e),n.complete()}function W(t,e,n){if(e){if(!Object(U.a)(e))return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return W(t,n).apply(void 0,r).pipe(Object(N.a)((function(t){return Object(L.a)(t)?e.apply(void 0,t):e(t)})))};n=e}return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var o={subject:void 0,args:e,callbackFunc:t,scheduler:n,context:this};return new r.a((function(r){var i=o.context,s=o.subject;if(n)return n.schedule(q,0,{params:o,subscriber:r,context:i});if(!s){s=o.subject=new h.a;try{t.apply(i,e.concat([function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t.shift();n?s.error(n):(s.next(t.length<=1?t[0]:t),s.complete())}]))}catch(t){Object(j.a)(s)?s.error(t):console.warn(t)}}return s.subscribe(r)}))}}function q(t){var e=this,n=t.params,r=t.subscriber,i=t.context,o=n.callbackFunc,s=n.args,a=n.scheduler,c=n.subject;if(!c){c=n.subject=new h.a;try{o.apply(i,s.concat([function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.shift();if(r)e.add(a.schedule(z,0,{err:r,subject:c}));else{var i=t.length<=1?t[0]:t;e.add(a.schedule(H,0,{value:i,subject:c}))}}]))}catch(t){this.add(a.schedule(z,0,{err:t,subject:c}))}}this.add(c.subscribe(r))}function H(t){var e=t.value,n=t.subject;n.next(e),n.complete()}function z(t){var e=t.err;t.subject.error(e)}var G=n(51),Y=n(32),$=n(53),X=n(10),K=n(55),J=n(11);function Z(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(1===t.length){var n=t[0];if(Object(L.a)(n))return Q(n,null);if(Object(K.a)(n)&&Object.getPrototypeOf(n)===Object.prototype){var r=Object.keys(n);return Q(r.map((function(t){return n[t]})),r)}}if("function"==typeof t[t.length-1]){var i=t.pop();return Q(t=1===t.length&&Object(L.a)(t[0])?t[0]:t,null).pipe(Object(N.a)((function(t){return i.apply(void 0,t)})))}return Q(t,null)}function Q(t,e){return new r.a((function(n){var r=t.length;if(0!==r)for(var i=new Array(r),o=0,s=0,a=function(a){var c=Object(J.a)(t[a]),u=!1;n.add(c.subscribe({next:function(t){u||(u=!0,s++),i[a]=t},error:function(t){return n.error(t)},complete:function(){++o!==r&&u||(s===r&&n.next(e?e.reduce((function(t,e,n){return t[e]=i[n],t}),{}):i),n.complete())}}))},c=0;c<r;c++)a(c);else n.complete()}))}var tt=n(23);function et(t,e,n,i){return Object(tt.a)(n)&&(i=n,n=void 0),i?et(t,e,n).pipe(Object(N.a)((function(t){return Object(L.a)(t)?i.apply(void 0,t):i(t)}))):new r.a((function(r){!function t(e,n,r,i,o){var s;if(function(t){return t&&"function"==typeof t.addEventListener&&"function"==typeof t.removeEventListener}(e)){var a=e;e.addEventListener(n,r,o),s=function(){return a.removeEventListener(n,r,o)}}else if(function(t){return t&&"function"==typeof t.on&&"function"==typeof t.off}(e)){var c=e;e.on(n,r),s=function(){return c.off(n,r)}}else if(function(t){return t&&"function"==typeof t.addListener&&"function"==typeof t.removeListener}(e)){var u=e;e.addListener(n,r),s=function(){return u.removeListener(n,r)}}else{if(!e||!e.length)throw new TypeError("Invalid event target");for(var h=0,l=e.length;h<l;h++)t(e[h],n,r,i,o)}i.add(s)}(t,e,(function(t){arguments.length>1?r.next(Array.prototype.slice.call(arguments)):r.next(t)}),r,n)}))}function nt(t,e,n){return n?nt(t,e).pipe(Object(N.a)((function(t){return Object(L.a)(t)?n.apply(void 0,t):n(t)}))):new r.a((function(n){var r,i=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.next(1===t.length?t[0]:t)};try{r=t(i)}catch(t){return void n.error(t)}if(Object(tt.a)(e))return function(){return e(i,r)}}))}function rt(t,e,n,i,o){var s,a;if(1==arguments.length){var c=t;a=c.initialState,e=c.condition,n=c.iterate,s=c.resultSelector||M.a,o=c.scheduler}else void 0===i||Object(U.a)(i)?(a=t,s=M.a,o=i):(a=t,s=i);return new r.a((function(t){var r=a;if(o)return o.schedule(it,0,{subscriber:t,iterate:n,condition:e,resultSelector:s,state:r});for(;;){if(e){var i=void 0;try{i=e(r)}catch(e){return void t.error(e)}if(!i){t.complete();break}}var c=void 0;try{c=s(r)}catch(e){return void t.error(e)}if(t.next(c),t.closed)break;try{r=n(r)}catch(e){return void t.error(e)}}}))}function it(t){var e=t.subscriber,n=t.condition;if(!e.closed){if(t.needIterate)try{t.state=t.iterate(t.state)}catch(t){return void e.error(t)}else t.needIterate=!0;if(n){var r=void 0;try{r=n(t.state)}catch(t){return void e.error(t)}if(!r)return void e.complete();if(e.closed)return}var i;try{i=t.resultSelector(t.state)}catch(t){return void e.error(t)}if(!e.closed&&(e.next(i),!e.closed))return this.schedule(t)}}function ot(t,e,n){return void 0===e&&(e=X.a),void 0===n&&(n=X.a),Object($.a)((function(){return t()?e:n}))}var st=n(30);function at(t,e){return void 0===t&&(t=0),void 0===e&&(e=f.a),(!Object(st.a)(t)||t<0)&&(t=0),e&&"function"==typeof e.schedule||(e=f.a),new r.a((function(n){return n.add(e.schedule(ct,t,{subscriber:n,counter:0,period:t})),n}))}function ct(t){var e=t.subscriber,n=t.counter,r=t.period;e.next(n),this.schedule({subscriber:e,counter:n+1,period:r},r)}var ut=n(70),ht=new r.a(R.a);function lt(){return ht}var ft=n(36);function dt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0===t.length)return X.a;var n=t[0],i=t.slice(1);return 1===t.length&&Object(L.a)(n)?dt.apply(void 0,n):new r.a((function(t){var e=function(){return t.add(dt.apply(void 0,i).subscribe(t))};return Object(J.a)(n).subscribe({next:function(e){t.next(e)},error:e,complete:e})}))}function pt(t,e){return e?new r.a((function(n){var r=Object.keys(t),i=new x.a;return i.add(e.schedule(vt,0,{keys:r,index:0,subscriber:n,subscription:i,obj:t})),i})):new r.a((function(e){for(var n=Object.keys(t),r=0;r<n.length&&!e.closed;r++){var i=n[r];t.hasOwnProperty(i)&&e.next([i,t[i]])}e.complete()}))}function vt(t){var e=t.keys,n=t.index,r=t.subscriber,i=t.subscription,o=t.obj;if(!r.closed)if(n<e.length){var s=e[n];r.next([s,o[s]]),i.add(this.schedule({keys:e,index:n+1,subscriber:r,subscription:i,obj:o}))}else r.complete()}var gt=n(78),mt=n(33),yt=n(16);function bt(t,e,n){return[Object(yt.a)(e,n)(new r.a(Object(mt.a)(t))),Object(yt.a)(Object(gt.a)(e,n))(new r.a(Object(mt.a)(t)))]}var _t=n(71);function wt(t,e,n){return void 0===t&&(t=0),new r.a((function(r){void 0===e&&(e=t,t=0);var i=0,o=t;if(n)return n.schedule(St,0,{index:i,count:e,start:t,subscriber:r});for(;;){if(i++>=e){r.complete();break}if(r.next(o++),r.closed)break}}))}function St(t){var e=t.start,n=t.index,r=t.count,i=t.subscriber;n>=r?i.complete():(i.next(e),i.closed||(t.index=n+1,t.start=e+1,this.schedule(t)))}var xt=n(50),Tt=n(72);function Ct(t,e){return new r.a((function(n){var r,i;try{r=t()}catch(t){return void n.error(t)}try{i=e(r)}catch(t){return void n.error(t)}var o=(i?Object(J.a)(i):X.a).subscribe(n);return function(){o.unsubscribe(),r&&r.unsubscribe()}}))}var Et=n(54),Rt=n(73),Mt=n(13)},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(0),i=n(1);function o(){return function(t){return t.lift(new s(t))}}var s=function(){function t(t){this.connectable=t}return t.prototype.call=function(t,e){var n=this.connectable;n._refCount++;var r=new a(t,n),i=e.subscribe(r);return r.closed||(r.connection=n.connect()),i},t}(),a=function(t){function e(e,n){var r=t.call(this,e)||this;return r.connectable=n,r}return r.a(e,t),e.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._refCount;if(e<=0)this.connection=null;else if(t._refCount=e-1,e>1)this.connection=null;else{var n=this.connection,r=t._connection;this.connection=null,!r||n&&r!==n||r.unsubscribe()}}else this.connection=null},e}(i.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(0),i=n(5),o=n(60),s=n(4),a=n(67),c=n(21),u=n(74),h=function(t){function e(e,n,r){void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===n&&(n=Number.POSITIVE_INFINITY);var i=t.call(this)||this;return i.scheduler=r,i._events=[],i._infiniteTimeWindow=!1,i._bufferSize=e<1?1:e,i._windowTime=n<1?1:n,n===Number.POSITIVE_INFINITY?(i._infiniteTimeWindow=!0,i.next=i.nextInfiniteTimeWindow):i.next=i.nextTimeWindow,i}return r.a(e,t),e.prototype.nextInfiniteTimeWindow=function(e){if(!this.isStopped){var n=this._events;n.push(e),n.length>this._bufferSize&&n.shift()}t.prototype.next.call(this,e)},e.prototype.nextTimeWindow=function(e){this.isStopped||(this._events.push(new l(this._getNow(),e)),this._trimBufferThenGetEvents()),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){var e,n=this._infiniteTimeWindow,r=n?this._events:this._trimBufferThenGetEvents(),i=this.scheduler,o=r.length;if(this.closed)throw new c.a;if(this.isStopped||this.hasError?e=s.a.EMPTY:(this.observers.push(t),e=new u.a(this,t)),i&&t.add(t=new a.a(t,i)),n)for(var h=0;h<o&&!t.closed;h++)t.next(r[h]);else for(h=0;h<o&&!t.closed;h++)t.next(r[h].value);return this.hasError?t.error(this.thrownError):this.isStopped&&t.complete(),e},e.prototype._getNow=function(){return(this.scheduler||o.a).now()},e.prototype._trimBufferThenGetEvents=function(){for(var t=this._getNow(),e=this._bufferSize,n=this._windowTime,r=this._events,i=r.length,o=0;o<i&&!(t-r[o].time<n);)o++;return i>e&&(o=Math.max(o,i-e)),o>0&&r.splice(0,o),r},e}(i.a),l=function(){return function(t,e){this.time=t,this.value=e}}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(3);function i(t,e){return e?new r.a((function(n){return e.schedule(o,0,{error:t,subscriber:n})})):new r.a((function(e){return e.error(t)}))}function o(t){var e=t.error;t.subscriber.error(e)}},function(t,e,n){"use strict";n.d(e,"b",(function(){return h})),n.d(e,"a",(function(){return l}));var r=n(0),i=n(9),o=n(7),s=n(15),a=n(12),c=n(26),u={};function h(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=void 0,r=void 0;return Object(i.a)(t[t.length-1])&&(r=t.pop()),"function"==typeof t[t.length-1]&&(n=t.pop()),1===t.length&&Object(o.a)(t[0])&&(t=t[0]),Object(c.a)(t,r).lift(new l(n))}var l=function(){function t(t){this.resultSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new f(t,this.resultSelector))},t}(),f=function(t){function e(e,n){var r=t.call(this,e)||this;return r.resultSelector=n,r.active=0,r.values=[],r.observables=[],r}return r.a(e,t),e.prototype._next=function(t){this.values.push(u),this.observables.push(t)},e.prototype._complete=function(){var t=this.observables,e=t.length;if(0===e)this.destination.complete();else{this.active=e,this.toRespond=e;for(var n=0;n<e;n++){var r=t[n];this.add(Object(a.a)(this,r,void 0,n))}}},e.prototype.notifyComplete=function(t){0==(this.active-=1)&&this.destination.complete()},e.prototype.notifyNext=function(t,e,n){var r=this.values,i=r[n],o=this.toRespond?i===u?--this.toRespond:this.toRespond:0;r[n]=e,0===o&&(this.resultSelector?this._tryResultSelector(r):this.destination.next(r.slice()))},e.prototype._tryResultSelector=function(t){var e;try{e=this.resultSelector.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(s.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(25),i=n(14);function o(t){return void 0===t&&(t=Number.POSITIVE_INFINITY),Object(r.b)(i.a,t)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(3),i=n(11),o=n(10);function s(t){return new r.a((function(e){var n;try{n=t()}catch(t){return void e.error(t)}return(n?Object(i.a)(n):Object(o.b)()).subscribe(e)}))}},function(t,e,n){"use strict";n.d(e,"b",(function(){return u})),n.d(e,"a",(function(){return h}));var r=n(0),i=n(26),o=n(7),s=n(1),a=n(18),c=n(2);function u(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[t.length-1];return"function"==typeof n&&t.pop(),Object(i.a)(t,void 0).lift(new h(n))}var h=function(){function t(t){this.resultSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new l(t,this.resultSelector))},t}(),l=function(t){function e(e,n,r){void 0===r&&(r=Object.create(null));var i=t.call(this,e)||this;return i.resultSelector=n,i.iterators=[],i.active=0,i.resultSelector="function"==typeof n?n:void 0,i}return r.a(e,t),e.prototype._next=function(t){var e=this.iterators;Object(o.a)(t)?e.push(new d(t)):"function"==typeof t[a.a]?e.push(new f(t[a.a]())):e.push(new p(this.destination,this,t))},e.prototype._complete=function(){var t=this.iterators,e=t.length;if(this.unsubscribe(),0!==e){this.active=e;for(var n=0;n<e;n++){var r=t[n];if(r.stillUnsubscribed)this.destination.add(r.subscribe());else this.active--}}else this.destination.complete()},e.prototype.notifyInactive=function(){this.active--,0===this.active&&this.destination.complete()},e.prototype.checkIterators=function(){for(var t=this.iterators,e=t.length,n=this.destination,r=0;r<e;r++){if("function"==typeof(s=t[r]).hasValue&&!s.hasValue())return}var i=!1,o=[];for(r=0;r<e;r++){var s,a=(s=t[r]).next();if(s.hasCompleted()&&(i=!0),a.done)return void n.complete();o.push(a.value)}this.resultSelector?this._tryresultSelector(o):n.next(o),i&&n.complete()},e.prototype._tryresultSelector=function(t){var e;try{e=this.resultSelector.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(s.a),f=function(){function t(t){this.iterator=t,this.nextResult=t.next()}return t.prototype.hasValue=function(){return!0},t.prototype.next=function(){var t=this.nextResult;return this.nextResult=this.iterator.next(),t},t.prototype.hasCompleted=function(){var t=this.nextResult;return Boolean(t&&t.done)},t}(),d=function(){function t(t){this.array=t,this.index=0,this.length=0,this.length=t.length}return t.prototype[a.a]=function(){return this},t.prototype.next=function(t){var e=this.index++,n=this.array;return e<this.length?{value:n[e],done:!1}:{value:null,done:!0}},t.prototype.hasValue=function(){return this.array.length>this.index},t.prototype.hasCompleted=function(){return this.array.length===this.index},t}(),p=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.parent=n,i.observable=r,i.stillUnsubscribed=!0,i.buffer=[],i.isComplete=!1,i}return r.a(e,t),e.prototype[a.a]=function(){return this},e.prototype.next=function(){var t=this.buffer;return 0===t.length&&this.isComplete?{value:null,done:!0}:{value:t.shift(),done:!1}},e.prototype.hasValue=function(){return this.buffer.length>0},e.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},e.prototype.notifyComplete=function(){this.buffer.length>0?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},e.prototype.notifyNext=function(t){this.buffer.push(t),this.parent.checkIterators()},e.prototype.subscribe=function(){return Object(c.c)(this.observable,new c.a(this))},e}(c.b)},function(t,e,n){"use strict";function r(t){return null!==t&&"object"==typeof t}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(1);function i(t){for(;t;){var e=t,n=e.closed,i=e.destination,o=e.isStopped;if(n||o)return!1;t=i&&i instanceof r.a?i:null}return!0}},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(3),i=n(4);function o(t,e){return new r.a((function(n){var r=new i.a,o=0;return r.add(e.schedule((function(){o!==t.length?(n.next(t[o++]),n.closed||r.add(this.schedule())):n.complete()}))),r}))}},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(13),i=n(34),o={closed:!0,next:function(t){},error:function(t){if(r.a.useDeprecatedSynchronousErrorHandling)throw t;Object(i.a)(t)},complete:function(){}}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}},function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"a",(function(){return s}));var r=n(0),i=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return r.a(e,t),e.prototype.schedule=function(e,n){return void 0===n&&(n=0),n>0?t.prototype.schedule.call(this,e,n):(this.delay=n,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,n){return n>0||this.closed?t.prototype.execute.call(this,e,n):this._execute(e,n)},e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0?t.prototype.requestAsyncId.call(this,e,n,r):e.flush(this)},e}(n(29).a),o=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.a(e,t),e}(n(27).a))(i),s=o},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){function t(e,n){void 0===n&&(n=t.now),this.SchedulerAction=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.SchedulerAction(this,t).schedule(n,e)},t.now=function(){return Date.now()},t}()},function(t,e,n){"use strict";n.d(e,"b",(function(){return c})),n.d(e,"a",(function(){return f}));var r=n(0),i=n(1),o=n(4),s=n(3),a=n(5);function c(t,e,n,r){return function(i){return i.lift(new u(t,e,n,r))}}var u=function(){function t(t,e,n,r){this.keySelector=t,this.elementSelector=e,this.durationSelector=n,this.subjectSelector=r}return t.prototype.call=function(t,e){return e.subscribe(new h(t,this.keySelector,this.elementSelector,this.durationSelector,this.subjectSelector))},t}(),h=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;return s.keySelector=n,s.elementSelector=r,s.durationSelector=i,s.subjectSelector=o,s.groups=null,s.attemptedToUnsubscribe=!1,s.count=0,s}return r.a(e,t),e.prototype._next=function(t){var e;try{e=this.keySelector(t)}catch(t){return void this.error(t)}this._group(t,e)},e.prototype._group=function(t,e){var n=this.groups;n||(n=this.groups=new Map);var r,i=n.get(e);if(this.elementSelector)try{r=this.elementSelector(t)}catch(t){this.error(t)}else r=t;if(!i){i=this.subjectSelector?this.subjectSelector():new a.a,n.set(e,i);var o=new f(e,i,this);if(this.destination.next(o),this.durationSelector){var s=void 0;try{s=this.durationSelector(new f(e,i))}catch(t){return void this.error(t)}this.add(s.subscribe(new l(e,i,this)))}}i.closed||i.next(r)},e.prototype._error=function(t){var e=this.groups;e&&(e.forEach((function(e,n){e.error(t)})),e.clear()),this.destination.error(t)},e.prototype._complete=function(){var t=this.groups;t&&(t.forEach((function(t,e){t.complete()})),t.clear()),this.destination.complete()},e.prototype.removeGroup=function(t){this.groups.delete(t)},e.prototype.unsubscribe=function(){this.closed||(this.attemptedToUnsubscribe=!0,0===this.count&&t.prototype.unsubscribe.call(this))},e}(i.a),l=function(t){function e(e,n,r){var i=t.call(this,n)||this;return i.key=e,i.group=n,i.parent=r,i}return r.a(e,t),e.prototype._next=function(t){this.complete()},e.prototype._unsubscribe=function(){var t=this.parent,e=this.key;this.key=this.parent=null,t&&t.removeGroup(e)},e}(i.a),f=function(t){function e(e,n,r){var i=t.call(this)||this;return i.key=e,i.groupSubject=n,i.refCountSubscription=r,i}return r.a(e,t),e.prototype._subscribe=function(t){var e=new o.a,n=this.refCountSubscription,r=this.groupSubject;return n&&!n.closed&&e.add(new d(n)),e.add(r.subscribe(t)),e},e}(s.a),d=function(t){function e(e){var n=t.call(this)||this;return n.parent=e,e.count++,n}return r.a(e,t),e.prototype.unsubscribe=function(){var e=this.parent;e.closed||this.closed||(t.prototype.unsubscribe.call(this),e.count-=1,0===e.count&&e.attemptedToUnsubscribe&&e.unsubscribe())},e}(o.a)},function(t,e,n){"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),e.DigitalHumanUnmuted=e.DigitalHumanPlayedInMutedModeSuccess=e.DigitalHumanFailedToPlay=e.DigitalHumanVideoError=e.ClientPerformanceMessage=e.ClientMediaStreamUpdateMessage=e.OnlineStatusUpdateMessage=e.SessionInfoMessage=e.AvatarRequestIgnored=e.AvatarRequestCompleted=e.SessionErrorMessage=e.WebRtcStatsMessage=e.WebRtcDataMessage=e.SessionLiveMessage=e.WarningMessage=e.RecordingStoppedMessage=e.RecordingStartedMessage=e.DevicePermissionAllowedMessage=e.AvatarTextInputFinishedMessage=e.FinishedSpeakingMessage=e.StartedSpeakingMessage=e.AvatarQuestionMessage=e.InstructionsMessage=e.AvatarAnswerContentMessage=e.AvatarAnswerMessage=e.ResumeSessionUnavailable=e.ConnectionLostMessage=e.VoiceActivityInputModeNotSupportedMessage=e.MicActivityNotSupportedMessage=e.MicActivityMessage=e.MicActivityErrorMessage=e.ServiceUnavailableMessage=e.AvatarUnavailableMessage=e.AvatarAvailableMessage=e.SessionEndedMessage=e.SessionResumedMessage=e.SessionPausedMessage=e.DeviceListUpdatedMessage=e.DeviceErrorMessage=e.SetSpeakerSuccessMessage=e.SetMicSuccessMessage=e.SetCameraSuccessMessage=e.DeviceNotFoundErrorMessage=e.ReadyMessage=e.UneeqMessageType=void 0,function(t){t.Ready="Ready",t.DeviceNotFoundError="DeviceNotFoundError",t.SetCameraSuccess="SetCameraSuccess",t.SetMicSuccess="SetMicSuccess",t.SetSpeakerSuccess="SetSpeakerSuccess",t.SessionPaused="SessionPaused",t.SessionResumed="SessionResumed",t.SessionEnded="SessionEnded",t.AvatarAvailable="AvatarAvailable",t.AvatarUnavailable="AvatarUnavailable",t.ConnectionLost="ConnectionLost",t.ResumeSessionUnavailable="ResumeSessionUnavailable",t.ServiceUnavailable="ServiceUnavailable",t.OnlineStatusUpdate="OnlineStatusUpdate",t.MicActivityNotSupported="MicActivityNotSupported",t.VoiceActivityInputModeNotSupported="VoiceActivityInputModeNotSupported",t.MicActivityError="MicActivityError",t.MicActivity="MicActivity",t.DeviceError="DeviceError",t.DeviceListUpdated="DeviceListUpdated",t.AvatarAnswer="AvatarAnswer",t.AvatarAnswerContent="AvatarAnswerContent",t.Instructions="Instructions",t.StartedSpeaking="StartedSpeaking",t.FinishedSpeaking="FinishedSpeaking",t.AvatarTextInputFinished="AvatarTextInputFinished",t.AvatarQuestionText="AvatarQuestionText",t.DevicePermissionAllowed="DevicePermissionAllowed",t.RecordingStarted="RecordingStarted",t.RecordingStopped="RecordingStopped",t.Warning="Warning",t.SessionLive="SessionLive",t.WebRtcData="WebRtcData",t.WebRtcStats="WebRtcStats",t.SessionError="SessionError",t.SessionInfo="SessionInfo",t.AvatarRequestCompleted="AvatarRequestCompleted",t.AvatarRequestIgnored="AvatarRequestIgnored",t.ClientMediaStreamUpdate="ClientMediaStreamUpdate",t.ClientPerformanceMessage="ClientPerformanceMessage",t.DigitalHumanVideoError="DigitalHumanVideoError",t.DigitalHumanFailedToPlay="DigitalHumanFailedToPlay",t.DigitalHumanPlayedInMutedModeSuccess="DigitalHumanPlayedInMutedModeSuccess",t.DigitalHumanUnmuted="DigitalHumanUnmuted"}(r=e.UneeqMessageType||(e.UneeqMessageType={}));e.ReadyMessage=class{constructor(){this.uneeqMessageType=r.Ready}};e.DeviceNotFoundErrorMessage=class{constructor(t,e){this.msg=t,this.deviceId=e,this.uneeqMessageType=r.DeviceNotFoundError}};e.SetCameraSuccessMessage=class{constructor(t){this.deviceId=t,this.uneeqMessageType=r.SetCameraSuccess}};e.SetMicSuccessMessage=class{constructor(t){this.deviceId=t,this.uneeqMessageType=r.SetMicSuccess}};e.SetSpeakerSuccessMessage=class{constructor(t){this.deviceId=t,this.uneeqMessageType=r.SetSpeakerSuccess}};e.DeviceErrorMessage=class{constructor(t){this.error=t,this.uneeqMessageType=r.DeviceError}};e.DeviceListUpdatedMessage=class{constructor(t){this.devices=t,this.uneeqMessageType=r.DeviceListUpdated}};e.SessionPausedMessage=class{constructor(){this.uneeqMessageType=r.SessionPaused}};e.SessionResumedMessage=class{constructor(){this.uneeqMessageType=r.SessionResumed}};e.SessionEndedMessage=class{constructor(){this.uneeqMessageType=r.SessionEnded}};e.AvatarAvailableMessage=class{constructor(){this.uneeqMessageType=r.AvatarAvailable}};e.AvatarUnavailableMessage=class{constructor(){this.uneeqMessageType=r.AvatarUnavailable}};e.ServiceUnavailableMessage=class{constructor(t){this.error=t,this.uneeqMessageType=r.ServiceUnavailable}};e.MicActivityErrorMessage=class{constructor(t){this.error=t,this.uneeqMessageType=r.MicActivityError}};e.MicActivityMessage=class{constructor(t){this.level=t,this.uneeqMessageType=r.MicActivity}};e.MicActivityNotSupportedMessage=class{constructor(){this.uneeqMessageType=r.MicActivityNotSupported}};e.VoiceActivityInputModeNotSupportedMessage=class{constructor(){this.uneeqMessageType=r.VoiceActivityInputModeNotSupported}};e.ConnectionLostMessage=class{constructor(t){this.connectionState=t,this.uneeqMessageType=r.ConnectionLost}};e.ResumeSessionUnavailable=class{constructor(){this.uneeqMessageType=r.ResumeSessionUnavailable}};e.AvatarAnswerMessage=class{constructor(t,e,n,i){this.answer=t,this.answerAvatar=e,this.answerSpeech=n,this.transcriptId=i,this.uneeqMessageType=r.AvatarAnswer}};e.AvatarAnswerContentMessage=class{constructor(t,e,n=!1){this.content=t,this.transcriptId=e,this.hasDisplayHtml=n,this.uneeqMessageType=r.AvatarAnswerContent}};e.InstructionsMessage=class{constructor(t){this.instructions=t,this.uneeqMessageType=r.Instructions}};e.AvatarQuestionMessage=class{constructor(t,e){this.question=t,this.transcriptId=e,this.uneeqMessageType=r.AvatarQuestionText}};e.StartedSpeakingMessage=class{constructor(){this.uneeqMessageType=r.StartedSpeaking}};e.FinishedSpeakingMessage=class{constructor(){this.uneeqMessageType=r.FinishedSpeaking}};e.AvatarTextInputFinishedMessage=class{constructor(){this.uneeqMessageType=r.AvatarTextInputFinished}};e.DevicePermissionAllowedMessage=class{constructor(){this.uneeqMessageType=r.DevicePermissionAllowed}};e.RecordingStartedMessage=class{constructor(){this.uneeqMessageType=r.RecordingStarted}};e.RecordingStoppedMessage=class{constructor(){this.uneeqMessageType=r.RecordingStopped}};e.WarningMessage=class{constructor(t){this.msg=t,this.uneeqMessageType=r.Warning}};e.SessionLiveMessage=class{constructor(t,e){this.showLogo=t,this.sessionResumed=e,this.uneeqMessageType=r.SessionLive}};e.WebRtcDataMessage=class{constructor(t){this.data=t,this.uneeqMessageType=r.WebRtcData}};e.WebRtcStatsMessage=class{constructor(t){this.stats=t,this.uneeqMessageType=r.WebRtcStats}};e.SessionErrorMessage=class{constructor(t){this.error=t,this.uneeqMessageType=r.SessionError}};e.AvatarRequestCompleted=class{constructor(t){this.reason=t,this.uneeqMessageType=r.AvatarRequestCompleted}};e.AvatarRequestIgnored=class{constructor(t){this.reason=t,this.uneeqMessageType=r.AvatarRequestIgnored}};e.SessionInfoMessage=class{constructor(t){this.info=t,this.uneeqMessageType=r.SessionInfo}};e.OnlineStatusUpdateMessage=class{constructor(t){this.online=t,this.uneeqMessageType=r.OnlineStatusUpdate}};e.ClientMediaStreamUpdateMessage=class{constructor(t,e,n,i){this.clientStreamingAudio=t,this.clientStreamingVideo=e,this.serverStreamingAudio=n,this.serverStreamingVideo=i,this.uneeqMessageType=r.ClientMediaStreamUpdate}};e.ClientPerformanceMessage=class{constructor(t){this.clientPerformance=t,this.uneeqMessageType=r.ClientPerformanceMessage}};e.DigitalHumanVideoError=class{constructor(t){this.error=t,this.uneeqMessageType=r.DigitalHumanVideoError}};e.DigitalHumanFailedToPlay=class{constructor(){this.uneeqMessageType=r.DigitalHumanFailedToPlay,this.msg="Digital Human failed to play with sound. This most likely occurred because the user has not yet interacted with the page and was blocked due to the browser's autoplay policy. Video will automatically be muted and attempted to be played again."}};e.DigitalHumanPlayedInMutedModeSuccess=class{constructor(){this.uneeqMessageType=r.DigitalHumanPlayedInMutedModeSuccess,this.msg="Digital Human was successfully played in muted mode. After the user interacts with the page you will need to call unmuteDigitalHuman() to unmute the video."}};e.DigitalHumanUnmuted=class{constructor(){this.uneeqMessageType=r.DigitalHumanUnmuted}}},function(t,e,n){(function(t,r){var i;
24
24
  /**
25
25
  * @license
26
26
  * Lodash <https://lodash.com/>
@@ -28,11 +28,11 @@ var r=n(101),i=n(102),o=n(103);function s(){return c.TYPED_ARRAY_SUPPORT?2147483
28
28
  * Released under MIT license <https://lodash.com/license>
29
29
  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
30
30
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
31
- */(function(){var o="Expected a function",s="__lodash_placeholder__",a=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],c="[object Arguments]",u="[object Array]",h="[object Boolean]",l="[object Date]",f="[object Error]",d="[object Function]",p="[object GeneratorFunction]",v="[object Map]",g="[object Number]",m="[object Object]",y="[object RegExp]",b="[object Set]",_="[object String]",w="[object Symbol]",S="[object WeakMap]",x="[object ArrayBuffer]",T="[object DataView]",C="[object Float32Array]",E="[object Float64Array]",R="[object Int8Array]",M="[object Int16Array]",O="[object Int32Array]",A="[object Uint8Array]",P="[object Uint16Array]",k="[object Uint32Array]",I=/\b__p \+= '';/g,D=/\b(__p \+=) '' \+/g,N=/(__e\(.*?\)|\b__t\)) \+\n'';/g,j=/&(?:amp|lt|gt|quot|#39);/g,L=/[&<>"']/g,U=RegExp(j.source),F=RegExp(L.source),B=/<%-([\s\S]+?)%>/g,V=/<%([\s\S]+?)%>/g,W=/<%=([\s\S]+?)%>/g,q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,H=/^\w*$/,z=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,G=/[\\^$.*+?()[\]{}|]/g,Y=RegExp(G.source),$=/^\s+/,X=/\s/,K=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,J=/\{\n\/\* \[wrapped with (.+)\] \*/,Z=/,? & /,Q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,tt=/[()=,{}\[\]\/\s]/,et=/\\(\\)?/g,nt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,rt=/\w*$/,it=/^[-+]0x[0-9a-f]+$/i,ot=/^0b[01]+$/i,st=/^\[object .+?Constructor\]$/,at=/^0o[0-7]+$/i,ct=/^(?:0|[1-9]\d*)$/,ut=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ht=/($^)/,lt=/['\n\r\u2028\u2029\\]/g,ft="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",dt="\\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",pt="[\\ud800-\\udfff]",vt="["+dt+"]",gt="["+ft+"]",mt="\\d+",yt="[\\u2700-\\u27bf]",bt="[a-z\\xdf-\\xf6\\xf8-\\xff]",_t="[^\\ud800-\\udfff"+dt+mt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",wt="\\ud83c[\\udffb-\\udfff]",St="[^\\ud800-\\udfff]",xt="(?:\\ud83c[\\udde6-\\uddff]){2}",Tt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ct="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Et="(?:"+bt+"|"+_t+")",Rt="(?:"+Ct+"|"+_t+")",Mt="(?:"+gt+"|"+wt+")"+"?",Ot="[\\ufe0e\\ufe0f]?"+Mt+("(?:\\u200d(?:"+[St,xt,Tt].join("|")+")[\\ufe0e\\ufe0f]?"+Mt+")*"),At="(?:"+[yt,xt,Tt].join("|")+")"+Ot,Pt="(?:"+[St+gt+"?",gt,xt,Tt,pt].join("|")+")",kt=RegExp("['’]","g"),It=RegExp(gt,"g"),Dt=RegExp(wt+"(?="+wt+")|"+Pt+Ot,"g"),Nt=RegExp([Ct+"?"+bt+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[vt,Ct,"$"].join("|")+")",Rt+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[vt,Ct+Et,"$"].join("|")+")",Ct+"?"+Et+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Ct+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",mt,At].join("|"),"g"),jt=RegExp("[\\u200d\\ud800-\\udfff"+ft+"\\ufe0e\\ufe0f]"),Lt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ut=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ft=-1,Bt={};Bt[C]=Bt[E]=Bt[R]=Bt[M]=Bt[O]=Bt[A]=Bt["[object Uint8ClampedArray]"]=Bt[P]=Bt[k]=!0,Bt[c]=Bt[u]=Bt[x]=Bt[h]=Bt[T]=Bt[l]=Bt[f]=Bt[d]=Bt[v]=Bt[g]=Bt[m]=Bt[y]=Bt[b]=Bt[_]=Bt[S]=!1;var Vt={};Vt[c]=Vt[u]=Vt[x]=Vt[T]=Vt[h]=Vt[l]=Vt[C]=Vt[E]=Vt[R]=Vt[M]=Vt[O]=Vt[v]=Vt[g]=Vt[m]=Vt[y]=Vt[b]=Vt[_]=Vt[w]=Vt[A]=Vt["[object Uint8ClampedArray]"]=Vt[P]=Vt[k]=!0,Vt[f]=Vt[d]=Vt[S]=!1;var Wt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},qt=parseFloat,Ht=parseInt,zt="object"==typeof t&&t&&t.Object===Object&&t,Gt="object"==typeof self&&self&&self.Object===Object&&self,Yt=zt||Gt||Function("return this")(),$t=e&&!e.nodeType&&e,Xt=$t&&"object"==typeof r&&r&&!r.nodeType&&r,Kt=Xt&&Xt.exports===$t,Jt=Kt&&zt.process,Zt=function(){try{var t=Xt&&Xt.require&&Xt.require("util").types;return t||Jt&&Jt.binding&&Jt.binding("util")}catch(t){}}(),Qt=Zt&&Zt.isArrayBuffer,te=Zt&&Zt.isDate,ee=Zt&&Zt.isMap,ne=Zt&&Zt.isRegExp,re=Zt&&Zt.isSet,ie=Zt&&Zt.isTypedArray;function oe(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function se(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var s=t[i];e(r,s,n(s),t)}return r}function ae(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function ce(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function ue(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function he(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var s=t[n];e(s,n,t)&&(o[i++]=s)}return o}function le(t,e){return!!(null==t?0:t.length)&&we(t,e,0)>-1}function fe(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function de(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function pe(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function ve(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function ge(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function me(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var ye=Ce("length");function be(t,e,n){var r;return n(t,(function(t,n,i){if(e(t,n,i))return r=n,!1})),r}function _e(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function we(t,e,n){return e==e?function(t,e,n){var r=n-1,i=t.length;for(;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):_e(t,xe,n)}function Se(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}function xe(t){return t!=t}function Te(t,e){var n=null==t?0:t.length;return n?Me(t,e)/n:NaN}function Ce(t){return function(e){return null==e?void 0:e[t]}}function Ee(t){return function(e){return null==t?void 0:t[e]}}function Re(t,e,n,r,i){return i(t,(function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)})),n}function Me(t,e){for(var n,r=-1,i=t.length;++r<i;){var o=e(t[r]);void 0!==o&&(n=void 0===n?o:n+o)}return n}function Oe(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Ae(t){return t?t.slice(0,$e(t)+1).replace($,""):t}function Pe(t){return function(e){return t(e)}}function ke(t,e){return de(e,(function(e){return t[e]}))}function Ie(t,e){return t.has(e)}function De(t,e){for(var n=-1,r=t.length;++n<r&&we(e,t[n],0)>-1;);return n}function Ne(t,e){for(var n=t.length;n--&&we(e,t[n],0)>-1;);return n}function je(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}var Le=Ee({"À":"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"}),Ue=Ee({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Fe(t){return"\\"+Wt[t]}function Be(t){return jt.test(t)}function Ve(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function We(t,e){return function(n){return t(e(n))}}function qe(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var a=t[n];a!==e&&a!==s||(t[n]=s,o[i++]=n)}return o}function He(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}function ze(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}function Ge(t){return Be(t)?function(t){var e=Dt.lastIndex=0;for(;Dt.test(t);)++e;return e}(t):ye(t)}function Ye(t){return Be(t)?function(t){return t.match(Dt)||[]}(t):function(t){return t.split("")}(t)}function $e(t){for(var e=t.length;e--&&X.test(t.charAt(e)););return e}var Xe=Ee({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var Ke=function t(e){var n,r=(e=null==e?Yt:Ke.defaults(Yt.Object(),e,Ke.pick(Yt,Ut))).Array,i=e.Date,X=e.Error,ft=e.Function,dt=e.Math,pt=e.Object,vt=e.RegExp,gt=e.String,mt=e.TypeError,yt=r.prototype,bt=ft.prototype,_t=pt.prototype,wt=e["__core-js_shared__"],St=bt.toString,xt=_t.hasOwnProperty,Tt=0,Ct=(n=/[^.]+$/.exec(wt&&wt.keys&&wt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Et=_t.toString,Rt=St.call(pt),Mt=Yt._,Ot=vt("^"+St.call(xt).replace(G,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),At=Kt?e.Buffer:void 0,Pt=e.Symbol,Dt=e.Uint8Array,jt=At?At.allocUnsafe:void 0,Wt=We(pt.getPrototypeOf,pt),zt=pt.create,Gt=_t.propertyIsEnumerable,$t=yt.splice,Xt=Pt?Pt.isConcatSpreadable:void 0,Jt=Pt?Pt.iterator:void 0,Zt=Pt?Pt.toStringTag:void 0,ye=function(){try{var t=to(pt,"defineProperty");return t({},"",{}),t}catch(t){}}(),Ee=e.clearTimeout!==Yt.clearTimeout&&e.clearTimeout,Je=i&&i.now!==Yt.Date.now&&i.now,Ze=e.setTimeout!==Yt.setTimeout&&e.setTimeout,Qe=dt.ceil,tn=dt.floor,en=pt.getOwnPropertySymbols,nn=At?At.isBuffer:void 0,rn=e.isFinite,on=yt.join,sn=We(pt.keys,pt),an=dt.max,cn=dt.min,un=i.now,hn=e.parseInt,ln=dt.random,fn=yt.reverse,dn=to(e,"DataView"),pn=to(e,"Map"),vn=to(e,"Promise"),gn=to(e,"Set"),mn=to(e,"WeakMap"),yn=to(pt,"create"),bn=mn&&new mn,_n={},wn=Mo(dn),Sn=Mo(pn),xn=Mo(vn),Tn=Mo(gn),Cn=Mo(mn),En=Pt?Pt.prototype:void 0,Rn=En?En.valueOf:void 0,Mn=En?En.toString:void 0;function On(t){if(zs(t)&&!Ds(t)&&!(t instanceof In)){if(t instanceof kn)return t;if(xt.call(t,"__wrapped__"))return Oo(t)}return new kn(t)}var An=function(){function t(){}return function(e){if(!Hs(e))return{};if(zt)return zt(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function Pn(){}function kn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}function In(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Dn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Nn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function jn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Ln(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new jn;++e<n;)this.add(t[e])}function Un(t){var e=this.__data__=new Nn(t);this.size=e.size}function Fn(t,e){var n=Ds(t),r=!n&&Is(t),i=!n&&!r&&Us(t),o=!n&&!r&&!i&&Qs(t),s=n||r||i||o,a=s?Oe(t.length,gt):[],c=a.length;for(var u in t)!e&&!xt.call(t,u)||s&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ao(u,c))||a.push(u);return a}function Bn(t){var e=t.length;return e?t[Lr(0,e-1)]:void 0}function Vn(t,e){return Co(yi(t),Kn(e,0,t.length))}function Wn(t){return Co(yi(t))}function qn(t,e,n){(void 0!==n&&!As(t[e],n)||void 0===n&&!(e in t))&&$n(t,e,n)}function Hn(t,e,n){var r=t[e];xt.call(t,e)&&As(r,n)&&(void 0!==n||e in t)||$n(t,e,n)}function zn(t,e){for(var n=t.length;n--;)if(As(t[n][0],e))return n;return-1}function Gn(t,e,n,r){return er(t,(function(t,i,o){e(r,t,n(t),o)})),r}function Yn(t,e){return t&&bi(e,wa(e),t)}function $n(t,e,n){"__proto__"==e&&ye?ye(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Xn(t,e){for(var n=-1,i=e.length,o=r(i),s=null==t;++n<i;)o[n]=s?void 0:ga(t,e[n]);return o}function Kn(t,e,n){return t==t&&(void 0!==n&&(t=t<=n?t:n),void 0!==e&&(t=t>=e?t:e)),t}function Jn(t,e,n,r,i,o){var s,a=1&e,u=2&e,f=4&e;if(n&&(s=i?n(t,r,i,o):n(t)),void 0!==s)return s;if(!Hs(t))return t;var S=Ds(t);if(S){if(s=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&xt.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!a)return yi(t,s)}else{var I=ro(t),D=I==d||I==p;if(Us(t))return fi(t,a);if(I==m||I==c||D&&!i){if(s=u||D?{}:oo(t),!a)return u?function(t,e){return bi(t,no(t),e)}(t,function(t,e){return t&&bi(e,Sa(e),t)}(s,t)):function(t,e){return bi(t,eo(t),e)}(t,Yn(s,t))}else{if(!Vt[I])return i?t:{};s=function(t,e,n){var r=t.constructor;switch(e){case x:return di(t);case h:case l:return new r(+t);case T:return function(t,e){var n=e?di(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case C:case E:case R:case M:case O:case A:case"[object Uint8ClampedArray]":case P:case k:return pi(t,n);case v:return new r;case g:case _:return new r(t);case y:return function(t){var e=new t.constructor(t.source,rt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case b:return new r;case w:return i=t,Rn?pt(Rn.call(i)):{}}var i}(t,I,a)}}o||(o=new Un);var N=o.get(t);if(N)return N;o.set(t,s),Ks(t)?t.forEach((function(r){s.add(Jn(r,e,n,r,t,o))})):Gs(t)&&t.forEach((function(r,i){s.set(i,Jn(r,e,n,i,t,o))}));var j=S?void 0:(f?u?Yi:Gi:u?Sa:wa)(t);return ae(j||t,(function(r,i){j&&(r=t[i=r]),Hn(s,i,Jn(r,e,n,i,t,o))})),s}function Zn(t,e,n){var r=n.length;if(null==t)return!r;for(t=pt(t);r--;){var i=n[r],o=e[i],s=t[i];if(void 0===s&&!(i in t)||!o(s))return!1}return!0}function Qn(t,e,n){if("function"!=typeof t)throw new mt(o);return wo((function(){t.apply(void 0,n)}),e)}function tr(t,e,n,r){var i=-1,o=le,s=!0,a=t.length,c=[],u=e.length;if(!a)return c;n&&(e=de(e,Pe(n))),r?(o=fe,s=!1):e.length>=200&&(o=Ie,s=!1,e=new Ln(e));t:for(;++i<a;){var h=t[i],l=null==n?h:n(h);if(h=r||0!==h?h:0,s&&l==l){for(var f=u;f--;)if(e[f]===l)continue t;c.push(h)}else o(e,l,r)||c.push(h)}return c}On.templateSettings={escape:B,evaluate:V,interpolate:W,variable:"",imports:{_:On}},On.prototype=Pn.prototype,On.prototype.constructor=On,kn.prototype=An(Pn.prototype),kn.prototype.constructor=kn,In.prototype=An(Pn.prototype),In.prototype.constructor=In,Dn.prototype.clear=function(){this.__data__=yn?yn(null):{},this.size=0},Dn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Dn.prototype.get=function(t){var e=this.__data__;if(yn){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return xt.call(e,t)?e[t]:void 0},Dn.prototype.has=function(t){var e=this.__data__;return yn?void 0!==e[t]:xt.call(e,t)},Dn.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=yn&&void 0===e?"__lodash_hash_undefined__":e,this},Nn.prototype.clear=function(){this.__data__=[],this.size=0},Nn.prototype.delete=function(t){var e=this.__data__,n=zn(e,t);return!(n<0)&&(n==e.length-1?e.pop():$t.call(e,n,1),--this.size,!0)},Nn.prototype.get=function(t){var e=this.__data__,n=zn(e,t);return n<0?void 0:e[n][1]},Nn.prototype.has=function(t){return zn(this.__data__,t)>-1},Nn.prototype.set=function(t,e){var n=this.__data__,r=zn(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},jn.prototype.clear=function(){this.size=0,this.__data__={hash:new Dn,map:new(pn||Nn),string:new Dn}},jn.prototype.delete=function(t){var e=Zi(this,t).delete(t);return this.size-=e?1:0,e},jn.prototype.get=function(t){return Zi(this,t).get(t)},jn.prototype.has=function(t){return Zi(this,t).has(t)},jn.prototype.set=function(t,e){var n=Zi(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Ln.prototype.add=Ln.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Ln.prototype.has=function(t){return this.__data__.has(t)},Un.prototype.clear=function(){this.__data__=new Nn,this.size=0},Un.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Un.prototype.get=function(t){return this.__data__.get(t)},Un.prototype.has=function(t){return this.__data__.has(t)},Un.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Nn){var r=n.__data__;if(!pn||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new jn(r)}return n.set(t,e),this.size=n.size,this};var er=Si(ur),nr=Si(hr,!0);function rr(t,e){var n=!0;return er(t,(function(t,r,i){return n=!!e(t,r,i)})),n}function ir(t,e,n){for(var r=-1,i=t.length;++r<i;){var o=t[r],s=e(o);if(null!=s&&(void 0===a?s==s&&!Zs(s):n(s,a)))var a=s,c=o}return c}function or(t,e){var n=[];return er(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n}function sr(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=so),i||(i=[]);++o<s;){var a=t[o];e>0&&n(a)?e>1?sr(a,e-1,n,r,i):pe(i,a):r||(i[i.length]=a)}return i}var ar=xi(),cr=xi(!0);function ur(t,e){return t&&ar(t,e,wa)}function hr(t,e){return t&&cr(t,e,wa)}function lr(t,e){return he(e,(function(e){return Vs(t[e])}))}function fr(t,e){for(var n=0,r=(e=ci(e,t)).length;null!=t&&n<r;)t=t[Ro(e[n++])];return n&&n==r?t:void 0}function dr(t,e,n){var r=e(t);return Ds(t)?r:pe(r,n(t))}function pr(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Zt&&Zt in pt(t)?function(t){var e=xt.call(t,Zt),n=t[Zt];try{t[Zt]=void 0;var r=!0}catch(t){}var i=Et.call(t);r&&(e?t[Zt]=n:delete t[Zt]);return i}(t):function(t){return Et.call(t)}(t)}function vr(t,e){return t>e}function gr(t,e){return null!=t&&xt.call(t,e)}function mr(t,e){return null!=t&&e in pt(t)}function yr(t,e,n){for(var i=n?fe:le,o=t[0].length,s=t.length,a=s,c=r(s),u=1/0,h=[];a--;){var l=t[a];a&&e&&(l=de(l,Pe(e))),u=cn(l.length,u),c[a]=!n&&(e||o>=120&&l.length>=120)?new Ln(a&&l):void 0}l=t[0];var f=-1,d=c[0];t:for(;++f<o&&h.length<u;){var p=l[f],v=e?e(p):p;if(p=n||0!==p?p:0,!(d?Ie(d,v):i(h,v,n))){for(a=s;--a;){var g=c[a];if(!(g?Ie(g,v):i(t[a],v,n)))continue t}d&&d.push(v),h.push(p)}}return h}function br(t,e,n){var r=null==(t=mo(t,e=ci(e,t)))?t:t[Ro(Bo(e))];return null==r?void 0:oe(r,t,n)}function _r(t){return zs(t)&&pr(t)==c}function wr(t,e,n,r,i){return t===e||(null==t||null==e||!zs(t)&&!zs(e)?t!=t&&e!=e:function(t,e,n,r,i,o){var s=Ds(t),a=Ds(e),d=s?u:ro(t),p=a?u:ro(e),S=(d=d==c?m:d)==m,C=(p=p==c?m:p)==m,E=d==p;if(E&&Us(t)){if(!Us(e))return!1;s=!0,S=!1}if(E&&!S)return o||(o=new Un),s||Qs(t)?Hi(t,e,n,r,i,o):function(t,e,n,r,i,o,s){switch(n){case T:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case x:return!(t.byteLength!=e.byteLength||!o(new Dt(t),new Dt(e)));case h:case l:case g:return As(+t,+e);case f:return t.name==e.name&&t.message==e.message;case y:case _:return t==e+"";case v:var a=Ve;case b:var c=1&r;if(a||(a=He),t.size!=e.size&&!c)return!1;var u=s.get(t);if(u)return u==e;r|=2,s.set(t,e);var d=Hi(a(t),a(e),r,i,o,s);return s.delete(t),d;case w:if(Rn)return Rn.call(t)==Rn.call(e)}return!1}(t,e,d,n,r,i,o);if(!(1&n)){var R=S&&xt.call(t,"__wrapped__"),M=C&&xt.call(e,"__wrapped__");if(R||M){var O=R?t.value():t,A=M?e.value():e;return o||(o=new Un),i(O,A,n,r,o)}}if(!E)return!1;return o||(o=new Un),function(t,e,n,r,i,o){var s=1&n,a=Gi(t),c=a.length,u=Gi(e).length;if(c!=u&&!s)return!1;var h=c;for(;h--;){var l=a[h];if(!(s?l in e:xt.call(e,l)))return!1}var f=o.get(t),d=o.get(e);if(f&&d)return f==e&&d==t;var p=!0;o.set(t,e),o.set(e,t);var v=s;for(;++h<c;){l=a[h];var g=t[l],m=e[l];if(r)var y=s?r(m,g,l,e,t,o):r(g,m,l,t,e,o);if(!(void 0===y?g===m||i(g,m,n,r,o):y)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){var b=t.constructor,_=e.constructor;b==_||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _||(p=!1)}return o.delete(t),o.delete(e),p}(t,e,n,r,i,o)}(t,e,n,r,wr,i))}function Sr(t,e,n,r){var i=n.length,o=i,s=!r;if(null==t)return!o;for(t=pt(t);i--;){var a=n[i];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<o;){var c=(a=n[i])[0],u=t[c],h=a[1];if(s&&a[2]){if(void 0===u&&!(c in t))return!1}else{var l=new Un;if(r)var f=r(u,h,c,t,e,l);if(!(void 0===f?wr(h,u,3,r,l):f))return!1}}return!0}function xr(t){return!(!Hs(t)||(e=t,Ct&&Ct in e))&&(Vs(t)?Ot:st).test(Mo(t));var e}function Tr(t){return"function"==typeof t?t:null==t?Ya:"object"==typeof t?Ds(t)?Ar(t[0],t[1]):Or(t):nc(t)}function Cr(t){if(!fo(t))return sn(t);var e=[];for(var n in pt(t))xt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Er(t){if(!Hs(t))return function(t){var e=[];if(null!=t)for(var n in pt(t))e.push(n);return e}(t);var e=fo(t),n=[];for(var r in t)("constructor"!=r||!e&&xt.call(t,r))&&n.push(r);return n}function Rr(t,e){return t<e}function Mr(t,e){var n=-1,i=js(t)?r(t.length):[];return er(t,(function(t,r,o){i[++n]=e(t,r,o)})),i}function Or(t){var e=Qi(t);return 1==e.length&&e[0][2]?vo(e[0][0],e[0][1]):function(n){return n===t||Sr(n,t,e)}}function Ar(t,e){return uo(t)&&po(e)?vo(Ro(t),e):function(n){var r=ga(n,t);return void 0===r&&r===e?ma(n,t):wr(e,r,3)}}function Pr(t,e,n,r,i){t!==e&&ar(e,(function(o,s){if(i||(i=new Un),Hs(o))!function(t,e,n,r,i,o,s){var a=bo(t,n),c=bo(e,n),u=s.get(c);if(u)return void qn(t,n,u);var h=o?o(a,c,n+"",t,e,s):void 0,l=void 0===h;if(l){var f=Ds(c),d=!f&&Us(c),p=!f&&!d&&Qs(c);h=c,f||d||p?Ds(a)?h=a:Ls(a)?h=yi(a):d?(l=!1,h=fi(c,!0)):p?(l=!1,h=pi(c,!0)):h=[]:$s(c)||Is(c)?(h=a,Is(a)?h=aa(a):Hs(a)&&!Vs(a)||(h=oo(c))):l=!1}l&&(s.set(c,h),i(h,c,r,o,s),s.delete(c));qn(t,n,h)}(t,e,s,n,Pr,r,i);else{var a=r?r(bo(t,s),o,s+"",t,e,i):void 0;void 0===a&&(a=o),qn(t,s,a)}}),Sa)}function kr(t,e){var n=t.length;if(n)return ao(e+=e<0?n:0,n)?t[e]:void 0}function Ir(t,e,n){e=e.length?de(e,(function(t){return Ds(t)?function(e){return fr(e,1===t.length?t[0]:t)}:t})):[Ya];var r=-1;return e=de(e,Pe(Ji())),function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(Mr(t,(function(t,n,i){return{criteria:de(e,(function(e){return e(t)})),index:++r,value:t}})),(function(t,e){return function(t,e,n){var r=-1,i=t.criteria,o=e.criteria,s=i.length,a=n.length;for(;++r<s;){var c=vi(i[r],o[r]);if(c){if(r>=a)return c;var u=n[r];return c*("desc"==u?-1:1)}}return t.index-e.index}(t,e,n)}))}function Dr(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var s=e[r],a=fr(t,s);n(a,s)&&Wr(o,ci(s,t),a)}return o}function Nr(t,e,n,r){var i=r?Se:we,o=-1,s=e.length,a=t;for(t===e&&(e=yi(e)),n&&(a=de(t,Pe(n)));++o<s;)for(var c=0,u=e[o],h=n?n(u):u;(c=i(a,h,c,r))>-1;)a!==t&&$t.call(a,c,1),$t.call(t,c,1);return t}function jr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;ao(i)?$t.call(t,i,1):ti(t,i)}}return t}function Lr(t,e){return t+tn(ln()*(e-t+1))}function Ur(t,e){var n="";if(!t||e<1||e>9007199254740991)return n;do{e%2&&(n+=t),(e=tn(e/2))&&(t+=t)}while(e);return n}function Fr(t,e){return So(go(t,e,Ya),t+"")}function Br(t){return Bn(Aa(t))}function Vr(t,e){var n=Aa(t);return Co(n,Kn(e,0,n.length))}function Wr(t,e,n,r){if(!Hs(t))return t;for(var i=-1,o=(e=ci(e,t)).length,s=o-1,a=t;null!=a&&++i<o;){var c=Ro(e[i]),u=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(i!=s){var h=a[c];void 0===(u=r?r(h,c,a):void 0)&&(u=Hs(h)?h:ao(e[i+1])?[]:{})}Hn(a,c,u),a=a[c]}return t}var qr=bn?function(t,e){return bn.set(t,e),t}:Ya,Hr=ye?function(t,e){return ye(t,"toString",{configurable:!0,enumerable:!1,value:Ha(e),writable:!0})}:Ya;function zr(t){return Co(Aa(t))}function Gr(t,e,n){var i=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var s=r(o);++i<o;)s[i]=t[i+e];return s}function Yr(t,e){var n;return er(t,(function(t,r,i){return!(n=e(t,r,i))})),!!n}function $r(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var o=r+i>>>1,s=t[o];null!==s&&!Zs(s)&&(n?s<=e:s<e)?r=o+1:i=o}return i}return Xr(t,e,Ya,n)}function Xr(t,e,n,r){var i=0,o=null==t?0:t.length;if(0===o)return 0;for(var s=(e=n(e))!=e,a=null===e,c=Zs(e),u=void 0===e;i<o;){var h=tn((i+o)/2),l=n(t[h]),f=void 0!==l,d=null===l,p=l==l,v=Zs(l);if(s)var g=r||p;else g=u?p&&(r||f):a?p&&f&&(r||!d):c?p&&f&&!d&&(r||!v):!d&&!v&&(r?l<=e:l<e);g?i=h+1:o=h}return cn(o,4294967294)}function Kr(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n],a=e?e(s):s;if(!n||!As(a,c)){var c=a;o[i++]=0===s?0:s}}return o}function Jr(t){return"number"==typeof t?t:Zs(t)?NaN:+t}function Zr(t){if("string"==typeof t)return t;if(Ds(t))return de(t,Zr)+"";if(Zs(t))return Mn?Mn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Qr(t,e,n){var r=-1,i=le,o=t.length,s=!0,a=[],c=a;if(n)s=!1,i=fe;else if(o>=200){var u=e?null:Ui(t);if(u)return He(u);s=!1,i=Ie,c=new Ln}else c=e?[]:a;t:for(;++r<o;){var h=t[r],l=e?e(h):h;if(h=n||0!==h?h:0,s&&l==l){for(var f=c.length;f--;)if(c[f]===l)continue t;e&&c.push(l),a.push(h)}else i(c,l,n)||(c!==a&&c.push(l),a.push(h))}return a}function ti(t,e){return null==(t=mo(t,e=ci(e,t)))||delete t[Ro(Bo(e))]}function ei(t,e,n,r){return Wr(t,e,n(fr(t,e)),r)}function ni(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?Gr(t,r?0:o,r?o+1:i):Gr(t,r?o+1:0,r?i:o)}function ri(t,e){var n=t;return n instanceof In&&(n=n.value()),ve(e,(function(t,e){return e.func.apply(e.thisArg,pe([t],e.args))}),n)}function ii(t,e,n){var i=t.length;if(i<2)return i?Qr(t[0]):[];for(var o=-1,s=r(i);++o<i;)for(var a=t[o],c=-1;++c<i;)c!=o&&(s[o]=tr(s[o]||a,t[c],e,n));return Qr(sr(s,1),e,n)}function oi(t,e,n){for(var r=-1,i=t.length,o=e.length,s={};++r<i;){var a=r<o?e[r]:void 0;n(s,t[r],a)}return s}function si(t){return Ls(t)?t:[]}function ai(t){return"function"==typeof t?t:Ya}function ci(t,e){return Ds(t)?t:uo(t,e)?[t]:Eo(ca(t))}var ui=Fr;function hi(t,e,n){var r=t.length;return n=void 0===n?r:n,!e&&n>=r?t:Gr(t,e,n)}var li=Ee||function(t){return Yt.clearTimeout(t)};function fi(t,e){if(e)return t.slice();var n=t.length,r=jt?jt(n):new t.constructor(n);return t.copy(r),r}function di(t){var e=new t.constructor(t.byteLength);return new Dt(e).set(new Dt(t)),e}function pi(t,e){var n=e?di(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function vi(t,e){if(t!==e){var n=void 0!==t,r=null===t,i=t==t,o=Zs(t),s=void 0!==e,a=null===e,c=e==e,u=Zs(e);if(!a&&!u&&!o&&t>e||o&&s&&c&&!a&&!u||r&&s&&c||!n&&c||!i)return 1;if(!r&&!o&&!u&&t<e||u&&n&&i&&!r&&!o||a&&n&&i||!s&&i||!c)return-1}return 0}function gi(t,e,n,i){for(var o=-1,s=t.length,a=n.length,c=-1,u=e.length,h=an(s-a,0),l=r(u+h),f=!i;++c<u;)l[c]=e[c];for(;++o<a;)(f||o<s)&&(l[n[o]]=t[o]);for(;h--;)l[c++]=t[o++];return l}function mi(t,e,n,i){for(var o=-1,s=t.length,a=-1,c=n.length,u=-1,h=e.length,l=an(s-c,0),f=r(l+h),d=!i;++o<l;)f[o]=t[o];for(var p=o;++u<h;)f[p+u]=e[u];for(;++a<c;)(d||o<s)&&(f[p+n[a]]=t[o++]);return f}function yi(t,e){var n=-1,i=t.length;for(e||(e=r(i));++n<i;)e[n]=t[n];return e}function bi(t,e,n,r){var i=!n;n||(n={});for(var o=-1,s=e.length;++o<s;){var a=e[o],c=r?r(n[a],t[a],a,n,t):void 0;void 0===c&&(c=t[a]),i?$n(n,a,c):Hn(n,a,c)}return n}function _i(t,e){return function(n,r){var i=Ds(n)?se:Gn,o=e?e():{};return i(n,t,Ji(r,2),o)}}function wi(t){return Fr((function(e,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=t.length>3&&"function"==typeof o?(i--,o):void 0,s&&co(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),e=pt(e);++r<i;){var a=n[r];a&&t(e,a,r,o)}return e}))}function Si(t,e){return function(n,r){if(null==n)return n;if(!js(n))return t(n,r);for(var i=n.length,o=e?i:-1,s=pt(n);(e?o--:++o<i)&&!1!==r(s[o],o,s););return n}}function xi(t){return function(e,n,r){for(var i=-1,o=pt(e),s=r(e),a=s.length;a--;){var c=s[t?a:++i];if(!1===n(o[c],c,o))break}return e}}function Ti(t){return function(e){var n=Be(e=ca(e))?Ye(e):void 0,r=n?n[0]:e.charAt(0),i=n?hi(n,1).join(""):e.slice(1);return r[t]()+i}}function Ci(t){return function(e){return ve(Va(Ia(e).replace(kt,"")),t,"")}}function Ei(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=An(t.prototype),r=t.apply(n,e);return Hs(r)?r:n}}function Ri(t){return function(e,n,r){var i=pt(e);if(!js(e)){var o=Ji(n,3);e=wa(e),n=function(t){return o(i[t],t,i)}}var s=t(e,n,r);return s>-1?i[o?e[s]:s]:void 0}}function Mi(t){return zi((function(e){var n=e.length,r=n,i=kn.prototype.thru;for(t&&e.reverse();r--;){var s=e[r];if("function"!=typeof s)throw new mt(o);if(i&&!a&&"wrapper"==Xi(s))var a=new kn([],!0)}for(r=a?r:n;++r<n;){var c=Xi(s=e[r]),u="wrapper"==c?$i(s):void 0;a=u&&ho(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?a[Xi(u[0])].apply(a,u[3]):1==s.length&&ho(s)?a[c]():a.thru(s)}return function(){var t=arguments,r=t[0];if(a&&1==t.length&&Ds(r))return a.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}}))}function Oi(t,e,n,i,o,s,a,c,u,h){var l=128&e,f=1&e,d=2&e,p=24&e,v=512&e,g=d?void 0:Ei(t);return function m(){for(var y=arguments.length,b=r(y),_=y;_--;)b[_]=arguments[_];if(p)var w=Ki(m),S=je(b,w);if(i&&(b=gi(b,i,o,p)),s&&(b=mi(b,s,a,p)),y-=S,p&&y<h){var x=qe(b,w);return ji(t,e,Oi,m.placeholder,n,b,x,c,u,h-y)}var T=f?n:this,C=d?T[t]:t;return y=b.length,c?b=yo(b,c):v&&y>1&&b.reverse(),l&&u<y&&(b.length=u),this&&this!==Yt&&this instanceof m&&(C=g||Ei(C)),C.apply(T,b)}}function Ai(t,e){return function(n,r){return function(t,e,n,r){return ur(t,(function(t,i,o){e(r,n(t),i,o)})),r}(n,t,e(r),{})}}function Pi(t,e){return function(n,r){var i;if(void 0===n&&void 0===r)return e;if(void 0!==n&&(i=n),void 0!==r){if(void 0===i)return r;"string"==typeof n||"string"==typeof r?(n=Zr(n),r=Zr(r)):(n=Jr(n),r=Jr(r)),i=t(n,r)}return i}}function ki(t){return zi((function(e){return e=de(e,Pe(Ji())),Fr((function(n){var r=this;return t(e,(function(t){return oe(t,r,n)}))}))}))}function Ii(t,e){var n=(e=void 0===e?" ":Zr(e)).length;if(n<2)return n?Ur(e,t):e;var r=Ur(e,Qe(t/Ge(e)));return Be(e)?hi(Ye(r),0,t).join(""):r.slice(0,t)}function Di(t){return function(e,n,i){return i&&"number"!=typeof i&&co(e,n,i)&&(n=i=void 0),e=ra(e),void 0===n?(n=e,e=0):n=ra(n),function(t,e,n,i){for(var o=-1,s=an(Qe((e-t)/(n||1)),0),a=r(s);s--;)a[i?s:++o]=t,t+=n;return a}(e,n,i=void 0===i?e<n?1:-1:ra(i),t)}}function Ni(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=sa(e),n=sa(n)),t(e,n)}}function ji(t,e,n,r,i,o,s,a,c,u){var h=8&e;e|=h?32:64,4&(e&=~(h?64:32))||(e&=-4);var l=[t,e,i,h?o:void 0,h?s:void 0,h?void 0:o,h?void 0:s,a,c,u],f=n.apply(void 0,l);return ho(t)&&_o(f,l),f.placeholder=r,xo(f,t,e)}function Li(t){var e=dt[t];return function(t,n){if(t=sa(t),(n=null==n?0:cn(ia(n),292))&&rn(t)){var r=(ca(t)+"e").split("e");return+((r=(ca(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Ui=gn&&1/He(new gn([,-0]))[1]==1/0?function(t){return new gn(t)}:Za;function Fi(t){return function(e){var n=ro(e);return n==v?Ve(e):n==b?ze(e):function(t,e){return de(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Bi(t,e,n,i,a,c,u,h){var l=2&e;if(!l&&"function"!=typeof t)throw new mt(o);var f=i?i.length:0;if(f||(e&=-97,i=a=void 0),u=void 0===u?u:an(ia(u),0),h=void 0===h?h:ia(h),f-=a?a.length:0,64&e){var d=i,p=a;i=a=void 0}var v=l?void 0:$i(t),g=[t,e,n,i,a,d,p,c,u,h];if(v&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,a=128==r&&8==n||128==r&&256==n&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!o&&!a)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var c=e[3];if(c){var u=t[3];t[3]=u?gi(u,c,e[4]):c,t[4]=u?qe(t[3],s):e[4]}(c=e[5])&&(u=t[5],t[5]=u?mi(u,c,e[6]):c,t[6]=u?qe(t[5],s):e[6]);(c=e[7])&&(t[7]=c);128&r&&(t[8]=null==t[8]?e[8]:cn(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=i}(g,v),t=g[0],e=g[1],n=g[2],i=g[3],a=g[4],!(h=g[9]=void 0===g[9]?l?0:t.length:an(g[9]-f,0))&&24&e&&(e&=-25),e&&1!=e)m=8==e||16==e?function(t,e,n){var i=Ei(t);return function o(){for(var s=arguments.length,a=r(s),c=s,u=Ki(o);c--;)a[c]=arguments[c];var h=s<3&&a[0]!==u&&a[s-1]!==u?[]:qe(a,u);if((s-=h.length)<n)return ji(t,e,Oi,o.placeholder,void 0,a,h,void 0,void 0,n-s);var l=this&&this!==Yt&&this instanceof o?i:t;return oe(l,this,a)}}(t,e,h):32!=e&&33!=e||a.length?Oi.apply(void 0,g):function(t,e,n,i){var o=1&e,s=Ei(t);return function e(){for(var a=-1,c=arguments.length,u=-1,h=i.length,l=r(h+c),f=this&&this!==Yt&&this instanceof e?s:t;++u<h;)l[u]=i[u];for(;c--;)l[u++]=arguments[++a];return oe(f,o?n:this,l)}}(t,e,n,i);else var m=function(t,e,n){var r=1&e,i=Ei(t);return function e(){var o=this&&this!==Yt&&this instanceof e?i:t;return o.apply(r?n:this,arguments)}}(t,e,n);return xo((v?qr:_o)(m,g),t,e)}function Vi(t,e,n,r){return void 0===t||As(t,_t[n])&&!xt.call(r,n)?e:t}function Wi(t,e,n,r,i,o){return Hs(t)&&Hs(e)&&(o.set(e,t),Pr(t,e,void 0,Wi,o),o.delete(e)),t}function qi(t){return $s(t)?void 0:t}function Hi(t,e,n,r,i,o){var s=1&n,a=t.length,c=e.length;if(a!=c&&!(s&&c>a))return!1;var u=o.get(t),h=o.get(e);if(u&&h)return u==e&&h==t;var l=-1,f=!0,d=2&n?new Ln:void 0;for(o.set(t,e),o.set(e,t);++l<a;){var p=t[l],v=e[l];if(r)var g=s?r(v,p,l,e,t,o):r(p,v,l,t,e,o);if(void 0!==g){if(g)continue;f=!1;break}if(d){if(!me(e,(function(t,e){if(!Ie(d,e)&&(p===t||i(p,t,n,r,o)))return d.push(e)}))){f=!1;break}}else if(p!==v&&!i(p,v,n,r,o)){f=!1;break}}return o.delete(t),o.delete(e),f}function zi(t){return So(go(t,void 0,No),t+"")}function Gi(t){return dr(t,wa,eo)}function Yi(t){return dr(t,Sa,no)}var $i=bn?function(t){return bn.get(t)}:Za;function Xi(t){for(var e=t.name+"",n=_n[e],r=xt.call(_n,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function Ki(t){return(xt.call(On,"placeholder")?On:t).placeholder}function Ji(){var t=On.iteratee||$a;return t=t===$a?Tr:t,arguments.length?t(arguments[0],arguments[1]):t}function Zi(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function Qi(t){for(var e=wa(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,po(i)]}return e}function to(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return xr(n)?n:void 0}var eo=en?function(t){return null==t?[]:(t=pt(t),he(en(t),(function(e){return Gt.call(t,e)})))}:oc,no=en?function(t){for(var e=[];t;)pe(e,eo(t)),t=Wt(t);return e}:oc,ro=pr;function io(t,e,n){for(var r=-1,i=(e=ci(e,t)).length,o=!1;++r<i;){var s=Ro(e[r]);if(!(o=null!=t&&n(t,s)))break;t=t[s]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&qs(i)&&ao(s,i)&&(Ds(t)||Is(t))}function oo(t){return"function"!=typeof t.constructor||fo(t)?{}:An(Wt(t))}function so(t){return Ds(t)||Is(t)||!!(Xt&&t&&t[Xt])}function ao(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&ct.test(t))&&t>-1&&t%1==0&&t<e}function co(t,e,n){if(!Hs(n))return!1;var r=typeof e;return!!("number"==r?js(n)&&ao(e,n.length):"string"==r&&e in n)&&As(n[e],t)}function uo(t,e){if(Ds(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Zs(t))||(H.test(t)||!q.test(t)||null!=e&&t in pt(e))}function ho(t){var e=Xi(t),n=On[e];if("function"!=typeof n||!(e in In.prototype))return!1;if(t===n)return!0;var r=$i(n);return!!r&&t===r[0]}(dn&&ro(new dn(new ArrayBuffer(1)))!=T||pn&&ro(new pn)!=v||vn&&"[object Promise]"!=ro(vn.resolve())||gn&&ro(new gn)!=b||mn&&ro(new mn)!=S)&&(ro=function(t){var e=pr(t),n=e==m?t.constructor:void 0,r=n?Mo(n):"";if(r)switch(r){case wn:return T;case Sn:return v;case xn:return"[object Promise]";case Tn:return b;case Cn:return S}return e});var lo=wt?Vs:sc;function fo(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||_t)}function po(t){return t==t&&!Hs(t)}function vo(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in pt(n)))}}function go(t,e,n){return e=an(void 0===e?t.length-1:e,0),function(){for(var i=arguments,o=-1,s=an(i.length-e,0),a=r(s);++o<s;)a[o]=i[e+o];o=-1;for(var c=r(e+1);++o<e;)c[o]=i[o];return c[e]=n(a),oe(t,this,c)}}function mo(t,e){return e.length<2?t:fr(t,Gr(e,0,-1))}function yo(t,e){for(var n=t.length,r=cn(e.length,n),i=yi(t);r--;){var o=e[r];t[r]=ao(o,n)?i[o]:void 0}return t}function bo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var _o=To(qr),wo=Ze||function(t,e){return Yt.setTimeout(t,e)},So=To(Hr);function xo(t,e,n){var r=e+"";return So(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(K,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return ae(a,(function(n){var r="_."+n[0];e&n[1]&&!le(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match(J);return e?e[1].split(Z):[]}(r),n)))}function To(t){var e=0,n=0;return function(){var r=un(),i=16-(r-n);if(n=r,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function Co(t,e){var n=-1,r=t.length,i=r-1;for(e=void 0===e?r:e;++n<e;){var o=Lr(n,i),s=t[o];t[o]=t[n],t[n]=s}return t.length=e,t}var Eo=function(t){var e=Ts(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(z,(function(t,n,r,i){e.push(r?i.replace(et,"$1"):n||t)})),e}));function Ro(t){if("string"==typeof t||Zs(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Mo(t){if(null!=t){try{return St.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Oo(t){if(t instanceof In)return t.clone();var e=new kn(t.__wrapped__,t.__chain__);return e.__actions__=yi(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Ao=Fr((function(t,e){return Ls(t)?tr(t,sr(e,1,Ls,!0)):[]})),Po=Fr((function(t,e){var n=Bo(e);return Ls(n)&&(n=void 0),Ls(t)?tr(t,sr(e,1,Ls,!0),Ji(n,2)):[]})),ko=Fr((function(t,e){var n=Bo(e);return Ls(n)&&(n=void 0),Ls(t)?tr(t,sr(e,1,Ls,!0),void 0,n):[]}));function Io(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ia(n);return i<0&&(i=an(r+i,0)),_e(t,Ji(e,3),i)}function Do(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=r-1;return void 0!==n&&(i=ia(n),i=n<0?an(r+i,0):cn(i,r-1)),_e(t,Ji(e,3),i,!0)}function No(t){return(null==t?0:t.length)?sr(t,1):[]}function jo(t){return t&&t.length?t[0]:void 0}var Lo=Fr((function(t){var e=de(t,si);return e.length&&e[0]===t[0]?yr(e):[]})),Uo=Fr((function(t){var e=Bo(t),n=de(t,si);return e===Bo(n)?e=void 0:n.pop(),n.length&&n[0]===t[0]?yr(n,Ji(e,2)):[]})),Fo=Fr((function(t){var e=Bo(t),n=de(t,si);return(e="function"==typeof e?e:void 0)&&n.pop(),n.length&&n[0]===t[0]?yr(n,void 0,e):[]}));function Bo(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}var Vo=Fr(Wo);function Wo(t,e){return t&&t.length&&e&&e.length?Nr(t,e):t}var qo=zi((function(t,e){var n=null==t?0:t.length,r=Xn(t,e);return jr(t,de(e,(function(t){return ao(t,n)?+t:t})).sort(vi)),r}));function Ho(t){return null==t?t:fn.call(t)}var zo=Fr((function(t){return Qr(sr(t,1,Ls,!0))})),Go=Fr((function(t){var e=Bo(t);return Ls(e)&&(e=void 0),Qr(sr(t,1,Ls,!0),Ji(e,2))})),Yo=Fr((function(t){var e=Bo(t);return e="function"==typeof e?e:void 0,Qr(sr(t,1,Ls,!0),void 0,e)}));function $o(t){if(!t||!t.length)return[];var e=0;return t=he(t,(function(t){if(Ls(t))return e=an(t.length,e),!0})),Oe(e,(function(e){return de(t,Ce(e))}))}function Xo(t,e){if(!t||!t.length)return[];var n=$o(t);return null==e?n:de(n,(function(t){return oe(e,void 0,t)}))}var Ko=Fr((function(t,e){return Ls(t)?tr(t,e):[]})),Jo=Fr((function(t){return ii(he(t,Ls))})),Zo=Fr((function(t){var e=Bo(t);return Ls(e)&&(e=void 0),ii(he(t,Ls),Ji(e,2))})),Qo=Fr((function(t){var e=Bo(t);return e="function"==typeof e?e:void 0,ii(he(t,Ls),void 0,e)})),ts=Fr($o);var es=Fr((function(t){var e=t.length,n=e>1?t[e-1]:void 0;return n="function"==typeof n?(t.pop(),n):void 0,Xo(t,n)}));function ns(t){var e=On(t);return e.__chain__=!0,e}function rs(t,e){return e(t)}var is=zi((function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,i=function(e){return Xn(e,t)};return!(e>1||this.__actions__.length)&&r instanceof In&&ao(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:rs,args:[i],thisArg:void 0}),new kn(r,this.__chain__).thru((function(t){return e&&!t.length&&t.push(void 0),t}))):this.thru(i)}));var os=_i((function(t,e,n){xt.call(t,n)?++t[n]:$n(t,n,1)}));var ss=Ri(Io),as=Ri(Do);function cs(t,e){return(Ds(t)?ae:er)(t,Ji(e,3))}function us(t,e){return(Ds(t)?ce:nr)(t,Ji(e,3))}var hs=_i((function(t,e,n){xt.call(t,n)?t[n].push(e):$n(t,n,[e])}));var ls=Fr((function(t,e,n){var i=-1,o="function"==typeof e,s=js(t)?r(t.length):[];return er(t,(function(t){s[++i]=o?oe(e,t,n):br(t,e,n)})),s})),fs=_i((function(t,e,n){$n(t,n,e)}));function ds(t,e){return(Ds(t)?de:Mr)(t,Ji(e,3))}var ps=_i((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));var vs=Fr((function(t,e){if(null==t)return[];var n=e.length;return n>1&&co(t,e[0],e[1])?e=[]:n>2&&co(e[0],e[1],e[2])&&(e=[e[0]]),Ir(t,sr(e,1),[])})),gs=Je||function(){return Yt.Date.now()};function ms(t,e,n){return e=n?void 0:e,Bi(t,128,void 0,void 0,void 0,void 0,e=t&&null==e?t.length:e)}function ys(t,e){var n;if("function"!=typeof e)throw new mt(o);return t=ia(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=void 0),n}}var bs=Fr((function(t,e,n){var r=1;if(n.length){var i=qe(n,Ki(bs));r|=32}return Bi(t,r,e,n,i)})),_s=Fr((function(t,e,n){var r=3;if(n.length){var i=qe(n,Ki(_s));r|=32}return Bi(e,r,t,n,i)}));function ws(t,e,n){var r,i,s,a,c,u,h=0,l=!1,f=!1,d=!0;if("function"!=typeof t)throw new mt(o);function p(e){var n=r,o=i;return r=i=void 0,h=e,a=t.apply(o,n)}function v(t){return h=t,c=wo(m,e),l?p(t):a}function g(t){var n=t-u;return void 0===u||n>=e||n<0||f&&t-h>=s}function m(){var t=gs();if(g(t))return y(t);c=wo(m,function(t){var n=e-(t-u);return f?cn(n,s-(t-h)):n}(t))}function y(t){return c=void 0,d&&r?p(t):(r=i=void 0,a)}function b(){var t=gs(),n=g(t);if(r=arguments,i=this,u=t,n){if(void 0===c)return v(u);if(f)return li(c),c=wo(m,e),p(u)}return void 0===c&&(c=wo(m,e)),a}return e=sa(e)||0,Hs(n)&&(l=!!n.leading,s=(f="maxWait"in n)?an(sa(n.maxWait)||0,e):s,d="trailing"in n?!!n.trailing:d),b.cancel=function(){void 0!==c&&li(c),h=0,r=u=i=c=void 0},b.flush=function(){return void 0===c?a:y(gs())},b}var Ss=Fr((function(t,e){return Qn(t,1,e)})),xs=Fr((function(t,e,n){return Qn(t,sa(e)||0,n)}));function Ts(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new mt(o);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Ts.Cache||jn),n}function Cs(t){if("function"!=typeof t)throw new mt(o);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Ts.Cache=jn;var Es=ui((function(t,e){var n=(e=1==e.length&&Ds(e[0])?de(e[0],Pe(Ji())):de(sr(e,1),Pe(Ji()))).length;return Fr((function(r){for(var i=-1,o=cn(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return oe(t,this,r)}))})),Rs=Fr((function(t,e){return Bi(t,32,void 0,e,qe(e,Ki(Rs)))})),Ms=Fr((function(t,e){return Bi(t,64,void 0,e,qe(e,Ki(Ms)))})),Os=zi((function(t,e){return Bi(t,256,void 0,void 0,void 0,e)}));function As(t,e){return t===e||t!=t&&e!=e}var Ps=Ni(vr),ks=Ni((function(t,e){return t>=e})),Is=_r(function(){return arguments}())?_r:function(t){return zs(t)&&xt.call(t,"callee")&&!Gt.call(t,"callee")},Ds=r.isArray,Ns=Qt?Pe(Qt):function(t){return zs(t)&&pr(t)==x};function js(t){return null!=t&&qs(t.length)&&!Vs(t)}function Ls(t){return zs(t)&&js(t)}var Us=nn||sc,Fs=te?Pe(te):function(t){return zs(t)&&pr(t)==l};function Bs(t){if(!zs(t))return!1;var e=pr(t);return e==f||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!$s(t)}function Vs(t){if(!Hs(t))return!1;var e=pr(t);return e==d||e==p||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Ws(t){return"number"==typeof t&&t==ia(t)}function qs(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function Hs(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function zs(t){return null!=t&&"object"==typeof t}var Gs=ee?Pe(ee):function(t){return zs(t)&&ro(t)==v};function Ys(t){return"number"==typeof t||zs(t)&&pr(t)==g}function $s(t){if(!zs(t)||pr(t)!=m)return!1;var e=Wt(t);if(null===e)return!0;var n=xt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&St.call(n)==Rt}var Xs=ne?Pe(ne):function(t){return zs(t)&&pr(t)==y};var Ks=re?Pe(re):function(t){return zs(t)&&ro(t)==b};function Js(t){return"string"==typeof t||!Ds(t)&&zs(t)&&pr(t)==_}function Zs(t){return"symbol"==typeof t||zs(t)&&pr(t)==w}var Qs=ie?Pe(ie):function(t){return zs(t)&&qs(t.length)&&!!Bt[pr(t)]};var ta=Ni(Rr),ea=Ni((function(t,e){return t<=e}));function na(t){if(!t)return[];if(js(t))return Js(t)?Ye(t):yi(t);if(Jt&&t[Jt])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[Jt]());var e=ro(t);return(e==v?Ve:e==b?He:Aa)(t)}function ra(t){return t?(t=sa(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function ia(t){var e=ra(t),n=e%1;return e==e?n?e-n:e:0}function oa(t){return t?Kn(ia(t),0,4294967295):0}function sa(t){if("number"==typeof t)return t;if(Zs(t))return NaN;if(Hs(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Hs(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ae(t);var n=ot.test(t);return n||at.test(t)?Ht(t.slice(2),n?2:8):it.test(t)?NaN:+t}function aa(t){return bi(t,Sa(t))}function ca(t){return null==t?"":Zr(t)}var ua=wi((function(t,e){if(fo(e)||js(e))bi(e,wa(e),t);else for(var n in e)xt.call(e,n)&&Hn(t,n,e[n])})),ha=wi((function(t,e){bi(e,Sa(e),t)})),la=wi((function(t,e,n,r){bi(e,Sa(e),t,r)})),fa=wi((function(t,e,n,r){bi(e,wa(e),t,r)})),da=zi(Xn);var pa=Fr((function(t,e){t=pt(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&co(e[0],e[1],i)&&(r=1);++n<r;)for(var o=e[n],s=Sa(o),a=-1,c=s.length;++a<c;){var u=s[a],h=t[u];(void 0===h||As(h,_t[u])&&!xt.call(t,u))&&(t[u]=o[u])}return t})),va=Fr((function(t){return t.push(void 0,Wi),oe(Ta,void 0,t)}));function ga(t,e,n){var r=null==t?void 0:fr(t,e);return void 0===r?n:r}function ma(t,e){return null!=t&&io(t,e,mr)}var ya=Ai((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Et.call(e)),t[e]=n}),Ha(Ya)),ba=Ai((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Et.call(e)),xt.call(t,e)?t[e].push(n):t[e]=[n]}),Ji),_a=Fr(br);function wa(t){return js(t)?Fn(t):Cr(t)}function Sa(t){return js(t)?Fn(t,!0):Er(t)}var xa=wi((function(t,e,n){Pr(t,e,n)})),Ta=wi((function(t,e,n,r){Pr(t,e,n,r)})),Ca=zi((function(t,e){var n={};if(null==t)return n;var r=!1;e=de(e,(function(e){return e=ci(e,t),r||(r=e.length>1),e})),bi(t,Yi(t),n),r&&(n=Jn(n,7,qi));for(var i=e.length;i--;)ti(n,e[i]);return n}));var Ea=zi((function(t,e){return null==t?{}:function(t,e){return Dr(t,e,(function(e,n){return ma(t,n)}))}(t,e)}));function Ra(t,e){if(null==t)return{};var n=de(Yi(t),(function(t){return[t]}));return e=Ji(e),Dr(t,n,(function(t,n){return e(t,n[0])}))}var Ma=Fi(wa),Oa=Fi(Sa);function Aa(t){return null==t?[]:ke(t,wa(t))}var Pa=Ci((function(t,e,n){return e=e.toLowerCase(),t+(n?ka(e):e)}));function ka(t){return Ba(ca(t).toLowerCase())}function Ia(t){return(t=ca(t))&&t.replace(ut,Le).replace(It,"")}var Da=Ci((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),Na=Ci((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),ja=Ti("toLowerCase");var La=Ci((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));var Ua=Ci((function(t,e,n){return t+(n?" ":"")+Ba(e)}));var Fa=Ci((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Ba=Ti("toUpperCase");function Va(t,e,n){return t=ca(t),void 0===(e=n?void 0:e)?function(t){return Lt.test(t)}(t)?function(t){return t.match(Nt)||[]}(t):function(t){return t.match(Q)||[]}(t):t.match(e)||[]}var Wa=Fr((function(t,e){try{return oe(t,void 0,e)}catch(t){return Bs(t)?t:new X(t)}})),qa=zi((function(t,e){return ae(e,(function(e){e=Ro(e),$n(t,e,bs(t[e],t))})),t}));function Ha(t){return function(){return t}}var za=Mi(),Ga=Mi(!0);function Ya(t){return t}function $a(t){return Tr("function"==typeof t?t:Jn(t,1))}var Xa=Fr((function(t,e){return function(n){return br(n,t,e)}})),Ka=Fr((function(t,e){return function(n){return br(t,n,e)}}));function Ja(t,e,n){var r=wa(e),i=lr(e,r);null!=n||Hs(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=lr(e,wa(e)));var o=!(Hs(n)&&"chain"in n&&!n.chain),s=Vs(t);return ae(i,(function(n){var r=e[n];t[n]=r,s&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__),i=n.__actions__=yi(this.__actions__);return i.push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,pe([this.value()],arguments))})})),t}function Za(){}var Qa=ki(de),tc=ki(ue),ec=ki(me);function nc(t){return uo(t)?Ce(Ro(t)):function(t){return function(e){return fr(e,t)}}(t)}var rc=Di(),ic=Di(!0);function oc(){return[]}function sc(){return!1}var ac=Pi((function(t,e){return t+e}),0),cc=Li("ceil"),uc=Pi((function(t,e){return t/e}),1),hc=Li("floor");var lc,fc=Pi((function(t,e){return t*e}),1),dc=Li("round"),pc=Pi((function(t,e){return t-e}),0);return On.after=function(t,e){if("function"!=typeof e)throw new mt(o);return t=ia(t),function(){if(--t<1)return e.apply(this,arguments)}},On.ary=ms,On.assign=ua,On.assignIn=ha,On.assignInWith=la,On.assignWith=fa,On.at=da,On.before=ys,On.bind=bs,On.bindAll=qa,On.bindKey=_s,On.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Ds(t)?t:[t]},On.chain=ns,On.chunk=function(t,e,n){e=(n?co(t,e,n):void 0===e)?1:an(ia(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var o=0,s=0,a=r(Qe(i/e));o<i;)a[s++]=Gr(t,o,o+=e);return a},On.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i},On.concat=function(){var t=arguments.length;if(!t)return[];for(var e=r(t-1),n=arguments[0],i=t;i--;)e[i-1]=arguments[i];return pe(Ds(n)?yi(n):[n],sr(e,1))},On.cond=function(t){var e=null==t?0:t.length,n=Ji();return t=e?de(t,(function(t){if("function"!=typeof t[1])throw new mt(o);return[n(t[0]),t[1]]})):[],Fr((function(n){for(var r=-1;++r<e;){var i=t[r];if(oe(i[0],this,n))return oe(i[1],this,n)}}))},On.conforms=function(t){return function(t){var e=wa(t);return function(n){return Zn(n,t,e)}}(Jn(t,1))},On.constant=Ha,On.countBy=os,On.create=function(t,e){var n=An(t);return null==e?n:Yn(n,e)},On.curry=function t(e,n,r){var i=Bi(e,8,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=t.placeholder,i},On.curryRight=function t(e,n,r){var i=Bi(e,16,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=t.placeholder,i},On.debounce=ws,On.defaults=pa,On.defaultsDeep=va,On.defer=Ss,On.delay=xs,On.difference=Ao,On.differenceBy=Po,On.differenceWith=ko,On.drop=function(t,e,n){var r=null==t?0:t.length;return r?Gr(t,(e=n||void 0===e?1:ia(e))<0?0:e,r):[]},On.dropRight=function(t,e,n){var r=null==t?0:t.length;return r?Gr(t,0,(e=r-(e=n||void 0===e?1:ia(e)))<0?0:e):[]},On.dropRightWhile=function(t,e){return t&&t.length?ni(t,Ji(e,3),!0,!0):[]},On.dropWhile=function(t,e){return t&&t.length?ni(t,Ji(e,3),!0):[]},On.fill=function(t,e,n,r){var i=null==t?0:t.length;return i?(n&&"number"!=typeof n&&co(t,e,n)&&(n=0,r=i),function(t,e,n,r){var i=t.length;for((n=ia(n))<0&&(n=-n>i?0:i+n),(r=void 0===r||r>i?i:ia(r))<0&&(r+=i),r=n>r?0:oa(r);n<r;)t[n++]=e;return t}(t,e,n,r)):[]},On.filter=function(t,e){return(Ds(t)?he:or)(t,Ji(e,3))},On.flatMap=function(t,e){return sr(ds(t,e),1)},On.flatMapDeep=function(t,e){return sr(ds(t,e),1/0)},On.flatMapDepth=function(t,e,n){return n=void 0===n?1:ia(n),sr(ds(t,e),n)},On.flatten=No,On.flattenDeep=function(t){return(null==t?0:t.length)?sr(t,1/0):[]},On.flattenDepth=function(t,e){return(null==t?0:t.length)?sr(t,e=void 0===e?1:ia(e)):[]},On.flip=function(t){return Bi(t,512)},On.flow=za,On.flowRight=Ga,On.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},On.functions=function(t){return null==t?[]:lr(t,wa(t))},On.functionsIn=function(t){return null==t?[]:lr(t,Sa(t))},On.groupBy=hs,On.initial=function(t){return(null==t?0:t.length)?Gr(t,0,-1):[]},On.intersection=Lo,On.intersectionBy=Uo,On.intersectionWith=Fo,On.invert=ya,On.invertBy=ba,On.invokeMap=ls,On.iteratee=$a,On.keyBy=fs,On.keys=wa,On.keysIn=Sa,On.map=ds,On.mapKeys=function(t,e){var n={};return e=Ji(e,3),ur(t,(function(t,r,i){$n(n,e(t,r,i),t)})),n},On.mapValues=function(t,e){var n={};return e=Ji(e,3),ur(t,(function(t,r,i){$n(n,r,e(t,r,i))})),n},On.matches=function(t){return Or(Jn(t,1))},On.matchesProperty=function(t,e){return Ar(t,Jn(e,1))},On.memoize=Ts,On.merge=xa,On.mergeWith=Ta,On.method=Xa,On.methodOf=Ka,On.mixin=Ja,On.negate=Cs,On.nthArg=function(t){return t=ia(t),Fr((function(e){return kr(e,t)}))},On.omit=Ca,On.omitBy=function(t,e){return Ra(t,Cs(Ji(e)))},On.once=function(t){return ys(2,t)},On.orderBy=function(t,e,n,r){return null==t?[]:(Ds(e)||(e=null==e?[]:[e]),Ds(n=r?void 0:n)||(n=null==n?[]:[n]),Ir(t,e,n))},On.over=Qa,On.overArgs=Es,On.overEvery=tc,On.overSome=ec,On.partial=Rs,On.partialRight=Ms,On.partition=ps,On.pick=Ea,On.pickBy=Ra,On.property=nc,On.propertyOf=function(t){return function(e){return null==t?void 0:fr(t,e)}},On.pull=Vo,On.pullAll=Wo,On.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Nr(t,e,Ji(n,2)):t},On.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?Nr(t,e,void 0,n):t},On.pullAt=qo,On.range=rc,On.rangeRight=ic,On.rearg=Os,On.reject=function(t,e){return(Ds(t)?he:or)(t,Cs(Ji(e,3)))},On.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=Ji(e,3);++r<o;){var s=t[r];e(s,r,t)&&(n.push(s),i.push(r))}return jr(t,i),n},On.rest=function(t,e){if("function"!=typeof t)throw new mt(o);return Fr(t,e=void 0===e?e:ia(e))},On.reverse=Ho,On.sampleSize=function(t,e,n){return e=(n?co(t,e,n):void 0===e)?1:ia(e),(Ds(t)?Vn:Vr)(t,e)},On.set=function(t,e,n){return null==t?t:Wr(t,e,n)},On.setWith=function(t,e,n,r){return r="function"==typeof r?r:void 0,null==t?t:Wr(t,e,n,r)},On.shuffle=function(t){return(Ds(t)?Wn:zr)(t)},On.slice=function(t,e,n){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&co(t,e,n)?(e=0,n=r):(e=null==e?0:ia(e),n=void 0===n?r:ia(n)),Gr(t,e,n)):[]},On.sortBy=vs,On.sortedUniq=function(t){return t&&t.length?Kr(t):[]},On.sortedUniqBy=function(t,e){return t&&t.length?Kr(t,Ji(e,2)):[]},On.split=function(t,e,n){return n&&"number"!=typeof n&&co(t,e,n)&&(e=n=void 0),(n=void 0===n?4294967295:n>>>0)?(t=ca(t))&&("string"==typeof e||null!=e&&!Xs(e))&&!(e=Zr(e))&&Be(t)?hi(Ye(t),0,n):t.split(e,n):[]},On.spread=function(t,e){if("function"!=typeof t)throw new mt(o);return e=null==e?0:an(ia(e),0),Fr((function(n){var r=n[e],i=hi(n,0,e);return r&&pe(i,r),oe(t,this,i)}))},On.tail=function(t){var e=null==t?0:t.length;return e?Gr(t,1,e):[]},On.take=function(t,e,n){return t&&t.length?Gr(t,0,(e=n||void 0===e?1:ia(e))<0?0:e):[]},On.takeRight=function(t,e,n){var r=null==t?0:t.length;return r?Gr(t,(e=r-(e=n||void 0===e?1:ia(e)))<0?0:e,r):[]},On.takeRightWhile=function(t,e){return t&&t.length?ni(t,Ji(e,3),!1,!0):[]},On.takeWhile=function(t,e){return t&&t.length?ni(t,Ji(e,3)):[]},On.tap=function(t,e){return e(t),t},On.throttle=function(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new mt(o);return Hs(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),ws(t,e,{leading:r,maxWait:e,trailing:i})},On.thru=rs,On.toArray=na,On.toPairs=Ma,On.toPairsIn=Oa,On.toPath=function(t){return Ds(t)?de(t,Ro):Zs(t)?[t]:yi(Eo(ca(t)))},On.toPlainObject=aa,On.transform=function(t,e,n){var r=Ds(t),i=r||Us(t)||Qs(t);if(e=Ji(e,4),null==n){var o=t&&t.constructor;n=i?r?new o:[]:Hs(t)&&Vs(o)?An(Wt(t)):{}}return(i?ae:ur)(t,(function(t,r,i){return e(n,t,r,i)})),n},On.unary=function(t){return ms(t,1)},On.union=zo,On.unionBy=Go,On.unionWith=Yo,On.uniq=function(t){return t&&t.length?Qr(t):[]},On.uniqBy=function(t,e){return t&&t.length?Qr(t,Ji(e,2)):[]},On.uniqWith=function(t,e){return e="function"==typeof e?e:void 0,t&&t.length?Qr(t,void 0,e):[]},On.unset=function(t,e){return null==t||ti(t,e)},On.unzip=$o,On.unzipWith=Xo,On.update=function(t,e,n){return null==t?t:ei(t,e,ai(n))},On.updateWith=function(t,e,n,r){return r="function"==typeof r?r:void 0,null==t?t:ei(t,e,ai(n),r)},On.values=Aa,On.valuesIn=function(t){return null==t?[]:ke(t,Sa(t))},On.without=Ko,On.words=Va,On.wrap=function(t,e){return Rs(ai(e),t)},On.xor=Jo,On.xorBy=Zo,On.xorWith=Qo,On.zip=ts,On.zipObject=function(t,e){return oi(t||[],e||[],Hn)},On.zipObjectDeep=function(t,e){return oi(t||[],e||[],Wr)},On.zipWith=es,On.entries=Ma,On.entriesIn=Oa,On.extend=ha,On.extendWith=la,Ja(On,On),On.add=ac,On.attempt=Wa,On.camelCase=Pa,On.capitalize=ka,On.ceil=cc,On.clamp=function(t,e,n){return void 0===n&&(n=e,e=void 0),void 0!==n&&(n=(n=sa(n))==n?n:0),void 0!==e&&(e=(e=sa(e))==e?e:0),Kn(sa(t),e,n)},On.clone=function(t){return Jn(t,4)},On.cloneDeep=function(t){return Jn(t,5)},On.cloneDeepWith=function(t,e){return Jn(t,5,e="function"==typeof e?e:void 0)},On.cloneWith=function(t,e){return Jn(t,4,e="function"==typeof e?e:void 0)},On.conformsTo=function(t,e){return null==e||Zn(t,e,wa(e))},On.deburr=Ia,On.defaultTo=function(t,e){return null==t||t!=t?e:t},On.divide=uc,On.endsWith=function(t,e,n){t=ca(t),e=Zr(e);var r=t.length,i=n=void 0===n?r:Kn(ia(n),0,r);return(n-=e.length)>=0&&t.slice(n,i)==e},On.eq=As,On.escape=function(t){return(t=ca(t))&&F.test(t)?t.replace(L,Ue):t},On.escapeRegExp=function(t){return(t=ca(t))&&Y.test(t)?t.replace(G,"\\$&"):t},On.every=function(t,e,n){var r=Ds(t)?ue:rr;return n&&co(t,e,n)&&(e=void 0),r(t,Ji(e,3))},On.find=ss,On.findIndex=Io,On.findKey=function(t,e){return be(t,Ji(e,3),ur)},On.findLast=as,On.findLastIndex=Do,On.findLastKey=function(t,e){return be(t,Ji(e,3),hr)},On.floor=hc,On.forEach=cs,On.forEachRight=us,On.forIn=function(t,e){return null==t?t:ar(t,Ji(e,3),Sa)},On.forInRight=function(t,e){return null==t?t:cr(t,Ji(e,3),Sa)},On.forOwn=function(t,e){return t&&ur(t,Ji(e,3))},On.forOwnRight=function(t,e){return t&&hr(t,Ji(e,3))},On.get=ga,On.gt=Ps,On.gte=ks,On.has=function(t,e){return null!=t&&io(t,e,gr)},On.hasIn=ma,On.head=jo,On.identity=Ya,On.includes=function(t,e,n,r){t=js(t)?t:Aa(t),n=n&&!r?ia(n):0;var i=t.length;return n<0&&(n=an(i+n,0)),Js(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&we(t,e,n)>-1},On.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ia(n);return i<0&&(i=an(r+i,0)),we(t,e,i)},On.inRange=function(t,e,n){return e=ra(e),void 0===n?(n=e,e=0):n=ra(n),function(t,e,n){return t>=cn(e,n)&&t<an(e,n)}(t=sa(t),e,n)},On.invoke=_a,On.isArguments=Is,On.isArray=Ds,On.isArrayBuffer=Ns,On.isArrayLike=js,On.isArrayLikeObject=Ls,On.isBoolean=function(t){return!0===t||!1===t||zs(t)&&pr(t)==h},On.isBuffer=Us,On.isDate=Fs,On.isElement=function(t){return zs(t)&&1===t.nodeType&&!$s(t)},On.isEmpty=function(t){if(null==t)return!0;if(js(t)&&(Ds(t)||"string"==typeof t||"function"==typeof t.splice||Us(t)||Qs(t)||Is(t)))return!t.length;var e=ro(t);if(e==v||e==b)return!t.size;if(fo(t))return!Cr(t).length;for(var n in t)if(xt.call(t,n))return!1;return!0},On.isEqual=function(t,e){return wr(t,e)},On.isEqualWith=function(t,e,n){var r=(n="function"==typeof n?n:void 0)?n(t,e):void 0;return void 0===r?wr(t,e,void 0,n):!!r},On.isError=Bs,On.isFinite=function(t){return"number"==typeof t&&rn(t)},On.isFunction=Vs,On.isInteger=Ws,On.isLength=qs,On.isMap=Gs,On.isMatch=function(t,e){return t===e||Sr(t,e,Qi(e))},On.isMatchWith=function(t,e,n){return n="function"==typeof n?n:void 0,Sr(t,e,Qi(e),n)},On.isNaN=function(t){return Ys(t)&&t!=+t},On.isNative=function(t){if(lo(t))throw new X("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return xr(t)},On.isNil=function(t){return null==t},On.isNull=function(t){return null===t},On.isNumber=Ys,On.isObject=Hs,On.isObjectLike=zs,On.isPlainObject=$s,On.isRegExp=Xs,On.isSafeInteger=function(t){return Ws(t)&&t>=-9007199254740991&&t<=9007199254740991},On.isSet=Ks,On.isString=Js,On.isSymbol=Zs,On.isTypedArray=Qs,On.isUndefined=function(t){return void 0===t},On.isWeakMap=function(t){return zs(t)&&ro(t)==S},On.isWeakSet=function(t){return zs(t)&&"[object WeakSet]"==pr(t)},On.join=function(t,e){return null==t?"":on.call(t,e)},On.kebabCase=Da,On.last=Bo,On.lastIndexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=r;return void 0!==n&&(i=(i=ia(n))<0?an(r+i,0):cn(i,r-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,i):_e(t,xe,i,!0)},On.lowerCase=Na,On.lowerFirst=ja,On.lt=ta,On.lte=ea,On.max=function(t){return t&&t.length?ir(t,Ya,vr):void 0},On.maxBy=function(t,e){return t&&t.length?ir(t,Ji(e,2),vr):void 0},On.mean=function(t){return Te(t,Ya)},On.meanBy=function(t,e){return Te(t,Ji(e,2))},On.min=function(t){return t&&t.length?ir(t,Ya,Rr):void 0},On.minBy=function(t,e){return t&&t.length?ir(t,Ji(e,2),Rr):void 0},On.stubArray=oc,On.stubFalse=sc,On.stubObject=function(){return{}},On.stubString=function(){return""},On.stubTrue=function(){return!0},On.multiply=fc,On.nth=function(t,e){return t&&t.length?kr(t,ia(e)):void 0},On.noConflict=function(){return Yt._===this&&(Yt._=Mt),this},On.noop=Za,On.now=gs,On.pad=function(t,e,n){t=ca(t);var r=(e=ia(e))?Ge(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Ii(tn(i),n)+t+Ii(Qe(i),n)},On.padEnd=function(t,e,n){t=ca(t);var r=(e=ia(e))?Ge(t):0;return e&&r<e?t+Ii(e-r,n):t},On.padStart=function(t,e,n){t=ca(t);var r=(e=ia(e))?Ge(t):0;return e&&r<e?Ii(e-r,n)+t:t},On.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),hn(ca(t).replace($,""),e||0)},On.random=function(t,e,n){if(n&&"boolean"!=typeof n&&co(t,e,n)&&(e=n=void 0),void 0===n&&("boolean"==typeof e?(n=e,e=void 0):"boolean"==typeof t&&(n=t,t=void 0)),void 0===t&&void 0===e?(t=0,e=1):(t=ra(t),void 0===e?(e=t,t=0):e=ra(e)),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var i=ln();return cn(t+i*(e-t+qt("1e-"+((i+"").length-1))),e)}return Lr(t,e)},On.reduce=function(t,e,n){var r=Ds(t)?ve:Re,i=arguments.length<3;return r(t,Ji(e,4),n,i,er)},On.reduceRight=function(t,e,n){var r=Ds(t)?ge:Re,i=arguments.length<3;return r(t,Ji(e,4),n,i,nr)},On.repeat=function(t,e,n){return e=(n?co(t,e,n):void 0===e)?1:ia(e),Ur(ca(t),e)},On.replace=function(){var t=arguments,e=ca(t[0]);return t.length<3?e:e.replace(t[1],t[2])},On.result=function(t,e,n){var r=-1,i=(e=ci(e,t)).length;for(i||(i=1,t=void 0);++r<i;){var o=null==t?void 0:t[Ro(e[r])];void 0===o&&(r=i,o=n),t=Vs(o)?o.call(t):o}return t},On.round=dc,On.runInContext=t,On.sample=function(t){return(Ds(t)?Bn:Br)(t)},On.size=function(t){if(null==t)return 0;if(js(t))return Js(t)?Ge(t):t.length;var e=ro(t);return e==v||e==b?t.size:Cr(t).length},On.snakeCase=La,On.some=function(t,e,n){var r=Ds(t)?me:Yr;return n&&co(t,e,n)&&(e=void 0),r(t,Ji(e,3))},On.sortedIndex=function(t,e){return $r(t,e)},On.sortedIndexBy=function(t,e,n){return Xr(t,e,Ji(n,2))},On.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=$r(t,e);if(r<n&&As(t[r],e))return r}return-1},On.sortedLastIndex=function(t,e){return $r(t,e,!0)},On.sortedLastIndexBy=function(t,e,n){return Xr(t,e,Ji(n,2),!0)},On.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var n=$r(t,e,!0)-1;if(As(t[n],e))return n}return-1},On.startCase=Ua,On.startsWith=function(t,e,n){return t=ca(t),n=null==n?0:Kn(ia(n),0,t.length),e=Zr(e),t.slice(n,n+e.length)==e},On.subtract=pc,On.sum=function(t){return t&&t.length?Me(t,Ya):0},On.sumBy=function(t,e){return t&&t.length?Me(t,Ji(e,2)):0},On.template=function(t,e,n){var r=On.templateSettings;n&&co(t,e,n)&&(e=void 0),t=ca(t),e=la({},e,r,Vi);var i,o,s=la({},e.imports,r.imports,Vi),a=wa(s),c=ke(s,a),u=0,h=e.interpolate||ht,l="__p += '",f=vt((e.escape||ht).source+"|"+h.source+"|"+(h===W?nt:ht).source+"|"+(e.evaluate||ht).source+"|$","g"),d="//# sourceURL="+(xt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ft+"]")+"\n";t.replace(f,(function(e,n,r,s,a,c){return r||(r=s),l+=t.slice(u,c).replace(lt,Fe),n&&(i=!0,l+="' +\n__e("+n+") +\n'"),a&&(o=!0,l+="';\n"+a+";\n__p += '"),r&&(l+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=c+e.length,e})),l+="';\n";var p=xt.call(e,"variable")&&e.variable;if(p){if(tt.test(p))throw new X("Invalid `variable` option passed into `_.template`")}else l="with (obj) {\n"+l+"\n}\n";l=(o?l.replace(I,""):l).replace(D,"$1").replace(N,"$1;"),l="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+l+"return __p\n}";var v=Wa((function(){return ft(a,d+"return "+l).apply(void 0,c)}));if(v.source=l,Bs(v))throw v;return v},On.times=function(t,e){if((t=ia(t))<1||t>9007199254740991)return[];var n=4294967295,r=cn(t,4294967295);t-=4294967295;for(var i=Oe(r,e=Ji(e));++n<t;)e(n);return i},On.toFinite=ra,On.toInteger=ia,On.toLength=oa,On.toLower=function(t){return ca(t).toLowerCase()},On.toNumber=sa,On.toSafeInteger=function(t){return t?Kn(ia(t),-9007199254740991,9007199254740991):0===t?t:0},On.toString=ca,On.toUpper=function(t){return ca(t).toUpperCase()},On.trim=function(t,e,n){if((t=ca(t))&&(n||void 0===e))return Ae(t);if(!t||!(e=Zr(e)))return t;var r=Ye(t),i=Ye(e);return hi(r,De(r,i),Ne(r,i)+1).join("")},On.trimEnd=function(t,e,n){if((t=ca(t))&&(n||void 0===e))return t.slice(0,$e(t)+1);if(!t||!(e=Zr(e)))return t;var r=Ye(t);return hi(r,0,Ne(r,Ye(e))+1).join("")},On.trimStart=function(t,e,n){if((t=ca(t))&&(n||void 0===e))return t.replace($,"");if(!t||!(e=Zr(e)))return t;var r=Ye(t);return hi(r,De(r,Ye(e))).join("")},On.truncate=function(t,e){var n=30,r="...";if(Hs(e)){var i="separator"in e?e.separator:i;n="length"in e?ia(e.length):n,r="omission"in e?Zr(e.omission):r}var o=(t=ca(t)).length;if(Be(t)){var s=Ye(t);o=s.length}if(n>=o)return t;var a=n-Ge(r);if(a<1)return r;var c=s?hi(s,0,a).join(""):t.slice(0,a);if(void 0===i)return c+r;if(s&&(a+=c.length-a),Xs(i)){if(t.slice(a).search(i)){var u,h=c;for(i.global||(i=vt(i.source,ca(rt.exec(i))+"g")),i.lastIndex=0;u=i.exec(h);)var l=u.index;c=c.slice(0,void 0===l?a:l)}}else if(t.indexOf(Zr(i),a)!=a){var f=c.lastIndexOf(i);f>-1&&(c=c.slice(0,f))}return c+r},On.unescape=function(t){return(t=ca(t))&&U.test(t)?t.replace(j,Xe):t},On.uniqueId=function(t){var e=++Tt;return ca(t)+e},On.upperCase=Fa,On.upperFirst=Ba,On.each=cs,On.eachRight=us,On.first=jo,Ja(On,(lc={},ur(On,(function(t,e){xt.call(On.prototype,e)||(lc[e]=t)})),lc),{chain:!1}),On.VERSION="4.17.21",ae(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){On[t].placeholder=On})),ae(["drop","take"],(function(t,e){In.prototype[t]=function(n){n=void 0===n?1:an(ia(n),0);var r=this.__filtered__&&!e?new In(this):this.clone();return r.__filtered__?r.__takeCount__=cn(n,r.__takeCount__):r.__views__.push({size:cn(n,4294967295),type:t+(r.__dir__<0?"Right":"")}),r},In.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),ae(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;In.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Ji(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}})),ae(["head","last"],(function(t,e){var n="take"+(e?"Right":"");In.prototype[t]=function(){return this[n](1).value()[0]}})),ae(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");In.prototype[t]=function(){return this.__filtered__?new In(this):this[n](1)}})),In.prototype.compact=function(){return this.filter(Ya)},In.prototype.find=function(t){return this.filter(t).head()},In.prototype.findLast=function(t){return this.reverse().find(t)},In.prototype.invokeMap=Fr((function(t,e){return"function"==typeof t?new In(this):this.map((function(n){return br(n,t,e)}))})),In.prototype.reject=function(t){return this.filter(Cs(Ji(t)))},In.prototype.slice=function(t,e){t=ia(t);var n=this;return n.__filtered__&&(t>0||e<0)?new In(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),void 0!==e&&(n=(e=ia(e))<0?n.dropRight(-e):n.take(e-t)),n)},In.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},In.prototype.toArray=function(){return this.take(4294967295)},ur(In.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),i=On[r?"take"+("last"==e?"Right":""):e],o=r||/^find/.test(e);i&&(On.prototype[e]=function(){var e=this.__wrapped__,s=r?[1]:arguments,a=e instanceof In,c=s[0],u=a||Ds(e),h=function(t){var e=i.apply(On,pe([t],s));return r&&l?e[0]:e};u&&n&&"function"==typeof c&&1!=c.length&&(a=u=!1);var l=this.__chain__,f=!!this.__actions__.length,d=o&&!l,p=a&&!f;if(!o&&u){e=p?e:new In(this);var v=t.apply(e,s);return v.__actions__.push({func:rs,args:[h],thisArg:void 0}),new kn(v,l)}return d&&p?t.apply(this,s):(v=this.thru(h),d?r?v.value()[0]:v.value():v)})})),ae(["pop","push","shift","sort","splice","unshift"],(function(t){var e=yt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);On.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(Ds(i)?i:[],t)}return this[n]((function(n){return e.apply(Ds(n)?n:[],t)}))}})),ur(In.prototype,(function(t,e){var n=On[e];if(n){var r=n.name+"";xt.call(_n,r)||(_n[r]=[]),_n[r].push({name:e,func:n})}})),_n[Oi(void 0,2).name]=[{name:"wrapper",func:void 0}],In.prototype.clone=function(){var t=new In(this.__wrapped__);return t.__actions__=yi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=yi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=yi(this.__views__),t},In.prototype.reverse=function(){if(this.__filtered__){var t=new In(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},In.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=Ds(t),r=e<0,i=n?t.length:0,o=function(t,e,n){var r=-1,i=n.length;for(;++r<i;){var o=n[r],s=o.size;switch(o.type){case"drop":t+=s;break;case"dropRight":e-=s;break;case"take":e=cn(e,t+s);break;case"takeRight":t=an(t,e-s)}}return{start:t,end:e}}(0,i,this.__views__),s=o.start,a=o.end,c=a-s,u=r?a:s-1,h=this.__iteratees__,l=h.length,f=0,d=cn(c,this.__takeCount__);if(!n||!r&&i==c&&d==c)return ri(t,this.__actions__);var p=[];t:for(;c--&&f<d;){for(var v=-1,g=t[u+=e];++v<l;){var m=h[v],y=m.iteratee,b=m.type,_=y(g);if(2==b)g=_;else if(!_){if(1==b)continue t;break t}}p[f++]=g}return p},On.prototype.at=is,On.prototype.chain=function(){return ns(this)},On.prototype.commit=function(){return new kn(this.value(),this.__chain__)},On.prototype.next=function(){void 0===this.__values__&&(this.__values__=na(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?void 0:this.__values__[this.__index__++]}},On.prototype.plant=function(t){for(var e,n=this;n instanceof Pn;){var r=Oo(n);r.__index__=0,r.__values__=void 0,e?i.__wrapped__=r:e=r;var i=r;n=n.__wrapped__}return i.__wrapped__=t,e},On.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof In){var e=t;return this.__actions__.length&&(e=new In(this)),(e=e.reverse()).__actions__.push({func:rs,args:[Ho],thisArg:void 0}),new kn(e,this.__chain__)}return this.thru(Ho)},On.prototype.toJSON=On.prototype.valueOf=On.prototype.value=function(){return ri(this.__wrapped__,this.__actions__)},On.prototype.first=On.prototype.head,Jt&&(On.prototype[Jt]=function(){return this}),On}();Yt._=Ke,void 0===(i=function(){return Ke}.call(e,n,e,r))||(r.exports=i)}).call(this)}).call(this,n(34),n(136)(t))},function(t,e,n){"use strict";n.d(e,"a",(function(){return u})),n.d(e,"b",(function(){return h}));var r=n(0),i=n(5),o=n(3),s=n(1),a=n(4),c=n(48),u=function(t){function e(e,n){var r=t.call(this)||this;return r.source=e,r.subjectFactory=n,r._refCount=0,r._isComplete=!1,r}return r.a(e,t),e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return t&&!t.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype.connect=function(){var t=this._connection;return t||(this._isComplete=!1,(t=this._connection=new a.a).add(this.source.subscribe(new l(this.getSubject(),this))),t.closed&&(this._connection=null,t=a.a.EMPTY)),t},e.prototype.refCount=function(){return Object(c.a)()(this)},e}(o.a),h=function(){var t=u.prototype;return{operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:t._subscribe},_isComplete:{value:t._isComplete,writable:!0},getSubject:{value:t.getSubject},connect:{value:t.connect},refCount:{value:t.refCount}}}(),l=function(t){function e(e,n){var r=t.call(this,e)||this;return r.connectable=n,r}return r.a(e,t),e.prototype._error=function(e){this._unsubscribe(),t.prototype._error.call(this,e)},e.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._connection;t._refCount=0,t._subject=null,t._connection=null,e&&e.unsubscribe()}},e}(i.b);s.a},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(0),i=n(5),o=n(21),s=function(t){function e(e){var n=t.call(this)||this;return n._value=e,n}return r.a(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),e.prototype._subscribe=function(e){var n=t.prototype._subscribe.call(this,e);return n&&!n.closed&&e.next(this._value),n},e.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new o.a;return this._value},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(i.a)},function(t,e,n){"use strict";n.d(e,"b",(function(){return s})),n.d(e,"a",(function(){return c}));var r=n(0),i=n(1),o=n(17);function s(t,e){return void 0===e&&(e=0),function(n){return n.lift(new a(t,e))}}var a=function(){function t(t,e){void 0===e&&(e=0),this.scheduler=t,this.delay=e}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.scheduler,this.delay))},t}(),c=function(t){function e(e,n,r){void 0===r&&(r=0);var i=t.call(this,e)||this;return i.scheduler=n,i.delay=r,i}return r.a(e,t),e.dispatch=function(t){var e=t.notification,n=t.destination;e.observe(n),this.unsubscribe()},e.prototype.scheduleMessage=function(t){this.destination.add(this.scheduler.schedule(e.dispatch,this.delay,new u(t,this.destination)))},e.prototype._next=function(t){this.scheduleMessage(o.a.createNext(t))},e.prototype._error=function(t){this.scheduleMessage(o.a.createError(t)),this.unsubscribe()},e.prototype._complete=function(){this.scheduleMessage(o.a.createComplete()),this.unsubscribe()},e}(i.a),u=function(){return function(t,e){this.notification=t,this.destination=e}}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){function t(){return Error.call(this),this.message="Timeout has occurred",this.name="TimeoutError",this}return t.prototype=Object.create(Error.prototype),t}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(52);function i(){return Object(r.a)(1)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return a}));var r=n(3),i=n(9),o=n(52),s=n(26);function a(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Number.POSITIVE_INFINITY,a=null,c=t[t.length-1];return Object(i.a)(c)?(a=t.pop(),t.length>1&&"number"==typeof t[t.length-1]&&(n=t.pop())):"number"==typeof c&&(n=t.pop()),null===a&&1===t.length&&t[0]instanceof r.a?t[0]:Object(o.a)(n)(Object(s.a)(t,a))}},function(t,e,n){"use strict";n.d(e,"a",(function(){return c}));var r=n(0),i=n(7),o=n(26),s=n(15),a=n(12);function c(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(1===t.length){if(!Object(i.a)(t[0]))return t[0];t=t[0]}return Object(o.a)(t,void 0).lift(new u)}var u=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new h(t))},t}(),h=function(t){function e(e){var n=t.call(this,e)||this;return n.hasFirst=!1,n.observables=[],n.subscriptions=[],n}return r.a(e,t),e.prototype._next=function(t){this.observables.push(t)},e.prototype._complete=function(){var t=this.observables,e=t.length;if(0===e)this.destination.complete();else{for(var n=0;n<e&&!this.hasFirst;n++){var r=t[n],i=Object(a.a)(this,r,void 0,n);this.subscriptions&&this.subscriptions.push(i),this.add(i)}this.observables=null}},e.prototype.notifyNext=function(t,e,n){if(!this.hasFirst){this.hasFirst=!0;for(var r=0;r<this.subscriptions.length;r++)if(r!==n){var i=this.subscriptions[r];i.unsubscribe(),this.remove(i)}this.subscriptions=null}this.destination.next(e)},e}(s.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return a}));var r=n(3),i=n(6),o=n(30),s=n(9);function a(t,e,n){void 0===t&&(t=0);var a=-1;return Object(o.a)(e)?a=Number(e)<1?1:Number(e):Object(s.a)(e)&&(n=e),Object(s.a)(n)||(n=i.a),new r.a((function(e){var r=Object(o.a)(t)?t:+t-n.now();return n.schedule(c,r,{index:0,period:a,subscriber:e})}))}function c(t){var e=t.index,n=t.period,r=t.subscriber;if(r.next(e),!r.closed){if(-1===n)return r.complete();t.index=e+1,this.schedule(t,n)}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(3),i=n(4),o=n(20);var s=n(57),a=n(18);var c=n(77),u=n(76);function h(t,e){if(null!=t){if(function(t){return t&&"function"==typeof t[o.a]}(t))return function(t,e){return new r.a((function(n){var r=new i.a;return r.add(e.schedule((function(){var i=t[o.a]();r.add(i.subscribe({next:function(t){r.add(e.schedule((function(){return n.next(t)})))},error:function(t){r.add(e.schedule((function(){return n.error(t)})))},complete:function(){r.add(e.schedule((function(){return n.complete()})))}}))}))),r}))}(t,e);if(Object(c.a)(t))return function(t,e){return new r.a((function(n){var r=new i.a;return r.add(e.schedule((function(){return t.then((function(t){r.add(e.schedule((function(){n.next(t),r.add(e.schedule((function(){return n.complete()})))})))}),(function(t){r.add(e.schedule((function(){return n.error(t)})))}))}))),r}))}(t,e);if(Object(u.a)(t))return Object(s.a)(t,e);if(function(t){return t&&"function"==typeof t[a.a]}(t)||"string"==typeof t)return function(t,e){if(!t)throw new Error("Iterable cannot be null");return new r.a((function(n){var r,o=new i.a;return o.add((function(){r&&"function"==typeof r.return&&r.return()})),o.add(e.schedule((function(){r=t[a.a](),o.add(e.schedule((function(){if(!n.closed){var t,e;try{var i=r.next();t=i.value,e=i.done}catch(t){return void n.error(t)}e?n.complete():(n.next(t),this.schedule())}})))}))),o}))}(t,e)}throw new TypeError((null!==t&&typeof t||t)+" is not observable")}},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(0),i=function(t){function e(e,n){var r=t.call(this)||this;return r.subject=e,r.subscriber=n,r.closed=!1,r}return r.a(e,t),e.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var n=e.indexOf(this.subscriber);-1!==n&&e.splice(n,1)}}},e}(n(4).a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(t){return function(e){for(var n=0,r=t.length;n<r&&!e.closed;n++)e.next(t[n]);e.complete()}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t}},function(t,e,n){"use strict";function r(t){return!!t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";function r(t,e){function n(){return!n.pred.apply(n.thisArg,arguments)}return n.pred=t,n.thisArg=e,n}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";var r=n(45).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,n,o){if("function"==typeof n)return t(e,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t.apply(this,r)}}}(o||i);var s=n.readable||!1!==n.readable&&e.readable,a=n.writable||!1!==n.writable&&e.writable,c=function(){e.writable||h()},u=e._writableState&&e._writableState.finished,h=function(){a=!1,u=!0,s||o.call(e)},l=e._readableState&&e._readableState.endEmitted,f=function(){s=!1,l=!0,a||o.call(e)},d=function(t){o.call(e,t)},p=function(){var t;return s&&!l?(e._readableState&&e._readableState.ended||(t=new r),o.call(e,t)):a&&!u?(e._writableState&&e._writableState.ended||(t=new r),o.call(e,t)):void 0},v=function(){e.req.on("finish",h)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(e)?a&&!e._writableState&&(e.on("end",c),e.on("close",c)):(e.on("complete",h),e.on("abort",p),e.req?v():e.on("request",v)),e.on("end",f),e.on("finish",h),!1!==n.error&&e.on("error",d),e.on("close",p),function(){e.removeListener("complete",h),e.removeListener("abort",p),e.removeListener("request",v),e.req&&e.req.removeListener("finish",h),e.removeListener("end",c),e.removeListener("close",c),e.removeListener("finish",h),e.removeListener("end",f),e.removeListener("error",d),e.removeListener("close",p)}}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Prom=e.PromMessageType=void 0;const i=r(n(134));var o;!function(t){t[t.SessionStart=0]="SessionStart",t[t.WebRtcPerformance=1]="WebRtcPerformance",t[t.AvailabilityCheck=2]="AvailabilityCheck",t[t.QuestionMessageReceived=3]="QuestionMessageReceived",t[t.AnswerMessageReceived=4]="AnswerMessageReceived",t[t.SessionEnded=5]="SessionEnded"}(o=e.PromMessageType||(e.PromMessageType={}));e.Prom=class{constructor(t){this.apiUrl=t,this.prom_prefix="client_sdk_",this.registry=i.default(),this.messageTimings=[],this.metricsPushedCounter=this.registry.create("counter",this.prom_prefix+"metrics_pushed_total","A counter for showcase metrics pushed."),this.sessionStartTime=this.registry.create("histogram",this.prom_prefix+"session_start_duration_seconds","A histogram of session start times.",[1,2.5,4,5,6,7.5,8.5,10,15,30,60]),this.availabilityCheckTime=this.registry.create("histogram",this.prom_prefix+"availability_chk_duration_seconds","A histogram of availability check response times.",[.05,.1,.2,.5,.75,1,1.5,2,2.5,5,7.5,10]),this.webRtcInboundRTT=this.registry.create("histogram",this.prom_prefix+"webrtc_inbound_rtt_duration_seconds","A histogram of client inbound round trip time.",[.001,.002,.005,.01,.02,.05,.1,.5,2,5]),this.webRtcInboundFramesPerSec=this.registry.create("histogram",this.prom_prefix+"webrtc_inbound_frames_per_second","A histogram of client inbound frames per second.",[1,2,5,10,15,20,25,35,50]),this.webRtcInboundPacketsLost=this.registry.create("histogram",this.prom_prefix+"webrtc_inbound_packets_lost","A histogram of client packets lost.",[1,2,4,8,12,16,22,30,50,100,200,500]),this.webRtcFramesDropped=this.registry.create("histogram",this.prom_prefix+"webrtc_inbound_frames_dropped","A histogram of frames dropped.",[1,2,4,8,12,16,22,30,50,100,200,500]),this.webRtcFrameHeight=this.registry.create("histogram",this.prom_prefix+"webrtc_frame_height_px","A histogram of frame height in pixels",[60,180,240,360,540,720,1280]),this.webRtcFrameWidth=this.registry.create("histogram",this.prom_prefix+"webrtc_frame_width_px","A histogram of frame width in pixels",[60,180,240,360,540,720,1280,1500,1920]),this.conversationRoundTripTime=this.registry.create("histogram",this.prom_prefix+"conversation_rtt_duration_seconds","A histogram of round trip time of a conversation",[.001,.005,.01,.03,.05,.1,.2,.5,.75,1,1.5,2,2.5,5,7.5,10]),this.metricsIntervalId=setInterval(()=>{this.sendMetrics()},1e4)}handleMessage(t){var e,n,r,i,s,a,c;const u=Object.assign(t.labels||{},{platform:"js"});switch(t.type){case o.SessionStart:this.sessionStartTime.observe(t.value,u);break;case o.QuestionMessageReceived:this.messageTimings.push(t.value);break;case o.AnswerMessageReceived:const h=this.calculateConversationRtt(t);h>0&&this.conversationRoundTripTime.observe(h,u);break;case o.WebRtcPerformance:const l=t.value;l.outboundQualityLimitationReason?u.qualityLimitationReason=null===(e=l.outboundQualityLimitationReason)||void 0===e?void 0:e.value:u.qualityLimitationReason="unknown",l.newFramesDropped&&this.webRtcFramesDropped.observe(null===(n=l.newFramesDropped)||void 0===n?void 0:n.value,u),l.framesPerSec&&this.webRtcInboundFramesPerSec.observe(null===(r=l.framesPerSec)||void 0===r?void 0:r.value,u),l.inboundNewPacketsLost&&this.webRtcInboundPacketsLost.observe(null===(i=l.inboundNewPacketsLost)||void 0===i?void 0:i.value,u),l.inboundRoundTripTime&&this.webRtcInboundRTT.observe(null===(s=l.inboundRoundTripTime)||void 0===s?void 0:s.value,u),l.frameHeight&&this.webRtcFrameHeight.observe(null===(a=l.frameHeight)||void 0===a?void 0:a.value,u),l.frameWidth&&this.webRtcFrameWidth.observe(null===(c=l.frameWidth)||void 0===c?void 0:c.value,u);break;case o.AvailabilityCheck:this.availabilityCheckTime.observe(t.value,u);break;case o.SessionEnded:this.stopSendingMetrics()}}calculateConversationRtt(t){if(t.value&&this.messageTimings){const e=this.messageTimings.find(e=>e.id===t.value.id);if(e){const n=e.receivedOn;if(n){const r=(t.value.receivedOn-n)/1e3;return this.messageTimings.splice(this.messageTimings.indexOf(e),1),r}}}return 0}sendMetrics(){this.metricsPushedCounter.inc({platform:"js"});const t=new Request(this.apiUrl+"/client-metrics",{method:"POST",body:this.registry.metrics(),mode:"no-cors"});fetch(t),this.registry.reset()}stopSendingMetrics(){this.metricsIntervalId&&clearInterval(this.metricsIntervalId)}}},function(t,e,n){"use strict";n.r(e),n.d(e,"audit",(function(){return o})),n.d(e,"auditTime",(function(){return h})),n.d(e,"buffer",(function(){return l})),n.d(e,"bufferCount",(function(){return v})),n.d(e,"bufferTime",(function(){return _})),n.d(e,"bufferToggle",(function(){return A})),n.d(e,"bufferWhen",(function(){return I})),n.d(e,"catchError",(function(){return j})),n.d(e,"combineAll",(function(){return B})),n.d(e,"combineLatest",(function(){return q})),n.d(e,"concat",(function(){return z})),n.d(e,"concatAll",(function(){return G.a})),n.d(e,"concatMap",(function(){return $})),n.d(e,"concatMapTo",(function(){return X})),n.d(e,"count",(function(){return K})),n.d(e,"debounce",(function(){return Q})),n.d(e,"debounceTime",(function(){return nt})),n.d(e,"defaultIfEmpty",(function(){return st})),n.d(e,"delay",(function(){return lt})),n.d(e,"delayWhen",(function(){return gt})),n.d(e,"dematerialize",(function(){return wt})),n.d(e,"distinct",(function(){return Tt})),n.d(e,"distinctUntilChanged",(function(){return Rt})),n.d(e,"distinctUntilKeyChanged",(function(){return At})),n.d(e,"elementAt",(function(){return Wt})),n.d(e,"endWith",(function(){return Ht})),n.d(e,"every",(function(){return zt})),n.d(e,"exhaust",(function(){return $t})),n.d(e,"exhaustMap",(function(){return Zt})),n.d(e,"expand",(function(){return ee})),n.d(e,"filter",(function(){return kt.a})),n.d(e,"finalize",(function(){return ie})),n.d(e,"find",(function(){return ae})),n.d(e,"findIndex",(function(){return he})),n.d(e,"first",(function(){return fe})),n.d(e,"groupBy",(function(){return de.b})),n.d(e,"ignoreElements",(function(){return pe})),n.d(e,"isEmpty",(function(){return me})),n.d(e,"last",(function(){return xe})),n.d(e,"map",(function(){return Jt.a})),n.d(e,"mapTo",(function(){return Te})),n.d(e,"materialize",(function(){return Re})),n.d(e,"max",(function(){return Ne})),n.d(e,"merge",(function(){return Le})),n.d(e,"mergeAll",(function(){return Ue.a})),n.d(e,"mergeMap",(function(){return Y.b})),n.d(e,"flatMap",(function(){return Y.a})),n.d(e,"mergeMapTo",(function(){return Fe})),n.d(e,"mergeScan",(function(){return Be})),n.d(e,"min",(function(){return qe})),n.d(e,"multicast",(function(){return ze})),n.d(e,"observeOn",(function(){return Ye.b})),n.d(e,"onErrorResumeNext",(function(){return $e})),n.d(e,"pairwise",(function(){return Je})),n.d(e,"partition",(function(){return en})),n.d(e,"pluck",(function(){return nn})),n.d(e,"publish",(function(){return sn})),n.d(e,"publishBehavior",(function(){return cn})),n.d(e,"publishLast",(function(){return hn})),n.d(e,"publishReplay",(function(){return fn})),n.d(e,"race",(function(){return pn})),n.d(e,"reduce",(function(){return De})),n.d(e,"repeat",(function(){return vn})),n.d(e,"repeatWhen",(function(){return yn})),n.d(e,"retry",(function(){return wn})),n.d(e,"retryWhen",(function(){return Tn})),n.d(e,"refCount",(function(){return Rn.a})),n.d(e,"sample",(function(){return Mn})),n.d(e,"sampleTime",(function(){return Pn})),n.d(e,"scan",(function(){return Ae})),n.d(e,"sequenceEqual",(function(){return Nn})),n.d(e,"share",(function(){return Bn})),n.d(e,"shareReplay",(function(){return Vn})),n.d(e,"single",(function(){return Wn})),n.d(e,"skip",(function(){return zn})),n.d(e,"skipLast",(function(){return $n})),n.d(e,"skipUntil",(function(){return Jn})),n.d(e,"skipWhile",(function(){return tr})),n.d(e,"startWith",(function(){return rr})),n.d(e,"subscribeOn",(function(){return ar})),n.d(e,"switchAll",(function(){return fr})),n.d(e,"switchMap",(function(){return ur})),n.d(e,"switchMapTo",(function(){return dr})),n.d(e,"take",(function(){return Ft})),n.d(e,"takeLast",(function(){return _e})),n.d(e,"takeUntil",(function(){return pr})),n.d(e,"takeWhile",(function(){return mr})),n.d(e,"tap",(function(){return Sr})),n.d(e,"throttle",(function(){return Er})),n.d(e,"throttleTime",(function(){return Or})),n.d(e,"throwIfEmpty",(function(){return Dt})),n.d(e,"timeInterval",(function(){return Dr})),n.d(e,"timeout",(function(){return Vr})),n.d(e,"timeoutWith",(function(){return Lr})),n.d(e,"timestamp",(function(){return Wr})),n.d(e,"toArray",(function(){return zr})),n.d(e,"window",(function(){return Gr})),n.d(e,"windowCount",(function(){return Xr})),n.d(e,"windowTime",(function(){return Zr})),n.d(e,"windowToggle",(function(){return oi})),n.d(e,"windowWhen",(function(){return ci})),n.d(e,"withLatestFrom",(function(){return li})),n.d(e,"zip",(function(){return vi})),n.d(e,"zipAll",(function(){return gi}));var r=n(0),i=n(2);function o(t){return function(e){return e.lift(new s(t))}}var s=function(){function t(t){this.durationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.durationSelector))},t}(),a=function(t){function e(e,n){var r=t.call(this,e)||this;return r.durationSelector=n,r.hasValue=!1,r}return r.a(e,t),e.prototype._next=function(t){if(this.value=t,this.hasValue=!0,!this.throttled){var e=void 0;try{e=(0,this.durationSelector)(t)}catch(t){return this.destination.error(t)}var n=Object(i.c)(e,new i.a(this));!n||n.closed?this.clearThrottle():this.add(this.throttled=n)}},e.prototype.clearThrottle=function(){var t=this.value,e=this.hasValue,n=this.throttled;n&&(this.remove(n),this.throttled=void 0,n.unsubscribe()),e&&(this.value=void 0,this.hasValue=!1,this.destination.next(t))},e.prototype.notifyNext=function(){this.clearThrottle()},e.prototype.notifyComplete=function(){this.clearThrottle()},e}(i.b),c=n(6),u=n(72);function h(t,e){return void 0===e&&(e=c.a),o((function(){return Object(u.a)(t,e)}))}function l(t){return function(e){return e.lift(new f(t))}}var f=function(){function t(t){this.closingNotifier=t}return t.prototype.call=function(t,e){return e.subscribe(new d(t,this.closingNotifier))},t}(),d=function(t){function e(e,n){var r=t.call(this,e)||this;return r.buffer=[],r.add(Object(i.c)(n,new i.a(r))),r}return r.a(e,t),e.prototype._next=function(t){this.buffer.push(t)},e.prototype.notifyNext=function(){var t=this.buffer;this.buffer=[],this.destination.next(t)},e}(i.b),p=n(1);function v(t,e){return void 0===e&&(e=null),function(n){return n.lift(new g(t,e))}}var g=function(){function t(t,e){this.bufferSize=t,this.startBufferEvery=e,this.subscriberClass=e&&t!==e?y:m}return t.prototype.call=function(t,e){return e.subscribe(new this.subscriberClass(t,this.bufferSize,this.startBufferEvery))},t}(),m=function(t){function e(e,n){var r=t.call(this,e)||this;return r.bufferSize=n,r.buffer=[],r}return r.a(e,t),e.prototype._next=function(t){var e=this.buffer;e.push(t),e.length==this.bufferSize&&(this.destination.next(e),this.buffer=[])},e.prototype._complete=function(){var e=this.buffer;e.length>0&&this.destination.next(e),t.prototype._complete.call(this)},e}(p.a),y=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.bufferSize=n,i.startBufferEvery=r,i.buffers=[],i.count=0,i}return r.a(e,t),e.prototype._next=function(t){var e=this.bufferSize,n=this.startBufferEvery,r=this.buffers,i=this.count;this.count++,i%n==0&&r.push([]);for(var o=r.length;o--;){var s=r[o];s.push(t),s.length===e&&(r.splice(o,1),this.destination.next(s))}},e.prototype._complete=function(){for(var e=this.buffers,n=this.destination;e.length>0;){var r=e.shift();r.length>0&&n.next(r)}t.prototype._complete.call(this)},e}(p.a),b=n(9);function _(t){var e=arguments.length,n=c.a;Object(b.a)(arguments[arguments.length-1])&&(n=arguments[arguments.length-1],e--);var r=null;e>=2&&(r=arguments[1]);var i=Number.POSITIVE_INFINITY;return e>=3&&(i=arguments[2]),function(e){return e.lift(new w(t,r,i,n))}}var w=function(){function t(t,e,n,r){this.bufferTimeSpan=t,this.bufferCreationInterval=e,this.maxBufferSize=n,this.scheduler=r}return t.prototype.call=function(t,e){return e.subscribe(new x(t,this.bufferTimeSpan,this.bufferCreationInterval,this.maxBufferSize,this.scheduler))},t}(),S=function(){return function(){this.buffer=[]}}(),x=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;s.bufferTimeSpan=n,s.bufferCreationInterval=r,s.maxBufferSize=i,s.scheduler=o,s.contexts=[];var a=s.openContext();if(s.timespanOnly=null==r||r<0,s.timespanOnly){var c={subscriber:s,context:a,bufferTimeSpan:n};s.add(a.closeAction=o.schedule(T,n,c))}else{var u={subscriber:s,context:a},h={bufferTimeSpan:n,bufferCreationInterval:r,subscriber:s,scheduler:o};s.add(a.closeAction=o.schedule(E,n,u)),s.add(o.schedule(C,r,h))}return s}return r.a(e,t),e.prototype._next=function(t){for(var e,n=this.contexts,r=n.length,i=0;i<r;i++){var o=n[i],s=o.buffer;s.push(t),s.length==this.maxBufferSize&&(e=o)}e&&this.onBufferFull(e)},e.prototype._error=function(e){this.contexts.length=0,t.prototype._error.call(this,e)},e.prototype._complete=function(){for(var e=this.contexts,n=this.destination;e.length>0;){var r=e.shift();n.next(r.buffer)}t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.contexts=null},e.prototype.onBufferFull=function(t){this.closeContext(t);var e=t.closeAction;if(e.unsubscribe(),this.remove(e),!this.closed&&this.timespanOnly){t=this.openContext();var n=this.bufferTimeSpan,r={subscriber:this,context:t,bufferTimeSpan:n};this.add(t.closeAction=this.scheduler.schedule(T,n,r))}},e.prototype.openContext=function(){var t=new S;return this.contexts.push(t),t},e.prototype.closeContext=function(t){this.destination.next(t.buffer);var e=this.contexts;(e?e.indexOf(t):-1)>=0&&e.splice(e.indexOf(t),1)},e}(p.a);function T(t){var e=t.subscriber,n=t.context;n&&e.closeContext(n),e.closed||(t.context=e.openContext(),t.context.closeAction=this.schedule(t,t.bufferTimeSpan))}function C(t){var e=t.bufferCreationInterval,n=t.bufferTimeSpan,r=t.subscriber,i=t.scheduler,o=r.openContext();r.closed||(r.add(o.closeAction=i.schedule(E,n,{subscriber:r,context:o})),this.schedule(t,e))}function E(t){var e=t.subscriber,n=t.context;e.closeContext(n)}var R=n(4),M=n(12),O=n(15);function A(t,e){return function(n){return n.lift(new P(t,e))}}var P=function(){function t(t,e){this.openings=t,this.closingSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new k(t,this.openings,this.closingSelector))},t}(),k=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.closingSelector=r,i.contexts=[],i.add(Object(M.a)(i,n)),i}return r.a(e,t),e.prototype._next=function(t){for(var e=this.contexts,n=e.length,r=0;r<n;r++)e[r].buffer.push(t)},e.prototype._error=function(e){for(var n=this.contexts;n.length>0;){var r=n.shift();r.subscription.unsubscribe(),r.buffer=null,r.subscription=null}this.contexts=null,t.prototype._error.call(this,e)},e.prototype._complete=function(){for(var e=this.contexts;e.length>0;){var n=e.shift();this.destination.next(n.buffer),n.subscription.unsubscribe(),n.buffer=null,n.subscription=null}this.contexts=null,t.prototype._complete.call(this)},e.prototype.notifyNext=function(t,e){t?this.closeBuffer(t):this.openBuffer(e)},e.prototype.notifyComplete=function(t){this.closeBuffer(t.context)},e.prototype.openBuffer=function(t){try{var e=this.closingSelector.call(this,t);e&&this.trySubscribe(e)}catch(t){this._error(t)}},e.prototype.closeBuffer=function(t){var e=this.contexts;if(e&&t){var n=t.buffer,r=t.subscription;this.destination.next(n),e.splice(e.indexOf(t),1),this.remove(r),r.unsubscribe()}},e.prototype.trySubscribe=function(t){var e=this.contexts,n=new R.a,r={buffer:[],subscription:n};e.push(r);var i=Object(M.a)(this,t,r);!i||i.closed?this.closeBuffer(r):(i.context=r,this.add(i),n.add(i))},e}(O.a);function I(t){return function(e){return e.lift(new D(t))}}var D=function(){function t(t){this.closingSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new N(t,this.closingSelector))},t}(),N=function(t){function e(e,n){var r=t.call(this,e)||this;return r.closingSelector=n,r.subscribing=!1,r.openBuffer(),r}return r.a(e,t),e.prototype._next=function(t){this.buffer.push(t)},e.prototype._complete=function(){var e=this.buffer;e&&this.destination.next(e),t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.buffer=void 0,this.subscribing=!1},e.prototype.notifyNext=function(){this.openBuffer()},e.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()},e.prototype.openBuffer=function(){var t=this.closingSubscription;t&&(this.remove(t),t.unsubscribe());var e,n=this.buffer;this.buffer&&this.destination.next(n),this.buffer=[];try{e=(0,this.closingSelector)()}catch(t){return this.error(t)}t=new R.a,this.closingSubscription=t,this.add(t),this.subscribing=!0,t.add(Object(i.c)(e,new i.a(this))),this.subscribing=!1},e}(i.b);function j(t){return function(e){var n=new L(t),r=e.lift(n);return n.caught=r}}var L=function(){function t(t){this.selector=t}return t.prototype.call=function(t,e){return e.subscribe(new U(t,this.selector,this.caught))},t}(),U=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.selector=n,i.caught=r,i}return r.a(e,t),e.prototype.error=function(e){if(!this.isStopped){var n=void 0;try{n=this.selector(e,this.caught)}catch(e){return void t.prototype.error.call(this,e)}this._unsubscribeAndRecycle();var r=new i.a(this);this.add(r);var o=Object(i.c)(n,r);o!==r&&this.add(o)}},e}(i.b),F=n(51);function B(t){return function(e){return e.lift(new F.a(t))}}var V=n(7),W=n(11);function q(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=null;return"function"==typeof t[t.length-1]&&(n=t.pop()),1===t.length&&Object(V.a)(t[0])&&(t=t[0].slice()),function(e){return e.lift.call(Object(W.a)([e].concat(t)),new F.a(n))}}var H=n(31);function z(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(H.a.apply(void 0,[e].concat(t)))}}var G=n(69),Y=n(25);function $(t,e){return Object(Y.b)(t,e,1)}function X(t,e){return $((function(){return t}),e)}function K(t){return function(e){return e.lift(new J(t,e))}}var J=function(){function t(t,e){this.predicate=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new Z(t,this.predicate,this.source))},t}(),Z=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.predicate=n,i.source=r,i.count=0,i.index=0,i}return r.a(e,t),e.prototype._next=function(t){this.predicate?this._tryPredicate(t):this.count++},e.prototype._tryPredicate=function(t){var e;try{e=this.predicate(t,this.index++,this.source)}catch(t){return void this.destination.error(t)}e&&this.count++},e.prototype._complete=function(){this.destination.next(this.count),this.destination.complete()},e}(p.a);function Q(t){return function(e){return e.lift(new tt(t))}}var tt=function(){function t(t){this.durationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new et(t,this.durationSelector))},t}(),et=function(t){function e(e,n){var r=t.call(this,e)||this;return r.durationSelector=n,r.hasValue=!1,r}return r.a(e,t),e.prototype._next=function(t){try{var e=this.durationSelector.call(this,t);e&&this._tryNext(t,e)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){this.emitValue(),this.destination.complete()},e.prototype._tryNext=function(t,e){var n=this.durationSubscription;this.value=t,this.hasValue=!0,n&&(n.unsubscribe(),this.remove(n)),(n=Object(i.c)(e,new i.a(this)))&&!n.closed&&this.add(this.durationSubscription=n)},e.prototype.notifyNext=function(){this.emitValue()},e.prototype.notifyComplete=function(){this.emitValue()},e.prototype.emitValue=function(){if(this.hasValue){var e=this.value,n=this.durationSubscription;n&&(this.durationSubscription=void 0,n.unsubscribe(),this.remove(n)),this.value=void 0,this.hasValue=!1,t.prototype._next.call(this,e)}},e}(i.b);function nt(t,e){return void 0===e&&(e=c.a),function(n){return n.lift(new rt(t,e))}}var rt=function(){function t(t,e){this.dueTime=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new it(t,this.dueTime,this.scheduler))},t}(),it=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.dueTime=n,i.scheduler=r,i.debouncedSubscription=null,i.lastValue=null,i.hasValue=!1,i}return r.a(e,t),e.prototype._next=function(t){this.clearDebounce(),this.lastValue=t,this.hasValue=!0,this.add(this.debouncedSubscription=this.scheduler.schedule(ot,this.dueTime,this))},e.prototype._complete=function(){this.debouncedNext(),this.destination.complete()},e.prototype.debouncedNext=function(){if(this.clearDebounce(),this.hasValue){var t=this.lastValue;this.lastValue=null,this.hasValue=!1,this.destination.next(t)}},e.prototype.clearDebounce=function(){var t=this.debouncedSubscription;null!==t&&(this.remove(t),t.unsubscribe(),this.debouncedSubscription=null)},e}(p.a);function ot(t){t.debouncedNext()}function st(t){return void 0===t&&(t=null),function(e){return e.lift(new at(t))}}var at=function(){function t(t){this.defaultValue=t}return t.prototype.call=function(t,e){return e.subscribe(new ct(t,this.defaultValue))},t}(),ct=function(t){function e(e,n){var r=t.call(this,e)||this;return r.defaultValue=n,r.isEmpty=!0,r}return r.a(e,t),e.prototype._next=function(t){this.isEmpty=!1,this.destination.next(t)},e.prototype._complete=function(){this.isEmpty&&this.destination.next(this.defaultValue),this.destination.complete()},e}(p.a);function ut(t){return t instanceof Date&&!isNaN(+t)}var ht=n(17);function lt(t,e){void 0===e&&(e=c.a);var n=ut(t)?+t-e.now():Math.abs(t);return function(t){return t.lift(new ft(n,e))}}var ft=function(){function t(t,e){this.delay=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new dt(t,this.delay,this.scheduler))},t}(),dt=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.delay=n,i.scheduler=r,i.queue=[],i.active=!1,i.errored=!1,i}return r.a(e,t),e.dispatch=function(t){for(var e=t.source,n=e.queue,r=t.scheduler,i=t.destination;n.length>0&&n[0].time-r.now()<=0;)n.shift().notification.observe(i);if(n.length>0){var o=Math.max(0,n[0].time-r.now());this.schedule(t,o)}else this.unsubscribe(),e.active=!1},e.prototype._schedule=function(t){this.active=!0,this.destination.add(t.schedule(e.dispatch,this.delay,{source:this,destination:this.destination,scheduler:t}))},e.prototype.scheduleNotification=function(t){if(!0!==this.errored){var e=this.scheduler,n=new pt(e.now()+this.delay,t);this.queue.push(n),!1===this.active&&this._schedule(e)}},e.prototype._next=function(t){this.scheduleNotification(ht.a.createNext(t))},e.prototype._error=function(t){this.errored=!0,this.queue=[],this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.scheduleNotification(ht.a.createComplete()),this.unsubscribe()},e}(p.a),pt=function(){return function(t,e){this.time=t,this.notification=e}}(),vt=n(3);function gt(t,e){return e?function(n){return new bt(n,e).lift(new mt(t))}:function(e){return e.lift(new mt(t))}}var mt=function(){function t(t){this.delayDurationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new yt(t,this.delayDurationSelector))},t}(),yt=function(t){function e(e,n){var r=t.call(this,e)||this;return r.delayDurationSelector=n,r.completed=!1,r.delayNotifierSubscriptions=[],r.index=0,r}return r.a(e,t),e.prototype.notifyNext=function(t,e,n,r,i){this.destination.next(t),this.removeSubscription(i),this.tryComplete()},e.prototype.notifyError=function(t,e){this._error(t)},e.prototype.notifyComplete=function(t){var e=this.removeSubscription(t);e&&this.destination.next(e),this.tryComplete()},e.prototype._next=function(t){var e=this.index++;try{var n=this.delayDurationSelector(t,e);n&&this.tryDelay(n,t)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){this.completed=!0,this.tryComplete(),this.unsubscribe()},e.prototype.removeSubscription=function(t){t.unsubscribe();var e=this.delayNotifierSubscriptions.indexOf(t);return-1!==e&&this.delayNotifierSubscriptions.splice(e,1),t.outerValue},e.prototype.tryDelay=function(t,e){var n=Object(M.a)(this,t,e);n&&!n.closed&&(this.destination.add(n),this.delayNotifierSubscriptions.push(n))},e.prototype.tryComplete=function(){this.completed&&0===this.delayNotifierSubscriptions.length&&this.destination.complete()},e}(O.a),bt=function(t){function e(e,n){var r=t.call(this)||this;return r.source=e,r.subscriptionDelay=n,r}return r.a(e,t),e.prototype._subscribe=function(t){this.subscriptionDelay.subscribe(new _t(t,this.source))},e}(vt.a),_t=function(t){function e(e,n){var r=t.call(this)||this;return r.parent=e,r.source=n,r.sourceSubscribed=!1,r}return r.a(e,t),e.prototype._next=function(t){this.subscribeToSource()},e.prototype._error=function(t){this.unsubscribe(),this.parent.error(t)},e.prototype._complete=function(){this.unsubscribe(),this.subscribeToSource()},e.prototype.subscribeToSource=function(){this.sourceSubscribed||(this.sourceSubscribed=!0,this.unsubscribe(),this.source.subscribe(this.parent))},e}(p.a);function wt(){return function(t){return t.lift(new St)}}var St=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new xt(t))},t}(),xt=function(t){function e(e){return t.call(this,e)||this}return r.a(e,t),e.prototype._next=function(t){t.observe(this.destination)},e}(p.a);function Tt(t,e){return function(n){return n.lift(new Ct(t,e))}}var Ct=function(){function t(t,e){this.keySelector=t,this.flushes=e}return t.prototype.call=function(t,e){return e.subscribe(new Et(t,this.keySelector,this.flushes))},t}(),Et=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.keySelector=n,o.values=new Set,r&&o.add(Object(i.c)(r,new i.a(o))),o}return r.a(e,t),e.prototype.notifyNext=function(){this.values.clear()},e.prototype.notifyError=function(t){this._error(t)},e.prototype._next=function(t){this.keySelector?this._useKeySelector(t):this._finalizeNext(t,t)},e.prototype._useKeySelector=function(t){var e,n=this.destination;try{e=this.keySelector(t)}catch(t){return void n.error(t)}this._finalizeNext(e,t)},e.prototype._finalizeNext=function(t,e){var n=this.values;n.has(t)||(n.add(t),this.destination.next(e))},e}(i.b);function Rt(t,e){return function(n){return n.lift(new Mt(t,e))}}var Mt=function(){function t(t,e){this.compare=t,this.keySelector=e}return t.prototype.call=function(t,e){return e.subscribe(new Ot(t,this.compare,this.keySelector))},t}(),Ot=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.keySelector=r,i.hasKey=!1,"function"==typeof n&&(i.compare=n),i}return r.a(e,t),e.prototype.compare=function(t,e){return t===e},e.prototype._next=function(t){var e;try{var n=this.keySelector;e=n?n(t):t}catch(t){return this.destination.error(t)}var r=!1;if(this.hasKey)try{r=(0,this.compare)(this.key,e)}catch(t){return this.destination.error(t)}else this.hasKey=!0;r||(this.key=e,this.destination.next(t))},e}(p.a);function At(t,e){return Rt((function(n,r){return e?e(n[t],r[t]):n[t]===r[t]}))}var Pt=n(22),kt=n(16),It=n(24);function Dt(t){return void 0===t&&(t=Lt),function(e){return e.lift(new Nt(t))}}var Nt=function(){function t(t){this.errorFactory=t}return t.prototype.call=function(t,e){return e.subscribe(new jt(t,this.errorFactory))},t}(),jt=function(t){function e(e,n){var r=t.call(this,e)||this;return r.errorFactory=n,r.hasValue=!1,r}return r.a(e,t),e.prototype._next=function(t){this.hasValue=!0,this.destination.next(t)},e.prototype._complete=function(){if(this.hasValue)return this.destination.complete();var t=void 0;try{t=this.errorFactory()}catch(e){t=e}this.destination.error(t)},e}(p.a);function Lt(){return new It.a}var Ut=n(10);function Ft(t){return function(e){return 0===t?Object(Ut.b)():e.lift(new Bt(t))}}var Bt=function(){function t(t){if(this.total=t,this.total<0)throw new Pt.a}return t.prototype.call=function(t,e){return e.subscribe(new Vt(t,this.total))},t}(),Vt=function(t){function e(e,n){var r=t.call(this,e)||this;return r.total=n,r.count=0,r}return r.a(e,t),e.prototype._next=function(t){var e=this.total,n=++this.count;n<=e&&(this.destination.next(t),n===e&&(this.destination.complete(),this.unsubscribe()))},e}(p.a);function Wt(t,e){if(t<0)throw new Pt.a;var n=arguments.length>=2;return function(r){return r.pipe(Object(kt.a)((function(e,n){return n===t})),Ft(1),n?st(e):Dt((function(){return new Pt.a})))}}var qt=n(36);function Ht(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return Object(H.a)(e,qt.a.apply(void 0,t))}}function zt(t,e){return function(n){return n.lift(new Gt(t,e,n))}}var Gt=function(){function t(t,e,n){this.predicate=t,this.thisArg=e,this.source=n}return t.prototype.call=function(t,e){return e.subscribe(new Yt(t,this.predicate,this.thisArg,this.source))},t}(),Yt=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.predicate=n,o.thisArg=r,o.source=i,o.index=0,o.thisArg=r||o,o}return r.a(e,t),e.prototype.notifyComplete=function(t){this.destination.next(t),this.destination.complete()},e.prototype._next=function(t){var e=!1;try{e=this.predicate.call(this.thisArg,t,this.index++,this.source)}catch(t){return void this.destination.error(t)}e||this.notifyComplete(!1)},e.prototype._complete=function(){this.notifyComplete(!0)},e}(p.a);function $t(){return function(t){return t.lift(new Xt)}}var Xt=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Kt(t))},t}(),Kt=function(t){function e(e){var n=t.call(this,e)||this;return n.hasCompleted=!1,n.hasSubscription=!1,n}return r.a(e,t),e.prototype._next=function(t){this.hasSubscription||(this.hasSubscription=!0,this.add(Object(i.c)(t,new i.a(this))))},e.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete()},e.prototype.notifyComplete=function(){this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},e}(i.b),Jt=n(8);function Zt(t,e){return e?function(n){return n.pipe(Zt((function(n,r){return Object(W.a)(t(n,r)).pipe(Object(Jt.a)((function(t,i){return e(n,t,r,i)})))})))}:function(e){return e.lift(new Qt(t))}}var Qt=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e.subscribe(new te(t,this.project))},t}(),te=function(t){function e(e,n){var r=t.call(this,e)||this;return r.project=n,r.hasSubscription=!1,r.hasCompleted=!1,r.index=0,r}return r.a(e,t),e.prototype._next=function(t){this.hasSubscription||this.tryNext(t)},e.prototype.tryNext=function(t){var e,n=this.index++;try{e=this.project(t,n)}catch(t){return void this.destination.error(t)}this.hasSubscription=!0,this._innerSub(e)},e.prototype._innerSub=function(t){var e=new i.a(this),n=this.destination;n.add(e);var r=Object(i.c)(t,e);r!==e&&n.add(r)},e.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyError=function(t){this.destination.error(t)},e.prototype.notifyComplete=function(){this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},e}(i.b);function ee(t,e,n){return void 0===e&&(e=Number.POSITIVE_INFINITY),e=(e||0)<1?Number.POSITIVE_INFINITY:e,function(r){return r.lift(new ne(t,e,n))}}var ne=function(){function t(t,e,n){this.project=t,this.concurrent=e,this.scheduler=n}return t.prototype.call=function(t,e){return e.subscribe(new re(t,this.project,this.concurrent,this.scheduler))},t}(),re=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.project=n,o.concurrent=r,o.scheduler=i,o.index=0,o.active=0,o.hasCompleted=!1,r<Number.POSITIVE_INFINITY&&(o.buffer=[]),o}return r.a(e,t),e.dispatch=function(t){var e=t.subscriber,n=t.result,r=t.value,i=t.index;e.subscribeToProjection(n,r,i)},e.prototype._next=function(t){var n=this.destination;if(n.closed)this._complete();else{var r=this.index++;if(this.active<this.concurrent){n.next(t);try{var i=(0,this.project)(t,r);if(this.scheduler){var o={subscriber:this,result:i,value:t,index:r};this.destination.add(this.scheduler.schedule(e.dispatch,0,o))}else this.subscribeToProjection(i,t,r)}catch(t){n.error(t)}}else this.buffer.push(t)}},e.prototype.subscribeToProjection=function(t,e,n){this.active++,this.destination.add(Object(i.c)(t,new i.a(this)))},e.prototype._complete=function(){this.hasCompleted=!0,this.hasCompleted&&0===this.active&&this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t){this._next(t)},e.prototype.notifyComplete=function(){var t=this.buffer;this.active--,t&&t.length>0&&this._next(t.shift()),this.hasCompleted&&0===this.active&&this.destination.complete()},e}(i.b);function ie(t){return function(e){return e.lift(new oe(t))}}var oe=function(){function t(t){this.callback=t}return t.prototype.call=function(t,e){return e.subscribe(new se(t,this.callback))},t}(),se=function(t){function e(e,n){var r=t.call(this,e)||this;return r.add(new R.a(n)),r}return r.a(e,t),e}(p.a);function ae(t,e){if("function"!=typeof t)throw new TypeError("predicate is not a function");return function(n){return n.lift(new ce(t,n,!1,e))}}var ce=function(){function t(t,e,n,r){this.predicate=t,this.source=e,this.yieldIndex=n,this.thisArg=r}return t.prototype.call=function(t,e){return e.subscribe(new ue(t,this.predicate,this.source,this.yieldIndex,this.thisArg))},t}(),ue=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;return s.predicate=n,s.source=r,s.yieldIndex=i,s.thisArg=o,s.index=0,s}return r.a(e,t),e.prototype.notifyComplete=function(t){var e=this.destination;e.next(t),e.complete(),this.unsubscribe()},e.prototype._next=function(t){var e=this.predicate,n=this.thisArg,r=this.index++;try{e.call(n||this,t,r,this.source)&&this.notifyComplete(this.yieldIndex?r:t)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){this.notifyComplete(this.yieldIndex?-1:void 0)},e}(p.a);function he(t,e){return function(n){return n.lift(new ce(t,n,!0,e))}}var le=n(14);function fe(t,e){var n=arguments.length>=2;return function(r){return r.pipe(t?Object(kt.a)((function(e,n){return t(e,n,r)})):le.a,Ft(1),n?st(e):Dt((function(){return new It.a})))}}var de=n(62);function pe(){return function(t){return t.lift(new ve)}}var ve=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new ge(t))},t}(),ge=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.a(e,t),e.prototype._next=function(t){},e}(p.a);function me(){return function(t){return t.lift(new ye)}}var ye=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new be(t))},t}(),be=function(t){function e(e){return t.call(this,e)||this}return r.a(e,t),e.prototype.notifyComplete=function(t){var e=this.destination;e.next(t),e.complete()},e.prototype._next=function(t){this.notifyComplete(!1)},e.prototype._complete=function(){this.notifyComplete(!0)},e}(p.a);function _e(t){return function(e){return 0===t?Object(Ut.b)():e.lift(new we(t))}}var we=function(){function t(t){if(this.total=t,this.total<0)throw new Pt.a}return t.prototype.call=function(t,e){return e.subscribe(new Se(t,this.total))},t}(),Se=function(t){function e(e,n){var r=t.call(this,e)||this;return r.total=n,r.ring=new Array,r.count=0,r}return r.a(e,t),e.prototype._next=function(t){var e=this.ring,n=this.total,r=this.count++;e.length<n?e.push(t):e[r%n]=t},e.prototype._complete=function(){var t=this.destination,e=this.count;if(e>0)for(var n=this.count>=this.total?this.total:this.count,r=this.ring,i=0;i<n;i++){var o=e++%n;t.next(r[o])}t.complete()},e}(p.a);function xe(t,e){var n=arguments.length>=2;return function(r){return r.pipe(t?Object(kt.a)((function(e,n){return t(e,n,r)})):le.a,_e(1),n?st(e):Dt((function(){return new It.a})))}}function Te(t){return function(e){return e.lift(new Ce(t))}}var Ce=function(){function t(t){this.value=t}return t.prototype.call=function(t,e){return e.subscribe(new Ee(t,this.value))},t}(),Ee=function(t){function e(e,n){var r=t.call(this,e)||this;return r.value=n,r}return r.a(e,t),e.prototype._next=function(t){this.destination.next(this.value)},e}(p.a);function Re(){return function(t){return t.lift(new Me)}}var Me=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Oe(t))},t}(),Oe=function(t){function e(e){return t.call(this,e)||this}return r.a(e,t),e.prototype._next=function(t){this.destination.next(ht.a.createNext(t))},e.prototype._error=function(t){var e=this.destination;e.next(ht.a.createError(t)),e.complete()},e.prototype._complete=function(){var t=this.destination;t.next(ht.a.createComplete()),t.complete()},e}(p.a);function Ae(t,e){var n=!1;return arguments.length>=2&&(n=!0),function(r){return r.lift(new Pe(t,e,n))}}var Pe=function(){function t(t,e,n){void 0===n&&(n=!1),this.accumulator=t,this.seed=e,this.hasSeed=n}return t.prototype.call=function(t,e){return e.subscribe(new ke(t,this.accumulator,this.seed,this.hasSeed))},t}(),ke=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.accumulator=n,o._seed=r,o.hasSeed=i,o.index=0,o}return r.a(e,t),Object.defineProperty(e.prototype,"seed",{get:function(){return this._seed},set:function(t){this.hasSeed=!0,this._seed=t},enumerable:!0,configurable:!0}),e.prototype._next=function(t){if(this.hasSeed)return this._tryNext(t);this.seed=t,this.destination.next(t)},e.prototype._tryNext=function(t){var e,n=this.index++;try{e=this.accumulator(this.seed,t,n)}catch(t){this.destination.error(t)}this.seed=e,this.destination.next(e)},e}(p.a),Ie=n(39);function De(t,e){return arguments.length>=2?function(n){return Object(Ie.a)(Ae(t,e),_e(1),st(e))(n)}:function(e){return Object(Ie.a)(Ae((function(e,n,r){return t(e,n,r+1)})),_e(1))(e)}}function Ne(t){return De("function"==typeof t?function(e,n){return t(e,n)>0?e:n}:function(t,e){return t>e?t:e})}var je=n(70);function Le(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(je.a.apply(void 0,[e].concat(t)))}}var Ue=n(52);function Fe(t,e,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),"function"==typeof e?Object(Y.b)((function(){return t}),e,n):("number"==typeof e&&(n=e),Object(Y.b)((function(){return t}),n))}function Be(t,e,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),function(r){return r.lift(new Ve(t,e,n))}}var Ve=function(){function t(t,e,n){this.accumulator=t,this.seed=e,this.concurrent=n}return t.prototype.call=function(t,e){return e.subscribe(new We(t,this.accumulator,this.seed,this.concurrent))},t}(),We=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.accumulator=n,o.acc=r,o.concurrent=i,o.hasValue=!1,o.hasCompleted=!1,o.buffer=[],o.active=0,o.index=0,o}return r.a(e,t),e.prototype._next=function(t){if(this.active<this.concurrent){var e=this.index++,n=this.destination,r=void 0;try{r=(0,this.accumulator)(this.acc,t,e)}catch(t){return n.error(t)}this.active++,this._innerSub(r)}else this.buffer.push(t)},e.prototype._innerSub=function(t){var e=new i.a(this),n=this.destination;n.add(e);var r=Object(i.c)(t,e);r!==e&&n.add(r)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete()),this.unsubscribe()},e.prototype.notifyNext=function(t){var e=this.destination;this.acc=t,this.hasValue=!0,e.next(t)},e.prototype.notifyComplete=function(){var t=this.buffer;this.active--,t.length>0?this._next(t.shift()):0===this.active&&this.hasCompleted&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete())},e}(i.b);function qe(t){return De("function"==typeof t?function(e,n){return t(e,n)<0?e:n}:function(t,e){return t<e?t:e})}var He=n(65);function ze(t,e){return function(n){var r;if(r="function"==typeof t?t:function(){return t},"function"==typeof e)return n.lift(new Ge(r,e));var i=Object.create(n,He.b);return i.source=n,i.subjectFactory=r,i}}var Ge=function(){function t(t,e){this.subjectFactory=t,this.selector=e}return t.prototype.call=function(t,e){var n=this.selector,r=this.subjectFactory(),i=n(r).subscribe(t);return i.add(e.subscribe(r)),i},t}(),Ye=n(67);function $e(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 1===t.length&&Object(V.a)(t[0])&&(t=t[0]),function(e){return e.lift(new Xe(t))}}var Xe=function(){function t(t){this.nextSources=t}return t.prototype.call=function(t,e){return e.subscribe(new Ke(t,this.nextSources))},t}(),Ke=function(t){function e(e,n){var r=t.call(this,e)||this;return r.destination=e,r.nextSources=n,r}return r.a(e,t),e.prototype.notifyError=function(){this.subscribeToNextSource()},e.prototype.notifyComplete=function(){this.subscribeToNextSource()},e.prototype._error=function(t){this.subscribeToNextSource(),this.unsubscribe()},e.prototype._complete=function(){this.subscribeToNextSource(),this.unsubscribe()},e.prototype.subscribeToNextSource=function(){var t=this.nextSources.shift();if(t){var e=new i.a(this),n=this.destination;n.add(e);var r=Object(i.c)(t,e);r!==e&&n.add(r)}else this.destination.complete()},e}(i.b);function Je(){return function(t){return t.lift(new Ze)}}var Ze=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Qe(t))},t}(),Qe=function(t){function e(e){var n=t.call(this,e)||this;return n.hasPrev=!1,n}return r.a(e,t),e.prototype._next=function(t){var e;this.hasPrev?e=[this.prev,t]:this.hasPrev=!0,this.prev=t,e&&this.destination.next(e)},e}(p.a),tn=n(78);function en(t,e){return function(n){return[Object(kt.a)(t,e)(n),Object(kt.a)(Object(tn.a)(t,e))(n)]}}function nn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t.length;if(0===n)throw new Error("list of properties cannot be empty.");return function(e){return Object(Jt.a)(rn(t,n))(e)}}function rn(t,e){return function(n){for(var r=n,i=0;i<e;i++){var o=null!=r?r[t[i]]:void 0;if(void 0===o)return;r=o}return r}}var on=n(5);function sn(t){return t?ze((function(){return new on.a}),t):ze(new on.a)}var an=n(66);function cn(t){return function(e){return ze(new an.a(t))(e)}}var un=n(28);function hn(){return function(t){return ze(new un.a)(t)}}var ln=n(49);function fn(t,e,n,r){n&&"function"!=typeof n&&(r=n);var i="function"==typeof n?n:void 0,o=new ln.a(t,e,r);return function(t){return ze((function(){return o}),i)(t)}}var dn=n(71);function pn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return 1===t.length&&Object(V.a)(t[0])&&(t=t[0]),e.lift.call(dn.a.apply(void 0,[e].concat(t)))}}function vn(t){return void 0===t&&(t=-1),function(e){return 0===t?Object(Ut.b)():t<0?e.lift(new gn(-1,e)):e.lift(new gn(t-1,e))}}var gn=function(){function t(t,e){this.count=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new mn(t,this.count,this.source))},t}(),mn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.count=n,i.source=r,i}return r.a(e,t),e.prototype.complete=function(){if(!this.isStopped){var e=this.source,n=this.count;if(0===n)return t.prototype.complete.call(this);n>-1&&(this.count=n-1),e.subscribe(this._unsubscribeAndRecycle())}},e}(p.a);function yn(t){return function(e){return e.lift(new bn(t))}}var bn=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new _n(t,this.notifier,e))},t}(),_n=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.notifier=n,i.source=r,i.sourceIsBeingSubscribedTo=!0,i}return r.a(e,t),e.prototype.notifyNext=function(){this.sourceIsBeingSubscribedTo=!0,this.source.subscribe(this)},e.prototype.notifyComplete=function(){if(!1===this.sourceIsBeingSubscribedTo)return t.prototype.complete.call(this)},e.prototype.complete=function(){if(this.sourceIsBeingSubscribedTo=!1,!this.isStopped){if(this.retries||this.subscribeToRetries(),!this.retriesSubscription||this.retriesSubscription.closed)return t.prototype.complete.call(this);this._unsubscribeAndRecycle(),this.notifications.next(void 0)}},e.prototype._unsubscribe=function(){var t=this.notifications,e=this.retriesSubscription;t&&(t.unsubscribe(),this.notifications=void 0),e&&(e.unsubscribe(),this.retriesSubscription=void 0),this.retries=void 0},e.prototype._unsubscribeAndRecycle=function(){var e=this._unsubscribe;return this._unsubscribe=null,t.prototype._unsubscribeAndRecycle.call(this),this._unsubscribe=e,this},e.prototype.subscribeToRetries=function(){var e;this.notifications=new on.a;try{e=(0,this.notifier)(this.notifications)}catch(e){return t.prototype.complete.call(this)}this.retries=e,this.retriesSubscription=Object(i.c)(e,new i.a(this))},e}(i.b);function wn(t){return void 0===t&&(t=-1),function(e){return e.lift(new Sn(t,e))}}var Sn=function(){function t(t,e){this.count=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new xn(t,this.count,this.source))},t}(),xn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.count=n,i.source=r,i}return r.a(e,t),e.prototype.error=function(e){if(!this.isStopped){var n=this.source,r=this.count;if(0===r)return t.prototype.error.call(this,e);r>-1&&(this.count=r-1),n.subscribe(this._unsubscribeAndRecycle())}},e}(p.a);function Tn(t){return function(e){return e.lift(new Cn(t,e))}}var Cn=function(){function t(t,e){this.notifier=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new En(t,this.notifier,this.source))},t}(),En=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.notifier=n,i.source=r,i}return r.a(e,t),e.prototype.error=function(e){if(!this.isStopped){var n=this.errors,r=this.retries,o=this.retriesSubscription;if(r)this.errors=void 0,this.retriesSubscription=void 0;else{n=new on.a;try{r=(0,this.notifier)(n)}catch(e){return t.prototype.error.call(this,e)}o=Object(i.c)(r,new i.a(this))}this._unsubscribeAndRecycle(),this.errors=n,this.retries=r,this.retriesSubscription=o,n.next(e)}},e.prototype._unsubscribe=function(){var t=this.errors,e=this.retriesSubscription;t&&(t.unsubscribe(),this.errors=void 0),e&&(e.unsubscribe(),this.retriesSubscription=void 0),this.retries=void 0},e.prototype.notifyNext=function(){var t=this._unsubscribe;this._unsubscribe=null,this._unsubscribeAndRecycle(),this._unsubscribe=t,this.source.subscribe(this)},e}(i.b),Rn=n(48);function Mn(t){return function(e){return e.lift(new On(t))}}var On=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){var n=new An(t),r=e.subscribe(n);return r.add(Object(i.c)(this.notifier,new i.a(n))),r},t}(),An=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.hasValue=!1,e}return r.a(e,t),e.prototype._next=function(t){this.value=t,this.hasValue=!0},e.prototype.notifyNext=function(){this.emitValue()},e.prototype.notifyComplete=function(){this.emitValue()},e.prototype.emitValue=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.value))},e}(i.b);function Pn(t,e){return void 0===e&&(e=c.a),function(n){return n.lift(new kn(t,e))}}var kn=function(){function t(t,e){this.period=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new In(t,this.period,this.scheduler))},t}(),In=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.period=n,i.scheduler=r,i.hasValue=!1,i.add(r.schedule(Dn,n,{subscriber:i,period:n})),i}return r.a(e,t),e.prototype._next=function(t){this.lastValue=t,this.hasValue=!0},e.prototype.notifyNext=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.lastValue))},e}(p.a);function Dn(t){var e=t.subscriber,n=t.period;e.notifyNext(),this.schedule(t,n)}function Nn(t,e){return function(n){return n.lift(new jn(t,e))}}var jn=function(){function t(t,e){this.compareTo=t,this.comparator=e}return t.prototype.call=function(t,e){return e.subscribe(new Ln(t,this.compareTo,this.comparator))},t}(),Ln=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.compareTo=n,i.comparator=r,i._a=[],i._b=[],i._oneComplete=!1,i.destination.add(n.subscribe(new Un(e,i))),i}return r.a(e,t),e.prototype._next=function(t){this._oneComplete&&0===this._b.length?this.emit(!1):(this._a.push(t),this.checkValues())},e.prototype._complete=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0,this.unsubscribe()},e.prototype.checkValues=function(){for(var t=this._a,e=this._b,n=this.comparator;t.length>0&&e.length>0;){var r=t.shift(),i=e.shift(),o=!1;try{o=n?n(r,i):r===i}catch(t){this.destination.error(t)}o||this.emit(!1)}},e.prototype.emit=function(t){var e=this.destination;e.next(t),e.complete()},e.prototype.nextB=function(t){this._oneComplete&&0===this._a.length?this.emit(!1):(this._b.push(t),this.checkValues())},e.prototype.completeB=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0},e}(p.a),Un=function(t){function e(e,n){var r=t.call(this,e)||this;return r.parent=n,r}return r.a(e,t),e.prototype._next=function(t){this.parent.nextB(t)},e.prototype._error=function(t){this.parent.error(t),this.unsubscribe()},e.prototype._complete=function(){this.parent.completeB(),this.unsubscribe()},e}(p.a);function Fn(){return new on.a}function Bn(){return function(t){return Object(Rn.a)()(ze(Fn)(t))}}function Vn(t,e,n){var r;return r=t&&"object"==typeof t?t:{bufferSize:t,windowTime:e,refCount:!1,scheduler:n},function(t){return t.lift(function(t){var e,n,r=t.bufferSize,i=void 0===r?Number.POSITIVE_INFINITY:r,o=t.windowTime,s=void 0===o?Number.POSITIVE_INFINITY:o,a=t.refCount,c=t.scheduler,u=0,h=!1,l=!1;return function(t){var r;u++,!e||h?(h=!1,e=new ln.a(i,s,c),r=e.subscribe(this),n=t.subscribe({next:function(t){e.next(t)},error:function(t){h=!0,e.error(t)},complete:function(){l=!0,n=void 0,e.complete()}}),l&&(n=void 0)):r=e.subscribe(this),this.add((function(){u--,r.unsubscribe(),r=void 0,n&&!l&&a&&0===u&&(n.unsubscribe(),n=void 0,e=void 0)}))}}(r))}}function Wn(t){return function(e){return e.lift(new qn(t,e))}}var qn=function(){function t(t,e){this.predicate=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new Hn(t,this.predicate,this.source))},t}(),Hn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.predicate=n,i.source=r,i.seenValue=!1,i.index=0,i}return r.a(e,t),e.prototype.applySingleValue=function(t){this.seenValue?this.destination.error("Sequence contains more than one element"):(this.seenValue=!0,this.singleValue=t)},e.prototype._next=function(t){var e=this.index++;this.predicate?this.tryNext(t,e):this.applySingleValue(t)},e.prototype.tryNext=function(t,e){try{this.predicate(t,e,this.source)&&this.applySingleValue(t)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){var t=this.destination;this.index>0?(t.next(this.seenValue?this.singleValue:void 0),t.complete()):t.error(new It.a)},e}(p.a);function zn(t){return function(e){return e.lift(new Gn(t))}}var Gn=function(){function t(t){this.total=t}return t.prototype.call=function(t,e){return e.subscribe(new Yn(t,this.total))},t}(),Yn=function(t){function e(e,n){var r=t.call(this,e)||this;return r.total=n,r.count=0,r}return r.a(e,t),e.prototype._next=function(t){++this.count>this.total&&this.destination.next(t)},e}(p.a);function $n(t){return function(e){return e.lift(new Xn(t))}}var Xn=function(){function t(t){if(this._skipCount=t,this._skipCount<0)throw new Pt.a}return t.prototype.call=function(t,e){return 0===this._skipCount?e.subscribe(new p.a(t)):e.subscribe(new Kn(t,this._skipCount))},t}(),Kn=function(t){function e(e,n){var r=t.call(this,e)||this;return r._skipCount=n,r._count=0,r._ring=new Array(n),r}return r.a(e,t),e.prototype._next=function(t){var e=this._skipCount,n=this._count++;if(n<e)this._ring[n]=t;else{var r=n%e,i=this._ring,o=i[r];i[r]=t,this.destination.next(o)}},e}(p.a);function Jn(t){return function(e){return e.lift(new Zn(t))}}var Zn=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new Qn(t,this.notifier))},t}(),Qn=function(t){function e(e,n){var r=t.call(this,e)||this;r.hasValue=!1;var o=new i.a(r);r.add(o),r.innerSubscription=o;var s=Object(i.c)(n,o);return s!==o&&(r.add(s),r.innerSubscription=s),r}return r.a(e,t),e.prototype._next=function(e){this.hasValue&&t.prototype._next.call(this,e)},e.prototype.notifyNext=function(){this.hasValue=!0,this.innerSubscription&&this.innerSubscription.unsubscribe()},e.prototype.notifyComplete=function(){},e}(i.b);function tr(t){return function(e){return e.lift(new er(t))}}var er=function(){function t(t){this.predicate=t}return t.prototype.call=function(t,e){return e.subscribe(new nr(t,this.predicate))},t}(),nr=function(t){function e(e,n){var r=t.call(this,e)||this;return r.predicate=n,r.skipping=!0,r.index=0,r}return r.a(e,t),e.prototype._next=function(t){var e=this.destination;this.skipping&&this.tryCallPredicate(t),this.skipping||e.next(t)},e.prototype.tryCallPredicate=function(t){try{var e=this.predicate(t,this.index++);this.skipping=Boolean(e)}catch(t){this.destination.error(t)}},e}(p.a);function rr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[t.length-1];return Object(b.a)(n)?(t.pop(),function(e){return Object(H.a)(t,e,n)}):function(e){return Object(H.a)(t,e)}}var ir=n(40),or=n(30),sr=function(t){function e(e,n,r){void 0===n&&(n=0),void 0===r&&(r=ir.a);var i=t.call(this)||this;return i.source=e,i.delayTime=n,i.scheduler=r,(!Object(or.a)(n)||n<0)&&(i.delayTime=0),r&&"function"==typeof r.schedule||(i.scheduler=ir.a),i}return r.a(e,t),e.create=function(t,n,r){return void 0===n&&(n=0),void 0===r&&(r=ir.a),new e(t,n,r)},e.dispatch=function(t){var e=t.source,n=t.subscriber;return this.add(e.subscribe(n))},e.prototype._subscribe=function(t){var n=this.delayTime,r=this.source;return this.scheduler.schedule(e.dispatch,n,{source:r,subscriber:t})},e}(vt.a);function ar(t,e){return void 0===e&&(e=0),function(n){return n.lift(new cr(t,e))}}var cr=function(){function t(t,e){this.scheduler=t,this.delay=e}return t.prototype.call=function(t,e){return new sr(e,this.delay,this.scheduler).subscribe(t)},t}();function ur(t,e){return"function"==typeof e?function(n){return n.pipe(ur((function(n,r){return Object(W.a)(t(n,r)).pipe(Object(Jt.a)((function(t,i){return e(n,t,r,i)})))})))}:function(e){return e.lift(new hr(t))}}var hr=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e.subscribe(new lr(t,this.project))},t}(),lr=function(t){function e(e,n){var r=t.call(this,e)||this;return r.project=n,r.index=0,r}return r.a(e,t),e.prototype._next=function(t){var e,n=this.index++;try{e=this.project(t,n)}catch(t){return void this.destination.error(t)}this._innerSub(e)},e.prototype._innerSub=function(t){var e=this.innerSubscription;e&&e.unsubscribe();var n=new i.a(this),r=this.destination;r.add(n),this.innerSubscription=Object(i.c)(t,n),this.innerSubscription!==n&&r.add(this.innerSubscription)},e.prototype._complete=function(){var e=this.innerSubscription;e&&!e.closed||t.prototype._complete.call(this),this.unsubscribe()},e.prototype._unsubscribe=function(){this.innerSubscription=void 0},e.prototype.notifyComplete=function(){this.innerSubscription=void 0,this.isStopped&&t.prototype._complete.call(this)},e.prototype.notifyNext=function(t){this.destination.next(t)},e}(i.b);function fr(){return ur(le.a)}function dr(t,e){return e?ur((function(){return t}),e):ur((function(){return t}))}function pr(t){return function(e){return e.lift(new vr(t))}}var vr=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){var n=new gr(t),r=Object(i.c)(this.notifier,new i.a(n));return r&&!n.seenValue?(n.add(r),e.subscribe(n)):n},t}(),gr=function(t){function e(e){var n=t.call(this,e)||this;return n.seenValue=!1,n}return r.a(e,t),e.prototype.notifyNext=function(){this.seenValue=!0,this.complete()},e.prototype.notifyComplete=function(){},e}(i.b);function mr(t,e){return void 0===e&&(e=!1),function(n){return n.lift(new yr(t,e))}}var yr=function(){function t(t,e){this.predicate=t,this.inclusive=e}return t.prototype.call=function(t,e){return e.subscribe(new br(t,this.predicate,this.inclusive))},t}(),br=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.predicate=n,i.inclusive=r,i.index=0,i}return r.a(e,t),e.prototype._next=function(t){var e,n=this.destination;try{e=this.predicate(t,this.index++)}catch(t){return void n.error(t)}this.nextOrComplete(t,e)},e.prototype.nextOrComplete=function(t,e){var n=this.destination;Boolean(e)?n.next(t):(this.inclusive&&n.next(t),n.complete())},e}(p.a),_r=n(19),wr=n(23);function Sr(t,e,n){return function(r){return r.lift(new xr(t,e,n))}}var xr=function(){function t(t,e,n){this.nextOrObserver=t,this.error=e,this.complete=n}return t.prototype.call=function(t,e){return e.subscribe(new Tr(t,this.nextOrObserver,this.error,this.complete))},t}(),Tr=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o._tapNext=_r.a,o._tapError=_r.a,o._tapComplete=_r.a,o._tapError=r||_r.a,o._tapComplete=i||_r.a,Object(wr.a)(n)?(o._context=o,o._tapNext=n):n&&(o._context=n,o._tapNext=n.next||_r.a,o._tapError=n.error||_r.a,o._tapComplete=n.complete||_r.a),o}return r.a(e,t),e.prototype._next=function(t){try{this._tapNext.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.next(t)},e.prototype._error=function(t){try{this._tapError.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.error(t)},e.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(t){return void this.destination.error(t)}return this.destination.complete()},e}(p.a),Cr={leading:!0,trailing:!1};function Er(t,e){return void 0===e&&(e=Cr),function(n){return n.lift(new Rr(t,!!e.leading,!!e.trailing))}}var Rr=function(){function t(t,e,n){this.durationSelector=t,this.leading=e,this.trailing=n}return t.prototype.call=function(t,e){return e.subscribe(new Mr(t,this.durationSelector,this.leading,this.trailing))},t}(),Mr=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.destination=e,o.durationSelector=n,o._leading=r,o._trailing=i,o._hasValue=!1,o}return r.a(e,t),e.prototype._next=function(t){this._hasValue=!0,this._sendValue=t,this._throttled||(this._leading?this.send():this.throttle(t))},e.prototype.send=function(){var t=this._hasValue,e=this._sendValue;t&&(this.destination.next(e),this.throttle(e)),this._hasValue=!1,this._sendValue=void 0},e.prototype.throttle=function(t){var e=this.tryDurationSelector(t);e&&this.add(this._throttled=Object(i.c)(e,new i.a(this)))},e.prototype.tryDurationSelector=function(t){try{return this.durationSelector(t)}catch(t){return this.destination.error(t),null}},e.prototype.throttlingDone=function(){var t=this._throttled,e=this._trailing;t&&t.unsubscribe(),this._throttled=void 0,e&&this.send()},e.prototype.notifyNext=function(){this.throttlingDone()},e.prototype.notifyComplete=function(){this.throttlingDone()},e}(i.b);function Or(t,e,n){return void 0===e&&(e=c.a),void 0===n&&(n=Cr),function(r){return r.lift(new Ar(t,e,n.leading,n.trailing))}}var Ar=function(){function t(t,e,n,r){this.duration=t,this.scheduler=e,this.leading=n,this.trailing=r}return t.prototype.call=function(t,e){return e.subscribe(new Pr(t,this.duration,this.scheduler,this.leading,this.trailing))},t}(),Pr=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;return s.duration=n,s.scheduler=r,s.leading=i,s.trailing=o,s._hasTrailingValue=!1,s._trailingValue=null,s}return r.a(e,t),e.prototype._next=function(t){this.throttled?this.trailing&&(this._trailingValue=t,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(kr,this.duration,{subscriber:this})),this.leading?this.destination.next(t):this.trailing&&(this._trailingValue=t,this._hasTrailingValue=!0))},e.prototype._complete=function(){this._hasTrailingValue?(this.destination.next(this._trailingValue),this.destination.complete()):this.destination.complete()},e.prototype.clearThrottle=function(){var t=this.throttled;t&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),t.unsubscribe(),this.remove(t),this.throttled=null)},e}(p.a);function kr(t){t.subscriber.clearThrottle()}var Ir=n(53);function Dr(t){return void 0===t&&(t=c.a),function(e){return Object(Ir.a)((function(){return e.pipe(Ae((function(e,n){var r=e.current;return{value:n,current:t.now(),last:r}}),{current:t.now(),value:void 0,last:void 0}),Object(Jt.a)((function(t){var e=t.current,n=t.last,r=t.value;return new Nr(r,e-n)})))}))}}var Nr=function(){return function(t,e){this.value=t,this.interval=e}}(),jr=n(68);function Lr(t,e,n){return void 0===n&&(n=c.a),function(r){var i=ut(t),o=i?+t-n.now():Math.abs(t);return r.lift(new Ur(o,i,e,n))}}var Ur=function(){function t(t,e,n,r){this.waitFor=t,this.absoluteTimeout=e,this.withObservable=n,this.scheduler=r}return t.prototype.call=function(t,e){return e.subscribe(new Fr(t,this.absoluteTimeout,this.waitFor,this.withObservable,this.scheduler))},t}(),Fr=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;return s.absoluteTimeout=n,s.waitFor=r,s.withObservable=i,s.scheduler=o,s.scheduleTimeout(),s}return r.a(e,t),e.dispatchTimeout=function(t){var e=t.withObservable;t._unsubscribeAndRecycle(),t.add(Object(i.c)(e,new i.a(t)))},e.prototype.scheduleTimeout=function(){var t=this.action;t?this.action=t.schedule(this,this.waitFor):this.add(this.action=this.scheduler.schedule(e.dispatchTimeout,this.waitFor,this))},e.prototype._next=function(e){this.absoluteTimeout||this.scheduleTimeout(),t.prototype._next.call(this,e)},e.prototype._unsubscribe=function(){this.action=void 0,this.scheduler=null,this.withObservable=null},e}(i.b),Br=n(50);function Vr(t,e){return void 0===e&&(e=c.a),Lr(t,Object(Br.a)(new jr.a),e)}function Wr(t){return void 0===t&&(t=c.a),Object(Jt.a)((function(e){return new qr(e,t.now())}))}var qr=function(){return function(t,e){this.value=t,this.timestamp=e}}();function Hr(t,e,n){return 0===n?[e]:(t.push(e),t)}function zr(){return De(Hr,[])}function Gr(t){return function(e){return e.lift(new Yr(t))}}var Yr=function(){function t(t){this.windowBoundaries=t}return t.prototype.call=function(t,e){var n=new $r(t),r=e.subscribe(n);return r.closed||n.add(Object(i.c)(this.windowBoundaries,new i.a(n))),r},t}(),$r=function(t){function e(e){var n=t.call(this,e)||this;return n.window=new on.a,e.next(n.window),n}return r.a(e,t),e.prototype.notifyNext=function(){this.openWindow()},e.prototype.notifyError=function(t){this._error(t)},e.prototype.notifyComplete=function(){this._complete()},e.prototype._next=function(t){this.window.next(t)},e.prototype._error=function(t){this.window.error(t),this.destination.error(t)},e.prototype._complete=function(){this.window.complete(),this.destination.complete()},e.prototype._unsubscribe=function(){this.window=null},e.prototype.openWindow=function(){var t=this.window;t&&t.complete();var e=this.destination,n=this.window=new on.a;e.next(n)},e}(i.b);function Xr(t,e){return void 0===e&&(e=0),function(n){return n.lift(new Kr(t,e))}}var Kr=function(){function t(t,e){this.windowSize=t,this.startWindowEvery=e}return t.prototype.call=function(t,e){return e.subscribe(new Jr(t,this.windowSize,this.startWindowEvery))},t}(),Jr=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.destination=e,i.windowSize=n,i.startWindowEvery=r,i.windows=[new on.a],i.count=0,e.next(i.windows[0]),i}return r.a(e,t),e.prototype._next=function(t){for(var e=this.startWindowEvery>0?this.startWindowEvery:this.windowSize,n=this.destination,r=this.windowSize,i=this.windows,o=i.length,s=0;s<o&&!this.closed;s++)i[s].next(t);var a=this.count-r+1;if(a>=0&&a%e==0&&!this.closed&&i.shift().complete(),++this.count%e==0&&!this.closed){var c=new on.a;i.push(c),n.next(c)}},e.prototype._error=function(t){var e=this.windows;if(e)for(;e.length>0&&!this.closed;)e.shift().error(t);this.destination.error(t)},e.prototype._complete=function(){var t=this.windows;if(t)for(;t.length>0&&!this.closed;)t.shift().complete();this.destination.complete()},e.prototype._unsubscribe=function(){this.count=0,this.windows=null},e}(p.a);function Zr(t){var e=c.a,n=null,r=Number.POSITIVE_INFINITY;return Object(b.a)(arguments[3])&&(e=arguments[3]),Object(b.a)(arguments[2])?e=arguments[2]:Object(or.a)(arguments[2])&&(r=Number(arguments[2])),Object(b.a)(arguments[1])?e=arguments[1]:Object(or.a)(arguments[1])&&(n=Number(arguments[1])),function(i){return i.lift(new Qr(t,n,r,e))}}var Qr=function(){function t(t,e,n,r){this.windowTimeSpan=t,this.windowCreationInterval=e,this.maxWindowSize=n,this.scheduler=r}return t.prototype.call=function(t,e){return e.subscribe(new ei(t,this.windowTimeSpan,this.windowCreationInterval,this.maxWindowSize,this.scheduler))},t}(),ti=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._numberOfNextedValues=0,e}return r.a(e,t),e.prototype.next=function(e){this._numberOfNextedValues++,t.prototype.next.call(this,e)},Object.defineProperty(e.prototype,"numberOfNextedValues",{get:function(){return this._numberOfNextedValues},enumerable:!0,configurable:!0}),e}(on.a),ei=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;s.destination=e,s.windowTimeSpan=n,s.windowCreationInterval=r,s.maxWindowSize=i,s.scheduler=o,s.windows=[];var a=s.openWindow();if(null!==r&&r>=0){var c={subscriber:s,window:a,context:null},u={windowTimeSpan:n,windowCreationInterval:r,subscriber:s,scheduler:o};s.add(o.schedule(ii,n,c)),s.add(o.schedule(ri,r,u))}else{var h={subscriber:s,window:a,windowTimeSpan:n};s.add(o.schedule(ni,n,h))}return s}return r.a(e,t),e.prototype._next=function(t){for(var e=this.windows,n=e.length,r=0;r<n;r++){var i=e[r];i.closed||(i.next(t),i.numberOfNextedValues>=this.maxWindowSize&&this.closeWindow(i))}},e.prototype._error=function(t){for(var e=this.windows;e.length>0;)e.shift().error(t);this.destination.error(t)},e.prototype._complete=function(){for(var t=this.windows;t.length>0;){var e=t.shift();e.closed||e.complete()}this.destination.complete()},e.prototype.openWindow=function(){var t=new ti;return this.windows.push(t),this.destination.next(t),t},e.prototype.closeWindow=function(t){t.complete();var e=this.windows;e.splice(e.indexOf(t),1)},e}(p.a);function ni(t){var e=t.subscriber,n=t.windowTimeSpan,r=t.window;r&&e.closeWindow(r),t.window=e.openWindow(),this.schedule(t,n)}function ri(t){var e=t.windowTimeSpan,n=t.subscriber,r=t.scheduler,i=t.windowCreationInterval,o=n.openWindow(),s={action:this,subscription:null},a={subscriber:n,window:o,context:s};s.subscription=r.schedule(ii,e,a),this.add(s.subscription),this.schedule(t,i)}function ii(t){var e=t.subscriber,n=t.window,r=t.context;r&&r.action&&r.subscription&&r.action.remove(r.subscription),e.closeWindow(n)}function oi(t,e){return function(n){return n.lift(new si(t,e))}}var si=function(){function t(t,e){this.openings=t,this.closingSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new ai(t,this.openings,this.closingSelector))},t}(),ai=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.openings=n,i.closingSelector=r,i.contexts=[],i.add(i.openSubscription=Object(M.a)(i,n,n)),i}return r.a(e,t),e.prototype._next=function(t){var e=this.contexts;if(e)for(var n=e.length,r=0;r<n;r++)e[r].window.next(t)},e.prototype._error=function(e){var n=this.contexts;if(this.contexts=null,n)for(var r=n.length,i=-1;++i<r;){var o=n[i];o.window.error(e),o.subscription.unsubscribe()}t.prototype._error.call(this,e)},e.prototype._complete=function(){var e=this.contexts;if(this.contexts=null,e)for(var n=e.length,r=-1;++r<n;){var i=e[r];i.window.complete(),i.subscription.unsubscribe()}t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){var t=this.contexts;if(this.contexts=null,t)for(var e=t.length,n=-1;++n<e;){var r=t[n];r.window.unsubscribe(),r.subscription.unsubscribe()}},e.prototype.notifyNext=function(t,e,n,r,i){if(t===this.openings){var o=void 0;try{o=(0,this.closingSelector)(e)}catch(t){return this.error(t)}var s=new on.a,a=new R.a,c={window:s,subscription:a};this.contexts.push(c);var u=Object(M.a)(this,o,c);u.closed?this.closeWindow(this.contexts.length-1):(u.context=c,a.add(u)),this.destination.next(s)}else this.closeWindow(this.contexts.indexOf(t))},e.prototype.notifyError=function(t){this.error(t)},e.prototype.notifyComplete=function(t){t!==this.openSubscription&&this.closeWindow(this.contexts.indexOf(t.context))},e.prototype.closeWindow=function(t){if(-1!==t){var e=this.contexts,n=e[t],r=n.window,i=n.subscription;e.splice(t,1),r.complete(),i.unsubscribe()}},e}(O.a);function ci(t){return function(e){return e.lift(new ui(t))}}var ui=function(){function t(t){this.closingSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new hi(t,this.closingSelector))},t}(),hi=function(t){function e(e,n){var r=t.call(this,e)||this;return r.destination=e,r.closingSelector=n,r.openWindow(),r}return r.a(e,t),e.prototype.notifyNext=function(t,e,n,r,i){this.openWindow(i)},e.prototype.notifyError=function(t){this._error(t)},e.prototype.notifyComplete=function(t){this.openWindow(t)},e.prototype._next=function(t){this.window.next(t)},e.prototype._error=function(t){this.window.error(t),this.destination.error(t),this.unsubscribeClosingNotification()},e.prototype._complete=function(){this.window.complete(),this.destination.complete(),this.unsubscribeClosingNotification()},e.prototype.unsubscribeClosingNotification=function(){this.closingNotification&&this.closingNotification.unsubscribe()},e.prototype.openWindow=function(t){void 0===t&&(t=null),t&&(this.remove(t),t.unsubscribe());var e=this.window;e&&e.complete();var n,r=this.window=new on.a;this.destination.next(r);try{n=(0,this.closingSelector)()}catch(t){return this.destination.error(t),void this.window.error(t)}this.add(this.closingNotification=Object(M.a)(this,n))},e}(O.a);function li(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){var n;"function"==typeof t[t.length-1]&&(n=t.pop());var r=t;return e.lift(new fi(r,n))}}var fi=function(){function t(t,e){this.observables=t,this.project=e}return t.prototype.call=function(t,e){return e.subscribe(new di(t,this.observables,this.project))},t}(),di=function(t){function e(e,n,r){var i=t.call(this,e)||this;i.observables=n,i.project=r,i.toRespond=[];var o=n.length;i.values=new Array(o);for(var s=0;s<o;s++)i.toRespond.push(s);for(s=0;s<o;s++){var a=n[s];i.add(Object(M.a)(i,a,void 0,s))}return i}return r.a(e,t),e.prototype.notifyNext=function(t,e,n){this.values[n]=e;var r=this.toRespond;if(r.length>0){var i=r.indexOf(n);-1!==i&&r.splice(i,1)}},e.prototype.notifyComplete=function(){},e.prototype._next=function(t){if(0===this.toRespond.length){var e=[t].concat(this.values);this.project?this._tryProject(e):this.destination.next(e)}},e.prototype._tryProject=function(t){var e;try{e=this.project.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(O.a),pi=n(54);function vi(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(pi.b.apply(void 0,[e].concat(t)))}}function gi(t){return function(e){return e.lift(new pi.a(t))}}},function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"shimGetUserMedia",(function(){return b})),n.d(r,"shimGetDisplayMedia",(function(){return _})),n.d(r,"shimMediaStream",(function(){return w})),n.d(r,"shimOnTrack",(function(){return S})),n.d(r,"shimGetSendersWithDtmf",(function(){return x})),n.d(r,"shimGetStats",(function(){return T})),n.d(r,"shimSenderReceiverGetStats",(function(){return C})),n.d(r,"shimAddTrackRemoveTrackWithNative",(function(){return E})),n.d(r,"shimAddTrackRemoveTrack",(function(){return R})),n.d(r,"shimPeerConnection",(function(){return M})),n.d(r,"fixNegotiationNeeded",(function(){return O}));var i={};n.r(i),n.d(i,"shimGetUserMedia",(function(){return A})),n.d(i,"shimGetDisplayMedia",(function(){return P})),n.d(i,"shimOnTrack",(function(){return k})),n.d(i,"shimPeerConnection",(function(){return I})),n.d(i,"shimSenderGetStats",(function(){return D})),n.d(i,"shimReceiverGetStats",(function(){return N})),n.d(i,"shimRemoveStream",(function(){return j})),n.d(i,"shimRTCDataChannel",(function(){return L})),n.d(i,"shimAddTransceiver",(function(){return U})),n.d(i,"shimGetParameters",(function(){return F})),n.d(i,"shimCreateOffer",(function(){return B})),n.d(i,"shimCreateAnswer",(function(){return V}));var o={};n.r(o),n.d(o,"shimLocalStreamsAPI",(function(){return W})),n.d(o,"shimRemoteStreamsAPI",(function(){return q})),n.d(o,"shimCallbacksAPI",(function(){return H})),n.d(o,"shimGetUserMedia",(function(){return z})),n.d(o,"shimConstraints",(function(){return G})),n.d(o,"shimRTCIceServerUrls",(function(){return Y})),n.d(o,"shimTrackEventTransceiver",(function(){return $})),n.d(o,"shimCreateOfferLegacy",(function(){return X})),n.d(o,"shimAudioContext",(function(){return K}));var s={};n.r(s),n.d(s,"shimRTCIceCandidate",(function(){return Q})),n.d(s,"shimMaxMessageSize",(function(){return tt})),n.d(s,"shimSendThrowTypeError",(function(){return et})),n.d(s,"shimConnectionState",(function(){return nt})),n.d(s,"removeExtmapAllowMixed",(function(){return rt})),n.d(s,"shimAddIceCandidateNullOrEmpty",(function(){return it})),n.d(s,"shimParameterlessSetLocalDescription",(function(){return ot}));let a=!0,c=!0;function u(t,e,n){const r=t.match(e);return r&&r.length>=n&&parseInt(r[n],10)}function h(t,e,n){if(!t.RTCPeerConnection)return;const r=t.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(t,r){if(t!==e)return i.apply(this,arguments);const o=t=>{const e=n(t);e&&(r.handleEvent?r.handleEvent(e):r(e))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(r,o),i.apply(this,[t,o])};const o=r.removeEventListener;r.removeEventListener=function(t,n){if(t!==e||!this._eventMap||!this._eventMap[e])return o.apply(this,arguments);if(!this._eventMap[e].has(n))return o.apply(this,arguments);const r=this._eventMap[e].get(n);return this._eventMap[e].delete(n),0===this._eventMap[e].size&&delete this._eventMap[e],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[t,r])},Object.defineProperty(r,"on"+e,{get(){return this["_on"+e]},set(t){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),t&&this.addEventListener(e,this["_on"+e]=t)},enumerable:!0,configurable:!0})}function l(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(a=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function f(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(c=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function d(){if("object"==typeof window){if(a)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function p(t,e){c&&console.warn(t+" is deprecated, please use "+e+" instead.")}function v(t){return"[object Object]"===Object.prototype.toString.call(t)}function g(t){return v(t)?Object.keys(t).reduce((function(e,n){const r=v(t[n]),i=r?g(t[n]):t[n],o=r&&!Object.keys(i).length;return void 0===i||o?e:Object.assign(e,{[n]:i})}),{}):t}function m(t,e,n){const r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===e)return i;const o=[];return t.forEach(t=>{"track"===t.type&&t.trackIdentifier===e.id&&o.push(t)}),o.forEach(e=>{t.forEach(n=>{n.type===r&&n.trackId===e.id&&function t(e,n,r){n&&!r.has(n.id)&&(r.set(n.id,n),Object.keys(n).forEach(i=>{i.endsWith("Id")?t(e,e.get(n[i]),r):i.endsWith("Ids")&&n[i].forEach(n=>{t(e,e.get(n),r)})}))}(t,n,i)})}),i}const y=d;function b(t,e){const n=t&&t.navigator;if(!n.mediaDevices)return;const r=function(t){if("object"!=typeof t||t.mandatory||t.optional)return t;const e={};return Object.keys(t).forEach(n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;const r="object"==typeof t[n]?t[n]:{ideal:t[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);const i=function(t,e){return t?t+e.charAt(0).toUpperCase()+e.slice(1):"deviceId"===e?"sourceId":e};if(void 0!==r.ideal){e.optional=e.optional||[];let t={};"number"==typeof r.ideal?(t[i("min",n)]=r.ideal,e.optional.push(t),t={},t[i("max",n)]=r.ideal,e.optional.push(t)):(t[i("",n)]=r.ideal,e.optional.push(t))}void 0!==r.exact&&"number"!=typeof r.exact?(e.mandatory=e.mandatory||{},e.mandatory[i("",n)]=r.exact):["min","max"].forEach(t=>{void 0!==r[t]&&(e.mandatory=e.mandatory||{},e.mandatory[i(t,n)]=r[t])})}),t.advanced&&(e.optional=(e.optional||[]).concat(t.advanced)),e},i=function(t,i){if(e.version>=61)return i(t);if((t=JSON.parse(JSON.stringify(t)))&&"object"==typeof t.audio){const e=function(t,e,n){e in t&&!(n in t)&&(t[n]=t[e],delete t[e])};e((t=JSON.parse(JSON.stringify(t))).audio,"autoGainControl","googAutoGainControl"),e(t.audio,"noiseSuppression","googNoiseSuppression"),t.audio=r(t.audio)}if(t&&"object"==typeof t.video){let o=t.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const s=e.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||s)){let e;if(delete t.video.facingMode,"environment"===o.exact||"environment"===o.ideal?e=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(e=["front"]),e)return n.mediaDevices.enumerateDevices().then(n=>{let s=(n=n.filter(t=>"videoinput"===t.kind)).find(t=>e.some(e=>t.label.toLowerCase().includes(e)));return!s&&n.length&&e.includes("back")&&(s=n[n.length-1]),s&&(t.video.deviceId=o.exact?{exact:s.deviceId}:{ideal:s.deviceId}),t.video=r(t.video),y("chrome: "+JSON.stringify(t)),i(t)})}t.video=r(t.video)}return y("chrome: "+JSON.stringify(t)),i(t)},o=function(t){return e.version>=64?t:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[t.name]||t.name,message:t.message,constraint:t.constraint||t.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(t,e,r){i(t,t=>{n.webkitGetUserMedia(t,e,t=>{r&&r(o(t))})})}.bind(n),n.mediaDevices.getUserMedia){const t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return i(e,e=>t(e).then(t=>{if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach(t=>{t.stop()}),new DOMException("","NotFoundError");return t},t=>Promise.reject(o(t))))}}}function _(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&("function"==typeof e?t.navigator.mediaDevices.getDisplayMedia=function(n){return e(n).then(e=>{const r=n.video&&n.video.width,i=n.video&&n.video.height,o=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e,maxFrameRate:o||3}},r&&(n.video.mandatory.maxWidth=r),i&&(n.video.mandatory.maxHeight=i),t.navigator.mediaDevices.getUserMedia(n)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function w(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function S(t){if("object"==typeof t&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=e=>{e.stream.addEventListener("addtrack",n=>{let r;r=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(t=>t.track&&t.track.id===n.track.id):{track:n.track};const i=new Event("track");i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[e.stream],this.dispatchEvent(i)}),e.stream.getTracks().forEach(n=>{let r;r=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(t=>t.track&&t.track.id===n.id):{track:n};const i=new Event("track");i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[e.stream],this.dispatchEvent(i)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else h(t,"track",t=>(t.transceiver||Object.defineProperty(t,"transceiver",{value:{receiver:t.receiver}}),t))}function x(t){if("object"==typeof t&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(t,e){return{track:e,get dtmf(){return void 0===this._dtmf&&("audio"===e.kind?this._dtmf=t.createDTMFSender(e):this._dtmf=null),this._dtmf},_pc:t}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const n=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(t,r){let i=n.apply(this,arguments);return i||(i=e(this,t),this._senders.push(i)),i};const r=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(t){r.apply(this,arguments);const e=this._senders.indexOf(t);-1!==e&&this._senders.splice(e,1)}}const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(t){this._senders=this._senders||[],n.apply(this,[t]),t.getTracks().forEach(t=>{this._senders.push(e(this,t))})};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(t){this._senders=this._senders||[],r.apply(this,[t]),t.getTracks().forEach(t=>{const e=this._senders.find(e=>e.track===t);e&&this._senders.splice(this._senders.indexOf(e),1)})}}else if("object"==typeof t&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach(t=>t._pc=this),t},Object.defineProperty(t.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function T(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[t,n,r]=arguments;if(arguments.length>0&&"function"==typeof t)return e.apply(this,arguments);if(0===e.length&&(0===arguments.length||"function"!=typeof t))return e.apply(this,[]);const i=function(t){const e={};return t.result().forEach(t=>{const n={id:t.id,timestamp:t.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[t.type]||t.type};t.names().forEach(e=>{n[e]=t.stat(e)}),e[n.id]=n}),e},o=function(t){return new Map(Object.keys(t).map(e=>[e,t[e]]))};if(arguments.length>=2){const r=function(t){n(o(i(t)))};return e.apply(this,[r,t])}return new Promise((t,n)=>{e.apply(this,[function(e){t(o(i(e)))},n])}).then(n,r)}}function C(t){if(!("object"==typeof t&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach(t=>t._pc=this),t});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const t=n.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function(){const t=this;return this._pc.getStats().then(e=>m(e,t.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const t=e.apply(this,[]);return t.forEach(t=>t._pc=this),t}),h(t,"track",t=>(t.receiver._pc=t.srcElement,t)),t.RTCRtpReceiver.prototype.getStats=function(){const t=this;return this._pc.getStats().then(e=>m(e,t.track,!1))}}if(!("getStats"in t.RTCRtpSender.prototype)||!("getStats"in t.RTCRtpReceiver.prototype))return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const t=arguments[0];let e,n,r;return this.getSenders().forEach(n=>{n.track===t&&(e?r=!0:e=n)}),this.getReceivers().forEach(e=>(e.track===t&&(n?r=!0:n=e),e.track===t)),r||e&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):e?e.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function E(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(t=>this._shimmedLocalStreams[t][0])};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(t,n){if(!n)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const r=e.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(t){this._shimmedLocalStreams=this._shimmedLocalStreams||{},t.getTracks().forEach(t=>{if(this.getSenders().find(e=>e.track===t))throw new DOMException("Track already exists.","InvalidAccessError")});const e=this.getSenders();n.apply(this,arguments);const r=this.getSenders().filter(t=>-1===e.indexOf(t));this._shimmedLocalStreams[t.id]=[t].concat(r)};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[t.id],r.apply(this,arguments)};const i=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},t&&Object.keys(this._shimmedLocalStreams).forEach(e=>{const n=this._shimmedLocalStreams[e].indexOf(t);-1!==n&&this._shimmedLocalStreams[e].splice(n,1),1===this._shimmedLocalStreams[e].length&&delete this._shimmedLocalStreams[e]}),i.apply(this,arguments)}}function R(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return E(t);const n=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const t=n.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map(t=>this._reverseStreams[t.id])};const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(e){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},e.getTracks().forEach(t=>{if(this.getSenders().find(e=>e.track===t))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[e.id]){const n=new t.MediaStream(e.getTracks());this._streams[e.id]=n,this._reverseStreams[n.id]=e,e=n}r.apply(this,[e])};const i=t.RTCPeerConnection.prototype.removeStream;function o(t,e){let n=e.sdp;return Object.keys(t._reverseStreams||[]).forEach(e=>{const r=t._reverseStreams[e],i=t._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)}),new RTCSessionDescription({type:e.type,sdp:n})}function s(t,e){let n=e.sdp;return Object.keys(t._reverseStreams||[]).forEach(e=>{const r=t._reverseStreams[e],i=t._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)}),new RTCSessionDescription({type:e.type,sdp:n})}t.RTCPeerConnection.prototype.removeStream=function(t){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[t.id]||t]),delete this._reverseStreams[this._streams[t.id]?this._streams[t.id].id:t.id],delete this._streams[t.id]},t.RTCPeerConnection.prototype.addTrack=function(e,n){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find(t=>t===e))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");const i=this.getSenders().find(t=>t.track===e);if(i)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const o=this._streams[n.id];if(o)o.addTrack(e),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const r=new t.MediaStream([e]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find(t=>t.track===e)},["createOffer","createAnswer"].forEach((function(e){const n=t.RTCPeerConnection.prototype[e],r={[e](){const t=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[e=>{const n=o(this,e);t[0].apply(null,[n])},e=>{t[1]&&t[1].apply(null,e)},arguments[2]]):n.apply(this,arguments).then(t=>o(this,t))}};t.RTCPeerConnection.prototype[e]=r[e]}));const a=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=s(this,arguments[0]),a.apply(this,arguments)):a.apply(this,arguments)};const c=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const t=c.get.apply(this);return""===t.type?t:o(this,t)}}),t.RTCPeerConnection.prototype.removeTrack=function(t){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!t._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(t._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let e;this._streams=this._streams||{},Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(e=>t.track===e)&&(e=this._streams[n])}),e&&(1===e.getTracks().length?this.removeStream(this._reverseStreams[e.id]):e.removeTrack(t.track),this.dispatchEvent(new Event("negotiationneeded")))}}function M(t,e){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(e){const n=t.RTCPeerConnection.prototype[e],r={[e](){return arguments[0]=new("addIceCandidate"===e?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};t.RTCPeerConnection.prototype[e]=r[e]}))}function O(t,e){h(t,"negotiationneeded",t=>{const n=t.target;if(!(e.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return t})}function A(t,e){const n=t&&t.navigator,r=t&&t.MediaStreamTrack;if(n.getUserMedia=function(t,e,r){p("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(t).then(e,r)},!(e.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const t=function(t,e,n){e in t&&!(n in t)&&(t[n]=t[e],delete t[e])},e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(n=JSON.parse(JSON.stringify(n)),t(n.audio,"autoGainControl","mozAutoGainControl"),t(n.audio,"noiseSuppression","mozNoiseSuppression")),e(n)},r&&r.prototype.getSettings){const e=r.prototype.getSettings;r.prototype.getSettings=function(){const n=e.apply(this,arguments);return t(n,"mozAutoGainControl","autoGainControl"),t(n,"mozNoiseSuppression","noiseSuppression"),n}}if(r&&r.prototype.applyConstraints){const e=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(n=JSON.parse(JSON.stringify(n)),t(n,"autoGainControl","mozAutoGainControl"),t(n,"noiseSuppression","mozNoiseSuppression")),e.apply(this,[n])}}}}function P(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){const t=new DOMException("getDisplayMedia without video constraints is undefined");return t.name="NotFoundError",t.code=8,Promise.reject(t)}return!0===n.video?n.video={mediaSource:e}:n.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(n)})}function k(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function I(t,e){if("object"!=typeof t||!t.RTCPeerConnection&&!t.mozRTCPeerConnection)return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(e){const n=t.RTCPeerConnection.prototype[e],r={[e](){return arguments[0]=new("addIceCandidate"===e?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};t.RTCPeerConnection.prototype[e]=r[e]}));const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[t,i,o]=arguments;return r.apply(this,[t||null]).then(t=>{if(e.version<53&&!i)try{t.forEach(t=>{t.type=n[t.type]||t.type})}catch(e){if("TypeError"!==e.name)throw e;t.forEach((e,r)=>{t.set(r,Object.assign({},e,{type:n[e.type]||e.type}))})}return t}).then(i,o)}}function D(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach(t=>t._pc=this),t});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const t=n.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function N(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const t=e.apply(this,[]);return t.forEach(t=>t._pc=this),t}),h(t,"track",t=>(t.receiver._pc=t.srcElement,t)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function j(t){t.RTCPeerConnection&&!("removeStream"in t.RTCPeerConnection.prototype)&&(t.RTCPeerConnection.prototype.removeStream=function(t){p("removeStream","removeTrack"),this.getSenders().forEach(e=>{e.track&&t.getTracks().includes(e.track)&&this.removeTrack(e)})})}function L(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function U(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.addTransceiver;e&&(t.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const t=arguments[1],n=t&&"sendEncodings"in t;n&&t.sendEncodings.forEach(t=>{if("rid"in t){if(!/^[a-z0-9]{0,16}$/i.test(t.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in t&&!(parseFloat(t.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in t&&!(parseFloat(t.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const r=e.apply(this,arguments);if(n){const{sender:e}=r,n=e.getParameters();(!("encodings"in n)||1===n.encodings.length&&0===Object.keys(n.encodings[0]).length)&&(n.encodings=t.sendEncodings,e.sendEncodings=t.sendEncodings,this.setParametersPromises.push(e.setParameters(n).then(()=>{delete e.sendEncodings}).catch(()=>{delete e.sendEncodings})))}return r})}function F(t){if("object"!=typeof t||!t.RTCRtpSender)return;const e=t.RTCRtpSender.prototype.getParameters;e&&(t.RTCRtpSender.prototype.getParameters=function(){const t=e.apply(this,arguments);return"encodings"in t||(t.encodings=[].concat(this.sendEncodings||[{}])),t})}function B(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function V(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function W(t){if("object"==typeof t&&t.RTCPeerConnection){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(t){this._localStreams||(this._localStreams=[]),this._localStreams.includes(t)||this._localStreams.push(t),t.getAudioTracks().forEach(n=>e.call(this,n,t)),t.getVideoTracks().forEach(n=>e.call(this,n,t))},t.RTCPeerConnection.prototype.addTrack=function(t,...n){return n&&n.forEach(t=>{this._localStreams?this._localStreams.includes(t)||this._localStreams.push(t):this._localStreams=[t]}),e.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(t){this._localStreams||(this._localStreams=[]);const e=this._localStreams.indexOf(t);if(-1===e)return;this._localStreams.splice(e,1);const n=t.getTracks();this.getSenders().forEach(t=>{n.includes(t.track)&&this.removeTrack(t)})})}}function q(t){if("object"==typeof t&&t.RTCPeerConnection&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(t){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=t),this.addEventListener("track",this._onaddstreampoly=t=>{t.streams.forEach(t=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(t))return;this._remoteStreams.push(t);const e=new Event("addstream");e.stream=t,this.dispatchEvent(e)})})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const t=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach(e=>{if(t._remoteStreams||(t._remoteStreams=[]),t._remoteStreams.indexOf(e)>=0)return;t._remoteStreams.push(e);const n=new Event("addstream");n.stream=e,t.dispatchEvent(n)})}),e.apply(t,arguments)}}}function H(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,n=e.createOffer,r=e.createAnswer,i=e.setLocalDescription,o=e.setRemoteDescription,s=e.addIceCandidate;e.createOffer=function(t,e){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return e?(i.then(t,e),Promise.resolve()):i},e.createAnswer=function(t,e){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return e?(i.then(t,e),Promise.resolve()):i};let a=function(t,e,n){const r=i.apply(this,[t]);return n?(r.then(e,n),Promise.resolve()):r};e.setLocalDescription=a,a=function(t,e,n){const r=o.apply(this,[t]);return n?(r.then(e,n),Promise.resolve()):r},e.setRemoteDescription=a,a=function(t,e,n){const r=s.apply(this,[t]);return n?(r.then(e,n),Promise.resolve()):r},e.addIceCandidate=a}function z(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const t=e.mediaDevices,n=t.getUserMedia.bind(t);e.mediaDevices.getUserMedia=t=>n(G(t))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=function(t,n,r){e.mediaDevices.getUserMedia(t).then(n,r)}.bind(e))}function G(t){return t&&void 0!==t.video?Object.assign({},t,{video:g(t.video)}):t}function Y(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(t,n){if(t&&t.iceServers){const e=[];for(let n=0;n<t.iceServers.length;n++){let r=t.iceServers[n];!r.hasOwnProperty("urls")&&r.hasOwnProperty("url")?(p("RTCIceServer.url","RTCIceServer.urls"),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,e.push(r)):e.push(t.iceServers[n])}t.iceServers=e}return new e(t,n)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get:()=>e.generateCertificate})}function $(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function X(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(t){if(t){void 0!==t.offerToReceiveAudio&&(t.offerToReceiveAudio=!!t.offerToReceiveAudio);const e=this.getTransceivers().find(t=>"audio"===t.receiver.track.kind);!1===t.offerToReceiveAudio&&e?"sendrecv"===e.direction?e.setDirection?e.setDirection("sendonly"):e.direction="sendonly":"recvonly"===e.direction&&(e.setDirection?e.setDirection("inactive"):e.direction="inactive"):!0!==t.offerToReceiveAudio||e||this.addTransceiver("audio"),void 0!==t.offerToReceiveVideo&&(t.offerToReceiveVideo=!!t.offerToReceiveVideo);const n=this.getTransceivers().find(t=>"video"===t.receiver.track.kind);!1===t.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!==t.offerToReceiveVideo||n||this.addTransceiver("video")}return e.apply(this,arguments)}}function K(t){"object"!=typeof t||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var J=n(43),Z=n.n(J);function Q(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const e=t.RTCIceCandidate;t.RTCIceCandidate=function(t){if("object"==typeof t&&t.candidate&&0===t.candidate.indexOf("a=")&&((t=JSON.parse(JSON.stringify(t))).candidate=t.candidate.substr(2)),t.candidate&&t.candidate.length){const n=new e(t),r=Z.a.parseCandidate(t.candidate),i=Object.assign(n,r);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new e(t)},t.RTCIceCandidate.prototype=e.prototype,h(t,"icecandidate",e=>(e.candidate&&Object.defineProperty(e,"candidate",{value:new t.RTCIceCandidate(e.candidate),writable:"false"}),e))}function tt(t,e){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const n=function(t){if(!t||!t.sdp)return!1;const e=Z.a.splitSections(t.sdp);return e.shift(),e.some(t=>{const e=Z.a.parseMLine(t);return e&&"application"===e.kind&&-1!==e.protocol.indexOf("SCTP")})},r=function(t){const e=t.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===e||e.length<2)return-1;const n=parseInt(e[1],10);return n!=n?-1:n},i=function(t){let n=65536;return"firefox"===e.browser&&(n=e.version<57?-1===t?16384:2147483637:e.version<60?57===e.version?65535:65536:2147483637),n},o=function(t,n){let r=65536;"firefox"===e.browser&&57===e.version&&(r=65535);const i=Z.a.matchPrefix(t.sdp,"a=max-message-size:");return i.length>0?r=parseInt(i[0].substr(19),10):"firefox"===e.browser&&-1!==n&&(r=2147483637),r},s=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===e.browser&&e.version>=76){const{sdpSemantics:t}=this.getConfiguration();"plan-b"===t&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(n(arguments[0])){const t=r(arguments[0]),e=i(t),n=o(arguments[0],t);let s;s=0===e&&0===n?Number.POSITIVE_INFINITY:0===e||0===n?Math.max(e,n):Math.min(e,n);const a={};Object.defineProperty(a,"maxMessageSize",{get:()=>s}),this._sctp=a}return s.apply(this,arguments)}}function et(t){if(!t.RTCPeerConnection||!("createDataChannel"in t.RTCPeerConnection.prototype))return;function e(t,e){const n=t.send;t.send=function(){const r=arguments[0],i=r.length||r.size||r.byteLength;if("open"===t.readyState&&e.sctp&&i>e.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+e.sctp.maxMessageSize+" bytes)");return n.apply(t,arguments)}}const n=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){const t=n.apply(this,arguments);return e(t,this),t},h(t,"datachannel",t=>(e(t.channel,t.target),t))}function nt(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const e=t.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(t){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),t&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=t)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(t=>{const n=e[t];e[t]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=t=>{const e=t.target;if(e._lastConnectionState!==e.connectionState){e._lastConnectionState=e.connectionState;const n=new Event("connectionstatechange",t);e.dispatchEvent(n)}return t},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}function rt(t,e){if(!t.RTCPeerConnection)return;if("chrome"===e.browser&&e.version>=71)return;if("safari"===e.browser&&e.version>=605)return;const n=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(e){if(e&&e.sdp&&-1!==e.sdp.indexOf("\na=extmap-allow-mixed")){const n=e.sdp.split("\n").filter(t=>"a=extmap-allow-mixed"!==t.trim()).join("\n");t.RTCSessionDescription&&e instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:e.type,sdp:n}):e.sdp=n}return n.apply(this,arguments)}}function it(t,e){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const n=t.RTCPeerConnection.prototype.addIceCandidate;n&&0!==n.length&&(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===e.browser&&e.version<78||"firefox"===e.browser&&e.version<68||"safari"===e.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function ot(t,e){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const n=t.RTCPeerConnection.prototype.setLocalDescription;n&&0!==n.length&&(t.RTCPeerConnection.prototype.setLocalDescription=function(){let t=arguments[0]||{};if("object"!=typeof t||t.type&&t.sdp)return n.apply(this,arguments);if(t={type:t.type,sdp:t.sdp},!t.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return n.apply(this,[t]);const e="offer"===t.type?this.createOffer:this.createAnswer;return e.apply(this).then(t=>n.apply(this,[t]))})}const st=function({window:t}={},e={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const n=d,a=function(t){const e={browser:null,version:null};if(void 0===t||!t.navigator)return e.browser="Not a browser.",e;const{navigator:n}=t;if(n.mozGetUserMedia)e.browser="firefox",e.version=u(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===t.isSecureContext&&t.webkitRTCPeerConnection&&!t.RTCIceGatherer)e.browser="chrome",e.version=u(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!t.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return e.browser="Not a supported browser.",e;e.browser="safari",e.version=u(n.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype}return e}(t),c={browserDetails:a,commonShim:s,extractVersion:u,disableLog:l,disableWarnings:f,sdp:J};switch(a.browser){case"chrome":if(!r||!M||!e.shimChrome)return n("Chrome shim is not included in this adapter release."),c;if(null===a.version)return n("Chrome shim can not determine version, not shimming."),c;n("adapter.js shimming chrome."),c.browserShim=r,it(t,a),ot(t),b(t,a),w(t),M(t,a),S(t),R(t,a),x(t),T(t),C(t),O(t,a),Q(t),nt(t),tt(t,a),et(t),rt(t,a);break;case"firefox":if(!i||!I||!e.shimFirefox)return n("Firefox shim is not included in this adapter release."),c;n("adapter.js shimming firefox."),c.browserShim=i,it(t,a),ot(t),A(t,a),I(t,a),k(t),j(t),D(t),N(t),L(t),U(t),F(t),B(t),V(t),Q(t),nt(t),tt(t,a),et(t);break;case"safari":if(!o||!e.shimSafari)return n("Safari shim is not included in this adapter release."),c;n("adapter.js shimming safari."),c.browserShim=o,it(t,a),ot(t),Y(t),X(t),H(t),W(t),q(t),$(t),z(t),K(t),Q(t),tt(t,a),et(t),rt(t,a);break;default:n("Unsupported browser!")}return c}({window:"undefined"==typeof window?void 0:window});e.default=st},function(t,e,n){"use strict";n.r(e),console.log("BUILD/SERIOUSLY.MODULE");let r,i,o,s,a,c,u,h={},l={},f={},d={},p=[],v={},g={},m={canvas:[],image:[],video:[]},y={},b=window.WeakMap&&new WeakMap,_=0,w=function(){},S={transparent:[0,0,0,0],black:[0,0,0,1],red:[1,0,0,1],green:[0,128/255,0,1],blue:[0,0,1,1],white:[1,1,1,1],silver:[192/255,192/255,192/255,1],gray:[128/255,128/255,128/255,1],maroon:[128/255,0,0,1],purple:[128/255,0,128/255,1],fuchsia:[1,0,1,1],lime:[0,1,0,1],olive:[128/255,128/255,0,1],yellow:[1,1,0,1],navy:[0,0,128/255,1],teal:[0,128/255,128/255,1],aqua:[0,1,1,1],orange:[1,165/255,0,1]},x=/^(rgb|hsl)a?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*(\d+(\.\d*)?)\s*)?\)/i,T=/^#(([0-9a-fA-F]{3,8}))/,C=["x","y","z","w"],E=["r","g","b","a"],R={srcRGB:770,dstRGB:771,srcAlpha:1,dstAlpha:771},M=["MAX_COMBINED_TEXTURE_IMAGE_UNITS","MAX_FRAGMENT_UNIFORM_VECTORS","MAX_TEXTURE_IMAGE_UNITS","MAX_VARYING_VECTORS","MAX_VERTEX_ATTRIBS","MAX_VERTEX_TEXTURE_IMAGE_UNITS","MAX_VERTEX_UNIFORM_VECTORS"],O=/^[\t ]*#define[\t ]+SHADER_NAME\s+([^$\n\r]+)/i,A={frustum:function(t,e,n,r,i,o,s){s||(s=A.create());var a=e-t,c=r-n,u=o-i;return s[0]=2*i/a,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=2*i/c,s[6]=0,s[7]=0,s[8]=(e+t)/a,s[9]=(r+n)/c,s[10]=-(o+i)/u,s[11]=-1,s[12]=0,s[13]=0,s[14]=-o*i*2/u,s[15]=0,s},perspective:function(t,e,n,r,i){var o=n*Math.tan(t*Math.PI/360),s=o*e;return A.frustum(-s,s,-o,o,n,r,i)},multiply:function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=e[4],c=e[5],u=e[6],h=e[7],l=e[8],f=e[9],d=e[10],p=e[11],v=e[12],g=e[13],m=e[14],y=e[15],b=n[0],_=n[1],w=n[2],S=n[3];return t[0]=b*r+_*a+w*l+S*v,t[1]=b*i+_*c+w*f+S*g,t[2]=b*o+_*u+w*d+S*m,t[3]=b*s+_*h+w*p+S*y,b=n[4],_=n[5],w=n[6],S=n[7],t[4]=b*r+_*a+w*l+S*v,t[5]=b*i+_*c+w*f+S*g,t[6]=b*o+_*u+w*d+S*m,t[7]=b*s+_*h+w*p+S*y,b=n[8],_=n[9],w=n[10],S=n[11],t[8]=b*r+_*a+w*l+S*v,t[9]=b*i+_*c+w*f+S*g,t[10]=b*o+_*u+w*d+S*m,t[11]=b*s+_*h+w*p+S*y,b=n[12],_=n[13],w=n[14],S=n[15],t[12]=b*r+_*a+w*l+S*v,t[13]=b*i+_*c+w*f+S*g,t[14]=b*o+_*u+w*d+S*m,t[15]=b*s+_*h+w*p+S*y,t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}},P=(j=0,window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){var e,n,r;return e=(new Date).getTime(),n=Math.max(0,16-(e-j)),r=window.setTimeout((function(){t(e+n)}),n),j=e+n,r}),k=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(t){window.cancelTimeout(t)},I=["alias","destroy","effect","id","initialize","inputs","isDestroyed","isReady","matte","off","on","readPixels","render","title","update"],D=["alias","destroy","id","inputs","isDestroyed","isReady","off","on","source","title","update"],N=["aliases","defaults","destroy","effect","go","id","incompatible","isDestroyed","isEffect","isNode","isSource","isTarget","isTransform","removeAlias","render","source","stop","target","transform"];var j;function L(t,e){var n,r;if("string"==typeof t)n=document.querySelector(t);else if(!t)return!1;return t.tagName&&(n=t),n?(r=n.tagName.toLowerCase(),e&&e.indexOf(r)<0?t:n):t}function U(t,e){var n,r;for(n in t.prototype&&e.prototype&&t.prototype!==e.prototype&&U(t.prototype,e.prototype),e)e.hasOwnProperty(n)&&((r=Object.getOwnPropertyDescriptor(e,n)).get||r.set?Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get:r.get,set:r.set}):t[n]=e[n]);return t}function F(t){var e;if(!console)return w;if("function"==typeof console[t])e=console[t];else{if("function"!=typeof console.log)return w;e=console.log}return e.bind?e.bind(console):function(){e.apply(console,arguments)}}function B(t,e){if(e||(e="HTMLElement"),t instanceof window[e])return!0;if(!t||"object"!=typeof t)return!1;for(;t;)if((t=Object.getPrototypeOf(t))&&t.constructor.name===e)return!0;return!1}function V(t,e,n,r,i){function o(t,e,n){return(n%=1)<0&&(n+=1),n<1/6?t+(e-t)*n*6:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}var s,a;return s=2*n-(a=n<.5?n*(e+1):n+e-n*e),i||(i=[]),i[0]=o(s,a,t+1/3),i[1]=o(s,a,t),i[2]=o(s,a,t-1/3),i[3]=r,i}function W(t){var e,n,r,i="#",o=t[3]<1?4:3;for(e=0;e<o;e++)r=(n=Math.min(255,Math.round(255*t[e]||0))).toString(16),n<16&&(r="0"+r),i+=r;return i}function q(t){return Array.isArray(t)||t&&t.BYTES_PER_ELEMENT&&"length"in t}function H(t){if("function"!=typeof t)throw new Error("setTimeoutZero argument is not a function");p.push(t),"file:"!==window.location.protocol?window.postMessage("seriously-timeout-message",window.location):setTimeout((function(){p.length&&p.shift()()}),0)}function z(t,e){var n;try{n=window.WebGLDebugUtils&&e&&e.debugContext?window.WebGLDebugUtils.makeDebugContext(t.getContext("webgl",e)):t.getContext("webgl",e)}catch(t){}if(!n)try{n=t.getContext("experimental-webgl",e)}catch(t){}return n}function G(){var t;return r&&r.getError()===r.CONTEXT_LOST_WEBGL&&(r=void 0),r||!window.WebGLRenderingContext||o||(t=document.createElement("canvas"),r=z(t),r?t.addEventListener("webglcontextlost",(function e(n){n.preventDefault(),r&&r.canvas===this&&(r=void 0,t.removeEventListener("webglcontextlost",e,!1))}),!1):K.logger.warn("Unable to access WebGL.")),r}function Y(t){var e,n,r;function i(t,r){var i,o;q(t)?(i=t[0],o=t[1]||i):i=t,"string"==typeof i?i=i.toLowerCase():"number"==typeof i?i=String(i):i||(i=""),n[i]=o,r||(e.firstValue=i)}function o(t){return t}for(r in t.inputs)if(t.inputs.hasOwnProperty(r)){if(t.reserved.indexOf(r)>=0||Object.prototype[r])throw new Error("Reserved input name: "+r);(e=t.inputs[r]).name=r,isNaN(e.min)&&(e.min=-1/0),isNaN(e.max)&&(e.max=1/0),isNaN(e.minCount)&&(e.minCount=-1/0),isNaN(e.maxCount)&&(e.maxCount=1/0),isNaN(e.step)&&(e.step=0),isNaN(e.mod)&&(e.mod=0),"enum"===e.type&&e.options&&q(e.options)&&e.options.length&&(n={},e.options.forEach(i),e.options=n),"vector"===e.type?e.dimensions<2?e.dimensions=2:e.dimensions>4||!e.dimensions||isNaN(e.dimensions)?e.dimensions=4:e.dimensions=Math.round(e.dimensions):e.dimensions=1,e.shaderDirty=!!e.shaderDirty,"function"!=typeof e.validate&&(e.validate=K.inputValidators[e.type]||o),t.defaultImageInput||"image"!==e.type||(t.defaultImageInput=r)}}function $(t,e,n,r){var i,o,s,a;!0===r||r&&r.useFloat;this.type=t.UNSIGNED_BYTE,i=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,i),r&&r.texture?(this.texture=r.texture,t.bindTexture(t.TEXTURE_2D,this.texture),this.ownTexture=!1):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),this.ownTexture=!0);try{this.type===t.FLOAT?(s=new Float32Array(e*n*4),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,n,0,t.RGBA,t.FLOAT,s)):(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,n,0,t.RGBA,t.UNSIGNED_BYTE,null),this.type=t.UNSIGNED_BYTE)}catch(r){this.type=t.UNSIGNED_BYTE,s=new Uint8Array(e*n*4),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,n,0,t.RGBA,t.UNSIGNED_BYTE,s)}if(o=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,o),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,e,n),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,o),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.texture,0),(a=t.checkFramebufferStatus(t.FRAMEBUFFER))===t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT)throw new Error("Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_ATTACHMENT");if(a===t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT)throw new Error("Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");if(a===t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS)throw new Error("Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_DIMENSIONS");if(a===t.FRAMEBUFFER_UNSUPPORTED)throw new Error("Incomplete framebuffer: FRAMEBUFFER_UNSUPPORTED");if(a!==t.FRAMEBUFFER_COMPLETE)throw new Error("Incomplete framebuffer: "+a);t.bindTexture(t.TEXTURE_2D,null),t.bindRenderbuffer(t.RENDERBUFFER,null),t.bindFramebuffer(t.FRAMEBUFFER,null),this.gl=t,this.frameBuffer=i,this.renderBuffer=o,this.width=e,this.height=n}function X(t,e,n){var r,i,o,s,a,c,u,h,l="";function f(e,n){var r,i;if(r=n?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER),t.shaderSource(r,e),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){for(e=e.split(/[\n\r]/),i=0;i<e.length;i++)e[i]=i+1+":\t"+e[i];throw e.unshift("Error compiling "+(n?"fragment":"vertex")+" shader:"),K.logger.error(e.join("\n")),new Error("Shader error: "+t.getShaderInfoLog(r))}return r}function d(e,n){if(e.type===t.SAMPLER_2D)return function(r){e.glTexture=t["TEXTURE"+r],t.uniform1i(n,r)};if(e.type===t.BOOL||e.type===t.INT)return e.size>1?function(e){t.uniform1iv(n,e)}:function(e){t.uniform1i(n,e)};if(e.type===t.FLOAT)return e.size>1?function(e){t.uniform1fv(n,e)}:function(e){t.uniform1f(n,e)};if(e.type===t.FLOAT_VEC2)return function(e){t.uniform2f(n,e[0],e[1])};if(e.type===t.FLOAT_VEC3)return function(e){t.uniform3f(n,e[0],e[1],e[2])};if(e.type===t.FLOAT_VEC4)return function(e){t.uniform4f(n,e[0],e[1],e[2],e[3])};if(e.type===t.FLOAT_MAT3)return function(e){t.uniformMatrix3fv(n,!1,e)};if(e.type===t.FLOAT_MAT4)return function(e){t.uniformMatrix4fv(n,!1,e)};throw new Error("Unknown shader uniform type: "+e.type)}function p(e){return function(){return t.getUniform(r,e)}}if(i=f(e),o=f(n,!0),r=t.createProgram(),t.attachShader(r,i),(s=t.getShaderInfoLog(i))&&(l+="Vertex shader error: "+s+"\n"),t.attachShader(r,o),(s=t.getShaderInfoLog(o))&&(l+="Fragment shader error: "+s+"\n"),t.linkProgram(r),!t.getProgramParameter(r,t.LINK_STATUS))throw l+=t.getProgramInfoLog(r),t.deleteProgram(r),t.deleteShader(i),t.deleteShader(o),(u=O.exec(e)||O.exec(n))&&(l="Shader = "+u[1]+"\n"+l),M.forEach((function(e){l+="\n"+e+": "+t.getParameter(t[e])})),new Error("Could not initialize shader:\n"+l);for(t.useProgram(r),this.uniforms={},c=t.getProgramParameter(r,t.ACTIVE_UNIFORMS),a=0;a<c;++a)(h={info:t.getActiveUniform(r,a)}).name=h.info.name.replace(/\[0\]$/,""),h.loc=t.getUniformLocation(r,h.name),h.set=d(h.info,h.loc),h.get=p(h.loc),this.uniforms[h.name]=h,this[h.name]||(this[h.name]=h);for(this.attributes={},this.location={},c=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES),a=0;a<c;++a)(h={info:t.getActiveAttrib(r,a)}).name=h.info.name,h.location=t.getAttribLocation(r,h.name),this.attributes[h.name]=h,this.location[h.name]=h.location;this.gl=t,this.program=r,this.destroy=function(){var e;for(e in t&&(t.deleteProgram(r),t.deleteShader(i),t.deleteShader(o)),this)this.hasOwnProperty(e)&&delete this[e];r=null,i=null,o=null}}function K(t){if(window===this||!(this instanceof K)||void 0!==this.id)return new K(t);var e,n,r,i,o,a,p,y,S,x,T,C,E,M,I,D=++_,j=this,F=[],V={},q=0,G=[],J=[],Z=[],Q=[],tt={},et=[],nt=[],rt={},it={},ot=!1,st=!1;function at(t,e){var n,r,i;return!!e&&(n=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,t.vertices,e.STATIC_DRAW),n.size=3,r=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r),e.bufferData(e.ELEMENT_ARRAY_BUFFER,t.indices,e.STATIC_DRAW),i=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,t.coords,e.STATIC_DRAW),i.size=2,{vertex:n,index:r,texCoord:i,length:t.indices.length,mode:t.mode||e.TRIANGLES})}function ct(t){var e={};return e.vertices=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,1,0]),e.indices=new Uint16Array([0,1,2,0,2,3]),e.coords=new Float32Array([0,0,1,0,1,1,0,1]),at(e,t)}function ut(t){var r,s;if(!n)if(t.canvas.addEventListener("webglcontextlost",lt,!1),t.canvas.addEventListener("webglcontextrestored",ht,!1),t.isContextLost())K.logger.warn("Unable to attach lost WebGL context. Will try again when context is restored.");else{for(n=t,e=t.canvas,i=ct(n),o=new X(n,"#define SHADER_NAME seriously.base\n"+c,"#define SHADER_NAME seriously.base\n"+u),r=0;r<Q.length;r++)(s=Q[r]).gl=n,s.initialize(),s.buildShader();for(r=0;r<G.length;r++)(s=G[r]).initialize();for(r=0;r<J.length;r++)(s=J[r]).model||(s.model=i,s.shader=o)}}function ht(){var t,e,i,o;if(r&&!n){if(B(e=r.target,"WebGLFramebuffer"))return void K.logger.error("Unable to restore target built on WebGLFramebuffer");if(t=z(e,{alpha:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!0,stencil:!0,debugContext:r.debugContext})){if(t.isContextLost())return void K.logger.error("Unable to restore WebGL Context");for(ut(t),r.renderToTexture?r.frameBuffer=new $(n,r.width,r.height,!1):r.frameBuffer={frameBuffer:null},i=0;i<F.length;i++)(o=F[i]).setDirty(),o.emit("webglcontextrestored");K.logger.log("WebGL context restored")}}}function lt(t){var r,s;for(t&&(K.logger.warn("WebGL context lost"),t.preventDefault()),I&&(k(I),I=0),e&&e.removeEventListener("webglcontextlost",lt,!1),r=0;r<Q.length;r++)(s=Q[r]).gl=null,s.initialized=!1,s.baseShader=null,s.model=null,s.frameBuffer=null,s.texture=null,s.shader&&s.shader.destroy&&(s.shader.destroy(),s.effect.commonShader&&delete it[s.hook]),s.shaderDirty=!0,s.shader=null,s.effect.lostContext&&s.effect.lostContext.call(s),t&&s.emit("webglcontextlost");for(r=0;r<G.length;r++)(s=G[r]).texture=null,s.initialized=!1,s.allowRefresh=!1,t&&s.emit("webglcontextlost");for(r=0;r<Z.length;r++)(s=Z[r]).frameBuffer=null,s.texture=null,t&&s.emit("webglcontextlost");for(r=0;r<J.length;r++)(s=J[r]).model=!1,s.frameBuffer=null,t&&s.emit("webglcontextlost");o&&o.destroy&&o.destroy(),n&&(n.deleteBuffer(i.vertex),n.deleteBuffer(i.texCoord),n.deleteBuffer(i.index)),i&&(delete i.vertex,delete i.texCoord,delete i.index),i=null,o=null,n=null,e=null}function ft(t){var e,n,r=!1;if(I=0,et.length)for(r=!0,e=0;e<et.length;e++)et[e].call(j,t);if(G&&G.length)for(r=!0,e=0;e<G.length;e++)((n=G[e]).dirty||n.checkDirty&&n.checkDirty())&&(n.dirty=!1,n.setDirty());for(e=0;e<J.length;e++)(n=J[e]).auto&&n.dirty&&n.render();if(nt.length)for(r=!0,e=0;e<nt.length;e++)nt[e].call(j);r&&!I&&(I=P(ft))}function dt(t,e,r,i,o,s){var a,c,u,h,l,f,d,v,g,m=0,b=o&&o.gl||n;if(b){for(a in o?(h=s&&s.width||o.width||b.canvas.width,l=s&&s.height||o.height||b.canvas.height):(h=s&&s.width||b.canvas.width,l=s&&s.height||b.canvas.height),t.use(),b.viewport(0,0,h,l),b.bindFramebuffer(b.FRAMEBUFFER,i),b.enableVertexAttribArray(t.location.position),b.enableVertexAttribArray(t.location.texCoord),e.texCoord&&(b.bindBuffer(b.ARRAY_BUFFER,e.texCoord),b.vertexAttribPointer(t.location.texCoord,e.texCoord.size,b.FLOAT,!1,0,0)),b.bindBuffer(b.ARRAY_BUFFER,e.vertex),b.vertexAttribPointer(t.location.position,e.vertex.size,b.FLOAT,!1,0,0),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e.index),s&&s.depth?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),s?void 0===s.blend||s.blend?(n.enable(n.BLEND),f=void 0===s.srcRGB?n.ONE:s.srcRGB,v=s.dstRGB||n.ZERO,d=void 0===s.srcAlpha?f:s.srcAlpha,g=void 0===s.dstAlpha?v:s.dstAlpha,n.blendFuncSeparate(f,v,d,g),n.blendEquation(s.blendEquation||n.FUNC_ADD)):n.disable(n.BLEND):(n.enable(n.BLEND),n.blendFunc(n.ONE,n.ZERO),n.blendEquation(n.FUNC_ADD)),r)r.hasOwnProperty(a)&&(c=r[a],(u=t.uniforms[a])&&(B(c,"WebGLTexture")?(b.activeTexture(b.TEXTURE0+m),b.bindTexture(b.TEXTURE_2D,c),u.set(m),m++):c instanceof p||c instanceof y||c instanceof S?c.texture&&(b.activeTexture(b.TEXTURE0+m),b.bindTexture(b.TEXTURE_2D,c.texture),u.set(m),m++):null!=c&&u.set(c)));s&&void 0!==s.clear&&!s.clear||(b.clearColor(0,0,0,0),b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)),b.drawElements(e.mode,e.length,b.UNSIGNED_SHORT,0),n.enable(n.DEPTH_TEST)}}function pt(t,e,n){var r,i;if(("string"!=typeof t||!e&&0!==e)&&(n&&"object"==typeof n||(n=e),e=t),"string"==typeof t&&f[t]||(t=null),e instanceof p||e instanceof y||e instanceof S)r=e;else if(e instanceof T||e instanceof C||e instanceof E){if(!(r=V[e.id]))throw new Error("Cannot connect a foreign node")}else{for("string"==typeof e&&isNaN(e)&&(e=L(e,["canvas","img","video"])),i=0;i<G.length;i++)if(r=G[i],(!t||t===r.hook)&&r.compare&&r.compare(e,n))return r;r=new p(t,e,n)}return r}function vt(t,e){var n,r,i;if(!(t instanceof y||t instanceof S))return!1;if(t===e)return!0;for(n in i=t.sources)if(i.hasOwnProperty(n)&&((r=i[n])===e||vt(r,e)))return!0;return!1}(a=function(){this.ready=!1,this.width=1,this.height=1,this.gl=n,this.uniforms={resolution:[this.width,this.height],transform:null},this.dirty=!0,this.isDestroyed=!1,this.seriously=j,this.listeners={},this.id=q,q++}).prototype.setReady=function(){var t;if(!this.ready&&(this.ready=!0,this.emit("ready"),this.targets))for(t=0;t<this.targets.length;t++)this.targets[t].setReady()},a.prototype.setUnready=function(){var t;if(this.ready&&(this.ready=!1,this.emit("unready"),this.targets))for(t=0;t<this.targets.length;t++)this.targets[t].setUnready()},a.prototype.setDirty=function(){var t;if(!this.dirty&&(this.emit("dirty"),this.dirty=!0,this.targets))for(t=0;t<this.targets.length;t++)this.targets[t].setDirty()},a.prototype.initFrameBuffer=function(t){n&&(this.frameBuffer=new $(n,this.width,this.height,t))},a.prototype.readPixels=function(t,e,r,i,o){var s=this.gl||n;if(!n)throw new Error("Cannot read pixels until a canvas is connected");if(this.frameBuffer||(this.initFrameBuffer(),this.setDirty()),this.render(),void 0===o)o=new Uint8Array(r*i*4);else if(!B(o,"Uint8Array"))throw new Error("Incompatible array type");return s.bindFramebuffer(n.FRAMEBUFFER,this.frameBuffer.frameBuffer),s.readPixels(t,e,r,i,n.RGBA,n.UNSIGNED_BYTE,o),o},a.prototype.resize=function(){var t,e;this.source?(t=this.source.width,e=this.source.height):this.sources&&this.sources.source?(t=this.sources.source.width,e=this.sources.source.height):this.inputs&&this.inputs.width?(t=this.inputs.width,e=this.inputs.height||t):this.inputs&&this.inputs.height?t=e=this.inputs.height:(t=1,e=1),t=Math.floor(t),e=Math.floor(e),this.width===t&&this.height===e||(this.width=t,this.height=e,this.emit("resize"),this.setDirty()),this.uniforms&&this.uniforms.resolution&&(this.uniforms.resolution[0]=t,this.uniforms.resolution[1]=e),this.frameBuffer&&this.frameBuffer.resize&&this.frameBuffer.resize(t,e)},a.prototype.on=function(t,e){var n,r=-1;t&&"function"==typeof e&&((n=this.listeners[t])?r=n.indexOf(e):n=this.listeners[t]=[],r<0&&n.push(e))},a.prototype.off=function(t,e){var n,r=-1;t&&"function"==typeof e&&(n=this.listeners[t])&&(r=n.indexOf(e))>=0&&n.splice(r,1)},a.prototype.emit=function(t){var e,n=this.listeners[t];if(n&&n.length)for(e=0;e<n.length;e++)H(n[e])},a.prototype.destroy=function(){var t,e;for(e in delete this.gl,delete this.seriously,this.listeners)this.listeners.hasOwnProperty(e)&&delete this.listeners[e];for(t in this.uniforms)this.uniforms.hasOwnProperty(t)&&delete this.uniforms[t];this.targets&&delete this.targets,this.frameBuffer&&this.frameBuffer.destroy&&(this.frameBuffer.destroy(),delete this.frameBuffer),(t=F.indexOf(this))>=0&&F.splice(t,1),delete V[this.id],this.isDestroyed=!0},T=function(t){var e,n=t;function r(t,e){var r,i,o;return o=n.effect.inputs[t],r=n.inputElements[t],"string"==typeof e&&isNaN(e)&&("enum"===o.type?o.options.hasOwnProperty(e)||(e=L(e,["select"])):"number"===o.type||"boolean"===o.type?e=L(e,["input","select"]):"image"===o.type&&(e=L(e,["canvas","img","video"]))),B(e,"HTMLInputElement")||B(e,"HTMLSelectElement")?(i=e.value,r&&r.element!==e&&(r.element.removeEventListener("change",r.listener,!0),r.element.removeEventListener("input",r.listener,!0),delete n.inputElements[t],r=null),r||(r={element:e,listener:function(t,r){return function(){var i,s;i="checkbox"===e.type?e.checked:r.value,s=n.setInput(t,i),"color"===o.type&&(s=W(s).substr(0,7)),s!==i&&(r.value=s)}}(t,e)},n.inputElements[t]=r,"range"===e.type?(e.addEventListener("input",r.listener,!0),e.addEventListener("change",r.listener,!0)):e.addEventListener("change",r.listener,!0)),r&&"checkbox"===e.type&&(i=e.checked)):(r&&(r.element.removeEventListener("change",r.listener,!0),r.element.removeEventListener("input",r.listener,!0),delete n.inputElements[t]),i=e),n.setInput(t,i),n.inputs[t]}function i(t){return function(e){var n=r(t,e);return n&&n.pub}}function o(t){return function(){var e=n.inputs[t];return e&&e.pub}}function s(t){return function(e){return r(t,e)}}function a(t){return function(){return n.inputs[t]}}for(e in n.effect.inputs)if(n.effect.inputs.hasOwnProperty(e)){if(void 0!==this[e])throw new Error("Cannot overwrite Seriously."+e);"image"===n.effect.inputs[e].type?Object.defineProperty(this,e,{configurable:!0,enumerable:!0,get:o(e),set:i(e)}):Object.defineProperty(this,e,{configurable:!0,enumerable:!0,get:a(e),set:s(e)})}Object.defineProperties(this,{effect:{enumerable:!0,configurable:!0,get:function(){return n.hook}},title:{enumerable:!0,configurable:!0,get:function(){return n.effect.title||n.hook}},width:{enumerable:!0,configurable:!0,get:function(){return n.width}},height:{enumerable:!0,configurable:!0,get:function(){return n.height}},id:{enumerable:!0,configurable:!0,get:function(){return n.id}}}),this.render=function(){return n.render(),this},this.readPixels=function(t,e,r,i,o){return n.readPixels(t,e,r,i,o)},this.on=function(t,e){n.on(t,e)},this.off=function(t,e){n.off(t,e)},this.inputs=function(t){var e,r,i,o;if(i=n.effect.inputs,t)return(r=i[t])?(e={type:r.type,defaultValue:r.defaultValue,title:r.title||t},"number"===r.type?(e.min=r.min,e.max=r.max,e.step=r.step,e.mod=r.mod):"enum"===r.type?e.options=U({},r.options):"vector"===r.type&&(e.dimensions=r.dimensions),r.description&&(e.description=r.description),e):null;for(o in e={},i)i.hasOwnProperty(o)&&(e[o]=this.inputs(o));return e},this.alias=function(t,e){return n.alias(t,e),this},this.matte=function(t){n.matte(t)},this.destroy=function(){var t,e;for(t in n.destroy(),this)this.hasOwnProperty(t)&&"isDestroyed"!==t&&"id"!==t&&((e=Object.getOwnPropertyDescriptor(this,t)).get||e.set||"function"!=typeof this[t]?delete this[t]:this[t]=w)},this.isDestroyed=function(){return n.isDestroyed},this.isReady=function(){return n.ready}},(y=function(t,e){var r,i,o,c,u={};for(r in a.call(this,e),this.gl=n,this.effectRef=h[t],this.sources={},this.targets=[],this.inputElements={},this.dirty=!0,this.shaderDirty=!0,this.hook=t,this.options=e,this.transform=null,this.effect=U({},this.effectRef),this.effectRef.definition&&U(this.effect,this.effectRef.definition.call(this,e)),Y(this.effect),this.uniforms.transform=s,this.inputs={},c=rt[t],this.effect.inputs)this.effect.inputs.hasOwnProperty(r)&&(void 0!==(i=this.effect.inputs[r]).defaultValue&&null!==i.defaultValue||("number"===i.type?i.defaultValue=Math.min(Math.max(0,i.min),i.max):"color"===i.type?i.defaultValue=[0,0,0,0]:"boolean"===i.type?i.defaultValue=!1:"string"===i.type?i.defaultValue="":"enum"===i.type&&(i.defaultValue=i.firstValue)),o=i.validate.call(this,i.defaultValue,i),c&&void 0!==c[r]&&(o=i.validate.call(this,c[r],i,i.defaultValue,o),c[r]=o,"image"===i.type&&(u[r]=o)),this.inputs[r]=o,i.uniform&&(this.uniforms[i.uniform]=i.defaultValue));for(r in n&&(this.initialize(),this.effect.commonShader&&this.buildShader()),this.updateReady(),this.inPlace=this.effect.inPlace,this.pub=new T(this),F.push(this),V[this.id]=this,Q.push(this),v[t].push(this),u)u.hasOwnProperty(r)&&this.setInput(r,u[r])}).prototype=Object.create(a.prototype),y.prototype.constructor=y,y.prototype.initialize=function(){if(!this.initialized){var t=this;this.baseShader=o,this.shape?this.model=at(this.shape,this.gl):this.model=i,"function"==typeof this.effect.initialize?this.effect.initialize.call(this,(function(){t.initFrameBuffer(!0)}),n):this.initFrameBuffer(!0),this.frameBuffer&&(this.texture=this.frameBuffer.texture),this.initialized=!0}},y.prototype.resize=function(){var t;for(a.prototype.resize.call(this),this.effect.resize&&this.effect.resize.call(this),t=0;t<this.targets.length;t++)this.targets[t].resize()},y.prototype.updateReady=function(){var t,e,n,r,i=!0;for(e in(n=this.effect).inputs)if(n.inputs.hasOwnProperty(e)&&"image"===this.effect.inputs[e].type&&(!this.sources[e]||!this.sources[e].ready)&&(!n.requires||n.requires.call(this,e,this.inputs))){i=!1;break}if(this.ready!==i&&(this.ready=i,this.emit(i?"ready":"unready"),r=i?"setReady":"setUnready",this.targets))for(t=0;t<this.targets.length;t++)this.targets[t][r]()},y.prototype.setReady=y.prototype.updateReady,y.prototype.setUnready=y.prototype.updateReady,y.prototype.addTarget=function(t){var e;for(e=0;e<this.targets.length;e++)if(this.targets[e]===t)return;this.targets.push(t)},y.prototype.removeTarget=function(t){var e=this.targets&&this.targets.indexOf(t);e>=0&&this.targets.splice(e,1)},y.prototype.removeSource=function(t){var e,n=t&&t.pub;for(e in this.inputs)!this.inputs.hasOwnProperty(e)||this.inputs[e]!==t&&this.inputs[e]!==n||(this.inputs[e]=null);for(e in this.sources)!this.sources.hasOwnProperty(e)||this.sources[e]!==t&&this.sources[e]!==n||(this.sources[e]=null)},y.prototype.buildShader=function(){var t,e=this.effect,r=this;function i(t){return O.test(t)?t:"#define SHADER_NAME seriously."+r.hook+"\n"+t}this.shaderDirty&&(e.commonShader&&it[this.hook]?(this.shader||it[this.hook].count++,this.shader=it[this.hook].shader):e.shader?(this.shader&&!e.commonShader&&this.shader.destroy(),(t=e.shader.call(this,this.inputs,{vertex:c,fragment:u},K.util))instanceof X?this.shader=t:t&&t.vertex&&t.fragment?this.shader=new X(n,i(t.vertex),i(t.fragment)):this.shader=o,e.commonShader&&(it[this.hook]={count:1,shader:this.shader})):this.shader=o,this.shaderDirty=!1)},y.prototype.render=function(){var t,e,r,i=this.effect,o=this;if(n){if(this.initialized||this.initialize(),this.shaderDirty&&this.buildShader(),this.dirty&&this.ready){for(t in this.sources)!this.sources.hasOwnProperty(t)||i.requires&&!i.requires.call(this,t,this.inputs)||(r="function"==typeof this.inPlace?this.inPlace(t):this.inPlace,this.sources[t].render(!r));this.frameBuffer&&(e=this.frameBuffer.frameBuffer),"function"==typeof i.draw?(i.draw.call(this,this.shader,this.model,this.uniforms,e,(function(t,e,n,r,i,s){dt(t,e,n,r,i||o,s)})),this.emit("render")):e&&(dt(this.shader,this.model,this.uniforms,e,this),this.emit("render")),this.dirty=!1}return this.texture}},y.prototype.setInput=function(t,e){var n,r,i,o,a,c=this;if(this.effect.inputs.hasOwnProperty(t)){if("image"===(n=this.effect.inputs[t]).type){if(e){if((e=pt(e))!==this.sources[t]){if(function(){var e,n=c.sources[t];if(n){for(e in c.sources)if(e!==t&&c.sources.hasOwnProperty(e)&&c.sources[e]===n)return;n.removeTarget(c)}}(),vt(e,this))throw new Error("Attempt to make cyclical connection.");this.sources[t]=e,e.addTarget(this)}}else delete this.sources[t],e=!1;r=this.sources[t],i=Object.keys(this.sources),!0===this.inPlace&&1===i.length?(o=this.sources[i[0]],this.uniforms.transform=o&&o.cumulativeMatrix||s):this.uniforms.transform=s}else a=rt[this.hook]&&void 0!==rt[this.hook][t]?rt[this.hook][t]:n.defaultValue,r=e=n.validate.call(this,e,n,a,this.inputs[t]);return this.inputs[t]===e&&"color"!==n.type&&"vector"!==n.type||(this.inputs[t]=e,n.uniform&&(this.uniforms[n.uniform]=r),"image"===n.type?(this.resize(),this.updateReady()):n.updateSources&&this.updateReady(),n.shaderDirty&&(this.shaderDirty=!0),this.setDirty(),n.update&&n.update.call(this,e)),e}},y.prototype.alias=function(t,e){var n=this;if(N.indexOf(e)>=0)throw new Error("'"+e+"' is a reserved name and cannot be used as an alias.");return this.effect.inputs.hasOwnProperty(t)&&(e||(e=t),j.removeAlias(e),tt[e]={node:this,input:t},Object.defineProperty(j,e,{configurable:!0,enumerable:!0,get:function(){return n.inputs[t]},set:function(e){return n.setInput(t,e)}})),this},y.prototype.matte=function(t){var e,n,r,i,o,s,a,c=[],u=[],h={};function l(t){var e,n,r,i,o,s,a,h,l,f,d,p=[];if(!t.simple){for(e=0;e<t.edges.length;e++)for(r=t.edges[e],n=e+1;n<t.edges.length;n++)i=t.edges[n],v=r[0],g=r[1],m=i[0],y=i[1],b=void 0,_=void 0,w=void 0,S=void 0,x=void 0,b=(y.x-m.x)*(v.y-m.y)-(y.y-m.y)*(v.x-m.x),_=(g.x-v.x)*(v.y-m.y)-(g.y-v.y)*(v.x-m.x),(o=!!((w=(y.y-m.y)*(g.x-v.x)-(y.x-m.x)*(g.y-v.y))&&(x=_/w,(S=b/w)>0&&S<=1&&x>0&&x<=1))&&{x:v.x+S*(g.x-v.x),y:v.y+S*(g.y-v.y)})&&(o.edge1=r,o.edge2=i,p.push(o));var v,g,m,y,b,_,w,S,x;if(p.length){for(l=[],e=0;e<p.length;e++)r=(o=p[e]).edge1,i=o.edge2,f={x:o.x,y:o.y,prev:r[0],next:i[1],id:u.length},t.vertices.push(f),u.push(f),d={x:o.x,y:o.y,prev:i[0],next:r[1],id:u.length},t.vertices.push(d),u.push(f),f.prev.next=f,f.next.prev=f,d.prev.next=d,d.next.prev=d;do{s={edges:[],vertices:[],simple:!0},l.push(s),a=h=t.vertices[0];do{e=t.vertices.indexOf(h),t.vertices.splice(e,1),s.edges.push([h,h.next]),s.vertices.push(h),h=h.next}while(h!==a)}while(t.vertices.length);for(e=c.indexOf(t),c.splice(e,1),e=0;e<l.length;e++)c.push(l[e])}else t.simple=!0}}function f(t){var e,n,r,i,o=t.vertices.length,s=0;for(e=o-1,n=0;n<o;e=n,n++)r=t.vertices[e],i=t.vertices[n],s+=r.x*i.y-i.x*r.y;return s>0}function d(t){var e,r,i,o,s,a,c,u,h,l,f,d=t.vertices,p=[],v=[];function g(t,e,n,r){var i,o,s,a,c,u,h,l,f,d,p,v;return i=n.x-e.x,o=n.y-e.y,s=t.x-n.x,a=t.y-n.y,c=e.x-t.x,u=e.y-t.y,h=r.x-t.x,l=r.y-t.y,f=r.x-e.x,d=r.y-e.y,p=r.x-n.x,v=r.y-n.y,i*d-o*f>=0&&s*v-a*p>=0&&c*l-u*h>=0}function m(t,e,n,r,i){var o,s,a,c;if(s=d[i[t]],a=d[i[e]],c=d[i[n]],0>(a.x-s.x)*(c.y-s.y)-(a.y-s.y)*(c.x-s.x))return!1;for(o=0;o<r;o++)if(o!==t&&o!==e&&o!==n&&g(s,a,c,d[i[o]]))return!1;return!0}if(r=d.length,t.clockWise)for(e=0;e<r;e++)p[e]=e;else for(e=0;e<r;e++)p[e]=r-1-e;for(o=2*(i=r),e=i-1;i>2;){if(o--<=0)return v;if(i<=(s=e)&&(s=0),i<=(e=s+1)&&(e=0),i<(a=e+1)&&(a=0),m(s,e,a,i,p)){for(c=p[s],u=p[e],h=p[a],t.clockWise?(v.push(d[c]),v.push(d[u]),v.push(d[h])):(v.push(d[h]),v.push(d[u]),v.push(d[c])),l=e,f=e+1;f<i;l++,f++)p[l]=p[f];o=2*--i}}n.indices=v}for(e=function(t){return t&&t.length&&Array.isArray(t)?Array.isArray(t[0])?Array.isArray(t[0])&&!isNaN(t[0][0])?[t]:t:[t]:[]}(t),r=0;r<e.length;r++){for(t=e[r],a=null,n={vertices:[],edges:[]},i=0;i<t.length;i++)"object"!=typeof(o=t[i])||isNaN(o.x)||isNaN(o.y)?o.length>=2&&!isNaN(o[0])&&!isNaN(o[1])&&(s={x:o[0],y:o[1],id:u.length}):s={x:o.x,y:o.y,id:u.length},s&&(a?(a.next=s,s.prev=a,s.next=n.vertices[0],n.vertices[0].prev=s):(n.head=s,s.next=s,s.prev=s),u.push(s),n.vertices.push(s),a=s);if(n.vertices.length>2)for(3===n.vertices.length&&(n.simple=!0),c.push(n),i=0;i<n.vertices.length;i++)s=n.vertices[i],n.edges.push([s,s.next])}for(r=c.length-1;r>=0;r--)l(n=c[r]);for(r=0;r<c.length;r++)(n=c[r]).clockWise=f(n),d(n);for(h.vertices=[],h.coords=[],r=0;r<u.length;r++)o=u[r],h.vertices.push(2*o.x-1),h.vertices.push(-2*o.y+1),h.vertices.push(-1),h.coords.push(o.x),h.coords.push(-1*o.y+1);for(h.vertices=new Float32Array(h.vertices),h.coords=new Float32Array(h.coords),h.indices=[],r=0;r<c.length;r++)for(n=c[r],i=0;i<n.indices.length;i++)o=n.indices[i],h.indices.push(o.id);h.indices=new Uint16Array(h.indices),this.shape=h,this.gl&&at(h,this.gl)},y.prototype.destroy=function(){var t,e,n,r=this.hook;for(e in this.effect.destroy&&"function"==typeof this.effect.destroy&&this.effect.destroy.call(this),delete this.effect,it[r]&&(it[r].count--,it[r].count||delete it[r]),this.shader&&this.shader.destroy&&this.shader!==o&&!it[r]&&this.shader.destroy(),delete this.shader,this.inputElements)this.inputElements.hasOwnProperty(e)&&((n=this.inputElements[e]).element.removeEventListener("change",n.listener,!0),n.element.removeEventListener("input",n.listener,!0));for(e in this.sources)this.sources.hasOwnProperty(e)&&((n=this.sources[e])&&n.removeTarget&&n.removeTarget(this),delete this.sources[e]);for(;this.targets.length;)(n=this.targets.pop())&&n.removeSource&&n.removeSource(this);for(e in this)this.hasOwnProperty(e)&&"id"!==e&&delete this[e];for(e in tt)tt.hasOwnProperty(e)&&(n=tt[e]).node===this&&j.removeAlias(e);(t=Q.indexOf(this))>=0&&Q.splice(t,1),(t=v[r].indexOf(this))>=0&&v[r].splice(t,1),a.prototype.destroy.call(this)},C=function(t){var e=t;Object.defineProperties(this,{original:{enumerable:!0,configurable:!0,get:function(){return e.source}},id:{enumerable:!0,configurable:!0,get:function(){return e.id}},width:{enumerable:!0,configurable:!0,get:function(){return e.width}},height:{enumerable:!0,configurable:!0,get:function(){return e.height}}}),this.render=function(){e.render()},this.update=function(){e.setDirty()},this.readPixels=function(t,n,r,i,o){return e.readPixels(t,n,r,i,o)},this.on=function(t,n){e.on(t,n)},this.off=function(t,n){e.off(t,n)},this.destroy=function(){var t,n;for(t in e.destroy(),this)this.hasOwnProperty(t)&&"isDestroyed"!==t&&"id"!==t&&((n=Object.getOwnPropertyDescriptor(this,t)).get||n.set||"function"!=typeof this[t]?delete this[t]:this[t]=w)},this.isDestroyed=function(){return e.isDestroyed},this.isReady=function(){return e.ready}},(p=function(t,e,r){var i,o,s=r||{},c=void 0===s.flip||s.flip,u=s.width,h=s.height,l=!1,d=this,p=!1;function v(t,e,n,r){var i=f[t];if(i.definition){if(!(i=i.definition.call(d,e,n,r)))return null;i=U(U({},f[t]),i)}return i}function g(t){return d.source===t}if(a.call(this),(t&&"string"!=typeof t||!e&&0!==e)&&(r&&"object"==typeof r||(r=e),e=t),"string"==typeof e&&isNaN(e)&&(e=L(e,["canvas","img","video"])),"string"==typeof t&&f[t]&&(o=v(t,e,r,!0))&&(this.hook=t,p=!0,l=o.deferTexture,this.plugin=o,this.compare=o.compare,this.checkDirty=o.checkDirty,o.source&&(e=o.source)),!o&&B(e))"CANVAS"===e.tagName?(this.width=e.width,this.height=e.height,this.render=this.renderImageCanvas,p=!0,this.hook="canvas",this.compare=g):"IMG"===e.tagName&&(this.width=e.naturalWidth||1,this.height=e.naturalHeight||1,e.complete&&e.naturalWidth||(l=!0),e.addEventListener("load",(function(){d.isDestroyed||(d.width===e.naturalWidth&&d.height===e.naturalHeight||(d.width=e.naturalWidth,d.height=e.naturalHeight,d.resize()),d.setDirty(),d.setReady())}),!0),this.render=this.renderImageCanvas,p=!0,this.hook="image",this.compare=g);else if(!o&&B(e,"WebGLTexture")){if(n&&!n.isTexture(e))throw new Error("Not a valid WebGL texture.");isNaN(u)?isNaN(h)||(u=h):isNaN(h)&&(h=u),this.width=u,this.height=h,void 0===s.flip&&(c=!1),p=!0,this.texture=e,this.initialized=!0,this.hook="texture",this.compare=g,this.render=function(){}}if(!p&&!o)for(i in f)if(f.hasOwnProperty(i)&&f[i]&&(o=v(i,e,r,!1))){this.hook=i,p=!0,l=o.deferTexture,this.plugin=o,this.compare=o.compare,this.checkDirty=o.checkDirty,o.source&&(e=o.source);break}if(!p)throw new Error("Unknown source type");this.source=e,void 0===this.flip&&(this.flip=c),this.targets=[],l||d.setReady(),this.pub=new C(this),F.push(this),V[this.id]=this,G.push(this),m[this.hook].push(this),G.length&&!I&&ft()}).prototype=Object.create(a.prototype),p.prototype.constructor=p,p.prototype.initialize=function(){var t;n&&!this.texture&&this.ready&&(t=n.createTexture(),n.bindTexture(n.TEXTURE_2D,t),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.bindTexture(n.TEXTURE_2D,null),this.texture=t,this.initialized=!0,this.allowRefresh=!0,this.setDirty())},p.prototype.initFrameBuffer=function(t){n&&(this.frameBuffer=new $(n,this.width,this.height,{texture:this.texture,useFloat:t}))},p.prototype.addTarget=function(t){var e;for(e=0;e<this.targets.length;e++)if(this.targets[e]===t)return;this.targets.push(t)},p.prototype.removeTarget=function(t){var e=this.targets&&this.targets.indexOf(t);e>=0&&this.targets.splice(e,1)},p.prototype.resize=function(){var t,e;if(this.uniforms.resolution[0]=this.width,this.uniforms.resolution[1]=this.height,this.framebuffer&&this.framebuffer.resize(this.width,this.height),this.emit("resize"),this.setDirty(),this.targets)for(t=0;t<this.targets.length;t++)(e=this.targets[t]).resize(),e.setTransformDirty&&e.setTransformDirty()},p.prototype.setReady=function(){var t;if(!this.ready&&(this.ready=!0,this.resize(),this.initialize(),this.emit("ready"),this.targets))for(t=0;t<this.targets.length;t++)this.targets[t].setReady()},p.prototype.render=function(){var t=this.source;n&&(t||0===t)&&this.ready&&(this.initialized||this.initialize(),this.allowRefresh&&this.plugin&&this.plugin.render&&(this.dirty||this.checkDirty&&this.checkDirty())&&this.plugin.render.call(this,n,dt,i,o)&&(this.dirty=!1,this.emit("render")))},p.prototype.renderImageCanvas=function(){var t=this.source;if(n&&t&&this.ready&&(this.initialized||this.initialize(),this.allowRefresh&&this.dirty)){n.bindTexture(n.TEXTURE_2D,this.texture),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,this.flip),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1);try{return n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t),this.dirty=!1,this.emit("render"),!0}catch(t){t.code===window.DOMException.SECURITY_ERR&&(this.allowRefresh=!1,K.logger.error("Unable to access cross-domain image"))}return!1}},p.prototype.destroy=function(){var t,e,r;for(this.plugin&&this.plugin.destroy&&this.plugin.destroy.call(this),n&&this.texture&&n.deleteTexture(this.texture);this.targets.length;)(r=this.targets.pop())&&r.removeSource&&r.removeSource(this);for(e in(t=G.indexOf(this))>=0&&G.splice(t,1),(t=m[this.hook].indexOf(this))>=0&&m[this.hook].splice(t,1),this)this.hasOwnProperty(e)&&"id"!==e&&delete this[e];a.prototype.destroy.call(this)},M=function(t){var e=t;Object.defineProperties(this,{source:{enumerable:!0,configurable:!0,get:function(){if(e.source)return e.source.pub},set:function(t){e.setSource(t)}},original:{enumerable:!0,configurable:!0,get:function(){return e.target}},width:{enumerable:!0,configurable:!0,get:function(){return e.width},set:function(t){!isNaN(t)&&t>0&&e.width!==t&&(e.width=t,e.resize(),e.setTransformDirty())}},height:{enumerable:!0,configurable:!0,get:function(){return e.height},set:function(t){!isNaN(t)&&t>0&&e.height!==t&&(e.height=t,e.resize(),e.setTransformDirty())}},id:{enumerable:!0,configurable:!0,get:function(){return e.id}}}),this.render=function(){e.render()},this.readPixels=function(t,n,r,i,o){return e.readPixels(t,n,r,i,o)},this.on=function(t,n){e.on(t,n)},this.off=function(t,n){e.off(t,n)},this.go=function(t){e.go(t)},this.stop=function(){e.stop()},this.getTexture=function(){return e.frameBuffer.texture},this.destroy=function(){var t,n;for(t in e.destroy(),this)this.hasOwnProperty(t)&&"isDestroyed"!==t&&"id"!==t&&((n=Object.getOwnPropertyDescriptor(this,t)).get||n.set||"function"!=typeof this[t]?delete this[t]:this[t]=w)},this.inputs=function(t){return{source:{type:"image"}}},this.isDestroyed=function(){return e.isDestroyed},this.isReady=function(){return e.ready}},((x=function(t,e,s){var h,l,f,p,v,g,m,y,_,S=this,x=!1;function T(t,e,r,s){var a=d[t];if(a.definition){if(!(a=a.definition.call(S,e,r,s)))return null;a=U(U({},d[t]),a),S.hook=_,x=!0,S.plugin=a,S.compare=a.compare,a.target&&(e=a.target),a.gl&&!S.gl&&(S.gl=a.gl,n||ut(a.gl)),S.gl===n&&(S.model=i,S.shader=o)}return a}if(a.call(this),(t&&"string"!=typeof t||!e&&0!==e)&&(s&&"object"==typeof s||(s=e),e=t),l=void 0===(h=s||{}).flip||h.flip,f=parseInt(h.width,10),p=parseInt(h.height,10),g=h.debugContext,"string"==typeof t&&d[t]&&T(t,e,h,!0),this.renderToTexture=h.renderToTexture,B(e,"WebGLFramebuffer"))if(m=e,B(h,"HTMLCanvasElement"))e=h;else if(B(h,"WebGLRenderingContext"))e=h.canvas;else if(B(h.canvas,"HTMLCanvasElement"))e=h.canvas;else{if(!B(h.context,"WebGLRenderingContext"))throw new Error("Must provide a canvas with WebGLFramebuffer target");e=h.context.canvas}if(B(e,"HTMLCanvasElement")){if(f=e.width,p=e.height,(!n||n.canvas!==e&&h.allowSecondaryWebGL)&&(v=z(e,{alpha:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!0,stencil:!0,debugContext:g})),v)n&&n!==v?(this.gl=v,this.frameBuffer={frameBuffer:m||null},this.shader=new X(this.gl,c,u),this.model=ct.call(this,this.gl),this.pixels=null,this.texture=this.gl.createTexture(),this.gl.bindTexture(n.TEXTURE_2D,this.texture),this.gl.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),this.gl.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),this.gl.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),this.gl.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),this.render=this.renderSecondaryWebGL):(r||(r=this),n||ut(v),this.render=this.renderWebGL,h.renderToTexture?n&&(this.frameBuffer=new $(n,f,p,!1)):this.frameBuffer={frameBuffer:m||null});else{if(!h.allowSecondaryWebGL&&n&&n.canvas!==e)throw new Error("Only one WebGL target canvas allowed. Set allowSecondaryWebGL option to create secondary context.");this.render=w,K.logger.log("Unable to create WebGL context.")}x=!0}if(!x)for(_ in d)if(d.hasOwnProperty(_)&&d[_]&&T(_,e,h,!1))break;if(!x)throw new Error("Unknown target type");b&&((y=b.get(e))?K.logger.warn("Target already in use by another instance",e,Object.keys(y).map((function(t){return y[t]}))):(y={},b.set(e,y)),y[j.id]=j),this.target=e,this.transform=null,this.transformDirty=!0,this.flip=l,f&&(this.width=f),p&&(this.height=p),this.uniforms.resolution[0]=this.width,this.uniforms.resolution[1]=this.height,void 0!==h.auto?this.auto=h.auto:this.auto=ot,this.frames=0,this.pub=new M(this),F.push(this),V[this.id]=this,J.push(this)}).prototype=Object.create(a.prototype)).constructor=x,x.prototype.setSource=function(t){var e;(e=pt(t))!==this.source&&(this.source&&this.source.removeTarget(this),this.source=e,e.addTarget(this),e&&(this.resize(),e.ready?this.setReady():this.setUnready()),this.setDirty())},x.prototype.setDirty=function(){this.dirty=!0,this.auto&&!I&&(I=P(ft))},x.prototype.resize=function(){B(this.target,"HTMLCanvasElement")?this.width===this.target.width&&this.height===this.target.height||(this.target.width=this.width,this.target.height=this.height,this.uniforms.resolution[0]=this.width,this.uniforms.resolution[1]=this.height,this.emit("resize"),this.setTransformDirty()):this.plugin&&this.plugin.resize&&this.plugin.resize.call(this),!this.source||this.source.width===this.width&&this.source.height===this.height||this.transform||(this.transform=new Float32Array(16))},x.prototype.setTransformDirty=function(){this.transformDirty=!0,this.setDirty()},x.prototype.go=function(){this.auto=!0,this.setDirty()},x.prototype.stop=function(){this.auto=!1},x.prototype.render=function(){n&&this.plugin&&this.plugin.render&&this.plugin.render.call(this,dt,o,i)},x.prototype.renderWebGL=function(){var t,e,r;if(this.resize(),n&&this.dirty&&this.ready){if(!this.source)return;this.source.render(),this.uniforms.source=this.source.texture,this.source.width===this.width&&this.source.height===this.height?this.uniforms.transform=this.source.cumulativeMatrix||s:this.transformDirty&&(t=this.transform,A.copy(t,this.source.cumulativeMatrix||s),e=this.source.width/this.width,r=this.source.height/this.height,t[0]*=e,t[1]*=e,t[2]*=e,t[3]*=e,t[4]*=r,t[5]*=r,t[6]*=r,t[7]*=r,this.uniforms.transform=t,this.transformDirty=!1),dt(o,i,this.uniforms,this.frameBuffer.frameBuffer,this,R),this.emit("render"),this.dirty=!1}},x.prototype.renderSecondaryWebGL=function(){var t,e,n,r,i;this.dirty&&this.ready&&this.source&&(this.emit("render"),this.source.render(!0),t=this.source.width,e=this.source.height,this.pixels&&this.pixels.length===t*e*4||(this.pixels=new Uint8Array(t*e*4)),this.source.readPixels(0,0,t,e,this.pixels),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,t,e,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.pixels),t===this.width&&e===this.height?this.uniforms.transform=s:this.transformDirty&&(n=this.transform,A.copy(n,s),r=this.source.width/this.width,i=this.source.height/this.height,n[0]*=r,n[1]*=r,n[2]*=r,n[3]*=r,n[4]*=i,n[5]*=i,n[6]*=i,n[7]*=i,this.uniforms.transform=n,this.transformDirty=!1),this.uniforms.source=this.texture,dt(this.shader,this.model,this.uniforms,null,this,R),this.dirty=!1)},x.prototype.removeSource=function(t){this.source!==t&&this.source!==t.pub||(this.source=null)},x.prototype.destroy=function(){var t,n;this.source&&this.source.removeTarget&&this.source.removeTarget(this),b&&(delete(n=b.get(this.target))[j.id],Object.keys(n).length||b.delete(this.target)),this.plugin&&this.plugin.destroy&&this.plugin.destroy.call(this),delete this.source,delete this.target,delete this.pub,delete this.uniforms,delete this.pixels,delete this.auto,(t=J.indexOf(this))>=0&&J.splice(t,1),a.prototype.destroy.call(this),this===r&&(e.removeEventListener("webglcontextrestored",ht,!1),lt(),r=null)},E=function(t){var e,n=t,r=this;function i(t,e){Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get:function(){return e.get.call(n)},set:function(r){!function(t,e,r){var i,o,s;i=n.inputElements[t],"string"==typeof r&&isNaN(r)&&("enum"===e.type?e.options.hasOwnProperty(r)||(r=L(r,["select"])):"number"===e.type||"boolean"===e.type?r=L(r,["input","select"]):"image"===e.type&&(r=L(r,["canvas","img","video"]))),B(r,"HTMLInputElement")||B(r,"HTMLSelectElement")?(o=r.value,i&&i.element!==r&&(i.element.removeEventListener("change",i.listener,!0),i.element.removeEventListener("input",i.listener,!0),delete n.inputElements[t],i=null),i||(i={element:r,listener:(s=r,function(){var e,i;e="checkbox"===r.type?r.checked:s.value,i=n.setInput(t,e),"color"===r.type&&(i=W(i)),i!==e&&(s.value=i)})},n.inputElements[t]=i,"range"===r.type?(r.addEventListener("input",i.listener,!0),r.addEventListener("change",i.listener,!0)):r.addEventListener("change",i.listener,!0)),i&&"checkbox"===r.type&&(o=r.checked)):(i&&(i.element.removeEventListener("change",i.listener,!0),i.element.removeEventListener("input",i.listener,!0),delete n.inputElements[t]),o=r),n.setInput(t,o)}(t,e,r)}})}function o(t){return function(){t.apply(n,arguments)&&n.setTransformDirty()}}for(e in Object.defineProperties(this,{transform:{enumerable:!0,configurable:!0,get:function(){return n.hook}},title:{enumerable:!0,configurable:!0,get:function(){return n.plugin.title||n.hook}},width:{enumerable:!0,configurable:!0,get:function(){return n.width}},height:{enumerable:!0,configurable:!0,get:function(){return n.height}},id:{enumerable:!0,configurable:!0,get:function(){return n.id}},source:{enumerable:!0,configurable:!0,get:function(){return n.source&&n.source.pub},set:function(t){n.setSource(t)}}}),n.methods)n.methods.hasOwnProperty(e)&&(this[e]=o(n.methods[e]));for(e in n.inputs)n.inputs.hasOwnProperty(e)&&i(e,n.inputs[e]);this.update=function(){n.setDirty()},this.inputs=function(t){var e,r,i,o;if(i=n.plugin.inputs,t)return!(r=i[t])||r.method?null:(e={type:r.type,defaultValue:r.defaultValue,title:r.title||t},"number"===r.type?(e.min=r.min,e.max=r.max,e.step=r.step,e.mod=r.mod):"enum"===r.type?e.options=U({},r.options):"vector"===r.type&&(e.dimensions=r.dimensions),r.description&&(e.description=r.description),e);for(o in e={},i)i.hasOwnProperty(o)&&!i[o].method&&(e[o]=this.inputs(o));return e},this.alias=function(t,e){return n.alias(t,e),this},this.on=function(t,e){n.on(t,e)},this.off=function(t,e){n.off(t,e)},this.destroy=function(){var t,e;for(t in n.destroy(),this)this.hasOwnProperty(t)&&"isDestroyed"!==t&&"id"!==t&&((e=Object.getOwnPropertyDescriptor(this,t)).get||e.set||"function"!=typeof this[t]?delete this[t]:this[t]=w)},this.isDestroyed=function(){return n.isDestroyed},this.isReady=function(){return n.ready}},(S=function(t,e){var n,r,i,o,s;for(n in this.matrix=new Float32Array(16),this.cumulativeMatrix=new Float32Array(16),this.ready=!1,this.width=1,this.height=1,this.seriously=j,this.transformRef=l[t],this.hook=t,this.id=q,q++,this.options=e,this.sources=null,this.targets=[],this.inputElements={},this.inputs={},this.methods={},this.listeners={},this.texture=null,this.frameBuffer=null,this.uniforms=null,this.dirty=!0,this.transformDirty=!0,this.renderDirty=!1,this.isDestroyed=!1,this.transformed=!1,this.plugin=U({},this.transformRef),this.transformRef.definition&&U(this.plugin,this.transformRef.definition.call(this,e)),this.plugin.inputs)this.plugin.inputs.hasOwnProperty(n)&&((r=this.plugin.inputs[n]).method&&"function"==typeof r.method?this.methods[n]=r.method:"function"==typeof r.set&&"function"==typeof r.get&&(this.inputs[n]=r));for(n in Y(this.plugin),s=rt[t],this.plugin.inputs)this.plugin.inputs.hasOwnProperty(n)&&"function"==typeof(r=this.plugin.inputs[n]).set&&"function"==typeof r.get&&"function"!=typeof r.method&&(i=r.get.call(this),o=void 0===r.defaultValue?i:r.defaultValue,o=r.validate.call(this,o,r,i),s&&void 0!==s[n]&&(o=r.validate.call(this,s[n],r,r.defaultValue,o),s[n]=o),o!==i&&r.set.call(this,o));F.push(this),V[this.id]=this,this.pub=new E(this),Z.push(this),g[t].push(this)}).prototype=Object.create(a.prototype),S.prototype.constructor=S,S.prototype.setDirty=function(){this.renderDirty=!0,a.prototype.setDirty.call(this)},S.prototype.setTransformDirty=function(){var t,e;for(this.transformDirty=!0,this.dirty=!0,this.renderDirty=!0,t=0;t<this.targets.length;t++)(e=this.targets[t]).setTransformDirty?e.setTransformDirty():e.setDirty()},S.prototype.resize=function(){var t;for(a.prototype.resize.call(this),this.plugin.resize&&this.plugin.resize.call(this),t=0;t<this.targets.length;t++)this.targets[t].resize();this.setTransformDirty()},S.prototype.setSource=function(t){var e;if((e=pt(t))!==this.source){if(vt(e,this))throw new Error("Attempt to make cyclical connection.");this.source&&this.source.removeTarget(this),this.source=e,e.addTarget(this),e&&e.ready?this.setReady():this.setUnready(),this.resize()}},S.prototype.addTarget=function(t){var e;for(e=0;e<this.targets.length;e++)if(this.targets[e]===t)return;this.targets.push(t)},S.prototype.removeTarget=function(t){var e=this.targets&&this.targets.indexOf(t);e>=0&&this.targets.splice(e,1),this.targets&&this.targets.length&&this.resize()},S.prototype.setInput=function(t,e){var n,r,i;if(this.plugin.inputs.hasOwnProperty(t))return n=this.plugin.inputs[t],r=rt[this.hook]&&void 0!==rt[this.hook][t]?rt[this.hook][t]:n.defaultValue,i=n.get.call(this),void 0===r&&(r=i),e=n.validate.call(this,e,n,r,i),n.set.call(this,e)&&this.setTransformDirty(),n.get.call(this)},S.prototype.alias=function(t,e){var n,r,i=this;if(N.indexOf(e)>=0)throw new Error("'"+e+"' is a reserved name and cannot be used as an alias.");return this.plugin.inputs.hasOwnProperty(t)&&(e||(e=t),j.removeAlias(e),(n=this.inputs[t])?(r=i.inputs[t],Object.defineProperty(j,e,{configurable:!0,enumerable:!0,get:function(){return r.get.call(i)},set:function(t){r.set.call(i,t)&&i.setTransformDirty()}})):(n=this.methods[t])&&(r=n,j[e]=function(){r.apply(i,arguments)&&i.setTransformDirty()}),n&&(tt[e]={node:this,input:t})),this},S.prototype.render=function(t){return this.source?(this.source.render(),this.transformDirty&&(this.transformed?this.source.cumulativeMatrix?A.multiply(this.cumulativeMatrix,this.matrix,this.source.cumulativeMatrix):A.copy(this.cumulativeMatrix,this.matrix):A.copy(this.cumulativeMatrix,this.source.cumulativeMatrix||s),this.transformDirty=!1),t&&n?(this.renderDirty&&(this.frameBuffer||(this.uniforms={resolution:[this.width,this.height]},this.frameBuffer=new $(n,this.width,this.height)),this.uniforms.source=this.source.texture,this.uniforms.transform=this.cumulativeMatrix||s,dt(o,i,this.uniforms,this.frameBuffer.frameBuffer,this),this.renderDirty=!1),this.texture=this.frameBuffer.texture):this.source?this.texture=this.source.texture:this.texture=null,this.dirty=!1,this.texture):(this.transformDirty&&(A.copy(this.cumulativeMatrix,this.matrix),this.transformDirty=!1),this.texture=null,void(this.dirty=!1))},S.prototype.readPixels=function(t,e,r,i,o){var s=this.gl||n;if(!n)throw new Error("Cannot read pixels until a canvas is connected");if(this.render(!0),void 0===o)o=new Uint8Array(r*i*4);else if(!B(o,"Uint8Array"))throw new Error("Incompatible array type");return s.bindFramebuffer(n.FRAMEBUFFER,this.frameBuffer.frameBuffer),s.readPixels(t,e,r,i,n.RGBA,n.UNSIGNED_BYTE,o),o},S.prototype.destroy=function(){var t,e,n,r=this.hook;for(t in this.plugin.destroy&&"function"==typeof this.plugin.destroy&&this.plugin.destroy.call(this),delete this.effect,this.frameBuffer&&(this.frameBuffer.destroy(),delete this.frameBuffer,delete this.texture),this.inputElements)this.inputElements.hasOwnProperty(t)&&((n=this.inputElements[t]).element.removeEventListener("change",n.listener,!0),n.element.removeEventListener("input",n.listener,!0));for(this.source&&this.source.removeTarget(this);this.targets.length;)(n=this.targets.pop())&&n.removeSource&&n.removeSource(this);for(e in this)this.hasOwnProperty(e)&&"id"!==e&&delete this[e];for(e in tt)tt.hasOwnProperty(e)&&(n=tt[e]).node===this&&j.removeAlias(e);(t=Z.indexOf(this))>=0&&Z.splice(t,1),(t=g[r].indexOf(this))>=0&&g[r].splice(t,1),a.prototype.destroy.call(this)},S.prototype.setReady=a.prototype.setReady,S.prototype.setUnready=a.prototype.setUnready,S.prototype.on=a.prototype.on,S.prototype.off=a.prototype.off,S.prototype.emit=a.prototype.emit,(t=B(t,"HTMLCanvasElement")?{canvas:t}:t||{}).canvas,this.effect=function(t,e){if(!h[t])throw new Error("Unknown effect: "+t);return new y(t,e).pub},this.source=function(t,e,n){return pt(t,e,n).pub},this.transform=function(e,n){if("string"!=typeof e&&(n=e,e=!1),e){if(!l[e])throw new Error("Unknown transform: "+e)}else if(e=t&&t.defaultTransform||"2d",!l[e])throw new Error("No transform specified");return new S(e,n).pub},this.target=function(t,e,n){var r,i,o;for(t&&"string"==typeof t&&!d[t]&&(i=document.querySelector(t)),("string"!=typeof t||!e&&0!==e||i)&&(n&&"object"==typeof n||(n=e),e=i||t,t=null),"string"==typeof e&&isNaN(e)&&(e=document.querySelector(e)),o=0;o<J.length;o++)if(r=J[o],(!t||t===r.hook)&&(r.target===e||r.compare&&r.compare(e,n)))return r.pub;return(r=new x(t,e,n)).pub},this.aliases=function(){return Object.keys(tt)},this.removeAlias=function(t){tt[t]&&(delete this[t],delete tt[t])},this.defaults=function(t,e){var n;if(t)if("object"!=typeof t)null===e?delete rt[t]:"object"==typeof e&&(rt[t]=U({},e));else for(n in t)t.hasOwnProperty(n)&&this.defaults(n,t[n]);else if(null===t)for(n in rt)rt.hasOwnProperty(n)&&delete rt[n]},this.go=function(t,e){var n;for("function"==typeof t&&et.indexOf(t)<0&&et.push(t),"function"==typeof e&&nt.indexOf(e)<0&&nt.push(e),ot=!0,n=0;n<J.length;n++)J[n].go();I||!et.length&&!nt.length||ft()},this.stop=function(){et.length=0,nt.length=0,k(I),I=0},this.render=function(){var e;for(e=0;e<J.length;e++)J[e].render(t)},this.destroy=function(){for(var t,e;F.length;)F[0].pub.destroy();for(t in this)this.hasOwnProperty(t)&&"isDestroyed"!==t&&"id"!==t&&((e=Object.getOwnPropertyDescriptor(this,t)).get||e.set||"function"!=typeof this[t]?delete this[t]:this[t]=w);j=null,G=[],J=[],Q=[],F=[],et.length=0,nt.length=0,k(I),I=0,st=!0},this.isDestroyed=function(){return st},this.incompatible=function(t){var e,n,r;if(r=K.incompatible(t))return r;if(!t){for(e in v)if(v.hasOwnProperty(e)&&v[e].length&&(n=h[e])&&"function"==typeof n.compatible&&!n.compatible.call(this))return"plugin-"+e;for(e in m)if(m.hasOwnProperty(e)&&m[e].length&&(n=f[e])&&"function"==typeof n.compatible&&!n.compatible.call(this))return"source-"+e}return!1},this.isNode=function(t){var e;return!(!t||!(e=V[t.id])||e.isDestroyed)},this.isSource=function(t){return this.isNode(t)&&t instanceof C},this.isEffect=function(t){return this.isNode(t)&&t instanceof T},this.isTransform=function(t){return this.isNode(t)&&t instanceof E},this.isTarget=function(t){return this.isNode(t)&&t instanceof M},Object.defineProperties(this,{id:{enumerable:!0,configurable:!0,get:function(){return D}}}),this.defaults(t.defaults)}window.addEventListener("message",(function(t){t.source===window&&"seriously-timeout-message"===t.data&&(t.stopPropagation(),p.length>0&&p.shift()())}),!0),$.prototype.resize=function(t,e){var n=this.gl;this.width===t&&this.height===e||(this.width=t,this.height=e,n&&(n.bindTexture(n.TEXTURE_2D,this.texture),n.bindFramebuffer(n.FRAMEBUFFER,this.frameBuffer),n.bindRenderbuffer(n.RENDERBUFFER,this.renderBuffer),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,t,e,0,n.RGBA,n.UNSIGNED_BYTE,null),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,t,e),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,this.texture,0),n.bindTexture(n.TEXTURE_2D,null),n.bindRenderbuffer(n.RENDERBUFFER,null),n.bindFramebuffer(n.FRAMEBUFFER,null)))},$.prototype.destroy=function(){var t=this.gl;t&&(t.deleteFramebuffer(this.frameBuffer),t.deleteRenderbuffer(this.renderBuffer),this.ownTexture&&t.deleteTexture(this.texture)),delete this.frameBuffer,delete this.renderBuffer,delete this.texture,delete this.gl},X.prototype.use=function(){this.gl.useProgram(this.program)},K.incompatible=function(t){var e,n,r;if(void 0===o&&((e=document.createElement("canvas"))&&e.getContext?window.WebGLRenderingContext?(n=G())||(o="context"):o="webgl":o="canvas"),o)return o;if(t){if((r=h[t])&&"function"==typeof r.compatible&&!r.compatible(n))return"plugin-"+t;if((r=f[t])&&"function"==typeof r.compatible&&!r.compatible(n))return"source-"+t}return!1},K.plugin=function(t,e,n){var r;if(h[t])K.logger.warn("Effect ["+t+"] already loaded");else if(void 0===n&&"object"==typeof e&&(n=e),n)return r=U({},n),"function"==typeof e&&(r.definition=e),r.reserved=I,r.inputs&&Y(r),r.title||(r.title=t),h[t]=r,v[t]=[],r},K.removePlugin=function(t){var e;if(!t)return this;if(!h[t])return this;if(e=v[t]){for(;e.length;)e.shift().destroy();delete v[t]}return delete h[t],this},K.source=function(t,e,n){var r;if(f[t])K.logger.warn("Source ["+t+"] already loaded");else if(void 0===n&&"object"==typeof e&&(n=e),n||e)return r=U({},n),"function"==typeof e&&(r.definition=e),r.title||(r.title=t),f[t]=r,m[t]=[],r},K.removeSource=function(t){var e;if(!t)return this;if(!f[t])return this;if(e=m[t]){for(;e.length;)e.shift().destroy();delete m[t]}return delete f[t],this},K.transform=function(t,e,n){var r;if(l[t])K.logger.warn("Transform ["+t+"] already loaded");else if(void 0===n&&"object"==typeof e&&(n=e),n||e)return r=U({},n),"function"==typeof e&&(r.definition=e),r.reserved=D,r.inputs&&Y(r),r.title||(r.title=t),l[t]=r,g[t]=[],r},K.removeTransform=function(t){var e;if(!t)return this;if(!l[t])return this;if(e=g[t]){for(;e.length;)e.shift().destroy();delete g[t]}return delete l[t],this},K.target=function(t,e,n){var r;if(d[t])K.logger.warn("Target ["+t+"] already loaded");else if(void 0===n&&"object"==typeof e&&(n=e),n||e)return r=U({},n),"function"==typeof e&&(r.definition=e),r.title||(r.title=t),d[t]=r,y[t]=[],r},K.removeTarget=function(t){var e;if(!t)return this;if(!d[t])return this;if(e=y[t]){for(;e.length;)e.shift().destroy();delete y[t]}return delete d[t],this},K.inputValidators={color:function(t,e,n,r){var o,s,a,c;if(s=r||[],"string"==typeof t){if((a=x.exec(t))&&a.length){if(a.length<3)return s[0]=s[1]=s[2]=s[3]=0,s;for(s[3]=1,c=0;c<3;c++)s[c]=parseFloat(a[c+2])/255;return isNaN(a[6])||(s[3]=parseFloat(a[6])),"hsl"===a[1].toLowerCase()?V(s[0],s[1],s[2],s[3],s):s}if((a=T.exec(t))&&a.length)return 3===(o=a[1]).length?(s[0]=parseInt(o[0],16)/15,s[1]=parseInt(o[1],16)/15,s[2]=parseInt(o[2],16)/15,s[3]=1):4===o.length?(s[0]=parseInt(o[0],16)/15,s[1]=parseInt(o[1],16)/15,s[2]=parseInt(o[2],16)/15,s[3]=parseInt(o[3],16)/15):6===o.length?(s[0]=parseInt(o.substr(0,2),16)/255,s[1]=parseInt(o.substr(2,2),16)/255,s[2]=parseInt(o.substr(4,2),16)/255,s[3]=1):8===o.length?(s[0]=parseInt(o.substr(0,2),16)/255,s[1]=parseInt(o.substr(2,2),16)/255,s[2]=parseInt(o.substr(4,2),16)/255,s[3]=parseInt(o.substr(6,2),16)/255):s[0]=s[1]=s[2]=s[3]=0,s;if(a=S[t.toLowerCase()]){for(c=0;c<4;c++)s[c]=a[c];return s}return i||(i=document.createElement("canvas").getContext("2d")),i.fillStyle=t,(o=i.fillStyle)&&"#000000"!==o?K.inputValidators.color(o,e,n,r):(s[0]=s[1]=s[2]=s[3]=0,s)}if(q(t)){if((s=t).length<3)return s[0]=s[1]=s[2]=s[3]=0,s;for(c=0;c<3;c++)if(isNaN(s[c]))return s[0]=s[1]=s[2]=s[3]=0,s;return s.length<4&&s.push(1),s}if("number"==typeof t)return s[0]=s[1]=s[2]=t,s[3]=1,s;if("object"==typeof t){for(c=0;c<4;c++)null===t[o=E[c]]||isNaN(t[o])?s[c]=3===c?1:0:s[c]=t[o];return s}return s[0]=s[1]=s[2]=s[3]=0,s},number:function(t,e,n){return t=parseFloat(t),isNaN(t)?n||0:(e.mod&&(t-=e.mod*Math.floor(t/e.mod)),t<e.min?e.min:t>e.max?e.max:e.step?Math.round(t/e.step)*e.step:t)},enum:function(t,e,n){var r=e.options||[];return"string"==typeof t?t=t.toLowerCase():"number"==typeof t?t=t.toString():t||(t=""),r.hasOwnProperty(t)?t:n||""},vector:function(t,e,n,r){var i,o,s,a=e.dimensions||4;if(i=r||[],q(t)){for(o=0;o<a;o++)i[o]=t[o]||0;return i}if("object"==typeof t){for(o=0;o<a;o++)void 0===t[s=C[o]]&&(s=E[o]),i[o]=t[s]||0;return i}for(t=parseFloat(t)||0,o=0;o<a;o++)i[o]=t;return i},boolean:function(t){return!!t&&(!t||!t.toLowerCase||"false"!==t.toLowerCase())},string:function(t){return"string"==typeof t?t:0===t||t?t.toString?t.toString():String(t):""}},K.prototype.effects=K.effects=function(){var t,e,n,r,i,o={};for(t in h)if(h.hasOwnProperty(t)){for(i in n={title:(e=h[t]).title||t,description:e.description||"",inputs:{}},e.inputs)e.inputs.hasOwnProperty(i)&&(r=e.inputs[i],n.inputs[i]={type:r.type,defaultValue:r.defaultValue,step:r.step,min:r.min,max:r.max,mod:r.mod,minCount:r.minCount,maxCount:r.maxCount,dimensions:r.dimensions,title:r.title||i,description:r.description||"",options:r.options||[]});o[t]=n}return o},window.Float32Array&&(s=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])),window.Seriously&&"object"==typeof window.Seriously&&function(){var t;for(t in window.Seriously)window.Seriously.hasOwnProperty(t)&&"plugin"!==t&&"object"==typeof window.Seriously[t]&&K.plugin(t,window.Seriously[t])}(),K.logger={log:F("log"),info:F("info"),warn:F("warn"),error:F("error")},K.util={mat4:A,checkSource:function(t){var e,n,r,i;if(!(e=L(t,["img","canvas","video"])))return!1;if(!(n=document.createElement("canvas")))return K.logger.warn("Browser does not support canvas or Seriously.js"),!1;if(0===e.naturalWidth&&"IMG"===e.tagName)return K.logger.warn("Image not loaded"),!1;if(0===e.readyState&&0===e.videoWidth&&"VIDEO"===e.tagName)return K.logger.warn("Video not loaded"),!1;if(r=G()){(i=r.createTexture())||K.logger.error("Test WebGL context has been lost"),r.bindTexture(r.TEXTURE_2D,i);try{r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,e)}catch(t){return t.code===window.DOMException.SECURITY_ERR?K.logger.log("Unable to access cross-domain image"):K.logger.error("Error storing image to texture: "+t.message),r.deleteTexture(i),!1}r.deleteTexture(i)}else{r=n.getContext("2d");try{r.drawImage(e,0,0),r.getImageData(0,0,1,1)}catch(t){return t.code===window.DOMException.SECURITY_ERR?K.logger.log("Unable to access cross-domain image"):K.logger.error("Error drawing image to canvas: "+t.message),!1}}return!0},hslToRgb:V,colors:S,setTimeoutZero:H,ShaderProgram:X,FrameBuffer:$,requestAnimationFrame:P,shader:{makeNoise:"float makeNoise(float u, float v, float timer) {\n\tfloat x = u * v * mod(timer * 1000.0, 100.0);\n\tx = mod(x, 13.0) * mod(x, 127.0);\n\tfloat dx = mod(x, 0.01);\n\treturn clamp(0.1 + dx * 100.0, 0.0, 1.0);\n}\n",random:"#ifndef RANDOM\n#define RANDOM\nfloat random(vec2 n) {\n\treturn 0.5 + 0.5 * fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* 43758.5453);\n}\n#endif\n"}},K.source("video",(function(t,e,n){var r,i,o=this,s=!1,c=!1,u=!1,h=0;function l(){t.removeEventListener("loadedmetadata",l,!0),s||(t.videoWidth?(o.width===t.videoWidth&&o.height===t.videoHeight||(o.width=t.videoWidth,o.height=t.videoHeight,o.resize()),c&&o.setReady()):(c=!0,setTimeout(l,50)))}function f(){u=!0}function d(){u=!1,o.setDirty()}if(B(t,"HTMLVideoElement"))return t.readyState?l():(c=!0,t.addEventListener("loadedmetadata",l,!0)),t.addEventListener("seeking",f,!1),t.addEventListener("seeked",d,!1),{deferTexture:c,source:t,render:function e(n){var s;if(h=t.currentTime,!t.videoHeight||!t.videoWidth)return!1;a?(i||(i=document.createElement("canvas").getContext("2d"),(r=i.canvas).width=o.width,r.height=o.height),s=r,i.drawImage(t,0,0,o.width,o.height)):s=t,n.bindTexture(n.TEXTURE_2D,o.texture),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,o.flip),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1);try{if(n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,s),void 0===a){if(n.getError()===n.INVALID_VALUE)return a=!0,e(n);a=!1}return!0}catch(t){t.code===window.DOMException.SECURITY_ERR?(o.allowRefresh=!1,K.logger.error("Unable to access cross-domain image")):K.logger.error("Error rendering video source",t)}return!1},checkDirty:function(){return!u&&t.currentTime!==h},compare:function(t){return o.source===t},destroy:function(){s=!0,t.removeEventListener("seeking",f,!1),t.removeEventListener("seeked",d,!1),t.removeEventListener("loadedmetadata",l,!0)}}}),{title:"Video"}),K.transform("2d",(function(t){var e=this,n=!(t&&t.radians),r=0,i=0,o=1,s=1,a=0,c=0,u=0,h=0,l=0;function f(){var t,f,d,p,v,g,m,y,b,_,w,S=e.matrix;function x(t,e){S[12]=S[0]*t+S[4]*e+S[12],S[13]=S[1]*t+S[5]*e+S[13],S[14]=S[2]*t+S[6]*e+S[14],S[15]=S[3]*t+S[7]*e+S[15]}a||c||u||h||l||1!==o||1!==s?(A.identity(S),x(a+r,c+i),h&&(S[4]=h/e.width),l&&(S[1]=l/e.height),u&&(p=S[0],v=S[1],g=S[2],m=S[3],y=S[4],b=S[5],_=S[6],w=S[7],t=-(n?u*Math.PI/180:u),f=Math.sin(t),d=Math.cos(t),S[0]=p*d+y*f,S[1]=v*d+b*f,S[2]=g*d+_*f,S[3]=m*d+w*f,S[4]=y*d-p*f,S[5]=b*d-v*f,S[6]=_*d-g*f,S[7]=w*d-m*f),1!==o&&(S[0]*=o,S[1]*=o,S[2]*=o,S[3]*=o),1!==s&&(S[4]*=s,S[5]*=s,S[6]*=s,S[7]*=s),x(-r,-i),e.transformed=!0):e.transformed=!1}return{inputs:{reset:{method:function(){return r=0,i=0,o=1,s=1,a=0,c=0,u=0,h=0,l=0,!!e.transformed&&(e.transformed=!1,!0)}},translate:{method:function(t,e){return isNaN(t)&&(t=a),isNaN(e)&&(e=c),(t!==a||e!==c)&&(a=t,c=e,f(),!0)},type:["number","number"]},translateX:{get:function(){return a},set:function(t){return t!==a&&(a=t,f(),!0)},type:"number"},translateY:{get:function(){return c},set:function(t){return t!==c&&(c=t,f(),!0)},type:"number"},rotation:{get:function(){return u},set:function(t){return t!==u&&(u=parseFloat(t),f(),!0)},type:"number"},center:{method:function(t,e){return isNaN(t)&&(t=r),isNaN(e)&&(e=i),(t!==r||e!==i)&&(r=t,i=e,f(),!0)},type:["number","number"]},centerX:{get:function(){return r},set:function(t){return t!==r&&(r=t,f(),!0)},type:"number"},centerY:{get:function(){return i},set:function(t){return t!==i&&(i=t,f(),!0)},type:"number"},skew:{method:function(t,e){return isNaN(t)&&(t=h),isNaN(e)&&(e=l),(t!==h||e!==l)&&(h=t,l=e,f(),!0)},type:["number","number"]},skewX:{get:function(){return h},set:function(t){return t!==h&&(h=t,f(),!0)},type:"number"},skewY:{get:function(){return l},set:function(t){return t!==l&&(l=t,f(),!0)},type:"number"},scale:{method:function(t,e){var n,r;if(n=isNaN(t)?o:t,isNaN(e)){if(isNaN(t))return!1;r=n}else r=e;return(n!==o||r!==s)&&(o=n,s=r,f(),!0)},type:["number","number"]},scaleX:{get:function(){return o},set:function(t){return t!==o&&(o=t,f(),!0)},type:"number"},scaleY:{get:function(){return s},set:function(t){return t!==s&&(s=t,f(),!0)},type:"number"}}}}),{title:"2D Transform",description:"Translate, Rotate, Scale, Skew"}),K.transform("flip",(function(){var t=this,e=!0;function n(){var n=t.matrix;e?(n[0]=-1,n[5]=1):(n[0]=1,n[5]=-1)}return A.identity(t.matrix),n(),t.transformDirty=!0,t.transformed=!0,{inputs:{direction:{get:function(){return e?"horizontal":"vertical"},set:function(t){var r;return(r="vertical"!==t)!==e&&(e=r,n(),!0)},type:"string"}}}}),{title:"Flip",description:"Flip Horizontal/Vertical"}),K.transform("reformat",(function(){var t,e,n=this,r="contain";function i(){var i,o,s,a,c=n.matrix,u=t||n.width,h=e||n.height,l=n.source,f=l&&l.width||1,d=l&&l.height||1;"distort"===r||u===f&&h===d?n.transformed=!1:(s=f/d,a=u/h,"none"===r?(i=f/u,o=d/h):"width"===r||"contain"===r&&a<=s?(i=1,o=a/s):"height"===r||"contain"===r&&a>s?(i=s/a,o=1):a>s?(i=1,o=a/s):(i=s/a,o=1),1!==i||1!==o?(A.identity(c),1!==i&&(c[0]*=i,c[1]*=i,c[2]*=i,c[3]*=i),1!==o&&(c[4]*=o,c[5]*=o,c[6]*=o,c[7]*=o),n.transformed=!0):n.transformed=!1)}function o(){return t||n.source&&n.source.width||1}function s(){return e||n.source&&n.source.height||1}return this.resize=function(){var t,e=o(),n=s();if(this.width!==e||this.height!==n)for(this.width=e,this.height=n,this.uniforms&&this.uniforms.resolution&&(this.uniforms.resolution[0]=e,this.uniforms.resolution[1]=n),this.frameBuffer&&this.frameBuffer.resize&&this.frameBuffer.resize(e,n),t=0;t<this.targets.length;t++)this.targets[t].resize();this.setTransformDirty(),i()},{inputs:{width:{get:o,set:function(e){return(e=Math.floor(e))===t||(t=e,this.resize()),!1},type:"number"},height:{get:s,set:function(t){return(t=Math.floor(t))===e||(e=t,this.resize()),!1},type:"number"},mode:{get:function(){return r},set:function(t){return t!==r&&(r=t,i(),!0)},type:"enum",options:["cover","contain","distort","width","height","none"]}}}}),{title:"Reformat",description:"Change output dimensions"}),c=["precision mediump float;","attribute vec4 position;","attribute vec2 texCoord;","uniform vec2 resolution;","uniform mat4 transform;","varying vec2 vTexCoord;","void main(void) {","\tvec4 screenPosition = vec4(position.xy * resolution / 2.0, position.z, position.w);","\tscreenPosition = transform * screenPosition;","\tgl_Position.xy = screenPosition.xy * 2.0 / resolution;","\tgl_Position.z = screenPosition.z * 2.0 / (resolution.x / resolution.y);","\tgl_Position.w = screenPosition.w;","\tvTexCoord = texCoord;","}\n"].join("\n"),u=["precision mediump float;","varying vec2 vTexCoord;","uniform sampler2D source;","void main(void) {","\t\tgl_FragColor = texture2D(source, vTexCoord);","}"].join("\n"),K.util.shader.noiseHelpers="#ifndef NOISE_HELPERS\n#define NOISE_HELPERS\nvec2 mod289(vec2 x) {\n\treturn x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec3 mod289(vec3 x) {\n\treturn x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec4 mod289(vec4 x) {\n\treturn x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec3 permute(vec3 x) {\n\treturn mod289(((x*34.0)+1.0)*x);\n}\nvec4 permute(vec4 x) {\n\treturn mod289(((x*34.0)+1.0)*x);\n}\nvec4 taylorInvSqrt(vec4 r) {\n\treturn 1.79284291400159 - 0.85373472095314 * r;\n}\nfloat taylorInvSqrt(float r) {\n\treturn 1.79284291400159 - 0.85373472095314 * r;\n}\n#endif\n",K.util.shader.snoise2d="#ifndef NOISE2D\n#define NOISE2D\nfloat snoise(vec2 v) {\n\tconst vec4 C = vec4(0.211324865405187, // (3.0-sqrt(3.0))/6.0\n\t\t0.366025403784439, // 0.5*(sqrt(3.0)-1.0)\n\t\t-0.577350269189626, // -1.0 + 2.0 * C.x\n\t\t0.024390243902439); // 1.0 / 41.0\n\tvec2 i = floor(v + dot(v, C.yy));\n\tvec2 x0 = v - i + dot(i, C.xx);\n\tvec2 i1;\n\t//i1.x = step(x0.y, x0.x); // x0.x > x0.y ? 1.0 : 0.0\n\t//i1.y = 1.0 - i1.x;\n\ti1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n\t// x0 = x0 - 0.0 + 0.0 * C.xx ;\n\t// x1 = x0 - i1 + 1.0 * C.xx ;\n\t// x2 = x0 - 1.0 + 2.0 * C.xx ;\n\tvec4 x12 = x0.xyxy + C.xxzz;\n\tx12.xy -= i1;\n\ti = mod289(i); // Avoid truncation effects in permutation\n\tvec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0)) + i.x + vec3(0.0, i1.x, 1.0));\n\tvec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);\n\tm = m*m ;\n\tm = m*m ;\n\tvec3 x = 2.0 * fract(p * C.www) - 1.0;\n\tvec3 h = abs(x) - 0.5;\n\tvec3 ox = floor(x + 0.5);\n\tvec3 a0 = x - ox;\n\tm *= 1.79284291400159 - 0.85373472095314 * (a0*a0 + h*h);\n\tvec3 g;\n\tg.x = a0.x * x0.x + h.x * x0.y;\n\tg.yz = a0.yz * x12.xz + h.yz * x12.yw;\n\treturn 130.0 * dot(m, g);\n}\n#endif\n",K.util.shader.snoise3d="#ifndef NOISE3D\n#define NOISE3D\nfloat snoise(vec3 v) {\n\tconst vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n\tconst vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n\tvec3 i = floor(v + dot(v, C.yyy));\n\tvec3 x0 = v - i + dot(i, C.xxx) ;\n\tvec3 g = step(x0.yzx, x0.xyz);\n\tvec3 l = 1.0 - g;\n\tvec3 i1 = min(g.xyz, l.zxy);\n\tvec3 i2 = max(g.xyz, l.zxy);\n\t// x0 = x0 - 0.0 + 0.0 * C.xxx;\n\t// x1 = x0 - i1 + 1.0 * C.xxx;\n\t// x2 = x0 - i2 + 2.0 * C.xxx;\n\t// x3 = x0 - 1.0 + 3.0 * C.xxx;\n\tvec3 x1 = x0 - i1 + C.xxx;\n\tvec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y\n\tvec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y\n\ti = mod289(i);\n\tvec4 p = permute(permute(permute(\n\t\t\t\t\t\ti.z + vec4(0.0, i1.z, i2.z, 1.0))\n\t\t\t\t\t\t+ i.y + vec4(0.0, i1.y, i2.y, 1.0))\n\t\t\t\t\t\t+ i.x + vec4(0.0, i1.x, i2.x, 1.0));\n\tfloat n_ = 0.142857142857; // 1.0/7.0\n\tvec3 ns = n_ * D.wyz - D.xzx;\n\tvec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p, 7 * 7)\n\tvec4 x_ = floor(j * ns.z);\n\tvec4 y_ = floor(j - 7.0 * x_); // mod(j, N)\n\tvec4 x = x_ * ns.x + ns.yyyy;\n\tvec4 y = y_ * ns.x + ns.yyyy;\n\tvec4 h = 1.0 - abs(x) - abs(y);\n\tvec4 b0 = vec4(x.xy, y.xy);\n\tvec4 b1 = vec4(x.zw, y.zw);\n\t//vec4 s0 = vec4(lessThan(b0, 0.0)) * 2.0 - 1.0;\n\t//vec4 s1 = vec4(lessThan(b1, 0.0)) * 2.0 - 1.0;\n\tvec4 s0 = floor(b0) * 2.0 + 1.0;\n\tvec4 s1 = floor(b1) * 2.0 + 1.0;\n\tvec4 sh = -step(h, vec4(0.0));\n\tvec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy ;\n\tvec4 a1 = b1.xzyw + s1.xzyw * sh.zzww ;\n\tvec3 p0 = vec3(a0.xy, h.x);\n\tvec3 p1 = vec3(a0.zw, h.y);\n\tvec3 p2 = vec3(a1.xy, h.z);\n\tvec3 p3 = vec3(a1.zw, h.w);\n\tvec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n\tp0 *= norm.x;\n\tp1 *= norm.y;\n\tp2 *= norm.z;\n\tp3 *= norm.w;\n\tvec4 m = max(0.6 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);\n\tm = m * m;\n\treturn 42.0 * dot(m*m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));\n}\n#endif\n",K.util.shader.snoise4d="#ifndef NOISE4D\n#define NOISE4D\nvec4 grad4(float j, vec4 ip)\n\t{\n\tconst vec4 ones = vec4(1.0, 1.0, 1.0, -1.0);\n\tvec4 p, s;\n\n\tp.xyz = floor(fract (vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0;\n\tp.w = 1.5 - dot(abs(p.xyz), ones.xyz);\n\ts = vec4(lessThan(p, vec4(0.0)));\n\tp.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www;\n\n\treturn p;\n\t}\n\n#define F4 0.309016994374947451\n\nfloat snoise(vec4 v)\n\t{\n\tconst vec4 C = vec4(0.138196601125011, // (5 - sqrt(5))/20 G4\n\t\t\t\t\t\t0.276393202250021, // 2 * G4\n\t\t\t\t\t\t0.414589803375032, // 3 * G4\n\t\t\t\t\t\t-0.447213595499958); // -1 + 4 * G4\n\n\tvec4 i = floor(v + dot(v, vec4(F4)));\n\tvec4 x0 = v - i + dot(i, C.xxxx);\n\n\n\tvec4 i0;\n\tvec3 isX = step(x0.yzw, x0.xxx);\n\tvec3 isYZ = step(x0.zww, x0.yyz);\n\ti0.x = isX.x + isX.y + isX.z;\n\ti0.yzw = 1.0 - isX;\n\ti0.y += isYZ.x + isYZ.y;\n\ti0.zw += 1.0 - isYZ.xy;\n\ti0.z += isYZ.z;\n\ti0.w += 1.0 - isYZ.z;\n\n\tvec4 i3 = clamp(i0, 0.0, 1.0);\n\tvec4 i2 = clamp(i0 - 1.0, 0.0, 1.0);\n\tvec4 i1 = clamp(i0 - 2.0, 0.0, 1.0);\n\n\tvec4 x1 = x0 - i1 + C.xxxx;\n\tvec4 x2 = x0 - i2 + C.yyyy;\n\tvec4 x3 = x0 - i3 + C.zzzz;\n\tvec4 x4 = x0 + C.wwww;\n\n\ti = mod289(i);\n\tfloat j0 = permute(permute(permute(permute(i.w) + i.z) + i.y) + i.x);\n\tvec4 j1 = permute(permute(permute(permute (\n\t\t\t\t\ti.w + vec4(i1.w, i2.w, i3.w, 1.0))\n\t\t\t\t\t+ i.z + vec4(i1.z, i2.z, i3.z, 1.0))\n\t\t\t\t\t+ i.y + vec4(i1.y, i2.y, i3.y, 1.0))\n\t\t\t\t\t+ i.x + vec4(i1.x, i2.x, i3.x, 1.0));\n\n\tvec4 ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0) ;\n\n\tvec4 p0 = grad4(j0, ip);\n\tvec4 p1 = grad4(j1.x, ip);\n\tvec4 p2 = grad4(j1.y, ip);\n\tvec4 p3 = grad4(j1.z, ip);\n\tvec4 p4 = grad4(j1.w, ip);\n\n\tvec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n\tp0 *= norm.x;\n\tp1 *= norm.y;\n\tp2 *= norm.z;\n\tp3 *= norm.w;\n\tp4 *= taylorInvSqrt(dot(p4, p4));\n\n\tvec3 m0 = max(0.6 - vec3(dot(x0, x0), dot(x1, x1), dot(x2, x2)), 0.0);\n\tvec2 m1 = max(0.6 - vec2(dot(x3, x3), dot(x4, x4)), 0.0);\n\tm0 = m0 * m0;\n\tm1 = m1 * m1;\n\treturn 49.0 * (dot(m0*m0, vec3(dot(p0, x0), dot(p1, x1), dot(p2, x2)))\n\t\t\t\t\t\t\t+ dot(m1*m1, vec2(dot(p3, x3), dot(p4, x4)))) ;\n}\n#endif\n",e.default=K},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Uneeq=void 0;const o=n(47);n(104);const s=n(81),a=i(n(107)),c=n(108),u=n(109),h=n(132),l=n(35),f=n(133),d=n(140),p=n(146),v=n(148),g=n(80),m=n(149),y=n(150),b=n(151),_=n(63),w=n(153),S=n(85),x=n(154),T=n(99);class C{constructor(t){this.ready=new o.BehaviorSubject(!1),this.version=a.default.version,this.messages=new o.Subject,this.internalMessages$=new o.Subject,this.sessionPaused=!1,this.sessionStarted=!1,this.unavailableAvatarMsgSent=!1,this.sessionWasResumed=!1,l.logger.enabled=t.logging||!1,this.options=t,this.options.diagnostics=t.diagnostics||!1,this.options.micActivityMessages=t.micActivityMessages||!1,this.options.sendLocalVideo=void 0===t.sendLocalVideo||t.sendLocalVideo,this.options.sendLocalAudio=void 0===t.sendLocalAudio||t.sendLocalAudio,this.options.enableClientPerformanceMessage=t.enableClientPerformanceMessage||!1,this.options.enableTransparentBackground=t.enableTransparentBackground||!1,this.options.backgroundImageUrl=t.backgroundImageUrl||"",this.options.nameTagImageUrl=t.nameTagImageUrl||"",this.options.speechToTextLocales=this.validateLocales(t.speechToTextLocales),this.options.voiceInputMode=t.voiceInputMode||T.VoiceInputMode.PUSH_TO_TALK,this.api=new c.API(this.options.url,this.options.apiKey),this.messageCallback=this.options.messageHandler||(()=>{}),this.checkWebRTCSupport(),this.startSessionData={workspaceName:this.options.conversationId,sessionType:w.SessionType.WEB,sdkVersion:this.version,clientWidth:window.screen.availWidth,clientHeight:window.screen.availHeight},this.options.customData&&(this.startSessionData.customData=this.options.customData),l.logger.log(`Uneeq Created (version ${this.version})`),this.streamManager=new y.StreamManager,this.initDigitalHumanVideoElement(),this.metricsService=new p.MetricsService(this.options,this.internalMessages$,this.messages),this.dhVideoPlayManager=new h.DigitalHumanVideoPlayManager(this.messages,()=>{this.unmuteDigitalHuman()})}get sessionId(){return this.session?this.session.id:null}setLoggerEnabled(t){l.logger.enabled=t}init(){this.startSessionTime=Date.now(),this.api.startSession(this.startSessionData).then(t=>{this.session=t,this.initialize()}).catch(t=>{this.sendServiceUnavailableMessage(t)})}initWithToken(t){return r(this,void 0,void 0,(function*(){this.startSessionTime=Date.now();try{const e=m.ResumeSessionCheck.validate(this.options);!0===e.resumeSession&&(this.startSessionData.resumeSessionId=e.resumeSessionId),this.startSessionData.tokenId=t,this.session=yield this.api.startSessionWithToken(this.startSessionData),console.log("UneeQ Session ID: "+this.session.id),this.session.id===this.startSessionData.resumeSessionId?(l.logger.log("UneeQ: Session was resumed."),this.sessionWasResumed=!0):l.logger.log("UneeQ: Session was not resumed."),localStorage.setItem("uneeqResumeSessionId",this.session.id),localStorage.setItem("uneeqResumeSessionPersonaId",this.options.conversationId),this.session.sourceApp=x.SourceApp[this.session.sourceApp?this.session.sourceApp:""]?this.session.sourceApp:x.SourceApp.UNKNOWN,this.initialize()}catch(t){this.sendServiceUnavailableMessage(t)}}))}setCamera(t){this.serviceReadyCheck("setCamera")&&this.deviceManager.setCamDevice(t)}setMic(t){this.serviceReadyCheck("setMic")&&this.deviceManager.setMicDevice(t)}setSpeaker(t){this.serviceReadyCheck("setSpeaker")&&this.deviceManager.setAvatarSpeakerDevice(t)}setVoiceInputMode(t){this.serviceReadyCheck("setVoiceInputMode")&&this.voiceInputManager.setVoiceInputMode(t)}enableMicrophone(t=!0){this.deviceManager&&this.deviceManager.enableLocalDevices(this.options.sendLocalVideo,t)}enableCamera(t=!0){this.serviceReadyCheck("enableMicrohpone")&&this.deviceManager.enableLocalDevices(t,this.options.sendLocalAudio)}enableMicrophoneAndCamera(t=!0){this.serviceReadyCheck("enableMicrohpone")&&this.deviceManager.enableLocalDevices(t,t)}sendTranscript(t){this.serviceReadyCheck("sendTranscript")&&(this.sessionPaused?this.messages.next(new _.WarningMessage("Call to sendTranscript() will be ignored. Session is paused.")):this.api.avatarAsk(t))}getServerStats(){this.deviceManager&&this.deviceManager.mediaHandler&&this.deviceManager.mediaHandler.sendDataMessage("stats")}startRecording(){this.serviceReadyCheck("startRecording")&&this.options.sendLocalAudio&&(this.sessionPaused?this.messages.next(new _.WarningMessage("Call to startRecording() will be ignored. Session is paused.")):this.voiceInputManager.startRecording())}stopSpeaking(){return this.api.avatarStopSpeaking()}stopRecording(){this.serviceReadyCheck("stopRecording")&&this.options.sendLocalAudio&&(this.sessionPaused?this.messages.next(new _.WarningMessage("Call to stopRecording() will be ignored. Session is paused.")):this.voiceInputManager.stopRecording())}pauseSession(){return!!this.serviceReadyCheck("pauseSession")&&(this.sessionPaused?(this.messages.next(new _.WarningMessage("Call to pauseSession() will be ignored. Session is paused.")),!1):(this.sessionPaused=!0,this.deviceManager.mediaHandler.pause(),this.messages.next(new _.SessionPausedMessage),!0))}resumeSession(){return!!this.serviceReadyCheck("resumeSession")&&(this.sessionPaused?(this.sessionPaused=!1,this.deviceManager.mediaHandler.resume(),this.messages.next(new _.SessionResumedMessage),!0):(this.messages.next(new _.WarningMessage("Call to resumeSession() will be ignored. Session is unpaused.")),!1))}endSession(){this.serviceReadyCheck("endSession")&&(this.api.endCall(),this.internalMessages$.next({faceMeMessageType:"sessionEnd"}))}setAvatarDebug(t){return this.api.setAvatarDebug(t)}playWelcomeMessage(){return this.api.avatarWelcome()}unmuteDigitalHuman(){this.voiceInputManager.resumeAudioContext(),this.dhVideoPlayManager.unmuteVideo()}initDigitalHumanVideoElement(){const t=document.createElement("video");this.digitalHumanVideoElement=t,t.volume=1,t.controls=!1,t.autoplay=!1,t.setAttribute("playsinline","true"),t.setAttribute("style","object-fit: cover; width: 100%; height: 100%;"),t.play().catch(t=>{l.logger.log("UneeQ: Failed to play digital human video. Play() will be re-attempted when stream is ready.",t)})}gatherWebRtcMetrics(){var t;null===(t=this.deviceManager)||void 0===t||t.mediaHandler.gatherWebRTCStats((t,e)=>{this.metricsService.parseAndLogWebRtcStats(e)}),setTimeout(()=>{this.gatherWebRtcMetrics()},5e3)}initMessaging(){this.messages.subscribe(t=>this.messageCallback(t)),this.messaging.state$.filter(t=>t===d.MessagingState.CONNECTED).subscribe(()=>{this.messaging.getTopic("/topic/avatar/"+this.session.streamId),this.ready.next(!0),this.messages.next(new _.ReadyMessage),this.gatherWebRtcMetrics()}),this.messaging.messages$.subscribe(t=>this.internalMessages$.next(JSON.parse(t.body))),this.messageHandler=new f.MessageHandler(this.internalMessages$,this.messages),this.messaging.connect(),this.messaging.messages$.subscribe(t=>{l.logger.log("-- Msg -- ",t)})}initDeviceManager(){this.voiceInputManager=new b.VoiceInputManager(this.options,this.api,this.messages,t=>{this.enableMicrophone(t)}),this.deviceManager=new u.DeviceManager({userMessages:this.messages,session:this.session,messages:this.messages,internalMessages$:this.internalMessages$,messaging:this.messaging,uneeqOptions:this.options,streamManager:this.streamManager,voiceInputManager:this.voiceInputManager,digitalHumanVideoElement:this.digitalHumanVideoElement},this.api),this.messageHandler.setDeviceManager(this.deviceManager)}sessionLiveHandler(){if(!this.sessionStarted){this.messages.next(new _.SessionLiveMessage(this.session.showUneeqLogo||!1,this.sessionWasResumed)),this.options.playWelcome&&this.api.avatarWelcome();const t={type:g.PromMessageType.SessionStart,value:(Date.now()-this.startSessionTime)/1e3};this.internalMessages$.next({faceMeMessageType:"prom",promMsg:t}),this.sessionStarted=!0}}initAvatar(){this.ready.filter(Boolean).pipe(s.take(1)).subscribe(()=>{this.internalMessages$.filter(t=>"DevicePermissionAllowedInternal"===t.faceMeMessageType).pipe(s.take(1)).subscribe(t=>{this.messages.next(new _.DevicePermissionAllowedMessage),this.startAvatarWhenAvailable()}),this.initDeviceManager()}),this.internalMessages$.filter(t=>"sessionLive"===t.faceMeMessageType).pipe(s.take(1)).subscribe(t=>this.sessionLiveHandler()),this.internalMessages$.filter(t=>"sessionEnd"===t.faceMeMessageType).subscribe(()=>{this.deviceManager.mediaHandler.endSession(),this.messages.next(new _.SessionEndedMessage),this.messaging.disconnect()}),this.internalMessages$.filter(t=>"remoteVideoReadyToPlay"===t.faceMeMessageType).subscribe(t=>{this.dhVideoPlayManager.play(this.deviceManager.mediaHandler.avatarVideoElement)})}startAvatarWhenAvailable(){this.availableResponseTime=Date.now(),this.api.getAvailableAvatarCount().then(t=>{if(t.available>0){const t={type:g.PromMessageType.AvailabilityCheck,value:(Date.now()-this.availableResponseTime)/1e3};this.internalMessages$.next({faceMeMessageType:"prom",promMsg:t}),this.messages.next(new _.AvatarAvailableMessage),this.api.avatarStart({enableTransparentBackground:this.options.enableTransparentBackground,resumeSession:this.sessionWasResumed,backgroundImageUrl:this.options.backgroundImageUrl,nameTagImageUrl:this.options.nameTagImageUrl,speechToTextLocales:this.options.speechToTextLocales}).catch(t=>{console.error("UneeQ: Digital human could not be started. Clearing resumeSession token and ending process.",t),localStorage.removeItem("uneeqResumeSessionId")})}else this.unavailableAvatarMsgSent||(this.unavailableAvatarMsgSent=!0,this.messages.next(new _.AvatarUnavailableMessage)),setTimeout(()=>{this.startAvatarWhenAvailable()},1e3)})}initialize(){if(this.session){this.initPromMetricsListener(),this.api.callId=this.session.id,this.initAvatar();const t={maxReconnectAttempts:3,reconnectTime:3e3,maxReconnectLimitReached:()=>{this.messages.next(new _.ConnectionLostMessage(S.PublishSubscribeState.DISCONNECTED)),this.endSession()},connectionHeaders:{"x-auth-token":this.api.authToken}};this.messaging=new d.MessagingService(this.options.url+"/api/messaging",t),this.initMessaging(),this.initOnlineStatusUpdateMessages()}}sendServiceUnavailableMessage(t){const e=new _.ServiceUnavailableMessage(t);this.messages.next(e),this.messageCallback(e)}serviceReadyCheck(t){return!!this.ready.value||(this.messages.next(new _.WarningMessage("Call to "+t+" ignored. Service Not Ready")),!1)}checkWebRTCSupport(){navigator.getUserMedia||this.sendServiceUnavailableMessage("Error: WEBRTC NOT SUPPORTED")}initOnlineStatusUpdateMessages(){new v.OnlineStatusService(this.messages,()=>{this.messages.next(new _.ConnectionLostMessage(S.PublishSubscribeState.DISCONNECTED)),this.endSession()})}initPromMetricsListener(){const t=new g.Prom(this.options.url);this.internalMessages$.filter(t=>"prom"===t.faceMeMessageType).subscribe(e=>{t.handleMessage(e.promMsg)})}validateLocales(t=""){if(t.length>0){if(t.match(C.localesRegEx))return t;console.error(`UneeQ: Invalid value for speechToTextLocales: ${t}. Please use a valid BCP 47 language tag with multiple locales separated by colon .e.g 'en-US:ja-JP`)}return""}}e.Uneeq=C,C.localesRegEx=/^([a-z]{2}(-[A-Z]{2})?)(:[a-z]{2}(-[A-Z]{2})?)*$/},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PublishSubscribeState=void 0,function(t){t.DISCONNECTED="DISCONNECTED",t.CONNECTING="CONNECTING",t.CONNECTED="CONNECTED",t.FAILED="FAILED"}(e.PublishSubscribeState||(e.PublishSubscribeState={}))},function(t,e,n){
31
+ */(function(){var o="Expected a function",s="__lodash_placeholder__",a=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],c="[object Arguments]",u="[object Array]",h="[object Boolean]",l="[object Date]",f="[object Error]",d="[object Function]",p="[object GeneratorFunction]",v="[object Map]",g="[object Number]",m="[object Object]",y="[object RegExp]",b="[object Set]",_="[object String]",w="[object Symbol]",S="[object WeakMap]",x="[object ArrayBuffer]",T="[object DataView]",C="[object Float32Array]",E="[object Float64Array]",R="[object Int8Array]",M="[object Int16Array]",O="[object Int32Array]",A="[object Uint8Array]",P="[object Uint16Array]",k="[object Uint32Array]",I=/\b__p \+= '';/g,D=/\b(__p \+=) '' \+/g,N=/(__e\(.*?\)|\b__t\)) \+\n'';/g,j=/&(?:amp|lt|gt|quot|#39);/g,L=/[&<>"']/g,U=RegExp(j.source),F=RegExp(L.source),B=/<%-([\s\S]+?)%>/g,V=/<%([\s\S]+?)%>/g,W=/<%=([\s\S]+?)%>/g,q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,H=/^\w*$/,z=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,G=/[\\^$.*+?()[\]{}|]/g,Y=RegExp(G.source),$=/^\s+/,X=/\s/,K=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,J=/\{\n\/\* \[wrapped with (.+)\] \*/,Z=/,? & /,Q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,tt=/[()=,{}\[\]\/\s]/,et=/\\(\\)?/g,nt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,rt=/\w*$/,it=/^[-+]0x[0-9a-f]+$/i,ot=/^0b[01]+$/i,st=/^\[object .+?Constructor\]$/,at=/^0o[0-7]+$/i,ct=/^(?:0|[1-9]\d*)$/,ut=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ht=/($^)/,lt=/['\n\r\u2028\u2029\\]/g,ft="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",dt="\\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",pt="[\\ud800-\\udfff]",vt="["+dt+"]",gt="["+ft+"]",mt="\\d+",yt="[\\u2700-\\u27bf]",bt="[a-z\\xdf-\\xf6\\xf8-\\xff]",_t="[^\\ud800-\\udfff"+dt+mt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",wt="\\ud83c[\\udffb-\\udfff]",St="[^\\ud800-\\udfff]",xt="(?:\\ud83c[\\udde6-\\uddff]){2}",Tt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ct="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Et="(?:"+bt+"|"+_t+")",Rt="(?:"+Ct+"|"+_t+")",Mt="(?:"+gt+"|"+wt+")"+"?",Ot="[\\ufe0e\\ufe0f]?"+Mt+("(?:\\u200d(?:"+[St,xt,Tt].join("|")+")[\\ufe0e\\ufe0f]?"+Mt+")*"),At="(?:"+[yt,xt,Tt].join("|")+")"+Ot,Pt="(?:"+[St+gt+"?",gt,xt,Tt,pt].join("|")+")",kt=RegExp("['’]","g"),It=RegExp(gt,"g"),Dt=RegExp(wt+"(?="+wt+")|"+Pt+Ot,"g"),Nt=RegExp([Ct+"?"+bt+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[vt,Ct,"$"].join("|")+")",Rt+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[vt,Ct+Et,"$"].join("|")+")",Ct+"?"+Et+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Ct+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",mt,At].join("|"),"g"),jt=RegExp("[\\u200d\\ud800-\\udfff"+ft+"\\ufe0e\\ufe0f]"),Lt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ut=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ft=-1,Bt={};Bt[C]=Bt[E]=Bt[R]=Bt[M]=Bt[O]=Bt[A]=Bt["[object Uint8ClampedArray]"]=Bt[P]=Bt[k]=!0,Bt[c]=Bt[u]=Bt[x]=Bt[h]=Bt[T]=Bt[l]=Bt[f]=Bt[d]=Bt[v]=Bt[g]=Bt[m]=Bt[y]=Bt[b]=Bt[_]=Bt[S]=!1;var Vt={};Vt[c]=Vt[u]=Vt[x]=Vt[T]=Vt[h]=Vt[l]=Vt[C]=Vt[E]=Vt[R]=Vt[M]=Vt[O]=Vt[v]=Vt[g]=Vt[m]=Vt[y]=Vt[b]=Vt[_]=Vt[w]=Vt[A]=Vt["[object Uint8ClampedArray]"]=Vt[P]=Vt[k]=!0,Vt[f]=Vt[d]=Vt[S]=!1;var Wt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},qt=parseFloat,Ht=parseInt,zt="object"==typeof t&&t&&t.Object===Object&&t,Gt="object"==typeof self&&self&&self.Object===Object&&self,Yt=zt||Gt||Function("return this")(),$t=e&&!e.nodeType&&e,Xt=$t&&"object"==typeof r&&r&&!r.nodeType&&r,Kt=Xt&&Xt.exports===$t,Jt=Kt&&zt.process,Zt=function(){try{var t=Xt&&Xt.require&&Xt.require("util").types;return t||Jt&&Jt.binding&&Jt.binding("util")}catch(t){}}(),Qt=Zt&&Zt.isArrayBuffer,te=Zt&&Zt.isDate,ee=Zt&&Zt.isMap,ne=Zt&&Zt.isRegExp,re=Zt&&Zt.isSet,ie=Zt&&Zt.isTypedArray;function oe(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function se(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var s=t[i];e(r,s,n(s),t)}return r}function ae(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function ce(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function ue(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function he(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var s=t[n];e(s,n,t)&&(o[i++]=s)}return o}function le(t,e){return!!(null==t?0:t.length)&&we(t,e,0)>-1}function fe(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function de(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function pe(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function ve(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function ge(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function me(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var ye=Ce("length");function be(t,e,n){var r;return n(t,(function(t,n,i){if(e(t,n,i))return r=n,!1})),r}function _e(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function we(t,e,n){return e==e?function(t,e,n){var r=n-1,i=t.length;for(;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):_e(t,xe,n)}function Se(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}function xe(t){return t!=t}function Te(t,e){var n=null==t?0:t.length;return n?Me(t,e)/n:NaN}function Ce(t){return function(e){return null==e?void 0:e[t]}}function Ee(t){return function(e){return null==t?void 0:t[e]}}function Re(t,e,n,r,i){return i(t,(function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)})),n}function Me(t,e){for(var n,r=-1,i=t.length;++r<i;){var o=e(t[r]);void 0!==o&&(n=void 0===n?o:n+o)}return n}function Oe(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Ae(t){return t?t.slice(0,$e(t)+1).replace($,""):t}function Pe(t){return function(e){return t(e)}}function ke(t,e){return de(e,(function(e){return t[e]}))}function Ie(t,e){return t.has(e)}function De(t,e){for(var n=-1,r=t.length;++n<r&&we(e,t[n],0)>-1;);return n}function Ne(t,e){for(var n=t.length;n--&&we(e,t[n],0)>-1;);return n}function je(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}var Le=Ee({"À":"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"}),Ue=Ee({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Fe(t){return"\\"+Wt[t]}function Be(t){return jt.test(t)}function Ve(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function We(t,e){return function(n){return t(e(n))}}function qe(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var a=t[n];a!==e&&a!==s||(t[n]=s,o[i++]=n)}return o}function He(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}function ze(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}function Ge(t){return Be(t)?function(t){var e=Dt.lastIndex=0;for(;Dt.test(t);)++e;return e}(t):ye(t)}function Ye(t){return Be(t)?function(t){return t.match(Dt)||[]}(t):function(t){return t.split("")}(t)}function $e(t){for(var e=t.length;e--&&X.test(t.charAt(e)););return e}var Xe=Ee({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var Ke=function t(e){var n,r=(e=null==e?Yt:Ke.defaults(Yt.Object(),e,Ke.pick(Yt,Ut))).Array,i=e.Date,X=e.Error,ft=e.Function,dt=e.Math,pt=e.Object,vt=e.RegExp,gt=e.String,mt=e.TypeError,yt=r.prototype,bt=ft.prototype,_t=pt.prototype,wt=e["__core-js_shared__"],St=bt.toString,xt=_t.hasOwnProperty,Tt=0,Ct=(n=/[^.]+$/.exec(wt&&wt.keys&&wt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Et=_t.toString,Rt=St.call(pt),Mt=Yt._,Ot=vt("^"+St.call(xt).replace(G,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),At=Kt?e.Buffer:void 0,Pt=e.Symbol,Dt=e.Uint8Array,jt=At?At.allocUnsafe:void 0,Wt=We(pt.getPrototypeOf,pt),zt=pt.create,Gt=_t.propertyIsEnumerable,$t=yt.splice,Xt=Pt?Pt.isConcatSpreadable:void 0,Jt=Pt?Pt.iterator:void 0,Zt=Pt?Pt.toStringTag:void 0,ye=function(){try{var t=to(pt,"defineProperty");return t({},"",{}),t}catch(t){}}(),Ee=e.clearTimeout!==Yt.clearTimeout&&e.clearTimeout,Je=i&&i.now!==Yt.Date.now&&i.now,Ze=e.setTimeout!==Yt.setTimeout&&e.setTimeout,Qe=dt.ceil,tn=dt.floor,en=pt.getOwnPropertySymbols,nn=At?At.isBuffer:void 0,rn=e.isFinite,on=yt.join,sn=We(pt.keys,pt),an=dt.max,cn=dt.min,un=i.now,hn=e.parseInt,ln=dt.random,fn=yt.reverse,dn=to(e,"DataView"),pn=to(e,"Map"),vn=to(e,"Promise"),gn=to(e,"Set"),mn=to(e,"WeakMap"),yn=to(pt,"create"),bn=mn&&new mn,_n={},wn=Mo(dn),Sn=Mo(pn),xn=Mo(vn),Tn=Mo(gn),Cn=Mo(mn),En=Pt?Pt.prototype:void 0,Rn=En?En.valueOf:void 0,Mn=En?En.toString:void 0;function On(t){if(zs(t)&&!Ds(t)&&!(t instanceof In)){if(t instanceof kn)return t;if(xt.call(t,"__wrapped__"))return Oo(t)}return new kn(t)}var An=function(){function t(){}return function(e){if(!Hs(e))return{};if(zt)return zt(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function Pn(){}function kn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}function In(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Dn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Nn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function jn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Ln(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new jn;++e<n;)this.add(t[e])}function Un(t){var e=this.__data__=new Nn(t);this.size=e.size}function Fn(t,e){var n=Ds(t),r=!n&&Is(t),i=!n&&!r&&Us(t),o=!n&&!r&&!i&&Qs(t),s=n||r||i||o,a=s?Oe(t.length,gt):[],c=a.length;for(var u in t)!e&&!xt.call(t,u)||s&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ao(u,c))||a.push(u);return a}function Bn(t){var e=t.length;return e?t[Lr(0,e-1)]:void 0}function Vn(t,e){return Co(yi(t),Kn(e,0,t.length))}function Wn(t){return Co(yi(t))}function qn(t,e,n){(void 0!==n&&!As(t[e],n)||void 0===n&&!(e in t))&&$n(t,e,n)}function Hn(t,e,n){var r=t[e];xt.call(t,e)&&As(r,n)&&(void 0!==n||e in t)||$n(t,e,n)}function zn(t,e){for(var n=t.length;n--;)if(As(t[n][0],e))return n;return-1}function Gn(t,e,n,r){return er(t,(function(t,i,o){e(r,t,n(t),o)})),r}function Yn(t,e){return t&&bi(e,wa(e),t)}function $n(t,e,n){"__proto__"==e&&ye?ye(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Xn(t,e){for(var n=-1,i=e.length,o=r(i),s=null==t;++n<i;)o[n]=s?void 0:ga(t,e[n]);return o}function Kn(t,e,n){return t==t&&(void 0!==n&&(t=t<=n?t:n),void 0!==e&&(t=t>=e?t:e)),t}function Jn(t,e,n,r,i,o){var s,a=1&e,u=2&e,f=4&e;if(n&&(s=i?n(t,r,i,o):n(t)),void 0!==s)return s;if(!Hs(t))return t;var S=Ds(t);if(S){if(s=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&xt.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!a)return yi(t,s)}else{var I=ro(t),D=I==d||I==p;if(Us(t))return fi(t,a);if(I==m||I==c||D&&!i){if(s=u||D?{}:oo(t),!a)return u?function(t,e){return bi(t,no(t),e)}(t,function(t,e){return t&&bi(e,Sa(e),t)}(s,t)):function(t,e){return bi(t,eo(t),e)}(t,Yn(s,t))}else{if(!Vt[I])return i?t:{};s=function(t,e,n){var r=t.constructor;switch(e){case x:return di(t);case h:case l:return new r(+t);case T:return function(t,e){var n=e?di(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case C:case E:case R:case M:case O:case A:case"[object Uint8ClampedArray]":case P:case k:return pi(t,n);case v:return new r;case g:case _:return new r(t);case y:return function(t){var e=new t.constructor(t.source,rt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case b:return new r;case w:return i=t,Rn?pt(Rn.call(i)):{}}var i}(t,I,a)}}o||(o=new Un);var N=o.get(t);if(N)return N;o.set(t,s),Ks(t)?t.forEach((function(r){s.add(Jn(r,e,n,r,t,o))})):Gs(t)&&t.forEach((function(r,i){s.set(i,Jn(r,e,n,i,t,o))}));var j=S?void 0:(f?u?Yi:Gi:u?Sa:wa)(t);return ae(j||t,(function(r,i){j&&(r=t[i=r]),Hn(s,i,Jn(r,e,n,i,t,o))})),s}function Zn(t,e,n){var r=n.length;if(null==t)return!r;for(t=pt(t);r--;){var i=n[r],o=e[i],s=t[i];if(void 0===s&&!(i in t)||!o(s))return!1}return!0}function Qn(t,e,n){if("function"!=typeof t)throw new mt(o);return wo((function(){t.apply(void 0,n)}),e)}function tr(t,e,n,r){var i=-1,o=le,s=!0,a=t.length,c=[],u=e.length;if(!a)return c;n&&(e=de(e,Pe(n))),r?(o=fe,s=!1):e.length>=200&&(o=Ie,s=!1,e=new Ln(e));t:for(;++i<a;){var h=t[i],l=null==n?h:n(h);if(h=r||0!==h?h:0,s&&l==l){for(var f=u;f--;)if(e[f]===l)continue t;c.push(h)}else o(e,l,r)||c.push(h)}return c}On.templateSettings={escape:B,evaluate:V,interpolate:W,variable:"",imports:{_:On}},On.prototype=Pn.prototype,On.prototype.constructor=On,kn.prototype=An(Pn.prototype),kn.prototype.constructor=kn,In.prototype=An(Pn.prototype),In.prototype.constructor=In,Dn.prototype.clear=function(){this.__data__=yn?yn(null):{},this.size=0},Dn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Dn.prototype.get=function(t){var e=this.__data__;if(yn){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return xt.call(e,t)?e[t]:void 0},Dn.prototype.has=function(t){var e=this.__data__;return yn?void 0!==e[t]:xt.call(e,t)},Dn.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=yn&&void 0===e?"__lodash_hash_undefined__":e,this},Nn.prototype.clear=function(){this.__data__=[],this.size=0},Nn.prototype.delete=function(t){var e=this.__data__,n=zn(e,t);return!(n<0)&&(n==e.length-1?e.pop():$t.call(e,n,1),--this.size,!0)},Nn.prototype.get=function(t){var e=this.__data__,n=zn(e,t);return n<0?void 0:e[n][1]},Nn.prototype.has=function(t){return zn(this.__data__,t)>-1},Nn.prototype.set=function(t,e){var n=this.__data__,r=zn(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},jn.prototype.clear=function(){this.size=0,this.__data__={hash:new Dn,map:new(pn||Nn),string:new Dn}},jn.prototype.delete=function(t){var e=Zi(this,t).delete(t);return this.size-=e?1:0,e},jn.prototype.get=function(t){return Zi(this,t).get(t)},jn.prototype.has=function(t){return Zi(this,t).has(t)},jn.prototype.set=function(t,e){var n=Zi(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Ln.prototype.add=Ln.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Ln.prototype.has=function(t){return this.__data__.has(t)},Un.prototype.clear=function(){this.__data__=new Nn,this.size=0},Un.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Un.prototype.get=function(t){return this.__data__.get(t)},Un.prototype.has=function(t){return this.__data__.has(t)},Un.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Nn){var r=n.__data__;if(!pn||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new jn(r)}return n.set(t,e),this.size=n.size,this};var er=Si(ur),nr=Si(hr,!0);function rr(t,e){var n=!0;return er(t,(function(t,r,i){return n=!!e(t,r,i)})),n}function ir(t,e,n){for(var r=-1,i=t.length;++r<i;){var o=t[r],s=e(o);if(null!=s&&(void 0===a?s==s&&!Zs(s):n(s,a)))var a=s,c=o}return c}function or(t,e){var n=[];return er(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n}function sr(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=so),i||(i=[]);++o<s;){var a=t[o];e>0&&n(a)?e>1?sr(a,e-1,n,r,i):pe(i,a):r||(i[i.length]=a)}return i}var ar=xi(),cr=xi(!0);function ur(t,e){return t&&ar(t,e,wa)}function hr(t,e){return t&&cr(t,e,wa)}function lr(t,e){return he(e,(function(e){return Vs(t[e])}))}function fr(t,e){for(var n=0,r=(e=ci(e,t)).length;null!=t&&n<r;)t=t[Ro(e[n++])];return n&&n==r?t:void 0}function dr(t,e,n){var r=e(t);return Ds(t)?r:pe(r,n(t))}function pr(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Zt&&Zt in pt(t)?function(t){var e=xt.call(t,Zt),n=t[Zt];try{t[Zt]=void 0;var r=!0}catch(t){}var i=Et.call(t);r&&(e?t[Zt]=n:delete t[Zt]);return i}(t):function(t){return Et.call(t)}(t)}function vr(t,e){return t>e}function gr(t,e){return null!=t&&xt.call(t,e)}function mr(t,e){return null!=t&&e in pt(t)}function yr(t,e,n){for(var i=n?fe:le,o=t[0].length,s=t.length,a=s,c=r(s),u=1/0,h=[];a--;){var l=t[a];a&&e&&(l=de(l,Pe(e))),u=cn(l.length,u),c[a]=!n&&(e||o>=120&&l.length>=120)?new Ln(a&&l):void 0}l=t[0];var f=-1,d=c[0];t:for(;++f<o&&h.length<u;){var p=l[f],v=e?e(p):p;if(p=n||0!==p?p:0,!(d?Ie(d,v):i(h,v,n))){for(a=s;--a;){var g=c[a];if(!(g?Ie(g,v):i(t[a],v,n)))continue t}d&&d.push(v),h.push(p)}}return h}function br(t,e,n){var r=null==(t=mo(t,e=ci(e,t)))?t:t[Ro(Bo(e))];return null==r?void 0:oe(r,t,n)}function _r(t){return zs(t)&&pr(t)==c}function wr(t,e,n,r,i){return t===e||(null==t||null==e||!zs(t)&&!zs(e)?t!=t&&e!=e:function(t,e,n,r,i,o){var s=Ds(t),a=Ds(e),d=s?u:ro(t),p=a?u:ro(e),S=(d=d==c?m:d)==m,C=(p=p==c?m:p)==m,E=d==p;if(E&&Us(t)){if(!Us(e))return!1;s=!0,S=!1}if(E&&!S)return o||(o=new Un),s||Qs(t)?Hi(t,e,n,r,i,o):function(t,e,n,r,i,o,s){switch(n){case T:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case x:return!(t.byteLength!=e.byteLength||!o(new Dt(t),new Dt(e)));case h:case l:case g:return As(+t,+e);case f:return t.name==e.name&&t.message==e.message;case y:case _:return t==e+"";case v:var a=Ve;case b:var c=1&r;if(a||(a=He),t.size!=e.size&&!c)return!1;var u=s.get(t);if(u)return u==e;r|=2,s.set(t,e);var d=Hi(a(t),a(e),r,i,o,s);return s.delete(t),d;case w:if(Rn)return Rn.call(t)==Rn.call(e)}return!1}(t,e,d,n,r,i,o);if(!(1&n)){var R=S&&xt.call(t,"__wrapped__"),M=C&&xt.call(e,"__wrapped__");if(R||M){var O=R?t.value():t,A=M?e.value():e;return o||(o=new Un),i(O,A,n,r,o)}}if(!E)return!1;return o||(o=new Un),function(t,e,n,r,i,o){var s=1&n,a=Gi(t),c=a.length,u=Gi(e).length;if(c!=u&&!s)return!1;var h=c;for(;h--;){var l=a[h];if(!(s?l in e:xt.call(e,l)))return!1}var f=o.get(t),d=o.get(e);if(f&&d)return f==e&&d==t;var p=!0;o.set(t,e),o.set(e,t);var v=s;for(;++h<c;){l=a[h];var g=t[l],m=e[l];if(r)var y=s?r(m,g,l,e,t,o):r(g,m,l,t,e,o);if(!(void 0===y?g===m||i(g,m,n,r,o):y)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){var b=t.constructor,_=e.constructor;b==_||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _||(p=!1)}return o.delete(t),o.delete(e),p}(t,e,n,r,i,o)}(t,e,n,r,wr,i))}function Sr(t,e,n,r){var i=n.length,o=i,s=!r;if(null==t)return!o;for(t=pt(t);i--;){var a=n[i];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<o;){var c=(a=n[i])[0],u=t[c],h=a[1];if(s&&a[2]){if(void 0===u&&!(c in t))return!1}else{var l=new Un;if(r)var f=r(u,h,c,t,e,l);if(!(void 0===f?wr(h,u,3,r,l):f))return!1}}return!0}function xr(t){return!(!Hs(t)||(e=t,Ct&&Ct in e))&&(Vs(t)?Ot:st).test(Mo(t));var e}function Tr(t){return"function"==typeof t?t:null==t?Ya:"object"==typeof t?Ds(t)?Ar(t[0],t[1]):Or(t):nc(t)}function Cr(t){if(!fo(t))return sn(t);var e=[];for(var n in pt(t))xt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Er(t){if(!Hs(t))return function(t){var e=[];if(null!=t)for(var n in pt(t))e.push(n);return e}(t);var e=fo(t),n=[];for(var r in t)("constructor"!=r||!e&&xt.call(t,r))&&n.push(r);return n}function Rr(t,e){return t<e}function Mr(t,e){var n=-1,i=js(t)?r(t.length):[];return er(t,(function(t,r,o){i[++n]=e(t,r,o)})),i}function Or(t){var e=Qi(t);return 1==e.length&&e[0][2]?vo(e[0][0],e[0][1]):function(n){return n===t||Sr(n,t,e)}}function Ar(t,e){return uo(t)&&po(e)?vo(Ro(t),e):function(n){var r=ga(n,t);return void 0===r&&r===e?ma(n,t):wr(e,r,3)}}function Pr(t,e,n,r,i){t!==e&&ar(e,(function(o,s){if(i||(i=new Un),Hs(o))!function(t,e,n,r,i,o,s){var a=bo(t,n),c=bo(e,n),u=s.get(c);if(u)return void qn(t,n,u);var h=o?o(a,c,n+"",t,e,s):void 0,l=void 0===h;if(l){var f=Ds(c),d=!f&&Us(c),p=!f&&!d&&Qs(c);h=c,f||d||p?Ds(a)?h=a:Ls(a)?h=yi(a):d?(l=!1,h=fi(c,!0)):p?(l=!1,h=pi(c,!0)):h=[]:$s(c)||Is(c)?(h=a,Is(a)?h=aa(a):Hs(a)&&!Vs(a)||(h=oo(c))):l=!1}l&&(s.set(c,h),i(h,c,r,o,s),s.delete(c));qn(t,n,h)}(t,e,s,n,Pr,r,i);else{var a=r?r(bo(t,s),o,s+"",t,e,i):void 0;void 0===a&&(a=o),qn(t,s,a)}}),Sa)}function kr(t,e){var n=t.length;if(n)return ao(e+=e<0?n:0,n)?t[e]:void 0}function Ir(t,e,n){e=e.length?de(e,(function(t){return Ds(t)?function(e){return fr(e,1===t.length?t[0]:t)}:t})):[Ya];var r=-1;return e=de(e,Pe(Ji())),function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(Mr(t,(function(t,n,i){return{criteria:de(e,(function(e){return e(t)})),index:++r,value:t}})),(function(t,e){return function(t,e,n){var r=-1,i=t.criteria,o=e.criteria,s=i.length,a=n.length;for(;++r<s;){var c=vi(i[r],o[r]);if(c){if(r>=a)return c;var u=n[r];return c*("desc"==u?-1:1)}}return t.index-e.index}(t,e,n)}))}function Dr(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var s=e[r],a=fr(t,s);n(a,s)&&Wr(o,ci(s,t),a)}return o}function Nr(t,e,n,r){var i=r?Se:we,o=-1,s=e.length,a=t;for(t===e&&(e=yi(e)),n&&(a=de(t,Pe(n)));++o<s;)for(var c=0,u=e[o],h=n?n(u):u;(c=i(a,h,c,r))>-1;)a!==t&&$t.call(a,c,1),$t.call(t,c,1);return t}function jr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;ao(i)?$t.call(t,i,1):ti(t,i)}}return t}function Lr(t,e){return t+tn(ln()*(e-t+1))}function Ur(t,e){var n="";if(!t||e<1||e>9007199254740991)return n;do{e%2&&(n+=t),(e=tn(e/2))&&(t+=t)}while(e);return n}function Fr(t,e){return So(go(t,e,Ya),t+"")}function Br(t){return Bn(Aa(t))}function Vr(t,e){var n=Aa(t);return Co(n,Kn(e,0,n.length))}function Wr(t,e,n,r){if(!Hs(t))return t;for(var i=-1,o=(e=ci(e,t)).length,s=o-1,a=t;null!=a&&++i<o;){var c=Ro(e[i]),u=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(i!=s){var h=a[c];void 0===(u=r?r(h,c,a):void 0)&&(u=Hs(h)?h:ao(e[i+1])?[]:{})}Hn(a,c,u),a=a[c]}return t}var qr=bn?function(t,e){return bn.set(t,e),t}:Ya,Hr=ye?function(t,e){return ye(t,"toString",{configurable:!0,enumerable:!1,value:Ha(e),writable:!0})}:Ya;function zr(t){return Co(Aa(t))}function Gr(t,e,n){var i=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var s=r(o);++i<o;)s[i]=t[i+e];return s}function Yr(t,e){var n;return er(t,(function(t,r,i){return!(n=e(t,r,i))})),!!n}function $r(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var o=r+i>>>1,s=t[o];null!==s&&!Zs(s)&&(n?s<=e:s<e)?r=o+1:i=o}return i}return Xr(t,e,Ya,n)}function Xr(t,e,n,r){var i=0,o=null==t?0:t.length;if(0===o)return 0;for(var s=(e=n(e))!=e,a=null===e,c=Zs(e),u=void 0===e;i<o;){var h=tn((i+o)/2),l=n(t[h]),f=void 0!==l,d=null===l,p=l==l,v=Zs(l);if(s)var g=r||p;else g=u?p&&(r||f):a?p&&f&&(r||!d):c?p&&f&&!d&&(r||!v):!d&&!v&&(r?l<=e:l<e);g?i=h+1:o=h}return cn(o,4294967294)}function Kr(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n],a=e?e(s):s;if(!n||!As(a,c)){var c=a;o[i++]=0===s?0:s}}return o}function Jr(t){return"number"==typeof t?t:Zs(t)?NaN:+t}function Zr(t){if("string"==typeof t)return t;if(Ds(t))return de(t,Zr)+"";if(Zs(t))return Mn?Mn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Qr(t,e,n){var r=-1,i=le,o=t.length,s=!0,a=[],c=a;if(n)s=!1,i=fe;else if(o>=200){var u=e?null:Ui(t);if(u)return He(u);s=!1,i=Ie,c=new Ln}else c=e?[]:a;t:for(;++r<o;){var h=t[r],l=e?e(h):h;if(h=n||0!==h?h:0,s&&l==l){for(var f=c.length;f--;)if(c[f]===l)continue t;e&&c.push(l),a.push(h)}else i(c,l,n)||(c!==a&&c.push(l),a.push(h))}return a}function ti(t,e){return null==(t=mo(t,e=ci(e,t)))||delete t[Ro(Bo(e))]}function ei(t,e,n,r){return Wr(t,e,n(fr(t,e)),r)}function ni(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?Gr(t,r?0:o,r?o+1:i):Gr(t,r?o+1:0,r?i:o)}function ri(t,e){var n=t;return n instanceof In&&(n=n.value()),ve(e,(function(t,e){return e.func.apply(e.thisArg,pe([t],e.args))}),n)}function ii(t,e,n){var i=t.length;if(i<2)return i?Qr(t[0]):[];for(var o=-1,s=r(i);++o<i;)for(var a=t[o],c=-1;++c<i;)c!=o&&(s[o]=tr(s[o]||a,t[c],e,n));return Qr(sr(s,1),e,n)}function oi(t,e,n){for(var r=-1,i=t.length,o=e.length,s={};++r<i;){var a=r<o?e[r]:void 0;n(s,t[r],a)}return s}function si(t){return Ls(t)?t:[]}function ai(t){return"function"==typeof t?t:Ya}function ci(t,e){return Ds(t)?t:uo(t,e)?[t]:Eo(ca(t))}var ui=Fr;function hi(t,e,n){var r=t.length;return n=void 0===n?r:n,!e&&n>=r?t:Gr(t,e,n)}var li=Ee||function(t){return Yt.clearTimeout(t)};function fi(t,e){if(e)return t.slice();var n=t.length,r=jt?jt(n):new t.constructor(n);return t.copy(r),r}function di(t){var e=new t.constructor(t.byteLength);return new Dt(e).set(new Dt(t)),e}function pi(t,e){var n=e?di(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function vi(t,e){if(t!==e){var n=void 0!==t,r=null===t,i=t==t,o=Zs(t),s=void 0!==e,a=null===e,c=e==e,u=Zs(e);if(!a&&!u&&!o&&t>e||o&&s&&c&&!a&&!u||r&&s&&c||!n&&c||!i)return 1;if(!r&&!o&&!u&&t<e||u&&n&&i&&!r&&!o||a&&n&&i||!s&&i||!c)return-1}return 0}function gi(t,e,n,i){for(var o=-1,s=t.length,a=n.length,c=-1,u=e.length,h=an(s-a,0),l=r(u+h),f=!i;++c<u;)l[c]=e[c];for(;++o<a;)(f||o<s)&&(l[n[o]]=t[o]);for(;h--;)l[c++]=t[o++];return l}function mi(t,e,n,i){for(var o=-1,s=t.length,a=-1,c=n.length,u=-1,h=e.length,l=an(s-c,0),f=r(l+h),d=!i;++o<l;)f[o]=t[o];for(var p=o;++u<h;)f[p+u]=e[u];for(;++a<c;)(d||o<s)&&(f[p+n[a]]=t[o++]);return f}function yi(t,e){var n=-1,i=t.length;for(e||(e=r(i));++n<i;)e[n]=t[n];return e}function bi(t,e,n,r){var i=!n;n||(n={});for(var o=-1,s=e.length;++o<s;){var a=e[o],c=r?r(n[a],t[a],a,n,t):void 0;void 0===c&&(c=t[a]),i?$n(n,a,c):Hn(n,a,c)}return n}function _i(t,e){return function(n,r){var i=Ds(n)?se:Gn,o=e?e():{};return i(n,t,Ji(r,2),o)}}function wi(t){return Fr((function(e,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=t.length>3&&"function"==typeof o?(i--,o):void 0,s&&co(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),e=pt(e);++r<i;){var a=n[r];a&&t(e,a,r,o)}return e}))}function Si(t,e){return function(n,r){if(null==n)return n;if(!js(n))return t(n,r);for(var i=n.length,o=e?i:-1,s=pt(n);(e?o--:++o<i)&&!1!==r(s[o],o,s););return n}}function xi(t){return function(e,n,r){for(var i=-1,o=pt(e),s=r(e),a=s.length;a--;){var c=s[t?a:++i];if(!1===n(o[c],c,o))break}return e}}function Ti(t){return function(e){var n=Be(e=ca(e))?Ye(e):void 0,r=n?n[0]:e.charAt(0),i=n?hi(n,1).join(""):e.slice(1);return r[t]()+i}}function Ci(t){return function(e){return ve(Va(Ia(e).replace(kt,"")),t,"")}}function Ei(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=An(t.prototype),r=t.apply(n,e);return Hs(r)?r:n}}function Ri(t){return function(e,n,r){var i=pt(e);if(!js(e)){var o=Ji(n,3);e=wa(e),n=function(t){return o(i[t],t,i)}}var s=t(e,n,r);return s>-1?i[o?e[s]:s]:void 0}}function Mi(t){return zi((function(e){var n=e.length,r=n,i=kn.prototype.thru;for(t&&e.reverse();r--;){var s=e[r];if("function"!=typeof s)throw new mt(o);if(i&&!a&&"wrapper"==Xi(s))var a=new kn([],!0)}for(r=a?r:n;++r<n;){var c=Xi(s=e[r]),u="wrapper"==c?$i(s):void 0;a=u&&ho(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?a[Xi(u[0])].apply(a,u[3]):1==s.length&&ho(s)?a[c]():a.thru(s)}return function(){var t=arguments,r=t[0];if(a&&1==t.length&&Ds(r))return a.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}}))}function Oi(t,e,n,i,o,s,a,c,u,h){var l=128&e,f=1&e,d=2&e,p=24&e,v=512&e,g=d?void 0:Ei(t);return function m(){for(var y=arguments.length,b=r(y),_=y;_--;)b[_]=arguments[_];if(p)var w=Ki(m),S=je(b,w);if(i&&(b=gi(b,i,o,p)),s&&(b=mi(b,s,a,p)),y-=S,p&&y<h){var x=qe(b,w);return ji(t,e,Oi,m.placeholder,n,b,x,c,u,h-y)}var T=f?n:this,C=d?T[t]:t;return y=b.length,c?b=yo(b,c):v&&y>1&&b.reverse(),l&&u<y&&(b.length=u),this&&this!==Yt&&this instanceof m&&(C=g||Ei(C)),C.apply(T,b)}}function Ai(t,e){return function(n,r){return function(t,e,n,r){return ur(t,(function(t,i,o){e(r,n(t),i,o)})),r}(n,t,e(r),{})}}function Pi(t,e){return function(n,r){var i;if(void 0===n&&void 0===r)return e;if(void 0!==n&&(i=n),void 0!==r){if(void 0===i)return r;"string"==typeof n||"string"==typeof r?(n=Zr(n),r=Zr(r)):(n=Jr(n),r=Jr(r)),i=t(n,r)}return i}}function ki(t){return zi((function(e){return e=de(e,Pe(Ji())),Fr((function(n){var r=this;return t(e,(function(t){return oe(t,r,n)}))}))}))}function Ii(t,e){var n=(e=void 0===e?" ":Zr(e)).length;if(n<2)return n?Ur(e,t):e;var r=Ur(e,Qe(t/Ge(e)));return Be(e)?hi(Ye(r),0,t).join(""):r.slice(0,t)}function Di(t){return function(e,n,i){return i&&"number"!=typeof i&&co(e,n,i)&&(n=i=void 0),e=ra(e),void 0===n?(n=e,e=0):n=ra(n),function(t,e,n,i){for(var o=-1,s=an(Qe((e-t)/(n||1)),0),a=r(s);s--;)a[i?s:++o]=t,t+=n;return a}(e,n,i=void 0===i?e<n?1:-1:ra(i),t)}}function Ni(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=sa(e),n=sa(n)),t(e,n)}}function ji(t,e,n,r,i,o,s,a,c,u){var h=8&e;e|=h?32:64,4&(e&=~(h?64:32))||(e&=-4);var l=[t,e,i,h?o:void 0,h?s:void 0,h?void 0:o,h?void 0:s,a,c,u],f=n.apply(void 0,l);return ho(t)&&_o(f,l),f.placeholder=r,xo(f,t,e)}function Li(t){var e=dt[t];return function(t,n){if(t=sa(t),(n=null==n?0:cn(ia(n),292))&&rn(t)){var r=(ca(t)+"e").split("e");return+((r=(ca(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Ui=gn&&1/He(new gn([,-0]))[1]==1/0?function(t){return new gn(t)}:Za;function Fi(t){return function(e){var n=ro(e);return n==v?Ve(e):n==b?ze(e):function(t,e){return de(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Bi(t,e,n,i,a,c,u,h){var l=2&e;if(!l&&"function"!=typeof t)throw new mt(o);var f=i?i.length:0;if(f||(e&=-97,i=a=void 0),u=void 0===u?u:an(ia(u),0),h=void 0===h?h:ia(h),f-=a?a.length:0,64&e){var d=i,p=a;i=a=void 0}var v=l?void 0:$i(t),g=[t,e,n,i,a,d,p,c,u,h];if(v&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,a=128==r&&8==n||128==r&&256==n&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!o&&!a)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var c=e[3];if(c){var u=t[3];t[3]=u?gi(u,c,e[4]):c,t[4]=u?qe(t[3],s):e[4]}(c=e[5])&&(u=t[5],t[5]=u?mi(u,c,e[6]):c,t[6]=u?qe(t[5],s):e[6]);(c=e[7])&&(t[7]=c);128&r&&(t[8]=null==t[8]?e[8]:cn(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=i}(g,v),t=g[0],e=g[1],n=g[2],i=g[3],a=g[4],!(h=g[9]=void 0===g[9]?l?0:t.length:an(g[9]-f,0))&&24&e&&(e&=-25),e&&1!=e)m=8==e||16==e?function(t,e,n){var i=Ei(t);return function o(){for(var s=arguments.length,a=r(s),c=s,u=Ki(o);c--;)a[c]=arguments[c];var h=s<3&&a[0]!==u&&a[s-1]!==u?[]:qe(a,u);if((s-=h.length)<n)return ji(t,e,Oi,o.placeholder,void 0,a,h,void 0,void 0,n-s);var l=this&&this!==Yt&&this instanceof o?i:t;return oe(l,this,a)}}(t,e,h):32!=e&&33!=e||a.length?Oi.apply(void 0,g):function(t,e,n,i){var o=1&e,s=Ei(t);return function e(){for(var a=-1,c=arguments.length,u=-1,h=i.length,l=r(h+c),f=this&&this!==Yt&&this instanceof e?s:t;++u<h;)l[u]=i[u];for(;c--;)l[u++]=arguments[++a];return oe(f,o?n:this,l)}}(t,e,n,i);else var m=function(t,e,n){var r=1&e,i=Ei(t);return function e(){var o=this&&this!==Yt&&this instanceof e?i:t;return o.apply(r?n:this,arguments)}}(t,e,n);return xo((v?qr:_o)(m,g),t,e)}function Vi(t,e,n,r){return void 0===t||As(t,_t[n])&&!xt.call(r,n)?e:t}function Wi(t,e,n,r,i,o){return Hs(t)&&Hs(e)&&(o.set(e,t),Pr(t,e,void 0,Wi,o),o.delete(e)),t}function qi(t){return $s(t)?void 0:t}function Hi(t,e,n,r,i,o){var s=1&n,a=t.length,c=e.length;if(a!=c&&!(s&&c>a))return!1;var u=o.get(t),h=o.get(e);if(u&&h)return u==e&&h==t;var l=-1,f=!0,d=2&n?new Ln:void 0;for(o.set(t,e),o.set(e,t);++l<a;){var p=t[l],v=e[l];if(r)var g=s?r(v,p,l,e,t,o):r(p,v,l,t,e,o);if(void 0!==g){if(g)continue;f=!1;break}if(d){if(!me(e,(function(t,e){if(!Ie(d,e)&&(p===t||i(p,t,n,r,o)))return d.push(e)}))){f=!1;break}}else if(p!==v&&!i(p,v,n,r,o)){f=!1;break}}return o.delete(t),o.delete(e),f}function zi(t){return So(go(t,void 0,No),t+"")}function Gi(t){return dr(t,wa,eo)}function Yi(t){return dr(t,Sa,no)}var $i=bn?function(t){return bn.get(t)}:Za;function Xi(t){for(var e=t.name+"",n=_n[e],r=xt.call(_n,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function Ki(t){return(xt.call(On,"placeholder")?On:t).placeholder}function Ji(){var t=On.iteratee||$a;return t=t===$a?Tr:t,arguments.length?t(arguments[0],arguments[1]):t}function Zi(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function Qi(t){for(var e=wa(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,po(i)]}return e}function to(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return xr(n)?n:void 0}var eo=en?function(t){return null==t?[]:(t=pt(t),he(en(t),(function(e){return Gt.call(t,e)})))}:oc,no=en?function(t){for(var e=[];t;)pe(e,eo(t)),t=Wt(t);return e}:oc,ro=pr;function io(t,e,n){for(var r=-1,i=(e=ci(e,t)).length,o=!1;++r<i;){var s=Ro(e[r]);if(!(o=null!=t&&n(t,s)))break;t=t[s]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&qs(i)&&ao(s,i)&&(Ds(t)||Is(t))}function oo(t){return"function"!=typeof t.constructor||fo(t)?{}:An(Wt(t))}function so(t){return Ds(t)||Is(t)||!!(Xt&&t&&t[Xt])}function ao(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&ct.test(t))&&t>-1&&t%1==0&&t<e}function co(t,e,n){if(!Hs(n))return!1;var r=typeof e;return!!("number"==r?js(n)&&ao(e,n.length):"string"==r&&e in n)&&As(n[e],t)}function uo(t,e){if(Ds(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Zs(t))||(H.test(t)||!q.test(t)||null!=e&&t in pt(e))}function ho(t){var e=Xi(t),n=On[e];if("function"!=typeof n||!(e in In.prototype))return!1;if(t===n)return!0;var r=$i(n);return!!r&&t===r[0]}(dn&&ro(new dn(new ArrayBuffer(1)))!=T||pn&&ro(new pn)!=v||vn&&"[object Promise]"!=ro(vn.resolve())||gn&&ro(new gn)!=b||mn&&ro(new mn)!=S)&&(ro=function(t){var e=pr(t),n=e==m?t.constructor:void 0,r=n?Mo(n):"";if(r)switch(r){case wn:return T;case Sn:return v;case xn:return"[object Promise]";case Tn:return b;case Cn:return S}return e});var lo=wt?Vs:sc;function fo(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||_t)}function po(t){return t==t&&!Hs(t)}function vo(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in pt(n)))}}function go(t,e,n){return e=an(void 0===e?t.length-1:e,0),function(){for(var i=arguments,o=-1,s=an(i.length-e,0),a=r(s);++o<s;)a[o]=i[e+o];o=-1;for(var c=r(e+1);++o<e;)c[o]=i[o];return c[e]=n(a),oe(t,this,c)}}function mo(t,e){return e.length<2?t:fr(t,Gr(e,0,-1))}function yo(t,e){for(var n=t.length,r=cn(e.length,n),i=yi(t);r--;){var o=e[r];t[r]=ao(o,n)?i[o]:void 0}return t}function bo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var _o=To(qr),wo=Ze||function(t,e){return Yt.setTimeout(t,e)},So=To(Hr);function xo(t,e,n){var r=e+"";return So(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(K,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return ae(a,(function(n){var r="_."+n[0];e&n[1]&&!le(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match(J);return e?e[1].split(Z):[]}(r),n)))}function To(t){var e=0,n=0;return function(){var r=un(),i=16-(r-n);if(n=r,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function Co(t,e){var n=-1,r=t.length,i=r-1;for(e=void 0===e?r:e;++n<e;){var o=Lr(n,i),s=t[o];t[o]=t[n],t[n]=s}return t.length=e,t}var Eo=function(t){var e=Ts(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(z,(function(t,n,r,i){e.push(r?i.replace(et,"$1"):n||t)})),e}));function Ro(t){if("string"==typeof t||Zs(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Mo(t){if(null!=t){try{return St.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Oo(t){if(t instanceof In)return t.clone();var e=new kn(t.__wrapped__,t.__chain__);return e.__actions__=yi(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Ao=Fr((function(t,e){return Ls(t)?tr(t,sr(e,1,Ls,!0)):[]})),Po=Fr((function(t,e){var n=Bo(e);return Ls(n)&&(n=void 0),Ls(t)?tr(t,sr(e,1,Ls,!0),Ji(n,2)):[]})),ko=Fr((function(t,e){var n=Bo(e);return Ls(n)&&(n=void 0),Ls(t)?tr(t,sr(e,1,Ls,!0),void 0,n):[]}));function Io(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ia(n);return i<0&&(i=an(r+i,0)),_e(t,Ji(e,3),i)}function Do(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=r-1;return void 0!==n&&(i=ia(n),i=n<0?an(r+i,0):cn(i,r-1)),_e(t,Ji(e,3),i,!0)}function No(t){return(null==t?0:t.length)?sr(t,1):[]}function jo(t){return t&&t.length?t[0]:void 0}var Lo=Fr((function(t){var e=de(t,si);return e.length&&e[0]===t[0]?yr(e):[]})),Uo=Fr((function(t){var e=Bo(t),n=de(t,si);return e===Bo(n)?e=void 0:n.pop(),n.length&&n[0]===t[0]?yr(n,Ji(e,2)):[]})),Fo=Fr((function(t){var e=Bo(t),n=de(t,si);return(e="function"==typeof e?e:void 0)&&n.pop(),n.length&&n[0]===t[0]?yr(n,void 0,e):[]}));function Bo(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}var Vo=Fr(Wo);function Wo(t,e){return t&&t.length&&e&&e.length?Nr(t,e):t}var qo=zi((function(t,e){var n=null==t?0:t.length,r=Xn(t,e);return jr(t,de(e,(function(t){return ao(t,n)?+t:t})).sort(vi)),r}));function Ho(t){return null==t?t:fn.call(t)}var zo=Fr((function(t){return Qr(sr(t,1,Ls,!0))})),Go=Fr((function(t){var e=Bo(t);return Ls(e)&&(e=void 0),Qr(sr(t,1,Ls,!0),Ji(e,2))})),Yo=Fr((function(t){var e=Bo(t);return e="function"==typeof e?e:void 0,Qr(sr(t,1,Ls,!0),void 0,e)}));function $o(t){if(!t||!t.length)return[];var e=0;return t=he(t,(function(t){if(Ls(t))return e=an(t.length,e),!0})),Oe(e,(function(e){return de(t,Ce(e))}))}function Xo(t,e){if(!t||!t.length)return[];var n=$o(t);return null==e?n:de(n,(function(t){return oe(e,void 0,t)}))}var Ko=Fr((function(t,e){return Ls(t)?tr(t,e):[]})),Jo=Fr((function(t){return ii(he(t,Ls))})),Zo=Fr((function(t){var e=Bo(t);return Ls(e)&&(e=void 0),ii(he(t,Ls),Ji(e,2))})),Qo=Fr((function(t){var e=Bo(t);return e="function"==typeof e?e:void 0,ii(he(t,Ls),void 0,e)})),ts=Fr($o);var es=Fr((function(t){var e=t.length,n=e>1?t[e-1]:void 0;return n="function"==typeof n?(t.pop(),n):void 0,Xo(t,n)}));function ns(t){var e=On(t);return e.__chain__=!0,e}function rs(t,e){return e(t)}var is=zi((function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,i=function(e){return Xn(e,t)};return!(e>1||this.__actions__.length)&&r instanceof In&&ao(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:rs,args:[i],thisArg:void 0}),new kn(r,this.__chain__).thru((function(t){return e&&!t.length&&t.push(void 0),t}))):this.thru(i)}));var os=_i((function(t,e,n){xt.call(t,n)?++t[n]:$n(t,n,1)}));var ss=Ri(Io),as=Ri(Do);function cs(t,e){return(Ds(t)?ae:er)(t,Ji(e,3))}function us(t,e){return(Ds(t)?ce:nr)(t,Ji(e,3))}var hs=_i((function(t,e,n){xt.call(t,n)?t[n].push(e):$n(t,n,[e])}));var ls=Fr((function(t,e,n){var i=-1,o="function"==typeof e,s=js(t)?r(t.length):[];return er(t,(function(t){s[++i]=o?oe(e,t,n):br(t,e,n)})),s})),fs=_i((function(t,e,n){$n(t,n,e)}));function ds(t,e){return(Ds(t)?de:Mr)(t,Ji(e,3))}var ps=_i((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));var vs=Fr((function(t,e){if(null==t)return[];var n=e.length;return n>1&&co(t,e[0],e[1])?e=[]:n>2&&co(e[0],e[1],e[2])&&(e=[e[0]]),Ir(t,sr(e,1),[])})),gs=Je||function(){return Yt.Date.now()};function ms(t,e,n){return e=n?void 0:e,Bi(t,128,void 0,void 0,void 0,void 0,e=t&&null==e?t.length:e)}function ys(t,e){var n;if("function"!=typeof e)throw new mt(o);return t=ia(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=void 0),n}}var bs=Fr((function(t,e,n){var r=1;if(n.length){var i=qe(n,Ki(bs));r|=32}return Bi(t,r,e,n,i)})),_s=Fr((function(t,e,n){var r=3;if(n.length){var i=qe(n,Ki(_s));r|=32}return Bi(e,r,t,n,i)}));function ws(t,e,n){var r,i,s,a,c,u,h=0,l=!1,f=!1,d=!0;if("function"!=typeof t)throw new mt(o);function p(e){var n=r,o=i;return r=i=void 0,h=e,a=t.apply(o,n)}function v(t){return h=t,c=wo(m,e),l?p(t):a}function g(t){var n=t-u;return void 0===u||n>=e||n<0||f&&t-h>=s}function m(){var t=gs();if(g(t))return y(t);c=wo(m,function(t){var n=e-(t-u);return f?cn(n,s-(t-h)):n}(t))}function y(t){return c=void 0,d&&r?p(t):(r=i=void 0,a)}function b(){var t=gs(),n=g(t);if(r=arguments,i=this,u=t,n){if(void 0===c)return v(u);if(f)return li(c),c=wo(m,e),p(u)}return void 0===c&&(c=wo(m,e)),a}return e=sa(e)||0,Hs(n)&&(l=!!n.leading,s=(f="maxWait"in n)?an(sa(n.maxWait)||0,e):s,d="trailing"in n?!!n.trailing:d),b.cancel=function(){void 0!==c&&li(c),h=0,r=u=i=c=void 0},b.flush=function(){return void 0===c?a:y(gs())},b}var Ss=Fr((function(t,e){return Qn(t,1,e)})),xs=Fr((function(t,e,n){return Qn(t,sa(e)||0,n)}));function Ts(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new mt(o);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Ts.Cache||jn),n}function Cs(t){if("function"!=typeof t)throw new mt(o);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Ts.Cache=jn;var Es=ui((function(t,e){var n=(e=1==e.length&&Ds(e[0])?de(e[0],Pe(Ji())):de(sr(e,1),Pe(Ji()))).length;return Fr((function(r){for(var i=-1,o=cn(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return oe(t,this,r)}))})),Rs=Fr((function(t,e){return Bi(t,32,void 0,e,qe(e,Ki(Rs)))})),Ms=Fr((function(t,e){return Bi(t,64,void 0,e,qe(e,Ki(Ms)))})),Os=zi((function(t,e){return Bi(t,256,void 0,void 0,void 0,e)}));function As(t,e){return t===e||t!=t&&e!=e}var Ps=Ni(vr),ks=Ni((function(t,e){return t>=e})),Is=_r(function(){return arguments}())?_r:function(t){return zs(t)&&xt.call(t,"callee")&&!Gt.call(t,"callee")},Ds=r.isArray,Ns=Qt?Pe(Qt):function(t){return zs(t)&&pr(t)==x};function js(t){return null!=t&&qs(t.length)&&!Vs(t)}function Ls(t){return zs(t)&&js(t)}var Us=nn||sc,Fs=te?Pe(te):function(t){return zs(t)&&pr(t)==l};function Bs(t){if(!zs(t))return!1;var e=pr(t);return e==f||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!$s(t)}function Vs(t){if(!Hs(t))return!1;var e=pr(t);return e==d||e==p||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Ws(t){return"number"==typeof t&&t==ia(t)}function qs(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function Hs(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function zs(t){return null!=t&&"object"==typeof t}var Gs=ee?Pe(ee):function(t){return zs(t)&&ro(t)==v};function Ys(t){return"number"==typeof t||zs(t)&&pr(t)==g}function $s(t){if(!zs(t)||pr(t)!=m)return!1;var e=Wt(t);if(null===e)return!0;var n=xt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&St.call(n)==Rt}var Xs=ne?Pe(ne):function(t){return zs(t)&&pr(t)==y};var Ks=re?Pe(re):function(t){return zs(t)&&ro(t)==b};function Js(t){return"string"==typeof t||!Ds(t)&&zs(t)&&pr(t)==_}function Zs(t){return"symbol"==typeof t||zs(t)&&pr(t)==w}var Qs=ie?Pe(ie):function(t){return zs(t)&&qs(t.length)&&!!Bt[pr(t)]};var ta=Ni(Rr),ea=Ni((function(t,e){return t<=e}));function na(t){if(!t)return[];if(js(t))return Js(t)?Ye(t):yi(t);if(Jt&&t[Jt])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[Jt]());var e=ro(t);return(e==v?Ve:e==b?He:Aa)(t)}function ra(t){return t?(t=sa(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function ia(t){var e=ra(t),n=e%1;return e==e?n?e-n:e:0}function oa(t){return t?Kn(ia(t),0,4294967295):0}function sa(t){if("number"==typeof t)return t;if(Zs(t))return NaN;if(Hs(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Hs(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ae(t);var n=ot.test(t);return n||at.test(t)?Ht(t.slice(2),n?2:8):it.test(t)?NaN:+t}function aa(t){return bi(t,Sa(t))}function ca(t){return null==t?"":Zr(t)}var ua=wi((function(t,e){if(fo(e)||js(e))bi(e,wa(e),t);else for(var n in e)xt.call(e,n)&&Hn(t,n,e[n])})),ha=wi((function(t,e){bi(e,Sa(e),t)})),la=wi((function(t,e,n,r){bi(e,Sa(e),t,r)})),fa=wi((function(t,e,n,r){bi(e,wa(e),t,r)})),da=zi(Xn);var pa=Fr((function(t,e){t=pt(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&co(e[0],e[1],i)&&(r=1);++n<r;)for(var o=e[n],s=Sa(o),a=-1,c=s.length;++a<c;){var u=s[a],h=t[u];(void 0===h||As(h,_t[u])&&!xt.call(t,u))&&(t[u]=o[u])}return t})),va=Fr((function(t){return t.push(void 0,Wi),oe(Ta,void 0,t)}));function ga(t,e,n){var r=null==t?void 0:fr(t,e);return void 0===r?n:r}function ma(t,e){return null!=t&&io(t,e,mr)}var ya=Ai((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Et.call(e)),t[e]=n}),Ha(Ya)),ba=Ai((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Et.call(e)),xt.call(t,e)?t[e].push(n):t[e]=[n]}),Ji),_a=Fr(br);function wa(t){return js(t)?Fn(t):Cr(t)}function Sa(t){return js(t)?Fn(t,!0):Er(t)}var xa=wi((function(t,e,n){Pr(t,e,n)})),Ta=wi((function(t,e,n,r){Pr(t,e,n,r)})),Ca=zi((function(t,e){var n={};if(null==t)return n;var r=!1;e=de(e,(function(e){return e=ci(e,t),r||(r=e.length>1),e})),bi(t,Yi(t),n),r&&(n=Jn(n,7,qi));for(var i=e.length;i--;)ti(n,e[i]);return n}));var Ea=zi((function(t,e){return null==t?{}:function(t,e){return Dr(t,e,(function(e,n){return ma(t,n)}))}(t,e)}));function Ra(t,e){if(null==t)return{};var n=de(Yi(t),(function(t){return[t]}));return e=Ji(e),Dr(t,n,(function(t,n){return e(t,n[0])}))}var Ma=Fi(wa),Oa=Fi(Sa);function Aa(t){return null==t?[]:ke(t,wa(t))}var Pa=Ci((function(t,e,n){return e=e.toLowerCase(),t+(n?ka(e):e)}));function ka(t){return Ba(ca(t).toLowerCase())}function Ia(t){return(t=ca(t))&&t.replace(ut,Le).replace(It,"")}var Da=Ci((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),Na=Ci((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),ja=Ti("toLowerCase");var La=Ci((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));var Ua=Ci((function(t,e,n){return t+(n?" ":"")+Ba(e)}));var Fa=Ci((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Ba=Ti("toUpperCase");function Va(t,e,n){return t=ca(t),void 0===(e=n?void 0:e)?function(t){return Lt.test(t)}(t)?function(t){return t.match(Nt)||[]}(t):function(t){return t.match(Q)||[]}(t):t.match(e)||[]}var Wa=Fr((function(t,e){try{return oe(t,void 0,e)}catch(t){return Bs(t)?t:new X(t)}})),qa=zi((function(t,e){return ae(e,(function(e){e=Ro(e),$n(t,e,bs(t[e],t))})),t}));function Ha(t){return function(){return t}}var za=Mi(),Ga=Mi(!0);function Ya(t){return t}function $a(t){return Tr("function"==typeof t?t:Jn(t,1))}var Xa=Fr((function(t,e){return function(n){return br(n,t,e)}})),Ka=Fr((function(t,e){return function(n){return br(t,n,e)}}));function Ja(t,e,n){var r=wa(e),i=lr(e,r);null!=n||Hs(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=lr(e,wa(e)));var o=!(Hs(n)&&"chain"in n&&!n.chain),s=Vs(t);return ae(i,(function(n){var r=e[n];t[n]=r,s&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__),i=n.__actions__=yi(this.__actions__);return i.push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,pe([this.value()],arguments))})})),t}function Za(){}var Qa=ki(de),tc=ki(ue),ec=ki(me);function nc(t){return uo(t)?Ce(Ro(t)):function(t){return function(e){return fr(e,t)}}(t)}var rc=Di(),ic=Di(!0);function oc(){return[]}function sc(){return!1}var ac=Pi((function(t,e){return t+e}),0),cc=Li("ceil"),uc=Pi((function(t,e){return t/e}),1),hc=Li("floor");var lc,fc=Pi((function(t,e){return t*e}),1),dc=Li("round"),pc=Pi((function(t,e){return t-e}),0);return On.after=function(t,e){if("function"!=typeof e)throw new mt(o);return t=ia(t),function(){if(--t<1)return e.apply(this,arguments)}},On.ary=ms,On.assign=ua,On.assignIn=ha,On.assignInWith=la,On.assignWith=fa,On.at=da,On.before=ys,On.bind=bs,On.bindAll=qa,On.bindKey=_s,On.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Ds(t)?t:[t]},On.chain=ns,On.chunk=function(t,e,n){e=(n?co(t,e,n):void 0===e)?1:an(ia(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var o=0,s=0,a=r(Qe(i/e));o<i;)a[s++]=Gr(t,o,o+=e);return a},On.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i},On.concat=function(){var t=arguments.length;if(!t)return[];for(var e=r(t-1),n=arguments[0],i=t;i--;)e[i-1]=arguments[i];return pe(Ds(n)?yi(n):[n],sr(e,1))},On.cond=function(t){var e=null==t?0:t.length,n=Ji();return t=e?de(t,(function(t){if("function"!=typeof t[1])throw new mt(o);return[n(t[0]),t[1]]})):[],Fr((function(n){for(var r=-1;++r<e;){var i=t[r];if(oe(i[0],this,n))return oe(i[1],this,n)}}))},On.conforms=function(t){return function(t){var e=wa(t);return function(n){return Zn(n,t,e)}}(Jn(t,1))},On.constant=Ha,On.countBy=os,On.create=function(t,e){var n=An(t);return null==e?n:Yn(n,e)},On.curry=function t(e,n,r){var i=Bi(e,8,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=t.placeholder,i},On.curryRight=function t(e,n,r){var i=Bi(e,16,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=t.placeholder,i},On.debounce=ws,On.defaults=pa,On.defaultsDeep=va,On.defer=Ss,On.delay=xs,On.difference=Ao,On.differenceBy=Po,On.differenceWith=ko,On.drop=function(t,e,n){var r=null==t?0:t.length;return r?Gr(t,(e=n||void 0===e?1:ia(e))<0?0:e,r):[]},On.dropRight=function(t,e,n){var r=null==t?0:t.length;return r?Gr(t,0,(e=r-(e=n||void 0===e?1:ia(e)))<0?0:e):[]},On.dropRightWhile=function(t,e){return t&&t.length?ni(t,Ji(e,3),!0,!0):[]},On.dropWhile=function(t,e){return t&&t.length?ni(t,Ji(e,3),!0):[]},On.fill=function(t,e,n,r){var i=null==t?0:t.length;return i?(n&&"number"!=typeof n&&co(t,e,n)&&(n=0,r=i),function(t,e,n,r){var i=t.length;for((n=ia(n))<0&&(n=-n>i?0:i+n),(r=void 0===r||r>i?i:ia(r))<0&&(r+=i),r=n>r?0:oa(r);n<r;)t[n++]=e;return t}(t,e,n,r)):[]},On.filter=function(t,e){return(Ds(t)?he:or)(t,Ji(e,3))},On.flatMap=function(t,e){return sr(ds(t,e),1)},On.flatMapDeep=function(t,e){return sr(ds(t,e),1/0)},On.flatMapDepth=function(t,e,n){return n=void 0===n?1:ia(n),sr(ds(t,e),n)},On.flatten=No,On.flattenDeep=function(t){return(null==t?0:t.length)?sr(t,1/0):[]},On.flattenDepth=function(t,e){return(null==t?0:t.length)?sr(t,e=void 0===e?1:ia(e)):[]},On.flip=function(t){return Bi(t,512)},On.flow=za,On.flowRight=Ga,On.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},On.functions=function(t){return null==t?[]:lr(t,wa(t))},On.functionsIn=function(t){return null==t?[]:lr(t,Sa(t))},On.groupBy=hs,On.initial=function(t){return(null==t?0:t.length)?Gr(t,0,-1):[]},On.intersection=Lo,On.intersectionBy=Uo,On.intersectionWith=Fo,On.invert=ya,On.invertBy=ba,On.invokeMap=ls,On.iteratee=$a,On.keyBy=fs,On.keys=wa,On.keysIn=Sa,On.map=ds,On.mapKeys=function(t,e){var n={};return e=Ji(e,3),ur(t,(function(t,r,i){$n(n,e(t,r,i),t)})),n},On.mapValues=function(t,e){var n={};return e=Ji(e,3),ur(t,(function(t,r,i){$n(n,r,e(t,r,i))})),n},On.matches=function(t){return Or(Jn(t,1))},On.matchesProperty=function(t,e){return Ar(t,Jn(e,1))},On.memoize=Ts,On.merge=xa,On.mergeWith=Ta,On.method=Xa,On.methodOf=Ka,On.mixin=Ja,On.negate=Cs,On.nthArg=function(t){return t=ia(t),Fr((function(e){return kr(e,t)}))},On.omit=Ca,On.omitBy=function(t,e){return Ra(t,Cs(Ji(e)))},On.once=function(t){return ys(2,t)},On.orderBy=function(t,e,n,r){return null==t?[]:(Ds(e)||(e=null==e?[]:[e]),Ds(n=r?void 0:n)||(n=null==n?[]:[n]),Ir(t,e,n))},On.over=Qa,On.overArgs=Es,On.overEvery=tc,On.overSome=ec,On.partial=Rs,On.partialRight=Ms,On.partition=ps,On.pick=Ea,On.pickBy=Ra,On.property=nc,On.propertyOf=function(t){return function(e){return null==t?void 0:fr(t,e)}},On.pull=Vo,On.pullAll=Wo,On.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Nr(t,e,Ji(n,2)):t},On.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?Nr(t,e,void 0,n):t},On.pullAt=qo,On.range=rc,On.rangeRight=ic,On.rearg=Os,On.reject=function(t,e){return(Ds(t)?he:or)(t,Cs(Ji(e,3)))},On.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=Ji(e,3);++r<o;){var s=t[r];e(s,r,t)&&(n.push(s),i.push(r))}return jr(t,i),n},On.rest=function(t,e){if("function"!=typeof t)throw new mt(o);return Fr(t,e=void 0===e?e:ia(e))},On.reverse=Ho,On.sampleSize=function(t,e,n){return e=(n?co(t,e,n):void 0===e)?1:ia(e),(Ds(t)?Vn:Vr)(t,e)},On.set=function(t,e,n){return null==t?t:Wr(t,e,n)},On.setWith=function(t,e,n,r){return r="function"==typeof r?r:void 0,null==t?t:Wr(t,e,n,r)},On.shuffle=function(t){return(Ds(t)?Wn:zr)(t)},On.slice=function(t,e,n){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&co(t,e,n)?(e=0,n=r):(e=null==e?0:ia(e),n=void 0===n?r:ia(n)),Gr(t,e,n)):[]},On.sortBy=vs,On.sortedUniq=function(t){return t&&t.length?Kr(t):[]},On.sortedUniqBy=function(t,e){return t&&t.length?Kr(t,Ji(e,2)):[]},On.split=function(t,e,n){return n&&"number"!=typeof n&&co(t,e,n)&&(e=n=void 0),(n=void 0===n?4294967295:n>>>0)?(t=ca(t))&&("string"==typeof e||null!=e&&!Xs(e))&&!(e=Zr(e))&&Be(t)?hi(Ye(t),0,n):t.split(e,n):[]},On.spread=function(t,e){if("function"!=typeof t)throw new mt(o);return e=null==e?0:an(ia(e),0),Fr((function(n){var r=n[e],i=hi(n,0,e);return r&&pe(i,r),oe(t,this,i)}))},On.tail=function(t){var e=null==t?0:t.length;return e?Gr(t,1,e):[]},On.take=function(t,e,n){return t&&t.length?Gr(t,0,(e=n||void 0===e?1:ia(e))<0?0:e):[]},On.takeRight=function(t,e,n){var r=null==t?0:t.length;return r?Gr(t,(e=r-(e=n||void 0===e?1:ia(e)))<0?0:e,r):[]},On.takeRightWhile=function(t,e){return t&&t.length?ni(t,Ji(e,3),!1,!0):[]},On.takeWhile=function(t,e){return t&&t.length?ni(t,Ji(e,3)):[]},On.tap=function(t,e){return e(t),t},On.throttle=function(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new mt(o);return Hs(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),ws(t,e,{leading:r,maxWait:e,trailing:i})},On.thru=rs,On.toArray=na,On.toPairs=Ma,On.toPairsIn=Oa,On.toPath=function(t){return Ds(t)?de(t,Ro):Zs(t)?[t]:yi(Eo(ca(t)))},On.toPlainObject=aa,On.transform=function(t,e,n){var r=Ds(t),i=r||Us(t)||Qs(t);if(e=Ji(e,4),null==n){var o=t&&t.constructor;n=i?r?new o:[]:Hs(t)&&Vs(o)?An(Wt(t)):{}}return(i?ae:ur)(t,(function(t,r,i){return e(n,t,r,i)})),n},On.unary=function(t){return ms(t,1)},On.union=zo,On.unionBy=Go,On.unionWith=Yo,On.uniq=function(t){return t&&t.length?Qr(t):[]},On.uniqBy=function(t,e){return t&&t.length?Qr(t,Ji(e,2)):[]},On.uniqWith=function(t,e){return e="function"==typeof e?e:void 0,t&&t.length?Qr(t,void 0,e):[]},On.unset=function(t,e){return null==t||ti(t,e)},On.unzip=$o,On.unzipWith=Xo,On.update=function(t,e,n){return null==t?t:ei(t,e,ai(n))},On.updateWith=function(t,e,n,r){return r="function"==typeof r?r:void 0,null==t?t:ei(t,e,ai(n),r)},On.values=Aa,On.valuesIn=function(t){return null==t?[]:ke(t,Sa(t))},On.without=Ko,On.words=Va,On.wrap=function(t,e){return Rs(ai(e),t)},On.xor=Jo,On.xorBy=Zo,On.xorWith=Qo,On.zip=ts,On.zipObject=function(t,e){return oi(t||[],e||[],Hn)},On.zipObjectDeep=function(t,e){return oi(t||[],e||[],Wr)},On.zipWith=es,On.entries=Ma,On.entriesIn=Oa,On.extend=ha,On.extendWith=la,Ja(On,On),On.add=ac,On.attempt=Wa,On.camelCase=Pa,On.capitalize=ka,On.ceil=cc,On.clamp=function(t,e,n){return void 0===n&&(n=e,e=void 0),void 0!==n&&(n=(n=sa(n))==n?n:0),void 0!==e&&(e=(e=sa(e))==e?e:0),Kn(sa(t),e,n)},On.clone=function(t){return Jn(t,4)},On.cloneDeep=function(t){return Jn(t,5)},On.cloneDeepWith=function(t,e){return Jn(t,5,e="function"==typeof e?e:void 0)},On.cloneWith=function(t,e){return Jn(t,4,e="function"==typeof e?e:void 0)},On.conformsTo=function(t,e){return null==e||Zn(t,e,wa(e))},On.deburr=Ia,On.defaultTo=function(t,e){return null==t||t!=t?e:t},On.divide=uc,On.endsWith=function(t,e,n){t=ca(t),e=Zr(e);var r=t.length,i=n=void 0===n?r:Kn(ia(n),0,r);return(n-=e.length)>=0&&t.slice(n,i)==e},On.eq=As,On.escape=function(t){return(t=ca(t))&&F.test(t)?t.replace(L,Ue):t},On.escapeRegExp=function(t){return(t=ca(t))&&Y.test(t)?t.replace(G,"\\$&"):t},On.every=function(t,e,n){var r=Ds(t)?ue:rr;return n&&co(t,e,n)&&(e=void 0),r(t,Ji(e,3))},On.find=ss,On.findIndex=Io,On.findKey=function(t,e){return be(t,Ji(e,3),ur)},On.findLast=as,On.findLastIndex=Do,On.findLastKey=function(t,e){return be(t,Ji(e,3),hr)},On.floor=hc,On.forEach=cs,On.forEachRight=us,On.forIn=function(t,e){return null==t?t:ar(t,Ji(e,3),Sa)},On.forInRight=function(t,e){return null==t?t:cr(t,Ji(e,3),Sa)},On.forOwn=function(t,e){return t&&ur(t,Ji(e,3))},On.forOwnRight=function(t,e){return t&&hr(t,Ji(e,3))},On.get=ga,On.gt=Ps,On.gte=ks,On.has=function(t,e){return null!=t&&io(t,e,gr)},On.hasIn=ma,On.head=jo,On.identity=Ya,On.includes=function(t,e,n,r){t=js(t)?t:Aa(t),n=n&&!r?ia(n):0;var i=t.length;return n<0&&(n=an(i+n,0)),Js(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&we(t,e,n)>-1},On.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ia(n);return i<0&&(i=an(r+i,0)),we(t,e,i)},On.inRange=function(t,e,n){return e=ra(e),void 0===n?(n=e,e=0):n=ra(n),function(t,e,n){return t>=cn(e,n)&&t<an(e,n)}(t=sa(t),e,n)},On.invoke=_a,On.isArguments=Is,On.isArray=Ds,On.isArrayBuffer=Ns,On.isArrayLike=js,On.isArrayLikeObject=Ls,On.isBoolean=function(t){return!0===t||!1===t||zs(t)&&pr(t)==h},On.isBuffer=Us,On.isDate=Fs,On.isElement=function(t){return zs(t)&&1===t.nodeType&&!$s(t)},On.isEmpty=function(t){if(null==t)return!0;if(js(t)&&(Ds(t)||"string"==typeof t||"function"==typeof t.splice||Us(t)||Qs(t)||Is(t)))return!t.length;var e=ro(t);if(e==v||e==b)return!t.size;if(fo(t))return!Cr(t).length;for(var n in t)if(xt.call(t,n))return!1;return!0},On.isEqual=function(t,e){return wr(t,e)},On.isEqualWith=function(t,e,n){var r=(n="function"==typeof n?n:void 0)?n(t,e):void 0;return void 0===r?wr(t,e,void 0,n):!!r},On.isError=Bs,On.isFinite=function(t){return"number"==typeof t&&rn(t)},On.isFunction=Vs,On.isInteger=Ws,On.isLength=qs,On.isMap=Gs,On.isMatch=function(t,e){return t===e||Sr(t,e,Qi(e))},On.isMatchWith=function(t,e,n){return n="function"==typeof n?n:void 0,Sr(t,e,Qi(e),n)},On.isNaN=function(t){return Ys(t)&&t!=+t},On.isNative=function(t){if(lo(t))throw new X("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return xr(t)},On.isNil=function(t){return null==t},On.isNull=function(t){return null===t},On.isNumber=Ys,On.isObject=Hs,On.isObjectLike=zs,On.isPlainObject=$s,On.isRegExp=Xs,On.isSafeInteger=function(t){return Ws(t)&&t>=-9007199254740991&&t<=9007199254740991},On.isSet=Ks,On.isString=Js,On.isSymbol=Zs,On.isTypedArray=Qs,On.isUndefined=function(t){return void 0===t},On.isWeakMap=function(t){return zs(t)&&ro(t)==S},On.isWeakSet=function(t){return zs(t)&&"[object WeakSet]"==pr(t)},On.join=function(t,e){return null==t?"":on.call(t,e)},On.kebabCase=Da,On.last=Bo,On.lastIndexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=r;return void 0!==n&&(i=(i=ia(n))<0?an(r+i,0):cn(i,r-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,i):_e(t,xe,i,!0)},On.lowerCase=Na,On.lowerFirst=ja,On.lt=ta,On.lte=ea,On.max=function(t){return t&&t.length?ir(t,Ya,vr):void 0},On.maxBy=function(t,e){return t&&t.length?ir(t,Ji(e,2),vr):void 0},On.mean=function(t){return Te(t,Ya)},On.meanBy=function(t,e){return Te(t,Ji(e,2))},On.min=function(t){return t&&t.length?ir(t,Ya,Rr):void 0},On.minBy=function(t,e){return t&&t.length?ir(t,Ji(e,2),Rr):void 0},On.stubArray=oc,On.stubFalse=sc,On.stubObject=function(){return{}},On.stubString=function(){return""},On.stubTrue=function(){return!0},On.multiply=fc,On.nth=function(t,e){return t&&t.length?kr(t,ia(e)):void 0},On.noConflict=function(){return Yt._===this&&(Yt._=Mt),this},On.noop=Za,On.now=gs,On.pad=function(t,e,n){t=ca(t);var r=(e=ia(e))?Ge(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Ii(tn(i),n)+t+Ii(Qe(i),n)},On.padEnd=function(t,e,n){t=ca(t);var r=(e=ia(e))?Ge(t):0;return e&&r<e?t+Ii(e-r,n):t},On.padStart=function(t,e,n){t=ca(t);var r=(e=ia(e))?Ge(t):0;return e&&r<e?Ii(e-r,n)+t:t},On.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),hn(ca(t).replace($,""),e||0)},On.random=function(t,e,n){if(n&&"boolean"!=typeof n&&co(t,e,n)&&(e=n=void 0),void 0===n&&("boolean"==typeof e?(n=e,e=void 0):"boolean"==typeof t&&(n=t,t=void 0)),void 0===t&&void 0===e?(t=0,e=1):(t=ra(t),void 0===e?(e=t,t=0):e=ra(e)),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var i=ln();return cn(t+i*(e-t+qt("1e-"+((i+"").length-1))),e)}return Lr(t,e)},On.reduce=function(t,e,n){var r=Ds(t)?ve:Re,i=arguments.length<3;return r(t,Ji(e,4),n,i,er)},On.reduceRight=function(t,e,n){var r=Ds(t)?ge:Re,i=arguments.length<3;return r(t,Ji(e,4),n,i,nr)},On.repeat=function(t,e,n){return e=(n?co(t,e,n):void 0===e)?1:ia(e),Ur(ca(t),e)},On.replace=function(){var t=arguments,e=ca(t[0]);return t.length<3?e:e.replace(t[1],t[2])},On.result=function(t,e,n){var r=-1,i=(e=ci(e,t)).length;for(i||(i=1,t=void 0);++r<i;){var o=null==t?void 0:t[Ro(e[r])];void 0===o&&(r=i,o=n),t=Vs(o)?o.call(t):o}return t},On.round=dc,On.runInContext=t,On.sample=function(t){return(Ds(t)?Bn:Br)(t)},On.size=function(t){if(null==t)return 0;if(js(t))return Js(t)?Ge(t):t.length;var e=ro(t);return e==v||e==b?t.size:Cr(t).length},On.snakeCase=La,On.some=function(t,e,n){var r=Ds(t)?me:Yr;return n&&co(t,e,n)&&(e=void 0),r(t,Ji(e,3))},On.sortedIndex=function(t,e){return $r(t,e)},On.sortedIndexBy=function(t,e,n){return Xr(t,e,Ji(n,2))},On.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=$r(t,e);if(r<n&&As(t[r],e))return r}return-1},On.sortedLastIndex=function(t,e){return $r(t,e,!0)},On.sortedLastIndexBy=function(t,e,n){return Xr(t,e,Ji(n,2),!0)},On.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var n=$r(t,e,!0)-1;if(As(t[n],e))return n}return-1},On.startCase=Ua,On.startsWith=function(t,e,n){return t=ca(t),n=null==n?0:Kn(ia(n),0,t.length),e=Zr(e),t.slice(n,n+e.length)==e},On.subtract=pc,On.sum=function(t){return t&&t.length?Me(t,Ya):0},On.sumBy=function(t,e){return t&&t.length?Me(t,Ji(e,2)):0},On.template=function(t,e,n){var r=On.templateSettings;n&&co(t,e,n)&&(e=void 0),t=ca(t),e=la({},e,r,Vi);var i,o,s=la({},e.imports,r.imports,Vi),a=wa(s),c=ke(s,a),u=0,h=e.interpolate||ht,l="__p += '",f=vt((e.escape||ht).source+"|"+h.source+"|"+(h===W?nt:ht).source+"|"+(e.evaluate||ht).source+"|$","g"),d="//# sourceURL="+(xt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ft+"]")+"\n";t.replace(f,(function(e,n,r,s,a,c){return r||(r=s),l+=t.slice(u,c).replace(lt,Fe),n&&(i=!0,l+="' +\n__e("+n+") +\n'"),a&&(o=!0,l+="';\n"+a+";\n__p += '"),r&&(l+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=c+e.length,e})),l+="';\n";var p=xt.call(e,"variable")&&e.variable;if(p){if(tt.test(p))throw new X("Invalid `variable` option passed into `_.template`")}else l="with (obj) {\n"+l+"\n}\n";l=(o?l.replace(I,""):l).replace(D,"$1").replace(N,"$1;"),l="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+l+"return __p\n}";var v=Wa((function(){return ft(a,d+"return "+l).apply(void 0,c)}));if(v.source=l,Bs(v))throw v;return v},On.times=function(t,e){if((t=ia(t))<1||t>9007199254740991)return[];var n=4294967295,r=cn(t,4294967295);t-=4294967295;for(var i=Oe(r,e=Ji(e));++n<t;)e(n);return i},On.toFinite=ra,On.toInteger=ia,On.toLength=oa,On.toLower=function(t){return ca(t).toLowerCase()},On.toNumber=sa,On.toSafeInteger=function(t){return t?Kn(ia(t),-9007199254740991,9007199254740991):0===t?t:0},On.toString=ca,On.toUpper=function(t){return ca(t).toUpperCase()},On.trim=function(t,e,n){if((t=ca(t))&&(n||void 0===e))return Ae(t);if(!t||!(e=Zr(e)))return t;var r=Ye(t),i=Ye(e);return hi(r,De(r,i),Ne(r,i)+1).join("")},On.trimEnd=function(t,e,n){if((t=ca(t))&&(n||void 0===e))return t.slice(0,$e(t)+1);if(!t||!(e=Zr(e)))return t;var r=Ye(t);return hi(r,0,Ne(r,Ye(e))+1).join("")},On.trimStart=function(t,e,n){if((t=ca(t))&&(n||void 0===e))return t.replace($,"");if(!t||!(e=Zr(e)))return t;var r=Ye(t);return hi(r,De(r,Ye(e))).join("")},On.truncate=function(t,e){var n=30,r="...";if(Hs(e)){var i="separator"in e?e.separator:i;n="length"in e?ia(e.length):n,r="omission"in e?Zr(e.omission):r}var o=(t=ca(t)).length;if(Be(t)){var s=Ye(t);o=s.length}if(n>=o)return t;var a=n-Ge(r);if(a<1)return r;var c=s?hi(s,0,a).join(""):t.slice(0,a);if(void 0===i)return c+r;if(s&&(a+=c.length-a),Xs(i)){if(t.slice(a).search(i)){var u,h=c;for(i.global||(i=vt(i.source,ca(rt.exec(i))+"g")),i.lastIndex=0;u=i.exec(h);)var l=u.index;c=c.slice(0,void 0===l?a:l)}}else if(t.indexOf(Zr(i),a)!=a){var f=c.lastIndexOf(i);f>-1&&(c=c.slice(0,f))}return c+r},On.unescape=function(t){return(t=ca(t))&&U.test(t)?t.replace(j,Xe):t},On.uniqueId=function(t){var e=++Tt;return ca(t)+e},On.upperCase=Fa,On.upperFirst=Ba,On.each=cs,On.eachRight=us,On.first=jo,Ja(On,(lc={},ur(On,(function(t,e){xt.call(On.prototype,e)||(lc[e]=t)})),lc),{chain:!1}),On.VERSION="4.17.21",ae(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){On[t].placeholder=On})),ae(["drop","take"],(function(t,e){In.prototype[t]=function(n){n=void 0===n?1:an(ia(n),0);var r=this.__filtered__&&!e?new In(this):this.clone();return r.__filtered__?r.__takeCount__=cn(n,r.__takeCount__):r.__views__.push({size:cn(n,4294967295),type:t+(r.__dir__<0?"Right":"")}),r},In.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),ae(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;In.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Ji(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}})),ae(["head","last"],(function(t,e){var n="take"+(e?"Right":"");In.prototype[t]=function(){return this[n](1).value()[0]}})),ae(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");In.prototype[t]=function(){return this.__filtered__?new In(this):this[n](1)}})),In.prototype.compact=function(){return this.filter(Ya)},In.prototype.find=function(t){return this.filter(t).head()},In.prototype.findLast=function(t){return this.reverse().find(t)},In.prototype.invokeMap=Fr((function(t,e){return"function"==typeof t?new In(this):this.map((function(n){return br(n,t,e)}))})),In.prototype.reject=function(t){return this.filter(Cs(Ji(t)))},In.prototype.slice=function(t,e){t=ia(t);var n=this;return n.__filtered__&&(t>0||e<0)?new In(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),void 0!==e&&(n=(e=ia(e))<0?n.dropRight(-e):n.take(e-t)),n)},In.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},In.prototype.toArray=function(){return this.take(4294967295)},ur(In.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),i=On[r?"take"+("last"==e?"Right":""):e],o=r||/^find/.test(e);i&&(On.prototype[e]=function(){var e=this.__wrapped__,s=r?[1]:arguments,a=e instanceof In,c=s[0],u=a||Ds(e),h=function(t){var e=i.apply(On,pe([t],s));return r&&l?e[0]:e};u&&n&&"function"==typeof c&&1!=c.length&&(a=u=!1);var l=this.__chain__,f=!!this.__actions__.length,d=o&&!l,p=a&&!f;if(!o&&u){e=p?e:new In(this);var v=t.apply(e,s);return v.__actions__.push({func:rs,args:[h],thisArg:void 0}),new kn(v,l)}return d&&p?t.apply(this,s):(v=this.thru(h),d?r?v.value()[0]:v.value():v)})})),ae(["pop","push","shift","sort","splice","unshift"],(function(t){var e=yt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);On.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(Ds(i)?i:[],t)}return this[n]((function(n){return e.apply(Ds(n)?n:[],t)}))}})),ur(In.prototype,(function(t,e){var n=On[e];if(n){var r=n.name+"";xt.call(_n,r)||(_n[r]=[]),_n[r].push({name:e,func:n})}})),_n[Oi(void 0,2).name]=[{name:"wrapper",func:void 0}],In.prototype.clone=function(){var t=new In(this.__wrapped__);return t.__actions__=yi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=yi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=yi(this.__views__),t},In.prototype.reverse=function(){if(this.__filtered__){var t=new In(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},In.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=Ds(t),r=e<0,i=n?t.length:0,o=function(t,e,n){var r=-1,i=n.length;for(;++r<i;){var o=n[r],s=o.size;switch(o.type){case"drop":t+=s;break;case"dropRight":e-=s;break;case"take":e=cn(e,t+s);break;case"takeRight":t=an(t,e-s)}}return{start:t,end:e}}(0,i,this.__views__),s=o.start,a=o.end,c=a-s,u=r?a:s-1,h=this.__iteratees__,l=h.length,f=0,d=cn(c,this.__takeCount__);if(!n||!r&&i==c&&d==c)return ri(t,this.__actions__);var p=[];t:for(;c--&&f<d;){for(var v=-1,g=t[u+=e];++v<l;){var m=h[v],y=m.iteratee,b=m.type,_=y(g);if(2==b)g=_;else if(!_){if(1==b)continue t;break t}}p[f++]=g}return p},On.prototype.at=is,On.prototype.chain=function(){return ns(this)},On.prototype.commit=function(){return new kn(this.value(),this.__chain__)},On.prototype.next=function(){void 0===this.__values__&&(this.__values__=na(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?void 0:this.__values__[this.__index__++]}},On.prototype.plant=function(t){for(var e,n=this;n instanceof Pn;){var r=Oo(n);r.__index__=0,r.__values__=void 0,e?i.__wrapped__=r:e=r;var i=r;n=n.__wrapped__}return i.__wrapped__=t,e},On.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof In){var e=t;return this.__actions__.length&&(e=new In(this)),(e=e.reverse()).__actions__.push({func:rs,args:[Ho],thisArg:void 0}),new kn(e,this.__chain__)}return this.thru(Ho)},On.prototype.toJSON=On.prototype.valueOf=On.prototype.value=function(){return ri(this.__wrapped__,this.__actions__)},On.prototype.first=On.prototype.head,Jt&&(On.prototype[Jt]=function(){return this}),On}();Yt._=Ke,void 0===(i=function(){return Ke}.call(e,n,e,r))||(r.exports=i)}).call(this)}).call(this,n(35),n(137)(t))},function(t,e,n){"use strict";n.d(e,"a",(function(){return u})),n.d(e,"b",(function(){return h}));var r=n(0),i=n(5),o=n(3),s=n(1),a=n(4),c=n(48),u=function(t){function e(e,n){var r=t.call(this)||this;return r.source=e,r.subjectFactory=n,r._refCount=0,r._isComplete=!1,r}return r.a(e,t),e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return t&&!t.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype.connect=function(){var t=this._connection;return t||(this._isComplete=!1,(t=this._connection=new a.a).add(this.source.subscribe(new l(this.getSubject(),this))),t.closed&&(this._connection=null,t=a.a.EMPTY)),t},e.prototype.refCount=function(){return Object(c.a)()(this)},e}(o.a),h=function(){var t=u.prototype;return{operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:t._subscribe},_isComplete:{value:t._isComplete,writable:!0},getSubject:{value:t.getSubject},connect:{value:t.connect},refCount:{value:t.refCount}}}(),l=function(t){function e(e,n){var r=t.call(this,e)||this;return r.connectable=n,r}return r.a(e,t),e.prototype._error=function(e){this._unsubscribe(),t.prototype._error.call(this,e)},e.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._connection;t._refCount=0,t._subject=null,t._connection=null,e&&e.unsubscribe()}},e}(i.b);s.a},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(0),i=n(5),o=n(21),s=function(t){function e(e){var n=t.call(this)||this;return n._value=e,n}return r.a(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),e.prototype._subscribe=function(e){var n=t.prototype._subscribe.call(this,e);return n&&!n.closed&&e.next(this._value),n},e.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new o.a;return this._value},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(i.a)},function(t,e,n){"use strict";n.d(e,"b",(function(){return s})),n.d(e,"a",(function(){return c}));var r=n(0),i=n(1),o=n(17);function s(t,e){return void 0===e&&(e=0),function(n){return n.lift(new a(t,e))}}var a=function(){function t(t,e){void 0===e&&(e=0),this.scheduler=t,this.delay=e}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.scheduler,this.delay))},t}(),c=function(t){function e(e,n,r){void 0===r&&(r=0);var i=t.call(this,e)||this;return i.scheduler=n,i.delay=r,i}return r.a(e,t),e.dispatch=function(t){var e=t.notification,n=t.destination;e.observe(n),this.unsubscribe()},e.prototype.scheduleMessage=function(t){this.destination.add(this.scheduler.schedule(e.dispatch,this.delay,new u(t,this.destination)))},e.prototype._next=function(t){this.scheduleMessage(o.a.createNext(t))},e.prototype._error=function(t){this.scheduleMessage(o.a.createError(t)),this.unsubscribe()},e.prototype._complete=function(){this.scheduleMessage(o.a.createComplete()),this.unsubscribe()},e}(i.a),u=function(){return function(t,e){this.notification=t,this.destination=e}}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){function t(){return Error.call(this),this.message="Timeout has occurred",this.name="TimeoutError",this}return t.prototype=Object.create(Error.prototype),t}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(52);function i(){return Object(r.a)(1)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return a}));var r=n(3),i=n(9),o=n(52),s=n(26);function a(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Number.POSITIVE_INFINITY,a=null,c=t[t.length-1];return Object(i.a)(c)?(a=t.pop(),t.length>1&&"number"==typeof t[t.length-1]&&(n=t.pop())):"number"==typeof c&&(n=t.pop()),null===a&&1===t.length&&t[0]instanceof r.a?t[0]:Object(o.a)(n)(Object(s.a)(t,a))}},function(t,e,n){"use strict";n.d(e,"a",(function(){return c}));var r=n(0),i=n(7),o=n(26),s=n(15),a=n(12);function c(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(1===t.length){if(!Object(i.a)(t[0]))return t[0];t=t[0]}return Object(o.a)(t,void 0).lift(new u)}var u=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new h(t))},t}(),h=function(t){function e(e){var n=t.call(this,e)||this;return n.hasFirst=!1,n.observables=[],n.subscriptions=[],n}return r.a(e,t),e.prototype._next=function(t){this.observables.push(t)},e.prototype._complete=function(){var t=this.observables,e=t.length;if(0===e)this.destination.complete();else{for(var n=0;n<e&&!this.hasFirst;n++){var r=t[n],i=Object(a.a)(this,r,void 0,n);this.subscriptions&&this.subscriptions.push(i),this.add(i)}this.observables=null}},e.prototype.notifyNext=function(t,e,n){if(!this.hasFirst){this.hasFirst=!0;for(var r=0;r<this.subscriptions.length;r++)if(r!==n){var i=this.subscriptions[r];i.unsubscribe(),this.remove(i)}this.subscriptions=null}this.destination.next(e)},e}(s.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return a}));var r=n(3),i=n(6),o=n(30),s=n(9);function a(t,e,n){void 0===t&&(t=0);var a=-1;return Object(o.a)(e)?a=Number(e)<1?1:Number(e):Object(s.a)(e)&&(n=e),Object(s.a)(n)||(n=i.a),new r.a((function(e){var r=Object(o.a)(t)?t:+t-n.now();return n.schedule(c,r,{index:0,period:a,subscriber:e})}))}function c(t){var e=t.index,n=t.period,r=t.subscriber;if(r.next(e),!r.closed){if(-1===n)return r.complete();t.index=e+1,this.schedule(t,n)}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(3),i=n(4),o=n(20);var s=n(57),a=n(18);var c=n(77),u=n(76);function h(t,e){if(null!=t){if(function(t){return t&&"function"==typeof t[o.a]}(t))return function(t,e){return new r.a((function(n){var r=new i.a;return r.add(e.schedule((function(){var i=t[o.a]();r.add(i.subscribe({next:function(t){r.add(e.schedule((function(){return n.next(t)})))},error:function(t){r.add(e.schedule((function(){return n.error(t)})))},complete:function(){r.add(e.schedule((function(){return n.complete()})))}}))}))),r}))}(t,e);if(Object(c.a)(t))return function(t,e){return new r.a((function(n){var r=new i.a;return r.add(e.schedule((function(){return t.then((function(t){r.add(e.schedule((function(){n.next(t),r.add(e.schedule((function(){return n.complete()})))})))}),(function(t){r.add(e.schedule((function(){return n.error(t)})))}))}))),r}))}(t,e);if(Object(u.a)(t))return Object(s.a)(t,e);if(function(t){return t&&"function"==typeof t[a.a]}(t)||"string"==typeof t)return function(t,e){if(!t)throw new Error("Iterable cannot be null");return new r.a((function(n){var r,o=new i.a;return o.add((function(){r&&"function"==typeof r.return&&r.return()})),o.add(e.schedule((function(){r=t[a.a](),o.add(e.schedule((function(){if(!n.closed){var t,e;try{var i=r.next();t=i.value,e=i.done}catch(t){return void n.error(t)}e?n.complete():(n.next(t),this.schedule())}})))}))),o}))}(t,e)}throw new TypeError((null!==t&&typeof t||t)+" is not observable")}},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(0),i=function(t){function e(e,n){var r=t.call(this)||this;return r.subject=e,r.subscriber=n,r.closed=!1,r}return r.a(e,t),e.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var n=e.indexOf(this.subscriber);-1!==n&&e.splice(n,1)}}},e}(n(4).a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(t){return function(e){for(var n=0,r=t.length;n<r&&!e.closed;n++)e.next(t[n]);e.complete()}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t}},function(t,e,n){"use strict";function r(t){return!!t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";function r(t,e){function n(){return!n.pred.apply(n.thisArg,arguments)}return n.pred=t,n.thisArg=e,n}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";var r=n(45).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,n,o){if("function"==typeof n)return t(e,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t.apply(this,r)}}}(o||i);var s=n.readable||!1!==n.readable&&e.readable,a=n.writable||!1!==n.writable&&e.writable,c=function(){e.writable||h()},u=e._writableState&&e._writableState.finished,h=function(){a=!1,u=!0,s||o.call(e)},l=e._readableState&&e._readableState.endEmitted,f=function(){s=!1,l=!0,a||o.call(e)},d=function(t){o.call(e,t)},p=function(){var t;return s&&!l?(e._readableState&&e._readableState.ended||(t=new r),o.call(e,t)):a&&!u?(e._writableState&&e._writableState.ended||(t=new r),o.call(e,t)):void 0},v=function(){e.req.on("finish",h)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(e)?a&&!e._writableState&&(e.on("end",c),e.on("close",c)):(e.on("complete",h),e.on("abort",p),e.req?v():e.on("request",v)),e.on("end",f),e.on("finish",h),!1!==n.error&&e.on("error",d),e.on("close",p),function(){e.removeListener("complete",h),e.removeListener("abort",p),e.removeListener("request",v),e.req&&e.req.removeListener("finish",h),e.removeListener("end",c),e.removeListener("close",c),e.removeListener("finish",h),e.removeListener("end",f),e.removeListener("error",d),e.removeListener("close",p)}}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Prom=e.PromMessageType=void 0;const i=r(n(135));var o;!function(t){t[t.SessionStart=0]="SessionStart",t[t.WebRtcPerformance=1]="WebRtcPerformance",t[t.AvailabilityCheck=2]="AvailabilityCheck",t[t.QuestionMessageReceived=3]="QuestionMessageReceived",t[t.AnswerMessageReceived=4]="AnswerMessageReceived",t[t.SessionEnded=5]="SessionEnded"}(o=e.PromMessageType||(e.PromMessageType={}));e.Prom=class{constructor(t){this.apiUrl=t,this.prom_prefix="client_sdk_",this.registry=i.default(),this.messageTimings=[],this.metricsPushedCounter=this.registry.create("counter",this.prom_prefix+"metrics_pushed_total","A counter for showcase metrics pushed."),this.sessionStartTime=this.registry.create("histogram",this.prom_prefix+"session_start_duration_seconds","A histogram of session start times.",[1,2.5,4,5,6,7.5,8.5,10,15,30,60]),this.availabilityCheckTime=this.registry.create("histogram",this.prom_prefix+"availability_chk_duration_seconds","A histogram of availability check response times.",[.05,.1,.2,.5,.75,1,1.5,2,2.5,5,7.5,10]),this.webRtcInboundRTT=this.registry.create("histogram",this.prom_prefix+"webrtc_inbound_rtt_duration_seconds","A histogram of client inbound round trip time.",[.001,.002,.005,.01,.02,.05,.1,.5,2,5]),this.webRtcInboundFramesPerSec=this.registry.create("histogram",this.prom_prefix+"webrtc_inbound_frames_per_second","A histogram of client inbound frames per second.",[1,2,5,10,15,20,25,35,50]),this.webRtcInboundPacketsLost=this.registry.create("histogram",this.prom_prefix+"webrtc_inbound_packets_lost","A histogram of client packets lost.",[1,2,4,8,12,16,22,30,50,100,200,500]),this.webRtcFramesDropped=this.registry.create("histogram",this.prom_prefix+"webrtc_inbound_frames_dropped","A histogram of frames dropped.",[1,2,4,8,12,16,22,30,50,100,200,500]),this.webRtcFrameHeight=this.registry.create("histogram",this.prom_prefix+"webrtc_frame_height_px","A histogram of frame height in pixels",[60,180,240,360,540,720,1280]),this.webRtcFrameWidth=this.registry.create("histogram",this.prom_prefix+"webrtc_frame_width_px","A histogram of frame width in pixels",[60,180,240,360,540,720,1280,1500,1920]),this.conversationRoundTripTime=this.registry.create("histogram",this.prom_prefix+"conversation_rtt_duration_seconds","A histogram of round trip time of a conversation",[.001,.005,.01,.03,.05,.1,.2,.5,.75,1,1.5,2,2.5,5,7.5,10]),this.metricsIntervalId=setInterval(()=>{this.sendMetrics()},1e4)}handleMessage(t){var e,n,r,i,s,a,c;const u=Object.assign(t.labels||{},{platform:"js"});switch(t.type){case o.SessionStart:this.sessionStartTime.observe(t.value,u);break;case o.QuestionMessageReceived:this.messageTimings.push(t.value);break;case o.AnswerMessageReceived:const h=this.calculateConversationRtt(t);h>0&&this.conversationRoundTripTime.observe(h,u);break;case o.WebRtcPerformance:const l=t.value;l.outboundQualityLimitationReason?u.qualityLimitationReason=null===(e=l.outboundQualityLimitationReason)||void 0===e?void 0:e.value:u.qualityLimitationReason="unknown",l.newFramesDropped&&this.webRtcFramesDropped.observe(null===(n=l.newFramesDropped)||void 0===n?void 0:n.value,u),l.framesPerSec&&this.webRtcInboundFramesPerSec.observe(null===(r=l.framesPerSec)||void 0===r?void 0:r.value,u),l.inboundNewPacketsLost&&this.webRtcInboundPacketsLost.observe(null===(i=l.inboundNewPacketsLost)||void 0===i?void 0:i.value,u),l.inboundRoundTripTime&&this.webRtcInboundRTT.observe(null===(s=l.inboundRoundTripTime)||void 0===s?void 0:s.value,u),l.frameHeight&&this.webRtcFrameHeight.observe(null===(a=l.frameHeight)||void 0===a?void 0:a.value,u),l.frameWidth&&this.webRtcFrameWidth.observe(null===(c=l.frameWidth)||void 0===c?void 0:c.value,u);break;case o.AvailabilityCheck:this.availabilityCheckTime.observe(t.value,u);break;case o.SessionEnded:this.stopSendingMetrics()}}calculateConversationRtt(t){if(t.value&&this.messageTimings){const e=this.messageTimings.find(e=>e.id===t.value.id);if(e){const n=e.receivedOn;if(n){const r=(t.value.receivedOn-n)/1e3;return this.messageTimings.splice(this.messageTimings.indexOf(e),1),r}}}return 0}sendMetrics(){this.metricsPushedCounter.inc({platform:"js"});const t=new Request(this.apiUrl+"/client-metrics",{method:"POST",body:this.registry.metrics(),mode:"no-cors"});fetch(t),this.registry.reset()}stopSendingMetrics(){this.metricsIntervalId&&clearInterval(this.metricsIntervalId)}}},function(t,e,n){"use strict";n.r(e),n.d(e,"audit",(function(){return o})),n.d(e,"auditTime",(function(){return h})),n.d(e,"buffer",(function(){return l})),n.d(e,"bufferCount",(function(){return v})),n.d(e,"bufferTime",(function(){return _})),n.d(e,"bufferToggle",(function(){return A})),n.d(e,"bufferWhen",(function(){return I})),n.d(e,"catchError",(function(){return j})),n.d(e,"combineAll",(function(){return B})),n.d(e,"combineLatest",(function(){return q})),n.d(e,"concat",(function(){return z})),n.d(e,"concatAll",(function(){return G.a})),n.d(e,"concatMap",(function(){return $})),n.d(e,"concatMapTo",(function(){return X})),n.d(e,"count",(function(){return K})),n.d(e,"debounce",(function(){return Q})),n.d(e,"debounceTime",(function(){return nt})),n.d(e,"defaultIfEmpty",(function(){return st})),n.d(e,"delay",(function(){return lt})),n.d(e,"delayWhen",(function(){return gt})),n.d(e,"dematerialize",(function(){return wt})),n.d(e,"distinct",(function(){return Tt})),n.d(e,"distinctUntilChanged",(function(){return Rt})),n.d(e,"distinctUntilKeyChanged",(function(){return At})),n.d(e,"elementAt",(function(){return Wt})),n.d(e,"endWith",(function(){return Ht})),n.d(e,"every",(function(){return zt})),n.d(e,"exhaust",(function(){return $t})),n.d(e,"exhaustMap",(function(){return Zt})),n.d(e,"expand",(function(){return ee})),n.d(e,"filter",(function(){return kt.a})),n.d(e,"finalize",(function(){return ie})),n.d(e,"find",(function(){return ae})),n.d(e,"findIndex",(function(){return he})),n.d(e,"first",(function(){return fe})),n.d(e,"groupBy",(function(){return de.b})),n.d(e,"ignoreElements",(function(){return pe})),n.d(e,"isEmpty",(function(){return me})),n.d(e,"last",(function(){return xe})),n.d(e,"map",(function(){return Jt.a})),n.d(e,"mapTo",(function(){return Te})),n.d(e,"materialize",(function(){return Re})),n.d(e,"max",(function(){return Ne})),n.d(e,"merge",(function(){return Le})),n.d(e,"mergeAll",(function(){return Ue.a})),n.d(e,"mergeMap",(function(){return Y.b})),n.d(e,"flatMap",(function(){return Y.a})),n.d(e,"mergeMapTo",(function(){return Fe})),n.d(e,"mergeScan",(function(){return Be})),n.d(e,"min",(function(){return qe})),n.d(e,"multicast",(function(){return ze})),n.d(e,"observeOn",(function(){return Ye.b})),n.d(e,"onErrorResumeNext",(function(){return $e})),n.d(e,"pairwise",(function(){return Je})),n.d(e,"partition",(function(){return en})),n.d(e,"pluck",(function(){return nn})),n.d(e,"publish",(function(){return sn})),n.d(e,"publishBehavior",(function(){return cn})),n.d(e,"publishLast",(function(){return hn})),n.d(e,"publishReplay",(function(){return fn})),n.d(e,"race",(function(){return pn})),n.d(e,"reduce",(function(){return De})),n.d(e,"repeat",(function(){return vn})),n.d(e,"repeatWhen",(function(){return yn})),n.d(e,"retry",(function(){return wn})),n.d(e,"retryWhen",(function(){return Tn})),n.d(e,"refCount",(function(){return Rn.a})),n.d(e,"sample",(function(){return Mn})),n.d(e,"sampleTime",(function(){return Pn})),n.d(e,"scan",(function(){return Ae})),n.d(e,"sequenceEqual",(function(){return Nn})),n.d(e,"share",(function(){return Bn})),n.d(e,"shareReplay",(function(){return Vn})),n.d(e,"single",(function(){return Wn})),n.d(e,"skip",(function(){return zn})),n.d(e,"skipLast",(function(){return $n})),n.d(e,"skipUntil",(function(){return Jn})),n.d(e,"skipWhile",(function(){return tr})),n.d(e,"startWith",(function(){return rr})),n.d(e,"subscribeOn",(function(){return ar})),n.d(e,"switchAll",(function(){return fr})),n.d(e,"switchMap",(function(){return ur})),n.d(e,"switchMapTo",(function(){return dr})),n.d(e,"take",(function(){return Ft})),n.d(e,"takeLast",(function(){return _e})),n.d(e,"takeUntil",(function(){return pr})),n.d(e,"takeWhile",(function(){return mr})),n.d(e,"tap",(function(){return Sr})),n.d(e,"throttle",(function(){return Er})),n.d(e,"throttleTime",(function(){return Or})),n.d(e,"throwIfEmpty",(function(){return Dt})),n.d(e,"timeInterval",(function(){return Dr})),n.d(e,"timeout",(function(){return Vr})),n.d(e,"timeoutWith",(function(){return Lr})),n.d(e,"timestamp",(function(){return Wr})),n.d(e,"toArray",(function(){return zr})),n.d(e,"window",(function(){return Gr})),n.d(e,"windowCount",(function(){return Xr})),n.d(e,"windowTime",(function(){return Zr})),n.d(e,"windowToggle",(function(){return oi})),n.d(e,"windowWhen",(function(){return ci})),n.d(e,"withLatestFrom",(function(){return li})),n.d(e,"zip",(function(){return vi})),n.d(e,"zipAll",(function(){return gi}));var r=n(0),i=n(2);function o(t){return function(e){return e.lift(new s(t))}}var s=function(){function t(t){this.durationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.durationSelector))},t}(),a=function(t){function e(e,n){var r=t.call(this,e)||this;return r.durationSelector=n,r.hasValue=!1,r}return r.a(e,t),e.prototype._next=function(t){if(this.value=t,this.hasValue=!0,!this.throttled){var e=void 0;try{e=(0,this.durationSelector)(t)}catch(t){return this.destination.error(t)}var n=Object(i.c)(e,new i.a(this));!n||n.closed?this.clearThrottle():this.add(this.throttled=n)}},e.prototype.clearThrottle=function(){var t=this.value,e=this.hasValue,n=this.throttled;n&&(this.remove(n),this.throttled=void 0,n.unsubscribe()),e&&(this.value=void 0,this.hasValue=!1,this.destination.next(t))},e.prototype.notifyNext=function(){this.clearThrottle()},e.prototype.notifyComplete=function(){this.clearThrottle()},e}(i.b),c=n(6),u=n(72);function h(t,e){return void 0===e&&(e=c.a),o((function(){return Object(u.a)(t,e)}))}function l(t){return function(e){return e.lift(new f(t))}}var f=function(){function t(t){this.closingNotifier=t}return t.prototype.call=function(t,e){return e.subscribe(new d(t,this.closingNotifier))},t}(),d=function(t){function e(e,n){var r=t.call(this,e)||this;return r.buffer=[],r.add(Object(i.c)(n,new i.a(r))),r}return r.a(e,t),e.prototype._next=function(t){this.buffer.push(t)},e.prototype.notifyNext=function(){var t=this.buffer;this.buffer=[],this.destination.next(t)},e}(i.b),p=n(1);function v(t,e){return void 0===e&&(e=null),function(n){return n.lift(new g(t,e))}}var g=function(){function t(t,e){this.bufferSize=t,this.startBufferEvery=e,this.subscriberClass=e&&t!==e?y:m}return t.prototype.call=function(t,e){return e.subscribe(new this.subscriberClass(t,this.bufferSize,this.startBufferEvery))},t}(),m=function(t){function e(e,n){var r=t.call(this,e)||this;return r.bufferSize=n,r.buffer=[],r}return r.a(e,t),e.prototype._next=function(t){var e=this.buffer;e.push(t),e.length==this.bufferSize&&(this.destination.next(e),this.buffer=[])},e.prototype._complete=function(){var e=this.buffer;e.length>0&&this.destination.next(e),t.prototype._complete.call(this)},e}(p.a),y=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.bufferSize=n,i.startBufferEvery=r,i.buffers=[],i.count=0,i}return r.a(e,t),e.prototype._next=function(t){var e=this.bufferSize,n=this.startBufferEvery,r=this.buffers,i=this.count;this.count++,i%n==0&&r.push([]);for(var o=r.length;o--;){var s=r[o];s.push(t),s.length===e&&(r.splice(o,1),this.destination.next(s))}},e.prototype._complete=function(){for(var e=this.buffers,n=this.destination;e.length>0;){var r=e.shift();r.length>0&&n.next(r)}t.prototype._complete.call(this)},e}(p.a),b=n(9);function _(t){var e=arguments.length,n=c.a;Object(b.a)(arguments[arguments.length-1])&&(n=arguments[arguments.length-1],e--);var r=null;e>=2&&(r=arguments[1]);var i=Number.POSITIVE_INFINITY;return e>=3&&(i=arguments[2]),function(e){return e.lift(new w(t,r,i,n))}}var w=function(){function t(t,e,n,r){this.bufferTimeSpan=t,this.bufferCreationInterval=e,this.maxBufferSize=n,this.scheduler=r}return t.prototype.call=function(t,e){return e.subscribe(new x(t,this.bufferTimeSpan,this.bufferCreationInterval,this.maxBufferSize,this.scheduler))},t}(),S=function(){return function(){this.buffer=[]}}(),x=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;s.bufferTimeSpan=n,s.bufferCreationInterval=r,s.maxBufferSize=i,s.scheduler=o,s.contexts=[];var a=s.openContext();if(s.timespanOnly=null==r||r<0,s.timespanOnly){var c={subscriber:s,context:a,bufferTimeSpan:n};s.add(a.closeAction=o.schedule(T,n,c))}else{var u={subscriber:s,context:a},h={bufferTimeSpan:n,bufferCreationInterval:r,subscriber:s,scheduler:o};s.add(a.closeAction=o.schedule(E,n,u)),s.add(o.schedule(C,r,h))}return s}return r.a(e,t),e.prototype._next=function(t){for(var e,n=this.contexts,r=n.length,i=0;i<r;i++){var o=n[i],s=o.buffer;s.push(t),s.length==this.maxBufferSize&&(e=o)}e&&this.onBufferFull(e)},e.prototype._error=function(e){this.contexts.length=0,t.prototype._error.call(this,e)},e.prototype._complete=function(){for(var e=this.contexts,n=this.destination;e.length>0;){var r=e.shift();n.next(r.buffer)}t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.contexts=null},e.prototype.onBufferFull=function(t){this.closeContext(t);var e=t.closeAction;if(e.unsubscribe(),this.remove(e),!this.closed&&this.timespanOnly){t=this.openContext();var n=this.bufferTimeSpan,r={subscriber:this,context:t,bufferTimeSpan:n};this.add(t.closeAction=this.scheduler.schedule(T,n,r))}},e.prototype.openContext=function(){var t=new S;return this.contexts.push(t),t},e.prototype.closeContext=function(t){this.destination.next(t.buffer);var e=this.contexts;(e?e.indexOf(t):-1)>=0&&e.splice(e.indexOf(t),1)},e}(p.a);function T(t){var e=t.subscriber,n=t.context;n&&e.closeContext(n),e.closed||(t.context=e.openContext(),t.context.closeAction=this.schedule(t,t.bufferTimeSpan))}function C(t){var e=t.bufferCreationInterval,n=t.bufferTimeSpan,r=t.subscriber,i=t.scheduler,o=r.openContext();r.closed||(r.add(o.closeAction=i.schedule(E,n,{subscriber:r,context:o})),this.schedule(t,e))}function E(t){var e=t.subscriber,n=t.context;e.closeContext(n)}var R=n(4),M=n(12),O=n(15);function A(t,e){return function(n){return n.lift(new P(t,e))}}var P=function(){function t(t,e){this.openings=t,this.closingSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new k(t,this.openings,this.closingSelector))},t}(),k=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.closingSelector=r,i.contexts=[],i.add(Object(M.a)(i,n)),i}return r.a(e,t),e.prototype._next=function(t){for(var e=this.contexts,n=e.length,r=0;r<n;r++)e[r].buffer.push(t)},e.prototype._error=function(e){for(var n=this.contexts;n.length>0;){var r=n.shift();r.subscription.unsubscribe(),r.buffer=null,r.subscription=null}this.contexts=null,t.prototype._error.call(this,e)},e.prototype._complete=function(){for(var e=this.contexts;e.length>0;){var n=e.shift();this.destination.next(n.buffer),n.subscription.unsubscribe(),n.buffer=null,n.subscription=null}this.contexts=null,t.prototype._complete.call(this)},e.prototype.notifyNext=function(t,e){t?this.closeBuffer(t):this.openBuffer(e)},e.prototype.notifyComplete=function(t){this.closeBuffer(t.context)},e.prototype.openBuffer=function(t){try{var e=this.closingSelector.call(this,t);e&&this.trySubscribe(e)}catch(t){this._error(t)}},e.prototype.closeBuffer=function(t){var e=this.contexts;if(e&&t){var n=t.buffer,r=t.subscription;this.destination.next(n),e.splice(e.indexOf(t),1),this.remove(r),r.unsubscribe()}},e.prototype.trySubscribe=function(t){var e=this.contexts,n=new R.a,r={buffer:[],subscription:n};e.push(r);var i=Object(M.a)(this,t,r);!i||i.closed?this.closeBuffer(r):(i.context=r,this.add(i),n.add(i))},e}(O.a);function I(t){return function(e){return e.lift(new D(t))}}var D=function(){function t(t){this.closingSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new N(t,this.closingSelector))},t}(),N=function(t){function e(e,n){var r=t.call(this,e)||this;return r.closingSelector=n,r.subscribing=!1,r.openBuffer(),r}return r.a(e,t),e.prototype._next=function(t){this.buffer.push(t)},e.prototype._complete=function(){var e=this.buffer;e&&this.destination.next(e),t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.buffer=void 0,this.subscribing=!1},e.prototype.notifyNext=function(){this.openBuffer()},e.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()},e.prototype.openBuffer=function(){var t=this.closingSubscription;t&&(this.remove(t),t.unsubscribe());var e,n=this.buffer;this.buffer&&this.destination.next(n),this.buffer=[];try{e=(0,this.closingSelector)()}catch(t){return this.error(t)}t=new R.a,this.closingSubscription=t,this.add(t),this.subscribing=!0,t.add(Object(i.c)(e,new i.a(this))),this.subscribing=!1},e}(i.b);function j(t){return function(e){var n=new L(t),r=e.lift(n);return n.caught=r}}var L=function(){function t(t){this.selector=t}return t.prototype.call=function(t,e){return e.subscribe(new U(t,this.selector,this.caught))},t}(),U=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.selector=n,i.caught=r,i}return r.a(e,t),e.prototype.error=function(e){if(!this.isStopped){var n=void 0;try{n=this.selector(e,this.caught)}catch(e){return void t.prototype.error.call(this,e)}this._unsubscribeAndRecycle();var r=new i.a(this);this.add(r);var o=Object(i.c)(n,r);o!==r&&this.add(o)}},e}(i.b),F=n(51);function B(t){return function(e){return e.lift(new F.a(t))}}var V=n(7),W=n(11);function q(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=null;return"function"==typeof t[t.length-1]&&(n=t.pop()),1===t.length&&Object(V.a)(t[0])&&(t=t[0].slice()),function(e){return e.lift.call(Object(W.a)([e].concat(t)),new F.a(n))}}var H=n(32);function z(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(H.a.apply(void 0,[e].concat(t)))}}var G=n(69),Y=n(25);function $(t,e){return Object(Y.b)(t,e,1)}function X(t,e){return $((function(){return t}),e)}function K(t){return function(e){return e.lift(new J(t,e))}}var J=function(){function t(t,e){this.predicate=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new Z(t,this.predicate,this.source))},t}(),Z=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.predicate=n,i.source=r,i.count=0,i.index=0,i}return r.a(e,t),e.prototype._next=function(t){this.predicate?this._tryPredicate(t):this.count++},e.prototype._tryPredicate=function(t){var e;try{e=this.predicate(t,this.index++,this.source)}catch(t){return void this.destination.error(t)}e&&this.count++},e.prototype._complete=function(){this.destination.next(this.count),this.destination.complete()},e}(p.a);function Q(t){return function(e){return e.lift(new tt(t))}}var tt=function(){function t(t){this.durationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new et(t,this.durationSelector))},t}(),et=function(t){function e(e,n){var r=t.call(this,e)||this;return r.durationSelector=n,r.hasValue=!1,r}return r.a(e,t),e.prototype._next=function(t){try{var e=this.durationSelector.call(this,t);e&&this._tryNext(t,e)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){this.emitValue(),this.destination.complete()},e.prototype._tryNext=function(t,e){var n=this.durationSubscription;this.value=t,this.hasValue=!0,n&&(n.unsubscribe(),this.remove(n)),(n=Object(i.c)(e,new i.a(this)))&&!n.closed&&this.add(this.durationSubscription=n)},e.prototype.notifyNext=function(){this.emitValue()},e.prototype.notifyComplete=function(){this.emitValue()},e.prototype.emitValue=function(){if(this.hasValue){var e=this.value,n=this.durationSubscription;n&&(this.durationSubscription=void 0,n.unsubscribe(),this.remove(n)),this.value=void 0,this.hasValue=!1,t.prototype._next.call(this,e)}},e}(i.b);function nt(t,e){return void 0===e&&(e=c.a),function(n){return n.lift(new rt(t,e))}}var rt=function(){function t(t,e){this.dueTime=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new it(t,this.dueTime,this.scheduler))},t}(),it=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.dueTime=n,i.scheduler=r,i.debouncedSubscription=null,i.lastValue=null,i.hasValue=!1,i}return r.a(e,t),e.prototype._next=function(t){this.clearDebounce(),this.lastValue=t,this.hasValue=!0,this.add(this.debouncedSubscription=this.scheduler.schedule(ot,this.dueTime,this))},e.prototype._complete=function(){this.debouncedNext(),this.destination.complete()},e.prototype.debouncedNext=function(){if(this.clearDebounce(),this.hasValue){var t=this.lastValue;this.lastValue=null,this.hasValue=!1,this.destination.next(t)}},e.prototype.clearDebounce=function(){var t=this.debouncedSubscription;null!==t&&(this.remove(t),t.unsubscribe(),this.debouncedSubscription=null)},e}(p.a);function ot(t){t.debouncedNext()}function st(t){return void 0===t&&(t=null),function(e){return e.lift(new at(t))}}var at=function(){function t(t){this.defaultValue=t}return t.prototype.call=function(t,e){return e.subscribe(new ct(t,this.defaultValue))},t}(),ct=function(t){function e(e,n){var r=t.call(this,e)||this;return r.defaultValue=n,r.isEmpty=!0,r}return r.a(e,t),e.prototype._next=function(t){this.isEmpty=!1,this.destination.next(t)},e.prototype._complete=function(){this.isEmpty&&this.destination.next(this.defaultValue),this.destination.complete()},e}(p.a);function ut(t){return t instanceof Date&&!isNaN(+t)}var ht=n(17);function lt(t,e){void 0===e&&(e=c.a);var n=ut(t)?+t-e.now():Math.abs(t);return function(t){return t.lift(new ft(n,e))}}var ft=function(){function t(t,e){this.delay=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new dt(t,this.delay,this.scheduler))},t}(),dt=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.delay=n,i.scheduler=r,i.queue=[],i.active=!1,i.errored=!1,i}return r.a(e,t),e.dispatch=function(t){for(var e=t.source,n=e.queue,r=t.scheduler,i=t.destination;n.length>0&&n[0].time-r.now()<=0;)n.shift().notification.observe(i);if(n.length>0){var o=Math.max(0,n[0].time-r.now());this.schedule(t,o)}else this.unsubscribe(),e.active=!1},e.prototype._schedule=function(t){this.active=!0,this.destination.add(t.schedule(e.dispatch,this.delay,{source:this,destination:this.destination,scheduler:t}))},e.prototype.scheduleNotification=function(t){if(!0!==this.errored){var e=this.scheduler,n=new pt(e.now()+this.delay,t);this.queue.push(n),!1===this.active&&this._schedule(e)}},e.prototype._next=function(t){this.scheduleNotification(ht.a.createNext(t))},e.prototype._error=function(t){this.errored=!0,this.queue=[],this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.scheduleNotification(ht.a.createComplete()),this.unsubscribe()},e}(p.a),pt=function(){return function(t,e){this.time=t,this.notification=e}}(),vt=n(3);function gt(t,e){return e?function(n){return new bt(n,e).lift(new mt(t))}:function(e){return e.lift(new mt(t))}}var mt=function(){function t(t){this.delayDurationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new yt(t,this.delayDurationSelector))},t}(),yt=function(t){function e(e,n){var r=t.call(this,e)||this;return r.delayDurationSelector=n,r.completed=!1,r.delayNotifierSubscriptions=[],r.index=0,r}return r.a(e,t),e.prototype.notifyNext=function(t,e,n,r,i){this.destination.next(t),this.removeSubscription(i),this.tryComplete()},e.prototype.notifyError=function(t,e){this._error(t)},e.prototype.notifyComplete=function(t){var e=this.removeSubscription(t);e&&this.destination.next(e),this.tryComplete()},e.prototype._next=function(t){var e=this.index++;try{var n=this.delayDurationSelector(t,e);n&&this.tryDelay(n,t)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){this.completed=!0,this.tryComplete(),this.unsubscribe()},e.prototype.removeSubscription=function(t){t.unsubscribe();var e=this.delayNotifierSubscriptions.indexOf(t);return-1!==e&&this.delayNotifierSubscriptions.splice(e,1),t.outerValue},e.prototype.tryDelay=function(t,e){var n=Object(M.a)(this,t,e);n&&!n.closed&&(this.destination.add(n),this.delayNotifierSubscriptions.push(n))},e.prototype.tryComplete=function(){this.completed&&0===this.delayNotifierSubscriptions.length&&this.destination.complete()},e}(O.a),bt=function(t){function e(e,n){var r=t.call(this)||this;return r.source=e,r.subscriptionDelay=n,r}return r.a(e,t),e.prototype._subscribe=function(t){this.subscriptionDelay.subscribe(new _t(t,this.source))},e}(vt.a),_t=function(t){function e(e,n){var r=t.call(this)||this;return r.parent=e,r.source=n,r.sourceSubscribed=!1,r}return r.a(e,t),e.prototype._next=function(t){this.subscribeToSource()},e.prototype._error=function(t){this.unsubscribe(),this.parent.error(t)},e.prototype._complete=function(){this.unsubscribe(),this.subscribeToSource()},e.prototype.subscribeToSource=function(){this.sourceSubscribed||(this.sourceSubscribed=!0,this.unsubscribe(),this.source.subscribe(this.parent))},e}(p.a);function wt(){return function(t){return t.lift(new St)}}var St=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new xt(t))},t}(),xt=function(t){function e(e){return t.call(this,e)||this}return r.a(e,t),e.prototype._next=function(t){t.observe(this.destination)},e}(p.a);function Tt(t,e){return function(n){return n.lift(new Ct(t,e))}}var Ct=function(){function t(t,e){this.keySelector=t,this.flushes=e}return t.prototype.call=function(t,e){return e.subscribe(new Et(t,this.keySelector,this.flushes))},t}(),Et=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.keySelector=n,o.values=new Set,r&&o.add(Object(i.c)(r,new i.a(o))),o}return r.a(e,t),e.prototype.notifyNext=function(){this.values.clear()},e.prototype.notifyError=function(t){this._error(t)},e.prototype._next=function(t){this.keySelector?this._useKeySelector(t):this._finalizeNext(t,t)},e.prototype._useKeySelector=function(t){var e,n=this.destination;try{e=this.keySelector(t)}catch(t){return void n.error(t)}this._finalizeNext(e,t)},e.prototype._finalizeNext=function(t,e){var n=this.values;n.has(t)||(n.add(t),this.destination.next(e))},e}(i.b);function Rt(t,e){return function(n){return n.lift(new Mt(t,e))}}var Mt=function(){function t(t,e){this.compare=t,this.keySelector=e}return t.prototype.call=function(t,e){return e.subscribe(new Ot(t,this.compare,this.keySelector))},t}(),Ot=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.keySelector=r,i.hasKey=!1,"function"==typeof n&&(i.compare=n),i}return r.a(e,t),e.prototype.compare=function(t,e){return t===e},e.prototype._next=function(t){var e;try{var n=this.keySelector;e=n?n(t):t}catch(t){return this.destination.error(t)}var r=!1;if(this.hasKey)try{r=(0,this.compare)(this.key,e)}catch(t){return this.destination.error(t)}else this.hasKey=!0;r||(this.key=e,this.destination.next(t))},e}(p.a);function At(t,e){return Rt((function(n,r){return e?e(n[t],r[t]):n[t]===r[t]}))}var Pt=n(22),kt=n(16),It=n(24);function Dt(t){return void 0===t&&(t=Lt),function(e){return e.lift(new Nt(t))}}var Nt=function(){function t(t){this.errorFactory=t}return t.prototype.call=function(t,e){return e.subscribe(new jt(t,this.errorFactory))},t}(),jt=function(t){function e(e,n){var r=t.call(this,e)||this;return r.errorFactory=n,r.hasValue=!1,r}return r.a(e,t),e.prototype._next=function(t){this.hasValue=!0,this.destination.next(t)},e.prototype._complete=function(){if(this.hasValue)return this.destination.complete();var t=void 0;try{t=this.errorFactory()}catch(e){t=e}this.destination.error(t)},e}(p.a);function Lt(){return new It.a}var Ut=n(10);function Ft(t){return function(e){return 0===t?Object(Ut.b)():e.lift(new Bt(t))}}var Bt=function(){function t(t){if(this.total=t,this.total<0)throw new Pt.a}return t.prototype.call=function(t,e){return e.subscribe(new Vt(t,this.total))},t}(),Vt=function(t){function e(e,n){var r=t.call(this,e)||this;return r.total=n,r.count=0,r}return r.a(e,t),e.prototype._next=function(t){var e=this.total,n=++this.count;n<=e&&(this.destination.next(t),n===e&&(this.destination.complete(),this.unsubscribe()))},e}(p.a);function Wt(t,e){if(t<0)throw new Pt.a;var n=arguments.length>=2;return function(r){return r.pipe(Object(kt.a)((function(e,n){return n===t})),Ft(1),n?st(e):Dt((function(){return new Pt.a})))}}var qt=n(36);function Ht(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return Object(H.a)(e,qt.a.apply(void 0,t))}}function zt(t,e){return function(n){return n.lift(new Gt(t,e,n))}}var Gt=function(){function t(t,e,n){this.predicate=t,this.thisArg=e,this.source=n}return t.prototype.call=function(t,e){return e.subscribe(new Yt(t,this.predicate,this.thisArg,this.source))},t}(),Yt=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.predicate=n,o.thisArg=r,o.source=i,o.index=0,o.thisArg=r||o,o}return r.a(e,t),e.prototype.notifyComplete=function(t){this.destination.next(t),this.destination.complete()},e.prototype._next=function(t){var e=!1;try{e=this.predicate.call(this.thisArg,t,this.index++,this.source)}catch(t){return void this.destination.error(t)}e||this.notifyComplete(!1)},e.prototype._complete=function(){this.notifyComplete(!0)},e}(p.a);function $t(){return function(t){return t.lift(new Xt)}}var Xt=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Kt(t))},t}(),Kt=function(t){function e(e){var n=t.call(this,e)||this;return n.hasCompleted=!1,n.hasSubscription=!1,n}return r.a(e,t),e.prototype._next=function(t){this.hasSubscription||(this.hasSubscription=!0,this.add(Object(i.c)(t,new i.a(this))))},e.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete()},e.prototype.notifyComplete=function(){this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},e}(i.b),Jt=n(8);function Zt(t,e){return e?function(n){return n.pipe(Zt((function(n,r){return Object(W.a)(t(n,r)).pipe(Object(Jt.a)((function(t,i){return e(n,t,r,i)})))})))}:function(e){return e.lift(new Qt(t))}}var Qt=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e.subscribe(new te(t,this.project))},t}(),te=function(t){function e(e,n){var r=t.call(this,e)||this;return r.project=n,r.hasSubscription=!1,r.hasCompleted=!1,r.index=0,r}return r.a(e,t),e.prototype._next=function(t){this.hasSubscription||this.tryNext(t)},e.prototype.tryNext=function(t){var e,n=this.index++;try{e=this.project(t,n)}catch(t){return void this.destination.error(t)}this.hasSubscription=!0,this._innerSub(e)},e.prototype._innerSub=function(t){var e=new i.a(this),n=this.destination;n.add(e);var r=Object(i.c)(t,e);r!==e&&n.add(r)},e.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyError=function(t){this.destination.error(t)},e.prototype.notifyComplete=function(){this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},e}(i.b);function ee(t,e,n){return void 0===e&&(e=Number.POSITIVE_INFINITY),e=(e||0)<1?Number.POSITIVE_INFINITY:e,function(r){return r.lift(new ne(t,e,n))}}var ne=function(){function t(t,e,n){this.project=t,this.concurrent=e,this.scheduler=n}return t.prototype.call=function(t,e){return e.subscribe(new re(t,this.project,this.concurrent,this.scheduler))},t}(),re=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.project=n,o.concurrent=r,o.scheduler=i,o.index=0,o.active=0,o.hasCompleted=!1,r<Number.POSITIVE_INFINITY&&(o.buffer=[]),o}return r.a(e,t),e.dispatch=function(t){var e=t.subscriber,n=t.result,r=t.value,i=t.index;e.subscribeToProjection(n,r,i)},e.prototype._next=function(t){var n=this.destination;if(n.closed)this._complete();else{var r=this.index++;if(this.active<this.concurrent){n.next(t);try{var i=(0,this.project)(t,r);if(this.scheduler){var o={subscriber:this,result:i,value:t,index:r};this.destination.add(this.scheduler.schedule(e.dispatch,0,o))}else this.subscribeToProjection(i,t,r)}catch(t){n.error(t)}}else this.buffer.push(t)}},e.prototype.subscribeToProjection=function(t,e,n){this.active++,this.destination.add(Object(i.c)(t,new i.a(this)))},e.prototype._complete=function(){this.hasCompleted=!0,this.hasCompleted&&0===this.active&&this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t){this._next(t)},e.prototype.notifyComplete=function(){var t=this.buffer;this.active--,t&&t.length>0&&this._next(t.shift()),this.hasCompleted&&0===this.active&&this.destination.complete()},e}(i.b);function ie(t){return function(e){return e.lift(new oe(t))}}var oe=function(){function t(t){this.callback=t}return t.prototype.call=function(t,e){return e.subscribe(new se(t,this.callback))},t}(),se=function(t){function e(e,n){var r=t.call(this,e)||this;return r.add(new R.a(n)),r}return r.a(e,t),e}(p.a);function ae(t,e){if("function"!=typeof t)throw new TypeError("predicate is not a function");return function(n){return n.lift(new ce(t,n,!1,e))}}var ce=function(){function t(t,e,n,r){this.predicate=t,this.source=e,this.yieldIndex=n,this.thisArg=r}return t.prototype.call=function(t,e){return e.subscribe(new ue(t,this.predicate,this.source,this.yieldIndex,this.thisArg))},t}(),ue=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;return s.predicate=n,s.source=r,s.yieldIndex=i,s.thisArg=o,s.index=0,s}return r.a(e,t),e.prototype.notifyComplete=function(t){var e=this.destination;e.next(t),e.complete(),this.unsubscribe()},e.prototype._next=function(t){var e=this.predicate,n=this.thisArg,r=this.index++;try{e.call(n||this,t,r,this.source)&&this.notifyComplete(this.yieldIndex?r:t)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){this.notifyComplete(this.yieldIndex?-1:void 0)},e}(p.a);function he(t,e){return function(n){return n.lift(new ce(t,n,!0,e))}}var le=n(14);function fe(t,e){var n=arguments.length>=2;return function(r){return r.pipe(t?Object(kt.a)((function(e,n){return t(e,n,r)})):le.a,Ft(1),n?st(e):Dt((function(){return new It.a})))}}var de=n(62);function pe(){return function(t){return t.lift(new ve)}}var ve=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new ge(t))},t}(),ge=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.a(e,t),e.prototype._next=function(t){},e}(p.a);function me(){return function(t){return t.lift(new ye)}}var ye=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new be(t))},t}(),be=function(t){function e(e){return t.call(this,e)||this}return r.a(e,t),e.prototype.notifyComplete=function(t){var e=this.destination;e.next(t),e.complete()},e.prototype._next=function(t){this.notifyComplete(!1)},e.prototype._complete=function(){this.notifyComplete(!0)},e}(p.a);function _e(t){return function(e){return 0===t?Object(Ut.b)():e.lift(new we(t))}}var we=function(){function t(t){if(this.total=t,this.total<0)throw new Pt.a}return t.prototype.call=function(t,e){return e.subscribe(new Se(t,this.total))},t}(),Se=function(t){function e(e,n){var r=t.call(this,e)||this;return r.total=n,r.ring=new Array,r.count=0,r}return r.a(e,t),e.prototype._next=function(t){var e=this.ring,n=this.total,r=this.count++;e.length<n?e.push(t):e[r%n]=t},e.prototype._complete=function(){var t=this.destination,e=this.count;if(e>0)for(var n=this.count>=this.total?this.total:this.count,r=this.ring,i=0;i<n;i++){var o=e++%n;t.next(r[o])}t.complete()},e}(p.a);function xe(t,e){var n=arguments.length>=2;return function(r){return r.pipe(t?Object(kt.a)((function(e,n){return t(e,n,r)})):le.a,_e(1),n?st(e):Dt((function(){return new It.a})))}}function Te(t){return function(e){return e.lift(new Ce(t))}}var Ce=function(){function t(t){this.value=t}return t.prototype.call=function(t,e){return e.subscribe(new Ee(t,this.value))},t}(),Ee=function(t){function e(e,n){var r=t.call(this,e)||this;return r.value=n,r}return r.a(e,t),e.prototype._next=function(t){this.destination.next(this.value)},e}(p.a);function Re(){return function(t){return t.lift(new Me)}}var Me=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Oe(t))},t}(),Oe=function(t){function e(e){return t.call(this,e)||this}return r.a(e,t),e.prototype._next=function(t){this.destination.next(ht.a.createNext(t))},e.prototype._error=function(t){var e=this.destination;e.next(ht.a.createError(t)),e.complete()},e.prototype._complete=function(){var t=this.destination;t.next(ht.a.createComplete()),t.complete()},e}(p.a);function Ae(t,e){var n=!1;return arguments.length>=2&&(n=!0),function(r){return r.lift(new Pe(t,e,n))}}var Pe=function(){function t(t,e,n){void 0===n&&(n=!1),this.accumulator=t,this.seed=e,this.hasSeed=n}return t.prototype.call=function(t,e){return e.subscribe(new ke(t,this.accumulator,this.seed,this.hasSeed))},t}(),ke=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.accumulator=n,o._seed=r,o.hasSeed=i,o.index=0,o}return r.a(e,t),Object.defineProperty(e.prototype,"seed",{get:function(){return this._seed},set:function(t){this.hasSeed=!0,this._seed=t},enumerable:!0,configurable:!0}),e.prototype._next=function(t){if(this.hasSeed)return this._tryNext(t);this.seed=t,this.destination.next(t)},e.prototype._tryNext=function(t){var e,n=this.index++;try{e=this.accumulator(this.seed,t,n)}catch(t){this.destination.error(t)}this.seed=e,this.destination.next(e)},e}(p.a),Ie=n(39);function De(t,e){return arguments.length>=2?function(n){return Object(Ie.a)(Ae(t,e),_e(1),st(e))(n)}:function(e){return Object(Ie.a)(Ae((function(e,n,r){return t(e,n,r+1)})),_e(1))(e)}}function Ne(t){return De("function"==typeof t?function(e,n){return t(e,n)>0?e:n}:function(t,e){return t>e?t:e})}var je=n(70);function Le(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(je.a.apply(void 0,[e].concat(t)))}}var Ue=n(52);function Fe(t,e,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),"function"==typeof e?Object(Y.b)((function(){return t}),e,n):("number"==typeof e&&(n=e),Object(Y.b)((function(){return t}),n))}function Be(t,e,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),function(r){return r.lift(new Ve(t,e,n))}}var Ve=function(){function t(t,e,n){this.accumulator=t,this.seed=e,this.concurrent=n}return t.prototype.call=function(t,e){return e.subscribe(new We(t,this.accumulator,this.seed,this.concurrent))},t}(),We=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.accumulator=n,o.acc=r,o.concurrent=i,o.hasValue=!1,o.hasCompleted=!1,o.buffer=[],o.active=0,o.index=0,o}return r.a(e,t),e.prototype._next=function(t){if(this.active<this.concurrent){var e=this.index++,n=this.destination,r=void 0;try{r=(0,this.accumulator)(this.acc,t,e)}catch(t){return n.error(t)}this.active++,this._innerSub(r)}else this.buffer.push(t)},e.prototype._innerSub=function(t){var e=new i.a(this),n=this.destination;n.add(e);var r=Object(i.c)(t,e);r!==e&&n.add(r)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete()),this.unsubscribe()},e.prototype.notifyNext=function(t){var e=this.destination;this.acc=t,this.hasValue=!0,e.next(t)},e.prototype.notifyComplete=function(){var t=this.buffer;this.active--,t.length>0?this._next(t.shift()):0===this.active&&this.hasCompleted&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete())},e}(i.b);function qe(t){return De("function"==typeof t?function(e,n){return t(e,n)<0?e:n}:function(t,e){return t<e?t:e})}var He=n(65);function ze(t,e){return function(n){var r;if(r="function"==typeof t?t:function(){return t},"function"==typeof e)return n.lift(new Ge(r,e));var i=Object.create(n,He.b);return i.source=n,i.subjectFactory=r,i}}var Ge=function(){function t(t,e){this.subjectFactory=t,this.selector=e}return t.prototype.call=function(t,e){var n=this.selector,r=this.subjectFactory(),i=n(r).subscribe(t);return i.add(e.subscribe(r)),i},t}(),Ye=n(67);function $e(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 1===t.length&&Object(V.a)(t[0])&&(t=t[0]),function(e){return e.lift(new Xe(t))}}var Xe=function(){function t(t){this.nextSources=t}return t.prototype.call=function(t,e){return e.subscribe(new Ke(t,this.nextSources))},t}(),Ke=function(t){function e(e,n){var r=t.call(this,e)||this;return r.destination=e,r.nextSources=n,r}return r.a(e,t),e.prototype.notifyError=function(){this.subscribeToNextSource()},e.prototype.notifyComplete=function(){this.subscribeToNextSource()},e.prototype._error=function(t){this.subscribeToNextSource(),this.unsubscribe()},e.prototype._complete=function(){this.subscribeToNextSource(),this.unsubscribe()},e.prototype.subscribeToNextSource=function(){var t=this.nextSources.shift();if(t){var e=new i.a(this),n=this.destination;n.add(e);var r=Object(i.c)(t,e);r!==e&&n.add(r)}else this.destination.complete()},e}(i.b);function Je(){return function(t){return t.lift(new Ze)}}var Ze=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Qe(t))},t}(),Qe=function(t){function e(e){var n=t.call(this,e)||this;return n.hasPrev=!1,n}return r.a(e,t),e.prototype._next=function(t){var e;this.hasPrev?e=[this.prev,t]:this.hasPrev=!0,this.prev=t,e&&this.destination.next(e)},e}(p.a),tn=n(78);function en(t,e){return function(n){return[Object(kt.a)(t,e)(n),Object(kt.a)(Object(tn.a)(t,e))(n)]}}function nn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t.length;if(0===n)throw new Error("list of properties cannot be empty.");return function(e){return Object(Jt.a)(rn(t,n))(e)}}function rn(t,e){return function(n){for(var r=n,i=0;i<e;i++){var o=null!=r?r[t[i]]:void 0;if(void 0===o)return;r=o}return r}}var on=n(5);function sn(t){return t?ze((function(){return new on.a}),t):ze(new on.a)}var an=n(66);function cn(t){return function(e){return ze(new an.a(t))(e)}}var un=n(28);function hn(){return function(t){return ze(new un.a)(t)}}var ln=n(49);function fn(t,e,n,r){n&&"function"!=typeof n&&(r=n);var i="function"==typeof n?n:void 0,o=new ln.a(t,e,r);return function(t){return ze((function(){return o}),i)(t)}}var dn=n(71);function pn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return 1===t.length&&Object(V.a)(t[0])&&(t=t[0]),e.lift.call(dn.a.apply(void 0,[e].concat(t)))}}function vn(t){return void 0===t&&(t=-1),function(e){return 0===t?Object(Ut.b)():t<0?e.lift(new gn(-1,e)):e.lift(new gn(t-1,e))}}var gn=function(){function t(t,e){this.count=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new mn(t,this.count,this.source))},t}(),mn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.count=n,i.source=r,i}return r.a(e,t),e.prototype.complete=function(){if(!this.isStopped){var e=this.source,n=this.count;if(0===n)return t.prototype.complete.call(this);n>-1&&(this.count=n-1),e.subscribe(this._unsubscribeAndRecycle())}},e}(p.a);function yn(t){return function(e){return e.lift(new bn(t))}}var bn=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new _n(t,this.notifier,e))},t}(),_n=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.notifier=n,i.source=r,i.sourceIsBeingSubscribedTo=!0,i}return r.a(e,t),e.prototype.notifyNext=function(){this.sourceIsBeingSubscribedTo=!0,this.source.subscribe(this)},e.prototype.notifyComplete=function(){if(!1===this.sourceIsBeingSubscribedTo)return t.prototype.complete.call(this)},e.prototype.complete=function(){if(this.sourceIsBeingSubscribedTo=!1,!this.isStopped){if(this.retries||this.subscribeToRetries(),!this.retriesSubscription||this.retriesSubscription.closed)return t.prototype.complete.call(this);this._unsubscribeAndRecycle(),this.notifications.next(void 0)}},e.prototype._unsubscribe=function(){var t=this.notifications,e=this.retriesSubscription;t&&(t.unsubscribe(),this.notifications=void 0),e&&(e.unsubscribe(),this.retriesSubscription=void 0),this.retries=void 0},e.prototype._unsubscribeAndRecycle=function(){var e=this._unsubscribe;return this._unsubscribe=null,t.prototype._unsubscribeAndRecycle.call(this),this._unsubscribe=e,this},e.prototype.subscribeToRetries=function(){var e;this.notifications=new on.a;try{e=(0,this.notifier)(this.notifications)}catch(e){return t.prototype.complete.call(this)}this.retries=e,this.retriesSubscription=Object(i.c)(e,new i.a(this))},e}(i.b);function wn(t){return void 0===t&&(t=-1),function(e){return e.lift(new Sn(t,e))}}var Sn=function(){function t(t,e){this.count=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new xn(t,this.count,this.source))},t}(),xn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.count=n,i.source=r,i}return r.a(e,t),e.prototype.error=function(e){if(!this.isStopped){var n=this.source,r=this.count;if(0===r)return t.prototype.error.call(this,e);r>-1&&(this.count=r-1),n.subscribe(this._unsubscribeAndRecycle())}},e}(p.a);function Tn(t){return function(e){return e.lift(new Cn(t,e))}}var Cn=function(){function t(t,e){this.notifier=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new En(t,this.notifier,this.source))},t}(),En=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.notifier=n,i.source=r,i}return r.a(e,t),e.prototype.error=function(e){if(!this.isStopped){var n=this.errors,r=this.retries,o=this.retriesSubscription;if(r)this.errors=void 0,this.retriesSubscription=void 0;else{n=new on.a;try{r=(0,this.notifier)(n)}catch(e){return t.prototype.error.call(this,e)}o=Object(i.c)(r,new i.a(this))}this._unsubscribeAndRecycle(),this.errors=n,this.retries=r,this.retriesSubscription=o,n.next(e)}},e.prototype._unsubscribe=function(){var t=this.errors,e=this.retriesSubscription;t&&(t.unsubscribe(),this.errors=void 0),e&&(e.unsubscribe(),this.retriesSubscription=void 0),this.retries=void 0},e.prototype.notifyNext=function(){var t=this._unsubscribe;this._unsubscribe=null,this._unsubscribeAndRecycle(),this._unsubscribe=t,this.source.subscribe(this)},e}(i.b),Rn=n(48);function Mn(t){return function(e){return e.lift(new On(t))}}var On=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){var n=new An(t),r=e.subscribe(n);return r.add(Object(i.c)(this.notifier,new i.a(n))),r},t}(),An=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.hasValue=!1,e}return r.a(e,t),e.prototype._next=function(t){this.value=t,this.hasValue=!0},e.prototype.notifyNext=function(){this.emitValue()},e.prototype.notifyComplete=function(){this.emitValue()},e.prototype.emitValue=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.value))},e}(i.b);function Pn(t,e){return void 0===e&&(e=c.a),function(n){return n.lift(new kn(t,e))}}var kn=function(){function t(t,e){this.period=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new In(t,this.period,this.scheduler))},t}(),In=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.period=n,i.scheduler=r,i.hasValue=!1,i.add(r.schedule(Dn,n,{subscriber:i,period:n})),i}return r.a(e,t),e.prototype._next=function(t){this.lastValue=t,this.hasValue=!0},e.prototype.notifyNext=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.lastValue))},e}(p.a);function Dn(t){var e=t.subscriber,n=t.period;e.notifyNext(),this.schedule(t,n)}function Nn(t,e){return function(n){return n.lift(new jn(t,e))}}var jn=function(){function t(t,e){this.compareTo=t,this.comparator=e}return t.prototype.call=function(t,e){return e.subscribe(new Ln(t,this.compareTo,this.comparator))},t}(),Ln=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.compareTo=n,i.comparator=r,i._a=[],i._b=[],i._oneComplete=!1,i.destination.add(n.subscribe(new Un(e,i))),i}return r.a(e,t),e.prototype._next=function(t){this._oneComplete&&0===this._b.length?this.emit(!1):(this._a.push(t),this.checkValues())},e.prototype._complete=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0,this.unsubscribe()},e.prototype.checkValues=function(){for(var t=this._a,e=this._b,n=this.comparator;t.length>0&&e.length>0;){var r=t.shift(),i=e.shift(),o=!1;try{o=n?n(r,i):r===i}catch(t){this.destination.error(t)}o||this.emit(!1)}},e.prototype.emit=function(t){var e=this.destination;e.next(t),e.complete()},e.prototype.nextB=function(t){this._oneComplete&&0===this._a.length?this.emit(!1):(this._b.push(t),this.checkValues())},e.prototype.completeB=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0},e}(p.a),Un=function(t){function e(e,n){var r=t.call(this,e)||this;return r.parent=n,r}return r.a(e,t),e.prototype._next=function(t){this.parent.nextB(t)},e.prototype._error=function(t){this.parent.error(t),this.unsubscribe()},e.prototype._complete=function(){this.parent.completeB(),this.unsubscribe()},e}(p.a);function Fn(){return new on.a}function Bn(){return function(t){return Object(Rn.a)()(ze(Fn)(t))}}function Vn(t,e,n){var r;return r=t&&"object"==typeof t?t:{bufferSize:t,windowTime:e,refCount:!1,scheduler:n},function(t){return t.lift(function(t){var e,n,r=t.bufferSize,i=void 0===r?Number.POSITIVE_INFINITY:r,o=t.windowTime,s=void 0===o?Number.POSITIVE_INFINITY:o,a=t.refCount,c=t.scheduler,u=0,h=!1,l=!1;return function(t){var r;u++,!e||h?(h=!1,e=new ln.a(i,s,c),r=e.subscribe(this),n=t.subscribe({next:function(t){e.next(t)},error:function(t){h=!0,e.error(t)},complete:function(){l=!0,n=void 0,e.complete()}}),l&&(n=void 0)):r=e.subscribe(this),this.add((function(){u--,r.unsubscribe(),r=void 0,n&&!l&&a&&0===u&&(n.unsubscribe(),n=void 0,e=void 0)}))}}(r))}}function Wn(t){return function(e){return e.lift(new qn(t,e))}}var qn=function(){function t(t,e){this.predicate=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new Hn(t,this.predicate,this.source))},t}(),Hn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.predicate=n,i.source=r,i.seenValue=!1,i.index=0,i}return r.a(e,t),e.prototype.applySingleValue=function(t){this.seenValue?this.destination.error("Sequence contains more than one element"):(this.seenValue=!0,this.singleValue=t)},e.prototype._next=function(t){var e=this.index++;this.predicate?this.tryNext(t,e):this.applySingleValue(t)},e.prototype.tryNext=function(t,e){try{this.predicate(t,e,this.source)&&this.applySingleValue(t)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){var t=this.destination;this.index>0?(t.next(this.seenValue?this.singleValue:void 0),t.complete()):t.error(new It.a)},e}(p.a);function zn(t){return function(e){return e.lift(new Gn(t))}}var Gn=function(){function t(t){this.total=t}return t.prototype.call=function(t,e){return e.subscribe(new Yn(t,this.total))},t}(),Yn=function(t){function e(e,n){var r=t.call(this,e)||this;return r.total=n,r.count=0,r}return r.a(e,t),e.prototype._next=function(t){++this.count>this.total&&this.destination.next(t)},e}(p.a);function $n(t){return function(e){return e.lift(new Xn(t))}}var Xn=function(){function t(t){if(this._skipCount=t,this._skipCount<0)throw new Pt.a}return t.prototype.call=function(t,e){return 0===this._skipCount?e.subscribe(new p.a(t)):e.subscribe(new Kn(t,this._skipCount))},t}(),Kn=function(t){function e(e,n){var r=t.call(this,e)||this;return r._skipCount=n,r._count=0,r._ring=new Array(n),r}return r.a(e,t),e.prototype._next=function(t){var e=this._skipCount,n=this._count++;if(n<e)this._ring[n]=t;else{var r=n%e,i=this._ring,o=i[r];i[r]=t,this.destination.next(o)}},e}(p.a);function Jn(t){return function(e){return e.lift(new Zn(t))}}var Zn=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new Qn(t,this.notifier))},t}(),Qn=function(t){function e(e,n){var r=t.call(this,e)||this;r.hasValue=!1;var o=new i.a(r);r.add(o),r.innerSubscription=o;var s=Object(i.c)(n,o);return s!==o&&(r.add(s),r.innerSubscription=s),r}return r.a(e,t),e.prototype._next=function(e){this.hasValue&&t.prototype._next.call(this,e)},e.prototype.notifyNext=function(){this.hasValue=!0,this.innerSubscription&&this.innerSubscription.unsubscribe()},e.prototype.notifyComplete=function(){},e}(i.b);function tr(t){return function(e){return e.lift(new er(t))}}var er=function(){function t(t){this.predicate=t}return t.prototype.call=function(t,e){return e.subscribe(new nr(t,this.predicate))},t}(),nr=function(t){function e(e,n){var r=t.call(this,e)||this;return r.predicate=n,r.skipping=!0,r.index=0,r}return r.a(e,t),e.prototype._next=function(t){var e=this.destination;this.skipping&&this.tryCallPredicate(t),this.skipping||e.next(t)},e.prototype.tryCallPredicate=function(t){try{var e=this.predicate(t,this.index++);this.skipping=Boolean(e)}catch(t){this.destination.error(t)}},e}(p.a);function rr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[t.length-1];return Object(b.a)(n)?(t.pop(),function(e){return Object(H.a)(t,e,n)}):function(e){return Object(H.a)(t,e)}}var ir=n(40),or=n(30),sr=function(t){function e(e,n,r){void 0===n&&(n=0),void 0===r&&(r=ir.a);var i=t.call(this)||this;return i.source=e,i.delayTime=n,i.scheduler=r,(!Object(or.a)(n)||n<0)&&(i.delayTime=0),r&&"function"==typeof r.schedule||(i.scheduler=ir.a),i}return r.a(e,t),e.create=function(t,n,r){return void 0===n&&(n=0),void 0===r&&(r=ir.a),new e(t,n,r)},e.dispatch=function(t){var e=t.source,n=t.subscriber;return this.add(e.subscribe(n))},e.prototype._subscribe=function(t){var n=this.delayTime,r=this.source;return this.scheduler.schedule(e.dispatch,n,{source:r,subscriber:t})},e}(vt.a);function ar(t,e){return void 0===e&&(e=0),function(n){return n.lift(new cr(t,e))}}var cr=function(){function t(t,e){this.scheduler=t,this.delay=e}return t.prototype.call=function(t,e){return new sr(e,this.delay,this.scheduler).subscribe(t)},t}();function ur(t,e){return"function"==typeof e?function(n){return n.pipe(ur((function(n,r){return Object(W.a)(t(n,r)).pipe(Object(Jt.a)((function(t,i){return e(n,t,r,i)})))})))}:function(e){return e.lift(new hr(t))}}var hr=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e.subscribe(new lr(t,this.project))},t}(),lr=function(t){function e(e,n){var r=t.call(this,e)||this;return r.project=n,r.index=0,r}return r.a(e,t),e.prototype._next=function(t){var e,n=this.index++;try{e=this.project(t,n)}catch(t){return void this.destination.error(t)}this._innerSub(e)},e.prototype._innerSub=function(t){var e=this.innerSubscription;e&&e.unsubscribe();var n=new i.a(this),r=this.destination;r.add(n),this.innerSubscription=Object(i.c)(t,n),this.innerSubscription!==n&&r.add(this.innerSubscription)},e.prototype._complete=function(){var e=this.innerSubscription;e&&!e.closed||t.prototype._complete.call(this),this.unsubscribe()},e.prototype._unsubscribe=function(){this.innerSubscription=void 0},e.prototype.notifyComplete=function(){this.innerSubscription=void 0,this.isStopped&&t.prototype._complete.call(this)},e.prototype.notifyNext=function(t){this.destination.next(t)},e}(i.b);function fr(){return ur(le.a)}function dr(t,e){return e?ur((function(){return t}),e):ur((function(){return t}))}function pr(t){return function(e){return e.lift(new vr(t))}}var vr=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){var n=new gr(t),r=Object(i.c)(this.notifier,new i.a(n));return r&&!n.seenValue?(n.add(r),e.subscribe(n)):n},t}(),gr=function(t){function e(e){var n=t.call(this,e)||this;return n.seenValue=!1,n}return r.a(e,t),e.prototype.notifyNext=function(){this.seenValue=!0,this.complete()},e.prototype.notifyComplete=function(){},e}(i.b);function mr(t,e){return void 0===e&&(e=!1),function(n){return n.lift(new yr(t,e))}}var yr=function(){function t(t,e){this.predicate=t,this.inclusive=e}return t.prototype.call=function(t,e){return e.subscribe(new br(t,this.predicate,this.inclusive))},t}(),br=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.predicate=n,i.inclusive=r,i.index=0,i}return r.a(e,t),e.prototype._next=function(t){var e,n=this.destination;try{e=this.predicate(t,this.index++)}catch(t){return void n.error(t)}this.nextOrComplete(t,e)},e.prototype.nextOrComplete=function(t,e){var n=this.destination;Boolean(e)?n.next(t):(this.inclusive&&n.next(t),n.complete())},e}(p.a),_r=n(19),wr=n(23);function Sr(t,e,n){return function(r){return r.lift(new xr(t,e,n))}}var xr=function(){function t(t,e,n){this.nextOrObserver=t,this.error=e,this.complete=n}return t.prototype.call=function(t,e){return e.subscribe(new Tr(t,this.nextOrObserver,this.error,this.complete))},t}(),Tr=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o._tapNext=_r.a,o._tapError=_r.a,o._tapComplete=_r.a,o._tapError=r||_r.a,o._tapComplete=i||_r.a,Object(wr.a)(n)?(o._context=o,o._tapNext=n):n&&(o._context=n,o._tapNext=n.next||_r.a,o._tapError=n.error||_r.a,o._tapComplete=n.complete||_r.a),o}return r.a(e,t),e.prototype._next=function(t){try{this._tapNext.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.next(t)},e.prototype._error=function(t){try{this._tapError.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.error(t)},e.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(t){return void this.destination.error(t)}return this.destination.complete()},e}(p.a),Cr={leading:!0,trailing:!1};function Er(t,e){return void 0===e&&(e=Cr),function(n){return n.lift(new Rr(t,!!e.leading,!!e.trailing))}}var Rr=function(){function t(t,e,n){this.durationSelector=t,this.leading=e,this.trailing=n}return t.prototype.call=function(t,e){return e.subscribe(new Mr(t,this.durationSelector,this.leading,this.trailing))},t}(),Mr=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.destination=e,o.durationSelector=n,o._leading=r,o._trailing=i,o._hasValue=!1,o}return r.a(e,t),e.prototype._next=function(t){this._hasValue=!0,this._sendValue=t,this._throttled||(this._leading?this.send():this.throttle(t))},e.prototype.send=function(){var t=this._hasValue,e=this._sendValue;t&&(this.destination.next(e),this.throttle(e)),this._hasValue=!1,this._sendValue=void 0},e.prototype.throttle=function(t){var e=this.tryDurationSelector(t);e&&this.add(this._throttled=Object(i.c)(e,new i.a(this)))},e.prototype.tryDurationSelector=function(t){try{return this.durationSelector(t)}catch(t){return this.destination.error(t),null}},e.prototype.throttlingDone=function(){var t=this._throttled,e=this._trailing;t&&t.unsubscribe(),this._throttled=void 0,e&&this.send()},e.prototype.notifyNext=function(){this.throttlingDone()},e.prototype.notifyComplete=function(){this.throttlingDone()},e}(i.b);function Or(t,e,n){return void 0===e&&(e=c.a),void 0===n&&(n=Cr),function(r){return r.lift(new Ar(t,e,n.leading,n.trailing))}}var Ar=function(){function t(t,e,n,r){this.duration=t,this.scheduler=e,this.leading=n,this.trailing=r}return t.prototype.call=function(t,e){return e.subscribe(new Pr(t,this.duration,this.scheduler,this.leading,this.trailing))},t}(),Pr=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;return s.duration=n,s.scheduler=r,s.leading=i,s.trailing=o,s._hasTrailingValue=!1,s._trailingValue=null,s}return r.a(e,t),e.prototype._next=function(t){this.throttled?this.trailing&&(this._trailingValue=t,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(kr,this.duration,{subscriber:this})),this.leading?this.destination.next(t):this.trailing&&(this._trailingValue=t,this._hasTrailingValue=!0))},e.prototype._complete=function(){this._hasTrailingValue?(this.destination.next(this._trailingValue),this.destination.complete()):this.destination.complete()},e.prototype.clearThrottle=function(){var t=this.throttled;t&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),t.unsubscribe(),this.remove(t),this.throttled=null)},e}(p.a);function kr(t){t.subscriber.clearThrottle()}var Ir=n(53);function Dr(t){return void 0===t&&(t=c.a),function(e){return Object(Ir.a)((function(){return e.pipe(Ae((function(e,n){var r=e.current;return{value:n,current:t.now(),last:r}}),{current:t.now(),value:void 0,last:void 0}),Object(Jt.a)((function(t){var e=t.current,n=t.last,r=t.value;return new Nr(r,e-n)})))}))}}var Nr=function(){return function(t,e){this.value=t,this.interval=e}}(),jr=n(68);function Lr(t,e,n){return void 0===n&&(n=c.a),function(r){var i=ut(t),o=i?+t-n.now():Math.abs(t);return r.lift(new Ur(o,i,e,n))}}var Ur=function(){function t(t,e,n,r){this.waitFor=t,this.absoluteTimeout=e,this.withObservable=n,this.scheduler=r}return t.prototype.call=function(t,e){return e.subscribe(new Fr(t,this.absoluteTimeout,this.waitFor,this.withObservable,this.scheduler))},t}(),Fr=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;return s.absoluteTimeout=n,s.waitFor=r,s.withObservable=i,s.scheduler=o,s.scheduleTimeout(),s}return r.a(e,t),e.dispatchTimeout=function(t){var e=t.withObservable;t._unsubscribeAndRecycle(),t.add(Object(i.c)(e,new i.a(t)))},e.prototype.scheduleTimeout=function(){var t=this.action;t?this.action=t.schedule(this,this.waitFor):this.add(this.action=this.scheduler.schedule(e.dispatchTimeout,this.waitFor,this))},e.prototype._next=function(e){this.absoluteTimeout||this.scheduleTimeout(),t.prototype._next.call(this,e)},e.prototype._unsubscribe=function(){this.action=void 0,this.scheduler=null,this.withObservable=null},e}(i.b),Br=n(50);function Vr(t,e){return void 0===e&&(e=c.a),Lr(t,Object(Br.a)(new jr.a),e)}function Wr(t){return void 0===t&&(t=c.a),Object(Jt.a)((function(e){return new qr(e,t.now())}))}var qr=function(){return function(t,e){this.value=t,this.timestamp=e}}();function Hr(t,e,n){return 0===n?[e]:(t.push(e),t)}function zr(){return De(Hr,[])}function Gr(t){return function(e){return e.lift(new Yr(t))}}var Yr=function(){function t(t){this.windowBoundaries=t}return t.prototype.call=function(t,e){var n=new $r(t),r=e.subscribe(n);return r.closed||n.add(Object(i.c)(this.windowBoundaries,new i.a(n))),r},t}(),$r=function(t){function e(e){var n=t.call(this,e)||this;return n.window=new on.a,e.next(n.window),n}return r.a(e,t),e.prototype.notifyNext=function(){this.openWindow()},e.prototype.notifyError=function(t){this._error(t)},e.prototype.notifyComplete=function(){this._complete()},e.prototype._next=function(t){this.window.next(t)},e.prototype._error=function(t){this.window.error(t),this.destination.error(t)},e.prototype._complete=function(){this.window.complete(),this.destination.complete()},e.prototype._unsubscribe=function(){this.window=null},e.prototype.openWindow=function(){var t=this.window;t&&t.complete();var e=this.destination,n=this.window=new on.a;e.next(n)},e}(i.b);function Xr(t,e){return void 0===e&&(e=0),function(n){return n.lift(new Kr(t,e))}}var Kr=function(){function t(t,e){this.windowSize=t,this.startWindowEvery=e}return t.prototype.call=function(t,e){return e.subscribe(new Jr(t,this.windowSize,this.startWindowEvery))},t}(),Jr=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.destination=e,i.windowSize=n,i.startWindowEvery=r,i.windows=[new on.a],i.count=0,e.next(i.windows[0]),i}return r.a(e,t),e.prototype._next=function(t){for(var e=this.startWindowEvery>0?this.startWindowEvery:this.windowSize,n=this.destination,r=this.windowSize,i=this.windows,o=i.length,s=0;s<o&&!this.closed;s++)i[s].next(t);var a=this.count-r+1;if(a>=0&&a%e==0&&!this.closed&&i.shift().complete(),++this.count%e==0&&!this.closed){var c=new on.a;i.push(c),n.next(c)}},e.prototype._error=function(t){var e=this.windows;if(e)for(;e.length>0&&!this.closed;)e.shift().error(t);this.destination.error(t)},e.prototype._complete=function(){var t=this.windows;if(t)for(;t.length>0&&!this.closed;)t.shift().complete();this.destination.complete()},e.prototype._unsubscribe=function(){this.count=0,this.windows=null},e}(p.a);function Zr(t){var e=c.a,n=null,r=Number.POSITIVE_INFINITY;return Object(b.a)(arguments[3])&&(e=arguments[3]),Object(b.a)(arguments[2])?e=arguments[2]:Object(or.a)(arguments[2])&&(r=Number(arguments[2])),Object(b.a)(arguments[1])?e=arguments[1]:Object(or.a)(arguments[1])&&(n=Number(arguments[1])),function(i){return i.lift(new Qr(t,n,r,e))}}var Qr=function(){function t(t,e,n,r){this.windowTimeSpan=t,this.windowCreationInterval=e,this.maxWindowSize=n,this.scheduler=r}return t.prototype.call=function(t,e){return e.subscribe(new ei(t,this.windowTimeSpan,this.windowCreationInterval,this.maxWindowSize,this.scheduler))},t}(),ti=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._numberOfNextedValues=0,e}return r.a(e,t),e.prototype.next=function(e){this._numberOfNextedValues++,t.prototype.next.call(this,e)},Object.defineProperty(e.prototype,"numberOfNextedValues",{get:function(){return this._numberOfNextedValues},enumerable:!0,configurable:!0}),e}(on.a),ei=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;s.destination=e,s.windowTimeSpan=n,s.windowCreationInterval=r,s.maxWindowSize=i,s.scheduler=o,s.windows=[];var a=s.openWindow();if(null!==r&&r>=0){var c={subscriber:s,window:a,context:null},u={windowTimeSpan:n,windowCreationInterval:r,subscriber:s,scheduler:o};s.add(o.schedule(ii,n,c)),s.add(o.schedule(ri,r,u))}else{var h={subscriber:s,window:a,windowTimeSpan:n};s.add(o.schedule(ni,n,h))}return s}return r.a(e,t),e.prototype._next=function(t){for(var e=this.windows,n=e.length,r=0;r<n;r++){var i=e[r];i.closed||(i.next(t),i.numberOfNextedValues>=this.maxWindowSize&&this.closeWindow(i))}},e.prototype._error=function(t){for(var e=this.windows;e.length>0;)e.shift().error(t);this.destination.error(t)},e.prototype._complete=function(){for(var t=this.windows;t.length>0;){var e=t.shift();e.closed||e.complete()}this.destination.complete()},e.prototype.openWindow=function(){var t=new ti;return this.windows.push(t),this.destination.next(t),t},e.prototype.closeWindow=function(t){t.complete();var e=this.windows;e.splice(e.indexOf(t),1)},e}(p.a);function ni(t){var e=t.subscriber,n=t.windowTimeSpan,r=t.window;r&&e.closeWindow(r),t.window=e.openWindow(),this.schedule(t,n)}function ri(t){var e=t.windowTimeSpan,n=t.subscriber,r=t.scheduler,i=t.windowCreationInterval,o=n.openWindow(),s={action:this,subscription:null},a={subscriber:n,window:o,context:s};s.subscription=r.schedule(ii,e,a),this.add(s.subscription),this.schedule(t,i)}function ii(t){var e=t.subscriber,n=t.window,r=t.context;r&&r.action&&r.subscription&&r.action.remove(r.subscription),e.closeWindow(n)}function oi(t,e){return function(n){return n.lift(new si(t,e))}}var si=function(){function t(t,e){this.openings=t,this.closingSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new ai(t,this.openings,this.closingSelector))},t}(),ai=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.openings=n,i.closingSelector=r,i.contexts=[],i.add(i.openSubscription=Object(M.a)(i,n,n)),i}return r.a(e,t),e.prototype._next=function(t){var e=this.contexts;if(e)for(var n=e.length,r=0;r<n;r++)e[r].window.next(t)},e.prototype._error=function(e){var n=this.contexts;if(this.contexts=null,n)for(var r=n.length,i=-1;++i<r;){var o=n[i];o.window.error(e),o.subscription.unsubscribe()}t.prototype._error.call(this,e)},e.prototype._complete=function(){var e=this.contexts;if(this.contexts=null,e)for(var n=e.length,r=-1;++r<n;){var i=e[r];i.window.complete(),i.subscription.unsubscribe()}t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){var t=this.contexts;if(this.contexts=null,t)for(var e=t.length,n=-1;++n<e;){var r=t[n];r.window.unsubscribe(),r.subscription.unsubscribe()}},e.prototype.notifyNext=function(t,e,n,r,i){if(t===this.openings){var o=void 0;try{o=(0,this.closingSelector)(e)}catch(t){return this.error(t)}var s=new on.a,a=new R.a,c={window:s,subscription:a};this.contexts.push(c);var u=Object(M.a)(this,o,c);u.closed?this.closeWindow(this.contexts.length-1):(u.context=c,a.add(u)),this.destination.next(s)}else this.closeWindow(this.contexts.indexOf(t))},e.prototype.notifyError=function(t){this.error(t)},e.prototype.notifyComplete=function(t){t!==this.openSubscription&&this.closeWindow(this.contexts.indexOf(t.context))},e.prototype.closeWindow=function(t){if(-1!==t){var e=this.contexts,n=e[t],r=n.window,i=n.subscription;e.splice(t,1),r.complete(),i.unsubscribe()}},e}(O.a);function ci(t){return function(e){return e.lift(new ui(t))}}var ui=function(){function t(t){this.closingSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new hi(t,this.closingSelector))},t}(),hi=function(t){function e(e,n){var r=t.call(this,e)||this;return r.destination=e,r.closingSelector=n,r.openWindow(),r}return r.a(e,t),e.prototype.notifyNext=function(t,e,n,r,i){this.openWindow(i)},e.prototype.notifyError=function(t){this._error(t)},e.prototype.notifyComplete=function(t){this.openWindow(t)},e.prototype._next=function(t){this.window.next(t)},e.prototype._error=function(t){this.window.error(t),this.destination.error(t),this.unsubscribeClosingNotification()},e.prototype._complete=function(){this.window.complete(),this.destination.complete(),this.unsubscribeClosingNotification()},e.prototype.unsubscribeClosingNotification=function(){this.closingNotification&&this.closingNotification.unsubscribe()},e.prototype.openWindow=function(t){void 0===t&&(t=null),t&&(this.remove(t),t.unsubscribe());var e=this.window;e&&e.complete();var n,r=this.window=new on.a;this.destination.next(r);try{n=(0,this.closingSelector)()}catch(t){return this.destination.error(t),void this.window.error(t)}this.add(this.closingNotification=Object(M.a)(this,n))},e}(O.a);function li(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){var n;"function"==typeof t[t.length-1]&&(n=t.pop());var r=t;return e.lift(new fi(r,n))}}var fi=function(){function t(t,e){this.observables=t,this.project=e}return t.prototype.call=function(t,e){return e.subscribe(new di(t,this.observables,this.project))},t}(),di=function(t){function e(e,n,r){var i=t.call(this,e)||this;i.observables=n,i.project=r,i.toRespond=[];var o=n.length;i.values=new Array(o);for(var s=0;s<o;s++)i.toRespond.push(s);for(s=0;s<o;s++){var a=n[s];i.add(Object(M.a)(i,a,void 0,s))}return i}return r.a(e,t),e.prototype.notifyNext=function(t,e,n){this.values[n]=e;var r=this.toRespond;if(r.length>0){var i=r.indexOf(n);-1!==i&&r.splice(i,1)}},e.prototype.notifyComplete=function(){},e.prototype._next=function(t){if(0===this.toRespond.length){var e=[t].concat(this.values);this.project?this._tryProject(e):this.destination.next(e)}},e.prototype._tryProject=function(t){var e;try{e=this.project.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(O.a),pi=n(54);function vi(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(pi.b.apply(void 0,[e].concat(t)))}}function gi(t){return function(e){return e.lift(new pi.a(t))}}},function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"shimGetUserMedia",(function(){return b})),n.d(r,"shimGetDisplayMedia",(function(){return _})),n.d(r,"shimMediaStream",(function(){return w})),n.d(r,"shimOnTrack",(function(){return S})),n.d(r,"shimGetSendersWithDtmf",(function(){return x})),n.d(r,"shimGetStats",(function(){return T})),n.d(r,"shimSenderReceiverGetStats",(function(){return C})),n.d(r,"shimAddTrackRemoveTrackWithNative",(function(){return E})),n.d(r,"shimAddTrackRemoveTrack",(function(){return R})),n.d(r,"shimPeerConnection",(function(){return M})),n.d(r,"fixNegotiationNeeded",(function(){return O}));var i={};n.r(i),n.d(i,"shimGetUserMedia",(function(){return A})),n.d(i,"shimGetDisplayMedia",(function(){return P})),n.d(i,"shimOnTrack",(function(){return k})),n.d(i,"shimPeerConnection",(function(){return I})),n.d(i,"shimSenderGetStats",(function(){return D})),n.d(i,"shimReceiverGetStats",(function(){return N})),n.d(i,"shimRemoveStream",(function(){return j})),n.d(i,"shimRTCDataChannel",(function(){return L})),n.d(i,"shimAddTransceiver",(function(){return U})),n.d(i,"shimGetParameters",(function(){return F})),n.d(i,"shimCreateOffer",(function(){return B})),n.d(i,"shimCreateAnswer",(function(){return V}));var o={};n.r(o),n.d(o,"shimLocalStreamsAPI",(function(){return W})),n.d(o,"shimRemoteStreamsAPI",(function(){return q})),n.d(o,"shimCallbacksAPI",(function(){return H})),n.d(o,"shimGetUserMedia",(function(){return z})),n.d(o,"shimConstraints",(function(){return G})),n.d(o,"shimRTCIceServerUrls",(function(){return Y})),n.d(o,"shimTrackEventTransceiver",(function(){return $})),n.d(o,"shimCreateOfferLegacy",(function(){return X})),n.d(o,"shimAudioContext",(function(){return K}));var s={};n.r(s),n.d(s,"shimRTCIceCandidate",(function(){return Q})),n.d(s,"shimMaxMessageSize",(function(){return tt})),n.d(s,"shimSendThrowTypeError",(function(){return et})),n.d(s,"shimConnectionState",(function(){return nt})),n.d(s,"removeExtmapAllowMixed",(function(){return rt})),n.d(s,"shimAddIceCandidateNullOrEmpty",(function(){return it})),n.d(s,"shimParameterlessSetLocalDescription",(function(){return ot}));let a=!0,c=!0;function u(t,e,n){const r=t.match(e);return r&&r.length>=n&&parseInt(r[n],10)}function h(t,e,n){if(!t.RTCPeerConnection)return;const r=t.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(t,r){if(t!==e)return i.apply(this,arguments);const o=t=>{const e=n(t);e&&(r.handleEvent?r.handleEvent(e):r(e))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(r,o),i.apply(this,[t,o])};const o=r.removeEventListener;r.removeEventListener=function(t,n){if(t!==e||!this._eventMap||!this._eventMap[e])return o.apply(this,arguments);if(!this._eventMap[e].has(n))return o.apply(this,arguments);const r=this._eventMap[e].get(n);return this._eventMap[e].delete(n),0===this._eventMap[e].size&&delete this._eventMap[e],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[t,r])},Object.defineProperty(r,"on"+e,{get(){return this["_on"+e]},set(t){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),t&&this.addEventListener(e,this["_on"+e]=t)},enumerable:!0,configurable:!0})}function l(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(a=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function f(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(c=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function d(){if("object"==typeof window){if(a)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function p(t,e){c&&console.warn(t+" is deprecated, please use "+e+" instead.")}function v(t){return"[object Object]"===Object.prototype.toString.call(t)}function g(t){return v(t)?Object.keys(t).reduce((function(e,n){const r=v(t[n]),i=r?g(t[n]):t[n],o=r&&!Object.keys(i).length;return void 0===i||o?e:Object.assign(e,{[n]:i})}),{}):t}function m(t,e,n){const r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===e)return i;const o=[];return t.forEach(t=>{"track"===t.type&&t.trackIdentifier===e.id&&o.push(t)}),o.forEach(e=>{t.forEach(n=>{n.type===r&&n.trackId===e.id&&function t(e,n,r){n&&!r.has(n.id)&&(r.set(n.id,n),Object.keys(n).forEach(i=>{i.endsWith("Id")?t(e,e.get(n[i]),r):i.endsWith("Ids")&&n[i].forEach(n=>{t(e,e.get(n),r)})}))}(t,n,i)})}),i}const y=d;function b(t,e){const n=t&&t.navigator;if(!n.mediaDevices)return;const r=function(t){if("object"!=typeof t||t.mandatory||t.optional)return t;const e={};return Object.keys(t).forEach(n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;const r="object"==typeof t[n]?t[n]:{ideal:t[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);const i=function(t,e){return t?t+e.charAt(0).toUpperCase()+e.slice(1):"deviceId"===e?"sourceId":e};if(void 0!==r.ideal){e.optional=e.optional||[];let t={};"number"==typeof r.ideal?(t[i("min",n)]=r.ideal,e.optional.push(t),t={},t[i("max",n)]=r.ideal,e.optional.push(t)):(t[i("",n)]=r.ideal,e.optional.push(t))}void 0!==r.exact&&"number"!=typeof r.exact?(e.mandatory=e.mandatory||{},e.mandatory[i("",n)]=r.exact):["min","max"].forEach(t=>{void 0!==r[t]&&(e.mandatory=e.mandatory||{},e.mandatory[i(t,n)]=r[t])})}),t.advanced&&(e.optional=(e.optional||[]).concat(t.advanced)),e},i=function(t,i){if(e.version>=61)return i(t);if((t=JSON.parse(JSON.stringify(t)))&&"object"==typeof t.audio){const e=function(t,e,n){e in t&&!(n in t)&&(t[n]=t[e],delete t[e])};e((t=JSON.parse(JSON.stringify(t))).audio,"autoGainControl","googAutoGainControl"),e(t.audio,"noiseSuppression","googNoiseSuppression"),t.audio=r(t.audio)}if(t&&"object"==typeof t.video){let o=t.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const s=e.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||s)){let e;if(delete t.video.facingMode,"environment"===o.exact||"environment"===o.ideal?e=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(e=["front"]),e)return n.mediaDevices.enumerateDevices().then(n=>{let s=(n=n.filter(t=>"videoinput"===t.kind)).find(t=>e.some(e=>t.label.toLowerCase().includes(e)));return!s&&n.length&&e.includes("back")&&(s=n[n.length-1]),s&&(t.video.deviceId=o.exact?{exact:s.deviceId}:{ideal:s.deviceId}),t.video=r(t.video),y("chrome: "+JSON.stringify(t)),i(t)})}t.video=r(t.video)}return y("chrome: "+JSON.stringify(t)),i(t)},o=function(t){return e.version>=64?t:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[t.name]||t.name,message:t.message,constraint:t.constraint||t.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(t,e,r){i(t,t=>{n.webkitGetUserMedia(t,e,t=>{r&&r(o(t))})})}.bind(n),n.mediaDevices.getUserMedia){const t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return i(e,e=>t(e).then(t=>{if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach(t=>{t.stop()}),new DOMException("","NotFoundError");return t},t=>Promise.reject(o(t))))}}}function _(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&("function"==typeof e?t.navigator.mediaDevices.getDisplayMedia=function(n){return e(n).then(e=>{const r=n.video&&n.video.width,i=n.video&&n.video.height,o=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e,maxFrameRate:o||3}},r&&(n.video.mandatory.maxWidth=r),i&&(n.video.mandatory.maxHeight=i),t.navigator.mediaDevices.getUserMedia(n)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function w(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function S(t){if("object"==typeof t&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=e=>{e.stream.addEventListener("addtrack",n=>{let r;r=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(t=>t.track&&t.track.id===n.track.id):{track:n.track};const i=new Event("track");i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[e.stream],this.dispatchEvent(i)}),e.stream.getTracks().forEach(n=>{let r;r=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(t=>t.track&&t.track.id===n.id):{track:n};const i=new Event("track");i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[e.stream],this.dispatchEvent(i)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else h(t,"track",t=>(t.transceiver||Object.defineProperty(t,"transceiver",{value:{receiver:t.receiver}}),t))}function x(t){if("object"==typeof t&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(t,e){return{track:e,get dtmf(){return void 0===this._dtmf&&("audio"===e.kind?this._dtmf=t.createDTMFSender(e):this._dtmf=null),this._dtmf},_pc:t}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const n=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(t,r){let i=n.apply(this,arguments);return i||(i=e(this,t),this._senders.push(i)),i};const r=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(t){r.apply(this,arguments);const e=this._senders.indexOf(t);-1!==e&&this._senders.splice(e,1)}}const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(t){this._senders=this._senders||[],n.apply(this,[t]),t.getTracks().forEach(t=>{this._senders.push(e(this,t))})};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(t){this._senders=this._senders||[],r.apply(this,[t]),t.getTracks().forEach(t=>{const e=this._senders.find(e=>e.track===t);e&&this._senders.splice(this._senders.indexOf(e),1)})}}else if("object"==typeof t&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach(t=>t._pc=this),t},Object.defineProperty(t.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function T(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[t,n,r]=arguments;if(arguments.length>0&&"function"==typeof t)return e.apply(this,arguments);if(0===e.length&&(0===arguments.length||"function"!=typeof t))return e.apply(this,[]);const i=function(t){const e={};return t.result().forEach(t=>{const n={id:t.id,timestamp:t.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[t.type]||t.type};t.names().forEach(e=>{n[e]=t.stat(e)}),e[n.id]=n}),e},o=function(t){return new Map(Object.keys(t).map(e=>[e,t[e]]))};if(arguments.length>=2){const r=function(t){n(o(i(t)))};return e.apply(this,[r,t])}return new Promise((t,n)=>{e.apply(this,[function(e){t(o(i(e)))},n])}).then(n,r)}}function C(t){if(!("object"==typeof t&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach(t=>t._pc=this),t});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const t=n.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function(){const t=this;return this._pc.getStats().then(e=>m(e,t.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const t=e.apply(this,[]);return t.forEach(t=>t._pc=this),t}),h(t,"track",t=>(t.receiver._pc=t.srcElement,t)),t.RTCRtpReceiver.prototype.getStats=function(){const t=this;return this._pc.getStats().then(e=>m(e,t.track,!1))}}if(!("getStats"in t.RTCRtpSender.prototype)||!("getStats"in t.RTCRtpReceiver.prototype))return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const t=arguments[0];let e,n,r;return this.getSenders().forEach(n=>{n.track===t&&(e?r=!0:e=n)}),this.getReceivers().forEach(e=>(e.track===t&&(n?r=!0:n=e),e.track===t)),r||e&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):e?e.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function E(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(t=>this._shimmedLocalStreams[t][0])};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(t,n){if(!n)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const r=e.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(t){this._shimmedLocalStreams=this._shimmedLocalStreams||{},t.getTracks().forEach(t=>{if(this.getSenders().find(e=>e.track===t))throw new DOMException("Track already exists.","InvalidAccessError")});const e=this.getSenders();n.apply(this,arguments);const r=this.getSenders().filter(t=>-1===e.indexOf(t));this._shimmedLocalStreams[t.id]=[t].concat(r)};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[t.id],r.apply(this,arguments)};const i=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},t&&Object.keys(this._shimmedLocalStreams).forEach(e=>{const n=this._shimmedLocalStreams[e].indexOf(t);-1!==n&&this._shimmedLocalStreams[e].splice(n,1),1===this._shimmedLocalStreams[e].length&&delete this._shimmedLocalStreams[e]}),i.apply(this,arguments)}}function R(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return E(t);const n=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const t=n.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map(t=>this._reverseStreams[t.id])};const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(e){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},e.getTracks().forEach(t=>{if(this.getSenders().find(e=>e.track===t))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[e.id]){const n=new t.MediaStream(e.getTracks());this._streams[e.id]=n,this._reverseStreams[n.id]=e,e=n}r.apply(this,[e])};const i=t.RTCPeerConnection.prototype.removeStream;function o(t,e){let n=e.sdp;return Object.keys(t._reverseStreams||[]).forEach(e=>{const r=t._reverseStreams[e],i=t._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)}),new RTCSessionDescription({type:e.type,sdp:n})}function s(t,e){let n=e.sdp;return Object.keys(t._reverseStreams||[]).forEach(e=>{const r=t._reverseStreams[e],i=t._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)}),new RTCSessionDescription({type:e.type,sdp:n})}t.RTCPeerConnection.prototype.removeStream=function(t){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[t.id]||t]),delete this._reverseStreams[this._streams[t.id]?this._streams[t.id].id:t.id],delete this._streams[t.id]},t.RTCPeerConnection.prototype.addTrack=function(e,n){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find(t=>t===e))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");const i=this.getSenders().find(t=>t.track===e);if(i)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const o=this._streams[n.id];if(o)o.addTrack(e),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const r=new t.MediaStream([e]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find(t=>t.track===e)},["createOffer","createAnswer"].forEach((function(e){const n=t.RTCPeerConnection.prototype[e],r={[e](){const t=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[e=>{const n=o(this,e);t[0].apply(null,[n])},e=>{t[1]&&t[1].apply(null,e)},arguments[2]]):n.apply(this,arguments).then(t=>o(this,t))}};t.RTCPeerConnection.prototype[e]=r[e]}));const a=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=s(this,arguments[0]),a.apply(this,arguments)):a.apply(this,arguments)};const c=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const t=c.get.apply(this);return""===t.type?t:o(this,t)}}),t.RTCPeerConnection.prototype.removeTrack=function(t){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!t._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(t._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let e;this._streams=this._streams||{},Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(e=>t.track===e)&&(e=this._streams[n])}),e&&(1===e.getTracks().length?this.removeStream(this._reverseStreams[e.id]):e.removeTrack(t.track),this.dispatchEvent(new Event("negotiationneeded")))}}function M(t,e){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(e){const n=t.RTCPeerConnection.prototype[e],r={[e](){return arguments[0]=new("addIceCandidate"===e?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};t.RTCPeerConnection.prototype[e]=r[e]}))}function O(t,e){h(t,"negotiationneeded",t=>{const n=t.target;if(!(e.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return t})}function A(t,e){const n=t&&t.navigator,r=t&&t.MediaStreamTrack;if(n.getUserMedia=function(t,e,r){p("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(t).then(e,r)},!(e.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const t=function(t,e,n){e in t&&!(n in t)&&(t[n]=t[e],delete t[e])},e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(n=JSON.parse(JSON.stringify(n)),t(n.audio,"autoGainControl","mozAutoGainControl"),t(n.audio,"noiseSuppression","mozNoiseSuppression")),e(n)},r&&r.prototype.getSettings){const e=r.prototype.getSettings;r.prototype.getSettings=function(){const n=e.apply(this,arguments);return t(n,"mozAutoGainControl","autoGainControl"),t(n,"mozNoiseSuppression","noiseSuppression"),n}}if(r&&r.prototype.applyConstraints){const e=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(n=JSON.parse(JSON.stringify(n)),t(n,"autoGainControl","mozAutoGainControl"),t(n,"noiseSuppression","mozNoiseSuppression")),e.apply(this,[n])}}}}function P(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){const t=new DOMException("getDisplayMedia without video constraints is undefined");return t.name="NotFoundError",t.code=8,Promise.reject(t)}return!0===n.video?n.video={mediaSource:e}:n.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(n)})}function k(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function I(t,e){if("object"!=typeof t||!t.RTCPeerConnection&&!t.mozRTCPeerConnection)return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(e){const n=t.RTCPeerConnection.prototype[e],r={[e](){return arguments[0]=new("addIceCandidate"===e?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};t.RTCPeerConnection.prototype[e]=r[e]}));const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[t,i,o]=arguments;return r.apply(this,[t||null]).then(t=>{if(e.version<53&&!i)try{t.forEach(t=>{t.type=n[t.type]||t.type})}catch(e){if("TypeError"!==e.name)throw e;t.forEach((e,r)=>{t.set(r,Object.assign({},e,{type:n[e.type]||e.type}))})}return t}).then(i,o)}}function D(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach(t=>t._pc=this),t});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const t=n.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function N(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const t=e.apply(this,[]);return t.forEach(t=>t._pc=this),t}),h(t,"track",t=>(t.receiver._pc=t.srcElement,t)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function j(t){t.RTCPeerConnection&&!("removeStream"in t.RTCPeerConnection.prototype)&&(t.RTCPeerConnection.prototype.removeStream=function(t){p("removeStream","removeTrack"),this.getSenders().forEach(e=>{e.track&&t.getTracks().includes(e.track)&&this.removeTrack(e)})})}function L(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function U(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.addTransceiver;e&&(t.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const t=arguments[1],n=t&&"sendEncodings"in t;n&&t.sendEncodings.forEach(t=>{if("rid"in t){if(!/^[a-z0-9]{0,16}$/i.test(t.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in t&&!(parseFloat(t.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in t&&!(parseFloat(t.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const r=e.apply(this,arguments);if(n){const{sender:e}=r,n=e.getParameters();(!("encodings"in n)||1===n.encodings.length&&0===Object.keys(n.encodings[0]).length)&&(n.encodings=t.sendEncodings,e.sendEncodings=t.sendEncodings,this.setParametersPromises.push(e.setParameters(n).then(()=>{delete e.sendEncodings}).catch(()=>{delete e.sendEncodings})))}return r})}function F(t){if("object"!=typeof t||!t.RTCRtpSender)return;const e=t.RTCRtpSender.prototype.getParameters;e&&(t.RTCRtpSender.prototype.getParameters=function(){const t=e.apply(this,arguments);return"encodings"in t||(t.encodings=[].concat(this.sendEncodings||[{}])),t})}function B(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function V(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function W(t){if("object"==typeof t&&t.RTCPeerConnection){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(t){this._localStreams||(this._localStreams=[]),this._localStreams.includes(t)||this._localStreams.push(t),t.getAudioTracks().forEach(n=>e.call(this,n,t)),t.getVideoTracks().forEach(n=>e.call(this,n,t))},t.RTCPeerConnection.prototype.addTrack=function(t,...n){return n&&n.forEach(t=>{this._localStreams?this._localStreams.includes(t)||this._localStreams.push(t):this._localStreams=[t]}),e.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(t){this._localStreams||(this._localStreams=[]);const e=this._localStreams.indexOf(t);if(-1===e)return;this._localStreams.splice(e,1);const n=t.getTracks();this.getSenders().forEach(t=>{n.includes(t.track)&&this.removeTrack(t)})})}}function q(t){if("object"==typeof t&&t.RTCPeerConnection&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(t){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=t),this.addEventListener("track",this._onaddstreampoly=t=>{t.streams.forEach(t=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(t))return;this._remoteStreams.push(t);const e=new Event("addstream");e.stream=t,this.dispatchEvent(e)})})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const t=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach(e=>{if(t._remoteStreams||(t._remoteStreams=[]),t._remoteStreams.indexOf(e)>=0)return;t._remoteStreams.push(e);const n=new Event("addstream");n.stream=e,t.dispatchEvent(n)})}),e.apply(t,arguments)}}}function H(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,n=e.createOffer,r=e.createAnswer,i=e.setLocalDescription,o=e.setRemoteDescription,s=e.addIceCandidate;e.createOffer=function(t,e){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return e?(i.then(t,e),Promise.resolve()):i},e.createAnswer=function(t,e){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return e?(i.then(t,e),Promise.resolve()):i};let a=function(t,e,n){const r=i.apply(this,[t]);return n?(r.then(e,n),Promise.resolve()):r};e.setLocalDescription=a,a=function(t,e,n){const r=o.apply(this,[t]);return n?(r.then(e,n),Promise.resolve()):r},e.setRemoteDescription=a,a=function(t,e,n){const r=s.apply(this,[t]);return n?(r.then(e,n),Promise.resolve()):r},e.addIceCandidate=a}function z(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const t=e.mediaDevices,n=t.getUserMedia.bind(t);e.mediaDevices.getUserMedia=t=>n(G(t))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=function(t,n,r){e.mediaDevices.getUserMedia(t).then(n,r)}.bind(e))}function G(t){return t&&void 0!==t.video?Object.assign({},t,{video:g(t.video)}):t}function Y(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(t,n){if(t&&t.iceServers){const e=[];for(let n=0;n<t.iceServers.length;n++){let r=t.iceServers[n];!r.hasOwnProperty("urls")&&r.hasOwnProperty("url")?(p("RTCIceServer.url","RTCIceServer.urls"),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,e.push(r)):e.push(t.iceServers[n])}t.iceServers=e}return new e(t,n)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get:()=>e.generateCertificate})}function $(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function X(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(t){if(t){void 0!==t.offerToReceiveAudio&&(t.offerToReceiveAudio=!!t.offerToReceiveAudio);const e=this.getTransceivers().find(t=>"audio"===t.receiver.track.kind);!1===t.offerToReceiveAudio&&e?"sendrecv"===e.direction?e.setDirection?e.setDirection("sendonly"):e.direction="sendonly":"recvonly"===e.direction&&(e.setDirection?e.setDirection("inactive"):e.direction="inactive"):!0!==t.offerToReceiveAudio||e||this.addTransceiver("audio"),void 0!==t.offerToReceiveVideo&&(t.offerToReceiveVideo=!!t.offerToReceiveVideo);const n=this.getTransceivers().find(t=>"video"===t.receiver.track.kind);!1===t.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!==t.offerToReceiveVideo||n||this.addTransceiver("video")}return e.apply(this,arguments)}}function K(t){"object"!=typeof t||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var J=n(43),Z=n.n(J);function Q(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const e=t.RTCIceCandidate;t.RTCIceCandidate=function(t){if("object"==typeof t&&t.candidate&&0===t.candidate.indexOf("a=")&&((t=JSON.parse(JSON.stringify(t))).candidate=t.candidate.substr(2)),t.candidate&&t.candidate.length){const n=new e(t),r=Z.a.parseCandidate(t.candidate),i=Object.assign(n,r);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new e(t)},t.RTCIceCandidate.prototype=e.prototype,h(t,"icecandidate",e=>(e.candidate&&Object.defineProperty(e,"candidate",{value:new t.RTCIceCandidate(e.candidate),writable:"false"}),e))}function tt(t,e){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const n=function(t){if(!t||!t.sdp)return!1;const e=Z.a.splitSections(t.sdp);return e.shift(),e.some(t=>{const e=Z.a.parseMLine(t);return e&&"application"===e.kind&&-1!==e.protocol.indexOf("SCTP")})},r=function(t){const e=t.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===e||e.length<2)return-1;const n=parseInt(e[1],10);return n!=n?-1:n},i=function(t){let n=65536;return"firefox"===e.browser&&(n=e.version<57?-1===t?16384:2147483637:e.version<60?57===e.version?65535:65536:2147483637),n},o=function(t,n){let r=65536;"firefox"===e.browser&&57===e.version&&(r=65535);const i=Z.a.matchPrefix(t.sdp,"a=max-message-size:");return i.length>0?r=parseInt(i[0].substr(19),10):"firefox"===e.browser&&-1!==n&&(r=2147483637),r},s=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===e.browser&&e.version>=76){const{sdpSemantics:t}=this.getConfiguration();"plan-b"===t&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(n(arguments[0])){const t=r(arguments[0]),e=i(t),n=o(arguments[0],t);let s;s=0===e&&0===n?Number.POSITIVE_INFINITY:0===e||0===n?Math.max(e,n):Math.min(e,n);const a={};Object.defineProperty(a,"maxMessageSize",{get:()=>s}),this._sctp=a}return s.apply(this,arguments)}}function et(t){if(!t.RTCPeerConnection||!("createDataChannel"in t.RTCPeerConnection.prototype))return;function e(t,e){const n=t.send;t.send=function(){const r=arguments[0],i=r.length||r.size||r.byteLength;if("open"===t.readyState&&e.sctp&&i>e.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+e.sctp.maxMessageSize+" bytes)");return n.apply(t,arguments)}}const n=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){const t=n.apply(this,arguments);return e(t,this),t},h(t,"datachannel",t=>(e(t.channel,t.target),t))}function nt(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const e=t.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(t){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),t&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=t)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(t=>{const n=e[t];e[t]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=t=>{const e=t.target;if(e._lastConnectionState!==e.connectionState){e._lastConnectionState=e.connectionState;const n=new Event("connectionstatechange",t);e.dispatchEvent(n)}return t},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}function rt(t,e){if(!t.RTCPeerConnection)return;if("chrome"===e.browser&&e.version>=71)return;if("safari"===e.browser&&e.version>=605)return;const n=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(e){if(e&&e.sdp&&-1!==e.sdp.indexOf("\na=extmap-allow-mixed")){const n=e.sdp.split("\n").filter(t=>"a=extmap-allow-mixed"!==t.trim()).join("\n");t.RTCSessionDescription&&e instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:e.type,sdp:n}):e.sdp=n}return n.apply(this,arguments)}}function it(t,e){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const n=t.RTCPeerConnection.prototype.addIceCandidate;n&&0!==n.length&&(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===e.browser&&e.version<78||"firefox"===e.browser&&e.version<68||"safari"===e.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function ot(t,e){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const n=t.RTCPeerConnection.prototype.setLocalDescription;n&&0!==n.length&&(t.RTCPeerConnection.prototype.setLocalDescription=function(){let t=arguments[0]||{};if("object"!=typeof t||t.type&&t.sdp)return n.apply(this,arguments);if(t={type:t.type,sdp:t.sdp},!t.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return n.apply(this,[t]);const e="offer"===t.type?this.createOffer:this.createAnswer;return e.apply(this).then(t=>n.apply(this,[t]))})}const st=function({window:t}={},e={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const n=d,a=function(t){const e={browser:null,version:null};if(void 0===t||!t.navigator)return e.browser="Not a browser.",e;const{navigator:n}=t;if(n.mozGetUserMedia)e.browser="firefox",e.version=u(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===t.isSecureContext&&t.webkitRTCPeerConnection&&!t.RTCIceGatherer)e.browser="chrome",e.version=u(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!t.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return e.browser="Not a supported browser.",e;e.browser="safari",e.version=u(n.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype}return e}(t),c={browserDetails:a,commonShim:s,extractVersion:u,disableLog:l,disableWarnings:f,sdp:J};switch(a.browser){case"chrome":if(!r||!M||!e.shimChrome)return n("Chrome shim is not included in this adapter release."),c;if(null===a.version)return n("Chrome shim can not determine version, not shimming."),c;n("adapter.js shimming chrome."),c.browserShim=r,it(t,a),ot(t),b(t,a),w(t),M(t,a),S(t),R(t,a),x(t),T(t),C(t),O(t,a),Q(t),nt(t),tt(t,a),et(t),rt(t,a);break;case"firefox":if(!i||!I||!e.shimFirefox)return n("Firefox shim is not included in this adapter release."),c;n("adapter.js shimming firefox."),c.browserShim=i,it(t,a),ot(t),A(t,a),I(t,a),k(t),j(t),D(t),N(t),L(t),U(t),F(t),B(t),V(t),Q(t),nt(t),tt(t,a),et(t);break;case"safari":if(!o||!e.shimSafari)return n("Safari shim is not included in this adapter release."),c;n("adapter.js shimming safari."),c.browserShim=o,it(t,a),ot(t),Y(t),X(t),H(t),W(t),q(t),$(t),z(t),K(t),Q(t),tt(t,a),et(t),rt(t,a);break;default:n("Unsupported browser!")}return c}({window:"undefined"==typeof window?void 0:window});e.default=st},function(t,e,n){"use strict";n.r(e),console.log("BUILD/SERIOUSLY.MODULE");let r,i,o,s,a,c,u,h={},l={},f={},d={},p=[],v={},g={},m={canvas:[],image:[],video:[]},y={},b=window.WeakMap&&new WeakMap,_=0,w=function(){},S={transparent:[0,0,0,0],black:[0,0,0,1],red:[1,0,0,1],green:[0,128/255,0,1],blue:[0,0,1,1],white:[1,1,1,1],silver:[192/255,192/255,192/255,1],gray:[128/255,128/255,128/255,1],maroon:[128/255,0,0,1],purple:[128/255,0,128/255,1],fuchsia:[1,0,1,1],lime:[0,1,0,1],olive:[128/255,128/255,0,1],yellow:[1,1,0,1],navy:[0,0,128/255,1],teal:[0,128/255,128/255,1],aqua:[0,1,1,1],orange:[1,165/255,0,1]},x=/^(rgb|hsl)a?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*(\d+(\.\d*)?)\s*)?\)/i,T=/^#(([0-9a-fA-F]{3,8}))/,C=["x","y","z","w"],E=["r","g","b","a"],R={srcRGB:770,dstRGB:771,srcAlpha:1,dstAlpha:771},M=["MAX_COMBINED_TEXTURE_IMAGE_UNITS","MAX_FRAGMENT_UNIFORM_VECTORS","MAX_TEXTURE_IMAGE_UNITS","MAX_VARYING_VECTORS","MAX_VERTEX_ATTRIBS","MAX_VERTEX_TEXTURE_IMAGE_UNITS","MAX_VERTEX_UNIFORM_VECTORS"],O=/^[\t ]*#define[\t ]+SHADER_NAME\s+([^$\n\r]+)/i,A={frustum:function(t,e,n,r,i,o,s){s||(s=A.create());var a=e-t,c=r-n,u=o-i;return s[0]=2*i/a,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=2*i/c,s[6]=0,s[7]=0,s[8]=(e+t)/a,s[9]=(r+n)/c,s[10]=-(o+i)/u,s[11]=-1,s[12]=0,s[13]=0,s[14]=-o*i*2/u,s[15]=0,s},perspective:function(t,e,n,r,i){var o=n*Math.tan(t*Math.PI/360),s=o*e;return A.frustum(-s,s,-o,o,n,r,i)},multiply:function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=e[4],c=e[5],u=e[6],h=e[7],l=e[8],f=e[9],d=e[10],p=e[11],v=e[12],g=e[13],m=e[14],y=e[15],b=n[0],_=n[1],w=n[2],S=n[3];return t[0]=b*r+_*a+w*l+S*v,t[1]=b*i+_*c+w*f+S*g,t[2]=b*o+_*u+w*d+S*m,t[3]=b*s+_*h+w*p+S*y,b=n[4],_=n[5],w=n[6],S=n[7],t[4]=b*r+_*a+w*l+S*v,t[5]=b*i+_*c+w*f+S*g,t[6]=b*o+_*u+w*d+S*m,t[7]=b*s+_*h+w*p+S*y,b=n[8],_=n[9],w=n[10],S=n[11],t[8]=b*r+_*a+w*l+S*v,t[9]=b*i+_*c+w*f+S*g,t[10]=b*o+_*u+w*d+S*m,t[11]=b*s+_*h+w*p+S*y,b=n[12],_=n[13],w=n[14],S=n[15],t[12]=b*r+_*a+w*l+S*v,t[13]=b*i+_*c+w*f+S*g,t[14]=b*o+_*u+w*d+S*m,t[15]=b*s+_*h+w*p+S*y,t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}},P=(j=0,window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){var e,n,r;return e=(new Date).getTime(),n=Math.max(0,16-(e-j)),r=window.setTimeout((function(){t(e+n)}),n),j=e+n,r}),k=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(t){window.cancelTimeout(t)},I=["alias","destroy","effect","id","initialize","inputs","isDestroyed","isReady","matte","off","on","readPixels","render","title","update"],D=["alias","destroy","id","inputs","isDestroyed","isReady","off","on","source","title","update"],N=["aliases","defaults","destroy","effect","go","id","incompatible","isDestroyed","isEffect","isNode","isSource","isTarget","isTransform","removeAlias","render","source","stop","target","transform"];var j;function L(t,e){var n,r;if("string"==typeof t)n=document.querySelector(t);else if(!t)return!1;return t.tagName&&(n=t),n?(r=n.tagName.toLowerCase(),e&&e.indexOf(r)<0?t:n):t}function U(t,e){var n,r;for(n in t.prototype&&e.prototype&&t.prototype!==e.prototype&&U(t.prototype,e.prototype),e)e.hasOwnProperty(n)&&((r=Object.getOwnPropertyDescriptor(e,n)).get||r.set?Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get:r.get,set:r.set}):t[n]=e[n]);return t}function F(t){var e;if(!console)return w;if("function"==typeof console[t])e=console[t];else{if("function"!=typeof console.log)return w;e=console.log}return e.bind?e.bind(console):function(){e.apply(console,arguments)}}function B(t,e){if(e||(e="HTMLElement"),t instanceof window[e])return!0;if(!t||"object"!=typeof t)return!1;for(;t;)if((t=Object.getPrototypeOf(t))&&t.constructor.name===e)return!0;return!1}function V(t,e,n,r,i){function o(t,e,n){return(n%=1)<0&&(n+=1),n<1/6?t+(e-t)*n*6:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}var s,a;return s=2*n-(a=n<.5?n*(e+1):n+e-n*e),i||(i=[]),i[0]=o(s,a,t+1/3),i[1]=o(s,a,t),i[2]=o(s,a,t-1/3),i[3]=r,i}function W(t){var e,n,r,i="#",o=t[3]<1?4:3;for(e=0;e<o;e++)r=(n=Math.min(255,Math.round(255*t[e]||0))).toString(16),n<16&&(r="0"+r),i+=r;return i}function q(t){return Array.isArray(t)||t&&t.BYTES_PER_ELEMENT&&"length"in t}function H(t){if("function"!=typeof t)throw new Error("setTimeoutZero argument is not a function");p.push(t),"file:"!==window.location.protocol?window.postMessage("seriously-timeout-message",window.location):setTimeout((function(){p.length&&p.shift()()}),0)}function z(t,e){var n;try{n=window.WebGLDebugUtils&&e&&e.debugContext?window.WebGLDebugUtils.makeDebugContext(t.getContext("webgl",e)):t.getContext("webgl",e)}catch(t){}if(!n)try{n=t.getContext("experimental-webgl",e)}catch(t){}return n}function G(){var t;return r&&r.getError()===r.CONTEXT_LOST_WEBGL&&(r=void 0),r||!window.WebGLRenderingContext||o||(t=document.createElement("canvas"),r=z(t),r?t.addEventListener("webglcontextlost",(function e(n){n.preventDefault(),r&&r.canvas===this&&(r=void 0,t.removeEventListener("webglcontextlost",e,!1))}),!1):K.logger.warn("Unable to access WebGL.")),r}function Y(t){var e,n,r;function i(t,r){var i,o;q(t)?(i=t[0],o=t[1]||i):i=t,"string"==typeof i?i=i.toLowerCase():"number"==typeof i?i=String(i):i||(i=""),n[i]=o,r||(e.firstValue=i)}function o(t){return t}for(r in t.inputs)if(t.inputs.hasOwnProperty(r)){if(t.reserved.indexOf(r)>=0||Object.prototype[r])throw new Error("Reserved input name: "+r);(e=t.inputs[r]).name=r,isNaN(e.min)&&(e.min=-1/0),isNaN(e.max)&&(e.max=1/0),isNaN(e.minCount)&&(e.minCount=-1/0),isNaN(e.maxCount)&&(e.maxCount=1/0),isNaN(e.step)&&(e.step=0),isNaN(e.mod)&&(e.mod=0),"enum"===e.type&&e.options&&q(e.options)&&e.options.length&&(n={},e.options.forEach(i),e.options=n),"vector"===e.type?e.dimensions<2?e.dimensions=2:e.dimensions>4||!e.dimensions||isNaN(e.dimensions)?e.dimensions=4:e.dimensions=Math.round(e.dimensions):e.dimensions=1,e.shaderDirty=!!e.shaderDirty,"function"!=typeof e.validate&&(e.validate=K.inputValidators[e.type]||o),t.defaultImageInput||"image"!==e.type||(t.defaultImageInput=r)}}function $(t,e,n,r){var i,o,s,a;!0===r||r&&r.useFloat;this.type=t.UNSIGNED_BYTE,i=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,i),r&&r.texture?(this.texture=r.texture,t.bindTexture(t.TEXTURE_2D,this.texture),this.ownTexture=!1):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),this.ownTexture=!0);try{this.type===t.FLOAT?(s=new Float32Array(e*n*4),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,n,0,t.RGBA,t.FLOAT,s)):(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,n,0,t.RGBA,t.UNSIGNED_BYTE,null),this.type=t.UNSIGNED_BYTE)}catch(r){this.type=t.UNSIGNED_BYTE,s=new Uint8Array(e*n*4),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,n,0,t.RGBA,t.UNSIGNED_BYTE,s)}if(o=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,o),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,e,n),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,o),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.texture,0),(a=t.checkFramebufferStatus(t.FRAMEBUFFER))===t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT)throw new Error("Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_ATTACHMENT");if(a===t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT)throw new Error("Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");if(a===t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS)throw new Error("Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_DIMENSIONS");if(a===t.FRAMEBUFFER_UNSUPPORTED)throw new Error("Incomplete framebuffer: FRAMEBUFFER_UNSUPPORTED");if(a!==t.FRAMEBUFFER_COMPLETE)throw new Error("Incomplete framebuffer: "+a);t.bindTexture(t.TEXTURE_2D,null),t.bindRenderbuffer(t.RENDERBUFFER,null),t.bindFramebuffer(t.FRAMEBUFFER,null),this.gl=t,this.frameBuffer=i,this.renderBuffer=o,this.width=e,this.height=n}function X(t,e,n){var r,i,o,s,a,c,u,h,l="";function f(e,n){var r,i;if(r=n?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER),t.shaderSource(r,e),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){for(e=e.split(/[\n\r]/),i=0;i<e.length;i++)e[i]=i+1+":\t"+e[i];throw e.unshift("Error compiling "+(n?"fragment":"vertex")+" shader:"),K.logger.error(e.join("\n")),new Error("Shader error: "+t.getShaderInfoLog(r))}return r}function d(e,n){if(e.type===t.SAMPLER_2D)return function(r){e.glTexture=t["TEXTURE"+r],t.uniform1i(n,r)};if(e.type===t.BOOL||e.type===t.INT)return e.size>1?function(e){t.uniform1iv(n,e)}:function(e){t.uniform1i(n,e)};if(e.type===t.FLOAT)return e.size>1?function(e){t.uniform1fv(n,e)}:function(e){t.uniform1f(n,e)};if(e.type===t.FLOAT_VEC2)return function(e){t.uniform2f(n,e[0],e[1])};if(e.type===t.FLOAT_VEC3)return function(e){t.uniform3f(n,e[0],e[1],e[2])};if(e.type===t.FLOAT_VEC4)return function(e){t.uniform4f(n,e[0],e[1],e[2],e[3])};if(e.type===t.FLOAT_MAT3)return function(e){t.uniformMatrix3fv(n,!1,e)};if(e.type===t.FLOAT_MAT4)return function(e){t.uniformMatrix4fv(n,!1,e)};throw new Error("Unknown shader uniform type: "+e.type)}function p(e){return function(){return t.getUniform(r,e)}}if(i=f(e),o=f(n,!0),r=t.createProgram(),t.attachShader(r,i),(s=t.getShaderInfoLog(i))&&(l+="Vertex shader error: "+s+"\n"),t.attachShader(r,o),(s=t.getShaderInfoLog(o))&&(l+="Fragment shader error: "+s+"\n"),t.linkProgram(r),!t.getProgramParameter(r,t.LINK_STATUS))throw l+=t.getProgramInfoLog(r),t.deleteProgram(r),t.deleteShader(i),t.deleteShader(o),(u=O.exec(e)||O.exec(n))&&(l="Shader = "+u[1]+"\n"+l),M.forEach((function(e){l+="\n"+e+": "+t.getParameter(t[e])})),new Error("Could not initialize shader:\n"+l);for(t.useProgram(r),this.uniforms={},c=t.getProgramParameter(r,t.ACTIVE_UNIFORMS),a=0;a<c;++a)(h={info:t.getActiveUniform(r,a)}).name=h.info.name.replace(/\[0\]$/,""),h.loc=t.getUniformLocation(r,h.name),h.set=d(h.info,h.loc),h.get=p(h.loc),this.uniforms[h.name]=h,this[h.name]||(this[h.name]=h);for(this.attributes={},this.location={},c=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES),a=0;a<c;++a)(h={info:t.getActiveAttrib(r,a)}).name=h.info.name,h.location=t.getAttribLocation(r,h.name),this.attributes[h.name]=h,this.location[h.name]=h.location;this.gl=t,this.program=r,this.destroy=function(){var e;for(e in t&&(t.deleteProgram(r),t.deleteShader(i),t.deleteShader(o)),this)this.hasOwnProperty(e)&&delete this[e];r=null,i=null,o=null}}function K(t){if(window===this||!(this instanceof K)||void 0!==this.id)return new K(t);var e,n,r,i,o,a,p,y,S,x,T,C,E,M,I,D=++_,j=this,F=[],V={},q=0,G=[],J=[],Z=[],Q=[],tt={},et=[],nt=[],rt={},it={},ot=!1,st=!1;function at(t,e){var n,r,i;return!!e&&(n=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,t.vertices,e.STATIC_DRAW),n.size=3,r=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r),e.bufferData(e.ELEMENT_ARRAY_BUFFER,t.indices,e.STATIC_DRAW),i=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,t.coords,e.STATIC_DRAW),i.size=2,{vertex:n,index:r,texCoord:i,length:t.indices.length,mode:t.mode||e.TRIANGLES})}function ct(t){var e={};return e.vertices=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,1,0]),e.indices=new Uint16Array([0,1,2,0,2,3]),e.coords=new Float32Array([0,0,1,0,1,1,0,1]),at(e,t)}function ut(t){var r,s;if(!n)if(t.canvas.addEventListener("webglcontextlost",lt,!1),t.canvas.addEventListener("webglcontextrestored",ht,!1),t.isContextLost())K.logger.warn("Unable to attach lost WebGL context. Will try again when context is restored.");else{for(n=t,e=t.canvas,i=ct(n),o=new X(n,"#define SHADER_NAME seriously.base\n"+c,"#define SHADER_NAME seriously.base\n"+u),r=0;r<Q.length;r++)(s=Q[r]).gl=n,s.initialize(),s.buildShader();for(r=0;r<G.length;r++)(s=G[r]).initialize();for(r=0;r<J.length;r++)(s=J[r]).model||(s.model=i,s.shader=o)}}function ht(){var t,e,i,o;if(r&&!n){if(B(e=r.target,"WebGLFramebuffer"))return void K.logger.error("Unable to restore target built on WebGLFramebuffer");if(t=z(e,{alpha:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!0,stencil:!0,debugContext:r.debugContext})){if(t.isContextLost())return void K.logger.error("Unable to restore WebGL Context");for(ut(t),r.renderToTexture?r.frameBuffer=new $(n,r.width,r.height,!1):r.frameBuffer={frameBuffer:null},i=0;i<F.length;i++)(o=F[i]).setDirty(),o.emit("webglcontextrestored");K.logger.log("WebGL context restored")}}}function lt(t){var r,s;for(t&&(K.logger.warn("WebGL context lost"),t.preventDefault()),I&&(k(I),I=0),e&&e.removeEventListener("webglcontextlost",lt,!1),r=0;r<Q.length;r++)(s=Q[r]).gl=null,s.initialized=!1,s.baseShader=null,s.model=null,s.frameBuffer=null,s.texture=null,s.shader&&s.shader.destroy&&(s.shader.destroy(),s.effect.commonShader&&delete it[s.hook]),s.shaderDirty=!0,s.shader=null,s.effect.lostContext&&s.effect.lostContext.call(s),t&&s.emit("webglcontextlost");for(r=0;r<G.length;r++)(s=G[r]).texture=null,s.initialized=!1,s.allowRefresh=!1,t&&s.emit("webglcontextlost");for(r=0;r<Z.length;r++)(s=Z[r]).frameBuffer=null,s.texture=null,t&&s.emit("webglcontextlost");for(r=0;r<J.length;r++)(s=J[r]).model=!1,s.frameBuffer=null,t&&s.emit("webglcontextlost");o&&o.destroy&&o.destroy(),n&&(n.deleteBuffer(i.vertex),n.deleteBuffer(i.texCoord),n.deleteBuffer(i.index)),i&&(delete i.vertex,delete i.texCoord,delete i.index),i=null,o=null,n=null,e=null}function ft(t){var e,n,r=!1;if(I=0,et.length)for(r=!0,e=0;e<et.length;e++)et[e].call(j,t);if(G&&G.length)for(r=!0,e=0;e<G.length;e++)((n=G[e]).dirty||n.checkDirty&&n.checkDirty())&&(n.dirty=!1,n.setDirty());for(e=0;e<J.length;e++)(n=J[e]).auto&&n.dirty&&n.render();if(nt.length)for(r=!0,e=0;e<nt.length;e++)nt[e].call(j);r&&!I&&(I=P(ft))}function dt(t,e,r,i,o,s){var a,c,u,h,l,f,d,v,g,m=0,b=o&&o.gl||n;if(b){for(a in o?(h=s&&s.width||o.width||b.canvas.width,l=s&&s.height||o.height||b.canvas.height):(h=s&&s.width||b.canvas.width,l=s&&s.height||b.canvas.height),t.use(),b.viewport(0,0,h,l),b.bindFramebuffer(b.FRAMEBUFFER,i),b.enableVertexAttribArray(t.location.position),b.enableVertexAttribArray(t.location.texCoord),e.texCoord&&(b.bindBuffer(b.ARRAY_BUFFER,e.texCoord),b.vertexAttribPointer(t.location.texCoord,e.texCoord.size,b.FLOAT,!1,0,0)),b.bindBuffer(b.ARRAY_BUFFER,e.vertex),b.vertexAttribPointer(t.location.position,e.vertex.size,b.FLOAT,!1,0,0),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e.index),s&&s.depth?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),s?void 0===s.blend||s.blend?(n.enable(n.BLEND),f=void 0===s.srcRGB?n.ONE:s.srcRGB,v=s.dstRGB||n.ZERO,d=void 0===s.srcAlpha?f:s.srcAlpha,g=void 0===s.dstAlpha?v:s.dstAlpha,n.blendFuncSeparate(f,v,d,g),n.blendEquation(s.blendEquation||n.FUNC_ADD)):n.disable(n.BLEND):(n.enable(n.BLEND),n.blendFunc(n.ONE,n.ZERO),n.blendEquation(n.FUNC_ADD)),r)r.hasOwnProperty(a)&&(c=r[a],(u=t.uniforms[a])&&(B(c,"WebGLTexture")?(b.activeTexture(b.TEXTURE0+m),b.bindTexture(b.TEXTURE_2D,c),u.set(m),m++):c instanceof p||c instanceof y||c instanceof S?c.texture&&(b.activeTexture(b.TEXTURE0+m),b.bindTexture(b.TEXTURE_2D,c.texture),u.set(m),m++):null!=c&&u.set(c)));s&&void 0!==s.clear&&!s.clear||(b.clearColor(0,0,0,0),b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)),b.drawElements(e.mode,e.length,b.UNSIGNED_SHORT,0),n.enable(n.DEPTH_TEST)}}function pt(t,e,n){var r,i;if(("string"!=typeof t||!e&&0!==e)&&(n&&"object"==typeof n||(n=e),e=t),"string"==typeof t&&f[t]||(t=null),e instanceof p||e instanceof y||e instanceof S)r=e;else if(e instanceof T||e instanceof C||e instanceof E){if(!(r=V[e.id]))throw new Error("Cannot connect a foreign node")}else{for("string"==typeof e&&isNaN(e)&&(e=L(e,["canvas","img","video"])),i=0;i<G.length;i++)if(r=G[i],(!t||t===r.hook)&&r.compare&&r.compare(e,n))return r;r=new p(t,e,n)}return r}function vt(t,e){var n,r,i;if(!(t instanceof y||t instanceof S))return!1;if(t===e)return!0;for(n in i=t.sources)if(i.hasOwnProperty(n)&&((r=i[n])===e||vt(r,e)))return!0;return!1}(a=function(){this.ready=!1,this.width=1,this.height=1,this.gl=n,this.uniforms={resolution:[this.width,this.height],transform:null},this.dirty=!0,this.isDestroyed=!1,this.seriously=j,this.listeners={},this.id=q,q++}).prototype.setReady=function(){var t;if(!this.ready&&(this.ready=!0,this.emit("ready"),this.targets))for(t=0;t<this.targets.length;t++)this.targets[t].setReady()},a.prototype.setUnready=function(){var t;if(this.ready&&(this.ready=!1,this.emit("unready"),this.targets))for(t=0;t<this.targets.length;t++)this.targets[t].setUnready()},a.prototype.setDirty=function(){var t;if(!this.dirty&&(this.emit("dirty"),this.dirty=!0,this.targets))for(t=0;t<this.targets.length;t++)this.targets[t].setDirty()},a.prototype.initFrameBuffer=function(t){n&&(this.frameBuffer=new $(n,this.width,this.height,t))},a.prototype.readPixels=function(t,e,r,i,o){var s=this.gl||n;if(!n)throw new Error("Cannot read pixels until a canvas is connected");if(this.frameBuffer||(this.initFrameBuffer(),this.setDirty()),this.render(),void 0===o)o=new Uint8Array(r*i*4);else if(!B(o,"Uint8Array"))throw new Error("Incompatible array type");return s.bindFramebuffer(n.FRAMEBUFFER,this.frameBuffer.frameBuffer),s.readPixels(t,e,r,i,n.RGBA,n.UNSIGNED_BYTE,o),o},a.prototype.resize=function(){var t,e;this.source?(t=this.source.width,e=this.source.height):this.sources&&this.sources.source?(t=this.sources.source.width,e=this.sources.source.height):this.inputs&&this.inputs.width?(t=this.inputs.width,e=this.inputs.height||t):this.inputs&&this.inputs.height?t=e=this.inputs.height:(t=1,e=1),t=Math.floor(t),e=Math.floor(e),this.width===t&&this.height===e||(this.width=t,this.height=e,this.emit("resize"),this.setDirty()),this.uniforms&&this.uniforms.resolution&&(this.uniforms.resolution[0]=t,this.uniforms.resolution[1]=e),this.frameBuffer&&this.frameBuffer.resize&&this.frameBuffer.resize(t,e)},a.prototype.on=function(t,e){var n,r=-1;t&&"function"==typeof e&&((n=this.listeners[t])?r=n.indexOf(e):n=this.listeners[t]=[],r<0&&n.push(e))},a.prototype.off=function(t,e){var n,r=-1;t&&"function"==typeof e&&(n=this.listeners[t])&&(r=n.indexOf(e))>=0&&n.splice(r,1)},a.prototype.emit=function(t){var e,n=this.listeners[t];if(n&&n.length)for(e=0;e<n.length;e++)H(n[e])},a.prototype.destroy=function(){var t,e;for(e in delete this.gl,delete this.seriously,this.listeners)this.listeners.hasOwnProperty(e)&&delete this.listeners[e];for(t in this.uniforms)this.uniforms.hasOwnProperty(t)&&delete this.uniforms[t];this.targets&&delete this.targets,this.frameBuffer&&this.frameBuffer.destroy&&(this.frameBuffer.destroy(),delete this.frameBuffer),(t=F.indexOf(this))>=0&&F.splice(t,1),delete V[this.id],this.isDestroyed=!0},T=function(t){var e,n=t;function r(t,e){var r,i,o;return o=n.effect.inputs[t],r=n.inputElements[t],"string"==typeof e&&isNaN(e)&&("enum"===o.type?o.options.hasOwnProperty(e)||(e=L(e,["select"])):"number"===o.type||"boolean"===o.type?e=L(e,["input","select"]):"image"===o.type&&(e=L(e,["canvas","img","video"]))),B(e,"HTMLInputElement")||B(e,"HTMLSelectElement")?(i=e.value,r&&r.element!==e&&(r.element.removeEventListener("change",r.listener,!0),r.element.removeEventListener("input",r.listener,!0),delete n.inputElements[t],r=null),r||(r={element:e,listener:function(t,r){return function(){var i,s;i="checkbox"===e.type?e.checked:r.value,s=n.setInput(t,i),"color"===o.type&&(s=W(s).substr(0,7)),s!==i&&(r.value=s)}}(t,e)},n.inputElements[t]=r,"range"===e.type?(e.addEventListener("input",r.listener,!0),e.addEventListener("change",r.listener,!0)):e.addEventListener("change",r.listener,!0)),r&&"checkbox"===e.type&&(i=e.checked)):(r&&(r.element.removeEventListener("change",r.listener,!0),r.element.removeEventListener("input",r.listener,!0),delete n.inputElements[t]),i=e),n.setInput(t,i),n.inputs[t]}function i(t){return function(e){var n=r(t,e);return n&&n.pub}}function o(t){return function(){var e=n.inputs[t];return e&&e.pub}}function s(t){return function(e){return r(t,e)}}function a(t){return function(){return n.inputs[t]}}for(e in n.effect.inputs)if(n.effect.inputs.hasOwnProperty(e)){if(void 0!==this[e])throw new Error("Cannot overwrite Seriously."+e);"image"===n.effect.inputs[e].type?Object.defineProperty(this,e,{configurable:!0,enumerable:!0,get:o(e),set:i(e)}):Object.defineProperty(this,e,{configurable:!0,enumerable:!0,get:a(e),set:s(e)})}Object.defineProperties(this,{effect:{enumerable:!0,configurable:!0,get:function(){return n.hook}},title:{enumerable:!0,configurable:!0,get:function(){return n.effect.title||n.hook}},width:{enumerable:!0,configurable:!0,get:function(){return n.width}},height:{enumerable:!0,configurable:!0,get:function(){return n.height}},id:{enumerable:!0,configurable:!0,get:function(){return n.id}}}),this.render=function(){return n.render(),this},this.readPixels=function(t,e,r,i,o){return n.readPixels(t,e,r,i,o)},this.on=function(t,e){n.on(t,e)},this.off=function(t,e){n.off(t,e)},this.inputs=function(t){var e,r,i,o;if(i=n.effect.inputs,t)return(r=i[t])?(e={type:r.type,defaultValue:r.defaultValue,title:r.title||t},"number"===r.type?(e.min=r.min,e.max=r.max,e.step=r.step,e.mod=r.mod):"enum"===r.type?e.options=U({},r.options):"vector"===r.type&&(e.dimensions=r.dimensions),r.description&&(e.description=r.description),e):null;for(o in e={},i)i.hasOwnProperty(o)&&(e[o]=this.inputs(o));return e},this.alias=function(t,e){return n.alias(t,e),this},this.matte=function(t){n.matte(t)},this.destroy=function(){var t,e;for(t in n.destroy(),this)this.hasOwnProperty(t)&&"isDestroyed"!==t&&"id"!==t&&((e=Object.getOwnPropertyDescriptor(this,t)).get||e.set||"function"!=typeof this[t]?delete this[t]:this[t]=w)},this.isDestroyed=function(){return n.isDestroyed},this.isReady=function(){return n.ready}},(y=function(t,e){var r,i,o,c,u={};for(r in a.call(this,e),this.gl=n,this.effectRef=h[t],this.sources={},this.targets=[],this.inputElements={},this.dirty=!0,this.shaderDirty=!0,this.hook=t,this.options=e,this.transform=null,this.effect=U({},this.effectRef),this.effectRef.definition&&U(this.effect,this.effectRef.definition.call(this,e)),Y(this.effect),this.uniforms.transform=s,this.inputs={},c=rt[t],this.effect.inputs)this.effect.inputs.hasOwnProperty(r)&&(void 0!==(i=this.effect.inputs[r]).defaultValue&&null!==i.defaultValue||("number"===i.type?i.defaultValue=Math.min(Math.max(0,i.min),i.max):"color"===i.type?i.defaultValue=[0,0,0,0]:"boolean"===i.type?i.defaultValue=!1:"string"===i.type?i.defaultValue="":"enum"===i.type&&(i.defaultValue=i.firstValue)),o=i.validate.call(this,i.defaultValue,i),c&&void 0!==c[r]&&(o=i.validate.call(this,c[r],i,i.defaultValue,o),c[r]=o,"image"===i.type&&(u[r]=o)),this.inputs[r]=o,i.uniform&&(this.uniforms[i.uniform]=i.defaultValue));for(r in n&&(this.initialize(),this.effect.commonShader&&this.buildShader()),this.updateReady(),this.inPlace=this.effect.inPlace,this.pub=new T(this),F.push(this),V[this.id]=this,Q.push(this),v[t].push(this),u)u.hasOwnProperty(r)&&this.setInput(r,u[r])}).prototype=Object.create(a.prototype),y.prototype.constructor=y,y.prototype.initialize=function(){if(!this.initialized){var t=this;this.baseShader=o,this.shape?this.model=at(this.shape,this.gl):this.model=i,"function"==typeof this.effect.initialize?this.effect.initialize.call(this,(function(){t.initFrameBuffer(!0)}),n):this.initFrameBuffer(!0),this.frameBuffer&&(this.texture=this.frameBuffer.texture),this.initialized=!0}},y.prototype.resize=function(){var t;for(a.prototype.resize.call(this),this.effect.resize&&this.effect.resize.call(this),t=0;t<this.targets.length;t++)this.targets[t].resize()},y.prototype.updateReady=function(){var t,e,n,r,i=!0;for(e in(n=this.effect).inputs)if(n.inputs.hasOwnProperty(e)&&"image"===this.effect.inputs[e].type&&(!this.sources[e]||!this.sources[e].ready)&&(!n.requires||n.requires.call(this,e,this.inputs))){i=!1;break}if(this.ready!==i&&(this.ready=i,this.emit(i?"ready":"unready"),r=i?"setReady":"setUnready",this.targets))for(t=0;t<this.targets.length;t++)this.targets[t][r]()},y.prototype.setReady=y.prototype.updateReady,y.prototype.setUnready=y.prototype.updateReady,y.prototype.addTarget=function(t){var e;for(e=0;e<this.targets.length;e++)if(this.targets[e]===t)return;this.targets.push(t)},y.prototype.removeTarget=function(t){var e=this.targets&&this.targets.indexOf(t);e>=0&&this.targets.splice(e,1)},y.prototype.removeSource=function(t){var e,n=t&&t.pub;for(e in this.inputs)!this.inputs.hasOwnProperty(e)||this.inputs[e]!==t&&this.inputs[e]!==n||(this.inputs[e]=null);for(e in this.sources)!this.sources.hasOwnProperty(e)||this.sources[e]!==t&&this.sources[e]!==n||(this.sources[e]=null)},y.prototype.buildShader=function(){var t,e=this.effect,r=this;function i(t){return O.test(t)?t:"#define SHADER_NAME seriously."+r.hook+"\n"+t}this.shaderDirty&&(e.commonShader&&it[this.hook]?(this.shader||it[this.hook].count++,this.shader=it[this.hook].shader):e.shader?(this.shader&&!e.commonShader&&this.shader.destroy(),(t=e.shader.call(this,this.inputs,{vertex:c,fragment:u},K.util))instanceof X?this.shader=t:t&&t.vertex&&t.fragment?this.shader=new X(n,i(t.vertex),i(t.fragment)):this.shader=o,e.commonShader&&(it[this.hook]={count:1,shader:this.shader})):this.shader=o,this.shaderDirty=!1)},y.prototype.render=function(){var t,e,r,i=this.effect,o=this;if(n){if(this.initialized||this.initialize(),this.shaderDirty&&this.buildShader(),this.dirty&&this.ready){for(t in this.sources)!this.sources.hasOwnProperty(t)||i.requires&&!i.requires.call(this,t,this.inputs)||(r="function"==typeof this.inPlace?this.inPlace(t):this.inPlace,this.sources[t].render(!r));this.frameBuffer&&(e=this.frameBuffer.frameBuffer),"function"==typeof i.draw?(i.draw.call(this,this.shader,this.model,this.uniforms,e,(function(t,e,n,r,i,s){dt(t,e,n,r,i||o,s)})),this.emit("render")):e&&(dt(this.shader,this.model,this.uniforms,e,this),this.emit("render")),this.dirty=!1}return this.texture}},y.prototype.setInput=function(t,e){var n,r,i,o,a,c=this;if(this.effect.inputs.hasOwnProperty(t)){if("image"===(n=this.effect.inputs[t]).type){if(e){if((e=pt(e))!==this.sources[t]){if(function(){var e,n=c.sources[t];if(n){for(e in c.sources)if(e!==t&&c.sources.hasOwnProperty(e)&&c.sources[e]===n)return;n.removeTarget(c)}}(),vt(e,this))throw new Error("Attempt to make cyclical connection.");this.sources[t]=e,e.addTarget(this)}}else delete this.sources[t],e=!1;r=this.sources[t],i=Object.keys(this.sources),!0===this.inPlace&&1===i.length?(o=this.sources[i[0]],this.uniforms.transform=o&&o.cumulativeMatrix||s):this.uniforms.transform=s}else a=rt[this.hook]&&void 0!==rt[this.hook][t]?rt[this.hook][t]:n.defaultValue,r=e=n.validate.call(this,e,n,a,this.inputs[t]);return this.inputs[t]===e&&"color"!==n.type&&"vector"!==n.type||(this.inputs[t]=e,n.uniform&&(this.uniforms[n.uniform]=r),"image"===n.type?(this.resize(),this.updateReady()):n.updateSources&&this.updateReady(),n.shaderDirty&&(this.shaderDirty=!0),this.setDirty(),n.update&&n.update.call(this,e)),e}},y.prototype.alias=function(t,e){var n=this;if(N.indexOf(e)>=0)throw new Error("'"+e+"' is a reserved name and cannot be used as an alias.");return this.effect.inputs.hasOwnProperty(t)&&(e||(e=t),j.removeAlias(e),tt[e]={node:this,input:t},Object.defineProperty(j,e,{configurable:!0,enumerable:!0,get:function(){return n.inputs[t]},set:function(e){return n.setInput(t,e)}})),this},y.prototype.matte=function(t){var e,n,r,i,o,s,a,c=[],u=[],h={};function l(t){var e,n,r,i,o,s,a,h,l,f,d,p=[];if(!t.simple){for(e=0;e<t.edges.length;e++)for(r=t.edges[e],n=e+1;n<t.edges.length;n++)i=t.edges[n],v=r[0],g=r[1],m=i[0],y=i[1],b=void 0,_=void 0,w=void 0,S=void 0,x=void 0,b=(y.x-m.x)*(v.y-m.y)-(y.y-m.y)*(v.x-m.x),_=(g.x-v.x)*(v.y-m.y)-(g.y-v.y)*(v.x-m.x),(o=!!((w=(y.y-m.y)*(g.x-v.x)-(y.x-m.x)*(g.y-v.y))&&(x=_/w,(S=b/w)>0&&S<=1&&x>0&&x<=1))&&{x:v.x+S*(g.x-v.x),y:v.y+S*(g.y-v.y)})&&(o.edge1=r,o.edge2=i,p.push(o));var v,g,m,y,b,_,w,S,x;if(p.length){for(l=[],e=0;e<p.length;e++)r=(o=p[e]).edge1,i=o.edge2,f={x:o.x,y:o.y,prev:r[0],next:i[1],id:u.length},t.vertices.push(f),u.push(f),d={x:o.x,y:o.y,prev:i[0],next:r[1],id:u.length},t.vertices.push(d),u.push(f),f.prev.next=f,f.next.prev=f,d.prev.next=d,d.next.prev=d;do{s={edges:[],vertices:[],simple:!0},l.push(s),a=h=t.vertices[0];do{e=t.vertices.indexOf(h),t.vertices.splice(e,1),s.edges.push([h,h.next]),s.vertices.push(h),h=h.next}while(h!==a)}while(t.vertices.length);for(e=c.indexOf(t),c.splice(e,1),e=0;e<l.length;e++)c.push(l[e])}else t.simple=!0}}function f(t){var e,n,r,i,o=t.vertices.length,s=0;for(e=o-1,n=0;n<o;e=n,n++)r=t.vertices[e],i=t.vertices[n],s+=r.x*i.y-i.x*r.y;return s>0}function d(t){var e,r,i,o,s,a,c,u,h,l,f,d=t.vertices,p=[],v=[];function g(t,e,n,r){var i,o,s,a,c,u,h,l,f,d,p,v;return i=n.x-e.x,o=n.y-e.y,s=t.x-n.x,a=t.y-n.y,c=e.x-t.x,u=e.y-t.y,h=r.x-t.x,l=r.y-t.y,f=r.x-e.x,d=r.y-e.y,p=r.x-n.x,v=r.y-n.y,i*d-o*f>=0&&s*v-a*p>=0&&c*l-u*h>=0}function m(t,e,n,r,i){var o,s,a,c;if(s=d[i[t]],a=d[i[e]],c=d[i[n]],0>(a.x-s.x)*(c.y-s.y)-(a.y-s.y)*(c.x-s.x))return!1;for(o=0;o<r;o++)if(o!==t&&o!==e&&o!==n&&g(s,a,c,d[i[o]]))return!1;return!0}if(r=d.length,t.clockWise)for(e=0;e<r;e++)p[e]=e;else for(e=0;e<r;e++)p[e]=r-1-e;for(o=2*(i=r),e=i-1;i>2;){if(o--<=0)return v;if(i<=(s=e)&&(s=0),i<=(e=s+1)&&(e=0),i<(a=e+1)&&(a=0),m(s,e,a,i,p)){for(c=p[s],u=p[e],h=p[a],t.clockWise?(v.push(d[c]),v.push(d[u]),v.push(d[h])):(v.push(d[h]),v.push(d[u]),v.push(d[c])),l=e,f=e+1;f<i;l++,f++)p[l]=p[f];o=2*--i}}n.indices=v}for(e=function(t){return t&&t.length&&Array.isArray(t)?Array.isArray(t[0])?Array.isArray(t[0])&&!isNaN(t[0][0])?[t]:t:[t]:[]}(t),r=0;r<e.length;r++){for(t=e[r],a=null,n={vertices:[],edges:[]},i=0;i<t.length;i++)"object"!=typeof(o=t[i])||isNaN(o.x)||isNaN(o.y)?o.length>=2&&!isNaN(o[0])&&!isNaN(o[1])&&(s={x:o[0],y:o[1],id:u.length}):s={x:o.x,y:o.y,id:u.length},s&&(a?(a.next=s,s.prev=a,s.next=n.vertices[0],n.vertices[0].prev=s):(n.head=s,s.next=s,s.prev=s),u.push(s),n.vertices.push(s),a=s);if(n.vertices.length>2)for(3===n.vertices.length&&(n.simple=!0),c.push(n),i=0;i<n.vertices.length;i++)s=n.vertices[i],n.edges.push([s,s.next])}for(r=c.length-1;r>=0;r--)l(n=c[r]);for(r=0;r<c.length;r++)(n=c[r]).clockWise=f(n),d(n);for(h.vertices=[],h.coords=[],r=0;r<u.length;r++)o=u[r],h.vertices.push(2*o.x-1),h.vertices.push(-2*o.y+1),h.vertices.push(-1),h.coords.push(o.x),h.coords.push(-1*o.y+1);for(h.vertices=new Float32Array(h.vertices),h.coords=new Float32Array(h.coords),h.indices=[],r=0;r<c.length;r++)for(n=c[r],i=0;i<n.indices.length;i++)o=n.indices[i],h.indices.push(o.id);h.indices=new Uint16Array(h.indices),this.shape=h,this.gl&&at(h,this.gl)},y.prototype.destroy=function(){var t,e,n,r=this.hook;for(e in this.effect.destroy&&"function"==typeof this.effect.destroy&&this.effect.destroy.call(this),delete this.effect,it[r]&&(it[r].count--,it[r].count||delete it[r]),this.shader&&this.shader.destroy&&this.shader!==o&&!it[r]&&this.shader.destroy(),delete this.shader,this.inputElements)this.inputElements.hasOwnProperty(e)&&((n=this.inputElements[e]).element.removeEventListener("change",n.listener,!0),n.element.removeEventListener("input",n.listener,!0));for(e in this.sources)this.sources.hasOwnProperty(e)&&((n=this.sources[e])&&n.removeTarget&&n.removeTarget(this),delete this.sources[e]);for(;this.targets.length;)(n=this.targets.pop())&&n.removeSource&&n.removeSource(this);for(e in this)this.hasOwnProperty(e)&&"id"!==e&&delete this[e];for(e in tt)tt.hasOwnProperty(e)&&(n=tt[e]).node===this&&j.removeAlias(e);(t=Q.indexOf(this))>=0&&Q.splice(t,1),(t=v[r].indexOf(this))>=0&&v[r].splice(t,1),a.prototype.destroy.call(this)},C=function(t){var e=t;Object.defineProperties(this,{original:{enumerable:!0,configurable:!0,get:function(){return e.source}},id:{enumerable:!0,configurable:!0,get:function(){return e.id}},width:{enumerable:!0,configurable:!0,get:function(){return e.width}},height:{enumerable:!0,configurable:!0,get:function(){return e.height}}}),this.render=function(){e.render()},this.update=function(){e.setDirty()},this.readPixels=function(t,n,r,i,o){return e.readPixels(t,n,r,i,o)},this.on=function(t,n){e.on(t,n)},this.off=function(t,n){e.off(t,n)},this.destroy=function(){var t,n;for(t in e.destroy(),this)this.hasOwnProperty(t)&&"isDestroyed"!==t&&"id"!==t&&((n=Object.getOwnPropertyDescriptor(this,t)).get||n.set||"function"!=typeof this[t]?delete this[t]:this[t]=w)},this.isDestroyed=function(){return e.isDestroyed},this.isReady=function(){return e.ready}},(p=function(t,e,r){var i,o,s=r||{},c=void 0===s.flip||s.flip,u=s.width,h=s.height,l=!1,d=this,p=!1;function v(t,e,n,r){var i=f[t];if(i.definition){if(!(i=i.definition.call(d,e,n,r)))return null;i=U(U({},f[t]),i)}return i}function g(t){return d.source===t}if(a.call(this),(t&&"string"!=typeof t||!e&&0!==e)&&(r&&"object"==typeof r||(r=e),e=t),"string"==typeof e&&isNaN(e)&&(e=L(e,["canvas","img","video"])),"string"==typeof t&&f[t]&&(o=v(t,e,r,!0))&&(this.hook=t,p=!0,l=o.deferTexture,this.plugin=o,this.compare=o.compare,this.checkDirty=o.checkDirty,o.source&&(e=o.source)),!o&&B(e))"CANVAS"===e.tagName?(this.width=e.width,this.height=e.height,this.render=this.renderImageCanvas,p=!0,this.hook="canvas",this.compare=g):"IMG"===e.tagName&&(this.width=e.naturalWidth||1,this.height=e.naturalHeight||1,e.complete&&e.naturalWidth||(l=!0),e.addEventListener("load",(function(){d.isDestroyed||(d.width===e.naturalWidth&&d.height===e.naturalHeight||(d.width=e.naturalWidth,d.height=e.naturalHeight,d.resize()),d.setDirty(),d.setReady())}),!0),this.render=this.renderImageCanvas,p=!0,this.hook="image",this.compare=g);else if(!o&&B(e,"WebGLTexture")){if(n&&!n.isTexture(e))throw new Error("Not a valid WebGL texture.");isNaN(u)?isNaN(h)||(u=h):isNaN(h)&&(h=u),this.width=u,this.height=h,void 0===s.flip&&(c=!1),p=!0,this.texture=e,this.initialized=!0,this.hook="texture",this.compare=g,this.render=function(){}}if(!p&&!o)for(i in f)if(f.hasOwnProperty(i)&&f[i]&&(o=v(i,e,r,!1))){this.hook=i,p=!0,l=o.deferTexture,this.plugin=o,this.compare=o.compare,this.checkDirty=o.checkDirty,o.source&&(e=o.source);break}if(!p)throw new Error("Unknown source type");this.source=e,void 0===this.flip&&(this.flip=c),this.targets=[],l||d.setReady(),this.pub=new C(this),F.push(this),V[this.id]=this,G.push(this),m[this.hook].push(this),G.length&&!I&&ft()}).prototype=Object.create(a.prototype),p.prototype.constructor=p,p.prototype.initialize=function(){var t;n&&!this.texture&&this.ready&&(t=n.createTexture(),n.bindTexture(n.TEXTURE_2D,t),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.bindTexture(n.TEXTURE_2D,null),this.texture=t,this.initialized=!0,this.allowRefresh=!0,this.setDirty())},p.prototype.initFrameBuffer=function(t){n&&(this.frameBuffer=new $(n,this.width,this.height,{texture:this.texture,useFloat:t}))},p.prototype.addTarget=function(t){var e;for(e=0;e<this.targets.length;e++)if(this.targets[e]===t)return;this.targets.push(t)},p.prototype.removeTarget=function(t){var e=this.targets&&this.targets.indexOf(t);e>=0&&this.targets.splice(e,1)},p.prototype.resize=function(){var t,e;if(this.uniforms.resolution[0]=this.width,this.uniforms.resolution[1]=this.height,this.framebuffer&&this.framebuffer.resize(this.width,this.height),this.emit("resize"),this.setDirty(),this.targets)for(t=0;t<this.targets.length;t++)(e=this.targets[t]).resize(),e.setTransformDirty&&e.setTransformDirty()},p.prototype.setReady=function(){var t;if(!this.ready&&(this.ready=!0,this.resize(),this.initialize(),this.emit("ready"),this.targets))for(t=0;t<this.targets.length;t++)this.targets[t].setReady()},p.prototype.render=function(){var t=this.source;n&&(t||0===t)&&this.ready&&(this.initialized||this.initialize(),this.allowRefresh&&this.plugin&&this.plugin.render&&(this.dirty||this.checkDirty&&this.checkDirty())&&this.plugin.render.call(this,n,dt,i,o)&&(this.dirty=!1,this.emit("render")))},p.prototype.renderImageCanvas=function(){var t=this.source;if(n&&t&&this.ready&&(this.initialized||this.initialize(),this.allowRefresh&&this.dirty)){n.bindTexture(n.TEXTURE_2D,this.texture),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,this.flip),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1);try{return n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t),this.dirty=!1,this.emit("render"),!0}catch(t){t.code===window.DOMException.SECURITY_ERR&&(this.allowRefresh=!1,K.logger.error("Unable to access cross-domain image"))}return!1}},p.prototype.destroy=function(){var t,e,r;for(this.plugin&&this.plugin.destroy&&this.plugin.destroy.call(this),n&&this.texture&&n.deleteTexture(this.texture);this.targets.length;)(r=this.targets.pop())&&r.removeSource&&r.removeSource(this);for(e in(t=G.indexOf(this))>=0&&G.splice(t,1),(t=m[this.hook].indexOf(this))>=0&&m[this.hook].splice(t,1),this)this.hasOwnProperty(e)&&"id"!==e&&delete this[e];a.prototype.destroy.call(this)},M=function(t){var e=t;Object.defineProperties(this,{source:{enumerable:!0,configurable:!0,get:function(){if(e.source)return e.source.pub},set:function(t){e.setSource(t)}},original:{enumerable:!0,configurable:!0,get:function(){return e.target}},width:{enumerable:!0,configurable:!0,get:function(){return e.width},set:function(t){!isNaN(t)&&t>0&&e.width!==t&&(e.width=t,e.resize(),e.setTransformDirty())}},height:{enumerable:!0,configurable:!0,get:function(){return e.height},set:function(t){!isNaN(t)&&t>0&&e.height!==t&&(e.height=t,e.resize(),e.setTransformDirty())}},id:{enumerable:!0,configurable:!0,get:function(){return e.id}}}),this.render=function(){e.render()},this.readPixels=function(t,n,r,i,o){return e.readPixels(t,n,r,i,o)},this.on=function(t,n){e.on(t,n)},this.off=function(t,n){e.off(t,n)},this.go=function(t){e.go(t)},this.stop=function(){e.stop()},this.getTexture=function(){return e.frameBuffer.texture},this.destroy=function(){var t,n;for(t in e.destroy(),this)this.hasOwnProperty(t)&&"isDestroyed"!==t&&"id"!==t&&((n=Object.getOwnPropertyDescriptor(this,t)).get||n.set||"function"!=typeof this[t]?delete this[t]:this[t]=w)},this.inputs=function(t){return{source:{type:"image"}}},this.isDestroyed=function(){return e.isDestroyed},this.isReady=function(){return e.ready}},((x=function(t,e,s){var h,l,f,p,v,g,m,y,_,S=this,x=!1;function T(t,e,r,s){var a=d[t];if(a.definition){if(!(a=a.definition.call(S,e,r,s)))return null;a=U(U({},d[t]),a),S.hook=_,x=!0,S.plugin=a,S.compare=a.compare,a.target&&(e=a.target),a.gl&&!S.gl&&(S.gl=a.gl,n||ut(a.gl)),S.gl===n&&(S.model=i,S.shader=o)}return a}if(a.call(this),(t&&"string"!=typeof t||!e&&0!==e)&&(s&&"object"==typeof s||(s=e),e=t),l=void 0===(h=s||{}).flip||h.flip,f=parseInt(h.width,10),p=parseInt(h.height,10),g=h.debugContext,"string"==typeof t&&d[t]&&T(t,e,h,!0),this.renderToTexture=h.renderToTexture,B(e,"WebGLFramebuffer"))if(m=e,B(h,"HTMLCanvasElement"))e=h;else if(B(h,"WebGLRenderingContext"))e=h.canvas;else if(B(h.canvas,"HTMLCanvasElement"))e=h.canvas;else{if(!B(h.context,"WebGLRenderingContext"))throw new Error("Must provide a canvas with WebGLFramebuffer target");e=h.context.canvas}if(B(e,"HTMLCanvasElement")){if(f=e.width,p=e.height,(!n||n.canvas!==e&&h.allowSecondaryWebGL)&&(v=z(e,{alpha:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!0,stencil:!0,debugContext:g})),v)n&&n!==v?(this.gl=v,this.frameBuffer={frameBuffer:m||null},this.shader=new X(this.gl,c,u),this.model=ct.call(this,this.gl),this.pixels=null,this.texture=this.gl.createTexture(),this.gl.bindTexture(n.TEXTURE_2D,this.texture),this.gl.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),this.gl.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),this.gl.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),this.gl.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),this.render=this.renderSecondaryWebGL):(r||(r=this),n||ut(v),this.render=this.renderWebGL,h.renderToTexture?n&&(this.frameBuffer=new $(n,f,p,!1)):this.frameBuffer={frameBuffer:m||null});else{if(!h.allowSecondaryWebGL&&n&&n.canvas!==e)throw new Error("Only one WebGL target canvas allowed. Set allowSecondaryWebGL option to create secondary context.");this.render=w,K.logger.log("Unable to create WebGL context.")}x=!0}if(!x)for(_ in d)if(d.hasOwnProperty(_)&&d[_]&&T(_,e,h,!1))break;if(!x)throw new Error("Unknown target type");b&&((y=b.get(e))?K.logger.warn("Target already in use by another instance",e,Object.keys(y).map((function(t){return y[t]}))):(y={},b.set(e,y)),y[j.id]=j),this.target=e,this.transform=null,this.transformDirty=!0,this.flip=l,f&&(this.width=f),p&&(this.height=p),this.uniforms.resolution[0]=this.width,this.uniforms.resolution[1]=this.height,void 0!==h.auto?this.auto=h.auto:this.auto=ot,this.frames=0,this.pub=new M(this),F.push(this),V[this.id]=this,J.push(this)}).prototype=Object.create(a.prototype)).constructor=x,x.prototype.setSource=function(t){var e;(e=pt(t))!==this.source&&(this.source&&this.source.removeTarget(this),this.source=e,e.addTarget(this),e&&(this.resize(),e.ready?this.setReady():this.setUnready()),this.setDirty())},x.prototype.setDirty=function(){this.dirty=!0,this.auto&&!I&&(I=P(ft))},x.prototype.resize=function(){B(this.target,"HTMLCanvasElement")?this.width===this.target.width&&this.height===this.target.height||(this.target.width=this.width,this.target.height=this.height,this.uniforms.resolution[0]=this.width,this.uniforms.resolution[1]=this.height,this.emit("resize"),this.setTransformDirty()):this.plugin&&this.plugin.resize&&this.plugin.resize.call(this),!this.source||this.source.width===this.width&&this.source.height===this.height||this.transform||(this.transform=new Float32Array(16))},x.prototype.setTransformDirty=function(){this.transformDirty=!0,this.setDirty()},x.prototype.go=function(){this.auto=!0,this.setDirty()},x.prototype.stop=function(){this.auto=!1},x.prototype.render=function(){n&&this.plugin&&this.plugin.render&&this.plugin.render.call(this,dt,o,i)},x.prototype.renderWebGL=function(){var t,e,r;if(this.resize(),n&&this.dirty&&this.ready){if(!this.source)return;this.source.render(),this.uniforms.source=this.source.texture,this.source.width===this.width&&this.source.height===this.height?this.uniforms.transform=this.source.cumulativeMatrix||s:this.transformDirty&&(t=this.transform,A.copy(t,this.source.cumulativeMatrix||s),e=this.source.width/this.width,r=this.source.height/this.height,t[0]*=e,t[1]*=e,t[2]*=e,t[3]*=e,t[4]*=r,t[5]*=r,t[6]*=r,t[7]*=r,this.uniforms.transform=t,this.transformDirty=!1),dt(o,i,this.uniforms,this.frameBuffer.frameBuffer,this,R),this.emit("render"),this.dirty=!1}},x.prototype.renderSecondaryWebGL=function(){var t,e,n,r,i;this.dirty&&this.ready&&this.source&&(this.emit("render"),this.source.render(!0),t=this.source.width,e=this.source.height,this.pixels&&this.pixels.length===t*e*4||(this.pixels=new Uint8Array(t*e*4)),this.source.readPixels(0,0,t,e,this.pixels),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,t,e,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.pixels),t===this.width&&e===this.height?this.uniforms.transform=s:this.transformDirty&&(n=this.transform,A.copy(n,s),r=this.source.width/this.width,i=this.source.height/this.height,n[0]*=r,n[1]*=r,n[2]*=r,n[3]*=r,n[4]*=i,n[5]*=i,n[6]*=i,n[7]*=i,this.uniforms.transform=n,this.transformDirty=!1),this.uniforms.source=this.texture,dt(this.shader,this.model,this.uniforms,null,this,R),this.dirty=!1)},x.prototype.removeSource=function(t){this.source!==t&&this.source!==t.pub||(this.source=null)},x.prototype.destroy=function(){var t,n;this.source&&this.source.removeTarget&&this.source.removeTarget(this),b&&(delete(n=b.get(this.target))[j.id],Object.keys(n).length||b.delete(this.target)),this.plugin&&this.plugin.destroy&&this.plugin.destroy.call(this),delete this.source,delete this.target,delete this.pub,delete this.uniforms,delete this.pixels,delete this.auto,(t=J.indexOf(this))>=0&&J.splice(t,1),a.prototype.destroy.call(this),this===r&&(e.removeEventListener("webglcontextrestored",ht,!1),lt(),r=null)},E=function(t){var e,n=t,r=this;function i(t,e){Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get:function(){return e.get.call(n)},set:function(r){!function(t,e,r){var i,o,s;i=n.inputElements[t],"string"==typeof r&&isNaN(r)&&("enum"===e.type?e.options.hasOwnProperty(r)||(r=L(r,["select"])):"number"===e.type||"boolean"===e.type?r=L(r,["input","select"]):"image"===e.type&&(r=L(r,["canvas","img","video"]))),B(r,"HTMLInputElement")||B(r,"HTMLSelectElement")?(o=r.value,i&&i.element!==r&&(i.element.removeEventListener("change",i.listener,!0),i.element.removeEventListener("input",i.listener,!0),delete n.inputElements[t],i=null),i||(i={element:r,listener:(s=r,function(){var e,i;e="checkbox"===r.type?r.checked:s.value,i=n.setInput(t,e),"color"===r.type&&(i=W(i)),i!==e&&(s.value=i)})},n.inputElements[t]=i,"range"===r.type?(r.addEventListener("input",i.listener,!0),r.addEventListener("change",i.listener,!0)):r.addEventListener("change",i.listener,!0)),i&&"checkbox"===r.type&&(o=r.checked)):(i&&(i.element.removeEventListener("change",i.listener,!0),i.element.removeEventListener("input",i.listener,!0),delete n.inputElements[t]),o=r),n.setInput(t,o)}(t,e,r)}})}function o(t){return function(){t.apply(n,arguments)&&n.setTransformDirty()}}for(e in Object.defineProperties(this,{transform:{enumerable:!0,configurable:!0,get:function(){return n.hook}},title:{enumerable:!0,configurable:!0,get:function(){return n.plugin.title||n.hook}},width:{enumerable:!0,configurable:!0,get:function(){return n.width}},height:{enumerable:!0,configurable:!0,get:function(){return n.height}},id:{enumerable:!0,configurable:!0,get:function(){return n.id}},source:{enumerable:!0,configurable:!0,get:function(){return n.source&&n.source.pub},set:function(t){n.setSource(t)}}}),n.methods)n.methods.hasOwnProperty(e)&&(this[e]=o(n.methods[e]));for(e in n.inputs)n.inputs.hasOwnProperty(e)&&i(e,n.inputs[e]);this.update=function(){n.setDirty()},this.inputs=function(t){var e,r,i,o;if(i=n.plugin.inputs,t)return!(r=i[t])||r.method?null:(e={type:r.type,defaultValue:r.defaultValue,title:r.title||t},"number"===r.type?(e.min=r.min,e.max=r.max,e.step=r.step,e.mod=r.mod):"enum"===r.type?e.options=U({},r.options):"vector"===r.type&&(e.dimensions=r.dimensions),r.description&&(e.description=r.description),e);for(o in e={},i)i.hasOwnProperty(o)&&!i[o].method&&(e[o]=this.inputs(o));return e},this.alias=function(t,e){return n.alias(t,e),this},this.on=function(t,e){n.on(t,e)},this.off=function(t,e){n.off(t,e)},this.destroy=function(){var t,e;for(t in n.destroy(),this)this.hasOwnProperty(t)&&"isDestroyed"!==t&&"id"!==t&&((e=Object.getOwnPropertyDescriptor(this,t)).get||e.set||"function"!=typeof this[t]?delete this[t]:this[t]=w)},this.isDestroyed=function(){return n.isDestroyed},this.isReady=function(){return n.ready}},(S=function(t,e){var n,r,i,o,s;for(n in this.matrix=new Float32Array(16),this.cumulativeMatrix=new Float32Array(16),this.ready=!1,this.width=1,this.height=1,this.seriously=j,this.transformRef=l[t],this.hook=t,this.id=q,q++,this.options=e,this.sources=null,this.targets=[],this.inputElements={},this.inputs={},this.methods={},this.listeners={},this.texture=null,this.frameBuffer=null,this.uniforms=null,this.dirty=!0,this.transformDirty=!0,this.renderDirty=!1,this.isDestroyed=!1,this.transformed=!1,this.plugin=U({},this.transformRef),this.transformRef.definition&&U(this.plugin,this.transformRef.definition.call(this,e)),this.plugin.inputs)this.plugin.inputs.hasOwnProperty(n)&&((r=this.plugin.inputs[n]).method&&"function"==typeof r.method?this.methods[n]=r.method:"function"==typeof r.set&&"function"==typeof r.get&&(this.inputs[n]=r));for(n in Y(this.plugin),s=rt[t],this.plugin.inputs)this.plugin.inputs.hasOwnProperty(n)&&"function"==typeof(r=this.plugin.inputs[n]).set&&"function"==typeof r.get&&"function"!=typeof r.method&&(i=r.get.call(this),o=void 0===r.defaultValue?i:r.defaultValue,o=r.validate.call(this,o,r,i),s&&void 0!==s[n]&&(o=r.validate.call(this,s[n],r,r.defaultValue,o),s[n]=o),o!==i&&r.set.call(this,o));F.push(this),V[this.id]=this,this.pub=new E(this),Z.push(this),g[t].push(this)}).prototype=Object.create(a.prototype),S.prototype.constructor=S,S.prototype.setDirty=function(){this.renderDirty=!0,a.prototype.setDirty.call(this)},S.prototype.setTransformDirty=function(){var t,e;for(this.transformDirty=!0,this.dirty=!0,this.renderDirty=!0,t=0;t<this.targets.length;t++)(e=this.targets[t]).setTransformDirty?e.setTransformDirty():e.setDirty()},S.prototype.resize=function(){var t;for(a.prototype.resize.call(this),this.plugin.resize&&this.plugin.resize.call(this),t=0;t<this.targets.length;t++)this.targets[t].resize();this.setTransformDirty()},S.prototype.setSource=function(t){var e;if((e=pt(t))!==this.source){if(vt(e,this))throw new Error("Attempt to make cyclical connection.");this.source&&this.source.removeTarget(this),this.source=e,e.addTarget(this),e&&e.ready?this.setReady():this.setUnready(),this.resize()}},S.prototype.addTarget=function(t){var e;for(e=0;e<this.targets.length;e++)if(this.targets[e]===t)return;this.targets.push(t)},S.prototype.removeTarget=function(t){var e=this.targets&&this.targets.indexOf(t);e>=0&&this.targets.splice(e,1),this.targets&&this.targets.length&&this.resize()},S.prototype.setInput=function(t,e){var n,r,i;if(this.plugin.inputs.hasOwnProperty(t))return n=this.plugin.inputs[t],r=rt[this.hook]&&void 0!==rt[this.hook][t]?rt[this.hook][t]:n.defaultValue,i=n.get.call(this),void 0===r&&(r=i),e=n.validate.call(this,e,n,r,i),n.set.call(this,e)&&this.setTransformDirty(),n.get.call(this)},S.prototype.alias=function(t,e){var n,r,i=this;if(N.indexOf(e)>=0)throw new Error("'"+e+"' is a reserved name and cannot be used as an alias.");return this.plugin.inputs.hasOwnProperty(t)&&(e||(e=t),j.removeAlias(e),(n=this.inputs[t])?(r=i.inputs[t],Object.defineProperty(j,e,{configurable:!0,enumerable:!0,get:function(){return r.get.call(i)},set:function(t){r.set.call(i,t)&&i.setTransformDirty()}})):(n=this.methods[t])&&(r=n,j[e]=function(){r.apply(i,arguments)&&i.setTransformDirty()}),n&&(tt[e]={node:this,input:t})),this},S.prototype.render=function(t){return this.source?(this.source.render(),this.transformDirty&&(this.transformed?this.source.cumulativeMatrix?A.multiply(this.cumulativeMatrix,this.matrix,this.source.cumulativeMatrix):A.copy(this.cumulativeMatrix,this.matrix):A.copy(this.cumulativeMatrix,this.source.cumulativeMatrix||s),this.transformDirty=!1),t&&n?(this.renderDirty&&(this.frameBuffer||(this.uniforms={resolution:[this.width,this.height]},this.frameBuffer=new $(n,this.width,this.height)),this.uniforms.source=this.source.texture,this.uniforms.transform=this.cumulativeMatrix||s,dt(o,i,this.uniforms,this.frameBuffer.frameBuffer,this),this.renderDirty=!1),this.texture=this.frameBuffer.texture):this.source?this.texture=this.source.texture:this.texture=null,this.dirty=!1,this.texture):(this.transformDirty&&(A.copy(this.cumulativeMatrix,this.matrix),this.transformDirty=!1),this.texture=null,void(this.dirty=!1))},S.prototype.readPixels=function(t,e,r,i,o){var s=this.gl||n;if(!n)throw new Error("Cannot read pixels until a canvas is connected");if(this.render(!0),void 0===o)o=new Uint8Array(r*i*4);else if(!B(o,"Uint8Array"))throw new Error("Incompatible array type");return s.bindFramebuffer(n.FRAMEBUFFER,this.frameBuffer.frameBuffer),s.readPixels(t,e,r,i,n.RGBA,n.UNSIGNED_BYTE,o),o},S.prototype.destroy=function(){var t,e,n,r=this.hook;for(t in this.plugin.destroy&&"function"==typeof this.plugin.destroy&&this.plugin.destroy.call(this),delete this.effect,this.frameBuffer&&(this.frameBuffer.destroy(),delete this.frameBuffer,delete this.texture),this.inputElements)this.inputElements.hasOwnProperty(t)&&((n=this.inputElements[t]).element.removeEventListener("change",n.listener,!0),n.element.removeEventListener("input",n.listener,!0));for(this.source&&this.source.removeTarget(this);this.targets.length;)(n=this.targets.pop())&&n.removeSource&&n.removeSource(this);for(e in this)this.hasOwnProperty(e)&&"id"!==e&&delete this[e];for(e in tt)tt.hasOwnProperty(e)&&(n=tt[e]).node===this&&j.removeAlias(e);(t=Z.indexOf(this))>=0&&Z.splice(t,1),(t=g[r].indexOf(this))>=0&&g[r].splice(t,1),a.prototype.destroy.call(this)},S.prototype.setReady=a.prototype.setReady,S.prototype.setUnready=a.prototype.setUnready,S.prototype.on=a.prototype.on,S.prototype.off=a.prototype.off,S.prototype.emit=a.prototype.emit,(t=B(t,"HTMLCanvasElement")?{canvas:t}:t||{}).canvas,this.effect=function(t,e){if(!h[t])throw new Error("Unknown effect: "+t);return new y(t,e).pub},this.source=function(t,e,n){return pt(t,e,n).pub},this.transform=function(e,n){if("string"!=typeof e&&(n=e,e=!1),e){if(!l[e])throw new Error("Unknown transform: "+e)}else if(e=t&&t.defaultTransform||"2d",!l[e])throw new Error("No transform specified");return new S(e,n).pub},this.target=function(t,e,n){var r,i,o;for(t&&"string"==typeof t&&!d[t]&&(i=document.querySelector(t)),("string"!=typeof t||!e&&0!==e||i)&&(n&&"object"==typeof n||(n=e),e=i||t,t=null),"string"==typeof e&&isNaN(e)&&(e=document.querySelector(e)),o=0;o<J.length;o++)if(r=J[o],(!t||t===r.hook)&&(r.target===e||r.compare&&r.compare(e,n)))return r.pub;return(r=new x(t,e,n)).pub},this.aliases=function(){return Object.keys(tt)},this.removeAlias=function(t){tt[t]&&(delete this[t],delete tt[t])},this.defaults=function(t,e){var n;if(t)if("object"!=typeof t)null===e?delete rt[t]:"object"==typeof e&&(rt[t]=U({},e));else for(n in t)t.hasOwnProperty(n)&&this.defaults(n,t[n]);else if(null===t)for(n in rt)rt.hasOwnProperty(n)&&delete rt[n]},this.go=function(t,e){var n;for("function"==typeof t&&et.indexOf(t)<0&&et.push(t),"function"==typeof e&&nt.indexOf(e)<0&&nt.push(e),ot=!0,n=0;n<J.length;n++)J[n].go();I||!et.length&&!nt.length||ft()},this.stop=function(){et.length=0,nt.length=0,k(I),I=0},this.render=function(){var e;for(e=0;e<J.length;e++)J[e].render(t)},this.destroy=function(){for(var t,e;F.length;)F[0].pub.destroy();for(t in this)this.hasOwnProperty(t)&&"isDestroyed"!==t&&"id"!==t&&((e=Object.getOwnPropertyDescriptor(this,t)).get||e.set||"function"!=typeof this[t]?delete this[t]:this[t]=w);j=null,G=[],J=[],Q=[],F=[],et.length=0,nt.length=0,k(I),I=0,st=!0},this.isDestroyed=function(){return st},this.incompatible=function(t){var e,n,r;if(r=K.incompatible(t))return r;if(!t){for(e in v)if(v.hasOwnProperty(e)&&v[e].length&&(n=h[e])&&"function"==typeof n.compatible&&!n.compatible.call(this))return"plugin-"+e;for(e in m)if(m.hasOwnProperty(e)&&m[e].length&&(n=f[e])&&"function"==typeof n.compatible&&!n.compatible.call(this))return"source-"+e}return!1},this.isNode=function(t){var e;return!(!t||!(e=V[t.id])||e.isDestroyed)},this.isSource=function(t){return this.isNode(t)&&t instanceof C},this.isEffect=function(t){return this.isNode(t)&&t instanceof T},this.isTransform=function(t){return this.isNode(t)&&t instanceof E},this.isTarget=function(t){return this.isNode(t)&&t instanceof M},Object.defineProperties(this,{id:{enumerable:!0,configurable:!0,get:function(){return D}}}),this.defaults(t.defaults)}window.addEventListener("message",(function(t){t.source===window&&"seriously-timeout-message"===t.data&&(t.stopPropagation(),p.length>0&&p.shift()())}),!0),$.prototype.resize=function(t,e){var n=this.gl;this.width===t&&this.height===e||(this.width=t,this.height=e,n&&(n.bindTexture(n.TEXTURE_2D,this.texture),n.bindFramebuffer(n.FRAMEBUFFER,this.frameBuffer),n.bindRenderbuffer(n.RENDERBUFFER,this.renderBuffer),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,t,e,0,n.RGBA,n.UNSIGNED_BYTE,null),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,t,e),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,this.texture,0),n.bindTexture(n.TEXTURE_2D,null),n.bindRenderbuffer(n.RENDERBUFFER,null),n.bindFramebuffer(n.FRAMEBUFFER,null)))},$.prototype.destroy=function(){var t=this.gl;t&&(t.deleteFramebuffer(this.frameBuffer),t.deleteRenderbuffer(this.renderBuffer),this.ownTexture&&t.deleteTexture(this.texture)),delete this.frameBuffer,delete this.renderBuffer,delete this.texture,delete this.gl},X.prototype.use=function(){this.gl.useProgram(this.program)},K.incompatible=function(t){var e,n,r;if(void 0===o&&((e=document.createElement("canvas"))&&e.getContext?window.WebGLRenderingContext?(n=G())||(o="context"):o="webgl":o="canvas"),o)return o;if(t){if((r=h[t])&&"function"==typeof r.compatible&&!r.compatible(n))return"plugin-"+t;if((r=f[t])&&"function"==typeof r.compatible&&!r.compatible(n))return"source-"+t}return!1},K.plugin=function(t,e,n){var r;if(h[t])K.logger.warn("Effect ["+t+"] already loaded");else if(void 0===n&&"object"==typeof e&&(n=e),n)return r=U({},n),"function"==typeof e&&(r.definition=e),r.reserved=I,r.inputs&&Y(r),r.title||(r.title=t),h[t]=r,v[t]=[],r},K.removePlugin=function(t){var e;if(!t)return this;if(!h[t])return this;if(e=v[t]){for(;e.length;)e.shift().destroy();delete v[t]}return delete h[t],this},K.source=function(t,e,n){var r;if(f[t])K.logger.warn("Source ["+t+"] already loaded");else if(void 0===n&&"object"==typeof e&&(n=e),n||e)return r=U({},n),"function"==typeof e&&(r.definition=e),r.title||(r.title=t),f[t]=r,m[t]=[],r},K.removeSource=function(t){var e;if(!t)return this;if(!f[t])return this;if(e=m[t]){for(;e.length;)e.shift().destroy();delete m[t]}return delete f[t],this},K.transform=function(t,e,n){var r;if(l[t])K.logger.warn("Transform ["+t+"] already loaded");else if(void 0===n&&"object"==typeof e&&(n=e),n||e)return r=U({},n),"function"==typeof e&&(r.definition=e),r.reserved=D,r.inputs&&Y(r),r.title||(r.title=t),l[t]=r,g[t]=[],r},K.removeTransform=function(t){var e;if(!t)return this;if(!l[t])return this;if(e=g[t]){for(;e.length;)e.shift().destroy();delete g[t]}return delete l[t],this},K.target=function(t,e,n){var r;if(d[t])K.logger.warn("Target ["+t+"] already loaded");else if(void 0===n&&"object"==typeof e&&(n=e),n||e)return r=U({},n),"function"==typeof e&&(r.definition=e),r.title||(r.title=t),d[t]=r,y[t]=[],r},K.removeTarget=function(t){var e;if(!t)return this;if(!d[t])return this;if(e=y[t]){for(;e.length;)e.shift().destroy();delete y[t]}return delete d[t],this},K.inputValidators={color:function(t,e,n,r){var o,s,a,c;if(s=r||[],"string"==typeof t){if((a=x.exec(t))&&a.length){if(a.length<3)return s[0]=s[1]=s[2]=s[3]=0,s;for(s[3]=1,c=0;c<3;c++)s[c]=parseFloat(a[c+2])/255;return isNaN(a[6])||(s[3]=parseFloat(a[6])),"hsl"===a[1].toLowerCase()?V(s[0],s[1],s[2],s[3],s):s}if((a=T.exec(t))&&a.length)return 3===(o=a[1]).length?(s[0]=parseInt(o[0],16)/15,s[1]=parseInt(o[1],16)/15,s[2]=parseInt(o[2],16)/15,s[3]=1):4===o.length?(s[0]=parseInt(o[0],16)/15,s[1]=parseInt(o[1],16)/15,s[2]=parseInt(o[2],16)/15,s[3]=parseInt(o[3],16)/15):6===o.length?(s[0]=parseInt(o.substr(0,2),16)/255,s[1]=parseInt(o.substr(2,2),16)/255,s[2]=parseInt(o.substr(4,2),16)/255,s[3]=1):8===o.length?(s[0]=parseInt(o.substr(0,2),16)/255,s[1]=parseInt(o.substr(2,2),16)/255,s[2]=parseInt(o.substr(4,2),16)/255,s[3]=parseInt(o.substr(6,2),16)/255):s[0]=s[1]=s[2]=s[3]=0,s;if(a=S[t.toLowerCase()]){for(c=0;c<4;c++)s[c]=a[c];return s}return i||(i=document.createElement("canvas").getContext("2d")),i.fillStyle=t,(o=i.fillStyle)&&"#000000"!==o?K.inputValidators.color(o,e,n,r):(s[0]=s[1]=s[2]=s[3]=0,s)}if(q(t)){if((s=t).length<3)return s[0]=s[1]=s[2]=s[3]=0,s;for(c=0;c<3;c++)if(isNaN(s[c]))return s[0]=s[1]=s[2]=s[3]=0,s;return s.length<4&&s.push(1),s}if("number"==typeof t)return s[0]=s[1]=s[2]=t,s[3]=1,s;if("object"==typeof t){for(c=0;c<4;c++)null===t[o=E[c]]||isNaN(t[o])?s[c]=3===c?1:0:s[c]=t[o];return s}return s[0]=s[1]=s[2]=s[3]=0,s},number:function(t,e,n){return t=parseFloat(t),isNaN(t)?n||0:(e.mod&&(t-=e.mod*Math.floor(t/e.mod)),t<e.min?e.min:t>e.max?e.max:e.step?Math.round(t/e.step)*e.step:t)},enum:function(t,e,n){var r=e.options||[];return"string"==typeof t?t=t.toLowerCase():"number"==typeof t?t=t.toString():t||(t=""),r.hasOwnProperty(t)?t:n||""},vector:function(t,e,n,r){var i,o,s,a=e.dimensions||4;if(i=r||[],q(t)){for(o=0;o<a;o++)i[o]=t[o]||0;return i}if("object"==typeof t){for(o=0;o<a;o++)void 0===t[s=C[o]]&&(s=E[o]),i[o]=t[s]||0;return i}for(t=parseFloat(t)||0,o=0;o<a;o++)i[o]=t;return i},boolean:function(t){return!!t&&(!t||!t.toLowerCase||"false"!==t.toLowerCase())},string:function(t){return"string"==typeof t?t:0===t||t?t.toString?t.toString():String(t):""}},K.prototype.effects=K.effects=function(){var t,e,n,r,i,o={};for(t in h)if(h.hasOwnProperty(t)){for(i in n={title:(e=h[t]).title||t,description:e.description||"",inputs:{}},e.inputs)e.inputs.hasOwnProperty(i)&&(r=e.inputs[i],n.inputs[i]={type:r.type,defaultValue:r.defaultValue,step:r.step,min:r.min,max:r.max,mod:r.mod,minCount:r.minCount,maxCount:r.maxCount,dimensions:r.dimensions,title:r.title||i,description:r.description||"",options:r.options||[]});o[t]=n}return o},window.Float32Array&&(s=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])),window.Seriously&&"object"==typeof window.Seriously&&function(){var t;for(t in window.Seriously)window.Seriously.hasOwnProperty(t)&&"plugin"!==t&&"object"==typeof window.Seriously[t]&&K.plugin(t,window.Seriously[t])}(),K.logger={log:F("log"),info:F("info"),warn:F("warn"),error:F("error")},K.util={mat4:A,checkSource:function(t){var e,n,r,i;if(!(e=L(t,["img","canvas","video"])))return!1;if(!(n=document.createElement("canvas")))return K.logger.warn("Browser does not support canvas or Seriously.js"),!1;if(0===e.naturalWidth&&"IMG"===e.tagName)return K.logger.warn("Image not loaded"),!1;if(0===e.readyState&&0===e.videoWidth&&"VIDEO"===e.tagName)return K.logger.warn("Video not loaded"),!1;if(r=G()){(i=r.createTexture())||K.logger.error("Test WebGL context has been lost"),r.bindTexture(r.TEXTURE_2D,i);try{r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,e)}catch(t){return t.code===window.DOMException.SECURITY_ERR?K.logger.log("Unable to access cross-domain image"):K.logger.error("Error storing image to texture: "+t.message),r.deleteTexture(i),!1}r.deleteTexture(i)}else{r=n.getContext("2d");try{r.drawImage(e,0,0),r.getImageData(0,0,1,1)}catch(t){return t.code===window.DOMException.SECURITY_ERR?K.logger.log("Unable to access cross-domain image"):K.logger.error("Error drawing image to canvas: "+t.message),!1}}return!0},hslToRgb:V,colors:S,setTimeoutZero:H,ShaderProgram:X,FrameBuffer:$,requestAnimationFrame:P,shader:{makeNoise:"float makeNoise(float u, float v, float timer) {\n\tfloat x = u * v * mod(timer * 1000.0, 100.0);\n\tx = mod(x, 13.0) * mod(x, 127.0);\n\tfloat dx = mod(x, 0.01);\n\treturn clamp(0.1 + dx * 100.0, 0.0, 1.0);\n}\n",random:"#ifndef RANDOM\n#define RANDOM\nfloat random(vec2 n) {\n\treturn 0.5 + 0.5 * fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* 43758.5453);\n}\n#endif\n"}},K.source("video",(function(t,e,n){var r,i,o=this,s=!1,c=!1,u=!1,h=0;function l(){t.removeEventListener("loadedmetadata",l,!0),s||(t.videoWidth?(o.width===t.videoWidth&&o.height===t.videoHeight||(o.width=t.videoWidth,o.height=t.videoHeight,o.resize()),c&&o.setReady()):(c=!0,setTimeout(l,50)))}function f(){u=!0}function d(){u=!1,o.setDirty()}if(B(t,"HTMLVideoElement"))return t.readyState?l():(c=!0,t.addEventListener("loadedmetadata",l,!0)),t.addEventListener("seeking",f,!1),t.addEventListener("seeked",d,!1),{deferTexture:c,source:t,render:function e(n){var s;if(h=t.currentTime,!t.videoHeight||!t.videoWidth)return!1;a?(i||(i=document.createElement("canvas").getContext("2d"),(r=i.canvas).width=o.width,r.height=o.height),s=r,i.drawImage(t,0,0,o.width,o.height)):s=t,n.bindTexture(n.TEXTURE_2D,o.texture),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,o.flip),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1);try{if(n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,s),void 0===a){if(n.getError()===n.INVALID_VALUE)return a=!0,e(n);a=!1}return!0}catch(t){t.code===window.DOMException.SECURITY_ERR?(o.allowRefresh=!1,K.logger.error("Unable to access cross-domain image")):K.logger.error("Error rendering video source",t)}return!1},checkDirty:function(){return!u&&t.currentTime!==h},compare:function(t){return o.source===t},destroy:function(){s=!0,t.removeEventListener("seeking",f,!1),t.removeEventListener("seeked",d,!1),t.removeEventListener("loadedmetadata",l,!0)}}}),{title:"Video"}),K.transform("2d",(function(t){var e=this,n=!(t&&t.radians),r=0,i=0,o=1,s=1,a=0,c=0,u=0,h=0,l=0;function f(){var t,f,d,p,v,g,m,y,b,_,w,S=e.matrix;function x(t,e){S[12]=S[0]*t+S[4]*e+S[12],S[13]=S[1]*t+S[5]*e+S[13],S[14]=S[2]*t+S[6]*e+S[14],S[15]=S[3]*t+S[7]*e+S[15]}a||c||u||h||l||1!==o||1!==s?(A.identity(S),x(a+r,c+i),h&&(S[4]=h/e.width),l&&(S[1]=l/e.height),u&&(p=S[0],v=S[1],g=S[2],m=S[3],y=S[4],b=S[5],_=S[6],w=S[7],t=-(n?u*Math.PI/180:u),f=Math.sin(t),d=Math.cos(t),S[0]=p*d+y*f,S[1]=v*d+b*f,S[2]=g*d+_*f,S[3]=m*d+w*f,S[4]=y*d-p*f,S[5]=b*d-v*f,S[6]=_*d-g*f,S[7]=w*d-m*f),1!==o&&(S[0]*=o,S[1]*=o,S[2]*=o,S[3]*=o),1!==s&&(S[4]*=s,S[5]*=s,S[6]*=s,S[7]*=s),x(-r,-i),e.transformed=!0):e.transformed=!1}return{inputs:{reset:{method:function(){return r=0,i=0,o=1,s=1,a=0,c=0,u=0,h=0,l=0,!!e.transformed&&(e.transformed=!1,!0)}},translate:{method:function(t,e){return isNaN(t)&&(t=a),isNaN(e)&&(e=c),(t!==a||e!==c)&&(a=t,c=e,f(),!0)},type:["number","number"]},translateX:{get:function(){return a},set:function(t){return t!==a&&(a=t,f(),!0)},type:"number"},translateY:{get:function(){return c},set:function(t){return t!==c&&(c=t,f(),!0)},type:"number"},rotation:{get:function(){return u},set:function(t){return t!==u&&(u=parseFloat(t),f(),!0)},type:"number"},center:{method:function(t,e){return isNaN(t)&&(t=r),isNaN(e)&&(e=i),(t!==r||e!==i)&&(r=t,i=e,f(),!0)},type:["number","number"]},centerX:{get:function(){return r},set:function(t){return t!==r&&(r=t,f(),!0)},type:"number"},centerY:{get:function(){return i},set:function(t){return t!==i&&(i=t,f(),!0)},type:"number"},skew:{method:function(t,e){return isNaN(t)&&(t=h),isNaN(e)&&(e=l),(t!==h||e!==l)&&(h=t,l=e,f(),!0)},type:["number","number"]},skewX:{get:function(){return h},set:function(t){return t!==h&&(h=t,f(),!0)},type:"number"},skewY:{get:function(){return l},set:function(t){return t!==l&&(l=t,f(),!0)},type:"number"},scale:{method:function(t,e){var n,r;if(n=isNaN(t)?o:t,isNaN(e)){if(isNaN(t))return!1;r=n}else r=e;return(n!==o||r!==s)&&(o=n,s=r,f(),!0)},type:["number","number"]},scaleX:{get:function(){return o},set:function(t){return t!==o&&(o=t,f(),!0)},type:"number"},scaleY:{get:function(){return s},set:function(t){return t!==s&&(s=t,f(),!0)},type:"number"}}}}),{title:"2D Transform",description:"Translate, Rotate, Scale, Skew"}),K.transform("flip",(function(){var t=this,e=!0;function n(){var n=t.matrix;e?(n[0]=-1,n[5]=1):(n[0]=1,n[5]=-1)}return A.identity(t.matrix),n(),t.transformDirty=!0,t.transformed=!0,{inputs:{direction:{get:function(){return e?"horizontal":"vertical"},set:function(t){var r;return(r="vertical"!==t)!==e&&(e=r,n(),!0)},type:"string"}}}}),{title:"Flip",description:"Flip Horizontal/Vertical"}),K.transform("reformat",(function(){var t,e,n=this,r="contain";function i(){var i,o,s,a,c=n.matrix,u=t||n.width,h=e||n.height,l=n.source,f=l&&l.width||1,d=l&&l.height||1;"distort"===r||u===f&&h===d?n.transformed=!1:(s=f/d,a=u/h,"none"===r?(i=f/u,o=d/h):"width"===r||"contain"===r&&a<=s?(i=1,o=a/s):"height"===r||"contain"===r&&a>s?(i=s/a,o=1):a>s?(i=1,o=a/s):(i=s/a,o=1),1!==i||1!==o?(A.identity(c),1!==i&&(c[0]*=i,c[1]*=i,c[2]*=i,c[3]*=i),1!==o&&(c[4]*=o,c[5]*=o,c[6]*=o,c[7]*=o),n.transformed=!0):n.transformed=!1)}function o(){return t||n.source&&n.source.width||1}function s(){return e||n.source&&n.source.height||1}return this.resize=function(){var t,e=o(),n=s();if(this.width!==e||this.height!==n)for(this.width=e,this.height=n,this.uniforms&&this.uniforms.resolution&&(this.uniforms.resolution[0]=e,this.uniforms.resolution[1]=n),this.frameBuffer&&this.frameBuffer.resize&&this.frameBuffer.resize(e,n),t=0;t<this.targets.length;t++)this.targets[t].resize();this.setTransformDirty(),i()},{inputs:{width:{get:o,set:function(e){return(e=Math.floor(e))===t||(t=e,this.resize()),!1},type:"number"},height:{get:s,set:function(t){return(t=Math.floor(t))===e||(e=t,this.resize()),!1},type:"number"},mode:{get:function(){return r},set:function(t){return t!==r&&(r=t,i(),!0)},type:"enum",options:["cover","contain","distort","width","height","none"]}}}}),{title:"Reformat",description:"Change output dimensions"}),c=["precision mediump float;","attribute vec4 position;","attribute vec2 texCoord;","uniform vec2 resolution;","uniform mat4 transform;","varying vec2 vTexCoord;","void main(void) {","\tvec4 screenPosition = vec4(position.xy * resolution / 2.0, position.z, position.w);","\tscreenPosition = transform * screenPosition;","\tgl_Position.xy = screenPosition.xy * 2.0 / resolution;","\tgl_Position.z = screenPosition.z * 2.0 / (resolution.x / resolution.y);","\tgl_Position.w = screenPosition.w;","\tvTexCoord = texCoord;","}\n"].join("\n"),u=["precision mediump float;","varying vec2 vTexCoord;","uniform sampler2D source;","void main(void) {","\t\tgl_FragColor = texture2D(source, vTexCoord);","}"].join("\n"),K.util.shader.noiseHelpers="#ifndef NOISE_HELPERS\n#define NOISE_HELPERS\nvec2 mod289(vec2 x) {\n\treturn x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec3 mod289(vec3 x) {\n\treturn x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec4 mod289(vec4 x) {\n\treturn x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec3 permute(vec3 x) {\n\treturn mod289(((x*34.0)+1.0)*x);\n}\nvec4 permute(vec4 x) {\n\treturn mod289(((x*34.0)+1.0)*x);\n}\nvec4 taylorInvSqrt(vec4 r) {\n\treturn 1.79284291400159 - 0.85373472095314 * r;\n}\nfloat taylorInvSqrt(float r) {\n\treturn 1.79284291400159 - 0.85373472095314 * r;\n}\n#endif\n",K.util.shader.snoise2d="#ifndef NOISE2D\n#define NOISE2D\nfloat snoise(vec2 v) {\n\tconst vec4 C = vec4(0.211324865405187, // (3.0-sqrt(3.0))/6.0\n\t\t0.366025403784439, // 0.5*(sqrt(3.0)-1.0)\n\t\t-0.577350269189626, // -1.0 + 2.0 * C.x\n\t\t0.024390243902439); // 1.0 / 41.0\n\tvec2 i = floor(v + dot(v, C.yy));\n\tvec2 x0 = v - i + dot(i, C.xx);\n\tvec2 i1;\n\t//i1.x = step(x0.y, x0.x); // x0.x > x0.y ? 1.0 : 0.0\n\t//i1.y = 1.0 - i1.x;\n\ti1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n\t// x0 = x0 - 0.0 + 0.0 * C.xx ;\n\t// x1 = x0 - i1 + 1.0 * C.xx ;\n\t// x2 = x0 - 1.0 + 2.0 * C.xx ;\n\tvec4 x12 = x0.xyxy + C.xxzz;\n\tx12.xy -= i1;\n\ti = mod289(i); // Avoid truncation effects in permutation\n\tvec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0)) + i.x + vec3(0.0, i1.x, 1.0));\n\tvec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);\n\tm = m*m ;\n\tm = m*m ;\n\tvec3 x = 2.0 * fract(p * C.www) - 1.0;\n\tvec3 h = abs(x) - 0.5;\n\tvec3 ox = floor(x + 0.5);\n\tvec3 a0 = x - ox;\n\tm *= 1.79284291400159 - 0.85373472095314 * (a0*a0 + h*h);\n\tvec3 g;\n\tg.x = a0.x * x0.x + h.x * x0.y;\n\tg.yz = a0.yz * x12.xz + h.yz * x12.yw;\n\treturn 130.0 * dot(m, g);\n}\n#endif\n",K.util.shader.snoise3d="#ifndef NOISE3D\n#define NOISE3D\nfloat snoise(vec3 v) {\n\tconst vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n\tconst vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n\tvec3 i = floor(v + dot(v, C.yyy));\n\tvec3 x0 = v - i + dot(i, C.xxx) ;\n\tvec3 g = step(x0.yzx, x0.xyz);\n\tvec3 l = 1.0 - g;\n\tvec3 i1 = min(g.xyz, l.zxy);\n\tvec3 i2 = max(g.xyz, l.zxy);\n\t// x0 = x0 - 0.0 + 0.0 * C.xxx;\n\t// x1 = x0 - i1 + 1.0 * C.xxx;\n\t// x2 = x0 - i2 + 2.0 * C.xxx;\n\t// x3 = x0 - 1.0 + 3.0 * C.xxx;\n\tvec3 x1 = x0 - i1 + C.xxx;\n\tvec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y\n\tvec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y\n\ti = mod289(i);\n\tvec4 p = permute(permute(permute(\n\t\t\t\t\t\ti.z + vec4(0.0, i1.z, i2.z, 1.0))\n\t\t\t\t\t\t+ i.y + vec4(0.0, i1.y, i2.y, 1.0))\n\t\t\t\t\t\t+ i.x + vec4(0.0, i1.x, i2.x, 1.0));\n\tfloat n_ = 0.142857142857; // 1.0/7.0\n\tvec3 ns = n_ * D.wyz - D.xzx;\n\tvec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p, 7 * 7)\n\tvec4 x_ = floor(j * ns.z);\n\tvec4 y_ = floor(j - 7.0 * x_); // mod(j, N)\n\tvec4 x = x_ * ns.x + ns.yyyy;\n\tvec4 y = y_ * ns.x + ns.yyyy;\n\tvec4 h = 1.0 - abs(x) - abs(y);\n\tvec4 b0 = vec4(x.xy, y.xy);\n\tvec4 b1 = vec4(x.zw, y.zw);\n\t//vec4 s0 = vec4(lessThan(b0, 0.0)) * 2.0 - 1.0;\n\t//vec4 s1 = vec4(lessThan(b1, 0.0)) * 2.0 - 1.0;\n\tvec4 s0 = floor(b0) * 2.0 + 1.0;\n\tvec4 s1 = floor(b1) * 2.0 + 1.0;\n\tvec4 sh = -step(h, vec4(0.0));\n\tvec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy ;\n\tvec4 a1 = b1.xzyw + s1.xzyw * sh.zzww ;\n\tvec3 p0 = vec3(a0.xy, h.x);\n\tvec3 p1 = vec3(a0.zw, h.y);\n\tvec3 p2 = vec3(a1.xy, h.z);\n\tvec3 p3 = vec3(a1.zw, h.w);\n\tvec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n\tp0 *= norm.x;\n\tp1 *= norm.y;\n\tp2 *= norm.z;\n\tp3 *= norm.w;\n\tvec4 m = max(0.6 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);\n\tm = m * m;\n\treturn 42.0 * dot(m*m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));\n}\n#endif\n",K.util.shader.snoise4d="#ifndef NOISE4D\n#define NOISE4D\nvec4 grad4(float j, vec4 ip)\n\t{\n\tconst vec4 ones = vec4(1.0, 1.0, 1.0, -1.0);\n\tvec4 p, s;\n\n\tp.xyz = floor(fract (vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0;\n\tp.w = 1.5 - dot(abs(p.xyz), ones.xyz);\n\ts = vec4(lessThan(p, vec4(0.0)));\n\tp.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www;\n\n\treturn p;\n\t}\n\n#define F4 0.309016994374947451\n\nfloat snoise(vec4 v)\n\t{\n\tconst vec4 C = vec4(0.138196601125011, // (5 - sqrt(5))/20 G4\n\t\t\t\t\t\t0.276393202250021, // 2 * G4\n\t\t\t\t\t\t0.414589803375032, // 3 * G4\n\t\t\t\t\t\t-0.447213595499958); // -1 + 4 * G4\n\n\tvec4 i = floor(v + dot(v, vec4(F4)));\n\tvec4 x0 = v - i + dot(i, C.xxxx);\n\n\n\tvec4 i0;\n\tvec3 isX = step(x0.yzw, x0.xxx);\n\tvec3 isYZ = step(x0.zww, x0.yyz);\n\ti0.x = isX.x + isX.y + isX.z;\n\ti0.yzw = 1.0 - isX;\n\ti0.y += isYZ.x + isYZ.y;\n\ti0.zw += 1.0 - isYZ.xy;\n\ti0.z += isYZ.z;\n\ti0.w += 1.0 - isYZ.z;\n\n\tvec4 i3 = clamp(i0, 0.0, 1.0);\n\tvec4 i2 = clamp(i0 - 1.0, 0.0, 1.0);\n\tvec4 i1 = clamp(i0 - 2.0, 0.0, 1.0);\n\n\tvec4 x1 = x0 - i1 + C.xxxx;\n\tvec4 x2 = x0 - i2 + C.yyyy;\n\tvec4 x3 = x0 - i3 + C.zzzz;\n\tvec4 x4 = x0 + C.wwww;\n\n\ti = mod289(i);\n\tfloat j0 = permute(permute(permute(permute(i.w) + i.z) + i.y) + i.x);\n\tvec4 j1 = permute(permute(permute(permute (\n\t\t\t\t\ti.w + vec4(i1.w, i2.w, i3.w, 1.0))\n\t\t\t\t\t+ i.z + vec4(i1.z, i2.z, i3.z, 1.0))\n\t\t\t\t\t+ i.y + vec4(i1.y, i2.y, i3.y, 1.0))\n\t\t\t\t\t+ i.x + vec4(i1.x, i2.x, i3.x, 1.0));\n\n\tvec4 ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0) ;\n\n\tvec4 p0 = grad4(j0, ip);\n\tvec4 p1 = grad4(j1.x, ip);\n\tvec4 p2 = grad4(j1.y, ip);\n\tvec4 p3 = grad4(j1.z, ip);\n\tvec4 p4 = grad4(j1.w, ip);\n\n\tvec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n\tp0 *= norm.x;\n\tp1 *= norm.y;\n\tp2 *= norm.z;\n\tp3 *= norm.w;\n\tp4 *= taylorInvSqrt(dot(p4, p4));\n\n\tvec3 m0 = max(0.6 - vec3(dot(x0, x0), dot(x1, x1), dot(x2, x2)), 0.0);\n\tvec2 m1 = max(0.6 - vec2(dot(x3, x3), dot(x4, x4)), 0.0);\n\tm0 = m0 * m0;\n\tm1 = m1 * m1;\n\treturn 49.0 * (dot(m0*m0, vec3(dot(p0, x0), dot(p1, x1), dot(p2, x2)))\n\t\t\t\t\t\t\t+ dot(m1*m1, vec2(dot(p3, x3), dot(p4, x4)))) ;\n}\n#endif\n",e.default=K},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Uneeq=void 0;const o=n(47);n(104);const s=n(81),a=i(n(107)),c=n(108),u=n(109),h=n(132),l=n(133),f=n(31),d=n(134),p=n(141),v=n(147),g=n(149),m=n(80),y=n(150),b=n(151),_=n(152),w=n(153),S=n(63),x=n(155),T=n(85),C=n(156),E=n(99);e.Uneeq=class{constructor(t){this.ready=new o.BehaviorSubject(!1),this.version=a.default.version,this.messages=new o.Subject,this.internalMessages$=new o.Subject,this.sessionPaused=!1,this.sessionStarted=!1,this.unavailableAvatarMsgSent=!1,this.sessionWasResumed=!1,this.uneeqLocalStorage=new _.UneeqLocalStorage,f.logger.enabled=t.logging||!1,this.options=t,this.options.diagnostics=t.diagnostics||!1,this.options.micActivityMessages=t.micActivityMessages||!1,this.options.sendLocalVideo=void 0===t.sendLocalVideo||t.sendLocalVideo,this.options.sendLocalAudio=void 0===t.sendLocalAudio||t.sendLocalAudio,this.options.enableClientPerformanceMessage=t.enableClientPerformanceMessage||!1,this.options.enableTransparentBackground=t.enableTransparentBackground||!1,this.options.backgroundImageUrl=t.backgroundImageUrl||"",this.options.nameTagImageUrl=t.nameTagImageUrl||"",this.options.speechToTextLocales=l.LocaleDetector.validateOrDetectSpeechLocales(t),this.checkIfResumeSessionIsAvailable(),this.options.voiceInputMode=t.voiceInputMode||E.VoiceInputMode.PUSH_TO_TALK,this.api=new c.API(this.options.url,this.options.apiKey),this.messageCallback=this.options.messageHandler||(()=>{}),this.checkWebRTCSupport(),this.startSessionData={workspaceName:this.options.conversationId,sessionType:x.SessionType.WEB,sdkVersion:this.version,clientWidth:window.screen.availWidth,clientHeight:window.screen.availHeight},this.options.customData&&(this.startSessionData.customData=this.options.customData),f.logger.log(`Uneeq Created (version ${this.version})`),this.streamManager=new b.StreamManager,this.initDigitalHumanVideoElement(),this.metricsService=new v.MetricsService(this.options,this.internalMessages$,this.messages),this.dhVideoPlayManager=new h.DigitalHumanVideoPlayManager(this.messages,()=>{this.unmuteDigitalHuman()})}get sessionId(){return this.session?this.session.id:null}setLoggerEnabled(t){f.logger.enabled=t}init(){this.startSessionTime=Date.now(),this.api.startSession(this.startSessionData).then(t=>{this.session=t,this.initialize()}).catch(t=>{this.sendServiceUnavailableMessage(t)})}initWithToken(t){return r(this,void 0,void 0,(function*(){this.startSessionTime=Date.now();try{const e=y.ResumeSessionCheck.validate(this.options);!0===e.resumeSession&&(this.startSessionData.resumeSessionId=e.resumeSessionId),this.startSessionData.tokenId=t,this.session=yield this.api.startSessionWithToken(this.startSessionData),console.log("UneeQ Session ID: "+this.session.id),this.session.id===this.startSessionData.resumeSessionId?(f.logger.log("UneeQ: Session was resumed."),this.sessionWasResumed=!0):f.logger.log("UneeQ: Session was not resumed."),this.uneeqLocalStorage.setItemSafely("uneeqResumeSessionId",this.session.id),this.uneeqLocalStorage.setItemSafely("uneeqResumeSessionPersonaId",this.options.conversationId),this.session.sourceApp=C.SourceApp[this.session.sourceApp?this.session.sourceApp:""]?this.session.sourceApp:C.SourceApp.UNKNOWN,this.initialize()}catch(t){this.sendServiceUnavailableMessage(t)}}))}setCamera(t){this.serviceReadyCheck("setCamera")&&this.deviceManager.setCamDevice(t)}setMic(t){this.serviceReadyCheck("setMic")&&this.deviceManager.setMicDevice(t)}setSpeaker(t){this.serviceReadyCheck("setSpeaker")&&this.deviceManager.setAvatarSpeakerDevice(t)}setVoiceInputMode(t){this.serviceReadyCheck("setVoiceInputMode")&&this.voiceInputManager.setVoiceInputMode(t)}enableMicrophone(t=!0){this.deviceManager&&this.deviceManager.enableLocalDevices(this.options.sendLocalVideo,t)}enableCamera(t=!0){this.serviceReadyCheck("enableMicrohpone")&&this.deviceManager.enableLocalDevices(t,this.options.sendLocalAudio)}enableMicrophoneAndCamera(t=!0){this.serviceReadyCheck("enableMicrohpone")&&this.deviceManager.enableLocalDevices(t,t)}sendTranscript(t){this.serviceReadyCheck("sendTranscript")&&(this.sessionPaused?this.messages.next(new S.WarningMessage("Call to sendTranscript() will be ignored. Session is paused.")):this.api.avatarAsk(t))}getServerStats(){this.deviceManager&&this.deviceManager.mediaHandler&&this.deviceManager.mediaHandler.sendDataMessage("stats")}startRecording(){this.serviceReadyCheck("startRecording")&&this.options.sendLocalAudio&&(this.sessionPaused?this.messages.next(new S.WarningMessage("Call to startRecording() will be ignored. Session is paused.")):this.voiceInputManager.startRecording())}stopSpeaking(){return this.api.avatarStopSpeaking()}stopRecording(){this.serviceReadyCheck("stopRecording")&&this.options.sendLocalAudio&&(this.sessionPaused?this.messages.next(new S.WarningMessage("Call to stopRecording() will be ignored. Session is paused.")):this.voiceInputManager.stopRecording())}pauseSession(){return!!this.serviceReadyCheck("pauseSession")&&(this.sessionPaused?(this.messages.next(new S.WarningMessage("Call to pauseSession() will be ignored. Session is paused.")),!1):(this.sessionPaused=!0,this.deviceManager.mediaHandler.pause(),this.messages.next(new S.SessionPausedMessage),!0))}resumeSession(){return!!this.serviceReadyCheck("resumeSession")&&(this.sessionPaused?(this.sessionPaused=!1,this.deviceManager.mediaHandler.resume(),this.messages.next(new S.SessionResumedMessage),!0):(this.messages.next(new S.WarningMessage("Call to resumeSession() will be ignored. Session is unpaused.")),!1))}endSession(){this.serviceReadyCheck("endSession")&&(this.api.endCall(),this.internalMessages$.next({faceMeMessageType:"sessionEnd"}))}setAvatarDebug(t){return this.api.setAvatarDebug(t)}playWelcomeMessage(){return this.api.avatarWelcome()}unmuteDigitalHuman(){this.voiceInputManager.resumeAudioContext(),this.dhVideoPlayManager.unmuteVideo()}initDigitalHumanVideoElement(){const t=document.createElement("video");this.digitalHumanVideoElement=t,t.volume=1,t.controls=!1,t.autoplay=!1,t.setAttribute("playsinline","true"),t.setAttribute("style","object-fit: cover; width: 100%; height: 100%;"),t.play().catch(t=>{f.logger.log("UneeQ: Failed to play digital human video. Play() will be re-attempted when stream is ready.",t)})}gatherWebRtcMetrics(){var t;null===(t=this.deviceManager)||void 0===t||t.mediaHandler.gatherWebRTCStats((t,e)=>{this.metricsService.parseAndLogWebRtcStats(e)}),setTimeout(()=>{this.gatherWebRtcMetrics()},5e3)}initMessaging(){this.messages.subscribe(t=>this.messageCallback(t)),this.messaging.state$.filter(t=>t===p.MessagingState.CONNECTED).subscribe(()=>{this.messaging.getTopic("/topic/avatar/"+this.session.streamId),this.ready.next(!0),this.messages.next(new S.ReadyMessage),this.gatherWebRtcMetrics()}),this.messaging.messages$.subscribe(t=>this.internalMessages$.next(JSON.parse(t.body))),this.messageHandler=new d.MessageHandler(this.internalMessages$,this.messages),this.messaging.connect(),this.messaging.messages$.subscribe(t=>{f.logger.log("-- Msg -- ",t)})}initDeviceManager(){this.voiceInputManager=new w.VoiceInputManager(this.options,this.api,this.messages,t=>{this.enableMicrophone(t)}),this.deviceManager=new u.DeviceManager({userMessages:this.messages,session:this.session,messages:this.messages,internalMessages$:this.internalMessages$,messaging:this.messaging,uneeqOptions:this.options,streamManager:this.streamManager,voiceInputManager:this.voiceInputManager,digitalHumanVideoElement:this.digitalHumanVideoElement},this.api),this.messageHandler.setDeviceManager(this.deviceManager)}sessionLiveHandler(){if(!this.sessionStarted){this.messages.next(new S.SessionLiveMessage(this.session.showUneeqLogo||!1,this.sessionWasResumed)),this.options.playWelcome&&this.api.avatarWelcome();const t={type:m.PromMessageType.SessionStart,value:(Date.now()-this.startSessionTime)/1e3};this.internalMessages$.next({faceMeMessageType:"prom",promMsg:t}),this.sessionStarted=!0}}initAvatar(){this.ready.filter(Boolean).pipe(s.take(1)).subscribe(()=>{this.internalMessages$.filter(t=>"DevicePermissionAllowedInternal"===t.faceMeMessageType).pipe(s.take(1)).subscribe(t=>{this.messages.next(new S.DevicePermissionAllowedMessage),this.startAvatarWhenAvailable()}),this.initDeviceManager()}),this.internalMessages$.filter(t=>"sessionLive"===t.faceMeMessageType).pipe(s.take(1)).subscribe(t=>this.sessionLiveHandler()),this.internalMessages$.filter(t=>"sessionEnd"===t.faceMeMessageType).subscribe(()=>{this.deviceManager.mediaHandler.endSession(),this.messages.next(new S.SessionEndedMessage),this.messaging.disconnect()}),this.internalMessages$.filter(t=>"remoteVideoReadyToPlay"===t.faceMeMessageType).subscribe(t=>{this.dhVideoPlayManager.play(this.deviceManager.mediaHandler.avatarVideoElement)})}startAvatarWhenAvailable(){this.availableResponseTime=Date.now(),this.api.getAvailableAvatarCount().then(t=>{if(t.available>0){const t={type:m.PromMessageType.AvailabilityCheck,value:(Date.now()-this.availableResponseTime)/1e3};this.internalMessages$.next({faceMeMessageType:"prom",promMsg:t}),this.messages.next(new S.AvatarAvailableMessage),this.api.avatarStart({enableTransparentBackground:this.options.enableTransparentBackground,resumeSession:this.sessionWasResumed,backgroundImageUrl:this.options.backgroundImageUrl,nameTagImageUrl:this.options.nameTagImageUrl,speechToTextLocales:this.options.speechToTextLocales}).catch(t=>{console.error("UneeQ: Digital human could not be started. Clearing resumeSession token and ending process.",t),this.uneeqLocalStorage.removeItemSafely("uneeqResumeSessionId")})}else this.unavailableAvatarMsgSent||(this.unavailableAvatarMsgSent=!0,this.messages.next(new S.AvatarUnavailableMessage)),setTimeout(()=>{this.startAvatarWhenAvailable()},1e3)})}initialize(){if(this.session){this.initPromMetricsListener(),this.api.callId=this.session.id,this.initAvatar();const t={maxReconnectAttempts:3,reconnectTime:3e3,maxReconnectLimitReached:()=>{this.messages.next(new S.ConnectionLostMessage(T.PublishSubscribeState.DISCONNECTED)),this.endSession()},connectionHeaders:{"x-auth-token":this.api.authToken}};this.messaging=new p.MessagingService(this.options.url+"/api/messaging",t),this.initMessaging(),this.initOnlineStatusUpdateMessages()}}sendServiceUnavailableMessage(t){const e=new S.ServiceUnavailableMessage(t);this.messages.next(e),this.messageCallback(e)}serviceReadyCheck(t){return!!this.ready.value||(this.messages.next(new S.WarningMessage("Call to "+t+" ignored. Service Not Ready")),!1)}checkWebRTCSupport(){navigator.getUserMedia||this.sendServiceUnavailableMessage("Error: WEBRTC NOT SUPPORTED")}initOnlineStatusUpdateMessages(){new g.OnlineStatusService(this.messages,()=>{this.messages.next(new S.ConnectionLostMessage(T.PublishSubscribeState.DISCONNECTED)),this.endSession()})}initPromMetricsListener(){const t=new m.Prom(this.options.url);this.internalMessages$.filter(t=>"prom"===t.faceMeMessageType).subscribe(e=>{t.handleMessage(e.promMsg)})}checkIfResumeSessionIsAvailable(){!0!==this.options.resumeSession||this.uneeqLocalStorage.available||(console.warn("UneeQ: Resuming session is unavailable in this browser because localStorage is not allowed."),this.messages.next(new S.ResumeSessionUnavailable),this.options.resumeSession=!1)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PublishSubscribeState=void 0,function(t){t.DISCONNECTED="DISCONNECTED",t.CONNECTING="CONNECTING",t.CONNECTED="CONNECTED",t.FAILED="FAILED"}(e.PublishSubscribeState||(e.PublishSubscribeState={}))},function(t,e,n){
32
32
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
33
- var r=n(44),i=r.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function s(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},s.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},function(t,e,n){"use strict";(function(e,r){var i;t.exports=C,C.ReadableState=T;n(88).EventEmitter;var o=function(t,e){return t.listeners(e).length},s=n(89),a=n(44).Buffer,c=e.Uint8Array||function(){};var u,h=n(122);u=h&&h.debuglog?h.debuglog("stream"):function(){};var l,f,d,p=n(123),v=n(90),g=n(91).getHighWaterMark,m=n(45).codes,y=m.ERR_INVALID_ARG_TYPE,b=m.ERR_STREAM_PUSH_AFTER_EOF,_=m.ERR_METHOD_NOT_IMPLEMENTED,w=m.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(59)(C,s);var S=v.errorOrDestroy,x=["error","close","destroy","pause","resume"];function T(t,e,r){i=i||n(46),t=t||{},"boolean"!=typeof r&&(r=e instanceof i),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",r),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!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=n(93).StringDecoder),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function C(t){if(i=i||n(46),!(this instanceof C))return new C(t);var e=this instanceof i;this._readableState=new T(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),s.call(this)}function E(t,e,n,r,i){u("readableAddChunk",e);var o,s=t._readableState;if(null===e)s.reading=!1,function(t,e){if(u("onEofChunk"),e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,e.sync?O(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,A(t)))}(t,s);else if(i||(o=function(t,e){var n;r=e,a.isBuffer(r)||r instanceof c||"string"==typeof e||void 0===e||t.objectMode||(n=new y("chunk",["string","Buffer","Uint8Array"],e));var r;return n}(s,e)),o)S(t,o);else if(s.objectMode||e&&e.length>0)if("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.from(t)}(e)),r)s.endEmitted?S(t,new w):R(t,s,e,!0);else if(s.ended)S(t,new b);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!n?(e=s.decoder.write(e),s.objectMode||0!==e.length?R(t,s,e,!1):P(t,s)):R(t,s,e,!1)}else r||(s.reading=!1,P(t,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function R(t,e,n,r){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",n)):(e.length+=e.objectMode?1:n.length,r?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&O(t)),P(t,e)}Object.defineProperty(C.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),C.prototype.destroy=v.destroy,C.prototype._undestroy=v.undestroy,C.prototype._destroy=function(t,e){e(t)},C.prototype.push=function(t,e){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof t&&((e=e||r.defaultEncoding)!==r.encoding&&(t=a.from(t,e),e=""),n=!0),E(this,t,e,!1,n)},C.prototype.unshift=function(t){return E(this,t,null,!0,!1)},C.prototype.isPaused=function(){return!1===this._readableState.flowing},C.prototype.setEncoding=function(t){l||(l=n(93).StringDecoder);var e=new l(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";null!==r;)i+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};function M(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function O(t){var e=t._readableState;u("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(u("emitReadable",e.flowing),e.emittedReadable=!0,r.nextTick(A,t))}function A(t){var e=t._readableState;u("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,j(t)}function P(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(k,t,e))}function k(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var n=e.length;if(u("maybeReadMore read 0"),t.read(0),n===e.length)break}e.readingMore=!1}function I(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function D(t){u("readable nexttick read 0"),t.read(0)}function N(t,e){u("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),j(t),e.flowing&&!e.reading&&t.read(0)}function j(t){var e=t._readableState;for(u("flow",e.flowing);e.flowing&&null!==t.read(););}function L(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):n=e.buffer.consume(t,e.decoder),n);var n}function U(t){var e=t._readableState;u("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,r.nextTick(F,e,t))}function F(t,e){if(u("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var n=e._writableState;(!n||n.autoDestroy&&n.finished)&&e.destroy()}}function B(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}C.prototype.read=function(t){u("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return u("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?U(this):O(this),null;if(0===(t=M(t,e))&&e.ended)return 0===e.length&&U(this),null;var r,i=e.needReadable;return u("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&u("length less than watermark",i=!0),e.ended||e.reading?u("reading or ended",i=!1):i&&(u("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=M(n,e))),null===(r=t>0?L(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&U(this)),null!==r&&this.emit("data",r),r},C.prototype._read=function(t){S(this,new _("_read()"))},C.prototype.pipe=function(t,e){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,u("pipe count=%d opts=%j",i.pipesCount,e);var s=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?c:g;function a(e,r){u("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,u("cleanup"),t.removeListener("close",p),t.removeListener("finish",v),t.removeListener("drain",h),t.removeListener("error",d),t.removeListener("unpipe",a),n.removeListener("end",c),n.removeListener("end",g),n.removeListener("data",f),l=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}function c(){u("onend"),t.end()}i.endEmitted?r.nextTick(s):n.once("end",s),t.on("unpipe",a);var h=function(t){return function(){var e=t._readableState;u("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,j(t))}}(n);t.on("drain",h);var l=!1;function f(e){u("ondata");var r=t.write(e);u("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==B(i.pipes,t))&&!l&&(u("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function d(e){u("onerror",e),g(),t.removeListener("error",d),0===o(t,"error")&&S(t,e)}function p(){t.removeListener("finish",v),g()}function v(){u("onfinish"),t.removeListener("close",p),g()}function g(){u("unpipe"),n.unpipe(t)}return n.on("data",f),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",d),t.once("close",p),t.once("finish",v),t.emit("pipe",n),i.flowing||(u("pipe resume"),n.resume()),t},C.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=B(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,n)),this},C.prototype.on=function(t,e){var n=s.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,u("on readable",i.length,i.reading),i.length?O(this):i.reading||r.nextTick(D,this))),n},C.prototype.addListener=C.prototype.on,C.prototype.removeListener=function(t,e){var n=s.prototype.removeListener.call(this,t,e);return"readable"===t&&r.nextTick(I,this),n},C.prototype.removeAllListeners=function(t){var e=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||r.nextTick(I,this),e},C.prototype.resume=function(){var t=this._readableState;return t.flowing||(u("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,r.nextTick(N,t,e))}(this,t)),t.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(t){var e=this,n=this._readableState,r=!1;for(var i in t.on("end",(function(){if(u("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(u("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i)||(n.objectMode||i&&i.length)&&(e.push(i)||(r=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<x.length;o++)t.on(x[o],this.emit.bind(this,x[o]));return this._read=function(e){u("wrapped _read",e),r&&(r=!1,t.resume())},this},"function"==typeof Symbol&&(C.prototype[Symbol.asyncIterator]=function(){return void 0===f&&(f=n(126)),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(t){this._readableState&&(this._readableState.flowing=t)}}),C._fromList=L,Object.defineProperty(C.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(C.from=function(t,e){return void 0===d&&(d=n(127)),d(C,t,e)})}).call(this,n(34),n(38))},function(t,e,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var s=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}t.exports=a,t.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}m(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&m(t,"error",e,n)}(t,i,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var c=10;function u(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function h(t){return void 0===t._maxListeners?a.defaultMaxListeners:t._maxListeners}function l(t,e,n,r){var i,o,s,a;if(u(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),s=o[e]),void 0===s)s=o[e]=n,++t._eventsCount;else if("function"==typeof s?s=o[e]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=h(t))>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return t}function f(){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(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}function p(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(i):g(i,i.length)}function v(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function g(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function m(t,e,n,r){if("function"==typeof t.on)r.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(o){r.once&&t.removeEventListener(e,i),n(o)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");c=t}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},a.prototype.getMaxListeners=function(){return h(this)},a.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=i[t];if(void 0===c)return!1;if("function"==typeof c)o(c,this,e);else{var u=c.length,h=g(c,u);for(n=0;n<u;++n)o(h[n],this,e)}return!0},a.prototype.addListener=function(t,e){return l(this,t,e,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(t,e){return l(this,t,e,!0)},a.prototype.once=function(t,e){return u(e),this.on(t,d(this,t,e)),this},a.prototype.prependOnceListener=function(t,e){return u(e),this.prependListener(t,d(this,t,e)),this},a.prototype.removeListener=function(t,e){var n,r,i,o,s;if(u(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,i),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,s||e)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},a.prototype.listeners=function(t){return p(this,t,!0)},a.prototype.rawListeners=function(t){return p(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):v.call(t,e)},a.prototype.listenerCount=v,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){t.exports=n(88).EventEmitter},function(t,e,n){"use strict";(function(e){function n(t,e){i(t,e),r(t)}function r(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,o){var s=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(o?o(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(i,this,t)):e.nextTick(i,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!o&&t?s._writableState?s._writableState.errorEmitted?e.nextTick(r,s):(s._writableState.errorEmitted=!0,e.nextTick(n,s,t)):e.nextTick(n,s,t):o?(e.nextTick(r,s),o(t)):e.nextTick(r,s)})),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(t,e){var n=t._readableState,r=t._writableState;n&&n.autoDestroy||r&&r.autoDestroy?t.destroy(e):t.emit("error",e)}}}).call(this,n(38))},function(t,e,n){"use strict";var r=n(45).codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,n,i){var o=function(t,e,n){return null!=t.highWaterMark?t.highWaterMark:e?t[n]:null}(e,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new r(i?n:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},function(t,e,n){"use strict";(function(e,r){function i(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;t.entry=null;for(;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree.next=t}(e,t)}}var o;t.exports=C,C.WritableState=T;var s={deprecate:n(125)},a=n(89),c=n(44).Buffer,u=e.Uint8Array||function(){};var h,l=n(90),f=n(91).getHighWaterMark,d=n(45).codes,p=d.ERR_INVALID_ARG_TYPE,v=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_MULTIPLE_CALLBACK,m=d.ERR_STREAM_CANNOT_PIPE,y=d.ERR_STREAM_DESTROYED,b=d.ERR_STREAM_NULL_VALUES,_=d.ERR_STREAM_WRITE_AFTER_END,w=d.ERR_UNKNOWN_ENCODING,S=l.errorOrDestroy;function x(){}function T(t,e,s){o=o||n(46),t=t||{},"boolean"!=typeof s&&(s=e instanceof o),this.objectMode=!!t.objectMode,s&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=f(this,t,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,i=n.sync,o=n.writecb;if("function"!=typeof o)throw new g;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,i,o){--e.pendingcb,n?(r.nextTick(o,i),r.nextTick(P,t,e),t._writableState.errorEmitted=!0,S(t,i)):(o(i),t._writableState.errorEmitted=!0,S(t,i),P(t,e))}(t,n,i,e,o);else{var s=O(n)||t.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||M(t,n),i?r.nextTick(R,t,n,s,o):R(t,n,s,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function C(t){var e=this instanceof(o=o||n(46));if(!e&&!h.call(C,this))return new C(t);this._writableState=new T(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),a.call(this)}function E(t,e,n,r,i,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new y("write")):n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function R(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),P(t,e)}function M(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,o=new Array(r),s=e.corkedRequestsFree;s.entry=n;for(var a=0,c=!0;n;)o[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;o.allBuffers=c,E(t,e,!0,e.length,o,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new i(e),e.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,h=n.encoding,l=n.callback;if(E(t,e,!1,e.objectMode?1:u.length,u,h,l),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function O(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function A(t,e){t._final((function(n){e.pendingcb--,n&&S(t,n),e.prefinished=!0,t.emit("prefinish"),P(t,e)}))}function P(t,e){var n=O(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,r.nextTick(A,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return n}n(59)(C,a),T.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(T.prototype,"buffer",{get:s.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(C,Symbol.hasInstance,{value:function(t){return!!h.call(this,t)||this===C&&(t&&t._writableState instanceof T)}})):h=function(t){return t instanceof this},C.prototype.pipe=function(){S(this,new m)},C.prototype.write=function(t,e,n){var i,o=this._writableState,s=!1,a=!o.objectMode&&(i=t,c.isBuffer(i)||i instanceof u);return a&&!c.isBuffer(t)&&(t=function(t){return c.from(t)}(t)),"function"==typeof e&&(n=e,e=null),a?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof n&&(n=x),o.ending?function(t,e){var n=new _;S(t,n),r.nextTick(e,n)}(this,n):(a||function(t,e,n,i){var o;return null===n?o=new b:"string"==typeof n||e.objectMode||(o=new p("chunk",["string","Buffer"],n)),!o||(S(t,o),r.nextTick(i,o),!1)}(this,o,t,n))&&(o.pendingcb++,s=function(t,e,n,r,i,o){if(!n){var s=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=c.from(e,n));return e}(e,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=e.objectMode?1:r.length;e.length+=a;var u=e.length<e.highWaterMark;u||(e.needDrain=!0);if(e.writing||e.corked){var h=e.lastBufferedRequest;e.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},h?h.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else E(t,e,!1,a,r,i,o);return u}(this,o,a,t,e,n)),s},C.prototype.cork=function(){this._writableState.corked++},C.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||M(this,t))},C.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new w(t);return this._writableState.defaultEncoding=t,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(t,e,n){n(new v("_write()"))},C.prototype._writev=null,C.prototype.end=function(t,e,n){var i=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,n){e.ending=!0,P(t,e),n&&(e.finished?r.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,i,n),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(t){this._writableState&&(this._writableState.destroyed=t)}}),C.prototype.destroy=l.destroy,C.prototype._undestroy=l.undestroy,C.prototype._destroy=function(t,e){e(t)}}).call(this,n(34),n(38))},function(t,e,n){"use strict";var r=n(86).Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=c,this.end=u,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=h,this.end=l,e=3;break;default:return this.write=f,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function c(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function u(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function h(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function f(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<t.length?e?e+this.text(t,n):this.text(t,n):e||""},o.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},o.prototype.text=function(t,e){var n=function(t,e,n){var r=e.length-1;if(r<n)return 0;var i=s(e[r]);if(i>=0)return i>0&&(t.lastNeed=i-1),i;if(--r<n||-2===i)return 0;if((i=s(e[r]))>=0)return i>0&&(t.lastNeed=i-2),i;if(--r<n||-2===i)return 0;if((i=s(e[r]))>=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,n){"use strict";t.exports=h;var r=n(45).codes,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,s=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,c=n(46);function u(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function h(t){if(!(this instanceof h))return new h(t);c.call(this,t),this._transformState={afterTransform:u.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",l)}function l(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?f(this,null,null):this._flush((function(e,n){f(t,e,n)}))}function f(t,e,n){if(e)return t.emit("error",e);if(null!=n&&t.push(n),t._writableState.length)throw new a;if(t._transformState.transforming)throw new s;return t.push(null)}n(59)(h,c),h.prototype.push=function(t,e){return this._transformState.needTransform=!1,c.prototype.push.call(this,t,e)},h.prototype._transform=function(t,e,n){n(new i("_transform()"))},h.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},h.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},h.prototype._destroy=function(t,e){c.prototype._destroy.call(this,t,(function(t){e(t)}))}},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}Object.defineProperty(e,"__esModule",{value:!0}),e.Counter=void 0;var u=function(t){function e(){return i(this,e),s(this,a(e).apply(this,arguments))}var n,r,u;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(e,t),n=e,(r=[{key:"inc",value:function(t){return this.add(1,t),this}},{key:"add",value:function(t,e){if(t<0)throw new Error("Expected increment amount to be greater than -1. Received: ".concat(t));var n=this.get(e);return this.set(n?n.value+t:t,e),this}},{key:"reset",value:function(t){this.set(0,t)}}])&&o(n.prototype,r),u&&o(n,u),e}(n(96).Collector);e.Counter=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Collector=void 0;var r=n(64),i=n(97);function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var s=function(){function t(){var e,n,r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r=void 0,(n="data")in(e=this)?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,this.data=[]}var e,n,s;return e=t,(n=[{key:"get",value:function(t){return(0,i.findExistingMetric)(t,this.data)}},{key:"set",value:function(t,e){var n=(0,i.findExistingMetric)(e,this.data);return n?n.value=t:this.data.push({labels:e,value:t}),this}},{key:"collect",value:function(t){return(0,r.filter)(this.data,(function(e){return(0,r.matches)(t)(e.labels)}))}},{key:"resetAll",value:function(){var t=this;return(0,r.each)(this.data,(function(e){t.reset(e.labels)})),this}}])&&o(e.prototype,n),s&&o(e,s),t}();e.Collector=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.formatHistogramOrSummary=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"le",o="",s=i(e);s.length>0?(o+="".concat(t,"_count{").concat(s,"} ").concat(e.value.count,"\n"),o+="".concat(t,"_sum{").concat(s,"} ").concat(e.value.sum,"\n")):(o+="".concat(t,"_count ").concat(e.value.count,"\n"),o+="".concat(t,"_sum ").concat(e.value.sum,"\n"));return(0,r.reduce)(e.value.entries,(function(e,r,i){return s.length>0?o+="".concat(t,"_bucket{").concat(n,'="').concat(i,'",').concat(s,"} ").concat(r,"\n"):o+="".concat(t,"_bucket{").concat(n,'="').concat(i,'"} ').concat(r,"\n"),o}),o)},e.findExistingMetric=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t)return e[0];return(0,r.find)(e,(function(e){return(0,r.isEqual)(e.labels,t)}))},e.formatCounterOrGauge=function(t,e){var n=" ".concat(e.value.toString());if(null==e.labels||0===Object.keys(e.labels).length)return"".concat(t).concat(n,"\n");var i=(0,r.map)(e.labels,(function(t,e){return"".concat(e,'="').concat(t,'"')}));return"".concat(t,"{").concat(i.join(","),"}").concat(n,"\n")};var r=n(64);function i(t){var e=(0,r.map)(t.labels,(function(t,e){return"".concat(e,'="').concat(t,'"')}));return 0===e.length?"":"".concat(e.join(","))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MessagingState=void 0,function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"}(e.MessagingState||(e.MessagingState={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VoiceInputMode=void 0,function(t){t.PUSH_TO_TALK="PUSH_TO_TALK",t.VOICE_ACTIVITY="VOICE_ACTIVITY"}(e.VoiceInputMode||(e.VoiceInputMode={}))},function(t,e,n){(function(t,e){!function(t){function n(){}function r(t,e){if(t=void 0===t?"utf-8":t,e=void 0===e?{fatal:!1}:e,-1===o.indexOf(t.toLowerCase()))throw new RangeError("Failed to construct 'TextDecoder': The encoding label provided ('"+t+"') is invalid.");if(e.fatal)throw Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.")}function i(t){for(var e=0,n=Math.min(65536,t.length+1),r=new Uint16Array(n),i=[],o=0;;){var s=e<t.length;if(!s||o>=n-1){if(i.push(String.fromCharCode.apply(null,r.subarray(0,o))),!s)return i.join("");t=t.subarray(e),o=e=0}if(0==(128&(s=t[e++])))r[o++]=s;else if(192==(224&s)){var a=63&t[e++];r[o++]=(31&s)<<6|a}else if(224==(240&s)){a=63&t[e++];var c=63&t[e++];r[o++]=(31&s)<<12|a<<6|c}else if(240==(248&s)){65535<(s=(7&s)<<18|(a=63&t[e++])<<12|(c=63&t[e++])<<6|63&t[e++])&&(s-=65536,r[o++]=s>>>10&1023|55296,s=56320|1023&s),r[o++]=s}}}if(t.TextEncoder&&t.TextDecoder)return!1;var o=["utf-8","utf8","unicode-1-1-utf-8"];Object.defineProperty(n.prototype,"encoding",{value:"utf-8"}),n.prototype.encode=function(t,e){if((e=void 0===e?{stream:!1}:e).stream)throw Error("Failed to encode: the 'stream' option is unsupported.");e=0;for(var n=t.length,r=0,i=Math.max(32,n+(n>>>1)+7),o=new Uint8Array(i>>>3<<3);e<n;){var s=t.charCodeAt(e++);if(55296<=s&&56319>=s){if(e<n){var a=t.charCodeAt(e);56320==(64512&a)&&(++e,s=((1023&s)<<10)+(1023&a)+65536)}if(55296<=s&&56319>=s)continue}if(r+4>o.length&&(i+=8,i=(i*=1+e/t.length*2)>>>3<<3,(a=new Uint8Array(i)).set(o),o=a),0==(4294967168&s))o[r++]=s;else{if(0==(4294965248&s))o[r++]=s>>>6&31|192;else if(0==(4294901760&s))o[r++]=s>>>12&15|224,o[r++]=s>>>6&63|128;else{if(0!=(4292870144&s))continue;o[r++]=s>>>18&7|240,o[r++]=s>>>12&63|128,o[r++]=s>>>6&63|128}o[r++]=63&s|128}}return o.slice?o.slice(0,r):o.subarray(0,r)},Object.defineProperty(r.prototype,"encoding",{value:"utf-8"}),Object.defineProperty(r.prototype,"fatal",{value:!1}),Object.defineProperty(r.prototype,"ignoreBOM",{value:!1});var s=i;"function"==typeof e&&e.from?s=function(t){return e.from(t.buffer,t.byteOffset,t.byteLength).toString("utf-8")}:"function"==typeof Blob&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&(s=function(t){try{var e=URL.createObjectURL(new Blob([t],{type:"text/plain;charset=UTF-8"})),n=new XMLHttpRequest;return n.open("GET",e,!1),n.send(),n.responseText}catch(e){return i(t)}finally{e&&URL.revokeObjectURL(e)}}),r.prototype.decode=function(t,e){if((e=void 0===e?{stream:!1}:e).stream)throw Error("Failed to decode: the 'stream' option is unsupported.");return t=t instanceof Uint8Array?t:t.buffer instanceof ArrayBuffer?new Uint8Array(t.buffer):new Uint8Array(t),s(t)},t.TextEncoder=n,t.TextDecoder=r}("undefined"!=typeof window?window:void 0!==t?t:this)}).call(this,n(34),n(44).Buffer)},function(t,e,n){"use strict";e.byteLength=function(t){var e=u(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,r=u(t),s=r[0],a=r[1],c=new o(function(t,e,n){return 3*(e+n)/4-n}(0,s,a)),h=0,l=a>0?s-4:s;for(n=0;n<l;n+=4)e=i[t.charCodeAt(n)]<<18|i[t.charCodeAt(n+1)]<<12|i[t.charCodeAt(n+2)]<<6|i[t.charCodeAt(n+3)],c[h++]=e>>16&255,c[h++]=e>>8&255,c[h++]=255&e;2===a&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,c[h++]=255&e);1===a&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,c[h++]=e>>8&255,c[h++]=255&e);return c},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],s=0,a=n-i;s<a;s+=16383)o.push(h(t,s,s+16383>a?a:s+16383));1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a<c;++a)r[a]=s[a],i[s.charCodeAt(a)]=a;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function h(t,e,n){for(var i,o,s=[],a=e;a<n;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){
33
+ var r=n(44),i=r.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function s(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},s.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},function(t,e,n){"use strict";(function(e,r){var i;t.exports=C,C.ReadableState=T;n(88).EventEmitter;var o=function(t,e){return t.listeners(e).length},s=n(89),a=n(44).Buffer,c=e.Uint8Array||function(){};var u,h=n(122);u=h&&h.debuglog?h.debuglog("stream"):function(){};var l,f,d,p=n(123),v=n(90),g=n(91).getHighWaterMark,m=n(45).codes,y=m.ERR_INVALID_ARG_TYPE,b=m.ERR_STREAM_PUSH_AFTER_EOF,_=m.ERR_METHOD_NOT_IMPLEMENTED,w=m.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(59)(C,s);var S=v.errorOrDestroy,x=["error","close","destroy","pause","resume"];function T(t,e,r){i=i||n(46),t=t||{},"boolean"!=typeof r&&(r=e instanceof i),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",r),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!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=n(93).StringDecoder),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function C(t){if(i=i||n(46),!(this instanceof C))return new C(t);var e=this instanceof i;this._readableState=new T(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),s.call(this)}function E(t,e,n,r,i){u("readableAddChunk",e);var o,s=t._readableState;if(null===e)s.reading=!1,function(t,e){if(u("onEofChunk"),e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,e.sync?O(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,A(t)))}(t,s);else if(i||(o=function(t,e){var n;r=e,a.isBuffer(r)||r instanceof c||"string"==typeof e||void 0===e||t.objectMode||(n=new y("chunk",["string","Buffer","Uint8Array"],e));var r;return n}(s,e)),o)S(t,o);else if(s.objectMode||e&&e.length>0)if("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.from(t)}(e)),r)s.endEmitted?S(t,new w):R(t,s,e,!0);else if(s.ended)S(t,new b);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!n?(e=s.decoder.write(e),s.objectMode||0!==e.length?R(t,s,e,!1):P(t,s)):R(t,s,e,!1)}else r||(s.reading=!1,P(t,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function R(t,e,n,r){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",n)):(e.length+=e.objectMode?1:n.length,r?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&O(t)),P(t,e)}Object.defineProperty(C.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),C.prototype.destroy=v.destroy,C.prototype._undestroy=v.undestroy,C.prototype._destroy=function(t,e){e(t)},C.prototype.push=function(t,e){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof t&&((e=e||r.defaultEncoding)!==r.encoding&&(t=a.from(t,e),e=""),n=!0),E(this,t,e,!1,n)},C.prototype.unshift=function(t){return E(this,t,null,!0,!1)},C.prototype.isPaused=function(){return!1===this._readableState.flowing},C.prototype.setEncoding=function(t){l||(l=n(93).StringDecoder);var e=new l(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";null!==r;)i+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};function M(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function O(t){var e=t._readableState;u("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(u("emitReadable",e.flowing),e.emittedReadable=!0,r.nextTick(A,t))}function A(t){var e=t._readableState;u("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,j(t)}function P(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(k,t,e))}function k(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var n=e.length;if(u("maybeReadMore read 0"),t.read(0),n===e.length)break}e.readingMore=!1}function I(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function D(t){u("readable nexttick read 0"),t.read(0)}function N(t,e){u("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),j(t),e.flowing&&!e.reading&&t.read(0)}function j(t){var e=t._readableState;for(u("flow",e.flowing);e.flowing&&null!==t.read(););}function L(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):n=e.buffer.consume(t,e.decoder),n);var n}function U(t){var e=t._readableState;u("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,r.nextTick(F,e,t))}function F(t,e){if(u("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var n=e._writableState;(!n||n.autoDestroy&&n.finished)&&e.destroy()}}function B(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}C.prototype.read=function(t){u("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return u("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?U(this):O(this),null;if(0===(t=M(t,e))&&e.ended)return 0===e.length&&U(this),null;var r,i=e.needReadable;return u("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&u("length less than watermark",i=!0),e.ended||e.reading?u("reading or ended",i=!1):i&&(u("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=M(n,e))),null===(r=t>0?L(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&U(this)),null!==r&&this.emit("data",r),r},C.prototype._read=function(t){S(this,new _("_read()"))},C.prototype.pipe=function(t,e){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,u("pipe count=%d opts=%j",i.pipesCount,e);var s=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?c:g;function a(e,r){u("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,u("cleanup"),t.removeListener("close",p),t.removeListener("finish",v),t.removeListener("drain",h),t.removeListener("error",d),t.removeListener("unpipe",a),n.removeListener("end",c),n.removeListener("end",g),n.removeListener("data",f),l=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}function c(){u("onend"),t.end()}i.endEmitted?r.nextTick(s):n.once("end",s),t.on("unpipe",a);var h=function(t){return function(){var e=t._readableState;u("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,j(t))}}(n);t.on("drain",h);var l=!1;function f(e){u("ondata");var r=t.write(e);u("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==B(i.pipes,t))&&!l&&(u("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function d(e){u("onerror",e),g(),t.removeListener("error",d),0===o(t,"error")&&S(t,e)}function p(){t.removeListener("finish",v),g()}function v(){u("onfinish"),t.removeListener("close",p),g()}function g(){u("unpipe"),n.unpipe(t)}return n.on("data",f),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",d),t.once("close",p),t.once("finish",v),t.emit("pipe",n),i.flowing||(u("pipe resume"),n.resume()),t},C.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=B(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,n)),this},C.prototype.on=function(t,e){var n=s.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,u("on readable",i.length,i.reading),i.length?O(this):i.reading||r.nextTick(D,this))),n},C.prototype.addListener=C.prototype.on,C.prototype.removeListener=function(t,e){var n=s.prototype.removeListener.call(this,t,e);return"readable"===t&&r.nextTick(I,this),n},C.prototype.removeAllListeners=function(t){var e=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||r.nextTick(I,this),e},C.prototype.resume=function(){var t=this._readableState;return t.flowing||(u("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,r.nextTick(N,t,e))}(this,t)),t.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(t){var e=this,n=this._readableState,r=!1;for(var i in t.on("end",(function(){if(u("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(u("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i)||(n.objectMode||i&&i.length)&&(e.push(i)||(r=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<x.length;o++)t.on(x[o],this.emit.bind(this,x[o]));return this._read=function(e){u("wrapped _read",e),r&&(r=!1,t.resume())},this},"function"==typeof Symbol&&(C.prototype[Symbol.asyncIterator]=function(){return void 0===f&&(f=n(126)),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(t){this._readableState&&(this._readableState.flowing=t)}}),C._fromList=L,Object.defineProperty(C.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(C.from=function(t,e){return void 0===d&&(d=n(127)),d(C,t,e)})}).call(this,n(35),n(38))},function(t,e,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var s=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}t.exports=a,t.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}m(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&m(t,"error",e,n)}(t,i,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var c=10;function u(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function h(t){return void 0===t._maxListeners?a.defaultMaxListeners:t._maxListeners}function l(t,e,n,r){var i,o,s,a;if(u(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),s=o[e]),void 0===s)s=o[e]=n,++t._eventsCount;else if("function"==typeof s?s=o[e]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=h(t))>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return t}function f(){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(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}function p(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(i):g(i,i.length)}function v(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function g(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function m(t,e,n,r){if("function"==typeof t.on)r.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(o){r.once&&t.removeEventListener(e,i),n(o)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");c=t}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},a.prototype.getMaxListeners=function(){return h(this)},a.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=i[t];if(void 0===c)return!1;if("function"==typeof c)o(c,this,e);else{var u=c.length,h=g(c,u);for(n=0;n<u;++n)o(h[n],this,e)}return!0},a.prototype.addListener=function(t,e){return l(this,t,e,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(t,e){return l(this,t,e,!0)},a.prototype.once=function(t,e){return u(e),this.on(t,d(this,t,e)),this},a.prototype.prependOnceListener=function(t,e){return u(e),this.prependListener(t,d(this,t,e)),this},a.prototype.removeListener=function(t,e){var n,r,i,o,s;if(u(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,i),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,s||e)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},a.prototype.listeners=function(t){return p(this,t,!0)},a.prototype.rawListeners=function(t){return p(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):v.call(t,e)},a.prototype.listenerCount=v,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){t.exports=n(88).EventEmitter},function(t,e,n){"use strict";(function(e){function n(t,e){i(t,e),r(t)}function r(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,o){var s=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(o?o(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(i,this,t)):e.nextTick(i,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!o&&t?s._writableState?s._writableState.errorEmitted?e.nextTick(r,s):(s._writableState.errorEmitted=!0,e.nextTick(n,s,t)):e.nextTick(n,s,t):o?(e.nextTick(r,s),o(t)):e.nextTick(r,s)})),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(t,e){var n=t._readableState,r=t._writableState;n&&n.autoDestroy||r&&r.autoDestroy?t.destroy(e):t.emit("error",e)}}}).call(this,n(38))},function(t,e,n){"use strict";var r=n(45).codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,n,i){var o=function(t,e,n){return null!=t.highWaterMark?t.highWaterMark:e?t[n]:null}(e,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new r(i?n:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},function(t,e,n){"use strict";(function(e,r){function i(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;t.entry=null;for(;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree.next=t}(e,t)}}var o;t.exports=C,C.WritableState=T;var s={deprecate:n(125)},a=n(89),c=n(44).Buffer,u=e.Uint8Array||function(){};var h,l=n(90),f=n(91).getHighWaterMark,d=n(45).codes,p=d.ERR_INVALID_ARG_TYPE,v=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_MULTIPLE_CALLBACK,m=d.ERR_STREAM_CANNOT_PIPE,y=d.ERR_STREAM_DESTROYED,b=d.ERR_STREAM_NULL_VALUES,_=d.ERR_STREAM_WRITE_AFTER_END,w=d.ERR_UNKNOWN_ENCODING,S=l.errorOrDestroy;function x(){}function T(t,e,s){o=o||n(46),t=t||{},"boolean"!=typeof s&&(s=e instanceof o),this.objectMode=!!t.objectMode,s&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=f(this,t,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,i=n.sync,o=n.writecb;if("function"!=typeof o)throw new g;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,i,o){--e.pendingcb,n?(r.nextTick(o,i),r.nextTick(P,t,e),t._writableState.errorEmitted=!0,S(t,i)):(o(i),t._writableState.errorEmitted=!0,S(t,i),P(t,e))}(t,n,i,e,o);else{var s=O(n)||t.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||M(t,n),i?r.nextTick(R,t,n,s,o):R(t,n,s,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function C(t){var e=this instanceof(o=o||n(46));if(!e&&!h.call(C,this))return new C(t);this._writableState=new T(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),a.call(this)}function E(t,e,n,r,i,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new y("write")):n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function R(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),P(t,e)}function M(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,o=new Array(r),s=e.corkedRequestsFree;s.entry=n;for(var a=0,c=!0;n;)o[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;o.allBuffers=c,E(t,e,!0,e.length,o,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new i(e),e.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,h=n.encoding,l=n.callback;if(E(t,e,!1,e.objectMode?1:u.length,u,h,l),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function O(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function A(t,e){t._final((function(n){e.pendingcb--,n&&S(t,n),e.prefinished=!0,t.emit("prefinish"),P(t,e)}))}function P(t,e){var n=O(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,r.nextTick(A,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return n}n(59)(C,a),T.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(T.prototype,"buffer",{get:s.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(C,Symbol.hasInstance,{value:function(t){return!!h.call(this,t)||this===C&&(t&&t._writableState instanceof T)}})):h=function(t){return t instanceof this},C.prototype.pipe=function(){S(this,new m)},C.prototype.write=function(t,e,n){var i,o=this._writableState,s=!1,a=!o.objectMode&&(i=t,c.isBuffer(i)||i instanceof u);return a&&!c.isBuffer(t)&&(t=function(t){return c.from(t)}(t)),"function"==typeof e&&(n=e,e=null),a?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof n&&(n=x),o.ending?function(t,e){var n=new _;S(t,n),r.nextTick(e,n)}(this,n):(a||function(t,e,n,i){var o;return null===n?o=new b:"string"==typeof n||e.objectMode||(o=new p("chunk",["string","Buffer"],n)),!o||(S(t,o),r.nextTick(i,o),!1)}(this,o,t,n))&&(o.pendingcb++,s=function(t,e,n,r,i,o){if(!n){var s=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=c.from(e,n));return e}(e,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=e.objectMode?1:r.length;e.length+=a;var u=e.length<e.highWaterMark;u||(e.needDrain=!0);if(e.writing||e.corked){var h=e.lastBufferedRequest;e.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},h?h.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else E(t,e,!1,a,r,i,o);return u}(this,o,a,t,e,n)),s},C.prototype.cork=function(){this._writableState.corked++},C.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||M(this,t))},C.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new w(t);return this._writableState.defaultEncoding=t,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(t,e,n){n(new v("_write()"))},C.prototype._writev=null,C.prototype.end=function(t,e,n){var i=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,n){e.ending=!0,P(t,e),n&&(e.finished?r.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,i,n),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(t){this._writableState&&(this._writableState.destroyed=t)}}),C.prototype.destroy=l.destroy,C.prototype._undestroy=l.undestroy,C.prototype._destroy=function(t,e){e(t)}}).call(this,n(35),n(38))},function(t,e,n){"use strict";var r=n(86).Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=c,this.end=u,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=h,this.end=l,e=3;break;default:return this.write=f,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function c(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function u(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function h(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function f(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<t.length?e?e+this.text(t,n):this.text(t,n):e||""},o.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},o.prototype.text=function(t,e){var n=function(t,e,n){var r=e.length-1;if(r<n)return 0;var i=s(e[r]);if(i>=0)return i>0&&(t.lastNeed=i-1),i;if(--r<n||-2===i)return 0;if((i=s(e[r]))>=0)return i>0&&(t.lastNeed=i-2),i;if(--r<n||-2===i)return 0;if((i=s(e[r]))>=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,n){"use strict";t.exports=h;var r=n(45).codes,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,s=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,c=n(46);function u(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function h(t){if(!(this instanceof h))return new h(t);c.call(this,t),this._transformState={afterTransform:u.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",l)}function l(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?f(this,null,null):this._flush((function(e,n){f(t,e,n)}))}function f(t,e,n){if(e)return t.emit("error",e);if(null!=n&&t.push(n),t._writableState.length)throw new a;if(t._transformState.transforming)throw new s;return t.push(null)}n(59)(h,c),h.prototype.push=function(t,e){return this._transformState.needTransform=!1,c.prototype.push.call(this,t,e)},h.prototype._transform=function(t,e,n){n(new i("_transform()"))},h.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},h.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},h.prototype._destroy=function(t,e){c.prototype._destroy.call(this,t,(function(t){e(t)}))}},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}Object.defineProperty(e,"__esModule",{value:!0}),e.Counter=void 0;var u=function(t){function e(){return i(this,e),s(this,a(e).apply(this,arguments))}var n,r,u;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(e,t),n=e,(r=[{key:"inc",value:function(t){return this.add(1,t),this}},{key:"add",value:function(t,e){if(t<0)throw new Error("Expected increment amount to be greater than -1. Received: ".concat(t));var n=this.get(e);return this.set(n?n.value+t:t,e),this}},{key:"reset",value:function(t){this.set(0,t)}}])&&o(n.prototype,r),u&&o(n,u),e}(n(96).Collector);e.Counter=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Collector=void 0;var r=n(64),i=n(97);function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var s=function(){function t(){var e,n,r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r=void 0,(n="data")in(e=this)?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,this.data=[]}var e,n,s;return e=t,(n=[{key:"get",value:function(t){return(0,i.findExistingMetric)(t,this.data)}},{key:"set",value:function(t,e){var n=(0,i.findExistingMetric)(e,this.data);return n?n.value=t:this.data.push({labels:e,value:t}),this}},{key:"collect",value:function(t){return(0,r.filter)(this.data,(function(e){return(0,r.matches)(t)(e.labels)}))}},{key:"resetAll",value:function(){var t=this;return(0,r.each)(this.data,(function(e){t.reset(e.labels)})),this}}])&&o(e.prototype,n),s&&o(e,s),t}();e.Collector=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.formatHistogramOrSummary=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"le",o="",s=i(e);s.length>0?(o+="".concat(t,"_count{").concat(s,"} ").concat(e.value.count,"\n"),o+="".concat(t,"_sum{").concat(s,"} ").concat(e.value.sum,"\n")):(o+="".concat(t,"_count ").concat(e.value.count,"\n"),o+="".concat(t,"_sum ").concat(e.value.sum,"\n"));return(0,r.reduce)(e.value.entries,(function(e,r,i){return s.length>0?o+="".concat(t,"_bucket{").concat(n,'="').concat(i,'",').concat(s,"} ").concat(r,"\n"):o+="".concat(t,"_bucket{").concat(n,'="').concat(i,'"} ').concat(r,"\n"),o}),o)},e.findExistingMetric=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t)return e[0];return(0,r.find)(e,(function(e){return(0,r.isEqual)(e.labels,t)}))},e.formatCounterOrGauge=function(t,e){var n=" ".concat(e.value.toString());if(null==e.labels||0===Object.keys(e.labels).length)return"".concat(t).concat(n,"\n");var i=(0,r.map)(e.labels,(function(t,e){return"".concat(e,'="').concat(t,'"')}));return"".concat(t,"{").concat(i.join(","),"}").concat(n,"\n")};var r=n(64);function i(t){var e=(0,r.map)(t.labels,(function(t,e){return"".concat(e,'="').concat(t,'"')}));return 0===e.length?"":"".concat(e.join(","))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MessagingState=void 0,function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"}(e.MessagingState||(e.MessagingState={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VoiceInputMode=void 0,function(t){t.PUSH_TO_TALK="PUSH_TO_TALK",t.VOICE_ACTIVITY="VOICE_ACTIVITY"}(e.VoiceInputMode||(e.VoiceInputMode={}))},function(t,e,n){(function(t,e){!function(t){function n(){}function r(t,e){if(t=void 0===t?"utf-8":t,e=void 0===e?{fatal:!1}:e,-1===o.indexOf(t.toLowerCase()))throw new RangeError("Failed to construct 'TextDecoder': The encoding label provided ('"+t+"') is invalid.");if(e.fatal)throw Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.")}function i(t){for(var e=0,n=Math.min(65536,t.length+1),r=new Uint16Array(n),i=[],o=0;;){var s=e<t.length;if(!s||o>=n-1){if(i.push(String.fromCharCode.apply(null,r.subarray(0,o))),!s)return i.join("");t=t.subarray(e),o=e=0}if(0==(128&(s=t[e++])))r[o++]=s;else if(192==(224&s)){var a=63&t[e++];r[o++]=(31&s)<<6|a}else if(224==(240&s)){a=63&t[e++];var c=63&t[e++];r[o++]=(31&s)<<12|a<<6|c}else if(240==(248&s)){65535<(s=(7&s)<<18|(a=63&t[e++])<<12|(c=63&t[e++])<<6|63&t[e++])&&(s-=65536,r[o++]=s>>>10&1023|55296,s=56320|1023&s),r[o++]=s}}}if(t.TextEncoder&&t.TextDecoder)return!1;var o=["utf-8","utf8","unicode-1-1-utf-8"];Object.defineProperty(n.prototype,"encoding",{value:"utf-8"}),n.prototype.encode=function(t,e){if((e=void 0===e?{stream:!1}:e).stream)throw Error("Failed to encode: the 'stream' option is unsupported.");e=0;for(var n=t.length,r=0,i=Math.max(32,n+(n>>>1)+7),o=new Uint8Array(i>>>3<<3);e<n;){var s=t.charCodeAt(e++);if(55296<=s&&56319>=s){if(e<n){var a=t.charCodeAt(e);56320==(64512&a)&&(++e,s=((1023&s)<<10)+(1023&a)+65536)}if(55296<=s&&56319>=s)continue}if(r+4>o.length&&(i+=8,i=(i*=1+e/t.length*2)>>>3<<3,(a=new Uint8Array(i)).set(o),o=a),0==(4294967168&s))o[r++]=s;else{if(0==(4294965248&s))o[r++]=s>>>6&31|192;else if(0==(4294901760&s))o[r++]=s>>>12&15|224,o[r++]=s>>>6&63|128;else{if(0!=(4292870144&s))continue;o[r++]=s>>>18&7|240,o[r++]=s>>>12&63|128,o[r++]=s>>>6&63|128}o[r++]=63&s|128}}return o.slice?o.slice(0,r):o.subarray(0,r)},Object.defineProperty(r.prototype,"encoding",{value:"utf-8"}),Object.defineProperty(r.prototype,"fatal",{value:!1}),Object.defineProperty(r.prototype,"ignoreBOM",{value:!1});var s=i;"function"==typeof e&&e.from?s=function(t){return e.from(t.buffer,t.byteOffset,t.byteLength).toString("utf-8")}:"function"==typeof Blob&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&(s=function(t){try{var e=URL.createObjectURL(new Blob([t],{type:"text/plain;charset=UTF-8"})),n=new XMLHttpRequest;return n.open("GET",e,!1),n.send(),n.responseText}catch(e){return i(t)}finally{e&&URL.revokeObjectURL(e)}}),r.prototype.decode=function(t,e){if((e=void 0===e?{stream:!1}:e).stream)throw Error("Failed to decode: the 'stream' option is unsupported.");return t=t instanceof Uint8Array?t:t.buffer instanceof ArrayBuffer?new Uint8Array(t.buffer):new Uint8Array(t),s(t)},t.TextEncoder=n,t.TextDecoder=r}("undefined"!=typeof window?window:void 0!==t?t:this)}).call(this,n(35),n(44).Buffer)},function(t,e,n){"use strict";e.byteLength=function(t){var e=u(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,r=u(t),s=r[0],a=r[1],c=new o(function(t,e,n){return 3*(e+n)/4-n}(0,s,a)),h=0,l=a>0?s-4:s;for(n=0;n<l;n+=4)e=i[t.charCodeAt(n)]<<18|i[t.charCodeAt(n+1)]<<12|i[t.charCodeAt(n+2)]<<6|i[t.charCodeAt(n+3)],c[h++]=e>>16&255,c[h++]=e>>8&255,c[h++]=255&e;2===a&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,c[h++]=255&e);1===a&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,c[h++]=e>>8&255,c[h++]=255&e);return c},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],s=0,a=n-i;s<a;s+=16383)o.push(h(t,s,s+16383>a?a:s+16383));1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a<c;++a)r[a]=s[a],i[s.charCodeAt(a)]=a;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function h(t,e,n){for(var i,o,s=[],a=e;a<n;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){
34
34
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
35
- e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,u=c>>1,h=-7,l=n?i-1:0,f=n?-1:1,d=t[e+l];for(l+=f,o=d&(1<<-h)-1,d>>=-h,h+=a;h>0;o=256*o+t[e+l],l+=f,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=256*s+t[e+l],l+=f,h-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=u}return(d?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,c,u=8*o-i-1,h=(1<<u)-1,l=h>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,v=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+l>=1?f/c:f*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(e*c-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[n+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[n+d]=255&s,d+=p,s/=256,u-=8);t[n+d-p]|=128*v}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n(105)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(47),i=n(106);r.Observable.prototype.filter=i.filter},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(81);e.filter=function(t,e){return r.filter(t,e)(this)}},function(t){t.exports=JSON.parse('{"name":"uneeq-js","version":"2.45.0","description":"","main":"dist/index.js","types":"dist/src/index.d.ts","scripts":{"start":"npx webpack -w","test-local":"npx karma start karma.conf.js -logLevel=DEBUG","test":"npx karma start --browsers ChromeHeadless --single-run","test:windows":"karma start karma.conf.js","build":"webpack --config webpack.config.prod.js && webpack --config webpack.config.umd.js","lint":"npx tslint -p tsconfig.json --fix","docs":"npx typedoc --options"},"files":["dist","!dist/test"],"author":"","license":"ISC","dependencies":{"@stomp/stompjs":"^6.0.0","@uehreka/seriously":"^1.0.1","fast-text-encoding":"^1.0.0","intrinsic-scale":"^3.0.4","promjs":"^0.4.1","rxjs":"^6.2.2","rxjs-compat":"^6.3.2","simple-peer":"9.11.0","webrtc-adapter":"8.1.0"},"devDependencies":{"@types/jasmine":"^2.8.8","@types/node":"^10.9.4","fetch-mock":"7.7.3","ignore-styles":"^5.0.1","jasmine":"^3.2.0","jasmine-class-mock":"^1.0.1","jasmine-core":"^3.3.0","karma":"^5.0.0","karma-chrome-launcher":"^2.2.0","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^2.0.1","karma-jasmine-html-reporter":"^1.4.0","karma-requirejs":"^1.1.0","karma-safari-launcher":"^1.0.0","karma-typescript":"^5.0.0","karma-typescript-es6-transform":"^5.0.0","nock":"^9.6.1","requirejs":"^2.3.6","ts-loader":"^5.0.0","ts-node":"^7.0.1","tslint":"^5.11.0","tslint-no-focused-test":"^0.5.0","typedoc":"^0.18.0","typescript":"^3.9.7","webpack":"^4.17.1","webpack-cli":"^3.1.0"}}')},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.API=void 0;e.API=class{constructor(t,e="",n=(()=>{})){this.xAuthToken="",this.apiUrl=t,this.apiKey=e,this.loggedOutHandler=n}set callId(t){this._callId=t}get authToken(){return this.xAuthToken}startSession(t){return this.postRequest("/api/v1/customers/",t,{},{"faceme-api-key":this.apiKey})}endCall(){return this.postRequest("/api/v1/calls/"+this._callId+"/endCall")}avatarStart(t){return this.postRequest("/api/v1/avatar/"+this._callId+"/start",t)}avatarWelcome(){return this.postRequest("/api/v1/avatar/"+this._callId+"/welcome")}avatarAsk(t){return this.postRequest("/api/v1/avatar/"+this._callId+"/ask",{text:t})}avatarStartRecording(){return this.postRequest("/api/v1/avatar/"+this._callId+"/audioCapture/start")}avatarStopRecording(){return this.postRequest("/api/v1/avatar/"+this._callId+"/audioCapture/stop")}avatarStopSpeaking(){return this.postRequest("/api/v1/avatar/"+this._callId+"/stopSpeaking")}getAvailableAvatarCount(){return this.getRequest("/api/v1/avatar/"+this._callId+"/available")}startSessionWithToken(t){return this.postRequest("/api/v2/clients/start-session",t,{},{"x-timezone-name":this.getTimeZone()})}setAvatarDebug(t){return this.putRequest("/api/v1/avatar/"+this._callId+"/debug",{enabled:t})}sendMediaUnavailable(t){return this.postRequest("/api/v1/avatar/"+this._callId+"/media/unavailable-update",t)}getEdgeNodeId(t){let e=t.replace("turn:","http://");e=e.replace("turns:","https://");const n=new Request(e,{method:"GET"});return this.makeRequest(n)}getTimeZone(){return Intl.DateTimeFormat().resolvedOptions().timeZone}makeRequest(t){return r(this,void 0,void 0,(function*(){const e=yield fetch(t);if(!e.ok){401===e.status&&this.loggedOutHandler();const t=yield e.json();throw{status:e.status,body:t}}return 204===e.status?new Promise((t,e)=>{t()}):(this.xAuthToken=e.headers.get("x-auth-token")||this.xAuthToken,yield e.json())}))}getRequest(t){const e=new Request(this.apiUrl+t,{method:"GET",credentials:"omit",headers:{"x-auth-token":this.xAuthToken}});return this.makeRequest(e)}postRequest(t,e={},n={},r={}){const i={method:"POST",credentials:"omit",headers:Object.assign({"Content-Type":"application/json","x-auth-token":this.xAuthToken},r),body:JSON.stringify(e)},o=new Request(this.apiUrl+t,Object.assign(i,n));return this.makeRequest(o)}putRequest(t,e={},n={}){const r={method:"PUT",credentials:"omit",headers:{"Content-Type":"application/json","x-auth-token":this.xAuthToken},body:JSON.stringify(e)},i=new Request(this.apiUrl+t,Object.assign(r,n));return this.makeRequest(i)}}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.DeviceManager=void 0;const i=n(37),o=n(110);e.DeviceManager=class{constructor(t,e){this.options=t,this.api=e,this.speakerConstraints={},this.publishStream=new MediaStream,this.devices={audioInput:[],audioOutput:[],videoInput:[]},this.previousMediaOptions={},this.mediaHandler=new o.MediaHandler(this.options,()=>this.remoteVideoReady()),this.initMediaConstraints(),this.getDevices(!1)}set edgeNodeId(t){this.mediaHandler.setEdgeNodeId(t),this.getDevices(!0)}enableLocalDevices(t,e){const n=this.options.uneeqOptions.sendLocalVideo!==t,r=this.options.uneeqOptions.sendLocalAudio!==e;(n||r)&&(this.previousMediaOptions={sendLocalVideo:this.options.uneeqOptions.sendLocalVideo,sendLocalAudio:this.options.uneeqOptions.sendLocalAudio},this.options.uneeqOptions.sendLocalVideo=t,this.options.uneeqOptions.sendLocalAudio=e,n&&!1===t&&this.publishStream.getVideoTracks().forEach(t=>t.stop()),r&&!1===e&&this.publishStream.getAudioTracks().forEach(t=>t.stop()),this.mediaHandler.publishingStream=!1,this.initMediaConstraints(),this.getDevices(!0))}getDevices(t=!0){if(!this.options.uneeqOptions.sendLocalVideo&&!this.options.uneeqOptions.sendLocalAudio)return void this.initStreamWithoutDevices();const e=this;this.publishStream=new MediaStream,this.options.streamManager.addCanvasVideoTrackToStream(this.publishStream),this.options.streamManager.addSilentAudioTrackToStream(this.publishStream),navigator.mediaDevices.getUserMedia(this.userMediaConstraints).then(e=>r(this,void 0,void 0,(function*(){if(this.initDeviceList(),this.options.internalMessages$.next({faceMeMessageType:"DevicePermissionAllowedInternal"}),t){if(this.options.uneeqOptions.sendLocalVideo){const t=e.getVideoTracks();t.length>0&&(this.publishStream.getVideoTracks().forEach(t=>this.publishStream.removeTrack(t)),this.publishStream.addTrack(t[0]))}if(this.options.uneeqOptions.sendLocalAudio){const t=e.getAudioTracks();t.length>0&&(this.publishStream.getAudioTracks().forEach(t=>this.publishStream.removeTrack(t)),this.publishStream.addTrack(t[0]))}this.mediaHandler.localStream$.next(this.publishStream)}}))).catch(t=>{e.options.userMessages.next(new i.DeviceErrorMessage(t)),console.error("device error: ",t),this.sendMediaUnavailableInfo("NotAllowedError"===t.name),this.revertMediaOptions()})}setMicDevice(t,e=!0){const n=this.devices.audioInput.filter(e=>e.deviceId===t);if(n&&n.length>0)this.options.uneeqOptions.preferredMicrophoneId=t,this.audioConstraints.deviceId=t,e&&(this.mediaHandler.publishingStream=!1,this.getDevices(!0)),this.options.userMessages.next(new i.SetMicSuccessMessage(t));else{const e="Uneeq setMic: Error setting device. Device not found.";this.options.userMessages.next(new i.DeviceNotFoundErrorMessage(e,t))}}setCamDevice(t,e=!0){const n=this.devices.videoInput.filter(e=>e.deviceId===t);if(n&&n.length>0)this.options.uneeqOptions.preferredCameraId=t,this.videoConstraints.deviceId=t,e&&(this.mediaHandler.publishingStream=!1,this.getDevices(!0)),this.options.userMessages.next(new i.SetCameraSuccessMessage(t));else{const e="Uneeq setCamera: Error setting device. Device not found.";this.options.userMessages.next(new i.DeviceNotFoundErrorMessage(e,t))}}setAvatarSpeakerDevice(t){if(this.mediaHandler.avatarVideoElement){const e=this.devices.audioOutput.filter(e=>e.deviceId===t);if(e&&e.length>0)this.options.uneeqOptions.preferredSpeakerId=t,this.mediaHandler.avatarVideoElement.setSinkId(t).then(()=>{this.speakerConstraints.deviceId=t,this.options.userMessages.next(new i.SetSpeakerSuccessMessage(t))}).catch(e=>{const n="Uneeq setSpeaker: Error setting device. "+e.message;this.options.userMessages.next(new i.DeviceNotFoundErrorMessage(n,t))});else{const e="Uneeq setSpeaker: Error setting device. Device not found.";this.options.userMessages.next(new i.DeviceNotFoundErrorMessage(e,t))}}}revertMediaOptions(){this.previousMediaOptions&&(this.options.uneeqOptions.sendLocalAudio=this.previousMediaOptions.sendLocalAudio,this.options.uneeqOptions.sendLocalVideo=this.previousMediaOptions.sendLocalVideo)}initMediaConstraints(){this.audioConstraints={},this.videoConstraints={facingMode:"user",width:640,height:480},this.userMediaConstraints={audio:!!this.options.uneeqOptions.sendLocalAudio&&this.audioConstraints,video:!!this.options.uneeqOptions.sendLocalVideo&&this.videoConstraints}}initStreamWithoutDevices(){this.publishStream.getTracks().forEach(t=>this.publishStream.removeTrack(t)),this.publishStream=new MediaStream,this.options.internalMessages$.next({faceMeMessageType:"DevicePermissionAllowedInternal"}),this.options.streamManager.addCanvasVideoTrackToStream(this.publishStream),this.options.streamManager.addSilentAudioTrackToStream(this.publishStream),this.mediaHandler.localStream$.next(this.publishStream)}remoteVideoReady(){this.options.uneeqOptions.preferredSpeakerId&&this.setAvatarSpeakerDevice(this.options.uneeqOptions.preferredSpeakerId)}sendMediaUnavailableInfo(t){return r(this,void 0,void 0,(function*(){const e=yield this.getMediaDevices(),n={audioInputs:e.audioInput.length,videoInputs:e.videoInput.length,hasUserDeniedPermission:t};return this.api.sendMediaUnavailable(n)}))}getMediaDevices(){return r(this,void 0,void 0,(function*(){const t=yield navigator.mediaDevices.enumerateDevices(),e={audioInput:[],audioOutput:[],videoInput:[]};return e.audioInput=t.filter(t=>"audioinput"===t.kind),e.audioOutput=t.filter(t=>"audiooutput"===t.kind),e.videoInput=t.filter(t=>"videoinput"===t.kind),e}))}initDeviceList(){return r(this,void 0,void 0,(function*(){navigator.mediaDevices.ondevicechange=t=>{this.initDeviceList()};const t=yield this.getMediaDevices();JSON.stringify(t)!==JSON.stringify(this.devices)&&(this.devices=t,this.options.uneeqOptions.preferredCameraId&&this.setCamDevice(this.options.uneeqOptions.preferredCameraId,!1),this.options.uneeqOptions.preferredMicrophoneId&&this.setMicDevice(this.options.uneeqOptions.preferredMicrophoneId,!1),this.options.userMessages.next(new i.DeviceListUpdatedMessage(this.devices)))}))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MediaHandler=void 0;const r=n(47),i=n(37),o=n(111),s=n(85),a=n(113),c=n(35),u=n(114);e.MediaHandler=class{constructor(t,e){this.options=t,this.remoteVideoReady=e,this.remoteStream$=new r.BehaviorSubject(null),this.localStream$=new r.BehaviorSubject(null),this.publishState$=new r.BehaviorSubject(s.PublishSubscribeState.DISCONNECTED),this.publishingStream=!1,this.remoteStream$.filter(t=>null!==t).subscribe(n=>{this.avatarVideoElement=this.options.digitalHumanVideoElement,this.avatarVideoElement.srcObject=n,t.uneeqOptions.avatarVideoContainerElement.style.overflow="hidden",t.uneeqOptions.avatarVideoContainerElement.innerHTML="",t.uneeqOptions.avatarVideoContainerElement.appendChild(this.avatarVideoElement),this.options.uneeqOptions.enableTransparentBackground&&this.initTransparentBackground(this.avatarVideoElement),e()}),this.localStream$.filter(t=>null!==t).subscribe(e=>{const n=document.createElement("video");this.localVideoElement=n,n.srcObject=e,n.autoplay=!0,n.muted=!0,n.setAttribute("playsinline","true"),n.setAttribute("style","width: 100%; height: 100%;"),t.uneeqOptions.localVideoContainerElement.innerHTML="",t.uneeqOptions.localVideoContainerElement.appendChild(n),this.options.voiceInputManager.initMicActivity(e),this.options.session.edgeNodeId&&!this.publishingStream&&this.publishVideo()}),this.options.internalMessages$.filter(t=>"AnswerMessage"===t.faceMeMessageType).subscribe(t=>{void 0!==this.webRTC&&this.webRTC.handleAnswerMessage(t)}),this.options.internalMessages$.filter(t=>"IceCandidateMessage"===t.faceMeMessageType).subscribe(t=>{void 0!==this.webRTC&&this.webRTC.handleIceCandidate(t)})}setEdgeNodeId(t){this.options.session.edgeNodeId=t,this.options.session.edgeNodeId&&!this.publishingStream&&this.localStream$.getValue()&&this.publishVideo()}unpublishVideo(){c.logger.log("UserSession | unpublishVideo"),void 0!==this.webRTC&&(this.webRTC.close(),this.webRTC=void 0),this.publishState$.next(s.PublishSubscribeState.DISCONNECTED)}pause(){const t=this.remoteStream$.getValue(),e=this.localStream$.getValue();this.avatarVideoElement.pause(),this.localVideoElement.pause(),e&&e.getTracks().forEach(t=>t.enabled=!1),t&&t.getTracks().forEach(t=>t.enabled=!1)}resume(){const t=this.remoteStream$.getValue(),e=this.localStream$.getValue();e&&e.getTracks().forEach(t=>t.enabled=!0),t&&t.getTracks().forEach(t=>t.enabled=!0),this.avatarVideoElement.play(),this.localVideoElement.play()}stopAllLocalStreams(){const t=this.localStream$.getValue();t&&t.getTracks().forEach(t=>t.stop()),this.publishingStream=!1}endSession(){this.stopAllLocalStreams(),this.options.uneeqOptions.localVideoContainerElement&&this.options.uneeqOptions.localVideoContainerElement&&(this.options.uneeqOptions.localVideoContainerElement.innerHTML=""),this.unpublishVideo(),this.options.uneeqOptions.avatarVideoContainerElement&&this.options.uneeqOptions.avatarVideoContainerElement&&(this.options.uneeqOptions.avatarVideoContainerElement.innerHTML="");const t=this.remoteStream$.getValue();t&&t.getTracks().forEach(t=>t.stop()),this.options.voiceInputManager.handleSessionEnd()}sendDataMessage(t){this.webRTC&&this.webRTC.sendDataMessage(t)}gatherWebRTCStats(t){var e;null===(e=this.webRTC)||void 0===e||e.getStats(t)}publishVideo(){const t=this.options.session.streamId,e=this.options.session.avatarStreamId,n=this.options.session.turnServerAddresses,r=this.options.session.turnUsername,o=this.options.session.turnPassword,a=this.options.session.forceTurnServerUse,h=this.publishState$,l=this.remoteStream$,f=this.localStream$.getValue();if(!f||!this.options.session.edgeNodeId)return void console.error("Not ready to publish");let d=0;c.logger.log("UserSession | publishVideo - stream:",f,"publishStreamName:",t),c.logger.log("PublishVideo with edge node id: ",this.options.session.edgeNodeId),this.publishingStream=!0,null==this.webRTC?(this.webRTC=new u.UneeqWebRTC({messaging:this.options.messaging,userMessages:this.options.userMessages,publishStreamName:t,subscribeStreamName:e,edgeNodeId:this.options.session.edgeNodeId||"id",diagnostics:this.options.uneeqOptions.diagnostics,onAddStream:t=>{c.logger.log("WEBRTC: onAddStream "+t.stream),l.next(t.stream)},forceTurnServerUse:a,iceServers:[{urls:n,username:r,credential:o}],onConnect:()=>{c.logger.log("UserSession | publishVideo | webRtcInstance | onStateChange - connected");h.getValue()===s.PublishSubscribeState.CONNECTING&&h.next(s.PublishSubscribeState.CONNECTED)},onError:t=>{c.logger.log("UserSession | publishVideo | webRtcInstance | onConnectionFailed - ",d),d<3?(d++,this.performWebRTCConnection(f),this.options.userMessages.next(new i.ConnectionLostMessage(s.PublishSubscribeState.DISCONNECTED))):(c.logger.log("UserSession | publishVideo | webRtcInstance | Publish failures > 3, so giving up"),h.next(s.PublishSubscribeState.FAILED),this.options.userMessages.next(new i.ConnectionLostMessage(s.PublishSubscribeState.FAILED)))}}),this.performWebRTCConnection(f)):this.webRTC.updateStreamTracks(f)}performWebRTCConnection(t){this.webRTC&&(this.publishState$.next(s.PublishSubscribeState.CONNECTING),this.webRTC.connect(t))}initTransparentBackground(t){const e=new a.CanvasService(this.options.uneeqOptions).createCanvas();(new o.VideoEditor).applyChromaKeyEffect(e,t),this.avatarVideoElement.style.display="none"}}},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.VideoEditor=void 0;const s=o(n(83));e.VideoEditor=class{constructor(){}applyChromaKeyEffect(t,e){try{n(112);const r=s.default();let i,o,a;i=r.transform("reformat"),i.source=e,i.width=t.width,i.height=t.height,a=r.target(t),o=r.effect("chroma"),o.source=i,a.source=o,r.go()}catch(t){console.error(t)}}}},function(t,e,n){"use strict";n.r(e),n(83).default.plugin("chroma",{shader:function(t,e){return e.vertex=["precision mediump float;","attribute vec4 position;","attribute vec2 texCoord;","uniform vec2 resolution;","uniform mat4 transform;","varying vec2 vTexCoord;","uniform vec4 screen;","uniform float balance;","varying float screenSat;","varying vec3 screenPrimary;","void main(void) {","\tfloat fmin = min(min(screen.r, screen.g), screen.b);","\tfloat fmax = max(max(screen.r, screen.g), screen.b);","\tfloat secondaryComponents;","\tscreenPrimary = step(fmax, screen.rgb);","\tsecondaryComponents = dot(1.0 - screenPrimary, screen.rgb);","\tscreenSat = fmax - mix(secondaryComponents - fmin, secondaryComponents / 2.0, balance);","\tvec4 screenPosition = vec4(position.xy * resolution / 2.0, position.z, position.w);","\tscreenPosition = transform * screenPosition;","\tgl_Position = screenPosition;","\tgl_Position.xy = screenPosition.xy * 2.0 / resolution;","\tgl_Position.z = screenPosition.z * 2.0 / (resolution.x / resolution.y);","\tvTexCoord = texCoord;","}"].join("\n"),e.fragment=[this.inputs.mask?"#define MASK":"","precision mediump float;","varying vec2 vTexCoord;","uniform sampler2D source;","uniform vec4 screen;","uniform float screenWeight;","uniform float balance;","uniform float clipBlack;","uniform float clipWhite;","uniform bool mask;","varying float screenSat;","varying vec3 screenPrimary;","void main(void) {","\tfloat pixelSat, secondaryComponents;","\tvec4 sourcePixel = texture2D(source, vTexCoord);","\tfloat fmin = min(min(sourcePixel.r, sourcePixel.g), sourcePixel.b);","\tfloat fmax = max(max(sourcePixel.r, sourcePixel.g), sourcePixel.b);","\tvec3 pixelPrimary = step(fmax, sourcePixel.rgb);","\tsecondaryComponents = dot(1.0 - pixelPrimary, sourcePixel.rgb);","\tpixelSat = fmax - mix(secondaryComponents - fmin, secondaryComponents / 2.0, balance);","\tfloat diffPrimary = dot(abs(pixelPrimary - screenPrimary), vec3(1.0));","\tfloat solid = step(1.0, step(pixelSat, 0.1) + step(fmax, 0.1) + diffPrimary);","\tfloat alpha = max(0.0, 1.0 - pixelSat / screenSat);","\talpha = smoothstep(clipBlack, clipWhite, alpha);","\tvec4 semiTransparentPixel = vec4((sourcePixel.rgb - (1.0 - alpha) * screen.rgb * screenWeight) / max(0.00001, alpha), alpha);","\tvec4 pixel = mix(semiTransparentPixel, sourcePixel, solid);","#ifdef MASK","\tgl_FragColor = vec4(vec3(pixel.a), 1.0);","#else","\tgl_FragColor = pixel;","#endif","}"].join("\n"),e},inPlace:!0,inputs:{source:{type:"image",uniform:"source"},screen:{type:"color",uniform:"screen",defaultValue:[66/255,195/255,31/255,1]},weight:{type:"number",uniform:"screenWeight",defaultValue:1,min:0},balance:{type:"number",uniform:"balance",defaultValue:1,min:0,max:1},clipBlack:{type:"number",uniform:"clipBlack",defaultValue:0,min:0,max:1},clipWhite:{type:"number",uniform:"clipWhite",defaultValue:1,min:0,max:1},mask:{type:"boolean",defaultValue:!1,uniform:"mask",shaderDirty:!0}},title:"Chroma Key",description:""})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CanvasService=void 0;e.CanvasService=class{constructor(t){this.canvasHeight=720,this.canvasWidth=1280,this.uneeqOptions=t}createCanvas(){const t=document.createElement("canvas");return this.uneeqOptions.avatarVideoContainerElement.appendChild(t),t.setAttribute("style","object-fit: cover; width: 100%; height: 100%;"),t.height=this.canvasHeight,t.width=this.canvasWidth,t}}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.UneeqWebRTC=void 0;const i=r(n(115)),o=r(n(82)),s=n(37),a=n(35);e.UneeqWebRTC=class{constructor(t){this.fakeDataChannel={},this.MESSAGING_ENDPOINT="/app/v2/webRTC",this.onStats=(t,e)=>{this.options.userMessages.next(new s.WebRtcStatsMessage(e)),this.statTimer=window.setTimeout(()=>{this.client.getStats(this.onStats)},2e3)},this.options=Object.assign({forceTurnServerUse:!1,iceServers:[]},t),this.log("Options",this.options),this.uniqueId=Math.random().toString(36).substring(2,12),RTCPeerConnection.prototype.createDataChannel||(this.warn("Implementing a fake createDataChannel"),RTCPeerConnection.prototype.createDataChannel=()=>this.fakeDataChannel)}connect(t){this.close(),this.client=new i.default({initiator:!0,config:{iceServers:this.options.iceServers},stream:t,channelName:"UneeqChannel"}),this.options.diagnostics&&this.enableDiagnostics(),this.fakeDataChannel.onopen&&(this.warn("Calling channel open on fake data channel"),this.fakeDataChannel.onopen()),this.client.on("error",t=>{this.log("error",t),void 0!==this.options.onError&&this.options.onError(t)}),this.client.on("signal",t=>{const e={payload:"",publishStreamName:this.options.publishStreamName,subscribeStreamName:this.options.subscribeStreamName,uniqueId:this.uniqueId,userAgent:navigator.userAgent,edgeNodeId:this.options.edgeNodeId};if("type"in t&&"offer"===t.type)e.payload=JSON.stringify({type:"offer",sdp:t.sdp}),e.type="OfferMessage",this.log("Offer payload ",e),this.options.messaging.send(this.MESSAGING_ENDPOINT,e);else if("candidate"in t){const n=JSON.stringify(t.candidate);this.options.forceTurnServerUse&&!n.match(/typ relay/)||n.match(/::/)||(e.payload=n,e.type="IceCandidate",this.log("IC payload ",e),this.options.messaging.send(this.MESSAGING_ENDPOINT,e))}else this.warn("WARNING Unhandled signal: ",JSON.stringify(t))}),this.client.on("connect",()=>{this.log("CONNECT"),void 0!==this.options.onConnect&&this.options.onConnect()}),this.client.on("data",t=>{this.log("data: "+t),void 0!==this.options.onData&&this.options.onData(t),this.options.userMessages.next(new s.WebRtcDataMessage(t))}),this.client.on("close",()=>{this.log("WebRTC session closed: "+this.uniqueId),this.client=null,void 0!==this.options.onClose&&this.options.onClose()}),this.client.on("stream",t=>{void 0!==this.options.onAddStream&&this.options.onAddStream({stream:t})})}close(){this.client&&(this.client.destroy(),this.client=null),this.statTimer&&clearTimeout(this.statTimer)}handleAnswerMessage(t){if(this.isMessageForUs(t)&&this.client){const e=JSON.parse(t.payload);return this.log("got answer: ",e),this.client.signal(e),!0}return this.log("ignoring answer: ",t),!1}handleIceCandidate(t){if(this.isMessageForUs(t)&&this.client){const e=JSON.parse(t.payload);if("candidate"in e&&""===e.candidate){if("edge"===o.default.browserDetails.browser){const t=this.client._pc;t.remoteDescription&&t.remoteDescription.type&&t.addIceCandidate(null)}}else this.client.signal({candidate:e});return!0}return!1}sendDataMessage(t){this.client.send(t)}getStats(t){return this.client&&this.client.getStats(t)}updateStreamTracks(t){t.getTracks().forEach(t=>{this.client._pc.getSenders().find(e=>t.kind===e.track.kind).replaceTrack(t).then(()=>{a.logger.log("Updated publish media stream track for "+t.kind)}).catch(e=>{a.logger.error("Error: updating publish media stream track failed for "+t.kind,e)})})}enableDiagnostics(){this.client._pc&&0!==this.client._pc.getStats.length&&(this.client._pc.getStats=""),this.client.getStats(this.onStats)}isMessageForUs(t){return t.requestUniqueId===this.uniqueId}log(t,...e){a.logger.log("UneeqWebRTC: "+t,e)}warn(t,...e){a.logger.warn("UneeqWebRTC: "+t,e)}}},function(t,e,n){
35
+ e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,u=c>>1,h=-7,l=n?i-1:0,f=n?-1:1,d=t[e+l];for(l+=f,o=d&(1<<-h)-1,d>>=-h,h+=a;h>0;o=256*o+t[e+l],l+=f,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=256*s+t[e+l],l+=f,h-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=u}return(d?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,c,u=8*o-i-1,h=(1<<u)-1,l=h>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,v=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+l>=1?f/c:f*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(e*c-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[n+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[n+d]=255&s,d+=p,s/=256,u-=8);t[n+d-p]|=128*v}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n(105)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(47),i=n(106);r.Observable.prototype.filter=i.filter},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(81);e.filter=function(t,e){return r.filter(t,e)(this)}},function(t){t.exports=JSON.parse('{"name":"uneeq-js","version":"2.46.2","description":"","main":"dist/index.js","types":"dist/src/index.d.ts","scripts":{"start":"npx webpack -w","test-local":"npx karma start karma.conf.js -logLevel=DEBUG","test":"npx karma start --browsers ChromeHeadless --single-run","test:windows":"karma start karma.conf.js","build":"webpack --config webpack.config.prod.js && webpack --config webpack.config.umd.js","lint":"npx tslint -p tsconfig.json --fix","docs":"npx typedoc --options"},"files":["dist","!dist/test"],"author":"","license":"ISC","dependencies":{"@stomp/stompjs":"^6.0.0","@uehreka/seriously":"^1.0.1","fast-text-encoding":"^1.0.0","intrinsic-scale":"^3.0.4","promjs":"^0.4.1","rxjs":"^6.2.2","rxjs-compat":"^6.3.2","simple-peer":"9.11.0","webrtc-adapter":"8.1.0"},"devDependencies":{"@types/jasmine":"^2.8.8","@types/node":"^10.9.4","fetch-mock":"7.7.3","ignore-styles":"^5.0.1","jasmine":"^3.2.0","jasmine-class-mock":"^1.0.1","jasmine-core":"^3.3.0","karma":"^5.0.0","karma-chrome-launcher":"^2.2.0","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^2.0.1","karma-jasmine-html-reporter":"^1.4.0","karma-requirejs":"^1.1.0","karma-safari-launcher":"^1.0.0","karma-typescript":"^5.0.0","karma-typescript-es6-transform":"^5.0.0","nock":"^9.6.1","requirejs":"^2.3.6","ts-loader":"^5.0.0","ts-node":"^7.0.1","tslint":"^5.11.0","tslint-no-focused-test":"^0.5.0","typedoc":"^0.18.0","typescript":"^3.9.7","webpack":"^4.17.1","webpack-cli":"^3.1.0"}}')},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.API=void 0;e.API=class{constructor(t,e="",n=(()=>{})){this.xAuthToken="",this.apiUrl=t,this.apiKey=e,this.loggedOutHandler=n}set callId(t){this._callId=t}get authToken(){return this.xAuthToken}startSession(t){return this.postRequest("/api/v1/customers/",t,{},{"faceme-api-key":this.apiKey})}endCall(){return this.postRequest("/api/v1/calls/"+this._callId+"/endCall")}avatarStart(t){return this.postRequest("/api/v1/avatar/"+this._callId+"/start",t)}avatarWelcome(){return this.postRequest("/api/v1/avatar/"+this._callId+"/welcome")}avatarAsk(t){return this.postRequest("/api/v1/avatar/"+this._callId+"/ask",{text:t})}avatarStartRecording(){return this.postRequest("/api/v1/avatar/"+this._callId+"/audioCapture/start")}avatarStopRecording(){return this.postRequest("/api/v1/avatar/"+this._callId+"/audioCapture/stop")}avatarStopSpeaking(){return this.postRequest("/api/v1/avatar/"+this._callId+"/stopSpeaking")}getAvailableAvatarCount(){return this.getRequest("/api/v1/avatar/"+this._callId+"/available")}startSessionWithToken(t){return this.postRequest("/api/v2/clients/start-session",t,{},{"x-timezone-name":this.getTimeZone()})}setAvatarDebug(t){return this.putRequest("/api/v1/avatar/"+this._callId+"/debug",{enabled:t})}sendMediaUnavailable(t){return this.postRequest("/api/v1/avatar/"+this._callId+"/media/unavailable-update",t)}getEdgeNodeId(t){let e=t.replace("turn:","http://");e=e.replace("turns:","https://");const n=new Request(e,{method:"GET"});return this.makeRequest(n)}getTimeZone(){return Intl.DateTimeFormat().resolvedOptions().timeZone}makeRequest(t){return r(this,void 0,void 0,(function*(){const e=yield fetch(t);if(!e.ok){401===e.status&&this.loggedOutHandler();const t=yield e.json();throw{status:e.status,body:t}}return 204===e.status?new Promise((t,e)=>{t()}):(this.xAuthToken=e.headers.get("x-auth-token")||this.xAuthToken,yield e.json())}))}getRequest(t){const e=new Request(this.apiUrl+t,{method:"GET",credentials:"omit",headers:{"x-auth-token":this.xAuthToken}});return this.makeRequest(e)}postRequest(t,e={},n={},r={}){const i={method:"POST",credentials:"omit",headers:Object.assign({"Content-Type":"application/json","x-auth-token":this.xAuthToken},r),body:JSON.stringify(e)},o=new Request(this.apiUrl+t,Object.assign(i,n));return this.makeRequest(o)}putRequest(t,e={},n={}){const r={method:"PUT",credentials:"omit",headers:{"Content-Type":"application/json","x-auth-token":this.xAuthToken},body:JSON.stringify(e)},i=new Request(this.apiUrl+t,Object.assign(r,n));return this.makeRequest(i)}}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.DeviceManager=void 0;const i=n(37),o=n(110);e.DeviceManager=class{constructor(t,e){this.options=t,this.api=e,this.speakerConstraints={},this.publishStream=new MediaStream,this.devices={audioInput:[],audioOutput:[],videoInput:[]},this.previousMediaOptions={},this.mediaHandler=new o.MediaHandler(this.options,()=>this.remoteVideoReady()),this.initMediaConstraints(),this.getDevices(!1)}set edgeNodeId(t){this.mediaHandler.setEdgeNodeId(t),this.getDevices(!0)}enableLocalDevices(t,e){const n=this.options.uneeqOptions.sendLocalVideo!==t,r=this.options.uneeqOptions.sendLocalAudio!==e;(n||r)&&(this.previousMediaOptions={sendLocalVideo:this.options.uneeqOptions.sendLocalVideo,sendLocalAudio:this.options.uneeqOptions.sendLocalAudio},this.options.uneeqOptions.sendLocalVideo=t,this.options.uneeqOptions.sendLocalAudio=e,n&&!1===t&&this.publishStream.getVideoTracks().forEach(t=>t.stop()),r&&!1===e&&this.publishStream.getAudioTracks().forEach(t=>t.stop()),this.mediaHandler.publishingStream=!1,this.initMediaConstraints(),this.getDevices(!0))}getDevices(t=!0){if(!this.options.uneeqOptions.sendLocalVideo&&!this.options.uneeqOptions.sendLocalAudio)return void this.initStreamWithoutDevices();const e=this;this.publishStream=new MediaStream,this.options.streamManager.addCanvasVideoTrackToStream(this.publishStream),this.options.streamManager.addSilentAudioTrackToStream(this.publishStream),navigator.mediaDevices.getUserMedia(this.userMediaConstraints).then(e=>r(this,void 0,void 0,(function*(){if(this.initDeviceList(),this.options.internalMessages$.next({faceMeMessageType:"DevicePermissionAllowedInternal"}),t){if(this.options.uneeqOptions.sendLocalVideo){const t=e.getVideoTracks();t.length>0&&(this.publishStream.getVideoTracks().forEach(t=>this.publishStream.removeTrack(t)),this.publishStream.addTrack(t[0]))}if(this.options.uneeqOptions.sendLocalAudio){const t=e.getAudioTracks();t.length>0&&(this.publishStream.getAudioTracks().forEach(t=>this.publishStream.removeTrack(t)),this.publishStream.addTrack(t[0]))}this.mediaHandler.localStream$.next(this.publishStream)}}))).catch(t=>{e.options.userMessages.next(new i.DeviceErrorMessage(t)),console.error("device error: ",t),this.sendMediaUnavailableInfo("NotAllowedError"===t.name),this.revertMediaOptions()})}setMicDevice(t,e=!0){const n=this.devices.audioInput.filter(e=>e.deviceId===t);if(n&&n.length>0)this.options.uneeqOptions.preferredMicrophoneId=t,this.audioConstraints.deviceId=t,e&&(this.mediaHandler.publishingStream=!1,this.getDevices(!0)),this.options.userMessages.next(new i.SetMicSuccessMessage(t));else{const e="Uneeq setMic: Error setting device. Device not found.";this.options.userMessages.next(new i.DeviceNotFoundErrorMessage(e,t))}}setCamDevice(t,e=!0){const n=this.devices.videoInput.filter(e=>e.deviceId===t);if(n&&n.length>0)this.options.uneeqOptions.preferredCameraId=t,this.videoConstraints.deviceId=t,e&&(this.mediaHandler.publishingStream=!1,this.getDevices(!0)),this.options.userMessages.next(new i.SetCameraSuccessMessage(t));else{const e="Uneeq setCamera: Error setting device. Device not found.";this.options.userMessages.next(new i.DeviceNotFoundErrorMessage(e,t))}}setAvatarSpeakerDevice(t){if(this.mediaHandler.avatarVideoElement){const e=this.devices.audioOutput.filter(e=>e.deviceId===t);if(e&&e.length>0)this.options.uneeqOptions.preferredSpeakerId=t,this.mediaHandler.avatarVideoElement.setSinkId(t).then(()=>{this.speakerConstraints.deviceId=t,this.options.userMessages.next(new i.SetSpeakerSuccessMessage(t))}).catch(e=>{const n="Uneeq setSpeaker: Error setting device. "+e.message;this.options.userMessages.next(new i.DeviceNotFoundErrorMessage(n,t))});else{const e="Uneeq setSpeaker: Error setting device. Device not found.";this.options.userMessages.next(new i.DeviceNotFoundErrorMessage(e,t))}}}revertMediaOptions(){this.previousMediaOptions&&(this.options.uneeqOptions.sendLocalAudio=this.previousMediaOptions.sendLocalAudio,this.options.uneeqOptions.sendLocalVideo=this.previousMediaOptions.sendLocalVideo)}initMediaConstraints(){this.audioConstraints={},this.videoConstraints={facingMode:"user",width:640,height:480},this.userMediaConstraints={audio:!!this.options.uneeqOptions.sendLocalAudio&&this.audioConstraints,video:!!this.options.uneeqOptions.sendLocalVideo&&this.videoConstraints}}initStreamWithoutDevices(){this.publishStream.getTracks().forEach(t=>this.publishStream.removeTrack(t)),this.publishStream=new MediaStream,this.options.internalMessages$.next({faceMeMessageType:"DevicePermissionAllowedInternal"}),this.options.streamManager.addCanvasVideoTrackToStream(this.publishStream),this.options.streamManager.addSilentAudioTrackToStream(this.publishStream),this.mediaHandler.localStream$.next(this.publishStream)}remoteVideoReady(){this.options.uneeqOptions.preferredSpeakerId&&this.setAvatarSpeakerDevice(this.options.uneeqOptions.preferredSpeakerId)}sendMediaUnavailableInfo(t){return r(this,void 0,void 0,(function*(){const e=yield this.getMediaDevices(),n={audioInputs:e.audioInput.length,videoInputs:e.videoInput.length,hasUserDeniedPermission:t};return this.api.sendMediaUnavailable(n)}))}getMediaDevices(){return r(this,void 0,void 0,(function*(){const t=yield navigator.mediaDevices.enumerateDevices(),e={audioInput:[],audioOutput:[],videoInput:[]};return e.audioInput=t.filter(t=>"audioinput"===t.kind),e.audioOutput=t.filter(t=>"audiooutput"===t.kind),e.videoInput=t.filter(t=>"videoinput"===t.kind),e}))}initDeviceList(){return r(this,void 0,void 0,(function*(){navigator.mediaDevices.ondevicechange=t=>{this.initDeviceList()};const t=yield this.getMediaDevices();JSON.stringify(t)!==JSON.stringify(this.devices)&&(this.devices=t,this.options.uneeqOptions.preferredCameraId&&this.setCamDevice(this.options.uneeqOptions.preferredCameraId,!1),this.options.uneeqOptions.preferredMicrophoneId&&this.setMicDevice(this.options.uneeqOptions.preferredMicrophoneId,!1),this.options.userMessages.next(new i.DeviceListUpdatedMessage(this.devices)))}))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MediaHandler=void 0;const r=n(47),i=n(37),o=n(111),s=n(85),a=n(113),c=n(31),u=n(114);e.MediaHandler=class{constructor(t,e){this.options=t,this.remoteVideoReady=e,this.remoteStream$=new r.BehaviorSubject(null),this.localStream$=new r.BehaviorSubject(null),this.publishState$=new r.BehaviorSubject(s.PublishSubscribeState.DISCONNECTED),this.publishingStream=!1,this.remoteStream$.filter(t=>null!==t).subscribe(n=>{this.avatarVideoElement=this.options.digitalHumanVideoElement,this.avatarVideoElement.srcObject=n,t.uneeqOptions.avatarVideoContainerElement.style.overflow="hidden",t.uneeqOptions.avatarVideoContainerElement.innerHTML="",t.uneeqOptions.avatarVideoContainerElement.appendChild(this.avatarVideoElement),this.options.uneeqOptions.enableTransparentBackground&&this.initTransparentBackground(this.avatarVideoElement),e()}),this.localStream$.filter(t=>null!==t).subscribe(e=>{const n=document.createElement("video");this.localVideoElement=n,n.srcObject=e,n.autoplay=!0,n.muted=!0,n.setAttribute("playsinline","true"),n.setAttribute("style","width: 100%; height: 100%;"),t.uneeqOptions.localVideoContainerElement.innerHTML="",t.uneeqOptions.localVideoContainerElement.appendChild(n),this.options.voiceInputManager.initMicActivity(e),this.options.session.edgeNodeId&&!this.publishingStream&&this.publishVideo()}),this.options.internalMessages$.filter(t=>"AnswerMessage"===t.faceMeMessageType).subscribe(t=>{void 0!==this.webRTC&&this.webRTC.handleAnswerMessage(t)}),this.options.internalMessages$.filter(t=>"IceCandidateMessage"===t.faceMeMessageType).subscribe(t=>{void 0!==this.webRTC&&this.webRTC.handleIceCandidate(t)})}setEdgeNodeId(t){this.options.session.edgeNodeId=t,this.options.session.edgeNodeId&&!this.publishingStream&&this.localStream$.getValue()&&this.publishVideo()}unpublishVideo(){c.logger.log("UserSession | unpublishVideo"),void 0!==this.webRTC&&(this.webRTC.close(),this.webRTC=void 0),this.publishState$.next(s.PublishSubscribeState.DISCONNECTED)}pause(){const t=this.remoteStream$.getValue(),e=this.localStream$.getValue();this.avatarVideoElement.pause(),this.localVideoElement.pause(),e&&e.getTracks().forEach(t=>t.enabled=!1),t&&t.getTracks().forEach(t=>t.enabled=!1)}resume(){const t=this.remoteStream$.getValue(),e=this.localStream$.getValue();e&&e.getTracks().forEach(t=>t.enabled=!0),t&&t.getTracks().forEach(t=>t.enabled=!0),this.avatarVideoElement.play(),this.localVideoElement.play()}stopAllLocalStreams(){const t=this.localStream$.getValue();t&&t.getTracks().forEach(t=>t.stop()),this.publishingStream=!1}endSession(){this.stopAllLocalStreams(),this.options.uneeqOptions.localVideoContainerElement&&this.options.uneeqOptions.localVideoContainerElement&&(this.options.uneeqOptions.localVideoContainerElement.innerHTML=""),this.unpublishVideo(),this.options.uneeqOptions.avatarVideoContainerElement&&this.options.uneeqOptions.avatarVideoContainerElement&&(this.options.uneeqOptions.avatarVideoContainerElement.innerHTML="");const t=this.remoteStream$.getValue();t&&t.getTracks().forEach(t=>t.stop()),this.options.voiceInputManager.handleSessionEnd()}sendDataMessage(t){this.webRTC&&this.webRTC.sendDataMessage(t)}gatherWebRTCStats(t){var e;null===(e=this.webRTC)||void 0===e||e.getStats(t)}publishVideo(){const t=this.options.session.streamId,e=this.options.session.avatarStreamId,n=this.options.session.turnServerAddresses,r=this.options.session.turnUsername,o=this.options.session.turnPassword,a=this.options.session.forceTurnServerUse,h=this.publishState$,l=this.remoteStream$,f=this.localStream$.getValue();if(!f||!this.options.session.edgeNodeId)return void console.error("Not ready to publish");let d=0;c.logger.log("UserSession | publishVideo - stream:",f,"publishStreamName:",t),c.logger.log("PublishVideo with edge node id: ",this.options.session.edgeNodeId),this.publishingStream=!0,null==this.webRTC?(this.webRTC=new u.UneeqWebRTC({messaging:this.options.messaging,userMessages:this.options.userMessages,publishStreamName:t,subscribeStreamName:e,edgeNodeId:this.options.session.edgeNodeId||"id",diagnostics:this.options.uneeqOptions.diagnostics,onAddStream:t=>{c.logger.log("WEBRTC: onAddStream "+t.stream),l.next(t.stream)},forceTurnServerUse:a,iceServers:[{urls:n,username:r,credential:o}],onConnect:()=>{c.logger.log("UserSession | publishVideo | webRtcInstance | onStateChange - connected");h.getValue()===s.PublishSubscribeState.CONNECTING&&h.next(s.PublishSubscribeState.CONNECTED)},onError:t=>{c.logger.log("UserSession | publishVideo | webRtcInstance | onConnectionFailed - ",d),d<3?(d++,this.performWebRTCConnection(f),this.options.userMessages.next(new i.ConnectionLostMessage(s.PublishSubscribeState.DISCONNECTED))):(c.logger.log("UserSession | publishVideo | webRtcInstance | Publish failures > 3, so giving up"),h.next(s.PublishSubscribeState.FAILED),this.options.userMessages.next(new i.ConnectionLostMessage(s.PublishSubscribeState.FAILED)))}}),this.performWebRTCConnection(f)):this.webRTC.updateStreamTracks(f)}performWebRTCConnection(t){this.webRTC&&(this.publishState$.next(s.PublishSubscribeState.CONNECTING),this.webRTC.connect(t))}initTransparentBackground(t){const e=new a.CanvasService(this.options.uneeqOptions).createCanvas();(new o.VideoEditor).applyChromaKeyEffect(e,t),this.avatarVideoElement.style.display="none"}}},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.VideoEditor=void 0;const s=o(n(83));e.VideoEditor=class{constructor(){}applyChromaKeyEffect(t,e){try{n(112);const r=s.default();let i,o,a;i=r.transform("reformat"),i.source=e,i.width=t.width,i.height=t.height,a=r.target(t),o=r.effect("chroma"),o.source=i,a.source=o,r.go()}catch(t){console.error(t)}}}},function(t,e,n){"use strict";n.r(e),n(83).default.plugin("chroma",{shader:function(t,e){return e.vertex=["precision mediump float;","attribute vec4 position;","attribute vec2 texCoord;","uniform vec2 resolution;","uniform mat4 transform;","varying vec2 vTexCoord;","uniform vec4 screen;","uniform float balance;","varying float screenSat;","varying vec3 screenPrimary;","void main(void) {","\tfloat fmin = min(min(screen.r, screen.g), screen.b);","\tfloat fmax = max(max(screen.r, screen.g), screen.b);","\tfloat secondaryComponents;","\tscreenPrimary = step(fmax, screen.rgb);","\tsecondaryComponents = dot(1.0 - screenPrimary, screen.rgb);","\tscreenSat = fmax - mix(secondaryComponents - fmin, secondaryComponents / 2.0, balance);","\tvec4 screenPosition = vec4(position.xy * resolution / 2.0, position.z, position.w);","\tscreenPosition = transform * screenPosition;","\tgl_Position = screenPosition;","\tgl_Position.xy = screenPosition.xy * 2.0 / resolution;","\tgl_Position.z = screenPosition.z * 2.0 / (resolution.x / resolution.y);","\tvTexCoord = texCoord;","}"].join("\n"),e.fragment=[this.inputs.mask?"#define MASK":"","precision mediump float;","varying vec2 vTexCoord;","uniform sampler2D source;","uniform vec4 screen;","uniform float screenWeight;","uniform float balance;","uniform float clipBlack;","uniform float clipWhite;","uniform bool mask;","varying float screenSat;","varying vec3 screenPrimary;","void main(void) {","\tfloat pixelSat, secondaryComponents;","\tvec4 sourcePixel = texture2D(source, vTexCoord);","\tfloat fmin = min(min(sourcePixel.r, sourcePixel.g), sourcePixel.b);","\tfloat fmax = max(max(sourcePixel.r, sourcePixel.g), sourcePixel.b);","\tvec3 pixelPrimary = step(fmax, sourcePixel.rgb);","\tsecondaryComponents = dot(1.0 - pixelPrimary, sourcePixel.rgb);","\tpixelSat = fmax - mix(secondaryComponents - fmin, secondaryComponents / 2.0, balance);","\tfloat diffPrimary = dot(abs(pixelPrimary - screenPrimary), vec3(1.0));","\tfloat solid = step(1.0, step(pixelSat, 0.1) + step(fmax, 0.1) + diffPrimary);","\tfloat alpha = max(0.0, 1.0 - pixelSat / screenSat);","\talpha = smoothstep(clipBlack, clipWhite, alpha);","\tvec4 semiTransparentPixel = vec4((sourcePixel.rgb - (1.0 - alpha) * screen.rgb * screenWeight) / max(0.00001, alpha), alpha);","\tvec4 pixel = mix(semiTransparentPixel, sourcePixel, solid);","#ifdef MASK","\tgl_FragColor = vec4(vec3(pixel.a), 1.0);","#else","\tgl_FragColor = pixel;","#endif","}"].join("\n"),e},inPlace:!0,inputs:{source:{type:"image",uniform:"source"},screen:{type:"color",uniform:"screen",defaultValue:[66/255,195/255,31/255,1]},weight:{type:"number",uniform:"screenWeight",defaultValue:1,min:0},balance:{type:"number",uniform:"balance",defaultValue:1,min:0,max:1},clipBlack:{type:"number",uniform:"clipBlack",defaultValue:0,min:0,max:1},clipWhite:{type:"number",uniform:"clipWhite",defaultValue:1,min:0,max:1},mask:{type:"boolean",defaultValue:!1,uniform:"mask",shaderDirty:!0}},title:"Chroma Key",description:""})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CanvasService=void 0;e.CanvasService=class{constructor(t){this.canvasHeight=720,this.canvasWidth=1280,this.uneeqOptions=t}createCanvas(){const t=document.createElement("canvas");return this.uneeqOptions.avatarVideoContainerElement.appendChild(t),t.setAttribute("style","object-fit: cover; width: 100%; height: 100%;"),t.height=this.canvasHeight,t.width=this.canvasWidth,t}}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.UneeqWebRTC=void 0;const i=r(n(115)),o=r(n(82)),s=n(37),a=n(31);e.UneeqWebRTC=class{constructor(t){this.fakeDataChannel={},this.MESSAGING_ENDPOINT="/app/v2/webRTC",this.onStats=(t,e)=>{this.options.userMessages.next(new s.WebRtcStatsMessage(e)),this.statTimer=window.setTimeout(()=>{this.client.getStats(this.onStats)},2e3)},this.options=Object.assign({forceTurnServerUse:!1,iceServers:[]},t),this.log("Options",this.options),this.uniqueId=Math.random().toString(36).substring(2,12),RTCPeerConnection.prototype.createDataChannel||(this.warn("Implementing a fake createDataChannel"),RTCPeerConnection.prototype.createDataChannel=()=>this.fakeDataChannel)}connect(t){this.close(),this.client=new i.default({initiator:!0,config:{iceServers:this.options.iceServers},stream:t,channelName:"UneeqChannel"}),this.options.diagnostics&&this.enableDiagnostics(),this.fakeDataChannel.onopen&&(this.warn("Calling channel open on fake data channel"),this.fakeDataChannel.onopen()),this.client.on("error",t=>{this.log("error",t),void 0!==this.options.onError&&this.options.onError(t)}),this.client.on("signal",t=>{const e={payload:"",publishStreamName:this.options.publishStreamName,subscribeStreamName:this.options.subscribeStreamName,uniqueId:this.uniqueId,userAgent:navigator.userAgent,edgeNodeId:this.options.edgeNodeId};if("type"in t&&"offer"===t.type)e.payload=JSON.stringify({type:"offer",sdp:t.sdp}),e.type="OfferMessage",this.log("Offer payload ",e),this.options.messaging.send(this.MESSAGING_ENDPOINT,e);else if("candidate"in t){const n=JSON.stringify(t.candidate);this.options.forceTurnServerUse&&!n.match(/typ relay/)||n.match(/::/)||(e.payload=n,e.type="IceCandidate",this.log("IC payload ",e),this.options.messaging.send(this.MESSAGING_ENDPOINT,e))}else this.warn("WARNING Unhandled signal: ",JSON.stringify(t))}),this.client.on("connect",()=>{this.log("CONNECT"),void 0!==this.options.onConnect&&this.options.onConnect()}),this.client.on("data",t=>{this.log("data: "+t),void 0!==this.options.onData&&this.options.onData(t),this.options.userMessages.next(new s.WebRtcDataMessage(t))}),this.client.on("close",()=>{this.log("WebRTC session closed: "+this.uniqueId),this.client=null,void 0!==this.options.onClose&&this.options.onClose()}),this.client.on("stream",t=>{void 0!==this.options.onAddStream&&this.options.onAddStream({stream:t})})}close(){this.client&&(this.client.destroy(),this.client=null),this.statTimer&&clearTimeout(this.statTimer)}handleAnswerMessage(t){if(this.isMessageForUs(t)&&this.client){const e=JSON.parse(t.payload);return this.log("got answer: ",e),this.client.signal(e),!0}return this.log("ignoring answer: ",t),!1}handleIceCandidate(t){if(this.isMessageForUs(t)&&this.client){const e=JSON.parse(t.payload);if("candidate"in e&&""===e.candidate){if("edge"===o.default.browserDetails.browser){const t=this.client._pc;t.remoteDescription&&t.remoteDescription.type&&t.addIceCandidate(null)}}else this.client.signal({candidate:e});return!0}return!1}sendDataMessage(t){this.client.send(t)}getStats(t){return this.client&&this.client.getStats(t)}updateStreamTracks(t){t.getTracks().forEach(t=>{this.client._pc.getSenders().find(e=>t.kind===e.track.kind).replaceTrack(t).then(()=>{a.logger.log("Updated publish media stream track for "+t.kind)}).catch(e=>{a.logger.error("Error: updating publish media stream track failed for "+t.kind,e)})})}enableDiagnostics(){this.client._pc&&0!==this.client._pc.getStats.length&&(this.client._pc.getStats=""),this.client.getStats(this.onStats)}isMessageForUs(t){return t.requestUniqueId===this.uniqueId}log(t,...e){a.logger.log("UneeqWebRTC: "+t,e)}warn(t,...e){a.logger.warn("UneeqWebRTC: "+t,e)}}},function(t,e,n){
36
36
  /*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
37
- const r=n(116)("simple-peer"),i=n(119),o=n(120),s=n(121),a=n(130),c=n(131),{Buffer:u}=n(44);function h(t){return t.replace(/a=ice-options:trickle\s\n/g,"")}class l extends s.Duplex{constructor(t){if(super(t=Object.assign({allowHalfOpen:!1},t)),this._id=o(4).toString("hex").slice(0,7),this._debug("new peer %o",t),this.channelName=t.initiator?t.channelName||o(20).toString("hex"):null,this.initiator=t.initiator||!1,this.channelConfig=t.channelConfig||l.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},l.config,t.config),this.offerOptions=t.offerOptions||{},this.answerOptions=t.answerOptions||{},this.sdpTransform=t.sdpTransform||(t=>t),this.streams=t.streams||(t.stream?[t.stream]:[]),this.trickle=void 0===t.trickle||t.trickle,this.allowHalfTrickle=void 0!==t.allowHalfTrickle&&t.allowHalfTrickle,this.iceCompleteTimeout=t.iceCompleteTimeout||5e3,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=t.wrtc&&"object"==typeof t.wrtc?t.wrtc:i(),!this._wrtc)throw"undefined"==typeof window?c(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):c(new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(t){return void this.destroy(c(t,"ERR_PC_CONSTRUCTOR"))}this._isReactNativeWebrtc="number"==typeof this._pc._peerConnectionId,this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=t=>{this._onIceCandidate(t)},"object"==typeof this._pc.peerIdentity&&this._pc.peerIdentity.catch(t=>{this.destroy(c(t,"ERR_PC_PEER_IDENTITY"))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=t=>{this._setupData(t)},this.streams&&this.streams.forEach(t=>{this.addStream(t)}),this._pc.ontrack=t=>{this._onTrack(t)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&"open"===this._channel.readyState}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(t){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if("string"==typeof t)try{t=JSON.parse(t)}catch(e){t={}}this._debug("signal()"),t.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),t.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(t.transceiverRequest.kind,t.transceiverRequest.init)),t.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(t.candidate):this._pendingCandidates.push(t.candidate)),t.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(t)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(t=>{this._addIceCandidate(t)}),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())}).catch(t=>{this.destroy(c(t,"ERR_SET_REMOTE_DESCRIPTION"))}),t.sdp||t.candidate||t.renegotiate||t.transceiverRequest||this.destroy(c(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(t){const e=new this._wrtc.RTCIceCandidate(t);this._pc.addIceCandidate(e).catch(t=>{var n;!e.address||e.address.endsWith(".local")?(n="Ignoring unsupported ICE candidate.",console.warn(n)):this.destroy(c(t,"ERR_ADD_ICE_CANDIDATE"))})}send(t){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(t)}}addTransceiver(t,e){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(t,e),this._needsNegotiation()}catch(t){this.destroy(c(t,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:t,init:e}})}}addStream(t){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),t.getTracks().forEach(e=>{this.addTrack(e,t)})}}addTrack(t,e){if(this.destroying)return;if(this.destroyed)throw c(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");const n=this._senderMap.get(t)||new Map;let r=n.get(e);if(r)throw r.removed?c(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):c(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED");r=this._pc.addTrack(t,e),n.set(e,r),this._senderMap.set(t,n),this._needsNegotiation()}replaceTrack(t,e,n){if(this.destroying)return;if(this.destroyed)throw c(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");const r=this._senderMap.get(t),i=r?r.get(n):null;if(!i)throw c(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");e&&this._senderMap.set(e,r),null!=i.replaceTrack?i.replaceTrack(e):this.destroy(c(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK"))}removeTrack(t,e){if(this.destroying)return;if(this.destroyed)throw c(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");const n=this._senderMap.get(t),r=n?n.get(e):null;if(!r)throw c(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{r.removed=!0,this._pc.removeTrack(r)}catch(t){"NS_ERROR_UNEXPECTED"===t.name?this._sendersAwaitingStable.push(r):this.destroy(c(t,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(t){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),t.getTracks().forEach(e=>{this.removeTrack(e,t)})}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,a(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1}))}negotiate(){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(t){this._destroy(t,()=>{})}_destroy(t,e){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",t&&(t.message||t)),a(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",t&&(t.message||t)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(t){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(t){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,t&&this.emit("error",t),this.emit("close"),e()}))}_setupData(t){if(!t.channel)return this.destroy(c(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=t.channel,this._channel.binaryType="arraybuffer","number"==typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=65536),this.channelName=this._channel.label,this._channel.onmessage=t=>{this._onChannelMessage(t)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=t=>{const e=t.error instanceof Error?t.error:new Error(`Datachannel error: ${t.message} ${t.filename}:${t.lineno}:${t.colno}`);this.destroy(c(e,"ERR_DATA_CHANNEL"))};let e=!1;this._closingInterval=setInterval(()=>{this._channel&&"closing"===this._channel.readyState?(e&&this._onChannelClose(),e=!0):e=!1},5e3)}_read(){}_write(t,e,n){if(this.destroyed)return n(c(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(t)}catch(t){return this.destroy(c(t,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=t,this._cb=n}_onFinish(){if(this.destroyed)return;const t=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?t():this.once("connect",t)}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(t=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(t.sdp=h(t.sdp)),t.sdp=this.sdpTransform(t.sdp);const e=()=>{if(this.destroyed)return;const e=this._pc.localDescription||t;this._debug("signal"),this.emit("signal",{type:e.type,sdp:e.sdp})};this._pc.setLocalDescription(t).then(()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?e():this.once("_iceComplete",e))}).catch(t=>{this.destroy(c(t,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(t=>{this.destroy(c(t,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(t=>{t.mid||!t.sender.track||t.requested||(t.requested=!0,this.addTransceiver(t.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(t=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(t.sdp=h(t.sdp)),t.sdp=this.sdpTransform(t.sdp);const e=()=>{if(this.destroyed)return;const e=this._pc.localDescription||t;this._debug("signal"),this.emit("signal",{type:e.type,sdp:e.sdp}),this.initiator||this._requestMissingTransceivers()};this._pc.setLocalDescription(t).then(()=>{this.destroyed||(this.trickle||this._iceComplete?e():this.once("_iceComplete",e))}).catch(t=>{this.destroy(c(t,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(t=>{this.destroy(c(t,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||"failed"===this._pc.connectionState&&this.destroy(c(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const t=this._pc.iceConnectionState,e=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",t,e),this.emit("iceStateChange",t,e),"connected"!==t&&"completed"!==t||(this._pcReady=!0,this._maybeReady()),"failed"===t&&this.destroy(c(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===t&&this.destroy(c(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(t){const e=t=>("[object Array]"===Object.prototype.toString.call(t.values)&&t.values.forEach(e=>{Object.assign(t,e)}),t);0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then(n=>{const r=[];n.forEach(t=>{r.push(e(t))}),t(null,r)},e=>t(e)):this._pc.getStats.length>0?this._pc.getStats(n=>{if(this.destroyed)return;const r=[];n.result().forEach(t=>{const n={};t.names().forEach(e=>{n[e]=t.stat(e)}),n.id=t.id,n.type=t.type,n.timestamp=t.timestamp,r.push(e(n))}),t(null,r)},e=>t(e)):t(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const t=()=>{this.destroyed||this.getStats((e,n)=>{if(this.destroyed)return;e&&(n=[]);const r={},i={},o={};let s=!1;n.forEach(t=>{"remotecandidate"!==t.type&&"remote-candidate"!==t.type||(r[t.id]=t),"localcandidate"!==t.type&&"local-candidate"!==t.type||(i[t.id]=t),"candidatepair"!==t.type&&"candidate-pair"!==t.type||(o[t.id]=t)});const a=t=>{s=!0;let e=i[t.localCandidateId];e&&(e.ip||e.address)?(this.localAddress=e.ip||e.address,this.localPort=Number(e.port)):e&&e.ipAddress?(this.localAddress=e.ipAddress,this.localPort=Number(e.portNumber)):"string"==typeof t.googLocalAddress&&(e=t.googLocalAddress.split(":"),this.localAddress=e[0],this.localPort=Number(e[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let n=r[t.remoteCandidateId];n&&(n.ip||n.address)?(this.remoteAddress=n.ip||n.address,this.remotePort=Number(n.port)):n&&n.ipAddress?(this.remoteAddress=n.ipAddress,this.remotePort=Number(n.portNumber)):"string"==typeof t.googRemoteAddress&&(n=t.googRemoteAddress.split(":"),this.remoteAddress=n[0],this.remotePort=Number(n[1])),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(n.forEach(t=>{"transport"===t.type&&t.selectedCandidatePairId&&a(o[t.selectedCandidatePairId]),("googCandidatePair"===t.type&&"true"===t.googActiveConnection||("candidatepair"===t.type||"candidate-pair"===t.type)&&t.selected)&&a(t)}),s||Object.keys(o).length&&!Object.keys(i).length){if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(e){return this.destroy(c(e,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const t=this._cb;this._cb=null,t(null)}"number"!=typeof this._channel.bufferedAmountLowThreshold&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}else setTimeout(t,100)})};t()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>65536||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||("stable"===this._pc.signalingState&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(t=>{this._pc.removeTrack(t),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(t){this.destroyed||(t.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:t.candidate.candidate,sdpMLineIndex:t.candidate.sdpMLineIndex,sdpMid:t.candidate.sdpMid}}):t.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),t.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(t){if(this.destroyed)return;let e=t.data;e instanceof ArrayBuffer&&(e=u.from(e)),this.push(e)}_onChannelBufferedAmountLow(){if(this.destroyed||!this._cb)return;this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const t=this._cb;this._cb=null,t(null)}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(t){this.destroyed||t.streams.forEach(e=>{this._debug("on track"),this.emit("track",t.track,e),this._remoteTracks.push({track:t.track,stream:e}),this._remoteStreams.some(t=>t.id===e.id)||(this._remoteStreams.push(e),a(()=>{this._debug("on stream"),this.emit("stream",e)}))})}_debug(){const t=[].slice.call(arguments);t[0]="["+this._id+"] "+t[0],r.apply(null,t)}}l.WEBRTC_SUPPORT=!!i(),l.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},l.channelConfig={},t.exports=l},function(t,e,n){(function(r){e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;e.splice(1,0,n,"color: inherit");let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,t=>{"%%"!==t&&(r++,"%c"===t&&(i=r))}),e.splice(i,0,n)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(t){}!t&&void 0!==r&&"env"in r&&(t=r.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=n(117)(e);const{formatters:i}=t.exports;i.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this,n(38))},function(t,e,n){t.exports=function(t){function e(t){let n,i,o,s=null;function a(...t){if(!a.enabled)return;const r=a,i=Number(new Date),o=i-(n||i);r.diff=o,r.prev=n,r.curr=i,n=i,t[0]=e.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let s=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,(n,i)=>{if("%%"===n)return"%";s++;const o=e.formatters[i];if("function"==typeof o){const e=t[s];n=o.call(r,e),t.splice(s,1),s--}return n}),e.formatArgs.call(r,t);(r.log||e.log).apply(r,t)}return a.namespace=t,a.useColors=e.useColors(),a.color=e.selectColor(t),a.extend=r,a.destroy=e.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==e.namespaces&&(i=e.namespaces,o=e.enabled(t)),o),set:t=>{s=t}}),"function"==typeof e.init&&e.init(a),a}function r(t,n){const r=e(this.namespace+(void 0===n?":":n)+t);return r.log=this.log,r}function i(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}return e.debug=e,e.default=e,e.coerce=function(t){if(t instanceof Error)return t.stack||t.message;return t},e.disable=function(){const t=[...e.names.map(i),...e.skips.map(i).map(t=>"-"+t)].join(",");return e.enable(""),t},e.enable=function(t){let n;e.save(t),e.namespaces=t,e.names=[],e.skips=[];const r=("string"==typeof t?t:"").split(/[\s,]+/),i=r.length;for(n=0;n<i;n++)r[n]&&("-"===(t=r[n].replace(/\*/g,".*?"))[0]?e.skips.push(new RegExp("^"+t.slice(1)+"$")):e.names.push(new RegExp("^"+t+"$")))},e.enabled=function(t){if("*"===t[t.length-1])return!0;let n,r;for(n=0,r=e.skips.length;n<r;n++)if(e.skips[n].test(t))return!1;for(n=0,r=e.names.length;n<r;n++)if(e.names[n].test(t))return!0;return!1},e.humanize=n(118),e.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach(n=>{e[n]=t[n]}),e.names=[],e.skips=[],e.formatters={},e.selectColor=function(t){let n=0;for(let e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n|=0;return e.colors[Math.abs(n)%e.colors.length]},e.enable(e.load()),e}},function(t,e){var n=1e3,r=6e4,i=60*r,o=24*i;function s(t,e,n,r){var i=e>=1.5*n;return Math.round(t/n)+" "+r+(i?"s":"")}t.exports=function(t,e){e=e||{};var a=typeof t;if("string"===a&&t.length>0)return function(t){if((t=String(t)).length>100)return;var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!e)return;var s=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return 6048e5*s;case"days":case"day":case"d":return s*o;case"hours":case"hour":case"hrs":case"hr":case"h":return s*i;case"minutes":case"minute":case"mins":case"min":case"m":return s*r;case"seconds":case"second":case"secs":case"sec":case"s":return s*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(t);if("number"===a&&isFinite(t))return e.long?function(t){var e=Math.abs(t);if(e>=o)return s(t,e,o,"day");if(e>=i)return s(t,e,i,"hour");if(e>=r)return s(t,e,r,"minute");if(e>=n)return s(t,e,n,"second");return t+" ms"}(t):function(t){var e=Math.abs(t);if(e>=o)return Math.round(t/o)+"d";if(e>=i)return Math.round(t/i)+"h";if(e>=r)return Math.round(t/r)+"m";if(e>=n)return Math.round(t/n)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e){t.exports=function(){if("undefined"==typeof globalThis)return null;var t={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return t.RTCPeerConnection?t:null}},function(t,e,n){"use strict";(function(e,r){var i=n(86).Buffer,o=e.crypto||e.msCrypto;o&&o.getRandomValues?t.exports=function(t,e){if(t>4294967295)throw new RangeError("requested too many random bytes");var n=i.allocUnsafe(t);if(t>0)if(t>65536)for(var s=0;s<t;s+=65536)o.getRandomValues(n.slice(s,s+65536));else o.getRandomValues(n);if("function"==typeof e)return r.nextTick((function(){e(null,n)}));return n}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,n(34),n(38))},function(t,e,n){(e=t.exports=n(87)).Stream=e,e.Readable=e,e.Writable=n(92),e.Duplex=n(46),e.Transform=n(94),e.PassThrough=n(128),e.finished=n(79),e.pipeline=n(129)},function(t,e){},function(t,e,n){"use strict";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var s=n(44).Buffer,a=n(124).inspect,c=a&&a.custom||"inspect";t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var e,n,u;return e=t,(n=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n}},{key:"concat",value:function(t){if(0===this.length)return s.alloc(0);for(var e,n,r,i=s.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,n=i,r=a,s.prototype.copy.call(e,n,r),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var n;return t<this.head.data.length?(n=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):n=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,n=1,r=e.data;for(t-=r.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?r+=i:r+=i.slice(0,t),0==(t-=o)){o===i.length?(++n,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(t){var e=s.allocUnsafe(t),n=this.head,r=1;for(n.data.copy(e),t-=n.data.length;n=n.next;){var i=n.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,e}},{key:c,value:function(t,e){return a(this,function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},e,{depth:0,customInspect:!1}))}}])&&o(e.prototype,n),u&&o(e,u),t}()},function(t,e){},function(t,e,n){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(t){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}}).call(this,n(34))},function(t,e,n){"use strict";(function(e){var r;function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var o=n(79),s=Symbol("lastResolve"),a=Symbol("lastReject"),c=Symbol("error"),u=Symbol("ended"),h=Symbol("lastPromise"),l=Symbol("handlePromise"),f=Symbol("stream");function d(t,e){return{value:t,done:e}}function p(t){var e=t[s];if(null!==e){var n=t[f].read();null!==n&&(t[h]=null,t[s]=null,t[a]=null,e(d(n,!1)))}}function v(t){e.nextTick(p,t)}var g=Object.getPrototypeOf((function(){})),m=Object.setPrototypeOf((i(r={get stream(){return this[f]},next:function(){var t=this,n=this[c];if(null!==n)return Promise.reject(n);if(this[u])return Promise.resolve(d(void 0,!0));if(this[f].destroyed)return new Promise((function(n,r){e.nextTick((function(){t[c]?r(t[c]):n(d(void 0,!0))}))}));var r,i=this[h];if(i)r=new Promise(function(t,e){return function(n,r){t.then((function(){e[u]?n(d(void 0,!0)):e[l](n,r)}),r)}}(i,this));else{var o=this[f].read();if(null!==o)return Promise.resolve(d(o,!1));r=new Promise(this[l])}return this[h]=r,r}},Symbol.asyncIterator,(function(){return this})),i(r,"return",(function(){var t=this;return new Promise((function(e,n){t[f].destroy(null,(function(t){t?n(t):e(d(void 0,!0))}))}))})),r),g);t.exports=function(t){var e,n=Object.create(m,(i(e={},f,{value:t,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,c,{value:null,writable:!0}),i(e,u,{value:t._readableState.endEmitted,writable:!0}),i(e,l,{value:function(t,e){var r=n[f].read();r?(n[h]=null,n[s]=null,n[a]=null,t(d(r,!1))):(n[s]=t,n[a]=e)},writable:!0}),e));return n[h]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=n[a];return null!==e&&(n[h]=null,n[s]=null,n[a]=null,e(t)),void(n[c]=t)}var r=n[s];null!==r&&(n[h]=null,n[s]=null,n[a]=null,r(d(void 0,!0))),n[u]=!0})),t.on("readable",v.bind(null,n)),n}}).call(this,n(38))},function(t,e){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},function(t,e,n){"use strict";t.exports=i;var r=n(94);function i(t){if(!(this instanceof i))return new i(t);r.call(this,t)}n(59)(i,r),i.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){"use strict";var r;var i=n(45).codes,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function c(t,e,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var a=!1;t.on("close",(function(){a=!0})),void 0===r&&(r=n(79)),r(t,{readable:e,writable:i},(function(t){if(t)return o(t);a=!0,o()}));var c=!1;return function(e){if(!a&&!c)return c=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new s("pipe"))}}function u(t){t()}function h(t,e){return t.pipe(e)}function l(t){return t.length?"function"!=typeof t[t.length-1]?a:t.pop():a}t.exports=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r,i=l(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new o("streams");var s=e.map((function(t,n){var o=n<e.length-1;return c(t,o,n>0,(function(t){r||(r=t),t&&s.forEach(u),o||(s.forEach(u),i(r))}))}));return e.reduce(h)}},function(t,e,n){(function(e){/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
38
- let n;t.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:e):t=>(n||(n=Promise.resolve())).then(t).catch(t=>setTimeout(()=>{throw t},0))}).call(this,n(34))},function(t,e,n){"use strict";function r(t,e){for(const n in e)Object.defineProperty(t,n,{value:e[n],enumerable:!0,configurable:!0});return t}t.exports=function(t,e,n){if(!t||"string"==typeof t)throw new TypeError("Please pass an Error to err-code");n||(n={}),"object"==typeof e&&(n=e,e=""),e&&(n.code=e);try{return r(t,n)}catch(e){n.message=t.message,n.stack=t.stack;const i=function(){};i.prototype=Object.create(Object.getPrototypeOf(t));return r(new i,n)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DigitalHumanVideoPlayManager=void 0;const r=n(63),i=n(35);e.DigitalHumanVideoPlayManager=class{constructor(t,e){this.messages=t,this.publicUnmuteDigitalHumanMethod=e,this.remoteVideoPlayCount=0}play(t){this.video=t,this.playRemoteVideo()}unmuteVideo(){this.video&&this.video.muted&&(this.video.muted=!1,this.messages.next(new r.DigitalHumanUnmuted))}playRemoteVideo(){this.video&&(this.video.onerror=t=>{this.messages.next(new r.DigitalHumanVideoError(t))},this.video.play().then(()=>{this.messages.next(new r.DigitalHumanUnmuted)}).catch(()=>{this.digitalHumanFailedToPlayUnmuted()}))}digitalHumanFailedToPlayUnmuted(){this.messages.next(new r.DigitalHumanFailedToPlay),this.video.muted=!0,this.video.play().then(()=>{i.logger.log("Muting the digital human and playing it succeeded."),this.messages.next(new r.DigitalHumanPlayedInMutedModeSuccess),this.video.addEventListener("click",()=>{this.publicUnmuteDigitalHumanMethod()},{once:!0})}).catch(t=>{i.logger.log("Could not play digital human video even as muted, starting exponential backoff.",t),this.playRemoteVideoWithExponentialBackoff()})}playRemoteVideoWithExponentialBackoff(){this.video&&(this.video.autoplay=!0,this.video.play().then(()=>{this.messages.next(new r.DigitalHumanUnmuted)}),this.remoteVideoPlayCount++,setTimeout(()=>{this.remoteVideoPlayCount<10&&this.playRemoteVideoWithExponentialBackoff()},100*(this.remoteVideoPlayCount-1)))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MessageHandler=void 0;const r=n(37),i=n(80);e.MessageHandler=class{constructor(t,e){this.internalMessages$=t,this.messages=e,this.deviceManager={getDevices:(t,e)=>{}},this.getMessagesOfType("AvatarQuestionText").subscribe(t=>{const e={type:i.PromMessageType.QuestionMessageReceived,value:{id:t.id,receivedOn:Date.now()}};this.internalMessages$.next({faceMeMessageType:"prom",promMsg:e}),this.messages.next(new r.AvatarQuestionMessage(t.question,t.id))}),this.getMessagesOfType("AvatarAnswerText").subscribe(t=>{const e={type:i.PromMessageType.AnswerMessageReceived,value:{id:t.questionId,receivedOn:Date.now()}};this.internalMessages$.next({faceMeMessageType:"prom",promMsg:e}),this.messages.next(new r.AvatarAnswerMessage(t.answer,t.answerAvatar,t.answerSpeech,t.questionId))}),this.getMessagesOfType("AvatarAnswerHTML").subscribe(t=>{this.messages.next(new r.AvatarAnswerContentMessage(t.html,t.messageId,t.hasDisplayHtml)),this.messages.next(new r.InstructionsMessage(t.instructions))}),this.getMessagesOfType("AvatarTextInputStarted").subscribe(t=>this.messages.next(new r.StartedSpeakingMessage)),this.getMessagesOfType("AvatarTextInputFinished").subscribe(t=>{this.messages.next(new r.FinishedSpeakingMessage),this.messages.next(new r.AvatarTextInputFinishedMessage)}),this.getMessagesOfType("AvatarStarting").subscribe(t=>{this.deviceManager.edgeNodeId=t.edgeNodeId}),this.getMessagesOfType("ClientMediaStreamUpdate").subscribe(t=>{this.messages.next(new r.ClientMediaStreamUpdateMessage(t.clientStreamingAudio,t.clientStreamingVideo,t.serverStreamingAudio,t.serverStreamingVideo)),t.clientStreamingAudio&&t.clientStreamingVideo&&t.serverStreamingAudio&&t.serverStreamingVideo&&(this.internalMessages$.next({faceMeMessageType:"sessionLive"}),this.internalMessages$.next({faceMeMessageType:"remoteVideoReadyToPlay"}))}),this.getMessagesOfType("SessionErrorMessage").subscribe(t=>{console.error(t.error),this.messages.next(new r.SessionErrorMessage(t.error))}),this.getMessagesOfType("SessionInfoMessage").subscribe(t=>{this.messages.next(new r.SessionInfoMessage(t.info))}),this.getMessagesOfType("SessionEndedMessage").subscribe(()=>{const t={type:i.PromMessageType.SessionEnded,value:{receivedOn:Date.now()}};this.internalMessages$.next({faceMeMessageType:"prom",promMsg:t}),this.internalMessages$.next({faceMeMessageType:"sessionEnd"})}),this.getMessagesOfType("AvatarRequestCompleted").subscribe(t=>{this.messages.next(new r.AvatarRequestCompleted(t.reason))}),this.getMessagesOfType("AvatarRequestIgnored").subscribe(t=>{this.messages.next(new r.AvatarRequestIgnored(t.reason))})}setDeviceManager(t){this.deviceManager=t}getMessagesOfType(t){return this.internalMessages$.filter(e=>e.faceMeMessageType===t)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r={};e.default=void 0;var i=n(135),o=n(139);Object.keys(o).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(r,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}}))}));e.default=function(){return new i.Registry}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Registry=void 0;var r=n(64),i=n(95),o=n(137),s=n(138),a=n(97);function c(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var u=function(){function t(){var e,n,r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r=void 0,(n="data")in(e=this)?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,this.data={counter:{},gauge:{},histogram:{}}}var e,n,u;return e=t,(n=[{key:"validateInput",value:function(t,e,n,i){if(""===String(e))throw new Error("Metric name cannot be empty");if(-1===["counter","gauge","histogram"].indexOf(t))throw new Error("Unknown metric type ".concat(t));if("string"!=typeof n&&null!=n)throw new Error("help must be string or undefined/null");if((0,r.has)(this.data,"".concat(t,".").concat(e)))throw new Error("A metric with the name '".concat(e,"' already exists for type '").concat(t,"'"));if(!Array.isArray(i)&&null!=i)throw new Error("buckets must be array or undefined/null")}},{key:"create",value:function(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return this.validateInput(t,e,r,a),"counter"===t?(n=new i.Counter,this.data.counter[e]={help:r,instance:n,type:t}):"gauge"===t?(n=new o.Gauge,this.data.gauge[e]={help:r,instance:n,type:t}):(n=new s.Histogram(a),this.data.histogram[e]={help:r,instance:n,type:t}),n}},{key:"metrics",value:function(){return(0,r.reduce)(this.data,(function(t,e,n){return t+(0,r.reduce)(e,(function(t,e,i){var o=e.instance.collect(),s=t;return e.help.length>0&&(s+="# HELP ".concat(i," ").concat(e.help,"\n")),s+="# TYPE ".concat(i," ").concat(n,"\n"),s+=(0,r.reduce)(o,(function(t,e){return t+("histogram"===n?(0,a.formatHistogramOrSummary)(i,e):(0,a.formatCounterOrGauge)(i,e))}),"")}),"")}),"")}},{key:"reset",value:function(){return(0,r.each)(this.data,(function(t){(0,r.each)(t,(function(t){t.instance.resetAll()}))})),this}},{key:"clear",value:function(){return this.data={counter:{},gauge:{},histogram:{}},this}},{key:"get",value:function(t,e){var n=(null!=t?[this.data[t]]:(0,r.valuesIn)(this.data)).find((function(t){return(0,r.has)(t,e)}));return null!=n?n[e].instance:void 0}}])&&c(e.prototype,n),u&&c(e,u),t}();e.Registry=u},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}Object.defineProperty(e,"__esModule",{value:!0}),e.Gauge=void 0;var u=function(t){function e(){return i(this,e),s(this,a(e).apply(this,arguments))}var n,r,u;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(e,t),n=e,(r=[{key:"dec",value:function(t){var e=this.get(t);return this.set(e?e.value-1:0,t),this}},{key:"sub",value:function(t,e){var n=this.get(e);return this.set(n?n.value-t:0,e),this}}])&&o(n.prototype,r),u&&o(n,u),e}(n(95).Counter);e.Gauge=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Histogram=void 0;var r=n(64);function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return!e||"object"!==i(e)&&"function"!=typeof e?u(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t,e){return(h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function l(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function f(t){return{entries:(0,r.reduce)(t,(function(t,e){return t[e.toString()]=0,t}),{"+Inf":0}),sum:0,count:0,raw:[]}}var d=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return o(this,e),l(u(t=a(this,c(e).call(this))),"buckets",void 0),t.buckets=n.sort((function(t,e){return t>e?1:-1})),t.set(f(t.buckets)),t.observe=t.observe.bind(u(t)),t}var n,i,d;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&h(t,e)}(e,t),n=e,(i=[{key:"observe",value:function(t,e){var n=this.get(e);null==n&&(n=this.set(f(this.buckets),e).get(e)),n.value.raw.push(t),n.value.entries["+Inf"]+=1;var i=function(t,e){if(e<t[t.length-1])for(var n=0;n<t.length;n+=1)if(e<=t[n])return n}(this.buckets,t);if(null!=i)for(var o=i;o<this.buckets.length;o+=1){var s=n.value.entries[this.buckets[o].toString()];n.value.entries[this.buckets[o].toString()]=s+1}return n.value.sum=(0,r.sum)(n.value.raw),n.value.count+=1,this}},{key:"reset",value:function(t){this.set(f(this.buckets),t)}}])&&s(n.prototype,i),d&&s(n,d),e}(n(96).Collector);e.Histogram=d},function(t,e,n){},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MessagingState=e.MessagingService=void 0;const r=n(141);Object.defineProperty(e,"MessagingService",{enumerable:!0,get:function(){return r.MessagingService}});const i=n(98);Object.defineProperty(e,"MessagingState",{enumerable:!0,get:function(){return i.MessagingState}})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MessagingService=void 0;const r=n(155),i=n(142),o=n(144),s=n(35),a=n(98);e.MessagingService=class{constructor(t,e){this.options={autoReconnect:!0,reconnectTime:5e3,maxReconnectAttempts:3,connectionHeaders:{},maxReconnectLimitReached:()=>{},onReconnect:()=>{}},this.url=t,this.options=Object.assign(this.options,e),this.subscriptions={},this.connectionAttempts=0,this.state$=new i.BehaviorSubject(a.MessagingState.DISCONNECTED),this.messages$=new o.Subject,console.log("connect headers messaging: ",this.options.connectionHeaders);const n={connectHeaders:this.options.connectionHeaders,reconnectDelay:0,connectionTimeout:5e3,discardWebsocketOnCommFailure:!0,brokerURL:this.url.replace("https://","wss://").replace("http://","ws://")};this.stompClient=new r.Client(n),this.stompClient.onConnect=t=>this.onStompConnected(t),this.stompClient.onDisconnect=t=>{s.logger.log("Stomp client disconnected",t)},this.stompClient.onStompError=t=>{s.logger.log("Stomp client error",t),this.onStompClientConnectionClosed(t)},this.stompClient.onWebSocketError=t=>{s.logger.log("Stomp client web socket error",t),this.onStompClientConnectionClosed(t)},this.stompClient.onWebSocketClose=t=>{s.logger.log("Stomp client web socket closed",t),this.onStompClientConnectionClosed(t)}}connect(){this.disconnect(),s.logger.log("MessagingService | connecting..."),this.state$.next(a.MessagingState.CONNECTING),this.connectionAttempts++,this.stompClient.activate()}disconnect(){const t=this.state$.getValue();if(t===a.MessagingState.CONNECTED||t===a.MessagingState.CONNECTING){s.logger.log("Disconnecting stomp client");try{this.subscriptions={},this.options.autoReconnect=!1,this.stompClient.deactivate(),this.stompClient.forceDisconnect(),this.state$.next(a.MessagingState.DISCONNECTED)}catch(t){console.error("MessagingService | disconnect: error",t),this.state$.next(a.MessagingState.DISCONNECTED)}}}send(t,e){s.logger.log("MessagingService | send:",t,e);const n={"content-type":"application/json","x-auth-token":this.options.connectionHeaders["x-auth-token"]},r=JSON.stringify(e);this.stompClient.publish({destination:t,body:r,headers:n})}getTopic(t){s.logger.log("MessagingService | subscribeToTopic: "+t);const e=this.subscriptions[t];if(e)return s.logger.log("existing subscription... not re-subscribing to topic"),e;const n=new o.Subject;return this.stompClient.subscribe(t,t=>{n.next(t),this.messages$.next(t)}),this.subscriptions[t]=n,n}onStompConnected(t){s.logger.log("MessagingService | connected"),this.state$.next(a.MessagingState.CONNECTED),this.initMessagingSubscription(),this.connectionAttempts=0}onStompClientConnectionClosed(t){this.options.autoReconnect?this.options.maxReconnectAttempts&&this.connectionAttempts<this.options.maxReconnectAttempts?setTimeout(()=>{this.connect()},this.options.reconnectTime):this.options.maxReconnectLimitReached&&(this.options.maxReconnectLimitReached(),this.disconnect()):this.disconnect()}initMessagingSubscription(){s.logger.log("MessagingService | initMessagingSubscription");this.stompClient.subscribe("/",t=>{this.messages$.next(t)})}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(143))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(47);e.BehaviorSubject=r.BehaviorSubject},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(145))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(47);e.Subject=r.Subject},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MetricsService=void 0;const r=n(37),i=n(147),o=n(80);e.MetricsService=class{constructor(t,e,n){this.uneeqOptions=t,this.internalMessages=e,this.messages=n,this.clientPerformanceStats={},this.options=t,this.internalMessages$=e,this.messages$=n}parseAndLogWebRtcStats(t){try{t.forEach(t=>{var e,n;if("inbound-rtp"===t.type&&"video"===t.kind){this.clientPerformanceStats.frameHeight=new i.ClientPerformanceStat("Frame height",t.frameHeight),this.clientPerformanceStats.frameWidth=new i.ClientPerformanceStat("Frame width",t.frameWidth);const r=t.framesDropped,o=r?r-(null===(e=this.clientPerformanceStats.totalFramesDropped)||void 0===e?void 0:e.value):0;this.clientPerformanceStats.newFramesDropped=o?new i.ClientPerformanceStat("New Frames Dropped",o):new i.ClientPerformanceStat,this.clientPerformanceStats.totalFramesDropped=r?new i.ClientPerformanceStat("Total Frames Dropped",r):new i.ClientPerformanceStat;const s=t.packetsLost,a=s?s-(null===(n=this.clientPerformanceStats.inboundTotalPacketsLost)||void 0===n?void 0:n.value):0;this.clientPerformanceStats.inboundNewPacketsLost=a?new i.ClientPerformanceStat("New packets lost",a):new i.ClientPerformanceStat,this.clientPerformanceStats.inboundTotalPacketsLost=s?new i.ClientPerformanceStat("Total packets lost",s):new i.ClientPerformanceStat;const c=t.framesPerSecond;this.clientPerformanceStats.framesPerSec=c?new i.ClientPerformanceStat("Frames per second",c):new i.ClientPerformanceStat}else if("remote-inbound-rtp"===t.type&&"video"===t.kind){const e=t.roundTripTime;this.clientPerformanceStats.inboundRoundTripTime=e?new i.ClientPerformanceStat("Round Trip Time",e):new i.ClientPerformanceStat}else if("outbound-rtp"===t.type&&"video"===t.kind){const e=t.qualityLimitationReason;this.clientPerformanceStats.outboundQualityLimitationReason=new i.ClientPerformanceStat("Quality Limitation Reason",e)}}),this.options.enableClientPerformanceMessage&&this.messages$.next(new r.ClientPerformanceMessage(this.clientPerformanceStats));const e={type:o.PromMessageType.WebRtcPerformance,value:this.clientPerformanceStats};this.internalMessages$.next({faceMeMessageType:"prom",promMsg:e})}catch(t){console.warn("Unable to parseAndLogWebRTCStats",t)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ClientPerformanceStat=void 0;e.ClientPerformanceStat=class{constructor(t="",e=0){this.label=t,this.value=e}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.OnlineStatusService=void 0;const r=n(37);e.OnlineStatusService=class{constructor(t,e){this.messages=t,this.offlineTimeoutLimitHandler=e,this.online=!0,this.offlineDisconnectTimeLimitMS=1e4,window.addEventListener("offline",()=>this.handleOffline()),window.addEventListener("online",()=>this.handleOnline())}handleOffline(){this.online=!1,this.disconnectTimer=setTimeout(()=>{this.offlineTimeoutLimitHandler()},this.offlineDisconnectTimeLimitMS),this.sendStatusUpdate()}handleOnline(){this.online=!0,window.clearTimeout(this.disconnectTimer),this.sendStatusUpdate()}sendStatusUpdate(){this.messages.next(new r.OnlineStatusUpdateMessage(this.online))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ResumeSessionCheck=void 0;const r=n(35);class i{static validate(t){let e=void 0!==t.resumeSession&&t.resumeSession;localStorage.getItem("uneeqResumeSessionPersonaId")===t.conversationId||(r.logger.log("UneeQ: Persona Id's do not match, unable to resume session."),e=!1);const n=i.browserTabIsActive();if(e&&!n&&(r.logger.log("UneeQ: Browser tab is not active so unable to resume"),e=!1),e){const t=localStorage.getItem("uneeqResumeSessionId");if(null!==t)return{resumeSession:!0,resumeSessionId:t}}return{resumeSession:!1}}static browserTabIsActive(){return!document.hidden}}e.ResumeSessionCheck=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.StreamManager=void 0;e.StreamManager=class{constructor(){window.AudioContext=window.AudioContext||window.webkitAudioContext,this.silentAudioTrack=this.generateSilentAudioTrack(),this.canvasVideoTrack=this.generateCanvasVideoTrack()}addCanvasVideoTrackToStream(t){return t.getVideoTracks().forEach(e=>t.removeTrack(e)),t.addTrack(this.canvasVideoTrack),t}addSilentAudioTrackToStream(t){return t.getAudioTracks().forEach(e=>t.removeTrack(e)),t.addTrack(this.silentAudioTrack),t}resumeAudioContext(){this.audioContextInstance&&this.audioContextInstance.resume()}generateCanvasVideoTrack(){const t=document.createElement("canvas");t.width=40,t.height=30,t.getContext("2d");return t.captureStream(1).getVideoTracks()[0]}generateSilentAudioTrack(){if(!this.audioSourceNode||!this.audioSourceDestination){const t=new window.AudioContext;this.audioContextInstance=t,this.audioSourceDestination=t.createMediaStreamDestination()}return this.audioSourceDestination.stream.getAudioTracks()[0]}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VoiceInputManager=void 0;const r=n(81),i=n(152),o=n(63),s=n(99),a=n(35);e.VoiceInputManager=class{constructor(t,e,n,r){this.options=t,this.api=e,this.messages=n,this.enableMicrophone=r,this.microphoneEngageVolume=.02,this.microphoneDisengageVolume=.02,this.voiceActivityNotSpeakingTimeoutMS=1e3,this.voiceActivityAllowInterruptions=!1,this.digitalHumanSpeaking=!1,this.recording=!1,this.setVoiceInputMode(t.voiceInputMode);try{window.AudioContext=window.AudioContext||window.webkitAudioContext,this.audioContext=new AudioContext}catch(t){this.audioContextNotSupported()}this.handleAppMessages()}setVoiceInputMode(t){t===s.VoiceInputMode.PUSH_TO_TALK?this.options.voiceInputMode=s.VoiceInputMode.PUSH_TO_TALK:t===s.VoiceInputMode.VOICE_ACTIVITY?this.options.voiceInputMode=s.VoiceInputMode.VOICE_ACTIVITY:this.messages.next(new o.WarningMessage("Invalid voice input mode selected: "+t))}startRecording(){this.options.voiceInputMode===s.VoiceInputMode.PUSH_TO_TALK?this.apiStartRecording():this.requestNotSupportedInVoiceActivityMode("startRecording")}stopRecording(){this.options.voiceInputMode===s.VoiceInputMode.PUSH_TO_TALK?this.apiStopRecording():this.requestNotSupportedInVoiceActivityMode("stopRecording")}handleSessionEnd(){this.soundMeter&&this.soundMeter.stop()}resumeAudioContext(){a.logger.log("UneeQ: resuming publish stream audio context and initializing mic activity."),this.audioContext&&(this.audioContext.resume(),this.stream&&this.initMicActivity(this.stream))}initMicActivity(t){this.stream=t,this.soundMeter=new i.SoundMeter(this.audioContext),this.soundMeter.connectToSource(t,t=>this.micActivityConnected(t))}audioContextNotSupported(){this.options.micActivityMessages&&this.messages.next(new o.MicActivityNotSupportedMessage),this.messages.next(new o.VoiceActivityInputModeNotSupportedMessage),this.setVoiceInputMode(s.VoiceInputMode.PUSH_TO_TALK)}handleAppMessages(){this.messages.subscribe(t=>{switch(t.uneeqMessageType){case o.UneeqMessageType.StartedSpeaking:console.log("StartSpeaking message"),this.digitalHumanSpeaking=!0;break;case o.UneeqMessageType.FinishedSpeaking:this.digitalHumanSpeaking=!1}})}requestNotSupportedInVoiceActivityMode(t){this.messages.next(new o.WarningMessage("Request not supported in voice activity mode: "+t))}apiStartRecording(){this.recording=!0,this.messages.next(new o.RecordingStartedMessage),this.api.avatarStartRecording().catch(()=>{this.recording=!1,this.messages.next(new o.RecordingStoppedMessage)})}apiStopRecording(){this.recording=!1,this.api.avatarStopRecording().finally(()=>this.messages.next(new o.RecordingStoppedMessage))}micActivityConnected(t){t?this.messages.next(new o.MicActivityErrorMessage(t)):this.soundMeter&&this.soundMeter.instant$.pipe(r.distinctUntilChanged()).subscribe(t=>{this.handleVoiceActivity(t)})}handleVoiceActivity(t){this.options.micActivityMessages&&this.messages.next(new o.MicActivityMessage(t)),this.options.voiceInputMode!==s.VoiceInputMode.VOICE_ACTIVITY||this.digitalHumanSpeaking&&!this.voiceActivityAllowInterruptions||(t>this.microphoneEngageVolume?(this.recording||this.apiStartRecording(),this.clearSilenceTimeout()):t<this.microphoneDisengageVolume&&this.recording&&(this.clearSilenceTimeout(),this.silenceTimeout=setTimeout(()=>{this.recording&&this.apiStopRecording()},this.voiceActivityNotSpeakingTimeoutMS)))}clearSilenceTimeout(){this.silenceTimeout&&clearTimeout(this.silenceTimeout)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SoundMeter=void 0;const r=n(47),i=n(35);e.SoundMeter=class{constructor(t){this.instant$=new r.BehaviorSubject(0),this.context=t,this.instant=0,this.slow=0,this.clip=0,this.script=t.createScriptProcessor(2048,1,1);const e=this;this.script.onaudioprocess=t=>{const n=t.inputBuffer.getChannelData(0);let r,i=0,o=0;for(r=0;r<n.length;++r)i+=n[r]*n[r],Math.abs(n[r])>.99&&(o+=1);e.instant=Math.sqrt(i/n.length),e.slow=.95*e.slow+.05*e.instant,e.clip=o/n.length,e.instant$.next(parseFloat(e.instant.toFixed(2)))}}connectToSource(t,e){i.logger.log("SoundMeter connecting");try{this.mic=this.context.createMediaStreamSource(t),this.mic.connect(this.script),this.script.connect(this.context.destination),void 0!==e&&e(null)}catch(t){console.error(t),void 0!==e&&e(t)}}stop(){this.mic.disconnect(),this.script.disconnect()}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SessionType=void 0,function(t){t[t.WEB=0]="WEB"}(e.SessionType||(e.SessionType={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SourceApp=void 0,function(t){t.HOSTED_EXPERIENCE="HOSTED_EXPERIENCE",t.SHOWCASE="SHOWCASE",t.SPLIT_SCREEN="SPLIT_SCREEN",t.INTERACTIONS="INTERACTIONS",t.UNKNOWN="UNKNOWN"}(e.SourceApp||(e.SourceApp={}))},function(t,e,n){"use strict";n.r(e),n.d(e,"Client",(function(){return f})),n.d(e,"FrameImpl",(function(){return o})),n.d(e,"Parser",(function(){return s})),n.d(e,"StompConfig",(function(){return d})),n.d(e,"StompHeaders",(function(){return p})),n.d(e,"StompSubscription",(function(){return v})),n.d(e,"StompSocketState",(function(){return a})),n.d(e,"ActivationState",(function(){return c})),n.d(e,"Versions",(function(){return u})),n.d(e,"CompatClient",(function(){return m})),n.d(e,"Stomp",(function(){return y}));const r="\n",i="\0";class o{constructor(t){const{command:e,headers:n,body:r,binaryBody:i,escapeHeaderValues:o,skipContentLengthHeader:s}=t;this.command=e,this.headers=Object.assign({},n||{}),i?(this._binaryBody=i,this.isBinaryBody=!0):(this._body=r||"",this.isBinaryBody=!1),this.escapeHeaderValues=o||!1,this.skipContentLengthHeader=s||!1}get body(){return!this._body&&this.isBinaryBody&&(this._body=(new TextDecoder).decode(this._binaryBody)),this._body}get binaryBody(){return this._binaryBody||this.isBinaryBody||(this._binaryBody=(new TextEncoder).encode(this._body)),this._binaryBody}static fromRawFrame(t,e){const n={},r=t=>t.replace(/^\s+|\s+$/g,"");for(const i of t.headers.reverse()){i.indexOf(":");const s=r(i[0]);let a=r(i[1]);e&&"CONNECT"!==t.command&&"CONNECTED"!==t.command&&(a=o.hdrValueUnEscape(a)),n[s]=a}return new o({command:t.command,headers:n,binaryBody:t.binaryBody,escapeHeaderValues:e})}toString(){return this.serializeCmdAndHeaders()}serialize(){const t=this.serializeCmdAndHeaders();return this.isBinaryBody?o.toUnit8Array(t,this._binaryBody).buffer:t+this._body+i}serializeCmdAndHeaders(){const t=[this.command];this.skipContentLengthHeader&&delete this.headers["content-length"];for(const e of Object.keys(this.headers||{})){const n=this.headers[e];this.escapeHeaderValues&&"CONNECT"!==this.command&&"CONNECTED"!==this.command?t.push(`${e}:${o.hdrValueEscape(""+n)}`):t.push(`${e}:${n}`)}return(this.isBinaryBody||!this.isBodyEmpty()&&!this.skipContentLengthHeader)&&t.push("content-length:"+this.bodyLength()),t.join(r)+r+r}isBodyEmpty(){return 0===this.bodyLength()}bodyLength(){const t=this.binaryBody;return t?t.length:0}static sizeOfUTF8(t){return t?(new TextEncoder).encode(t).length:0}static toUnit8Array(t,e){const n=(new TextEncoder).encode(t),r=new Uint8Array([0]),i=new Uint8Array(n.length+e.length+r.length);return i.set(n),i.set(e,n.length),i.set(r,n.length+e.length),i}static marshall(t){return new o(t).serialize()}static hdrValueEscape(t){return t.replace(/\\/g,"\\\\").replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/:/g,"\\c")}static hdrValueUnEscape(t){return t.replace(/\\r/g,"\r").replace(/\\n/g,"\n").replace(/\\c/g,":").replace(/\\\\/g,"\\")}}class s{constructor(t,e){this.onFrame=t,this.onIncomingPing=e,this._encoder=new TextEncoder,this._decoder=new TextDecoder,this._token=[],this._initState()}parseChunk(t,e=!1){let n;if(n=t instanceof ArrayBuffer?new Uint8Array(t):this._encoder.encode(t),e&&0!==n[n.length-1]){const t=new Uint8Array(n.length+1);t.set(n,0),t[n.length]=0,n=t}for(let t=0;t<n.length;t++){const e=n[t];this._onByte(e)}}_collectFrame(t){0!==t&&13!==t&&(10!==t?(this._onByte=this._collectCommand,this._reinjectByte(t)):this.onIncomingPing())}_collectCommand(t){if(13!==t)return 10===t?(this._results.command=this._consumeTokenAsUTF8(),void(this._onByte=this._collectHeaders)):void this._consumeByte(t)}_collectHeaders(t){13!==t&&(10!==t?(this._onByte=this._collectHeaderKey,this._reinjectByte(t)):this._setupCollectBody())}_reinjectByte(t){this._onByte(t)}_collectHeaderKey(t){if(58===t)return this._headerKey=this._consumeTokenAsUTF8(),void(this._onByte=this._collectHeaderValue);this._consumeByte(t)}_collectHeaderValue(t){if(13!==t)return 10===t?(this._results.headers.push([this._headerKey,this._consumeTokenAsUTF8()]),this._headerKey=void 0,void(this._onByte=this._collectHeaders)):void this._consumeByte(t)}_setupCollectBody(){const t=this._results.headers.filter(t=>"content-length"===t[0])[0];t?(this._bodyBytesRemaining=parseInt(t[1],10),this._onByte=this._collectBodyFixedSize):this._onByte=this._collectBodyNullTerminated}_collectBodyNullTerminated(t){0!==t?this._consumeByte(t):this._retrievedBody()}_collectBodyFixedSize(t){0!=this._bodyBytesRemaining--?this._consumeByte(t):this._retrievedBody()}_retrievedBody(){this._results.binaryBody=this._consumeTokenAsRaw(),this.onFrame(this._results),this._initState()}_consumeByte(t){this._token.push(t)}_consumeTokenAsUTF8(){return this._decoder.decode(this._consumeTokenAsRaw())}_consumeTokenAsRaw(){const t=new Uint8Array(this._token);return this._token=[],t}_initState(){this._results={command:void 0,headers:[],binaryBody:void 0},this._token=[],this._headerKey=void 0,this._onByte=this._collectFrame}}var a,c;!function(t){t[t.CONNECTING=0]="CONNECTING",t[t.OPEN=1]="OPEN",t[t.CLOSING=2]="CLOSING",t[t.CLOSED=3]="CLOSED"}(a||(a={})),function(t){t[t.ACTIVE=0]="ACTIVE",t[t.DEACTIVATING=1]="DEACTIVATING",t[t.INACTIVE=2]="INACTIVE"}(c||(c={}));class u{constructor(t){this.versions=t}supportedVersions(){return this.versions.join(",")}protocolVersions(){return this.versions.map(t=>`v${t.replace(".","")}.stomp`)}}u.V1_0="1.0",u.V1_1="1.1",u.V1_2="1.2",u.default=new u([u.V1_0,u.V1_1,u.V1_2]);class h{constructor(t,e,n={}){this._client=t,this._webSocket=e,this._serverFrameHandlers={CONNECTED:t=>{this.debug("connected to server "+t.headers.server),this._connected=!0,this._connectedVersion=t.headers.version,this._connectedVersion===u.V1_2&&(this._escapeHeaderValues=!0),this._setupHeartbeat(t.headers),this.onConnect(t)},MESSAGE:t=>{const e=t.headers.subscription,n=this._subscriptions[e]||this.onUnhandledMessage,r=t,i=this,o=this._connectedVersion===u.V1_2?r.headers.ack:r.headers["message-id"];r.ack=(t={})=>i.ack(o,e,t),r.nack=(t={})=>i.nack(o,e,t),n(r)},RECEIPT:t=>{const e=this._receiptWatchers[t.headers["receipt-id"]];e?(e(t),delete this._receiptWatchers[t.headers["receipt-id"]]):this.onUnhandledReceipt(t)},ERROR:t=>{this.onStompError(t)}},this._counter=0,this._subscriptions={},this._receiptWatchers={},this._partialData="",this._escapeHeaderValues=!1,this._lastServerActivityTS=Date.now(),this.configure(n)}get connectedVersion(){return this._connectedVersion}get connected(){return this._connected}configure(t){Object.assign(this,t)}start(){const t=new s(t=>{const e=o.fromRawFrame(t,this._escapeHeaderValues);this.logRawCommunication||this.debug("<<< "+e);(this._serverFrameHandlers[e.command]||this.onUnhandledFrame)(e)},()=>{this.debug("<<< PONG")});this._webSocket.onmessage=e=>{if(this.debug("Received data"),this._lastServerActivityTS=Date.now(),this.logRawCommunication){const t=e.data instanceof ArrayBuffer?(new TextDecoder).decode(e.data):e.data;this.debug("<<< "+t)}t.parseChunk(e.data,this.appendMissingNULLonIncoming)},this._onclose=t=>{this.debug("Connection closed to "+this._client.brokerURL),this._cleanUp(),this.onWebSocketClose(t)},this._webSocket.onclose=this._onclose,this._webSocket.onerror=t=>{this.onWebSocketError(t)},this._webSocket.onopen=()=>{const t=Object.assign({},this.connectHeaders);this.debug("Web Socket Opened..."),t["accept-version"]=this.stompVersions.supportedVersions(),t["heart-beat"]=[this.heartbeatOutgoing,this.heartbeatIncoming].join(","),this._transmit({command:"CONNECT",headers:t})}}_setupHeartbeat(t){if(t.version!==u.V1_1&&t.version!==u.V1_2)return;if(!t["heart-beat"])return;const[e,n]=t["heart-beat"].split(",").map(t=>parseInt(t,10));if(0!==this.heartbeatOutgoing&&0!==n){const t=Math.max(this.heartbeatOutgoing,n);this.debug(`send PING every ${t}ms`),this._pinger=setInterval(()=>{this._webSocket.readyState===a.OPEN&&(this._webSocket.send(r),this.debug(">>> PING"))},t)}if(0!==this.heartbeatIncoming&&0!==e){const t=Math.max(this.heartbeatIncoming,e);this.debug(`check PONG every ${t}ms`),this._ponger=setInterval(()=>{const e=Date.now()-this._lastServerActivityTS;e>2*t&&(this.debug(`did not receive server activity for the last ${e}ms`),this._closeOrDiscardWebsocket())},t)}}_closeOrDiscardWebsocket(){this.discardWebsocketOnCommFailure?(this.debug("Discarding websocket, the underlying socket may linger for a while"),this._discardWebsocket()):(this.debug("Issuing close on the websocket"),this._closeWebsocket())}forceDisconnect(){this._webSocket&&(this._webSocket.readyState!==a.CONNECTING&&this._webSocket.readyState!==a.OPEN||this._closeOrDiscardWebsocket())}_closeWebsocket(){this._webSocket.onmessage=()=>{},this._webSocket.close()}_discardWebsocket(){var t,e;this._webSocket.terminate||(t=this._webSocket,e=t=>this.debug(t),t.terminate=function(){const t=()=>{};this.onerror=t,this.onmessage=t,this.onopen=t;const n=new Date,r=this.onclose;this.onclose=t=>{const r=(new Date).getTime()-n.getTime();e(`Discarded socket closed after ${r}ms, with code/reason: ${t.code}/${t.reason}`)},this.close(),r.call(this,{code:4001,reason:"Heartbeat failure, discarding the socket",wasClean:!1})}),this._webSocket.terminate()}_transmit(t){const{command:e,headers:n,body:r,binaryBody:i,skipContentLengthHeader:s}=t,a=new o({command:e,headers:n,body:r,binaryBody:i,escapeHeaderValues:this._escapeHeaderValues,skipContentLengthHeader:s});let c=a.serialize();if(this.logRawCommunication?this.debug(">>> "+c):this.debug(">>> "+a),this.forceBinaryWSFrames&&"string"==typeof c&&(c=(new TextEncoder).encode(c)),"string"==typeof c&&this.splitLargeFrames){let t=c;for(;t.length>0;){const e=t.substring(0,this.maxWebSocketChunkSize);t=t.substring(this.maxWebSocketChunkSize),this._webSocket.send(e),this.debug(`chunk sent = ${e.length}, remaining = ${t.length}`)}}else this._webSocket.send(c)}dispose(){if(this.connected)try{const t=Object.assign({},this.disconnectHeaders);t.receipt||(t.receipt="close-"+this._counter++),this.watchForReceipt(t.receipt,t=>{this._closeWebsocket(),this._cleanUp(),this.onDisconnect(t)}),this._transmit({command:"DISCONNECT",headers:t})}catch(t){this.debug("Ignoring error during disconnect "+t)}else this._webSocket.readyState!==a.CONNECTING&&this._webSocket.readyState!==a.OPEN||this._closeWebsocket()}_cleanUp(){this._connected=!1,this._pinger&&clearInterval(this._pinger),this._ponger&&clearInterval(this._ponger)}publish(t){const{destination:e,headers:n,body:r,binaryBody:i,skipContentLengthHeader:o}=t,s=Object.assign({destination:e},n);this._transmit({command:"SEND",headers:s,body:r,binaryBody:i,skipContentLengthHeader:o})}watchForReceipt(t,e){this._receiptWatchers[t]=e}subscribe(t,e,n={}){(n=Object.assign({},n)).id||(n.id="sub-"+this._counter++),n.destination=t,this._subscriptions[n.id]=e,this._transmit({command:"SUBSCRIBE",headers:n});const r=this;return{id:n.id,unsubscribe:t=>r.unsubscribe(n.id,t)}}unsubscribe(t,e={}){e=Object.assign({},e),delete this._subscriptions[t],e.id=t,this._transmit({command:"UNSUBSCRIBE",headers:e})}begin(t){const e=t||"tx-"+this._counter++;this._transmit({command:"BEGIN",headers:{transaction:e}});const n=this;return{id:e,commit(){n.commit(e)},abort(){n.abort(e)}}}commit(t){this._transmit({command:"COMMIT",headers:{transaction:t}})}abort(t){this._transmit({command:"ABORT",headers:{transaction:t}})}ack(t,e,n={}){n=Object.assign({},n),this._connectedVersion===u.V1_2?n.id=t:n["message-id"]=t,n.subscription=e,this._transmit({command:"ACK",headers:n})}nack(t,e,n={}){return n=Object.assign({},n),this._connectedVersion===u.V1_2?n.id=t:n["message-id"]=t,n.subscription=e,this._transmit({command:"NACK",headers:n})}}var l=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};class f{constructor(t={}){this.stompVersions=u.default,this.connectionTimeout=0,this.reconnectDelay=5e3,this.heartbeatIncoming=1e4,this.heartbeatOutgoing=1e4,this.splitLargeFrames=!1,this.maxWebSocketChunkSize=8192,this.forceBinaryWSFrames=!1,this.appendMissingNULLonIncoming=!1,this.state=c.INACTIVE;const e=()=>{};this.debug=e,this.beforeConnect=e,this.onConnect=e,this.onDisconnect=e,this.onUnhandledMessage=e,this.onUnhandledReceipt=e,this.onUnhandledFrame=e,this.onStompError=e,this.onWebSocketClose=e,this.onWebSocketError=e,this.logRawCommunication=!1,this.onChangeState=e,this.connectHeaders={},this._disconnectHeaders={},this.configure(t)}get webSocket(){return this._stompHandler?this._stompHandler._webSocket:void 0}get disconnectHeaders(){return this._disconnectHeaders}set disconnectHeaders(t){this._disconnectHeaders=t,this._stompHandler&&(this._stompHandler.disconnectHeaders=this._disconnectHeaders)}get connected(){return!!this._stompHandler&&this._stompHandler.connected}get connectedVersion(){return this._stompHandler?this._stompHandler.connectedVersion:void 0}get active(){return this.state===c.ACTIVE}_changeState(t){this.state=t,this.onChangeState(t)}configure(t){Object.assign(this,t)}activate(){if(this.state===c.DEACTIVATING)throw this.debug("Still DEACTIVATING, please await call to deactivate before trying to re-activate"),new Error("Still DEACTIVATING, can not activate now");this.active?this.debug("Already ACTIVE, ignoring request to activate"):(this._changeState(c.ACTIVE),this._connect())}_connect(){return l(this,void 0,void 0,(function*(){if(this.connected)return void this.debug("STOMP: already connected, nothing to do");if(yield this.beforeConnect(),!this.active)return void this.debug("Client has been marked inactive, will not attempt to connect");this.connectionTimeout>0&&(this._connectionWatcher&&clearTimeout(this._connectionWatcher),this._connectionWatcher=setTimeout(()=>{this.connected||(this.debug(`Connection not established in ${this.connectionTimeout}ms, closing socket`),this.forceDisconnect())},this.connectionTimeout)),this.debug("Opening Web Socket...");const t=this._createWebSocket();this._stompHandler=new h(this,t,{debug:this.debug,stompVersions:this.stompVersions,connectHeaders:this.connectHeaders,disconnectHeaders:this._disconnectHeaders,heartbeatIncoming:this.heartbeatIncoming,heartbeatOutgoing:this.heartbeatOutgoing,splitLargeFrames:this.splitLargeFrames,maxWebSocketChunkSize:this.maxWebSocketChunkSize,forceBinaryWSFrames:this.forceBinaryWSFrames,logRawCommunication:this.logRawCommunication,appendMissingNULLonIncoming:this.appendMissingNULLonIncoming,discardWebsocketOnCommFailure:this.discardWebsocketOnCommFailure,onConnect:t=>{if(this._connectionWatcher&&(clearTimeout(this._connectionWatcher),this._connectionWatcher=void 0),!this.active)return this.debug("STOMP got connected while deactivate was issued, will disconnect now"),void this._disposeStompHandler();this.onConnect(t)},onDisconnect:t=>{this.onDisconnect(t)},onStompError:t=>{this.onStompError(t)},onWebSocketClose:t=>{this._stompHandler=void 0,this.state===c.DEACTIVATING&&(this._resolveSocketClose(),this._resolveSocketClose=void 0,this._changeState(c.INACTIVE)),this.onWebSocketClose(t),this.active&&this._schedule_reconnect()},onWebSocketError:t=>{this.onWebSocketError(t)},onUnhandledMessage:t=>{this.onUnhandledMessage(t)},onUnhandledReceipt:t=>{this.onUnhandledReceipt(t)},onUnhandledFrame:t=>{this.onUnhandledFrame(t)}}),this._stompHandler.start()}))}_createWebSocket(){let t;return t=this.webSocketFactory?this.webSocketFactory():new WebSocket(this.brokerURL,this.stompVersions.protocolVersions()),t.binaryType="arraybuffer",t}_schedule_reconnect(){this.reconnectDelay>0&&(this.debug(`STOMP: scheduling reconnection in ${this.reconnectDelay}ms`),this._reconnector=setTimeout(()=>{this._connect()},this.reconnectDelay))}deactivate(){return l(this,void 0,void 0,(function*(){let t;return this.state!==c.ACTIVE?(this.debug(`Already ${c[this.state]}, ignoring call to deactivate`),Promise.resolve()):(this._changeState(c.DEACTIVATING),this._reconnector&&clearTimeout(this._reconnector),this._stompHandler&&this.webSocket.readyState!==a.CLOSED?(t=new Promise((t,e)=>{this._resolveSocketClose=t}),this._disposeStompHandler(),t):(this._changeState(c.INACTIVE),Promise.resolve()))}))}forceDisconnect(){this._stompHandler&&this._stompHandler.forceDisconnect()}_disposeStompHandler(){this._stompHandler&&(this._stompHandler.dispose(),this._stompHandler=null)}publish(t){this._stompHandler.publish(t)}watchForReceipt(t,e){this._stompHandler.watchForReceipt(t,e)}subscribe(t,e,n={}){return this._stompHandler.subscribe(t,e,n)}unsubscribe(t,e={}){this._stompHandler.unsubscribe(t,e)}begin(t){return this._stompHandler.begin(t)}commit(t){this._stompHandler.commit(t)}abort(t){this._stompHandler.abort(t)}ack(t,e,n={}){this._stompHandler.ack(t,e,n)}nack(t,e,n={}){this._stompHandler.nack(t,e,n)}}class d{}class p{}class v{}class g{constructor(t){this.client=t}get outgoing(){return this.client.heartbeatOutgoing}set outgoing(t){this.client.heartbeatOutgoing=t}get incoming(){return this.client.heartbeatIncoming}set incoming(t){this.client.heartbeatIncoming=t}}class m extends f{constructor(t){super(),this.maxWebSocketFrameSize=16384,this._heartbeatInfo=new g(this),this.reconnect_delay=0,this.webSocketFactory=t,this.debug=(...t)=>{console.log(...t)}}_parseConnect(...t){let e,n,r,i={};if(t.length<2)throw new Error("Connect requires at least 2 arguments");if("function"==typeof t[1])[i,n,r,e]=t;else switch(t.length){case 6:[i.login,i.passcode,n,r,e,i.host]=t;break;default:[i.login,i.passcode,n,r,e]=t}return[i,n,r,e]}connect(...t){const e=this._parseConnect(...t);e[0]&&(this.connectHeaders=e[0]),e[1]&&(this.onConnect=e[1]),e[2]&&(this.onStompError=e[2]),e[3]&&(this.onWebSocketClose=e[3]),super.activate()}disconnect(t,e={}){t&&(this.onDisconnect=t),this.disconnectHeaders=e,super.deactivate()}send(t,e={},n=""){const r=!1===(e=Object.assign({},e))["content-length"];r&&delete e["content-length"],this.publish({destination:t,headers:e,body:n,skipContentLengthHeader:r})}set reconnect_delay(t){this.reconnectDelay=t}get ws(){return this.webSocket}get version(){return this.connectedVersion}get onreceive(){return this.onUnhandledMessage}set onreceive(t){this.onUnhandledMessage=t}get onreceipt(){return this.onUnhandledReceipt}set onreceipt(t){this.onUnhandledReceipt=t}get heartbeat(){return this._heartbeatInfo}set heartbeat(t){this.heartbeatIncoming=t.incoming,this.heartbeatOutgoing=t.outgoing}}class y{static client(t,e){null==e&&(e=u.default.protocolVersions());return new m(()=>new(y.WebSocketClass||WebSocket)(t,e))}static over(t){let e;return"function"==typeof t?e=t:(console.warn("Stomp.over did not receive a factory, auto reconnect will not work. Please see https://stomp-js.github.io/api-docs/latest/classes/Stomp.html#over"),e=()=>t),new m(e)}}y.WebSocketClass=null}]));
37
+ const r=n(116)("simple-peer"),i=n(119),o=n(120),s=n(121),a=n(130),c=n(131),{Buffer:u}=n(44);function h(t){return t.replace(/a=ice-options:trickle\s\n/g,"")}class l extends s.Duplex{constructor(t){if(super(t=Object.assign({allowHalfOpen:!1},t)),this._id=o(4).toString("hex").slice(0,7),this._debug("new peer %o",t),this.channelName=t.initiator?t.channelName||o(20).toString("hex"):null,this.initiator=t.initiator||!1,this.channelConfig=t.channelConfig||l.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},l.config,t.config),this.offerOptions=t.offerOptions||{},this.answerOptions=t.answerOptions||{},this.sdpTransform=t.sdpTransform||(t=>t),this.streams=t.streams||(t.stream?[t.stream]:[]),this.trickle=void 0===t.trickle||t.trickle,this.allowHalfTrickle=void 0!==t.allowHalfTrickle&&t.allowHalfTrickle,this.iceCompleteTimeout=t.iceCompleteTimeout||5e3,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=t.wrtc&&"object"==typeof t.wrtc?t.wrtc:i(),!this._wrtc)throw"undefined"==typeof window?c(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):c(new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(t){return void this.destroy(c(t,"ERR_PC_CONSTRUCTOR"))}this._isReactNativeWebrtc="number"==typeof this._pc._peerConnectionId,this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=t=>{this._onIceCandidate(t)},"object"==typeof this._pc.peerIdentity&&this._pc.peerIdentity.catch(t=>{this.destroy(c(t,"ERR_PC_PEER_IDENTITY"))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=t=>{this._setupData(t)},this.streams&&this.streams.forEach(t=>{this.addStream(t)}),this._pc.ontrack=t=>{this._onTrack(t)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&"open"===this._channel.readyState}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(t){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if("string"==typeof t)try{t=JSON.parse(t)}catch(e){t={}}this._debug("signal()"),t.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),t.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(t.transceiverRequest.kind,t.transceiverRequest.init)),t.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(t.candidate):this._pendingCandidates.push(t.candidate)),t.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(t)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(t=>{this._addIceCandidate(t)}),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())}).catch(t=>{this.destroy(c(t,"ERR_SET_REMOTE_DESCRIPTION"))}),t.sdp||t.candidate||t.renegotiate||t.transceiverRequest||this.destroy(c(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(t){const e=new this._wrtc.RTCIceCandidate(t);this._pc.addIceCandidate(e).catch(t=>{var n;!e.address||e.address.endsWith(".local")?(n="Ignoring unsupported ICE candidate.",console.warn(n)):this.destroy(c(t,"ERR_ADD_ICE_CANDIDATE"))})}send(t){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(t)}}addTransceiver(t,e){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(t,e),this._needsNegotiation()}catch(t){this.destroy(c(t,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:t,init:e}})}}addStream(t){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),t.getTracks().forEach(e=>{this.addTrack(e,t)})}}addTrack(t,e){if(this.destroying)return;if(this.destroyed)throw c(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");const n=this._senderMap.get(t)||new Map;let r=n.get(e);if(r)throw r.removed?c(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):c(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED");r=this._pc.addTrack(t,e),n.set(e,r),this._senderMap.set(t,n),this._needsNegotiation()}replaceTrack(t,e,n){if(this.destroying)return;if(this.destroyed)throw c(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");const r=this._senderMap.get(t),i=r?r.get(n):null;if(!i)throw c(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");e&&this._senderMap.set(e,r),null!=i.replaceTrack?i.replaceTrack(e):this.destroy(c(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK"))}removeTrack(t,e){if(this.destroying)return;if(this.destroyed)throw c(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");const n=this._senderMap.get(t),r=n?n.get(e):null;if(!r)throw c(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{r.removed=!0,this._pc.removeTrack(r)}catch(t){"NS_ERROR_UNEXPECTED"===t.name?this._sendersAwaitingStable.push(r):this.destroy(c(t,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(t){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),t.getTracks().forEach(e=>{this.removeTrack(e,t)})}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,a(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1}))}negotiate(){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(t){this._destroy(t,()=>{})}_destroy(t,e){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",t&&(t.message||t)),a(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",t&&(t.message||t)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(t){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(t){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,t&&this.emit("error",t),this.emit("close"),e()}))}_setupData(t){if(!t.channel)return this.destroy(c(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=t.channel,this._channel.binaryType="arraybuffer","number"==typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=65536),this.channelName=this._channel.label,this._channel.onmessage=t=>{this._onChannelMessage(t)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=t=>{const e=t.error instanceof Error?t.error:new Error(`Datachannel error: ${t.message} ${t.filename}:${t.lineno}:${t.colno}`);this.destroy(c(e,"ERR_DATA_CHANNEL"))};let e=!1;this._closingInterval=setInterval(()=>{this._channel&&"closing"===this._channel.readyState?(e&&this._onChannelClose(),e=!0):e=!1},5e3)}_read(){}_write(t,e,n){if(this.destroyed)return n(c(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(t)}catch(t){return this.destroy(c(t,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=t,this._cb=n}_onFinish(){if(this.destroyed)return;const t=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?t():this.once("connect",t)}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(t=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(t.sdp=h(t.sdp)),t.sdp=this.sdpTransform(t.sdp);const e=()=>{if(this.destroyed)return;const e=this._pc.localDescription||t;this._debug("signal"),this.emit("signal",{type:e.type,sdp:e.sdp})};this._pc.setLocalDescription(t).then(()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?e():this.once("_iceComplete",e))}).catch(t=>{this.destroy(c(t,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(t=>{this.destroy(c(t,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(t=>{t.mid||!t.sender.track||t.requested||(t.requested=!0,this.addTransceiver(t.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(t=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(t.sdp=h(t.sdp)),t.sdp=this.sdpTransform(t.sdp);const e=()=>{if(this.destroyed)return;const e=this._pc.localDescription||t;this._debug("signal"),this.emit("signal",{type:e.type,sdp:e.sdp}),this.initiator||this._requestMissingTransceivers()};this._pc.setLocalDescription(t).then(()=>{this.destroyed||(this.trickle||this._iceComplete?e():this.once("_iceComplete",e))}).catch(t=>{this.destroy(c(t,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(t=>{this.destroy(c(t,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||"failed"===this._pc.connectionState&&this.destroy(c(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const t=this._pc.iceConnectionState,e=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",t,e),this.emit("iceStateChange",t,e),"connected"!==t&&"completed"!==t||(this._pcReady=!0,this._maybeReady()),"failed"===t&&this.destroy(c(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===t&&this.destroy(c(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(t){const e=t=>("[object Array]"===Object.prototype.toString.call(t.values)&&t.values.forEach(e=>{Object.assign(t,e)}),t);0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then(n=>{const r=[];n.forEach(t=>{r.push(e(t))}),t(null,r)},e=>t(e)):this._pc.getStats.length>0?this._pc.getStats(n=>{if(this.destroyed)return;const r=[];n.result().forEach(t=>{const n={};t.names().forEach(e=>{n[e]=t.stat(e)}),n.id=t.id,n.type=t.type,n.timestamp=t.timestamp,r.push(e(n))}),t(null,r)},e=>t(e)):t(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const t=()=>{this.destroyed||this.getStats((e,n)=>{if(this.destroyed)return;e&&(n=[]);const r={},i={},o={};let s=!1;n.forEach(t=>{"remotecandidate"!==t.type&&"remote-candidate"!==t.type||(r[t.id]=t),"localcandidate"!==t.type&&"local-candidate"!==t.type||(i[t.id]=t),"candidatepair"!==t.type&&"candidate-pair"!==t.type||(o[t.id]=t)});const a=t=>{s=!0;let e=i[t.localCandidateId];e&&(e.ip||e.address)?(this.localAddress=e.ip||e.address,this.localPort=Number(e.port)):e&&e.ipAddress?(this.localAddress=e.ipAddress,this.localPort=Number(e.portNumber)):"string"==typeof t.googLocalAddress&&(e=t.googLocalAddress.split(":"),this.localAddress=e[0],this.localPort=Number(e[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let n=r[t.remoteCandidateId];n&&(n.ip||n.address)?(this.remoteAddress=n.ip||n.address,this.remotePort=Number(n.port)):n&&n.ipAddress?(this.remoteAddress=n.ipAddress,this.remotePort=Number(n.portNumber)):"string"==typeof t.googRemoteAddress&&(n=t.googRemoteAddress.split(":"),this.remoteAddress=n[0],this.remotePort=Number(n[1])),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(n.forEach(t=>{"transport"===t.type&&t.selectedCandidatePairId&&a(o[t.selectedCandidatePairId]),("googCandidatePair"===t.type&&"true"===t.googActiveConnection||("candidatepair"===t.type||"candidate-pair"===t.type)&&t.selected)&&a(t)}),s||Object.keys(o).length&&!Object.keys(i).length){if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(e){return this.destroy(c(e,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const t=this._cb;this._cb=null,t(null)}"number"!=typeof this._channel.bufferedAmountLowThreshold&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}else setTimeout(t,100)})};t()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>65536||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||("stable"===this._pc.signalingState&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(t=>{this._pc.removeTrack(t),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(t){this.destroyed||(t.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:t.candidate.candidate,sdpMLineIndex:t.candidate.sdpMLineIndex,sdpMid:t.candidate.sdpMid}}):t.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),t.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(t){if(this.destroyed)return;let e=t.data;e instanceof ArrayBuffer&&(e=u.from(e)),this.push(e)}_onChannelBufferedAmountLow(){if(this.destroyed||!this._cb)return;this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const t=this._cb;this._cb=null,t(null)}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(t){this.destroyed||t.streams.forEach(e=>{this._debug("on track"),this.emit("track",t.track,e),this._remoteTracks.push({track:t.track,stream:e}),this._remoteStreams.some(t=>t.id===e.id)||(this._remoteStreams.push(e),a(()=>{this._debug("on stream"),this.emit("stream",e)}))})}_debug(){const t=[].slice.call(arguments);t[0]="["+this._id+"] "+t[0],r.apply(null,t)}}l.WEBRTC_SUPPORT=!!i(),l.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},l.channelConfig={},t.exports=l},function(t,e,n){(function(r){e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;e.splice(1,0,n,"color: inherit");let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,t=>{"%%"!==t&&(r++,"%c"===t&&(i=r))}),e.splice(i,0,n)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(t){}!t&&void 0!==r&&"env"in r&&(t=r.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=n(117)(e);const{formatters:i}=t.exports;i.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this,n(38))},function(t,e,n){t.exports=function(t){function e(t){let n,i,o,s=null;function a(...t){if(!a.enabled)return;const r=a,i=Number(new Date),o=i-(n||i);r.diff=o,r.prev=n,r.curr=i,n=i,t[0]=e.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let s=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,(n,i)=>{if("%%"===n)return"%";s++;const o=e.formatters[i];if("function"==typeof o){const e=t[s];n=o.call(r,e),t.splice(s,1),s--}return n}),e.formatArgs.call(r,t);(r.log||e.log).apply(r,t)}return a.namespace=t,a.useColors=e.useColors(),a.color=e.selectColor(t),a.extend=r,a.destroy=e.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==e.namespaces&&(i=e.namespaces,o=e.enabled(t)),o),set:t=>{s=t}}),"function"==typeof e.init&&e.init(a),a}function r(t,n){const r=e(this.namespace+(void 0===n?":":n)+t);return r.log=this.log,r}function i(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}return e.debug=e,e.default=e,e.coerce=function(t){if(t instanceof Error)return t.stack||t.message;return t},e.disable=function(){const t=[...e.names.map(i),...e.skips.map(i).map(t=>"-"+t)].join(",");return e.enable(""),t},e.enable=function(t){let n;e.save(t),e.namespaces=t,e.names=[],e.skips=[];const r=("string"==typeof t?t:"").split(/[\s,]+/),i=r.length;for(n=0;n<i;n++)r[n]&&("-"===(t=r[n].replace(/\*/g,".*?"))[0]?e.skips.push(new RegExp("^"+t.slice(1)+"$")):e.names.push(new RegExp("^"+t+"$")))},e.enabled=function(t){if("*"===t[t.length-1])return!0;let n,r;for(n=0,r=e.skips.length;n<r;n++)if(e.skips[n].test(t))return!1;for(n=0,r=e.names.length;n<r;n++)if(e.names[n].test(t))return!0;return!1},e.humanize=n(118),e.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach(n=>{e[n]=t[n]}),e.names=[],e.skips=[],e.formatters={},e.selectColor=function(t){let n=0;for(let e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n|=0;return e.colors[Math.abs(n)%e.colors.length]},e.enable(e.load()),e}},function(t,e){var n=1e3,r=6e4,i=60*r,o=24*i;function s(t,e,n,r){var i=e>=1.5*n;return Math.round(t/n)+" "+r+(i?"s":"")}t.exports=function(t,e){e=e||{};var a=typeof t;if("string"===a&&t.length>0)return function(t){if((t=String(t)).length>100)return;var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!e)return;var s=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return 6048e5*s;case"days":case"day":case"d":return s*o;case"hours":case"hour":case"hrs":case"hr":case"h":return s*i;case"minutes":case"minute":case"mins":case"min":case"m":return s*r;case"seconds":case"second":case"secs":case"sec":case"s":return s*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(t);if("number"===a&&isFinite(t))return e.long?function(t){var e=Math.abs(t);if(e>=o)return s(t,e,o,"day");if(e>=i)return s(t,e,i,"hour");if(e>=r)return s(t,e,r,"minute");if(e>=n)return s(t,e,n,"second");return t+" ms"}(t):function(t){var e=Math.abs(t);if(e>=o)return Math.round(t/o)+"d";if(e>=i)return Math.round(t/i)+"h";if(e>=r)return Math.round(t/r)+"m";if(e>=n)return Math.round(t/n)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e){t.exports=function(){if("undefined"==typeof globalThis)return null;var t={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return t.RTCPeerConnection?t:null}},function(t,e,n){"use strict";(function(e,r){var i=n(86).Buffer,o=e.crypto||e.msCrypto;o&&o.getRandomValues?t.exports=function(t,e){if(t>4294967295)throw new RangeError("requested too many random bytes");var n=i.allocUnsafe(t);if(t>0)if(t>65536)for(var s=0;s<t;s+=65536)o.getRandomValues(n.slice(s,s+65536));else o.getRandomValues(n);if("function"==typeof e)return r.nextTick((function(){e(null,n)}));return n}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,n(35),n(38))},function(t,e,n){(e=t.exports=n(87)).Stream=e,e.Readable=e,e.Writable=n(92),e.Duplex=n(46),e.Transform=n(94),e.PassThrough=n(128),e.finished=n(79),e.pipeline=n(129)},function(t,e){},function(t,e,n){"use strict";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var s=n(44).Buffer,a=n(124).inspect,c=a&&a.custom||"inspect";t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var e,n,u;return e=t,(n=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n}},{key:"concat",value:function(t){if(0===this.length)return s.alloc(0);for(var e,n,r,i=s.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,n=i,r=a,s.prototype.copy.call(e,n,r),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var n;return t<this.head.data.length?(n=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):n=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,n=1,r=e.data;for(t-=r.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?r+=i:r+=i.slice(0,t),0==(t-=o)){o===i.length?(++n,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(t){var e=s.allocUnsafe(t),n=this.head,r=1;for(n.data.copy(e),t-=n.data.length;n=n.next;){var i=n.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,e}},{key:c,value:function(t,e){return a(this,function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},e,{depth:0,customInspect:!1}))}}])&&o(e.prototype,n),u&&o(e,u),t}()},function(t,e){},function(t,e,n){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(t){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}}).call(this,n(35))},function(t,e,n){"use strict";(function(e){var r;function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var o=n(79),s=Symbol("lastResolve"),a=Symbol("lastReject"),c=Symbol("error"),u=Symbol("ended"),h=Symbol("lastPromise"),l=Symbol("handlePromise"),f=Symbol("stream");function d(t,e){return{value:t,done:e}}function p(t){var e=t[s];if(null!==e){var n=t[f].read();null!==n&&(t[h]=null,t[s]=null,t[a]=null,e(d(n,!1)))}}function v(t){e.nextTick(p,t)}var g=Object.getPrototypeOf((function(){})),m=Object.setPrototypeOf((i(r={get stream(){return this[f]},next:function(){var t=this,n=this[c];if(null!==n)return Promise.reject(n);if(this[u])return Promise.resolve(d(void 0,!0));if(this[f].destroyed)return new Promise((function(n,r){e.nextTick((function(){t[c]?r(t[c]):n(d(void 0,!0))}))}));var r,i=this[h];if(i)r=new Promise(function(t,e){return function(n,r){t.then((function(){e[u]?n(d(void 0,!0)):e[l](n,r)}),r)}}(i,this));else{var o=this[f].read();if(null!==o)return Promise.resolve(d(o,!1));r=new Promise(this[l])}return this[h]=r,r}},Symbol.asyncIterator,(function(){return this})),i(r,"return",(function(){var t=this;return new Promise((function(e,n){t[f].destroy(null,(function(t){t?n(t):e(d(void 0,!0))}))}))})),r),g);t.exports=function(t){var e,n=Object.create(m,(i(e={},f,{value:t,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,c,{value:null,writable:!0}),i(e,u,{value:t._readableState.endEmitted,writable:!0}),i(e,l,{value:function(t,e){var r=n[f].read();r?(n[h]=null,n[s]=null,n[a]=null,t(d(r,!1))):(n[s]=t,n[a]=e)},writable:!0}),e));return n[h]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=n[a];return null!==e&&(n[h]=null,n[s]=null,n[a]=null,e(t)),void(n[c]=t)}var r=n[s];null!==r&&(n[h]=null,n[s]=null,n[a]=null,r(d(void 0,!0))),n[u]=!0})),t.on("readable",v.bind(null,n)),n}}).call(this,n(38))},function(t,e){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},function(t,e,n){"use strict";t.exports=i;var r=n(94);function i(t){if(!(this instanceof i))return new i(t);r.call(this,t)}n(59)(i,r),i.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){"use strict";var r;var i=n(45).codes,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function c(t,e,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var a=!1;t.on("close",(function(){a=!0})),void 0===r&&(r=n(79)),r(t,{readable:e,writable:i},(function(t){if(t)return o(t);a=!0,o()}));var c=!1;return function(e){if(!a&&!c)return c=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new s("pipe"))}}function u(t){t()}function h(t,e){return t.pipe(e)}function l(t){return t.length?"function"!=typeof t[t.length-1]?a:t.pop():a}t.exports=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r,i=l(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new o("streams");var s=e.map((function(t,n){var o=n<e.length-1;return c(t,o,n>0,(function(t){r||(r=t),t&&s.forEach(u),o||(s.forEach(u),i(r))}))}));return e.reduce(h)}},function(t,e,n){(function(e){/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
38
+ let n;t.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:e):t=>(n||(n=Promise.resolve())).then(t).catch(t=>setTimeout(()=>{throw t},0))}).call(this,n(35))},function(t,e,n){"use strict";function r(t,e){for(const n in e)Object.defineProperty(t,n,{value:e[n],enumerable:!0,configurable:!0});return t}t.exports=function(t,e,n){if(!t||"string"==typeof t)throw new TypeError("Please pass an Error to err-code");n||(n={}),"object"==typeof e&&(n=e,e=""),e&&(n.code=e);try{return r(t,n)}catch(e){n.message=t.message,n.stack=t.stack;const i=function(){};i.prototype=Object.create(Object.getPrototypeOf(t));return r(new i,n)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DigitalHumanVideoPlayManager=void 0;const r=n(63),i=n(31);e.DigitalHumanVideoPlayManager=class{constructor(t,e){this.messages=t,this.publicUnmuteDigitalHumanMethod=e,this.remoteVideoPlayCount=0}play(t){this.video=t,this.playRemoteVideo()}unmuteVideo(){this.video&&this.video.muted&&(this.video.muted=!1,this.messages.next(new r.DigitalHumanUnmuted))}playRemoteVideo(){this.video&&(this.video.onerror=t=>{this.messages.next(new r.DigitalHumanVideoError(t))},this.video.play().then(()=>{this.messages.next(new r.DigitalHumanUnmuted)}).catch(()=>{this.digitalHumanFailedToPlayUnmuted()}))}digitalHumanFailedToPlayUnmuted(){this.messages.next(new r.DigitalHumanFailedToPlay),this.video.muted=!0,this.video.play().then(()=>{i.logger.log("Muting the digital human and playing it succeeded."),this.messages.next(new r.DigitalHumanPlayedInMutedModeSuccess),this.video.addEventListener("click",()=>{this.publicUnmuteDigitalHumanMethod()},{once:!0})}).catch(t=>{i.logger.log("Could not play digital human video even as muted, starting exponential backoff.",t),this.playRemoteVideoWithExponentialBackoff()})}playRemoteVideoWithExponentialBackoff(){this.video&&(this.video.autoplay=!0,this.video.play().then(()=>{this.messages.next(new r.DigitalHumanUnmuted)}),this.remoteVideoPlayCount++,setTimeout(()=>{this.remoteVideoPlayCount<10&&this.playRemoteVideoWithExponentialBackoff()},100*(this.remoteVideoPlayCount-1)))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LocaleDetector=void 0;class r{static validateOrDetectSpeechLocales(t){let e=t.speechToTextLocales;e&&e.length>0&&(e.match(this.localesRegEx)||console.error(`UneeQ: Likely invalid value for speechToTextLocales: ${e}. Please use a BCP-47 language tag with multiple locales separated by colon .e.g 'en-US:ja-JP`),"undefined"!==e&&"null"!==e||(e=this.defaultLocale));let n=(window.navigator.languages||[window.navigator.language]).map(t=>t.length<5?this.localeMappings[t]||null:t).slice(0,4).join(":");return n&&0!==n.length||(n=this.defaultLocale),e||n}}e.LocaleDetector=r,r.defaultLocale="en-US",r.localesRegEx=/^([a-z]{2}(-[A-Z]{2}))(:[a-z]{2}(-[A-Z]{2})?)*$/,r.localeMappings={en:"en-US",es:"es-ES",fr:"fr-FR",ja:"ja-JP",de:"de-DE",ko:"ko-KR",zh:"zh-CN",it:"it-IT",pt:"pt-PT",nl:"nl-NL",sv:"sv-SE",da:"da-DK",no:"no-NO",fi:"fi-FI",ru:"ru-RU",pl:"pl-PL",tr:"tr-TR",ar:"ar-SA",th:"th-TH",id:"id-ID",cs:"cs-CZ",hu:"hu-HU",ro:"ro-RO",he:"he-IL",vi:"vi-VN",uk:"uk-UA",hi:"hi-IN"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MessageHandler=void 0;const r=n(37),i=n(80);e.MessageHandler=class{constructor(t,e){this.internalMessages$=t,this.messages=e,this.deviceManager={getDevices:(t,e)=>{}},this.getMessagesOfType("AvatarQuestionText").subscribe(t=>{const e={type:i.PromMessageType.QuestionMessageReceived,value:{id:t.id,receivedOn:Date.now()}};this.internalMessages$.next({faceMeMessageType:"prom",promMsg:e}),this.messages.next(new r.AvatarQuestionMessage(t.question,t.id))}),this.getMessagesOfType("AvatarAnswerText").subscribe(t=>{const e={type:i.PromMessageType.AnswerMessageReceived,value:{id:t.questionId,receivedOn:Date.now()}};this.internalMessages$.next({faceMeMessageType:"prom",promMsg:e}),this.messages.next(new r.AvatarAnswerMessage(t.answer,t.answerAvatar,t.answerSpeech,t.questionId))}),this.getMessagesOfType("AvatarAnswerHTML").subscribe(t=>{this.messages.next(new r.AvatarAnswerContentMessage(t.html,t.messageId,t.hasDisplayHtml)),this.messages.next(new r.InstructionsMessage(t.instructions))}),this.getMessagesOfType("AvatarTextInputStarted").subscribe(t=>this.messages.next(new r.StartedSpeakingMessage)),this.getMessagesOfType("AvatarTextInputFinished").subscribe(t=>{this.messages.next(new r.FinishedSpeakingMessage),this.messages.next(new r.AvatarTextInputFinishedMessage)}),this.getMessagesOfType("AvatarStarting").subscribe(t=>{this.deviceManager.edgeNodeId=t.edgeNodeId}),this.getMessagesOfType("ClientMediaStreamUpdate").subscribe(t=>{this.messages.next(new r.ClientMediaStreamUpdateMessage(t.clientStreamingAudio,t.clientStreamingVideo,t.serverStreamingAudio,t.serverStreamingVideo)),t.clientStreamingAudio&&t.clientStreamingVideo&&t.serverStreamingAudio&&t.serverStreamingVideo&&(this.internalMessages$.next({faceMeMessageType:"sessionLive"}),this.internalMessages$.next({faceMeMessageType:"remoteVideoReadyToPlay"}))}),this.getMessagesOfType("SessionErrorMessage").subscribe(t=>{console.error(t.error),this.messages.next(new r.SessionErrorMessage(t.error))}),this.getMessagesOfType("SessionInfoMessage").subscribe(t=>{this.messages.next(new r.SessionInfoMessage(t.info))}),this.getMessagesOfType("SessionEndedMessage").subscribe(()=>{const t={type:i.PromMessageType.SessionEnded,value:{receivedOn:Date.now()}};this.internalMessages$.next({faceMeMessageType:"prom",promMsg:t}),this.internalMessages$.next({faceMeMessageType:"sessionEnd"})}),this.getMessagesOfType("AvatarRequestCompleted").subscribe(t=>{this.messages.next(new r.AvatarRequestCompleted(t.reason))}),this.getMessagesOfType("AvatarRequestIgnored").subscribe(t=>{this.messages.next(new r.AvatarRequestIgnored(t.reason))})}setDeviceManager(t){this.deviceManager=t}getMessagesOfType(t){return this.internalMessages$.filter(e=>e.faceMeMessageType===t)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r={};e.default=void 0;var i=n(136),o=n(140);Object.keys(o).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(r,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}}))}));e.default=function(){return new i.Registry}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Registry=void 0;var r=n(64),i=n(95),o=n(138),s=n(139),a=n(97);function c(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var u=function(){function t(){var e,n,r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r=void 0,(n="data")in(e=this)?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,this.data={counter:{},gauge:{},histogram:{}}}var e,n,u;return e=t,(n=[{key:"validateInput",value:function(t,e,n,i){if(""===String(e))throw new Error("Metric name cannot be empty");if(-1===["counter","gauge","histogram"].indexOf(t))throw new Error("Unknown metric type ".concat(t));if("string"!=typeof n&&null!=n)throw new Error("help must be string or undefined/null");if((0,r.has)(this.data,"".concat(t,".").concat(e)))throw new Error("A metric with the name '".concat(e,"' already exists for type '").concat(t,"'"));if(!Array.isArray(i)&&null!=i)throw new Error("buckets must be array or undefined/null")}},{key:"create",value:function(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return this.validateInput(t,e,r,a),"counter"===t?(n=new i.Counter,this.data.counter[e]={help:r,instance:n,type:t}):"gauge"===t?(n=new o.Gauge,this.data.gauge[e]={help:r,instance:n,type:t}):(n=new s.Histogram(a),this.data.histogram[e]={help:r,instance:n,type:t}),n}},{key:"metrics",value:function(){return(0,r.reduce)(this.data,(function(t,e,n){return t+(0,r.reduce)(e,(function(t,e,i){var o=e.instance.collect(),s=t;return e.help.length>0&&(s+="# HELP ".concat(i," ").concat(e.help,"\n")),s+="# TYPE ".concat(i," ").concat(n,"\n"),s+=(0,r.reduce)(o,(function(t,e){return t+("histogram"===n?(0,a.formatHistogramOrSummary)(i,e):(0,a.formatCounterOrGauge)(i,e))}),"")}),"")}),"")}},{key:"reset",value:function(){return(0,r.each)(this.data,(function(t){(0,r.each)(t,(function(t){t.instance.resetAll()}))})),this}},{key:"clear",value:function(){return this.data={counter:{},gauge:{},histogram:{}},this}},{key:"get",value:function(t,e){var n=(null!=t?[this.data[t]]:(0,r.valuesIn)(this.data)).find((function(t){return(0,r.has)(t,e)}));return null!=n?n[e].instance:void 0}}])&&c(e.prototype,n),u&&c(e,u),t}();e.Registry=u},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}Object.defineProperty(e,"__esModule",{value:!0}),e.Gauge=void 0;var u=function(t){function e(){return i(this,e),s(this,a(e).apply(this,arguments))}var n,r,u;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(e,t),n=e,(r=[{key:"dec",value:function(t){var e=this.get(t);return this.set(e?e.value-1:0,t),this}},{key:"sub",value:function(t,e){var n=this.get(e);return this.set(n?n.value-t:0,e),this}}])&&o(n.prototype,r),u&&o(n,u),e}(n(95).Counter);e.Gauge=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Histogram=void 0;var r=n(64);function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return!e||"object"!==i(e)&&"function"!=typeof e?u(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t,e){return(h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function l(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function f(t){return{entries:(0,r.reduce)(t,(function(t,e){return t[e.toString()]=0,t}),{"+Inf":0}),sum:0,count:0,raw:[]}}var d=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return o(this,e),l(u(t=a(this,c(e).call(this))),"buckets",void 0),t.buckets=n.sort((function(t,e){return t>e?1:-1})),t.set(f(t.buckets)),t.observe=t.observe.bind(u(t)),t}var n,i,d;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&h(t,e)}(e,t),n=e,(i=[{key:"observe",value:function(t,e){var n=this.get(e);null==n&&(n=this.set(f(this.buckets),e).get(e)),n.value.raw.push(t),n.value.entries["+Inf"]+=1;var i=function(t,e){if(e<t[t.length-1])for(var n=0;n<t.length;n+=1)if(e<=t[n])return n}(this.buckets,t);if(null!=i)for(var o=i;o<this.buckets.length;o+=1){var s=n.value.entries[this.buckets[o].toString()];n.value.entries[this.buckets[o].toString()]=s+1}return n.value.sum=(0,r.sum)(n.value.raw),n.value.count+=1,this}},{key:"reset",value:function(t){this.set(f(this.buckets),t)}}])&&s(n.prototype,i),d&&s(n,d),e}(n(96).Collector);e.Histogram=d},function(t,e,n){},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MessagingState=e.MessagingService=void 0;const r=n(142);Object.defineProperty(e,"MessagingService",{enumerable:!0,get:function(){return r.MessagingService}});const i=n(98);Object.defineProperty(e,"MessagingState",{enumerable:!0,get:function(){return i.MessagingState}})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MessagingService=void 0;const r=n(157),i=n(143),o=n(145),s=n(31),a=n(98);e.MessagingService=class{constructor(t,e){this.options={autoReconnect:!0,reconnectTime:5e3,maxReconnectAttempts:3,connectionHeaders:{},maxReconnectLimitReached:()=>{},onReconnect:()=>{}},this.url=t,this.options=Object.assign(this.options,e),this.subscriptions={},this.connectionAttempts=0,this.state$=new i.BehaviorSubject(a.MessagingState.DISCONNECTED),this.messages$=new o.Subject,console.log("connect headers messaging: ",this.options.connectionHeaders);const n={connectHeaders:this.options.connectionHeaders,reconnectDelay:0,connectionTimeout:5e3,discardWebsocketOnCommFailure:!0,brokerURL:this.url.replace("https://","wss://").replace("http://","ws://")};this.stompClient=new r.Client(n),this.stompClient.onConnect=t=>this.onStompConnected(t),this.stompClient.onDisconnect=t=>{s.logger.log("Stomp client disconnected",t)},this.stompClient.onStompError=t=>{s.logger.log("Stomp client error",t),this.onStompClientConnectionClosed(t)},this.stompClient.onWebSocketError=t=>{s.logger.log("Stomp client web socket error",t),this.onStompClientConnectionClosed(t)},this.stompClient.onWebSocketClose=t=>{s.logger.log("Stomp client web socket closed",t),this.onStompClientConnectionClosed(t)}}connect(){this.disconnect(),s.logger.log("MessagingService | connecting..."),this.state$.next(a.MessagingState.CONNECTING),this.connectionAttempts++,this.stompClient.activate()}disconnect(){const t=this.state$.getValue();if(t===a.MessagingState.CONNECTED||t===a.MessagingState.CONNECTING){s.logger.log("Disconnecting stomp client");try{this.subscriptions={},this.options.autoReconnect=!1,this.stompClient.deactivate(),this.stompClient.forceDisconnect(),this.state$.next(a.MessagingState.DISCONNECTED)}catch(t){console.error("MessagingService | disconnect: error",t),this.state$.next(a.MessagingState.DISCONNECTED)}}}send(t,e){s.logger.log("MessagingService | send:",t,e);const n={"content-type":"application/json","x-auth-token":this.options.connectionHeaders["x-auth-token"]},r=JSON.stringify(e);this.stompClient.publish({destination:t,body:r,headers:n})}getTopic(t){s.logger.log("MessagingService | subscribeToTopic: "+t);const e=this.subscriptions[t];if(e)return s.logger.log("existing subscription... not re-subscribing to topic"),e;const n=new o.Subject;return this.stompClient.subscribe(t,t=>{n.next(t),this.messages$.next(t)}),this.subscriptions[t]=n,n}onStompConnected(t){s.logger.log("MessagingService | connected"),this.state$.next(a.MessagingState.CONNECTED),this.initMessagingSubscription(),this.connectionAttempts=0}onStompClientConnectionClosed(t){this.options.autoReconnect?this.options.maxReconnectAttempts&&this.connectionAttempts<this.options.maxReconnectAttempts?setTimeout(()=>{this.connect()},this.options.reconnectTime):this.options.maxReconnectLimitReached&&(this.options.maxReconnectLimitReached(),this.disconnect()):this.disconnect()}initMessagingSubscription(){s.logger.log("MessagingService | initMessagingSubscription");this.stompClient.subscribe("/",t=>{this.messages$.next(t)})}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(144))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(47);e.BehaviorSubject=r.BehaviorSubject},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(146))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(47);e.Subject=r.Subject},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MetricsService=void 0;const r=n(37),i=n(148),o=n(80);e.MetricsService=class{constructor(t,e,n){this.uneeqOptions=t,this.internalMessages=e,this.messages=n,this.clientPerformanceStats={},this.options=t,this.internalMessages$=e,this.messages$=n}parseAndLogWebRtcStats(t){try{t.forEach(t=>{var e,n;if("inbound-rtp"===t.type&&"video"===t.kind){this.clientPerformanceStats.frameHeight=new i.ClientPerformanceStat("Frame height",t.frameHeight),this.clientPerformanceStats.frameWidth=new i.ClientPerformanceStat("Frame width",t.frameWidth);const r=t.framesDropped,o=r?r-(null===(e=this.clientPerformanceStats.totalFramesDropped)||void 0===e?void 0:e.value):0;this.clientPerformanceStats.newFramesDropped=o?new i.ClientPerformanceStat("New Frames Dropped",o):new i.ClientPerformanceStat,this.clientPerformanceStats.totalFramesDropped=r?new i.ClientPerformanceStat("Total Frames Dropped",r):new i.ClientPerformanceStat;const s=t.packetsLost,a=s?s-(null===(n=this.clientPerformanceStats.inboundTotalPacketsLost)||void 0===n?void 0:n.value):0;this.clientPerformanceStats.inboundNewPacketsLost=a?new i.ClientPerformanceStat("New packets lost",a):new i.ClientPerformanceStat,this.clientPerformanceStats.inboundTotalPacketsLost=s?new i.ClientPerformanceStat("Total packets lost",s):new i.ClientPerformanceStat;const c=t.framesPerSecond;this.clientPerformanceStats.framesPerSec=c?new i.ClientPerformanceStat("Frames per second",c):new i.ClientPerformanceStat}else if("remote-inbound-rtp"===t.type&&"video"===t.kind){const e=t.roundTripTime;this.clientPerformanceStats.inboundRoundTripTime=e?new i.ClientPerformanceStat("Round Trip Time",e):new i.ClientPerformanceStat}else if("outbound-rtp"===t.type&&"video"===t.kind){const e=t.qualityLimitationReason;this.clientPerformanceStats.outboundQualityLimitationReason=new i.ClientPerformanceStat("Quality Limitation Reason",e)}}),this.options.enableClientPerformanceMessage&&this.messages$.next(new r.ClientPerformanceMessage(this.clientPerformanceStats));const e={type:o.PromMessageType.WebRtcPerformance,value:this.clientPerformanceStats};this.internalMessages$.next({faceMeMessageType:"prom",promMsg:e})}catch(t){console.warn("Unable to parseAndLogWebRTCStats",t)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ClientPerformanceStat=void 0;e.ClientPerformanceStat=class{constructor(t="",e=0){this.label=t,this.value=e}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.OnlineStatusService=void 0;const r=n(37);e.OnlineStatusService=class{constructor(t,e){this.messages=t,this.offlineTimeoutLimitHandler=e,this.online=!0,this.offlineDisconnectTimeLimitMS=1e4,window.addEventListener("offline",()=>this.handleOffline()),window.addEventListener("online",()=>this.handleOnline())}handleOffline(){this.online=!1,this.disconnectTimer=setTimeout(()=>{this.offlineTimeoutLimitHandler()},this.offlineDisconnectTimeLimitMS),this.sendStatusUpdate()}handleOnline(){this.online=!0,window.clearTimeout(this.disconnectTimer),this.sendStatusUpdate()}sendStatusUpdate(){this.messages.next(new r.OnlineStatusUpdateMessage(this.online))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ResumeSessionCheck=void 0;const r=n(31);class i{static validate(t){let e=void 0!==t.resumeSession&&t.resumeSession;localStorage.getItem("uneeqResumeSessionPersonaId")===t.conversationId||(r.logger.log("UneeQ: Persona Id's do not match, unable to resume session."),e=!1);const n=i.browserTabIsActive();if(e&&!n&&(r.logger.log("UneeQ: Browser tab is not active so unable to resume"),e=!1),e){const t=localStorage.getItem("uneeqResumeSessionId");if(null!==t)return{resumeSession:!0,resumeSessionId:t}}return{resumeSession:!1}}static browserTabIsActive(){return!document.hidden}}e.ResumeSessionCheck=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.StreamManager=void 0;e.StreamManager=class{constructor(){window.AudioContext=window.AudioContext||window.webkitAudioContext,this.silentAudioTrack=this.generateSilentAudioTrack(),this.canvasVideoTrack=this.generateCanvasVideoTrack()}addCanvasVideoTrackToStream(t){return t.getVideoTracks().forEach(e=>t.removeTrack(e)),t.addTrack(this.canvasVideoTrack),t}addSilentAudioTrackToStream(t){return t.getAudioTracks().forEach(e=>t.removeTrack(e)),t.addTrack(this.silentAudioTrack),t}resumeAudioContext(){this.audioContextInstance&&this.audioContextInstance.resume()}generateCanvasVideoTrack(){const t=document.createElement("canvas");t.width=40,t.height=30,t.getContext("2d");return t.captureStream(1).getVideoTracks()[0]}generateSilentAudioTrack(){if(!this.audioSourceNode||!this.audioSourceDestination){const t=new window.AudioContext;this.audioContextInstance=t,this.audioSourceDestination=t.createMediaStreamDestination()}return this.audioSourceDestination.stream.getAudioTracks()[0]}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UneeqLocalStorage=void 0;const r=n(31);e.UneeqLocalStorage=class{constructor(){}get available(){return void 0===this.localStorageAvailable&&(this.localStorageAvailable=this.checkIfLocalStorageAvailable()),this.localStorageAvailable}setItemSafely(t,e){this.available?localStorage.setItem(t,e):r.logger.log("UneeQ: unable to access localStorage because it is not available.")}getItemSafely(t){return this.available?localStorage.getItem(t):void r.logger.log("UneeQ: unable to access localStorage because it is not available.")}removeItemSafely(t){this.available?localStorage.removeItem(t):r.logger.log("UneeQ: unable to access localStorage because it is not available.")}checkIfLocalStorageAvailable(){try{return localStorage.setItem("UneeqLocalStoreCheck","UneeqLocalStoreCheck"),localStorage.removeItem("UneeqLocalStoreCheck"),!0}catch(t){return console.warn("UneeQ: Local storage is not available. Reason: ",t),!1}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VoiceInputManager=void 0;const r=n(81),i=n(154),o=n(63),s=n(99),a=n(31);e.VoiceInputManager=class{constructor(t,e,n,r){this.options=t,this.api=e,this.messages=n,this.enableMicrophone=r,this.microphoneEngageVolume=.02,this.microphoneDisengageVolume=.02,this.voiceActivityNotSpeakingTimeoutMS=1e3,this.voiceActivityAllowInterruptions=!1,this.digitalHumanSpeaking=!1,this.recording=!1,this.setVoiceInputMode(t.voiceInputMode);try{window.AudioContext=window.AudioContext||window.webkitAudioContext,this.audioContext=new AudioContext}catch(t){this.audioContextNotSupported()}this.handleAppMessages()}setVoiceInputMode(t){t===s.VoiceInputMode.PUSH_TO_TALK?this.options.voiceInputMode=s.VoiceInputMode.PUSH_TO_TALK:t===s.VoiceInputMode.VOICE_ACTIVITY?this.options.voiceInputMode=s.VoiceInputMode.VOICE_ACTIVITY:this.messages.next(new o.WarningMessage("Invalid voice input mode selected: "+t))}startRecording(){this.options.voiceInputMode===s.VoiceInputMode.PUSH_TO_TALK?this.apiStartRecording():this.requestNotSupportedInVoiceActivityMode("startRecording")}stopRecording(){this.options.voiceInputMode===s.VoiceInputMode.PUSH_TO_TALK?this.apiStopRecording():this.requestNotSupportedInVoiceActivityMode("stopRecording")}handleSessionEnd(){this.soundMeter&&this.soundMeter.stop()}resumeAudioContext(){a.logger.log("UneeQ: resuming publish stream audio context and initializing mic activity."),this.audioContext&&(this.audioContext.resume(),this.stream&&this.initMicActivity(this.stream))}initMicActivity(t){this.stream=t,this.soundMeter=new i.SoundMeter(this.audioContext),this.soundMeter.connectToSource(t,t=>this.micActivityConnected(t))}audioContextNotSupported(){this.options.micActivityMessages&&this.messages.next(new o.MicActivityNotSupportedMessage),this.messages.next(new o.VoiceActivityInputModeNotSupportedMessage),this.setVoiceInputMode(s.VoiceInputMode.PUSH_TO_TALK)}handleAppMessages(){this.messages.subscribe(t=>{switch(t.uneeqMessageType){case o.UneeqMessageType.StartedSpeaking:console.log("StartSpeaking message"),this.digitalHumanSpeaking=!0;break;case o.UneeqMessageType.FinishedSpeaking:this.digitalHumanSpeaking=!1}})}requestNotSupportedInVoiceActivityMode(t){this.messages.next(new o.WarningMessage("Request not supported in voice activity mode: "+t))}apiStartRecording(){this.recording=!0,this.messages.next(new o.RecordingStartedMessage),this.api.avatarStartRecording().catch(()=>{this.recording=!1,this.messages.next(new o.RecordingStoppedMessage)})}apiStopRecording(){this.recording=!1,this.api.avatarStopRecording().finally(()=>this.messages.next(new o.RecordingStoppedMessage))}micActivityConnected(t){t?this.messages.next(new o.MicActivityErrorMessage(t)):this.soundMeter&&this.soundMeter.instant$.pipe(r.distinctUntilChanged()).subscribe(t=>{this.handleVoiceActivity(t)})}handleVoiceActivity(t){this.options.micActivityMessages&&this.messages.next(new o.MicActivityMessage(t)),this.options.voiceInputMode!==s.VoiceInputMode.VOICE_ACTIVITY||this.digitalHumanSpeaking&&!this.voiceActivityAllowInterruptions||(t>this.microphoneEngageVolume?(this.recording||this.apiStartRecording(),this.clearSilenceTimeout()):t<this.microphoneDisengageVolume&&this.recording&&(this.clearSilenceTimeout(),this.silenceTimeout=setTimeout(()=>{this.recording&&this.apiStopRecording()},this.voiceActivityNotSpeakingTimeoutMS)))}clearSilenceTimeout(){this.silenceTimeout&&clearTimeout(this.silenceTimeout)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SoundMeter=void 0;const r=n(47),i=n(31);e.SoundMeter=class{constructor(t){this.instant$=new r.BehaviorSubject(0),this.context=t,this.instant=0,this.slow=0,this.clip=0,this.script=t.createScriptProcessor(2048,1,1);const e=this;this.script.onaudioprocess=t=>{const n=t.inputBuffer.getChannelData(0);let r,i=0,o=0;for(r=0;r<n.length;++r)i+=n[r]*n[r],Math.abs(n[r])>.99&&(o+=1);e.instant=Math.sqrt(i/n.length),e.slow=.95*e.slow+.05*e.instant,e.clip=o/n.length,e.instant$.next(parseFloat(e.instant.toFixed(2)))}}connectToSource(t,e){i.logger.log("SoundMeter connecting");try{this.mic=this.context.createMediaStreamSource(t),this.mic.connect(this.script),this.script.connect(this.context.destination),void 0!==e&&e(null)}catch(t){console.error(t),void 0!==e&&e(t)}}stop(){this.mic.disconnect(),this.script.disconnect()}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SessionType=void 0,function(t){t[t.WEB=0]="WEB"}(e.SessionType||(e.SessionType={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SourceApp=void 0,function(t){t.HOSTED_EXPERIENCE="HOSTED_EXPERIENCE",t.SHOWCASE="SHOWCASE",t.SPLIT_SCREEN="SPLIT_SCREEN",t.INTERACTIONS="INTERACTIONS",t.UNKNOWN="UNKNOWN"}(e.SourceApp||(e.SourceApp={}))},function(t,e,n){"use strict";n.r(e),n.d(e,"Client",(function(){return f})),n.d(e,"FrameImpl",(function(){return o})),n.d(e,"Parser",(function(){return s})),n.d(e,"StompConfig",(function(){return d})),n.d(e,"StompHeaders",(function(){return p})),n.d(e,"StompSubscription",(function(){return v})),n.d(e,"StompSocketState",(function(){return a})),n.d(e,"ActivationState",(function(){return c})),n.d(e,"Versions",(function(){return u})),n.d(e,"CompatClient",(function(){return m})),n.d(e,"Stomp",(function(){return y}));const r="\n",i="\0";class o{constructor(t){const{command:e,headers:n,body:r,binaryBody:i,escapeHeaderValues:o,skipContentLengthHeader:s}=t;this.command=e,this.headers=Object.assign({},n||{}),i?(this._binaryBody=i,this.isBinaryBody=!0):(this._body=r||"",this.isBinaryBody=!1),this.escapeHeaderValues=o||!1,this.skipContentLengthHeader=s||!1}get body(){return!this._body&&this.isBinaryBody&&(this._body=(new TextDecoder).decode(this._binaryBody)),this._body}get binaryBody(){return this._binaryBody||this.isBinaryBody||(this._binaryBody=(new TextEncoder).encode(this._body)),this._binaryBody}static fromRawFrame(t,e){const n={},r=t=>t.replace(/^\s+|\s+$/g,"");for(const i of t.headers.reverse()){i.indexOf(":");const s=r(i[0]);let a=r(i[1]);e&&"CONNECT"!==t.command&&"CONNECTED"!==t.command&&(a=o.hdrValueUnEscape(a)),n[s]=a}return new o({command:t.command,headers:n,binaryBody:t.binaryBody,escapeHeaderValues:e})}toString(){return this.serializeCmdAndHeaders()}serialize(){const t=this.serializeCmdAndHeaders();return this.isBinaryBody?o.toUnit8Array(t,this._binaryBody).buffer:t+this._body+i}serializeCmdAndHeaders(){const t=[this.command];this.skipContentLengthHeader&&delete this.headers["content-length"];for(const e of Object.keys(this.headers||{})){const n=this.headers[e];this.escapeHeaderValues&&"CONNECT"!==this.command&&"CONNECTED"!==this.command?t.push(`${e}:${o.hdrValueEscape(""+n)}`):t.push(`${e}:${n}`)}return(this.isBinaryBody||!this.isBodyEmpty()&&!this.skipContentLengthHeader)&&t.push("content-length:"+this.bodyLength()),t.join(r)+r+r}isBodyEmpty(){return 0===this.bodyLength()}bodyLength(){const t=this.binaryBody;return t?t.length:0}static sizeOfUTF8(t){return t?(new TextEncoder).encode(t).length:0}static toUnit8Array(t,e){const n=(new TextEncoder).encode(t),r=new Uint8Array([0]),i=new Uint8Array(n.length+e.length+r.length);return i.set(n),i.set(e,n.length),i.set(r,n.length+e.length),i}static marshall(t){return new o(t).serialize()}static hdrValueEscape(t){return t.replace(/\\/g,"\\\\").replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/:/g,"\\c")}static hdrValueUnEscape(t){return t.replace(/\\r/g,"\r").replace(/\\n/g,"\n").replace(/\\c/g,":").replace(/\\\\/g,"\\")}}class s{constructor(t,e){this.onFrame=t,this.onIncomingPing=e,this._encoder=new TextEncoder,this._decoder=new TextDecoder,this._token=[],this._initState()}parseChunk(t,e=!1){let n;if(n=t instanceof ArrayBuffer?new Uint8Array(t):this._encoder.encode(t),e&&0!==n[n.length-1]){const t=new Uint8Array(n.length+1);t.set(n,0),t[n.length]=0,n=t}for(let t=0;t<n.length;t++){const e=n[t];this._onByte(e)}}_collectFrame(t){0!==t&&13!==t&&(10!==t?(this._onByte=this._collectCommand,this._reinjectByte(t)):this.onIncomingPing())}_collectCommand(t){if(13!==t)return 10===t?(this._results.command=this._consumeTokenAsUTF8(),void(this._onByte=this._collectHeaders)):void this._consumeByte(t)}_collectHeaders(t){13!==t&&(10!==t?(this._onByte=this._collectHeaderKey,this._reinjectByte(t)):this._setupCollectBody())}_reinjectByte(t){this._onByte(t)}_collectHeaderKey(t){if(58===t)return this._headerKey=this._consumeTokenAsUTF8(),void(this._onByte=this._collectHeaderValue);this._consumeByte(t)}_collectHeaderValue(t){if(13!==t)return 10===t?(this._results.headers.push([this._headerKey,this._consumeTokenAsUTF8()]),this._headerKey=void 0,void(this._onByte=this._collectHeaders)):void this._consumeByte(t)}_setupCollectBody(){const t=this._results.headers.filter(t=>"content-length"===t[0])[0];t?(this._bodyBytesRemaining=parseInt(t[1],10),this._onByte=this._collectBodyFixedSize):this._onByte=this._collectBodyNullTerminated}_collectBodyNullTerminated(t){0!==t?this._consumeByte(t):this._retrievedBody()}_collectBodyFixedSize(t){0!=this._bodyBytesRemaining--?this._consumeByte(t):this._retrievedBody()}_retrievedBody(){this._results.binaryBody=this._consumeTokenAsRaw(),this.onFrame(this._results),this._initState()}_consumeByte(t){this._token.push(t)}_consumeTokenAsUTF8(){return this._decoder.decode(this._consumeTokenAsRaw())}_consumeTokenAsRaw(){const t=new Uint8Array(this._token);return this._token=[],t}_initState(){this._results={command:void 0,headers:[],binaryBody:void 0},this._token=[],this._headerKey=void 0,this._onByte=this._collectFrame}}var a,c;!function(t){t[t.CONNECTING=0]="CONNECTING",t[t.OPEN=1]="OPEN",t[t.CLOSING=2]="CLOSING",t[t.CLOSED=3]="CLOSED"}(a||(a={})),function(t){t[t.ACTIVE=0]="ACTIVE",t[t.DEACTIVATING=1]="DEACTIVATING",t[t.INACTIVE=2]="INACTIVE"}(c||(c={}));class u{constructor(t){this.versions=t}supportedVersions(){return this.versions.join(",")}protocolVersions(){return this.versions.map(t=>`v${t.replace(".","")}.stomp`)}}u.V1_0="1.0",u.V1_1="1.1",u.V1_2="1.2",u.default=new u([u.V1_0,u.V1_1,u.V1_2]);class h{constructor(t,e,n={}){this._client=t,this._webSocket=e,this._serverFrameHandlers={CONNECTED:t=>{this.debug("connected to server "+t.headers.server),this._connected=!0,this._connectedVersion=t.headers.version,this._connectedVersion===u.V1_2&&(this._escapeHeaderValues=!0),this._setupHeartbeat(t.headers),this.onConnect(t)},MESSAGE:t=>{const e=t.headers.subscription,n=this._subscriptions[e]||this.onUnhandledMessage,r=t,i=this,o=this._connectedVersion===u.V1_2?r.headers.ack:r.headers["message-id"];r.ack=(t={})=>i.ack(o,e,t),r.nack=(t={})=>i.nack(o,e,t),n(r)},RECEIPT:t=>{const e=this._receiptWatchers[t.headers["receipt-id"]];e?(e(t),delete this._receiptWatchers[t.headers["receipt-id"]]):this.onUnhandledReceipt(t)},ERROR:t=>{this.onStompError(t)}},this._counter=0,this._subscriptions={},this._receiptWatchers={},this._partialData="",this._escapeHeaderValues=!1,this._lastServerActivityTS=Date.now(),this.configure(n)}get connectedVersion(){return this._connectedVersion}get connected(){return this._connected}configure(t){Object.assign(this,t)}start(){const t=new s(t=>{const e=o.fromRawFrame(t,this._escapeHeaderValues);this.logRawCommunication||this.debug("<<< "+e);(this._serverFrameHandlers[e.command]||this.onUnhandledFrame)(e)},()=>{this.debug("<<< PONG")});this._webSocket.onmessage=e=>{if(this.debug("Received data"),this._lastServerActivityTS=Date.now(),this.logRawCommunication){const t=e.data instanceof ArrayBuffer?(new TextDecoder).decode(e.data):e.data;this.debug("<<< "+t)}t.parseChunk(e.data,this.appendMissingNULLonIncoming)},this._onclose=t=>{this.debug("Connection closed to "+this._client.brokerURL),this._cleanUp(),this.onWebSocketClose(t)},this._webSocket.onclose=this._onclose,this._webSocket.onerror=t=>{this.onWebSocketError(t)},this._webSocket.onopen=()=>{const t=Object.assign({},this.connectHeaders);this.debug("Web Socket Opened..."),t["accept-version"]=this.stompVersions.supportedVersions(),t["heart-beat"]=[this.heartbeatOutgoing,this.heartbeatIncoming].join(","),this._transmit({command:"CONNECT",headers:t})}}_setupHeartbeat(t){if(t.version!==u.V1_1&&t.version!==u.V1_2)return;if(!t["heart-beat"])return;const[e,n]=t["heart-beat"].split(",").map(t=>parseInt(t,10));if(0!==this.heartbeatOutgoing&&0!==n){const t=Math.max(this.heartbeatOutgoing,n);this.debug(`send PING every ${t}ms`),this._pinger=setInterval(()=>{this._webSocket.readyState===a.OPEN&&(this._webSocket.send(r),this.debug(">>> PING"))},t)}if(0!==this.heartbeatIncoming&&0!==e){const t=Math.max(this.heartbeatIncoming,e);this.debug(`check PONG every ${t}ms`),this._ponger=setInterval(()=>{const e=Date.now()-this._lastServerActivityTS;e>2*t&&(this.debug(`did not receive server activity for the last ${e}ms`),this._closeOrDiscardWebsocket())},t)}}_closeOrDiscardWebsocket(){this.discardWebsocketOnCommFailure?(this.debug("Discarding websocket, the underlying socket may linger for a while"),this._discardWebsocket()):(this.debug("Issuing close on the websocket"),this._closeWebsocket())}forceDisconnect(){this._webSocket&&(this._webSocket.readyState!==a.CONNECTING&&this._webSocket.readyState!==a.OPEN||this._closeOrDiscardWebsocket())}_closeWebsocket(){this._webSocket.onmessage=()=>{},this._webSocket.close()}_discardWebsocket(){var t,e;this._webSocket.terminate||(t=this._webSocket,e=t=>this.debug(t),t.terminate=function(){const t=()=>{};this.onerror=t,this.onmessage=t,this.onopen=t;const n=new Date,r=this.onclose;this.onclose=t=>{const r=(new Date).getTime()-n.getTime();e(`Discarded socket closed after ${r}ms, with code/reason: ${t.code}/${t.reason}`)},this.close(),r.call(this,{code:4001,reason:"Heartbeat failure, discarding the socket",wasClean:!1})}),this._webSocket.terminate()}_transmit(t){const{command:e,headers:n,body:r,binaryBody:i,skipContentLengthHeader:s}=t,a=new o({command:e,headers:n,body:r,binaryBody:i,escapeHeaderValues:this._escapeHeaderValues,skipContentLengthHeader:s});let c=a.serialize();if(this.logRawCommunication?this.debug(">>> "+c):this.debug(">>> "+a),this.forceBinaryWSFrames&&"string"==typeof c&&(c=(new TextEncoder).encode(c)),"string"==typeof c&&this.splitLargeFrames){let t=c;for(;t.length>0;){const e=t.substring(0,this.maxWebSocketChunkSize);t=t.substring(this.maxWebSocketChunkSize),this._webSocket.send(e),this.debug(`chunk sent = ${e.length}, remaining = ${t.length}`)}}else this._webSocket.send(c)}dispose(){if(this.connected)try{const t=Object.assign({},this.disconnectHeaders);t.receipt||(t.receipt="close-"+this._counter++),this.watchForReceipt(t.receipt,t=>{this._closeWebsocket(),this._cleanUp(),this.onDisconnect(t)}),this._transmit({command:"DISCONNECT",headers:t})}catch(t){this.debug("Ignoring error during disconnect "+t)}else this._webSocket.readyState!==a.CONNECTING&&this._webSocket.readyState!==a.OPEN||this._closeWebsocket()}_cleanUp(){this._connected=!1,this._pinger&&clearInterval(this._pinger),this._ponger&&clearInterval(this._ponger)}publish(t){const{destination:e,headers:n,body:r,binaryBody:i,skipContentLengthHeader:o}=t,s=Object.assign({destination:e},n);this._transmit({command:"SEND",headers:s,body:r,binaryBody:i,skipContentLengthHeader:o})}watchForReceipt(t,e){this._receiptWatchers[t]=e}subscribe(t,e,n={}){(n=Object.assign({},n)).id||(n.id="sub-"+this._counter++),n.destination=t,this._subscriptions[n.id]=e,this._transmit({command:"SUBSCRIBE",headers:n});const r=this;return{id:n.id,unsubscribe:t=>r.unsubscribe(n.id,t)}}unsubscribe(t,e={}){e=Object.assign({},e),delete this._subscriptions[t],e.id=t,this._transmit({command:"UNSUBSCRIBE",headers:e})}begin(t){const e=t||"tx-"+this._counter++;this._transmit({command:"BEGIN",headers:{transaction:e}});const n=this;return{id:e,commit(){n.commit(e)},abort(){n.abort(e)}}}commit(t){this._transmit({command:"COMMIT",headers:{transaction:t}})}abort(t){this._transmit({command:"ABORT",headers:{transaction:t}})}ack(t,e,n={}){n=Object.assign({},n),this._connectedVersion===u.V1_2?n.id=t:n["message-id"]=t,n.subscription=e,this._transmit({command:"ACK",headers:n})}nack(t,e,n={}){return n=Object.assign({},n),this._connectedVersion===u.V1_2?n.id=t:n["message-id"]=t,n.subscription=e,this._transmit({command:"NACK",headers:n})}}var l=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};class f{constructor(t={}){this.stompVersions=u.default,this.connectionTimeout=0,this.reconnectDelay=5e3,this.heartbeatIncoming=1e4,this.heartbeatOutgoing=1e4,this.splitLargeFrames=!1,this.maxWebSocketChunkSize=8192,this.forceBinaryWSFrames=!1,this.appendMissingNULLonIncoming=!1,this.state=c.INACTIVE;const e=()=>{};this.debug=e,this.beforeConnect=e,this.onConnect=e,this.onDisconnect=e,this.onUnhandledMessage=e,this.onUnhandledReceipt=e,this.onUnhandledFrame=e,this.onStompError=e,this.onWebSocketClose=e,this.onWebSocketError=e,this.logRawCommunication=!1,this.onChangeState=e,this.connectHeaders={},this._disconnectHeaders={},this.configure(t)}get webSocket(){return this._stompHandler?this._stompHandler._webSocket:void 0}get disconnectHeaders(){return this._disconnectHeaders}set disconnectHeaders(t){this._disconnectHeaders=t,this._stompHandler&&(this._stompHandler.disconnectHeaders=this._disconnectHeaders)}get connected(){return!!this._stompHandler&&this._stompHandler.connected}get connectedVersion(){return this._stompHandler?this._stompHandler.connectedVersion:void 0}get active(){return this.state===c.ACTIVE}_changeState(t){this.state=t,this.onChangeState(t)}configure(t){Object.assign(this,t)}activate(){if(this.state===c.DEACTIVATING)throw this.debug("Still DEACTIVATING, please await call to deactivate before trying to re-activate"),new Error("Still DEACTIVATING, can not activate now");this.active?this.debug("Already ACTIVE, ignoring request to activate"):(this._changeState(c.ACTIVE),this._connect())}_connect(){return l(this,void 0,void 0,(function*(){if(this.connected)return void this.debug("STOMP: already connected, nothing to do");if(yield this.beforeConnect(),!this.active)return void this.debug("Client has been marked inactive, will not attempt to connect");this.connectionTimeout>0&&(this._connectionWatcher&&clearTimeout(this._connectionWatcher),this._connectionWatcher=setTimeout(()=>{this.connected||(this.debug(`Connection not established in ${this.connectionTimeout}ms, closing socket`),this.forceDisconnect())},this.connectionTimeout)),this.debug("Opening Web Socket...");const t=this._createWebSocket();this._stompHandler=new h(this,t,{debug:this.debug,stompVersions:this.stompVersions,connectHeaders:this.connectHeaders,disconnectHeaders:this._disconnectHeaders,heartbeatIncoming:this.heartbeatIncoming,heartbeatOutgoing:this.heartbeatOutgoing,splitLargeFrames:this.splitLargeFrames,maxWebSocketChunkSize:this.maxWebSocketChunkSize,forceBinaryWSFrames:this.forceBinaryWSFrames,logRawCommunication:this.logRawCommunication,appendMissingNULLonIncoming:this.appendMissingNULLonIncoming,discardWebsocketOnCommFailure:this.discardWebsocketOnCommFailure,onConnect:t=>{if(this._connectionWatcher&&(clearTimeout(this._connectionWatcher),this._connectionWatcher=void 0),!this.active)return this.debug("STOMP got connected while deactivate was issued, will disconnect now"),void this._disposeStompHandler();this.onConnect(t)},onDisconnect:t=>{this.onDisconnect(t)},onStompError:t=>{this.onStompError(t)},onWebSocketClose:t=>{this._stompHandler=void 0,this.state===c.DEACTIVATING&&(this._resolveSocketClose(),this._resolveSocketClose=void 0,this._changeState(c.INACTIVE)),this.onWebSocketClose(t),this.active&&this._schedule_reconnect()},onWebSocketError:t=>{this.onWebSocketError(t)},onUnhandledMessage:t=>{this.onUnhandledMessage(t)},onUnhandledReceipt:t=>{this.onUnhandledReceipt(t)},onUnhandledFrame:t=>{this.onUnhandledFrame(t)}}),this._stompHandler.start()}))}_createWebSocket(){let t;return t=this.webSocketFactory?this.webSocketFactory():new WebSocket(this.brokerURL,this.stompVersions.protocolVersions()),t.binaryType="arraybuffer",t}_schedule_reconnect(){this.reconnectDelay>0&&(this.debug(`STOMP: scheduling reconnection in ${this.reconnectDelay}ms`),this._reconnector=setTimeout(()=>{this._connect()},this.reconnectDelay))}deactivate(){return l(this,void 0,void 0,(function*(){let t;return this.state!==c.ACTIVE?(this.debug(`Already ${c[this.state]}, ignoring call to deactivate`),Promise.resolve()):(this._changeState(c.DEACTIVATING),this._reconnector&&clearTimeout(this._reconnector),this._stompHandler&&this.webSocket.readyState!==a.CLOSED?(t=new Promise((t,e)=>{this._resolveSocketClose=t}),this._disposeStompHandler(),t):(this._changeState(c.INACTIVE),Promise.resolve()))}))}forceDisconnect(){this._stompHandler&&this._stompHandler.forceDisconnect()}_disposeStompHandler(){this._stompHandler&&(this._stompHandler.dispose(),this._stompHandler=null)}publish(t){this._stompHandler.publish(t)}watchForReceipt(t,e){this._stompHandler.watchForReceipt(t,e)}subscribe(t,e,n={}){return this._stompHandler.subscribe(t,e,n)}unsubscribe(t,e={}){this._stompHandler.unsubscribe(t,e)}begin(t){return this._stompHandler.begin(t)}commit(t){this._stompHandler.commit(t)}abort(t){this._stompHandler.abort(t)}ack(t,e,n={}){this._stompHandler.ack(t,e,n)}nack(t,e,n={}){this._stompHandler.nack(t,e,n)}}class d{}class p{}class v{}class g{constructor(t){this.client=t}get outgoing(){return this.client.heartbeatOutgoing}set outgoing(t){this.client.heartbeatOutgoing=t}get incoming(){return this.client.heartbeatIncoming}set incoming(t){this.client.heartbeatIncoming=t}}class m extends f{constructor(t){super(),this.maxWebSocketFrameSize=16384,this._heartbeatInfo=new g(this),this.reconnect_delay=0,this.webSocketFactory=t,this.debug=(...t)=>{console.log(...t)}}_parseConnect(...t){let e,n,r,i={};if(t.length<2)throw new Error("Connect requires at least 2 arguments");if("function"==typeof t[1])[i,n,r,e]=t;else switch(t.length){case 6:[i.login,i.passcode,n,r,e,i.host]=t;break;default:[i.login,i.passcode,n,r,e]=t}return[i,n,r,e]}connect(...t){const e=this._parseConnect(...t);e[0]&&(this.connectHeaders=e[0]),e[1]&&(this.onConnect=e[1]),e[2]&&(this.onStompError=e[2]),e[3]&&(this.onWebSocketClose=e[3]),super.activate()}disconnect(t,e={}){t&&(this.onDisconnect=t),this.disconnectHeaders=e,super.deactivate()}send(t,e={},n=""){const r=!1===(e=Object.assign({},e))["content-length"];r&&delete e["content-length"],this.publish({destination:t,headers:e,body:n,skipContentLengthHeader:r})}set reconnect_delay(t){this.reconnectDelay=t}get ws(){return this.webSocket}get version(){return this.connectedVersion}get onreceive(){return this.onUnhandledMessage}set onreceive(t){this.onUnhandledMessage=t}get onreceipt(){return this.onUnhandledReceipt}set onreceipt(t){this.onUnhandledReceipt=t}get heartbeat(){return this._heartbeatInfo}set heartbeat(t){this.heartbeatIncoming=t.incoming,this.heartbeatOutgoing=t.outgoing}}class y{static client(t,e){null==e&&(e=u.default.protocolVersions());return new m(()=>new(y.WebSocketClass||WebSocket)(t,e))}static over(t){let e;return"function"==typeof t?e=t:(console.warn("Stomp.over did not receive a factory, auto reconnect will not work. Please see https://stomp-js.github.io/api-docs/latest/classes/Stomp.html#over"),e=()=>t),new m(e)}}y.WebSocketClass=null}]));