/* ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. *****************************************************************************/ (function(m,h){"object"===typeof exports&&"undefined"!==typeof module?h(exports):"function"===typeof define&&define.amd?define("rxjs",["exports"],h):h(m.rxjs={})})(this,function(m){function h(b,a){function c(){this.constructor=b}vd(b,a);b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}function T(b){return"function"===typeof b}function U(b){setTimeout(function(){throw b;},0)}function za(b){return null!==b&&"object"===typeof b}function Wa(b){return b.reduce(function(a,c){return a.concat(c instanceof fa?c.errors:c)},[])}function Aa(b){for(;b;){var a=b.destination,c=b.isStopped;if(b.closed||c)return!1;b=a&&a instanceof l?a:null}return!0}function N(b){return b}function Ba(){for(var b=[],a=0;a=c.length?c[0]:c);k.complete()}]))}catch(O){Aa(k)?k.error(O):console.warn(O)}}return k.subscribe(d)})}}function Cd(b){var a=this,c=b.args,d=b.subscriber;b=b.params;var e=b.callbackFunc,f=b.context,k=b.scheduler,g=b.subject;if(!g){g=b.subject=new W;try{e.apply(f,c.concat([function(){for(var c=[],b=0;b=c.length?c[0]:c,subject:g}))}]))}catch(n){g.error(n)}}this.add(g.subscribe(d))} function Dd(b){var a=b.subject;a.next(b.value);a.complete()}function db(b,a,c){if(a)if(y(a))c=a;else return function(){for(var d=[],e=0;e=c.length?c[0]:c),k.complete())}]))}catch(O){Aa(k)?k.error(O):console.warn(O)}}return k.subscribe(d)})}}function Ed(b){var a=this,c=b.params,d=b.subscriber;b=b.context;var e=c.callbackFunc,f=c.args,k=c.scheduler,g=c.subject;if(!g){g=c.subject=new W;try{e.apply(b,f.concat([function(){for(var c=[],b=0;b=c.length?c[0]:c,subject:g}))}]))}catch(n){this.add(k.schedule(eb,0,{err:n,subject:g}))}}this.add(g.subscribe(d))}function Fd(b){var a=b.subject;a.next(b.value);a.complete()}function eb(b){b.subject.error(b.err)}function fb(b){return!!b&&"function"!==typeof b.subscribe&&"function"===typeof b.then}function I(b,a,c,d,e){void 0===e&&(e=new Gd(b,c,d));if(!e.closed)return a instanceof g?a.subscribe(e):Fa(a)(e)} function Hd(b,a){return new g(function(c){var d=new q;d.add(a.schedule(function(){var e=b[X]();d.add(e.subscribe({next:function(b){d.add(a.schedule(function(){return c.next(b)}))},error:function(b){d.add(a.schedule(function(){return c.error(b)}))},complete:function(){d.add(a.schedule(function(){return c.complete()}))}}))}));return d})}function Id(b,a){return new g(function(c){var d=new q;d.add(a.schedule(function(){return b.then(function(b){d.add(a.schedule(function(){c.next(b);d.add(a.schedule(function(){return c.complete()}))}))}, function(b){d.add(a.schedule(function(){return c.error(b)}))})}));return d})}function Jd(b,a){if(!b)throw Error("Iterable cannot be null");return new g(function(c){var d=new q,e;d.add(function(){e&&"function"===typeof e.return&&e.return()});d.add(a.schedule(function(){e=b[F]();d.add(a.schedule(function(){if(!c.closed){var a,b;try{var d=e.next();a=d.value;b=d.done}catch(n){c.error(n);return}b?c.complete():(c.next(a),this.schedule())}}))}));return d})}function Kd(b,a){if(null!=b){if(b&&"function"=== typeof b[X])return Hd(b,a);if(fb(b))return Id(b,a);if(gb(b))return Da(b,a);if(b&&"function"===typeof b[F]||"string"===typeof b)return Jd(b,a)}throw new TypeError((null!==b&&typeof b||b)+" is not observable");}function G(b,a){return a?Kd(b,a):b instanceof g?b:new g(Fa(b))}function u(b,a){if(!a.closed){if(b instanceof g)return b.subscribe(a);var c;try{c=Fa(b)(a)}catch(d){a.error(d)}return c}}function J(b,a,c){void 0===c&&(c=Number.POSITIVE_INFINITY);if("function"===typeof a)return function(d){return d.pipe(J(function(c, d){return G(b(c,d)).pipe(A(function(b,e){return a(c,b,d,e)}))},c))};"number"===typeof a&&(c=a);return function(a){return a.lift(new Ld(b,c))}}function qa(b){void 0===b&&(b=Number.POSITIVE_INFINITY);return J(N,b)}function Ga(){return qa(1)}function Y(){for(var b=[],a=0;a=b.count?d.complete():(d.next(a),d.closed||(b.index=c+1,b.start=a+1,this.schedule(b)))}function lb(b,a,c){void 0===b&&(b=0);var d=-1;K(a)?d=1>Number(a)&&1||Number(a):y(a)&&(c=a);y(c)||(c=B);return new g(function(a){var e=K(b)?b:+b-c.now();return c.schedule(Wd,e,{index:0,period:d,subscriber:a})})}function Wd(b){var a=b.index,c=b.period,d=b.subscriber; d.next(a);if(!d.closed){if(-1===c)return d.complete();b.index=a+1;this.schedule(b,c)}}function Ka(){for(var b=[],a=0;ab)throw new ba;var c=2<=arguments.length; return function(d){return d.pipe(P(function(c,a){return a===b}),va(1),c?aa(a):ua(function(){return new ba}))}}function Rb(b,a){return function(c){return c.lift(new Ae(b,a,c))}}function Sb(){return function(b){return b.lift(new Be)}}function Oa(b,a){return a?function(c){return c.pipe(Oa(function(c,e){return G(b(c,e)).pipe(A(function(b,d){return a(c,b,e,d)}))}))}:function(c){return c.lift(new Ce(b))}}function Tb(b,a,c){void 0===a&&(a=Number.POSITIVE_INFINITY);a=1>(a||0)?Number.POSITIVE_INFINITY:a;return function(d){return d.lift(new De(b, a,c))}}function Ub(b){return function(a){return a.lift(new Ee(b))}}function Vb(b,a){if("function"!==typeof b)throw new TypeError("predicate is not a function");return function(c){return c.lift(new Wb(b,c,!1,a))}}function Xb(b,a){return function(c){return c.lift(new Wb(b,c,!0,a))}}function Yb(b,a){var c=2<=arguments.length;return function(d){return d.pipe(b?P(function(c,a){return b(c,a,d)}):N,va(1),c?aa(a):ua(function(){return new ja}))}}function Zb(){return function(b){return b.lift(new Fe)}}function $b(){return function(b){return b.lift(new Ge)}} function ka(b){return function(a){return 0===b?V():a.lift(new He(b))}}function ac(b,a){var c=2<=arguments.length;return function(d){return d.pipe(b?P(function(c,a){return b(c,a,d)}):N,ka(1),c?aa(a):ua(function(){return new ja}))}}function bc(b){return function(a){return a.lift(new Ie(b))}}function cc(){return function(b){return b.lift(new Je)}}function ca(b,a){return 2<=arguments.length?function(c){return Ba(Z(b,a),ka(1),aa(a))(c)}:function(c){return Ba(Z(function(c,a,f){return b(c,a,f+1)}),ka(1))(c)}} function dc(b){return ca("function"===typeof b?function(a,c){return 0c?a:c})}function ec(b,a,c){void 0===c&&(c=Number.POSITIVE_INFINITY);if("function"===typeof a)return J(function(){return b},a,c);"number"===typeof a&&(c=a);return J(function(){return b},c)}function fc(b,a,c){void 0===c&&(c=Number.POSITIVE_INFINITY);return function(d){return d.lift(new Ke(b,a,c))}}function gc(b){return ca("function"===typeof b?function(a,c){return 0>b(a,c)?a:c}:function(a,c){return a< c?a:c})}function L(b,a){return function(c){var d;d="function"===typeof b?b:function(){return b};if("function"===typeof a)return c.lift(new Le(d,a));var e=Object.create(c,Me);e.source=c;e.subjectFactory=d;return e}}function hc(){for(var b=[],a=0;ab?a.lift(new sc(-1,a)):a.lift(new sc(b-1,a))}}function tc(b){return function(a){return a.lift(new Qe(b))}}function uc(b){void 0===b&&(b=-1); return function(a){return a.lift(new Re(b,a))}}function vc(b){return function(a){return a.lift(new Se(b,a))}}function wc(b){return function(a){return a.lift(new Te(b))}}function xc(b,a){void 0===a&&(a=B);return function(c){return c.lift(new Ue(b,a))}}function Ve(b){var a=b.period;b.subscriber.notifyNext();this.schedule(b,a)}function yc(b,a){return function(c){return c.lift(new We(b,a))}}function Xe(){return new w}function zc(){return function(b){return Ca()(L(Xe)(b))}}function Pa(b,a,c){var d;d=b&& "object"===typeof b?b:{bufferSize:b,windowTime:a,refCount:!1,scheduler:c};return function(c){return c.lift(Ye(d))}}function Ye(b){var a=b.bufferSize,c=void 0===a?Number.POSITIVE_INFINITY:a,a=b.windowTime,d=void 0===a?Number.POSITIVE_INFINITY:a,e=b.refCount,f=b.scheduler,k,g=0,h,l=!1,p=!1;return function(a){g++;var b;!k||l?(l=!1,k=new da(c,d,f),b=k.subscribe(this),h=a.subscribe({next:function(c){k.next(c)},error:function(c){l=!0;k.error(c)},complete:function(){p=!0;h=void 0;k.complete()}}),p&&(h=void 0)): b=k.subscribe(this);this.add(function(){g--;b.unsubscribe();b=void 0;h&&!p&&e&&0===g&&(h.unsubscribe(),k=h=void 0)})}}function Ac(b){return function(a){return a.lift(new Ze(b,a))}}function Bc(b){return function(a){return a.lift(new $e(b))}}function Cc(b){return function(a){return a.lift(new af(b))}}function Dc(b){return function(a){return a.lift(new bf(b))}}function Ec(b){return function(a){return a.lift(new cf(b))}}function Fc(){for(var b=[],a=0;a=a?this.connection=null:(c._refCount= a-1,1=a?this.connection=null:(c._refCount=a-1,1c?1:c;d._windowTime=1>a?1:a;a===Number.POSITIVE_INFINITY?(d._infiniteTimeWindow=!0,d.next=d.nextInfiniteTimeWindow):d.next=d.nextTimeWindow;return d}h(a,b);a.prototype.nextInfiniteTimeWindow= function(c){if(!this.isStopped){var a=this._events;a.push(c);a.length>this._bufferSize&&a.shift()}b.prototype.next.call(this,c)};a.prototype.nextTimeWindow=function(c){this.isStopped||(this._events.push(new Df(this._getNow(),c)),this._trimBufferThenGetEvents());b.prototype.next.call(this,c)};a.prototype._subscribe=function(c){var a=this._infiniteTimeWindow,b=a?this._events:this._trimBufferThenGetEvents(),f=this.scheduler,k=b.length,g;if(this.closed)throw new M;this.isStopped||this.hasError?g=q.EMPTY: (this.observers.push(c),g=new fd(this,c));f&&c.add(c=new md(c,f));if(a)for(a=0;aa&&(g=Math.max(g,k-a));0< g&&f.splice(0,g);return f};return a}(w),Df=function(){return function(b,a){this.time=b;this.value=a}}(),W=function(b){function a(){var c=null!==b&&b.apply(this,arguments)||this;c.value=null;c.hasNext=!1;c.hasCompleted=!1;return c}h(a,b);a.prototype._subscribe=function(c){return this.hasError?(c.error(this.thrownError),q.EMPTY):this.hasCompleted&&this.hasNext?(c.next(this.value),c.complete(),q.EMPTY):b.prototype._subscribe.call(this,c)};a.prototype.next=function(c){this.hasCompleted||(this.value=c, this.hasNext=!0)};a.prototype.error=function(c){this.hasCompleted||b.prototype.error.call(this,c)};a.prototype.complete=function(){this.hasCompleted=!0;this.hasNext&&b.prototype.next.call(this,this.value);b.prototype.complete.call(this)};return a}(w),Ef=1,Ff=Promise.resolve(),Ea={},nd={setImmediate:function(b){var a=Ef++;Ea[a]=!0;Ff.then(function(){return bb(a)&&b()});return a},clearImmediate:function(b){bb(b)}},Gf=function(b){function a(c,a){var d=b.call(this,c,a)||this;d.scheduler=c;d.work=a;return d} h(a,b);a.prototype.requestAsyncId=function(c,a,e){void 0===e&&(e=0);if(null!==e&&0a.index?1:-1:c.delay>a.delay?1:-1};return a}(ma),ba=function(){function b(){Error.call(this); this.message="argument out of range";this.name="ArgumentOutOfRangeError";return this}b.prototype=Object.create(Error.prototype);return b}(),ja=function(){function b(){Error.call(this);this.message="no elements in sequence";this.name="EmptyError";return this}b.prototype=Object.create(Error.prototype);return b}(),Oc=function(){function b(){Error.call(this);this.message="Timeout has occurred";this.name="TimeoutError";return this}b.prototype=Object.create(Error.prototype);return b}(),Bd=function(){function b(a, c){this.project=a;this.thisArg=c}b.prototype.call=function(a,c){return c.subscribe(new Jf(a,this.project,this.thisArg))};return b}(),Jf=function(b){function a(c,a,e){c=b.call(this,c)||this;c.project=a;c.count=0;c.thisArg=e||c;return c}h(a,b);a.prototype._next=function(c){var a;try{a=this.project.call(this.thisArg,c,this.count++)}catch(e){this.destination.error(e);return}this.destination.next(a)};return a}(l),S=function(b){function a(){return null!==b&&b.apply(this,arguments)||this}h(a,b);a.prototype.notifyNext= function(c,a,b,f,k){this.destination.next(a)};a.prototype.notifyError=function(c,a){this.destination.error(c)};a.prototype.notifyComplete=function(c){this.destination.complete()};return a}(l),Gd=function(b){function a(c,a,e){var d=b.call(this)||this;d.parent=c;d.outerValue=a;d.outerIndex=e;d.index=0;return d}h(a,b);a.prototype._next=function(c){this.parent.notifyNext(this.outerValue,c,this.outerIndex,this.index++,this)};a.prototype._error=function(c){this.parent.notifyError(c,this);this.unsubscribe()}; a.prototype._complete=function(){this.parent.notifyComplete(this);this.unsubscribe()};return a}(l),Kf=function(b){return function(a){b.then(function(c){a.closed||(a.next(c),a.complete())},function(c){return a.error(c)}).then(null,U);return a}},F;F="function"===typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";var Lf=function(b){return function(a){var c=b[F]();do{var d=void 0;try{d=c.next()}catch(e){return a.error(e),a}if(d.done){a.complete();break}a.next(d.value);if(a.closed)break}while(1); "function"===typeof c.return&&a.add(function(){c.return&&c.return()});return a}},Mf=function(b){return function(a){var c=b[X]();if("function"!==typeof c.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return c.subscribe(a)}},gb=function(b){return b&&"number"===typeof b.length&&"function"!==typeof b},Fa=function(b){if(b&&"function"===typeof b[X])return Mf(b);if(gb(b))return $a(b);if(fb(b))return Kf(b);if(b&&"function"===typeof b[F])return Lf(b);b=za(b)? "an invalid object":"'"+b+"'";throw new TypeError("You provided "+b+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.");},qd={},ta=function(){function b(a){this.resultSelector=a}b.prototype.call=function(a,c){return c.subscribe(new Nf(a,this.resultSelector))};return b}(),Nf=function(b){function a(c,a){c=b.call(this,c)||this;c.resultSelector=a;c.active=0;c.values=[];c.observables=[];return c}h(a,b);a.prototype._next=function(c){this.values.push(qd);this.observables.push(c)}; a.prototype._complete=function(){var c=this.observables,a=c.length;if(0===a)this.destination.complete();else{this.toRespond=this.active=a;for(var b=0;bthis.index};b.prototype.hasCompleted=function(){return this.array.length===this.index};return b}(),Vf=function(b){function a(c,a,e){c=b.call(this,c)||this;c.parent=a;c.observable=e;c.stillUnsubscribed=!0;c.buffer=[];c.isComplete=!1;return c}h(a,b);a.prototype[F]=function(){return this};a.prototype.next=function(){var c= this.buffer;return 0===c.length&&this.isComplete?{value:null,done:!0}:{value:c.shift(),done:!1}};a.prototype.hasValue=function(){return 0d;d++)try{a=b[d];new C.ActiveXObject(a);break}catch(p){}c=new C.ActiveXObject(a)}catch(p){throw Error("XMLHttpRequest is not supported by your browser");}}return c},crossDomain:!0,withCredentials:!1,headers:{},method:"GET",responseType:"json",timeout:0}; if("string"===typeof c)e.url=c;else for(var f in c)c.hasOwnProperty(f)&&(e[f]=c[f]);a.request=e;return a}h(a,b);a.prototype._subscribe=function(c){return new Yf(c,this.request)};a.create=function(){var c=function(c){return new a(c)};c.get=Xd;c.post=Yd;c.delete=Zd;c.put=$d;c.patch=ae;c.getJSON=be;return c}();return a}(g),Yf=function(b){function a(c,a){c=b.call(this,c)||this;c.request=a;c.done=!1;var d=a.headers=a.headers||{};a.crossDomain||c.getHeader(d,"X-Requested-With")||(d["X-Requested-With"]= "XMLHttpRequest");c.getHeader(d,"Content-Type")||C.FormData&&a.body instanceof C.FormData||"undefined"===typeof a.body||(d["Content-Type"]="application/x-www-form-urlencoded; charset\x3dUTF-8");a.body=c.serializeBody(a.body,c.getHeader(a.headers,"Content-Type"));c.send();return c}h(a,b);a.prototype.next=function(c){this.done=!0;var a=this.xhr,b=this.request,f=this.destination,k;try{k=new Sa(c,a,b)}catch(v){return f.error(v)}f.next(k)};a.prototype.send=function(){var c=this.request,a=this.request, b=a.user,f=a.method,k=a.url,g=a.async,h=a.password,l=a.headers,a=a.body;try{var p=this.xhr=c.createXHR();this.setupEvents(p,c);b?p.open(f,k,g,b,h):p.open(f,k,g);g&&(p.timeout=c.timeout,p.responseType=c.responseType);"withCredentials"in p&&(p.withCredentials=!!c.withCredentials);this.setHeaders(p,l);a?p.send(a):p.send()}catch(Md){this.error(Md)}};a.prototype.serializeBody=function(c,a){if(!c||"string"===typeof c||C.FormData&&c instanceof C.FormData)return c;if(a){var b=a.indexOf(";");-1!==b&&(a=a.substring(0, b))}switch(a){case "application/x-www-form-urlencoded":return Object.keys(c).map(function(a){return encodeURIComponent(a)+"\x3d"+encodeURIComponent(c[a])}).join("\x26");case "application/json":return JSON.stringify(c);default:return c}};a.prototype.setHeaders=function(c,a){for(var b in a)a.hasOwnProperty(b)&&c.setRequestHeader(b,a[b])};a.prototype.getHeader=function(c,a){for(var b in c)if(b.toLowerCase()===a.toLowerCase())return c[b]};a.prototype.setupEvents=function(c,a){function b(c){var a=b.subscriber, d=b.progressSubscriber,e=b.request;d&&d.error(c);var f;try{f=new Ta(this,e)}catch(Ua){f=Ua}a.error(f)}function d(c){}function k(c){var a=k.subscriber,b=k.progressSubscriber,d=k.request;if(4===this.readyState){var e=1223===this.status?204:this.status,f="text"===this.responseType?this.response||this.responseText:this.response;0===e&&(e=f?200:0);if(400>e)b&&b.complete(),a.next(c),a.complete();else{b&&b.error(c);c=void 0;try{c=new na("ajax error "+e,this,d)}catch(Zf){c=Zf}a.error(c)}}}var g=a.progressSubscriber; c.ontimeout=b;b.request=a;b.subscriber=this;b.progressSubscriber=g;if(c.upload&&"withCredentials"in c){if(g){var h;h=function(c){h.progressSubscriber.next(c)};C.XDomainRequest?c.onprogress=h:c.upload.onprogress=h;h.progressSubscriber=g}var l;l=function(c){var a=l.progressSubscriber,b=l.subscriber,d=l.request;a&&a.error(c);var e;try{e=new na("ajax error",this,d)}catch(Ua){e=Ua}b.error(e)};c.onerror=l;l.request=a;l.subscriber=this;l.progressSubscriber=g}c.onreadystatechange=d;d.subscriber=this;d.progressSubscriber= g;d.request=a;c.onload=k;k.subscriber=this;k.progressSubscriber=g;k.request=a};a.prototype.unsubscribe=function(){var c=this.xhr;!this.done&&c&&4!==c.readyState&&"function"===typeof c.abort&&c.abort();b.prototype.unsubscribe.call(this)};return a}(l),Sa=function(){return function(b,a,c){this.originalEvent=b;this.xhr=a;this.request=c;this.status=a.status;this.responseType=a.responseType||c.responseType;this.response=nb(this.responseType,a)}}(),na=function(){function b(a,c,b){Error.call(this);this.message= a;this.name="AjaxError";this.xhr=c;this.request=b;this.status=c.status;this.responseType=c.responseType||b.responseType;this.response=nb(this.responseType,c);return this}b.prototype=Object.create(Error.prototype);return b}(),Ta=function(b,a){na.call(this,"ajax timeout",b,a);this.name="AjaxTimeoutError";return this},rd=Q.create,$f={url:"",deserializer:function(b){return JSON.parse(b.data)},serializer:function(b){return JSON.stringify(b)}},pb=function(b){function a(c,a){var d=b.call(this)||this;if(c instanceof g)d.destination=a,d.source=c;else{a=d._config=vf({},$f);d._output=new w;if("string"===typeof c)a.url=c;else for(var f in c)c.hasOwnProperty(f)&&(a[f]=c[f]);if(!a.WebSocketCtor&&WebSocket)a.WebSocketCtor=WebSocket;else if(!a.WebSocketCtor)throw Error("no WebSocket constructor can be found");d.destination=new da}return d}h(a,b);a.prototype.lift=function(c){var b=new a(this._config,this.destination);b.operator=c;b.source=this;return b};a.prototype._resetState=function(){this._socket=null;this.source|| (this.destination=new da);this._output=new w};a.prototype.multiplex=function(c,a,b){var d=this;return new g(function(e){try{d.next(c())}catch(n){e.error(n)}var f=d.subscribe(function(c){try{b(c)&&e.next(c)}catch(O){e.error(O)}},function(c){return e.error(c)},function(){return e.complete()});return function(){try{d.next(a())}catch(n){e.error(n)}f.unsubscribe()}})};a.prototype._connectSocket=function(){var c=this,a=this._config,b=a.WebSocketCtor,f=a.protocol,g=a.url,a=a.binaryType,h=this._output,n= null;try{this._socket=n=f?new b(g,f):new b(g),a&&(this._socket.binaryType=a)}catch(p){h.error(p);return}var m=new q(function(){c._socket=null;n&&1===n.readyState&&n.close()});n.onopen=function(a){if(c._socket){var b=c._config.openObserver;b&&b.next(a);a=c.destination;c.destination=l.create(function(a){if(1===n.readyState)try{var b=c._config.serializer;n.send(b(a))}catch(Od){c.destination.error(Od)}},function(a){var b=c._config.closingObserver;b&&b.next(void 0);a&&a.code?n.close(a.code,a.reason):h.error(new TypeError("WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }")); c._resetState()},function(){var a=c._config.closingObserver;a&&a.next(void 0);n.close();c._resetState()});a&&a instanceof da&&m.add(a.subscribe(c.destination))}else n.close(),c._resetState()};n.onerror=function(a){c._resetState();h.error(a)};n.onclose=function(a){c._resetState();var b=c._config.closeObserver;b&&b.next(a);a.wasClean?h.complete():h.error(a)};n.onmessage=function(a){try{var b=c._config.deserializer;h.next(b(a))}catch(Nd){h.error(Nd)}}};a.prototype._subscribe=function(c){var a=this,b= this.source;if(b)return b.subscribe(c);this._socket||this._connectSocket();this._output.subscribe(c);c.add(function(){var c=a._socket;0===a._output.observers.length&&(c&&1===c.readyState&&c.close(),a._resetState())});return c};a.prototype.unsubscribe=function(){var c=this._socket;c&&1===c.readyState&&c.close();this._resetState();b.prototype.unsubscribe.call(this)};return a}(xa),ag=function(b){function a(c,a,e){void 0===a&&(a=0);void 0===e&&(e=ya);var d=b.call(this)||this;d.source=c;d.delayTime=a; d.scheduler=e;if(!K(a)||0>a)d.delayTime=0;e&&"function"===typeof e.schedule||(d.scheduler=ya);return d}h(a,b);a.create=function(c,b,e){void 0===b&&(b=0);void 0===e&&(e=ya);return new a(c,b,e)};a.dispatch=function(c){return this.add(c.source.subscribe(c.subscriber))};a.prototype._subscribe=function(c){return this.scheduler.schedule(a.dispatch,this.delayTime,{source:this.source,subscriber:c})};return a}(g),rb=function(){return function(b,a){this.value=b;this.timestamp=a}}(),de=function(){function b(a, c,b){void 0===b&&(b=!1);this.accumulator=a;this.seed=c;this.hasSeed=b}b.prototype.call=function(a,c){return c.subscribe(new bg(a,this.accumulator,this.seed,this.hasSeed))};return b}(),bg=function(b){function a(c,a,e,f){c=b.call(this,c)||this;c.accumulator=a;c._seed=e;c.hasSeed=f;c.index=0;return c}h(a,b);Object.defineProperty(a.prototype,"seed",{get:function(){return this._seed},set:function(c){this.hasSeed=!0;this._seed=c},enumerable:!0,configurable:!0});a.prototype._next=function(c){if(this.hasSeed)return this._tryNext(c); this.seed=c;this.destination.next(c)};a.prototype._tryNext=function(c){var a=this.index++,b;try{b=this.accumulator(this.seed,c,a)}catch(f){this.destination.error(f)}this.seed=b;this.destination.next(b)};return a}(l),tb=function(){return function(b,a){this.value=b;this.interval=a}}(),sa={leading:!0,trailing:!1},ee=function(){function b(a,c,b){this.durationSelector=a;this.leading=c;this.trailing=b}b.prototype.call=function(a,c){return c.subscribe(new cg(a,this.durationSelector,this.leading,this.trailing))}; return b}(),cg=function(b){function a(c,a,e,f){var d=b.call(this,c)||this;d.destination=c;d.durationSelector=a;d._leading=e;d._trailing=f;d._hasValue=!1;return d}h(a,b);a.prototype._next=function(c){this._hasValue=!0;this._sendValue=c;this._throttled||(this._leading?this.send():this.throttle(c))};a.prototype.send=function(){var c=this._sendValue;this._hasValue&&(this.destination.next(c),this.throttle(c));this._hasValue=!1;this._sendValue=void 0};a.prototype.throttle=function(c){(c=this.tryDurationSelector(c))&& this.add(this._throttled=u(c,new t(this)))};a.prototype.tryDurationSelector=function(c){try{return this.durationSelector(c)}catch(d){return this.destination.error(d),null}};a.prototype.throttlingDone=function(){var c=this._throttled,a=this._trailing;c&&c.unsubscribe();this._throttled=void 0;a&&this.send()};a.prototype.notifyNext=function(){this.throttlingDone()};a.prototype.notifyComplete=function(){this.throttlingDone()};return a}(r);g.bindCallback=cb;g.bindNodeCallback=db;g.combineLatest=function(){for(var b= [],a=0;ab)b=0;a&&"function"===typeof a.schedule||(a=B);return new g(function(c){c.add(a.schedule(Qd,b,{subscriber:c,counter:0, period:b}));return c})};g.merge=Ia;g.race=kb;g.never=function(){return Pf};g.of=ia;g.onErrorResumeNext=Ja;g.pairs=function(b,a){return a?new g(function(c){var d=Object.keys(b),e=new q;e.add(a.schedule(Rd,0,{keys:d,index:0,subscriber:c,subscription:e,obj:b}));return e}):new g(function(c){for(var a=Object.keys(b),e=0;e=a){d.complete();break}d.next(f++);if(d.closed)break}while(1)})};g.using=function(b,a){return new g(function(c){var d;try{d=b()}catch(k){c.error(k);return}var e;try{e=a(d)}catch(k){c.error(k);return}var f=(e?G(e):ga).subscribe(c);return function(){f.unsubscribe();d&&d.unsubscribe()}})};g.throw=pa;g.throwError=pa;g.timer=lb;g.zip=Ka;var dg=Object.freeze({ajax:rd,AjaxResponse:Sa,AjaxError:na,AjaxTimeoutError:Ta});g.ajax= rd;var eg=Object.freeze({webSocket:ob,WebSocketSubject:pb});g.webSocket=ob;var fe=function(){function b(a){this.durationSelector=a}b.prototype.call=function(a,c){return c.subscribe(new fg(a,this.durationSelector))};return b}(),fg=function(b){function a(c,a){c=b.call(this,c)||this;c.durationSelector=a;c.hasValue=!1;return c}h(a,b);a.prototype._next=function(c){this.value=c;this.hasValue=!0;if(!this.throttled){var a=void 0;try{var b=this.durationSelector,a=b(c)}catch(f){return this.destination.error(f)}c= u(a,new t(this));!c||c.closed?this.clearThrottle():this.add(this.throttled=c)}};a.prototype.clearThrottle=function(){var c=this.value,a=this.hasValue,b=this.throttled;b&&(this.remove(b),this.throttled=void 0,b.unsubscribe());a&&(this.value=void 0,this.hasValue=!1,this.destination.next(c))};a.prototype.notifyNext=function(){this.clearThrottle()};a.prototype.notifyComplete=function(){this.clearThrottle()};return a}(r),ge=function(){function b(a){this.closingNotifier=a}b.prototype.call=function(a,c){return c.subscribe(new gg(a, this.closingNotifier))};return b}(),gg=function(b){function a(c,a){c=b.call(this,c)||this;c.buffer=[];c.add(u(a,new t(c)));return c}h(a,b);a.prototype._next=function(c){this.buffer.push(c)};a.prototype.notifyNext=function(){var c=this.buffer;this.buffer=[];this.destination.next(c)};return a}(r),he=function(){function b(a,c){this.bufferSize=a;this.subscriberClass=(this.startBufferEvery=c)&&a!==c?hg:ig}b.prototype.call=function(a,c){return c.subscribe(new this.subscriberClass(a,this.bufferSize,this.startBufferEvery))}; return b}(),ig=function(b){function a(c,a){c=b.call(this,c)||this;c.bufferSize=a;c.buffer=[];return c}h(a,b);a.prototype._next=function(c){var a=this.buffer;a.push(c);a.length==this.bufferSize&&(this.destination.next(a),this.buffer=[])};a.prototype._complete=function(){var c=this.buffer;0e;if(c.timespanOnly)c.add(f.closeAction=g.schedule(Ab,a,{subscriber:c,context:f, bufferTimeSpan:a}));else{var d={bufferTimeSpan:a,bufferCreationInterval:e,subscriber:c,scheduler:g};c.add(f.closeAction=g.schedule(Bb,a,{subscriber:c,context:f}));c.add(g.schedule(je,e,d))}return c}h(a,b);a.prototype._next=function(c){for(var a=this.contexts,b=a.length,f,g=0;g=b[0].time-f.now();)b.shift().notification.observe(g);0this.total)throw new ba;}b.prototype.call=function(a,c){return c.subscribe(new Ag(a,this.total))};return b}(),Ag=function(b){function a(a,d){a=b.call(this,a)||this;a.total=d;a.count=0;return a}h(a,b);a.prototype._next=function(a){var c= this.total,b=++this.count;b<=c&&(this.destination.next(a),b===c&&(this.destination.complete(),this.unsubscribe()))};return a}(l),Ae=function(){function b(a,c,b){this.predicate=a;this.thisArg=c;this.source=b}b.prototype.call=function(a,c){return c.subscribe(new Bg(a,this.predicate,this.thisArg,this.source))};return b}(),Bg=function(b){function a(a,d,e,f){a=b.call(this,a)||this;a.predicate=d;a.thisArg=e;a.source=f;a.index=0;a.thisArg=e||a;return a}h(a,b);a.prototype.notifyComplete=function(a){this.destination.next(a); this.destination.complete()};a.prototype._next=function(a){var c=!1;try{c=this.predicate.call(this.thisArg,a,this.index++,this.source)}catch(e){this.destination.error(e);return}c||this.notifyComplete(!1)};a.prototype._complete=function(){this.notifyComplete(!0)};return a}(l),Be=function(){function b(){}b.prototype.call=function(a,c){return c.subscribe(new Cg(a))};return b}(),Cg=function(b){function a(a){a=b.call(this,a)||this;a.hasCompleted=!1;a.hasSubscription=!1;return a}h(a,b);a.prototype._next= function(a){this.hasSubscription||(this.hasSubscription=!0,this.add(u(a,new t(this))))};a.prototype._complete=function(){this.hasCompleted=!0;this.hasSubscription||this.destination.complete()};a.prototype.notifyComplete=function(){this.hasSubscription=!1;this.hasCompleted&&this.destination.complete()};return a}(r),Ce=function(){function b(a){this.project=a}b.prototype.call=function(a,c){return c.subscribe(new Dg(a,this.project))};return b}(),Dg=function(b){function a(a,d){a=b.call(this,a)||this;a.project= d;a.hasSubscription=!1;a.hasCompleted=!1;a.index=0;return a}h(a,b);a.prototype._next=function(a){this.hasSubscription||this.tryNext(a)};a.prototype.tryNext=function(a){var c,b=this.index++;try{c=this.project(a,b)}catch(f){this.destination.error(f);return}this.hasSubscription=!0;this._innerSub(c)};a.prototype._innerSub=function(a){var c=new t(this),b=this.destination;b.add(c);a=u(a,c);a!==c&&b.add(a)};a.prototype._complete=function(){this.hasCompleted=!0;this.hasSubscription||this.destination.complete(); this.unsubscribe()};a.prototype.notifyNext=function(a){this.destination.next(a)};a.prototype.notifyError=function(a){this.destination.error(a)};a.prototype.notifyComplete=function(){this.hasSubscription=!1;this.hasCompleted&&this.destination.complete()};return a}(r),De=function(){function b(a,c,b){this.project=a;this.concurrent=c;this.scheduler=b}b.prototype.call=function(a,c){return c.subscribe(new Eg(a,this.project,this.concurrent,this.scheduler))};return b}(),Eg=function(b){function a(a,d,e,f){a= b.call(this,a)||this;a.project=d;a.concurrent=e;a.scheduler=f;a.index=0;a.active=0;a.hasCompleted=!1;ethis.total)throw new ba;}b.prototype.call=function(a,c){return c.subscribe(new Jg(a,this.total))};return b}(),Jg=function(b){function a(a,d){a=b.call(this,a)||this;a.total=d;a.ring=[];a.count=0;return a}h(a,b);a.prototype._next=function(a){var c=this.ring,b=this.total,f=this.count++;c.length=this.total?this.total:this.count,f=this.ring,g=0;gthis.total&&this.destination.next(a)};return a}(l),af=function(){function b(a){this._skipCount=a;if(0>this._skipCount)throw new ba;}b.prototype.call=function(a,c){return 0===this._skipCount?c.subscribe(new l(a)):c.subscribe(new Zg(a,this._skipCount))};return b}(),Zg=function(b){function a(a,d){a=b.call(this,a)||this;a._skipCount=d;a._count=0;a._ring=Array(d);return a}h(a,b);a.prototype._next=function(a){var c= this._skipCount,b=this._count++;if(b=this.maxWindowSize&&this.closeWindow(g))}};a.prototype._error=function(a){for(var b=this.windows;0(a||0)?Number.POSITIVE_INFINITY:a;return Tb(b,a,c)(this)};g.prototype.elementAt=function(b,a){return Qb.apply(void 0,arguments)(this)};g.prototype.filter=function(b,a){return P(b,a)(this)};g.prototype.finally=$c;g.prototype._finally=$c;g.prototype.find= function(b,a){return Vb(b,a)(this)};g.prototype.findIndex=function(b,a){return Xb(b,a)(this)};g.prototype.first=function(){for(var b=[],a=0;al?new oa(h):new oa(h,l)};a.parseMarbles=function(a,b, e,f,g){var c=this;void 0===f&&(f=!1);void 0===g&&(g=!1);if(-1!==a.indexOf("!"))throw Error('conventional marble diagrams cannot have the unsubscription marker "!"');for(var d=a.length,h=[],k=g?a.replace(/^[ ]+/,"").indexOf("^"):a.indexOf("^"),l=-1===k?0:k*-this.frameTimeFactor,m="object"!==typeof b?function(a){return a}:function(a){return f&&b[a]instanceof Va?b[a].messages:b[a]},q=-1,k=function(b){var d=l,f=function(a){d+=a*c.frameTimeFactor},k=void 0,n=a[b];switch(n){case " ":g||f(1);break;case "-":f(1); break;case "(":q=l;f(1);break;case ")":q=-1;f(1);break;case "|":k=x.createComplete();f(1);break;case "^":f(1);break;case "#":k=x.createError(e||"error");f(1);break;default:if(g&&n.match(/^[0-9]$/)&&(0===b||" "===a[b-1])){var p=a.slice(b).match(/^([0-9]+(?:\.[0-9]+)?)(ms|s|m) /);if(p){b+=p[0].length-1;var n=parseFloat(p[1]),r=void 0;switch(p[2]){case "ms":r=n;break;case "s":r=1E3*n;break;case "m":r=6E4*n}f(r/t.frameTimeFactor);break}}k=x.createNext(m(n));f(1)}k&&h.push({frame:-1