{"version":3,"sources":["./node_modules/rxjs/src/internal/util/subscribeToArray.ts","./node_modules/rxjs/src/internal/util/noop.ts","./node_modules/rxjs/src/internal/util/isNumeric.ts","./node_modules/rxjs/src/internal/util/isPromise.ts","./node_modules/rxjs/src/internal/observable/from.ts","./node_modules/zone.js/dist/zone.js","./node_modules/rxjs/src/internal/util/canReportError.ts","./node_modules/rxjs/src/internal/BehaviorSubject.ts","./node_modules/rxjs/src/internal/util/isFunction.ts","./node_modules/rxjs/src/internal/util/isArrayLike.ts","./node_modules/rxjs/src/internal/util/EmptyError.ts","./node_modules/rxjs/src/internal/Notification.ts","./node_modules/rxjs/src/internal/operators/map.ts","./node_modules/rxjs/src/internal/Observer.ts","./node_modules/rxjs/src/internal/Observable.ts","./node_modules/rxjs/src/internal/util/toSubscriber.ts","./node_modules/rxjs/src/internal/util/ObjectUnsubscribedError.ts","./node_modules/rxjs/src/internal/scheduler/AsyncScheduler.ts","./node_modules/rxjs/src/internal/util/hostReportError.ts","./node_modules/zone.js/dist/zone-patch-rxjs-fake-async.js","./node_modules/rxjs/src/internal/operators/groupBy.ts","./node_modules/rxjs/src/internal/AsyncSubject.ts","./node_modules/rxjs/src/internal/scheduler/VirtualTimeScheduler.ts","./node_modules/rxjs/src/internal/util/isObservable.ts","./node_modules/rxjs/src/internal/util/TimeoutError.ts","./node_modules/rxjs/src/internal/observable/bindCallback.ts","./node_modules/rxjs/src/internal/observable/bindNodeCallback.ts","./node_modules/rxjs/src/internal/observable/fromEventPattern.ts","./node_modules/rxjs/src/internal/observable/generate.ts","./node_modules/rxjs/src/internal/observable/onErrorResumeNext.ts","./node_modules/rxjs/src/internal/observable/pairs.ts","./node_modules/rxjs/src/internal/util/not.ts","./node_modules/rxjs/src/internal/observable/partition.ts","./node_modules/rxjs/src/internal/observable/range.ts","./node_modules/rxjs/src/internal/observable/using.ts","./node_modules/rxjs/src/internal/observable/zip.ts","./node_modules/rxjs/src/index.ts","./node_modules/rxjs/src/internal/symbol/iterator.ts","./node_modules/rxjs/src/internal/observable/of.ts","./node_modules/rxjs/src/internal/Subscriber.ts","./node_modules/rxjs/src/internal/util/subscribeTo.ts","./node_modules/rxjs/src/internal/util/subscribeToObservable.ts","./node_modules/rxjs/src/internal/util/subscribeToPromise.ts","./node_modules/rxjs/src/internal/util/subscribeToIterable.ts","./node_modules/rxjs/src/internal/observable/empty.ts","./node_modules/rxjs/src/internal/observable/never.ts","./node_modules/rxjs/src/internal/observable/fromArray.ts","./node_modules/rxjs/src/internal/scheduled/scheduleArray.ts","./node_modules/rxjs/src/internal/Subject.ts","./node_modules/rxjs/src/internal/util/Immediate.ts","./node_modules/rxjs/src/internal/scheduler/AsapAction.ts","./node_modules/rxjs/src/internal/scheduler/AsapScheduler.ts","./node_modules/rxjs/src/internal/scheduler/asap.ts","./node_modules/rxjs/src/internal/observable/ConnectableObservable.ts","./node_modules/rxjs/src/internal/symbol/rxSubscriber.ts","./node_modules/rxjs/src/internal/OuterSubscriber.ts","./node_modules/rxjs/src/internal/util/isObject.ts","./node_modules/rxjs/src/internal/operators/observeOn.ts","./node_modules/rxjs/src/internal/ReplaySubject.ts","./node_modules/rxjs/src/internal/scheduler/async.ts","./node_modules/rxjs/src/internal/observable/forkJoin.ts","./node_modules/rxjs/src/internal/operators/filter.ts","./node_modules/rxjs/src/internal/observable/race.ts","./node_modules/rxjs/src/internal/observable/throwError.ts","./node_modules/rxjs/src/internal/operators/mergeAll.ts","./node_modules/rxjs/src/internal/util/UnsubscriptionError.ts","./node_modules/rxjs/src/internal/util/ArgumentOutOfRangeError.ts","./node_modules/rxjs/src/internal/observable/fromEvent.ts","./node_modules/rxjs/src/internal/operators/concatAll.ts","./node_modules/rxjs/src/internal/observable/concat.ts","./node_modules/rxjs/src/internal/observable/combineLatest.ts","./node_modules/rxjs/src/internal/observable/timer.ts","./node_modules/rxjs/src/internal/scheduler/Action.ts","./node_modules/rxjs/src/internal/scheduler/AsyncAction.ts","./src/polyfills.ts","./node_modules/rxjs/src/internal/scheduled/scheduled.ts","./node_modules/rxjs/src/internal/util/isInteropObservable.ts","./node_modules/rxjs/src/internal/scheduled/scheduleObservable.ts","./node_modules/rxjs/src/internal/scheduled/schedulePromise.ts","./node_modules/rxjs/src/internal/util/isIterable.ts","./node_modules/rxjs/src/internal/scheduled/scheduleIterable.ts","./node_modules/rxjs/src/internal/config.ts","./node_modules/rxjs/src/internal/util/isArray.ts","./node_modules/zone.js/dist/zone-patch-rxjs.js","./node_modules/rxjs/src/internal/observable/defer.ts","./node_modules/rxjs/src/internal/util/identity.ts","./node_modules/rxjs/src/internal/observable/iif.ts","./node_modules/tslib/tslib.es6.js","./node_modules/rxjs/src/internal/util/isScheduler.ts","./node_modules/rxjs/src/internal/observable/merge.ts","./node_modules/rxjs/src/internal/operators/mergeMap.ts","./node_modules/rxjs/src/internal/Subscription.ts","./node_modules/rxjs/src/internal/InnerSubscriber.ts","./node_modules/rxjs/src/internal/Scheduler.ts","./node_modules/rxjs/src/internal/scheduler/AnimationFrameAction.ts","./node_modules/rxjs/src/internal/scheduler/AnimationFrameScheduler.ts","./node_modules/rxjs/src/internal/scheduler/animationFrame.ts","./node_modules/rxjs/src/internal/SubjectSubscription.ts","./node_modules/rxjs/src/internal/symbol/observable.ts","./node_modules/rxjs/src/internal/observable/interval.ts","./node_modules/rxjs/src/internal/util/pipe.ts","./node_modules/rxjs/src/internal/operators/refCount.ts","./node_modules/rxjs/src/internal/scheduler/QueueAction.ts","./node_modules/rxjs/src/internal/scheduler/QueueScheduler.ts","./node_modules/rxjs/src/internal/scheduler/queue.ts","./node_modules/rxjs/src/internal/util/subscribeToResult.ts"],"names":["subscriber","global","performance","mark","name","performanceMeasure","label","symbolPrefix","__symbol__","checkDuplicate","Error","Zone","parent","zoneSpec","this","_parent","_name","_properties","properties","_zoneDelegate","ZoneDelegate","assertZonePatched","patches","Object","defineProperty","get","zone","current","enumerable","configurable","_currentZoneFrame","_currentTask","__load_patch","fn","ignoreDuplicate","hasOwnProperty","perfName","_api","prototype","key","getZoneWith","fork","wrap","callback","source","_callback","intercept","runGuarded","arguments","run","applyThis","applyArgs","invoke","error","handleError","runTask","task","NO_ZONE","state","notScheduled","type","eventTask","macroTask","reEntryGuard","running","_transitionTo","scheduled","runCount","previousTask","data","isPeriodic","cancelFn","undefined","invokeTask","unknown","_updateTaskCount","scheduleTask","newZone","scheduling","zoneDelegates","_zoneDelegates","_zone","err","scheduleMicroTask","customSchedule","ZoneTask","microTask","scheduleMacroTask","customCancel","scheduleEventTask","cancelTask","canceling","count","i","length","nativeMicroTaskQueuePromise","DELEGATE_ZS","onHasTask","delegate","_","target","hasTaskState","hasTask","onScheduleTask","onInvokeTask","onCancelTask","parentDelegate","_taskCounts","_parentDelegate","_forkZS","onFork","_forkDlgt","_forkCurrZone","_interceptZS","onIntercept","_interceptDlgt","_interceptCurrZone","_invokeZS","onInvoke","_invokeDlgt","_invokeCurrZone","_handleErrorZS","onHandleError","_handleErrorDlgt","_handleErrorCurrZone","_scheduleTaskZS","_scheduleTaskDlgt","_scheduleTaskCurrZone","_invokeTaskZS","_invokeTaskDlgt","_invokeTaskCurrZone","_cancelTaskZS","_cancelTaskDlgt","_cancelTaskCurrZone","_hasTaskZS","_hasTaskDlgt","_hasTaskDlgtOwner","_hasTaskCurrZone","zoneSpecHasTask","targetZone","apply","returnTask","push","scheduleFn","value","isEmpty","counts","prev","next","change","options","_state","self","useG","call","args","_numberOfNestedTaskFrames","drainMicroTaskQueue","cancelScheduleRequest","toState","fromState1","fromState2","toString","handleId","toJSON","symbolSetTimeout","symbolPromise","symbolThen","_microTaskQueue","_isDrainingMicrotaskQueue","resolve","nativeThen","queue","onUnhandledError","microtaskDrainDone","symbol","currentZoneFrame","noop","showUncaughtError","patchEventTarget","patchOnProperties","patchMethod","bindArguments","patchThen","patchMacroTask","patchEventPrototype","isIEOrEdge","getGlobalObjects","ObjectDefineProperty","ObjectGetOwnPropertyDescriptor","ObjectCreate","ArraySlice","patchClass","wrapWithCurrentZone","filterProperties","attachOriginToPatched","_redefineProperty","patchCallbacks","window","getOwnPropertyDescriptor","ObjectGetPrototypeOf","getPrototypeOf","create","Array","slice","ZONE_SYMBOL_ADD_EVENT_LISTENER","ZONE_SYMBOL_REMOVE_EVENT_LISTENER","ZONE_SYMBOL_PREFIX","scheduleMacroTaskWithCurrentZone","zoneSymbol","isWindowExists","internalWindow","_global","NULL_ON_PROP_VALUE","isPropertyWritable","propertyDesc","writable","set","isWebWorker","WorkerGlobalScope","isNode","process","isBrowser","isMix","zoneSymbolEventNames","wrapFn","event","eventNameSymbol","result","listener","errorEvent","message","filename","lineno","colno","preventDefault","patchProperty","obj","prop","desc","onPropPatchedSymbol","originalDescGet","originalDescSet","eventName","substr","newValue","removeEventListener","addEventListener","removeAttribute","onProperties","j","originalInstanceKey","className","OriginalClass","a","instance","patchFn","proto","delegateName","patchDelegate_1","funcName","metaCreator","setNative","cbIdx","meta","patched","original","isDetectedIEOrEdge","ieOrEdge","ua","navigator","userAgent","indexOf","api","_uncaughtPromiseErrors","isDisableWrappingUncaughtPromiseRejection","e","rejection","console","stack","_loop_2","uncaughtPromiseError","shift","throwOriginal","handler","UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL","handleUnhandledRejection","isThenable","then","forwardResolution","forwardRejection","ZoneAwarePromise","reject","symbolState","symbolValue","symbolFinally","symbolParentPromiseValue","symbolParentPromiseState","makeResolver","promise","v","resolvePromise","CURRENT_TASK_TRACE_SYMBOL","wasCalled","onceWrapper","wrappedFunction","TypeError","clearRejectedNoCatch","trace","currentTask","scheduleResolveOrReject","constructor","JSON","stringify","REJECTION_HANDLED_HANDLER","splice","chainPromise","onFulfilled","onRejected","promiseState","parentPromiseValue","isFinallyPromise","executor","race","values","res","rej","onResolve","onReject","_i","values_1","all","allWithCallback","allSettled","thenCallback","status","errorCallback","reason","unresolvedCount","valueIndex","resolvedValues","_loop_3","this_1","curValueIndex","thenErr","values_2","Symbol","toStringTag","species","C","catch","finally","onFinally","NativePromise","symbolThenPatched","Ctor","originalThen","_this","resultPromise","ctor","Promise","originalFunctionToString","Function","ORIGINAL_DELEGATE_SYMBOL","PROMISE_SYMBOL","ERROR_SYMBOL","newFunctionToString","originalDelegate","nativePromise","nativeError","originalObjectToString","passiveSupported","OPTIMIZED_ZONE_EVENT_TASK_DATA","zoneSymbolEventNames$1","globalSources","EVENT_NAME_SYMBOL_REGX","RegExp","IMMEDIATE_PROPAGATION_SYMBOL","prepareEventNames","eventNameToString","falseEventName","trueEventName","symbolCapture","apis","patchOptions","ADD_EVENT_LISTENER","add","REMOVE_EVENT_LISTENER","rm","LISTENERS_EVENT_LISTENER","listeners","REMOVE_ALL_LISTENERS_EVENT_LISTENER","rmAll","zoneSymbolAddEventListener","ADD_EVENT_LISTENER_SOURCE","isRemoved","handleEvent","once","globalZoneAwareCallback","tasks","copyTasks","globalZoneAwareCaptureCallback","patchEventTargetMethods","useGlobalCallback","validateHandler","vh","chkDup","returnTarget","rt","nativePrependEventListener","taskData","nativeAddEventListener","nativeRemoveEventListener","nativeListeners","nativeRemoveAllListeners","buildEventListenerOptions","passive","capture","assign","prepend","isExisting","symbolEventNames","symbolEventName","existingTasks","allRemoved","compare","diff","typeOfDelegate","unpatchedEvents","passiveEvents","makeAddListener","nativeListener","addSource","customScheduleFn","customCancelFn","transferEventName","isHandleEvent","constructorName","targetSource","unshift","existingTask","onPropertySymbol","findEventTasks","symbolCaptureEventName","captureTasks","removeTasks","keys","match","exec","evtName","results","foundTasks","captureFalseTasks","captureTrueTasks","concat","Event","targetName","method","callbacks","nativeDelegate","opts","forEach","descriptor","zoneSymbol$1","_defineProperty","_getOwnPropertyDescriptor","_create","unconfigurablesKey","windowEventNames","mediaElementEventNames","frameEventNames","frameSetEventNames","marqueeEventNames","XMLHttpRequestEventNames","IDBIndexEventNames","websocketEventNames","workerEventNames","eventNames","ignoreProperties","tip","filter","ip","targetIgnoreProperties","op","patchFilteredProperties","propertyDescriptorPatch","supportsWebSocket","WebSocket","internalWindow_1","ignoreErrorProperties","isIE","Document","Element","HTMLElement","HTMLMediaElement","HTMLFrameSetElement","HTMLBodyElement","HTMLFrameElement","HTMLIFrameElement","HTMLMarqueeElement_1","Worker_1","XMLHttpRequest","XMLHttpRequestEventTarget","IDBIndex","IDBRequest","IDBOpenDBRequest","IDBDatabase","IDBTransaction","IDBCursor","propertyPatch","isUnconfigurable","originalConfigurableFlag","rewriteDescriptor","_tryDefineProperty","defineProperties","props","isFrozen","swallowError","descJson","log","eventTargetLegacyPatch","_a","TRUE_STR","FALSE_STR","NO_EVENT_TARGET","split","isWtf","WTF_ISSUE_555_ARRAY","map","isDisableIECheck","isEnableCrossContextCheck","BROWSER_TOOLS","pointerEventsMap","targets","apiTypes","testString","propertyDescriptorLegacyPatch","document","createElement","onclick","XMLHttpRequestPrototype","xhrDesc","req","onreadystatechange","SYMBOL_FAKE_ONREADYSTATECHANGE_1","detectFunc","canPatchViaPropertyDescriptor","unboundKey","_loop_4","property","onproperty","bound","elt","parentElement","patchViaCapturingAllTheEvents","ADD_EVENT_LISTENER_STR","REMOVE_EVENT_LISTENER_STR","WS","EventTarget","x","y","proxySocket","proxySocketProto","socket","onmessageDesc","propName","propertySymbol","globalWebSocket","SYMBOL_BLACK_LISTED_EVENTS","SYMBOL_UNPATCHED_EVENTS","registerElementPatch","taskSymbol","patchTimer","setName","cancelName","nameSuffix","clearNative","tasksByHandleId","clearTask","options_1","delay","callback_1","handle","ref","unref","bind","id","eventTargetPatch","EVENT_TARGET","legacyPatch","blockingMethods","s","patchEvent","customElements","patchCustomElements","oriAddListener","oriRemoveListener","XMLHttpRequestEventTarget_1","XMLHttpRequestEventTargetPrototype","openNative","XHR_SYNC","XHR_URL","fetchTaskAborting","fetchTaskScheduling","sendNative","url","aborted","placeholderCallback","XHR_ERROR_BEFORE_SCHEDULED","abortNative","XHR_TASK","XHR_SCHEDULED","XHR_LISTENER","newListener","readyState","DONE","loadTasks","oriInvoke_1","patchXHR","geolocation","fnNames","_loop_1","name_1","patchPrototype","findPromiseRejectionHandler","PromiseRejectionEvent","evt","destination","subscription","NotificationKind","nextOrObserver","project","observable","sink","syncErrorThrowable","subscribe","promiseCtor","active","ProxyZoneSpec","defaultSpecDelegate","_delegateSpec","propertyKeys","lastTaskState","isNeedToTriggerHasTask","setDelegate","isLoaded","assertPresent","delegateSpec","isNewDelegate","k","getDelegate","resetDelegate","tryTriggerHasTask","parentZoneDelegate","currentZone","removeFromTasks","getAndClearPendingTasksInfo","pendingTasksInfo","dataInfo","join","refCountSubscription","SchedulerAction","action","VirtualAction","resultSelector","subject","params","not","notPred","start","resource","iterators","array","buffer","destinationOrNext","isStopped","observerOrNext","context","unsubscribe","_parentSubscriber","iterator","return","activeHandles","connection","connectableProto","connectable","scheduleMessage","Notification","bufferSize","len","closed","_events","spliceCount","hasValue","predicate","observables","subscriptions","hasFirst","concurrent","sourceObj","dueTime","periodOrScheduler","scheduler","requestAsyncId","actions","sub","schedule","input","rxjs","ObservablePrototype","_subscribe","complete","ObjectDefineProperties","Observable","operator","operatorDelegate","operatorSelf","operatorArgs","_zoneSource","_zoneSubscribe","tearDown_1","zone_1","subjectFactory","_zoneSubjectFactory","factory","Subscription","_zoneUnsubscribe","_unsubscribe","_zoneUnsubscribeCleared","Subscriber","_zoneDestination","subscriptionZone","trueResult","extendStatics","d","b","setPrototypeOf","__proto__","p","__extends","__","__assign","t","n","__rest","getOwnPropertySymbols","propertyIsEnumerable","__decorate","decorators","c","r","Reflect","decorate","__metadata","metadataKey","metadataValue","metadata","__awaiter","thisArg","_arguments","P","generator","fulfilled","step","rejected","done","__generator","body","f","g","sent","trys","ops","verb","pop","__values","o","m","__read","ar","__spread","__spreadArrays","il","jl","index","_parentOrParents","subscriptionIndex","now","Scheduler","subscriberIndex","period","refCounter","refCount","sharedConnection","innerSubscriber"],"mappings":"6FAMA,kCACE,IAAK,EAAiB,SAAc,G,OAClC,SAAW,GACZ,0CACDA,EAAmB,KAAG,M,kECTxB,mC,oCCDA,kDAOE,SAAQ,EAAY,GACr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KAAKtD,EAAQhG,EAAMwc,EAAMtT,IAEnD2H,EAAI9E,sBAAsB/F,EAAOqW,GAASE,IAS9C,IAoWII,EACAC,EACAC,EACAC,EACAC,EAhQAC,EAAmB,CACnB,4BACA,aACA,aACA,eACA,sBACA,cACA,eACA,cACA,eACA,oBACA,4BACA,kBACA,aACA,iBACA,UACA,iBACA,UACA,SACA,QACA,WACA,WACA,WACA,mBACA,UACA,qBACA,SACA,gBACA,qBACA,wBACA,0BAOAC,EAAyB,CAAC,YAAa,gBAAiB,YAAa,oBAAqB,mBA6D1FC,EAAkB,CAAC,QACnBC,EAAqB,CAAC,OAAQ,QAAS,QAAS,OAAQ,SAAU,SAAU,gBAC5EC,GAAoB,CAAC,SAAU,SAAU,SACzCC,GAA2B,CAC3B,YAAa,WAAY,QAAS,QAAS,OAAQ,WAAY,UAAW,UAC1E,oBAEAC,GAAqB,CAAC,gBAAiB,WAAY,QAAS,UAAW,QAAS,UAAW,gBAAiB,SAC5GC,GAAsB,CAAC,QAAS,QAAS,OAAQ,WACjDC,GAAmB,CAAC,QAAS,WAC7BC,GApNgC,CAChC,QACA,kBACA,eACA,qBACA,WACA,cACA,OACA,SACA,UACA,iBACA,SACA,mBACA,oBACA,iBACA,YACA,QACA,QACA,cACA,aACA,WACA,OACA,UACA,YACA,WACA,YACA,WACA,OACA,iBACA,UACA,QACA,QACA,QACA,UACA,WACA,oBACA,QACA,UACA,UACA,WACA,QACA,OACA,YACA,aACA,iBACA,qBACA,YACA,aACA,aACA,YACA,WACA,YACA,UACA,aACA,oBACA,QACA,OACA,UACA,gBACA,cACA,eACA,eACA,oBACA,uBACA,4BACA,mBACA,sBACA,yBACA,cACA,WACA,cACA,YACA,WACA,aACA,QACA,SACA,SACA,SACA,UACA,SACA,kBACA,cACA,OACA,OACA,UACA,SACA,UACA,aACA,eACA,cACA,YACA,aACA,WACA,mBACA,gBACA,UACA,SAoH2CvB,OAbzB,CAAC,uBAAwB,mBAAoB,6BAC9C,CAAC,eAAg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,GAEL,EAAM,EACC,EAAO,UAAC,yBAEnB,WAAY,EACb,aAEM,2BACE,O,EAED,UAAU,QAAO,SAAQ,KAChC,wBAES,yBAAe,KAAzB,EAAyB,GAAqC,gBAAAA,I,EAK1D,UAAO,eAAM,SAAc,EAAC,KAKlC,YAJK,QAED,EAAO,GAEV,OAAD,GAAC,wE,iBAjCmC,C,aCRA,WAAc,G,aACjD,+CADmC,OAApC,SAAoC,G,aCFpC,kC,kDCCA,0EA0BE,iBAAqC,EAAgB,GAKrD,QAHoB,IAAhBsN,IACF,EAAiB,iBAEf,EAAM,OAGV,oBAAmB,IACpB,e","file":"polyfills.js","sourcesContent":["import { Subscriber } from '../Subscriber';\n\n/**\n * Subscribes to an ArrayLike with a subscriber\n * @param array The array or array-like to subscribe to\n */\nexport const subscribeToArray = (array: ArrayLike) => (subscriber: Subscriber) => {\n for (let i = 0, len = array.length; i < len && !subscriber.closed; i++) {\n subscriber.next(array[i]);\n }\n subscriber.complete();\n};\n","/* tslint:disable:no-empty */\nexport function noop() { }\n","import { isArray } from './isArray';\n\nexport function isNumeric(val: any): val is number | string {\n // parseFloat NaNs numeric-cast false positives (null|true|false|\"\")\n // ...but misinterprets leading-number strings, particularly hex literals (\"0x...\")\n // subtraction forces infinities to NaN\n // adding 1 corrects loss of precision from parseFloat (#15100)\n return !isArray(val) && (val - parseFloat(val) + 1) >= 0;\n}\n","/**\n * Tests to see if the object is an ES2015 (ES6) Promise\n * @see {@link https://www.ecma-international.org/ecma-262/6.0/#sec-promise-objects}\n * @param value the object to test\n */\nexport function isPromise(value: any): value is PromiseLike {\n return !!value && typeof (value).subscribe !== 'function' && typeof (value as any).then === 'function';\n}\n","import { Observable } from '../Observable';\nimport { subscribeTo } from '../util/subscribeTo';\nimport { ObservableInput, SchedulerLike, ObservedValueOf } from '../types';\nimport { scheduled } from '../scheduled/scheduled';\n\nexport function from>(input: O): Observable>;\n/** @deprecated use {@link scheduled} instead. */\nexport function from>(input: O, scheduler: SchedulerLike): Observable>;\n\n/**\n * Creates an Observable from an Array, an array-like object, a Promise, an iterable object, or an Observable-like object.\n *\n * Converts almost anything to an Observable.\n *\n * ![](from.png)\n *\n * `from` converts various other objects and data types into Observables. It also converts a Promise, an array-like, or an\n * iterable\n * object into an Observable that emits the items in that promise, array, or iterable. A String, in this context, is treated\n * as an array of characters. Observable-like objects (contains a function named with the ES2015 Symbol for Observable) can also be\n * converted through this operator.\n *\n * ## Examples\n *\n * ### Converts an array to an Observable\n *\n * ```ts\n * import { from } from 'rxjs';\n *\n * const array = [10, 20, 30];\n * const result = from(array);\n *\n * result.subscribe(x => console.log(x));\n *\n * // Logs:\n * // 10\n * // 20\n * // 30\n * ```\n *\n * ---\n *\n * ### Convert an infinite iterable (from a generator) to an Observable\n *\n * ```ts\n * import { from } from 'rxjs';\n * import { take } from 'rxjs/operators';\n *\n * function* generateDoubles(seed) {\n * let i = seed;\n * while (true) {\n * yield i;\n * i = 2 * i; // double it\n * }\n * }\n *\n * const iterator = generateDoubles(3);\n * const result = from(iterator).pipe(take(10));\n *\n * result.subscribe(x => console.log(x));\n *\n * // Logs:\n * // 3\n * // 6\n * // 12\n * // 24\n * // 48\n * // 96\n * // 192\n * // 384\n * // 768\n * // 1536\n * ```\n *\n * ---\n *\n * ### With async scheduler\n *\n * ```ts\n * import { from, asyncScheduler } from 'rxjs';\n *\n * console.log('start');\n *\n * const array = [10, 20, 30];\n * const result = from(array, asyncScheduler);\n *\n * result.subscribe(x => console.log(x));\n *\n * console.log('end');\n *\n * // Logs:\n * // start\n * // end\n * // 10\n * // 20\n * // 30\n * ```\n *\n * @see {@link fromEvent}\n * @see {@link fromEventPattern}\n *\n * @param {ObservableInput} A subscription object, a Promise, an Observable-like,\n * an Array, an iterable, or an array-like object to be converted.\n * @param {SchedulerLike} An optional {@link SchedulerLike} on which to schedule the emission of values.\n * @return {Observable}\n * @name from\n * @owner Observable\n */\nexport function from(input: ObservableInput, scheduler?: SchedulerLike): Observable {\n if (!scheduler) {\n if (input instanceof Observable) {\n return input;\n }\n return new Observable(subscribeTo(input));\n } else {\n return scheduled(input, scheduler);\n }\n}\n","'use strict';\n/**\n * @license Angular v12.0.0-next.0\n * (c) 2010-2020 Google LLC. https://angular.io/\n * License: MIT\n */\n(function (factory) {\n typeof define === 'function' && define.amd ? define(factory) :\n factory();\n}((function () {\n 'use strict';\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n var Zone$1 = (function (global) {\n var performance = global['performance'];\n function mark(name) {\n performance && performance['mark'] && performance['mark'](name);\n }\n function performanceMeasure(name, label) {\n performance && performance['measure'] && performance['measure'](name, label);\n }\n mark('Zone');\n // Initialize before it's accessed below.\n // __Zone_symbol_prefix global can be used to override the default zone\n // symbol prefix with a custom one if needed.\n var symbolPrefix = global['__Zone_symbol_prefix'] || '__zone_symbol__';\n function __symbol__(name) {\n return symbolPrefix + name;\n }\n var checkDuplicate = global[__symbol__('forceDuplicateZoneCheck')] === true;\n if (global['Zone']) {\n // if global['Zone'] already exists (maybe zone.js was already loaded or\n // some other lib also registered a global object named Zone), we may need\n // to throw an error, but sometimes user may not want this error.\n // For example,\n // we have two web pages, page1 includes zone.js, page2 doesn't.\n // and the 1st time user load page1 and page2, everything work fine,\n // but when user load page2 again, error occurs because global['Zone'] already exists.\n // so we add a flag to let user choose whether to throw this error or not.\n // By default, if existing Zone is from zone.js, we will not throw the error.\n if (checkDuplicate || typeof global['Zone'].__symbol__ !== 'function') {\n throw new Error('Zone already loaded.');\n }\n else {\n return global['Zone'];\n }\n }\n var Zone = /** @class */ (function () {\n function Zone(parent, zoneSpec) {\n this._parent = parent;\n this._name = zoneSpec ? zoneSpec.name || 'unnamed' : '';\n this._properties = zoneSpec && zoneSpec.properties || {};\n this._zoneDelegate =\n new ZoneDelegate(this, this._parent && this._parent._zoneDelegate, zoneSpec);\n }\n Zone.assertZonePatched = function () {\n if (global['Promise'] !== patches['ZoneAwarePromise']) {\n throw new Error('Zone.js has detected that ZoneAwarePromise `(window|global).Promise` ' +\n 'has been overwritten.\\n' +\n 'Most likely cause is that a Promise polyfill has been loaded ' +\n 'after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. ' +\n 'If you must load one, do so before loading zone.js.)');\n }\n };\n Object.defineProperty(Zone, \"root\", {\n get: function () {\n var zone = Zone.current;\n while (zone.parent) {\n zone = zone.parent;\n }\n return zone;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Zone, \"current\", {\n get: function () {\n return _currentZoneFrame.zone;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Zone, \"currentTask\", {\n get: function () {\n return _currentTask;\n },\n enumerable: false,\n configurable: true\n });\n // tslint:disable-next-line:require-internal-with-underscore\n Zone.__load_patch = function (name, fn, ignoreDuplicate) {\n if (ignoreDuplicate === void 0) { ignoreDuplicate = false; }\n if (patches.hasOwnProperty(name)) {\n // `checkDuplicate` option is defined from global variable\n // so it works for all modules.\n // `ignoreDuplicate` can work for the specified module\n if (!ignoreDuplicate && checkDuplicate) {\n throw Error('Already loaded patch: ' + name);\n }\n }\n else if (!global['__Zone_disable_' + name]) {\n var perfName = 'Zone:' + name;\n mark(perfName);\n patches[name] = fn(global, Zone, _api);\n performanceMeasure(perfName, perfName);\n }\n };\n Object.defineProperty(Zone.prototype, \"parent\", {\n get: function () {\n return this._parent;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Zone.prototype, \"name\", {\n get: function () {\n return this._name;\n },\n enumerable: false,\n configurable: true\n });\n Zone.prototype.get = function (key) {\n var zone = this.getZoneWith(key);\n if (zone)\n return zone._properties[key];\n };\n Zone.prototype.getZoneWith = function (key) {\n var current = this;\n while (current) {\n if (current._properties.hasOwnProperty(key)) {\n return current;\n }\n current = current._parent;\n }\n return null;\n };\n Zone.prototype.fork = function (zoneSpec) {\n if (!zoneSpec)\n throw new Error('ZoneSpec required!');\n return this._zoneDelegate.fork(this, zoneSpec);\n };\n Zone.prototype.wrap = function (callback, source) {\n if (typeof callback !== 'function') {\n throw new Error('Expecting function got: ' + callback);\n }\n var _callback = this._zoneDelegate.intercept(this, callback, source);\n var zone = this;\n return function () {\n return zone.runGuarded(_callback, this, arguments, source);\n };\n };\n Zone.prototype.run = function (callback, applyThis, applyArgs, source) {\n _currentZoneFrame = { parent: _currentZoneFrame, zone: this };\n try {\n return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);\n }\n finally {\n _currentZoneFrame = _currentZoneFrame.parent;\n }\n };\n Zone.prototype.runGuarded = function (callback, applyThis, applyArgs, source) {\n if (applyThis === void 0) { applyThis = null; }\n _currentZoneFrame = { parent: _currentZoneFrame, zone: this };\n try {\n try {\n return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);\n }\n catch (error) {\n if (this._zoneDelegate.handleError(this, error)) {\n throw error;\n }\n }\n }\n finally {\n _currentZoneFrame = _currentZoneFrame.parent;\n }\n };\n Zone.prototype.runTask = function (task, applyThis, applyArgs) {\n if (task.zone != this) {\n throw new Error('A task can only be run in the zone of creation! (Creation: ' +\n (task.zone || NO_ZONE).name + '; Execution: ' + this.name + ')');\n }\n // https://github.com/angular/zone.js/issues/778, sometimes eventTask\n // will run in notScheduled(canceled) state, we should not try to\n // run such kind of task but just return\n if (task.state === notScheduled && (task.type === eventTask || task.type === macroTask)) {\n return;\n }\n var reEntryGuard = task.state != running;\n reEntryGuard && task._transitionTo(running, scheduled);\n task.runCount++;\n var previousTask = _currentTask;\n _currentTask = task;\n _currentZoneFrame = { parent: _currentZoneFrame, zone: this };\n try {\n if (task.type == macroTask && task.data && !task.data.isPeriodic) {\n task.cancelFn = undefined;\n }\n try {\n return this._zoneDelegate.invokeTask(this, task, applyThis, applyArgs);\n }\n catch (error) {\n if (this._zoneDelegate.handleError(this, error)) {\n throw error;\n }\n }\n }\n finally {\n // if the task's state is notScheduled or unknown, then it has already been cancelled\n // we should not reset the state to scheduled\n if (task.state !== notScheduled && task.state !== unknown) {\n if (task.type == eventTask || (task.data && task.data.isPeriodic)) {\n reEntryGuard && task._transitionTo(scheduled, running);\n }\n else {\n task.runCount = 0;\n this._updateTaskCount(task, -1);\n reEntryGuard &&\n task._transitionTo(notScheduled, running, notScheduled);\n }\n }\n _currentZoneFrame = _currentZoneFrame.parent;\n _currentTask = previousTask;\n }\n };\n Zone.prototype.scheduleTask = function (task) {\n if (task.zone && task.zone !== this) {\n // check if the task was rescheduled, the newZone\n // should not be the children of the original zone\n var newZone = this;\n while (newZone) {\n if (newZone === task.zone) {\n throw Error(\"can not reschedule task to \" + this.name + \" which is descendants of the original zone \" + task.zone.name);\n }\n newZone = newZone.parent;\n }\n }\n task._transitionTo(scheduling, notScheduled);\n var zoneDelegates = [];\n task._zoneDelegates = zoneDelegates;\n task._zone = this;\n try {\n task = this._zoneDelegate.scheduleTask(this, task);\n }\n catch (err) {\n // should set task's state to unknown when scheduleTask throw error\n // because the err may from reschedule, so the fromState maybe notScheduled\n task._transitionTo(unknown, scheduling, notScheduled);\n // TODO: @JiaLiPassion, should we check the result from handleError?\n this._zoneDelegate.handleError(this, err);\n throw err;\n }\n if (task._zoneDelegates === zoneDelegates) {\n // we have to check because internally the delegate can reschedule the task.\n this._updateTaskCount(task, 1);\n }\n if (task.state == scheduling) {\n task._transitionTo(scheduled, scheduling);\n }\n return task;\n };\n Zone.prototype.scheduleMicroTask = function (source, callback, data, customSchedule) {\n return this.scheduleTask(new ZoneTask(microTask, source, callback, data, customSchedule, undefined));\n };\n Zone.prototype.scheduleMacroTask = function (source, callback, data, customSchedule, customCancel) {\n return this.scheduleTask(new ZoneTask(macroTask, source, callback, data, customSchedule, customCancel));\n };\n Zone.prototype.scheduleEventTask = function (source, callback, data, customSchedule, customCancel) {\n return this.scheduleTask(new ZoneTask(eventTask, source, callback, data, customSchedule, customCancel));\n };\n Zone.prototype.cancelTask = function (task) {\n if (task.zone != this)\n throw new Error('A task can only be cancelled in the zone of creation! (Creation: ' +\n (task.zone || NO_ZONE).name + '; Execution: ' + this.name + ')');\n task._transitionTo(canceling, scheduled, running);\n try {\n this._zoneDelegate.cancelTask(this, task);\n }\n catch (err) {\n // if error occurs when cancelTask, transit the state to unknown\n task._transitionTo(unknown, canceling);\n this._zoneDelegate.handleError(this, err);\n throw err;\n }\n this._updateTaskCount(task, -1);\n task._transitionTo(notScheduled, canceling);\n task.runCount = 0;\n return task;\n };\n Zone.prototype._updateTaskCount = function (task, count) {\n var zoneDelegates = task._zoneDelegates;\n if (count == -1) {\n task._zoneDelegates = null;\n }\n for (var i = 0; i < zoneDelegates.length; i++) {\n zoneDelegates[i]._updateTaskCount(task.type, count);\n }\n };\n return Zone;\n }());\n // tslint:disable-next-line:require-internal-with-underscore\n Zone.__symbol__ = __symbol__;\n var DELEGATE_ZS = {\n name: '',\n onHasTask: function (delegate, _, target, hasTaskState) { return delegate.hasTask(target, hasTaskState); },\n onScheduleTask: function (delegate, _, target, task) { return delegate.scheduleTask(target, task); },\n onInvokeTask: function (delegate, _, target, task, applyThis, applyArgs) { return delegate.invokeTask(target, task, applyThis, applyArgs); },\n onCancelTask: function (delegate, _, target, task) { return delegate.cancelTask(target, task); }\n };\n var ZoneDelegate = /** @class */ (function () {\n function ZoneDelegate(zone, parentDelegate, zoneSpec) {\n this._taskCounts = { 'microTask': 0, 'macroTask': 0, 'eventTask': 0 };\n this.zone = zone;\n this._parentDelegate = parentDelegate;\n this._forkZS = zoneSpec && (zoneSpec && zoneSpec.onFork ? zoneSpec : parentDelegate._forkZS);\n this._forkDlgt = zoneSpec && (zoneSpec.onFork ? parentDelegate : parentDelegate._forkDlgt);\n this._forkCurrZone =\n zoneSpec && (zoneSpec.onFork ? this.zone : parentDelegate._forkCurrZone);\n this._interceptZS =\n zoneSpec && (zoneSpec.onIntercept ? zoneSpec : parentDelegate._interceptZS);\n this._interceptDlgt =\n zoneSpec && (zoneSpec.onIntercept ? parentDelegate : parentDelegate._interceptDlgt);\n this._interceptCurrZone =\n zoneSpec && (zoneSpec.onIntercept ? this.zone : parentDelegate._interceptCurrZone);\n this._invokeZS = zoneSpec && (zoneSpec.onInvoke ? zoneSpec : parentDelegate._invokeZS);\n this._invokeDlgt =\n zoneSpec && (zoneSpec.onInvoke ? parentDelegate : parentDelegate._invokeDlgt);\n this._invokeCurrZone =\n zoneSpec && (zoneSpec.onInvoke ? this.zone : parentDelegate._invokeCurrZone);\n this._handleErrorZS =\n zoneSpec && (zoneSpec.onHandleError ? zoneSpec : parentDelegate._handleErrorZS);\n this._handleErrorDlgt =\n zoneSpec && (zoneSpec.onHandleError ? parentDelegate : parentDelegate._handleErrorDlgt);\n this._handleErrorCurrZone =\n zoneSpec && (zoneSpec.onHandleError ? this.zone : parentDelegate._handleErrorCurrZone);\n this._scheduleTaskZS =\n zoneSpec && (zoneSpec.onScheduleTask ? zoneSpec : parentDelegate._scheduleTaskZS);\n this._scheduleTaskDlgt = zoneSpec &&\n (zoneSpec.onScheduleTask ? parentDelegate : parentDelegate._scheduleTaskDlgt);\n this._scheduleTaskCurrZone =\n zoneSpec && (zoneSpec.onScheduleTask ? this.zone : parentDelegate._scheduleTaskCurrZone);\n this._invokeTaskZS =\n zoneSpec && (zoneSpec.onInvokeTask ? zoneSpec : parentDelegate._invokeTaskZS);\n this._invokeTaskDlgt =\n zoneSpec && (zoneSpec.onInvokeTask ? parentDelegate : parentDelegate._invokeTaskDlgt);\n this._invokeTaskCurrZone =\n zoneSpec && (zoneSpec.onInvokeTask ? this.zone : parentDelegate._invokeTaskCurrZone);\n this._cancelTaskZS =\n zoneSpec && (zoneSpec.onCancelTask ? zoneSpec : parentDelegate._cancelTaskZS);\n this._cancelTaskDlgt =\n zoneSpec && (zoneSpec.onCancelTask ? parentDelegate : parentDelegate._cancelTaskDlgt);\n this._cancelTaskCurrZone =\n zoneSpec && (zoneSpec.onCancelTask ? this.zone : parentDelegate._cancelTaskCurrZone);\n this._hasTaskZS = null;\n this._hasTaskDlgt = null;\n this._hasTaskDlgtOwner = null;\n this._hasTaskCurrZone = null;\n var zoneSpecHasTask = zoneSpec && zoneSpec.onHasTask;\n var parentHasTask = parentDelegate && parentDelegate._hasTaskZS;\n if (zoneSpecHasTask || parentHasTask) {\n // If we need to report hasTask, than this ZS needs to do ref counting on tasks. In such\n // a case all task related interceptors must go through this ZD. We can't short circuit it.\n this._hasTaskZS = zoneSpecHasTask ? zoneSpec : DELEGATE_ZS;\n this._hasTaskDlgt = parentDelegate;\n this._hasTaskDlgtOwner = this;\n this._hasTaskCurrZone = zone;\n if (!zoneSpec.onScheduleTask) {\n this._scheduleTaskZS = DELEGATE_ZS;\n this._scheduleTaskDlgt = parentDelegate;\n this._scheduleTaskCurrZone = this.zone;\n }\n if (!zoneSpec.onInvokeTask) {\n this._invokeTaskZS = DELEGATE_ZS;\n this._invokeTaskDlgt = parentDelegate;\n this._invokeTaskCurrZone = this.zone;\n }\n if (!zoneSpec.onCancelTask) {\n this._cancelTaskZS = DELEGATE_ZS;\n this._cancelTaskDlgt = parentDelegate;\n this._cancelTaskCurrZone = this.zone;\n }\n }\n }\n ZoneDelegate.prototype.fork = function (targetZone, zoneSpec) {\n return this._forkZS ? this._forkZS.onFork(this._forkDlgt, this.zone, targetZone, zoneSpec) :\n new Zone(targetZone, zoneSpec);\n };\n ZoneDelegate.prototype.intercept = function (targetZone, callback, source) {\n return this._interceptZS ?\n this._interceptZS.onIntercept(this._interceptDlgt, this._interceptCurrZone, targetZone, callback, source) :\n callback;\n };\n ZoneDelegate.prototype.invoke = function (targetZone, callback, applyThis, applyArgs, source) {\n return this._invokeZS ? this._invokeZS.onInvoke(this._invokeDlgt, this._invokeCurrZone, targetZone, callback, applyThis, applyArgs, source) :\n callback.apply(applyThis, applyArgs);\n };\n ZoneDelegate.prototype.handleError = function (targetZone, error) {\n return this._handleErrorZS ?\n this._handleErrorZS.onHandleError(this._handleErrorDlgt, this._handleErrorCurrZone, targetZone, error) :\n true;\n };\n ZoneDelegate.prototype.scheduleTask = function (targetZone, task) {\n var returnTask = task;\n if (this._scheduleTaskZS) {\n if (this._hasTaskZS) {\n returnTask._zoneDelegates.push(this._hasTaskDlgtOwner);\n }\n // clang-format off\n returnTask = this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt, this._scheduleTaskCurrZone, targetZone, task);\n // clang-format on\n if (!returnTask)\n returnTask = task;\n }\n else {\n if (task.scheduleFn) {\n task.scheduleFn(task);\n }\n else if (task.type == microTask) {\n scheduleMicroTask(task);\n }\n else {\n throw new Error('Task is missing scheduleFn.');\n }\n }\n return returnTask;\n };\n ZoneDelegate.prototype.invokeTask = function (targetZone, task, applyThis, applyArgs) {\n return this._invokeTaskZS ? this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this._invokeTaskCurrZone, targetZone, task, applyThis, applyArgs) :\n task.callback.apply(applyThis, applyArgs);\n };\n ZoneDelegate.prototype.cancelTask = function (targetZone, task) {\n var value;\n if (this._cancelTaskZS) {\n value = this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt, this._cancelTaskCurrZone, targetZone, task);\n }\n else {\n if (!task.cancelFn) {\n throw Error('Task is not cancelable');\n }\n value = task.cancelFn(task);\n }\n return value;\n };\n ZoneDelegate.prototype.hasTask = function (targetZone, isEmpty) {\n // hasTask should not throw error so other ZoneDelegate\n // can still trigger hasTask callback\n try {\n this._hasTaskZS &&\n this._hasTaskZS.onHasTask(this._hasTaskDlgt, this._hasTaskCurrZone, targetZone, isEmpty);\n }\n catch (err) {\n this.handleError(targetZone, err);\n }\n };\n // tslint:disable-next-line:require-internal-with-underscore\n ZoneDelegate.prototype._updateTaskCount = function (type, count) {\n var counts = this._taskCounts;\n var prev = counts[type];\n var next = counts[type] = prev + count;\n if (next < 0) {\n throw new Error('More tasks executed then were scheduled.');\n }\n if (prev == 0 || next == 0) {\n var isEmpty = {\n microTask: counts['microTask'] > 0,\n macroTask: counts['macroTask'] > 0,\n eventTask: counts['eventTask'] > 0,\n change: type\n };\n this.hasTask(this.zone, isEmpty);\n }\n };\n return ZoneDelegate;\n }());\n var ZoneTask = /** @class */ (function () {\n function ZoneTask(type, source, callback, options, scheduleFn, cancelFn) {\n // tslint:disable-next-line:require-internal-with-underscore\n this._zone = null;\n this.runCount = 0;\n // tslint:disable-next-line:require-internal-with-underscore\n this._zoneDelegates = null;\n // tslint:disable-next-line:require-internal-with-underscore\n this._state = 'notScheduled';\n this.type = type;\n this.source = source;\n this.data = options;\n this.scheduleFn = scheduleFn;\n this.cancelFn = cancelFn;\n if (!callback) {\n throw new Error('callback is not defined');\n }\n this.callback = callback;\n var self = this;\n // TODO: @JiaLiPassion options should have interface\n if (type === eventTask && options && options.useG) {\n this.invoke = ZoneTask.invokeTask;\n }\n else {\n this.invoke = function () {\n return ZoneTask.invokeTask.call(global, self, this, arguments);\n };\n }\n }\n ZoneTask.invokeTask = function (task, target, args) {\n if (!task) {\n task = this;\n }\n _numberOfNestedTaskFrames++;\n try {\n task.runCount++;\n return task.zone.runTask(task, target, args);\n }\n finally {\n if (_numberOfNestedTaskFrames == 1) {\n drainMicroTaskQueue();\n }\n _numberOfNestedTaskFrames--;\n }\n };\n Object.defineProperty(ZoneTask.prototype, \"zone\", {\n get: function () {\n return this._zone;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ZoneTask.prototype, \"state\", {\n get: function () {\n return this._state;\n },\n enumerable: false,\n configurable: true\n });\n ZoneTask.prototype.cancelScheduleRequest = function () {\n this._transitionTo(notScheduled, scheduling);\n };\n // tslint:disable-next-line:require-internal-with-underscore\n ZoneTask.prototype._transitionTo = function (toState, fromState1, fromState2) {\n if (this._state === fromState1 || this._state === fromState2) {\n this._state = toState;\n if (toState == notScheduled) {\n this._zoneDelegates = null;\n }\n }\n else {\n throw new Error(this.type + \" '\" + this.source + \"': can not transition to '\" + toState + \"', expecting state '\" + fromState1 + \"'\" + (fromState2 ? ' or \\'' + fromState2 + '\\'' : '') + \", was '\" + this._state + \"'.\");\n }\n };\n ZoneTask.prototype.toString = function () {\n if (this.data && typeof this.data.handleId !== 'undefined') {\n return this.data.handleId.toString();\n }\n else {\n return Object.prototype.toString.call(this);\n }\n };\n // add toJSON method to prevent cyclic error when\n // call JSON.stringify(zoneTask)\n ZoneTask.prototype.toJSON = function () {\n return {\n type: this.type,\n state: this.state,\n source: this.source,\n zone: this.zone.name,\n runCount: this.runCount\n };\n };\n return ZoneTask;\n }());\n //////////////////////////////////////////////////////\n //////////////////////////////////////////////////////\n /// MICROTASK QUEUE\n //////////////////////////////////////////////////////\n //////////////////////////////////////////////////////\n var symbolSetTimeout = __symbol__('setTimeout');\n var symbolPromise = __symbol__('Promise');\n var symbolThen = __symbol__('then');\n var _microTaskQueue = [];\n var _isDrainingMicrotaskQueue = false;\n var nativeMicroTaskQueuePromise;\n function scheduleMicroTask(task) {\n // if we are not running in any task, and there has not been anything scheduled\n // we must bootstrap the initial task creation by manually scheduling the drain\n if (_numberOfNestedTaskFrames === 0 && _microTaskQueue.length === 0) {\n // We are not running in Task, so we need to kickstart the microtask queue.\n if (!nativeMicroTaskQueuePromise) {\n if (global[symbolPromise]) {\n nativeMicroTaskQueuePromise = global[symbolPromise].resolve(0);\n }\n }\n if (nativeMicroTaskQueuePromise) {\n var nativeThen = nativeMicroTaskQueuePromise[symbolThen];\n if (!nativeThen) {\n // native Promise is not patchable, we need to use `then` directly\n // issue 1078\n nativeThen = nativeMicroTaskQueuePromise['then'];\n }\n nativeThen.call(nativeMicroTaskQueuePromise, drainMicroTaskQueue);\n }\n else {\n global[symbolSetTimeout](drainMicroTaskQueue, 0);\n }\n }\n task && _microTaskQueue.push(task);\n }\n function drainMicroTaskQueue() {\n if (!_isDrainingMicrotaskQueue) {\n _isDrainingMicrotaskQueue = true;\n while (_microTaskQueue.length) {\n var queue = _microTaskQueue;\n _microTaskQueue = [];\n for (var i = 0; i < queue.length; i++) {\n var task = queue[i];\n try {\n task.zone.runTask(task, null, null);\n }\n catch (error) {\n _api.onUnhandledError(error);\n }\n }\n }\n _api.microtaskDrainDone();\n _isDrainingMicrotaskQueue = false;\n }\n }\n //////////////////////////////////////////////////////\n //////////////////////////////////////////////////////\n /// BOOTSTRAP\n //////////////////////////////////////////////////////\n //////////////////////////////////////////////////////\n var NO_ZONE = { name: 'NO ZONE' };\n var notScheduled = 'notScheduled', scheduling = 'scheduling', scheduled = 'scheduled', running = 'running', canceling = 'canceling', unknown = 'unknown';\n var microTask = 'microTask', macroTask = 'macroTask', eventTask = 'eventTask';\n var patches = {};\n var _api = {\n symbol: __symbol__,\n currentZoneFrame: function () { return _currentZoneFrame; },\n onUnhandledError: noop,\n microtaskDrainDone: noop,\n scheduleMicroTask: scheduleMicroTask,\n showUncaughtError: function () { return !Zone[__symbol__('ignoreConsoleErrorUncaughtError')]; },\n patchEventTarget: function () { return []; },\n patchOnProperties: noop,\n patchMethod: function () { return noop; },\n bindArguments: function () { return []; },\n patchThen: function () { return noop; },\n patchMacroTask: function () { return noop; },\n patchEventPrototype: function () { return noop; },\n isIEOrEdge: function () { return false; },\n getGlobalObjects: function () { return undefined; },\n ObjectDefineProperty: function () { return noop; },\n ObjectGetOwnPropertyDescriptor: function () { return undefined; },\n ObjectCreate: function () { return undefined; },\n ArraySlice: function () { return []; },\n patchClass: function () { return noop; },\n wrapWithCurrentZone: function () { return noop; },\n filterProperties: function () { return []; },\n attachOriginToPatched: function () { return noop; },\n _redefineProperty: function () { return noop; },\n patchCallbacks: function () { return noop; }\n };\n var _currentZoneFrame = { parent: null, zone: new Zone(null, null) };\n var _currentTask = null;\n var _numberOfNestedTaskFrames = 0;\n function noop() { }\n performanceMeasure('Zone', 'Zone');\n return global['Zone'] = Zone;\n })(typeof window !== 'undefined' && window || typeof self !== 'undefined' && self || global);\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n /**\n * Suppress closure compiler errors about unknown 'Zone' variable\n * @fileoverview\n * @suppress {undefinedVars,globalThis,missingRequire}\n */\n /// \n // issue #989, to reduce bundle size, use short name\n /** Object.getOwnPropertyDescriptor */\n var ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n /** Object.defineProperty */\n var ObjectDefineProperty = Object.defineProperty;\n /** Object.getPrototypeOf */\n var ObjectGetPrototypeOf = Object.getPrototypeOf;\n /** Object.create */\n var ObjectCreate = Object.create;\n /** Array.prototype.slice */\n var ArraySlice = Array.prototype.slice;\n /** addEventListener string const */\n var ADD_EVENT_LISTENER_STR = 'addEventListener';\n /** removeEventListener string const */\n var REMOVE_EVENT_LISTENER_STR = 'removeEventListener';\n /** zoneSymbol addEventListener */\n var ZONE_SYMBOL_ADD_EVENT_LISTENER = Zone.__symbol__(ADD_EVENT_LISTENER_STR);\n /** zoneSymbol removeEventListener */\n var ZONE_SYMBOL_REMOVE_EVENT_LISTENER = Zone.__symbol__(REMOVE_EVENT_LISTENER_STR);\n /** true string const */\n var TRUE_STR = 'true';\n /** false string const */\n var FALSE_STR = 'false';\n /** Zone symbol prefix string const. */\n var ZONE_SYMBOL_PREFIX = Zone.__symbol__('');\n function wrapWithCurrentZone(callback, source) {\n return Zone.current.wrap(callback, source);\n }\n function scheduleMacroTaskWithCurrentZone(source, callback, data, customSchedule, customCancel) {\n return Zone.current.scheduleMacroTask(source, callback, data, customSchedule, customCancel);\n }\n var zoneSymbol = Zone.__symbol__;\n var isWindowExists = typeof window !== 'undefined';\n var internalWindow = isWindowExists ? window : undefined;\n var _global = isWindowExists && internalWindow || typeof self === 'object' && self || global;\n var REMOVE_ATTRIBUTE = 'removeAttribute';\n var NULL_ON_PROP_VALUE = [null];\n function bindArguments(args, source) {\n for (var i = args.length - 1; i >= 0; i--) {\n if (typeof args[i] === 'function') {\n args[i] = wrapWithCurrentZone(args[i], source + '_' + i);\n }\n }\n return args;\n }\n function patchPrototype(prototype, fnNames) {\n var source = prototype.constructor['name'];\n var _loop_1 = function (i) {\n var name_1 = fnNames[i];\n var delegate = prototype[name_1];\n if (delegate) {\n var prototypeDesc = ObjectGetOwnPropertyDescriptor(prototype, name_1);\n if (!isPropertyWritable(prototypeDesc)) {\n return \"continue\";\n }\n prototype[name_1] = (function (delegate) {\n var patched = function () {\n return delegate.apply(this, bindArguments(arguments, source + '.' + name_1));\n };\n attachOriginToPatched(patched, delegate);\n return patched;\n })(delegate);\n }\n };\n for (var i = 0; i < fnNames.length; i++) {\n _loop_1(i);\n }\n }\n function isPropertyWritable(propertyDesc) {\n if (!propertyDesc) {\n return true;\n }\n if (propertyDesc.writable === false) {\n return false;\n }\n return !(typeof propertyDesc.get === 'function' && typeof propertyDesc.set === 'undefined');\n }\n var isWebWorker = (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope);\n // Make sure to access `process` through `_global` so that WebPack does not accidentally browserify\n // this code.\n var isNode = (!('nw' in _global) && typeof _global.process !== 'undefined' &&\n {}.toString.call(_global.process) === '[object process]');\n var isBrowser = !isNode && !isWebWorker && !!(isWindowExists && internalWindow['HTMLElement']);\n // we are in electron of nw, so we are both browser and nodejs\n // Make sure to access `process` through `_global` so that WebPack does not accidentally browserify\n // this code.\n var isMix = typeof _global.process !== 'undefined' &&\n {}.toString.call(_global.process) === '[object process]' && !isWebWorker &&\n !!(isWindowExists && internalWindow['HTMLElement']);\n var zoneSymbolEventNames = {};\n var wrapFn = function (event) {\n // https://github.com/angular/zone.js/issues/911, in IE, sometimes\n // event will be undefined, so we need to use window.event\n event = event || _global.event;\n if (!event) {\n return;\n }\n var eventNameSymbol = zoneSymbolEventNames[event.type];\n if (!eventNameSymbol) {\n eventNameSymbol = zoneSymbolEventNames[event.type] = zoneSymbol('ON_PROPERTY' + event.type);\n }\n var target = this || event.target || _global;\n var listener = target[eventNameSymbol];\n var result;\n if (isBrowser && target === internalWindow && event.type === 'error') {\n // window.onerror have different signiture\n // https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror#window.onerror\n // and onerror callback will prevent default when callback return true\n var errorEvent = event;\n result = listener &&\n listener.call(this, errorEvent.message, errorEvent.filename, errorEvent.lineno, errorEvent.colno, errorEvent.error);\n if (result === true) {\n event.preventDefault();\n }\n }\n else {\n result = listener && listener.apply(this, arguments);\n if (result != undefined && !result) {\n event.preventDefault();\n }\n }\n return result;\n };\n function patchProperty(obj, prop, prototype) {\n var desc = ObjectGetOwnPropertyDescriptor(obj, prop);\n if (!desc && prototype) {\n // when patch window object, use prototype to check prop exist or not\n var prototypeDesc = ObjectGetOwnPropertyDescriptor(prototype, prop);\n if (prototypeDesc) {\n desc = { enumerable: true, configurable: true };\n }\n }\n // if the descriptor not exists or is not configurable\n // just return\n if (!desc || !desc.configurable) {\n return;\n }\n var onPropPatchedSymbol = zoneSymbol('on' + prop + 'patched');\n if (obj.hasOwnProperty(onPropPatchedSymbol) && obj[onPropPatchedSymbol]) {\n return;\n }\n // A property descriptor cannot have getter/setter and be writable\n // deleting the writable and value properties avoids this error:\n //\n // TypeError: property descriptors must not specify a value or be writable when a\n // getter or setter has been specified\n delete desc.writable;\n delete desc.value;\n var originalDescGet = desc.get;\n var originalDescSet = desc.set;\n // substr(2) cuz 'onclick' -> 'click', etc\n var eventName = prop.substr(2);\n var eventNameSymbol = zoneSymbolEventNames[eventName];\n if (!eventNameSymbol) {\n eventNameSymbol = zoneSymbolEventNames[eventName] = zoneSymbol('ON_PROPERTY' + eventName);\n }\n desc.set = function (newValue) {\n // in some of windows's onproperty callback, this is undefined\n // so we need to check it\n var target = this;\n if (!target && obj === _global) {\n target = _global;\n }\n if (!target) {\n return;\n }\n var previousValue = target[eventNameSymbol];\n if (previousValue) {\n target.removeEventListener(eventName, wrapFn);\n }\n // issue #978, when onload handler was added before loading zone.js\n // we should remove it with originalDescSet\n if (originalDescSet) {\n originalDescSet.apply(target, NULL_ON_PROP_VALUE);\n }\n if (typeof newValue === 'function') {\n target[eventNameSymbol] = newValue;\n target.addEventListener(eventName, wrapFn, false);\n }\n else {\n target[eventNameSymbol] = null;\n }\n };\n // The getter would return undefined for unassigned properties but the default value of an\n // unassigned property is null\n desc.get = function () {\n // in some of windows's onproperty callback, this is undefined\n // so we need to check it\n var target = this;\n if (!target && obj === _global) {\n target = _global;\n }\n if (!target) {\n return null;\n }\n var listener = target[eventNameSymbol];\n if (listener) {\n return listener;\n }\n else if (originalDescGet) {\n // result will be null when use inline event attribute,\n // such as \n // because the onclick function is internal raw uncompiled handler\n // the onclick will be evaluated when first time event was triggered or\n // the property is accessed, https://github.com/angular/zone.js/issues/525\n // so we should use original native get to retrieve the handler\n var value = originalDescGet && originalDescGet.call(this);\n if (value) {\n desc.set.call(this, value);\n if (typeof target[REMOVE_ATTRIBUTE] === 'function') {\n target.removeAttribute(prop);\n }\n return value;\n }\n }\n return null;\n };\n ObjectDefineProperty(obj, prop, desc);\n obj[onPropPatchedSymbol] = true;\n }\n function patchOnProperties(obj, properties, prototype) {\n if (properties) {\n for (var i = 0; i < properties.length; i++) {\n patchProperty(obj, 'on' + properties[i], prototype);\n }\n }\n else {\n var onProperties = [];\n for (var prop in obj) {\n if (prop.substr(0, 2) == 'on') {\n onProperties.push(prop);\n }\n }\n for (var j = 0; j < onProperties.length; j++) {\n patchProperty(obj, onProperties[j], prototype);\n }\n }\n }\n var originalInstanceKey = zoneSymbol('originalInstance');\n // wrap some native API on `window`\n function patchClass(className) {\n var OriginalClass = _global[className];\n if (!OriginalClass)\n return;\n // keep original class in global\n _global[zoneSymbol(className)] = OriginalClass;\n _global[className] = function () {\n var a = bindArguments(arguments, className);\n switch (a.length) {\n case 0:\n this[originalInstanceKey] = new OriginalClass();\n break;\n case 1:\n this[originalInstanceKey] = new OriginalClass(a[0]);\n break;\n case 2:\n this[originalInstanceKey] = new OriginalClass(a[0], a[1]);\n break;\n case 3:\n this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2]);\n break;\n case 4:\n this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2], a[3]);\n break;\n default:\n throw new Error('Arg list too long.');\n }\n };\n // attach original delegate to patched function\n attachOriginToPatched(_global[className], OriginalClass);\n var instance = new OriginalClass(function () { });\n var prop;\n for (prop in instance) {\n // https://bugs.webkit.org/show_bug.cgi?id=44721\n if (className === 'XMLHttpRequest' && prop === 'responseBlob')\n continue;\n (function (prop) {\n if (typeof instance[prop] === 'function') {\n _global[className].prototype[prop] = function () {\n return this[originalInstanceKey][prop].apply(this[originalInstanceKey], arguments);\n };\n }\n else {\n ObjectDefineProperty(_global[className].prototype, prop, {\n set: function (fn) {\n if (typeof fn === 'function') {\n this[originalInstanceKey][prop] = wrapWithCurrentZone(fn, className + '.' + prop);\n // keep callback in wrapped function so we can\n // use it in Function.prototype.toString to return\n // the native one.\n attachOriginToPatched(this[originalInstanceKey][prop], fn);\n }\n else {\n this[originalInstanceKey][prop] = fn;\n }\n },\n get: function () {\n return this[originalInstanceKey][prop];\n }\n });\n }\n }(prop));\n }\n for (prop in OriginalClass) {\n if (prop !== 'prototype' && OriginalClass.hasOwnProperty(prop)) {\n _global[className][prop] = OriginalClass[prop];\n }\n }\n }\n function patchMethod(target, name, patchFn) {\n var proto = target;\n while (proto && !proto.hasOwnProperty(name)) {\n proto = ObjectGetPrototypeOf(proto);\n }\n if (!proto && target[name]) {\n // somehow we did not find it, but we can see it. This happens on IE for Window properties.\n proto = target;\n }\n var delegateName = zoneSymbol(name);\n var delegate = null;\n if (proto && (!(delegate = proto[delegateName]) || !proto.hasOwnProperty(delegateName))) {\n delegate = proto[delegateName] = proto[name];\n // check whether proto[name] is writable\n // some property is readonly in safari, such as HtmlCanvasElement.prototype.toBlob\n var desc = proto && ObjectGetOwnPropertyDescriptor(proto, name);\n if (isPropertyWritable(desc)) {\n var patchDelegate_1 = patchFn(delegate, delegateName, name);\n proto[name] = function () {\n return patchDelegate_1(this, arguments);\n };\n attachOriginToPatched(proto[name], delegate);\n }\n }\n return delegate;\n }\n // TODO: @JiaLiPassion, support cancel task later if necessary\n function patchMacroTask(obj, funcName, metaCreator) {\n var setNative = null;\n function scheduleTask(task) {\n var data = task.data;\n data.args[data.cbIdx] = function () {\n task.invoke.apply(this, arguments);\n };\n setNative.apply(data.target, data.args);\n return task;\n }\n setNative = patchMethod(obj, funcName, function (delegate) { return function (self, args) {\n var meta = metaCreator(self, args);\n if (meta.cbIdx >= 0 && typeof args[meta.cbIdx] === 'function') {\n return scheduleMacroTaskWithCurrentZone(meta.name, args[meta.cbIdx], meta, scheduleTask);\n }\n else {\n // cause an error by calling it directly.\n return delegate.apply(self, args);\n }\n }; });\n }\n function attachOriginToPatched(patched, original) {\n patched[zoneSymbol('OriginalDelegate')] = original;\n }\n var isDetectedIEOrEdge = false;\n var ieOrEdge = false;\n function isIE() {\n try {\n var ua = internalWindow.navigator.userAgent;\n if (ua.indexOf('MSIE ') !== -1 || ua.indexOf('Trident/') !== -1) {\n return true;\n }\n }\n catch (error) {\n }\n return false;\n }\n function isIEOrEdge() {\n if (isDetectedIEOrEdge) {\n return ieOrEdge;\n }\n isDetectedIEOrEdge = true;\n try {\n var ua = internalWindow.navigator.userAgent;\n if (ua.indexOf('MSIE ') !== -1 || ua.indexOf('Trident/') !== -1 || ua.indexOf('Edge/') !== -1) {\n ieOrEdge = true;\n }\n }\n catch (error) {\n }\n return ieOrEdge;\n }\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {\n var ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n var ObjectDefineProperty = Object.defineProperty;\n function readableObjectToString(obj) {\n if (obj && obj.toString === Object.prototype.toString) {\n var className = obj.constructor && obj.constructor.name;\n return (className ? className : '') + ': ' + JSON.stringify(obj);\n }\n return obj ? obj.toString() : Object.prototype.toString.call(obj);\n }\n var __symbol__ = api.symbol;\n var _uncaughtPromiseErrors = [];\n var isDisableWrappingUncaughtPromiseRejection = global[__symbol__('DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION')] === true;\n var symbolPromise = __symbol__('Promise');\n var symbolThen = __symbol__('then');\n var creationTrace = '__creationTrace__';\n api.onUnhandledError = function (e) {\n if (api.showUncaughtError()) {\n var rejection = e && e.rejection;\n if (rejection) {\n console.error('Unhandled Promise rejection:', rejection instanceof Error ? rejection.message : rejection, '; Zone:', e.zone.name, '; Task:', e.task && e.task.source, '; Value:', rejection, rejection instanceof Error ? rejection.stack : undefined);\n }\n else {\n console.error(e);\n }\n }\n };\n api.microtaskDrainDone = function () {\n var _loop_2 = function () {\n var uncaughtPromiseError = _uncaughtPromiseErrors.shift();\n try {\n uncaughtPromiseError.zone.runGuarded(function () {\n if (uncaughtPromiseError.throwOriginal) {\n throw uncaughtPromiseError.rejection;\n }\n throw uncaughtPromiseError;\n });\n }\n catch (error) {\n handleUnhandledRejection(error);\n }\n };\n while (_uncaughtPromiseErrors.length) {\n _loop_2();\n }\n };\n var UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL = __symbol__('unhandledPromiseRejectionHandler');\n function handleUnhandledRejection(e) {\n api.onUnhandledError(e);\n try {\n var handler = Zone[UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL];\n if (typeof handler === 'function') {\n handler.call(this, e);\n }\n }\n catch (err) {\n }\n }\n function isThenable(value) {\n return value && value.then;\n }\n function forwardResolution(value) {\n return value;\n }\n function forwardRejection(rejection) {\n return ZoneAwarePromise.reject(rejection);\n }\n var symbolState = __symbol__('state');\n var symbolValue = __symbol__('value');\n var symbolFinally = __symbol__('finally');\n var symbolParentPromiseValue = __symbol__('parentPromiseValue');\n var symbolParentPromiseState = __symbol__('parentPromiseState');\n var source = 'Promise.then';\n var UNRESOLVED = null;\n var RESOLVED = true;\n var REJECTED = false;\n var REJECTED_NO_CATCH = 0;\n function makeResolver(promise, state) {\n return function (v) {\n try {\n resolvePromise(promise, state, v);\n }\n catch (err) {\n resolvePromise(promise, false, err);\n }\n // Do not return value or you will break the Promise spec.\n };\n }\n var once = function () {\n var wasCalled = false;\n return function wrapper(wrappedFunction) {\n return function () {\n if (wasCalled) {\n return;\n }\n wasCalled = true;\n wrappedFunction.apply(null, arguments);\n };\n };\n };\n var TYPE_ERROR = 'Promise resolved with itself';\n var CURRENT_TASK_TRACE_SYMBOL = __symbol__('currentTaskTrace');\n // Promise Resolution\n function resolvePromise(promise, state, value) {\n var onceWrapper = once();\n if (promise === value) {\n throw new TypeError(TYPE_ERROR);\n }\n if (promise[symbolState] === UNRESOLVED) {\n // should only get value.then once based on promise spec.\n var then = null;\n try {\n if (typeof value === 'object' || typeof value === 'function') {\n then = value && value.then;\n }\n }\n catch (err) {\n onceWrapper(function () {\n resolvePromise(promise, false, err);\n })();\n return promise;\n }\n // if (value instanceof ZoneAwarePromise) {\n if (state !== REJECTED && value instanceof ZoneAwarePromise &&\n value.hasOwnProperty(symbolState) && value.hasOwnProperty(symbolValue) &&\n value[symbolState] !== UNRESOLVED) {\n clearRejectedNoCatch(value);\n resolvePromise(promise, value[symbolState], value[symbolValue]);\n }\n else if (state !== REJECTED && typeof then === 'function') {\n try {\n then.call(value, onceWrapper(makeResolver(promise, state)), onceWrapper(makeResolver(promise, false)));\n }\n catch (err) {\n onceWrapper(function () {\n resolvePromise(promise, false, err);\n })();\n }\n }\n else {\n promise[symbolState] = state;\n var queue = promise[symbolValue];\n promise[symbolValue] = value;\n if (promise[symbolFinally] === symbolFinally) {\n // the promise is generated by Promise.prototype.finally\n if (state === RESOLVED) {\n // the state is resolved, should ignore the value\n // and use parent promise value\n promise[symbolState] = promise[symbolParentPromiseState];\n promise[symbolValue] = promise[symbolParentPromiseValue];\n }\n }\n // record task information in value when error occurs, so we can\n // do some additional work such as render longStackTrace\n if (state === REJECTED && value instanceof Error) {\n // check if longStackTraceZone is here\n var trace = Zone.currentTask && Zone.currentTask.data &&\n Zone.currentTask.data[creationTrace];\n if (trace) {\n // only keep the long stack trace into error when in longStackTraceZone\n ObjectDefineProperty(value, CURRENT_TASK_TRACE_SYMBOL, { configurable: true, enumerable: false, writable: true, value: trace });\n }\n }\n for (var i = 0; i < queue.length;) {\n scheduleResolveOrReject(promise, queue[i++], queue[i++], queue[i++], queue[i++]);\n }\n if (queue.length == 0 && state == REJECTED) {\n promise[symbolState] = REJECTED_NO_CATCH;\n var uncaughtPromiseError = value;\n try {\n // Here we throws a new Error to print more readable error log\n // and if the value is not an error, zone.js builds an `Error`\n // Object here to attach the stack information.\n throw new Error('Uncaught (in promise): ' + readableObjectToString(value) +\n (value && value.stack ? '\\n' + value.stack : ''));\n }\n catch (err) {\n uncaughtPromiseError = err;\n }\n if (isDisableWrappingUncaughtPromiseRejection) {\n // If disable wrapping uncaught promise reject\n // use the value instead of wrapping it.\n uncaughtPromiseError.throwOriginal = true;\n }\n uncaughtPromiseError.rejection = value;\n uncaughtPromiseError.promise = promise;\n uncaughtPromiseError.zone = Zone.current;\n uncaughtPromiseError.task = Zone.currentTask;\n _uncaughtPromiseErrors.push(uncaughtPromiseError);\n api.scheduleMicroTask(); // to make sure that it is running\n }\n }\n }\n // Resolving an already resolved promise is a noop.\n return promise;\n }\n var REJECTION_HANDLED_HANDLER = __symbol__('rejectionHandledHandler');\n function clearRejectedNoCatch(promise) {\n if (promise[symbolState] === REJECTED_NO_CATCH) {\n // if the promise is rejected no catch status\n // and queue.length > 0, means there is a error handler\n // here to handle the rejected promise, we should trigger\n // windows.rejectionhandled eventHandler or nodejs rejectionHandled\n // eventHandler\n try {\n var handler = Zone[REJECTION_HANDLED_HANDLER];\n if (handler && typeof handler === 'function') {\n handler.call(this, { rejection: promise[symbolValue], promise: promise });\n }\n }\n catch (err) {\n }\n promise[symbolState] = REJECTED;\n for (var i = 0; i < _uncaughtPromiseErrors.length; i++) {\n if (promise === _uncaughtPromiseErrors[i].promise) {\n _uncaughtPromiseErrors.splice(i, 1);\n }\n }\n }\n }\n function scheduleResolveOrReject(promise, zone, chainPromise, onFulfilled, onRejected) {\n clearRejectedNoCatch(promise);\n var promiseState = promise[symbolState];\n var delegate = promiseState ?\n (typeof onFulfilled === 'function') ? onFulfilled : forwardResolution :\n (typeof onRejected === 'function') ? onRejected : forwardRejection;\n zone.scheduleMicroTask(source, function () {\n try {\n var parentPromiseValue = promise[symbolValue];\n var isFinallyPromise = !!chainPromise && symbolFinally === chainPromise[symbolFinally];\n if (isFinallyPromise) {\n // if the promise is generated from finally call, keep parent promise's state and value\n chainPromise[symbolParentPromiseValue] = parentPromiseValue;\n chainPromise[symbolParentPromiseState] = promiseState;\n }\n // should not pass value to finally callback\n var value = zone.run(delegate, undefined, isFinallyPromise && delegate !== forwardRejection && delegate !== forwardResolution ?\n [] :\n [parentPromiseValue]);\n resolvePromise(chainPromise, true, value);\n }\n catch (error) {\n // if error occurs, should always return this error\n resolvePromise(chainPromise, false, error);\n }\n }, chainPromise);\n }\n var ZONE_AWARE_PROMISE_TO_STRING = 'function ZoneAwarePromise() { [native code] }';\n var noop = function () { };\n var ZoneAwarePromise = /** @class */ (function () {\n function ZoneAwarePromise(executor) {\n var promise = this;\n if (!(promise instanceof ZoneAwarePromise)) {\n throw new Error('Must be an instanceof Promise.');\n }\n promise[symbolState] = UNRESOLVED;\n promise[symbolValue] = []; // queue;\n try {\n executor && executor(makeResolver(promise, RESOLVED), makeResolver(promise, REJECTED));\n }\n catch (error) {\n resolvePromise(promise, false, error);\n }\n }\n ZoneAwarePromise.toString = function () {\n return ZONE_AWARE_PROMISE_TO_STRING;\n };\n ZoneAwarePromise.resolve = function (value) {\n return resolvePromise(new this(null), RESOLVED, value);\n };\n ZoneAwarePromise.reject = function (error) {\n return resolvePromise(new this(null), REJECTED, error);\n };\n ZoneAwarePromise.race = function (values) {\n var resolve;\n var reject;\n var promise = new this(function (res, rej) {\n resolve = res;\n reject = rej;\n });\n function onResolve(value) {\n resolve(value);\n }\n function onReject(error) {\n reject(error);\n }\n for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {\n var value = values_1[_i];\n if (!isThenable(value)) {\n value = this.resolve(value);\n }\n value.then(onResolve, onReject);\n }\n return promise;\n };\n ZoneAwarePromise.all = function (values) {\n return ZoneAwarePromise.allWithCallback(values);\n };\n ZoneAwarePromise.allSettled = function (values) {\n var P = this && this.prototype instanceof ZoneAwarePromise ? this : ZoneAwarePromise;\n return P.allWithCallback(values, {\n thenCallback: function (value) { return ({ status: 'fulfilled', value: value }); },\n errorCallback: function (err) { return ({ status: 'rejected', reason: err }); }\n });\n };\n ZoneAwarePromise.allWithCallback = function (values, callback) {\n var resolve;\n var reject;\n var promise = new this(function (res, rej) {\n resolve = res;\n reject = rej;\n });\n // Start at 2 to prevent prematurely resolving if .then is called immediately.\n var unresolvedCount = 2;\n var valueIndex = 0;\n var resolvedValues = [];\n var _loop_3 = function (value) {\n if (!isThenable(value)) {\n value = this_1.resolve(value);\n }\n var curValueIndex = valueIndex;\n try {\n value.then(function (value) {\n resolvedValues[curValueIndex] = callback ? callback.thenCallback(value) : value;\n unresolvedCount--;\n if (unresolvedCount === 0) {\n resolve(resolvedValues);\n }\n }, function (err) {\n if (!callback) {\n reject(err);\n }\n else {\n resolvedValues[curValueIndex] = callback.errorCallback(err);\n unresolvedCount--;\n if (unresolvedCount === 0) {\n resolve(resolvedValues);\n }\n }\n });\n }\n catch (thenErr) {\n reject(thenErr);\n }\n unresolvedCount++;\n valueIndex++;\n };\n var this_1 = this;\n for (var _i = 0, values_2 = values; _i < values_2.length; _i++) {\n var value = values_2[_i];\n _loop_3(value);\n }\n // Make the unresolvedCount zero-based again.\n unresolvedCount -= 2;\n if (unresolvedCount === 0) {\n resolve(resolvedValues);\n }\n return promise;\n };\n Object.defineProperty(ZoneAwarePromise.prototype, Symbol.toStringTag, {\n get: function () {\n return 'Promise';\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ZoneAwarePromise.prototype, Symbol.species, {\n get: function () {\n return ZoneAwarePromise;\n },\n enumerable: false,\n configurable: true\n });\n ZoneAwarePromise.prototype.then = function (onFulfilled, onRejected) {\n var C = this.constructor[Symbol.species];\n if (!C || typeof C !== 'function') {\n C = this.constructor || ZoneAwarePromise;\n }\n var chainPromise = new C(noop);\n var zone = Zone.current;\n if (this[symbolState] == UNRESOLVED) {\n this[symbolValue].push(zone, chainPromise, onFulfilled, onRejected);\n }\n else {\n scheduleResolveOrReject(this, zone, chainPromise, onFulfilled, onRejected);\n }\n return chainPromise;\n };\n ZoneAwarePromise.prototype.catch = function (onRejected) {\n return this.then(null, onRejected);\n };\n ZoneAwarePromise.prototype.finally = function (onFinally) {\n var C = this.constructor[Symbol.species];\n if (!C || typeof C !== 'function') {\n C = ZoneAwarePromise;\n }\n var chainPromise = new C(noop);\n chainPromise[symbolFinally] = symbolFinally;\n var zone = Zone.current;\n if (this[symbolState] == UNRESOLVED) {\n this[symbolValue].push(zone, chainPromise, onFinally, onFinally);\n }\n else {\n scheduleResolveOrReject(this, zone, chainPromise, onFinally, onFinally);\n }\n return chainPromise;\n };\n return ZoneAwarePromise;\n }());\n // Protect against aggressive optimizers dropping seemingly unused properties.\n // E.g. Closure Compiler in advanced mode.\n ZoneAwarePromise['resolve'] = ZoneAwarePromise.resolve;\n ZoneAwarePromise['reject'] = ZoneAwarePromise.reject;\n ZoneAwarePromise['race'] = ZoneAwarePromise.race;\n ZoneAwarePromise['all'] = ZoneAwarePromise.all;\n var NativePromise = global[symbolPromise] = global['Promise'];\n global['Promise'] = ZoneAwarePromise;\n var symbolThenPatched = __symbol__('thenPatched');\n function patchThen(Ctor) {\n var proto = Ctor.prototype;\n var prop = ObjectGetOwnPropertyDescriptor(proto, 'then');\n if (prop && (prop.writable === false || !prop.configurable)) {\n // check Ctor.prototype.then propertyDescriptor is writable or not\n // in meteor env, writable is false, we should ignore such case\n return;\n }\n var originalThen = proto.then;\n // Keep a reference to the original method.\n proto[symbolThen] = originalThen;\n Ctor.prototype.then = function (onResolve, onReject) {\n var _this = this;\n var wrapped = new ZoneAwarePromise(function (resolve, reject) {\n originalThen.call(_this, resolve, reject);\n });\n return wrapped.then(onResolve, onReject);\n };\n Ctor[symbolThenPatched] = true;\n }\n api.patchThen = patchThen;\n function zoneify(fn) {\n return function (self, args) {\n var resultPromise = fn.apply(self, args);\n if (resultPromise instanceof ZoneAwarePromise) {\n return resultPromise;\n }\n var ctor = resultPromise.constructor;\n if (!ctor[symbolThenPatched]) {\n patchThen(ctor);\n }\n return resultPromise;\n };\n }\n if (NativePromise) {\n patchThen(NativePromise);\n patchMethod(global, 'fetch', function (delegate) { return zoneify(delegate); });\n }\n // This is not part of public API, but it is useful for tests, so we expose it.\n Promise[Zone.__symbol__('uncaughtPromiseErrors')] = _uncaughtPromiseErrors;\n return ZoneAwarePromise;\n });\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n // override Function.prototype.toString to make zone.js patched function\n // look like native function\n Zone.__load_patch('toString', function (global) {\n // patch Func.prototype.toString to let them look like native\n var originalFunctionToString = Function.prototype.toString;\n var ORIGINAL_DELEGATE_SYMBOL = zoneSymbol('OriginalDelegate');\n var PROMISE_SYMBOL = zoneSymbol('Promise');\n var ERROR_SYMBOL = zoneSymbol('Error');\n var newFunctionToString = function toString() {\n if (typeof this === 'function') {\n var originalDelegate = this[ORIGINAL_DELEGATE_SYMBOL];\n if (originalDelegate) {\n if (typeof originalDelegate === 'function') {\n return originalFunctionToString.call(originalDelegate);\n }\n else {\n return Object.prototype.toString.call(originalDelegate);\n }\n }\n if (this === Promise) {\n var nativePromise = global[PROMISE_SYMBOL];\n if (nativePromise) {\n return originalFunctionToString.call(nativePromise);\n }\n }\n if (this === Error) {\n var nativeError = global[ERROR_SYMBOL];\n if (nativeError) {\n return originalFunctionToString.call(nativeError);\n }\n }\n }\n return originalFunctionToString.call(this);\n };\n newFunctionToString[ORIGINAL_DELEGATE_SYMBOL] = originalFunctionToString;\n Function.prototype.toString = newFunctionToString;\n // patch Object.prototype.toString to let them look like native\n var originalObjectToString = Object.prototype.toString;\n var PROMISE_OBJECT_TO_STRING = '[object Promise]';\n Object.prototype.toString = function () {\n if (typeof Promise === 'function' && this instanceof Promise) {\n return PROMISE_OBJECT_TO_STRING;\n }\n return originalObjectToString.call(this);\n };\n });\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n var passiveSupported = false;\n if (typeof window !== 'undefined') {\n try {\n var options = Object.defineProperty({}, 'passive', {\n get: function () {\n passiveSupported = true;\n }\n });\n window.addEventListener('test', options, options);\n window.removeEventListener('test', options, options);\n }\n catch (err) {\n passiveSupported = false;\n }\n }\n // an identifier to tell ZoneTask do not create a new invoke closure\n var OPTIMIZED_ZONE_EVENT_TASK_DATA = {\n useG: true\n };\n var zoneSymbolEventNames$1 = {};\n var globalSources = {};\n var EVENT_NAME_SYMBOL_REGX = new RegExp('^' + ZONE_SYMBOL_PREFIX + '(\\\\w+)(true|false)$');\n var IMMEDIATE_PROPAGATION_SYMBOL = zoneSymbol('propagationStopped');\n function prepareEventNames(eventName, eventNameToString) {\n var falseEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + FALSE_STR;\n var trueEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + TRUE_STR;\n var symbol = ZONE_SYMBOL_PREFIX + falseEventName;\n var symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName;\n zoneSymbolEventNames$1[eventName] = {};\n zoneSymbolEventNames$1[eventName][FALSE_STR] = symbol;\n zoneSymbolEventNames$1[eventName][TRUE_STR] = symbolCapture;\n }\n function patchEventTarget(_global, apis, patchOptions) {\n var ADD_EVENT_LISTENER = (patchOptions && patchOptions.add) || ADD_EVENT_LISTENER_STR;\n var REMOVE_EVENT_LISTENER = (patchOptions && patchOptions.rm) || REMOVE_EVENT_LISTENER_STR;\n var LISTENERS_EVENT_LISTENER = (patchOptions && patchOptions.listeners) || 'eventListeners';\n var REMOVE_ALL_LISTENERS_EVENT_LISTENER = (patchOptions && patchOptions.rmAll) || 'removeAllListeners';\n var zoneSymbolAddEventListener = zoneSymbol(ADD_EVENT_LISTENER);\n var ADD_EVENT_LISTENER_SOURCE = '.' + ADD_EVENT_LISTENER + ':';\n var PREPEND_EVENT_LISTENER = 'prependListener';\n var PREPEND_EVENT_LISTENER_SOURCE = '.' + PREPEND_EVENT_LISTENER + ':';\n var invokeTask = function (task, target, event) {\n // for better performance, check isRemoved which is set\n // by removeEventListener\n if (task.isRemoved) {\n return;\n }\n var delegate = task.callback;\n if (typeof delegate === 'object' && delegate.handleEvent) {\n // create the bind version of handleEvent when invoke\n task.callback = function (event) { return delegate.handleEvent(event); };\n task.originalDelegate = delegate;\n }\n // invoke static task.invoke\n task.invoke(task, target, [event]);\n var options = task.options;\n if (options && typeof options === 'object' && options.once) {\n // if options.once is true, after invoke once remove listener here\n // only browser need to do this, nodejs eventEmitter will cal removeListener\n // inside EventEmitter.once\n var delegate_1 = task.originalDelegate ? task.originalDelegate : task.callback;\n target[REMOVE_EVENT_LISTENER].call(target, event.type, delegate_1, options);\n }\n };\n // global shared zoneAwareCallback to handle all event callback with capture = false\n var globalZoneAwareCallback = function (event) {\n // https://github.com/angular/zone.js/issues/911, in IE, sometimes\n // event will be undefined, so we need to use window.event\n event = event || _global.event;\n if (!event) {\n return;\n }\n // event.target is needed for Samsung TV and SourceBuffer\n // || global is needed https://github.com/angular/zone.js/issues/190\n var target = this || event.target || _global;\n var tasks = target[zoneSymbolEventNames$1[event.type][FALSE_STR]];\n if (tasks) {\n // invoke all tasks which attached to current target with given event.type and capture = false\n // for performance concern, if task.length === 1, just invoke\n if (tasks.length === 1) {\n invokeTask(tasks[0], target, event);\n }\n else {\n // https://github.com/angular/zone.js/issues/836\n // copy the tasks array before invoke, to avoid\n // the callback will remove itself or other listener\n var copyTasks = tasks.slice();\n for (var i = 0; i < copyTasks.length; i++) {\n if (event && event[IMMEDIATE_PROPAGATION_SYMBOL] === true) {\n break;\n }\n invokeTask(copyTasks[i], target, event);\n }\n }\n }\n };\n // global shared zoneAwareCallback to handle all event callback with capture = true\n var globalZoneAwareCaptureCallback = function (event) {\n // https://github.com/angular/zone.js/issues/911, in IE, sometimes\n // event will be undefined, so we need to use window.event\n event = event || _global.event;\n if (!event) {\n return;\n }\n // event.target is needed for Samsung TV and SourceBuffer\n // || global is needed https://github.com/angular/zone.js/issues/190\n var target = this || event.target || _global;\n var tasks = target[zoneSymbolEventNames$1[event.type][TRUE_STR]];\n if (tasks) {\n // invoke all tasks which attached to current target with given event.type and capture = false\n // for performance concern, if task.length === 1, just invoke\n if (tasks.length === 1) {\n invokeTask(tasks[0], target, event);\n }\n else {\n // https://github.com/angular/zone.js/issues/836\n // copy the tasks array before invoke, to avoid\n // the callback will remove itself or other listener\n var copyTasks = tasks.slice();\n for (var i = 0; i < copyTasks.length; i++) {\n if (event && event[IMMEDIATE_PROPAGATION_SYMBOL] === true) {\n break;\n }\n invokeTask(copyTasks[i], target, event);\n }\n }\n }\n };\n function patchEventTargetMethods(obj, patchOptions) {\n if (!obj) {\n return false;\n }\n var useGlobalCallback = true;\n if (patchOptions && patchOptions.useG !== undefined) {\n useGlobalCallback = patchOptions.useG;\n }\n var validateHandler = patchOptions && patchOptions.vh;\n var checkDuplicate = true;\n if (patchOptions && patchOptions.chkDup !== undefined) {\n checkDuplicate = patchOptions.chkDup;\n }\n var returnTarget = false;\n if (patchOptions && patchOptions.rt !== undefined) {\n returnTarget = patchOptions.rt;\n }\n var proto = obj;\n while (proto && !proto.hasOwnProperty(ADD_EVENT_LISTENER)) {\n proto = ObjectGetPrototypeOf(proto);\n }\n if (!proto && obj[ADD_EVENT_LISTENER]) {\n // somehow we did not find it, but we can see it. This happens on IE for Window properties.\n proto = obj;\n }\n if (!proto) {\n return false;\n }\n if (proto[zoneSymbolAddEventListener]) {\n return false;\n }\n var eventNameToString = patchOptions && patchOptions.eventNameToString;\n // a shared global taskData to pass data for scheduleEventTask\n // so we do not need to create a new object just for pass some data\n var taskData = {};\n var nativeAddEventListener = proto[zoneSymbolAddEventListener] = proto[ADD_EVENT_LISTENER];\n var nativeRemoveEventListener = proto[zoneSymbol(REMOVE_EVENT_LISTENER)] =\n proto[REMOVE_EVENT_LISTENER];\n var nativeListeners = proto[zoneSymbol(LISTENERS_EVENT_LISTENER)] =\n proto[LISTENERS_EVENT_LISTENER];\n var nativeRemoveAllListeners = proto[zoneSymbol(REMOVE_ALL_LISTENERS_EVENT_LISTENER)] =\n proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER];\n var nativePrependEventListener;\n if (patchOptions && patchOptions.prepend) {\n nativePrependEventListener = proto[zoneSymbol(patchOptions.prepend)] =\n proto[patchOptions.prepend];\n }\n /**\n * This util function will build an option object with passive option\n * to handle all possible input from the user.\n */\n function buildEventListenerOptions(options, passive) {\n if (!passiveSupported && typeof options === 'object' && options) {\n // doesn't support passive but user want to pass an object as options.\n // this will not work on some old browser, so we just pass a boolean\n // as useCapture parameter\n return !!options.capture;\n }\n if (!passiveSupported || !passive) {\n return options;\n }\n if (typeof options === 'boolean') {\n return { capture: options, passive: true };\n }\n if (!options) {\n return { passive: true };\n }\n if (typeof options === 'object' && options.passive !== false) {\n return Object.assign(Object.assign({}, options), { passive: true });\n }\n return options;\n }\n var customScheduleGlobal = function (task) {\n // if there is already a task for the eventName + capture,\n // just return, because we use the shared globalZoneAwareCallback here.\n if (taskData.isExisting) {\n return;\n }\n return nativeAddEventListener.call(taskData.target, taskData.eventName, taskData.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, taskData.options);\n };\n var customCancelGlobal = function (task) {\n // if task is not marked as isRemoved, this call is directly\n // from Zone.prototype.cancelTask, we should remove the task\n // from tasksList of target first\n if (!task.isRemoved) {\n var symbolEventNames = zoneSymbolEventNames$1[task.eventName];\n var symbolEventName = void 0;\n if (symbolEventNames) {\n symbolEventName = symbolEventNames[task.capture ? TRUE_STR : FALSE_STR];\n }\n var existingTasks = symbolEventName && task.target[symbolEventName];\n if (existingTasks) {\n for (var i = 0; i < existingTasks.length; i++) {\n var existingTask = existingTasks[i];\n if (existingTask === task) {\n existingTasks.splice(i, 1);\n // set isRemoved to data for faster invokeTask check\n task.isRemoved = true;\n if (existingTasks.length === 0) {\n // all tasks for the eventName + capture have gone,\n // remove globalZoneAwareCallback and remove the task cache from target\n task.allRemoved = true;\n task.target[symbolEventName] = null;\n }\n break;\n }\n }\n }\n }\n // if all tasks for the eventName + capture have gone,\n // we will really remove the global event callback,\n // if not, return\n if (!task.allRemoved) {\n return;\n }\n return nativeRemoveEventListener.call(task.target, task.eventName, task.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, task.options);\n };\n var customScheduleNonGlobal = function (task) {\n return nativeAddEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options);\n };\n var customSchedulePrepend = function (task) {\n return nativePrependEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options);\n };\n var customCancelNonGlobal = function (task) {\n return nativeRemoveEventListener.call(task.target, task.eventName, task.invoke, task.options);\n };\n var customSchedule = useGlobalCallback ? customScheduleGlobal : customScheduleNonGlobal;\n var customCancel = useGlobalCallback ? customCancelGlobal : customCancelNonGlobal;\n var compareTaskCallbackVsDelegate = function (task, delegate) {\n var typeOfDelegate = typeof delegate;\n return (typeOfDelegate === 'function' && task.callback === delegate) ||\n (typeOfDelegate === 'object' && task.originalDelegate === delegate);\n };\n var compare = (patchOptions && patchOptions.diff) ? patchOptions.diff : compareTaskCallbackVsDelegate;\n var unpatchedEvents = Zone[zoneSymbol('UNPATCHED_EVENTS')];\n var passiveEvents = _global[zoneSymbol('PASSIVE_EVENTS')];\n var makeAddListener = function (nativeListener, addSource, customScheduleFn, customCancelFn, returnTarget, prepend) {\n if (returnTarget === void 0) { returnTarget = false; }\n if (prepend === void 0) { prepend = false; }\n return function () {\n var target = this || _global;\n var eventName = arguments[0];\n if (patchOptions && patchOptions.transferEventName) {\n eventName = patchOptions.transferEventName(eventName);\n }\n var delegate = arguments[1];\n if (!delegate) {\n return nativeListener.apply(this, arguments);\n }\n if (isNode && eventName === 'uncaughtException') {\n // don't patch uncaughtException of nodejs to prevent endless loop\n return nativeListener.apply(this, arguments);\n }\n // don't create the bind delegate function for handleEvent\n // case here to improve addEventListener performance\n // we will create the bind delegate when invoke\n var isHandleEvent = false;\n if (typeof delegate !== 'function') {\n if (!delegate.handleEvent) {\n return nativeListener.apply(this, arguments);\n }\n isHandleEvent = true;\n }\n if (validateHandler && !validateHandler(nativeListener, delegate, target, arguments)) {\n return;\n }\n var passive = passiveSupported && !!passiveEvents && passiveEvents.indexOf(eventName) !== -1;\n var options = buildEventListenerOptions(arguments[2], passive);\n if (unpatchedEvents) {\n // check upatched list\n for (var i = 0; i < unpatchedEvents.length; i++) {\n if (eventName === unpatchedEvents[i]) {\n if (passive) {\n return nativeListener.call(target, eventName, delegate, options);\n }\n else {\n return nativeListener.apply(this, arguments);\n }\n }\n }\n }\n var capture = !options ? false : typeof options === 'boolean' ? true : options.capture;\n var once = options && typeof options === 'object' ? options.once : false;\n var zone = Zone.current;\n var symbolEventNames = zoneSymbolEventNames$1[eventName];\n if (!symbolEventNames) {\n prepareEventNames(eventName, eventNameToString);\n symbolEventNames = zoneSymbolEventNames$1[eventName];\n }\n var symbolEventName = symbolEventNames[capture ? TRUE_STR : FALSE_STR];\n var existingTasks = target[symbolEventName];\n var isExisting = false;\n if (existingTasks) {\n // already have task registered\n isExisting = true;\n if (checkDuplicate) {\n for (var i = 0; i < existingTasks.length; i++) {\n if (compare(existingTasks[i], delegate)) {\n // same callback, same capture, same event name, just return\n return;\n }\n }\n }\n }\n else {\n existingTasks = target[symbolEventName] = [];\n }\n var source;\n var constructorName = target.constructor['name'];\n var targetSource = globalSources[constructorName];\n if (targetSource) {\n source = targetSource[eventName];\n }\n if (!source) {\n source = constructorName + addSource +\n (eventNameToString ? eventNameToString(eventName) : eventName);\n }\n // do not create a new object as task.data to pass those things\n // just use the global shared one\n taskData.options = options;\n if (once) {\n // if addEventListener with once options, we don't pass it to\n // native addEventListener, instead we keep the once setting\n // and handle ourselves.\n taskData.options.once = false;\n }\n taskData.target = target;\n taskData.capture = capture;\n taskData.eventName = eventName;\n taskData.isExisting = isExisting;\n var data = useGlobalCallback ? OPTIMIZED_ZONE_EVENT_TASK_DATA : undefined;\n // keep taskData into data to allow onScheduleEventTask to access the task information\n if (data) {\n data.taskData = taskData;\n }\n var task = zone.scheduleEventTask(source, delegate, data, customScheduleFn, customCancelFn);\n // should clear taskData.target to avoid memory leak\n // issue, https://github.com/angular/angular/issues/20442\n taskData.target = null;\n // need to clear up taskData because it is a global object\n if (data) {\n data.taskData = null;\n }\n // have to save those information to task in case\n // application may call task.zone.cancelTask() directly\n if (once) {\n options.once = true;\n }\n if (!(!passiveSupported && typeof task.options === 'boolean')) {\n // if not support passive, and we pass an option object\n // to addEventListener, we should save the options to task\n task.options = options;\n }\n task.target = target;\n task.capture = capture;\n task.eventName = eventName;\n if (isHandleEvent) {\n // save original delegate for compare to check duplicate\n task.originalDelegate = delegate;\n }\n if (!prepend) {\n existingTasks.push(task);\n }\n else {\n existingTasks.unshift(task);\n }\n if (returnTarget) {\n return target;\n }\n };\n };\n proto[ADD_EVENT_LISTENER] = makeAddListener(nativeAddEventListener, ADD_EVENT_LISTENER_SOURCE, customSchedule, customCancel, returnTarget);\n if (nativePrependEventListener) {\n proto[PREPEND_EVENT_LISTENER] = makeAddListener(nativePrependEventListener, PREPEND_EVENT_LISTENER_SOURCE, customSchedulePrepend, customCancel, returnTarget, true);\n }\n proto[REMOVE_EVENT_LISTENER] = function () {\n var target = this || _global;\n var eventName = arguments[0];\n if (patchOptions && patchOptions.transferEventName) {\n eventName = patchOptions.transferEventName(eventName);\n }\n var options = arguments[2];\n var capture = !options ? false : typeof options === 'boolean' ? true : options.capture;\n var delegate = arguments[1];\n if (!delegate) {\n return nativeRemoveEventListener.apply(this, arguments);\n }\n if (validateHandler &&\n !validateHandler(nativeRemoveEventListener, delegate, target, arguments)) {\n return;\n }\n var symbolEventNames = zoneSymbolEventNames$1[eventName];\n var symbolEventName;\n if (symbolEventNames) {\n symbolEventName = symbolEventNames[capture ? TRUE_STR : FALSE_STR];\n }\n var existingTasks = symbolEventName && target[symbolEventName];\n if (existingTasks) {\n for (var i = 0; i < existingTasks.length; i++) {\n var existingTask = existingTasks[i];\n if (compare(existingTask, delegate)) {\n existingTasks.splice(i, 1);\n // set isRemoved to data for faster invokeTask check\n existingTask.isRemoved = true;\n if (existingTasks.length === 0) {\n // all tasks for the eventName + capture have gone,\n // remove globalZoneAwareCallback and remove the task cache from target\n existingTask.allRemoved = true;\n target[symbolEventName] = null;\n // in the target, we have an event listener which is added by on_property\n // such as target.onclick = function() {}, so we need to clear this internal\n // property too if all delegates all removed\n if (typeof eventName === 'string') {\n var onPropertySymbol = ZONE_SYMBOL_PREFIX + 'ON_PROPERTY' + eventName;\n target[onPropertySymbol] = null;\n }\n }\n existingTask.zone.cancelTask(existingTask);\n if (returnTarget) {\n return target;\n }\n return;\n }\n }\n }\n // issue 930, didn't find the event name or callback\n // from zone kept existingTasks, the callback maybe\n // added outside of zone, we need to call native removeEventListener\n // to try to remove it.\n return nativeRemoveEventListener.apply(this, arguments);\n };\n proto[LISTENERS_EVENT_LISTENER] = function () {\n var target = this || _global;\n var eventName = arguments[0];\n if (patchOptions && patchOptions.transferEventName) {\n eventName = patchOptions.transferEventName(eventName);\n }\n var listeners = [];\n var tasks = findEventTasks(target, eventNameToString ? eventNameToString(eventName) : eventName);\n for (var i = 0; i < tasks.length; i++) {\n var task = tasks[i];\n var delegate = task.originalDelegate ? task.originalDelegate : task.callback;\n listeners.push(delegate);\n }\n return listeners;\n };\n proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER] = function () {\n var target = this || _global;\n var eventName = arguments[0];\n if (!eventName) {\n var keys = Object.keys(target);\n for (var i = 0; i < keys.length; i++) {\n var prop = keys[i];\n var match = EVENT_NAME_SYMBOL_REGX.exec(prop);\n var evtName = match && match[1];\n // in nodejs EventEmitter, removeListener event is\n // used for monitoring the removeListener call,\n // so just keep removeListener eventListener until\n // all other eventListeners are removed\n if (evtName && evtName !== 'removeListener') {\n this[REMOVE_ALL_LISTENERS_EVENT_LISTENER].call(this, evtName);\n }\n }\n // remove removeListener listener finally\n this[REMOVE_ALL_LISTENERS_EVENT_LISTENER].call(this, 'removeListener');\n }\n else {\n if (patchOptions && patchOptions.transferEventName) {\n eventName = patchOptions.transferEventName(eventName);\n }\n var symbolEventNames = zoneSymbolEventNames$1[eventName];\n if (symbolEventNames) {\n var symbolEventName = symbolEventNames[FALSE_STR];\n var symbolCaptureEventName = symbolEventNames[TRUE_STR];\n var tasks = target[symbolEventName];\n var captureTasks = target[symbolCaptureEventName];\n if (tasks) {\n var removeTasks = tasks.slice();\n for (var i = 0; i < removeTasks.length; i++) {\n var task = removeTasks[i];\n var delegate = task.originalDelegate ? task.originalDelegate : task.callback;\n this[REMOVE_EVENT_LISTENER].call(this, eventName, delegate, task.options);\n }\n }\n if (captureTasks) {\n var removeTasks = captureTasks.slice();\n for (var i = 0; i < removeTasks.length; i++) {\n var task = removeTasks[i];\n var delegate = task.originalDelegate ? task.originalDelegate : task.callback;\n this[REMOVE_EVENT_LISTENER].call(this, eventName, delegate, task.options);\n }\n }\n }\n }\n if (returnTarget) {\n return this;\n }\n };\n // for native toString patch\n attachOriginToPatched(proto[ADD_EVENT_LISTENER], nativeAddEventListener);\n attachOriginToPatched(proto[REMOVE_EVENT_LISTENER], nativeRemoveEventListener);\n if (nativeRemoveAllListeners) {\n attachOriginToPatched(proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER], nativeRemoveAllListeners);\n }\n if (nativeListeners) {\n attachOriginToPatched(proto[LISTENERS_EVENT_LISTENER], nativeListeners);\n }\n return true;\n }\n var results = [];\n for (var i = 0; i < apis.length; i++) {\n results[i] = patchEventTargetMethods(apis[i], patchOptions);\n }\n return results;\n }\n function findEventTasks(target, eventName) {\n if (!eventName) {\n var foundTasks = [];\n for (var prop in target) {\n var match = EVENT_NAME_SYMBOL_REGX.exec(prop);\n var evtName = match && match[1];\n if (evtName && (!eventName || evtName === eventName)) {\n var tasks = target[prop];\n if (tasks) {\n for (var i = 0; i < tasks.length; i++) {\n foundTasks.push(tasks[i]);\n }\n }\n }\n }\n return foundTasks;\n }\n var symbolEventName = zoneSymbolEventNames$1[eventName];\n if (!symbolEventName) {\n prepareEventNames(eventName);\n symbolEventName = zoneSymbolEventNames$1[eventName];\n }\n var captureFalseTasks = target[symbolEventName[FALSE_STR]];\n var captureTrueTasks = target[symbolEventName[TRUE_STR]];\n if (!captureFalseTasks) {\n return captureTrueTasks ? captureTrueTasks.slice() : [];\n }\n else {\n return captureTrueTasks ? captureFalseTasks.concat(captureTrueTasks) :\n captureFalseTasks.slice();\n }\n }\n function patchEventPrototype(global, api) {\n var Event = global['Event'];\n if (Event && Event.prototype) {\n api.patchMethod(Event.prototype, 'stopImmediatePropagation', function (delegate) { return function (self, args) {\n self[IMMEDIATE_PROPAGATION_SYMBOL] = true;\n // we need to call the native stopImmediatePropagation\n // in case in some hybrid application, some part of\n // application will be controlled by zone, some are not\n delegate && delegate.apply(self, args);\n }; });\n }\n }\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n function patchCallbacks(api, target, targetName, method, callbacks) {\n var symbol = Zone.__symbol__(method);\n if (target[symbol]) {\n return;\n }\n var nativeDelegate = target[symbol] = target[method];\n target[method] = function (name, opts, options) {\n if (opts && opts.prototype) {\n callbacks.forEach(function (callback) {\n var source = targetName + \".\" + method + \"::\" + callback;\n var prototype = opts.prototype;\n if (prototype.hasOwnProperty(callback)) {\n var descriptor = api.ObjectGetOwnPropertyDescriptor(prototype, callback);\n if (descriptor && descriptor.value) {\n descriptor.value = api.wrapWithCurrentZone(descriptor.value, source);\n api._redefineProperty(opts.prototype, callback, descriptor);\n }\n else if (prototype[callback]) {\n prototype[callback] = api.wrapWithCurrentZone(prototype[callback], source);\n }\n }\n else if (prototype[callback]) {\n prototype[callback] = api.wrapWithCurrentZone(prototype[callback], source);\n }\n });\n }\n return nativeDelegate.call(target, name, opts, options);\n };\n api.attachOriginToPatched(target[method], nativeDelegate);\n }\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n var globalEventHandlersEventNames = [\n 'abort',\n 'animationcancel',\n 'animationend',\n 'animationiteration',\n 'auxclick',\n 'beforeinput',\n 'blur',\n 'cancel',\n 'canplay',\n 'canplaythrough',\n 'change',\n 'compositionstart',\n 'compositionupdate',\n 'compositionend',\n 'cuechange',\n 'click',\n 'close',\n 'contextmenu',\n 'curechange',\n 'dblclick',\n 'drag',\n 'dragend',\n 'dragenter',\n 'dragexit',\n 'dragleave',\n 'dragover',\n 'drop',\n 'durationchange',\n 'emptied',\n 'ended',\n 'error',\n 'focus',\n 'focusin',\n 'focusout',\n 'gotpointercapture',\n 'input',\n 'invalid',\n 'keydown',\n 'keypress',\n 'keyup',\n 'load',\n 'loadstart',\n 'loadeddata',\n 'loadedmetadata',\n 'lostpointercapture',\n 'mousedown',\n 'mouseenter',\n 'mouseleave',\n 'mousemove',\n 'mouseout',\n 'mouseover',\n 'mouseup',\n 'mousewheel',\n 'orientationchange',\n 'pause',\n 'play',\n 'playing',\n 'pointercancel',\n 'pointerdown',\n 'pointerenter',\n 'pointerleave',\n 'pointerlockchange',\n 'mozpointerlockchange',\n 'webkitpointerlockerchange',\n 'pointerlockerror',\n 'mozpointerlockerror',\n 'webkitpointerlockerror',\n 'pointermove',\n 'pointout',\n 'pointerover',\n 'pointerup',\n 'progress',\n 'ratechange',\n 'reset',\n 'resize',\n 'scroll',\n 'seeked',\n 'seeking',\n 'select',\n 'selectionchange',\n 'selectstart',\n 'show',\n 'sort',\n 'stalled',\n 'submit',\n 'suspend',\n 'timeupdate',\n 'volumechange',\n 'touchcancel',\n 'touchmove',\n 'touchstart',\n 'touchend',\n 'transitioncancel',\n 'transitionend',\n 'waiting',\n 'wheel'\n ];\n var documentEventNames = [\n 'afterscriptexecute', 'beforescriptexecute', 'DOMContentLoaded', 'freeze', 'fullscreenchange',\n 'mozfullscreenchange', 'webkitfullscreenchange', 'msfullscreenchange', 'fullscreenerror',\n 'mozfullscreenerror', 'webkitfullscreenerror', 'msfullscreenerror', 'readystatechange',\n 'visibilitychange', 'resume'\n ];\n var windowEventNames = [\n 'absolutedeviceorientation',\n 'afterinput',\n 'afterprint',\n 'appinstalled',\n 'beforeinstallprompt',\n 'beforeprint',\n 'beforeunload',\n 'devicelight',\n 'devicemotion',\n 'deviceorientation',\n 'deviceorientationabsolute',\n 'deviceproximity',\n 'hashchange',\n 'languagechange',\n 'message',\n 'mozbeforepaint',\n 'offline',\n 'online',\n 'paint',\n 'pageshow',\n 'pagehide',\n 'popstate',\n 'rejectionhandled',\n 'storage',\n 'unhandledrejection',\n 'unload',\n 'userproximity',\n 'vrdisplayconnected',\n 'vrdisplaydisconnected',\n 'vrdisplaypresentchange'\n ];\n var htmlElementEventNames = [\n 'beforecopy', 'beforecut', 'beforepaste', 'copy', 'cut', 'paste', 'dragstart', 'loadend',\n 'animationstart', 'search', 'transitionrun', 'transitionstart', 'webkitanimationend',\n 'webkitanimationiteration', 'webkitanimationstart', 'webkittransitionend'\n ];\n var mediaElementEventNames = ['encrypted', 'waitingforkey', 'msneedkey', 'mozinterruptbegin', 'mozinterruptend'];\n var ieElementEventNames = [\n 'activate',\n 'afterupdate',\n 'ariarequest',\n 'beforeactivate',\n 'beforedeactivate',\n 'beforeeditfocus',\n 'beforeupdate',\n 'cellchange',\n 'controlselect',\n 'dataavailable',\n 'datasetchanged',\n 'datasetcomplete',\n 'errorupdate',\n 'filterchange',\n 'layoutcomplete',\n 'losecapture',\n 'move',\n 'moveend',\n 'movestart',\n 'propertychange',\n 'resizeend',\n 'resizestart',\n 'rowenter',\n 'rowexit',\n 'rowsdelete',\n 'rowsinserted',\n 'command',\n 'compassneedscalibration',\n 'deactivate',\n 'help',\n 'mscontentzoom',\n 'msmanipulationstatechanged',\n 'msgesturechange',\n 'msgesturedoubletap',\n 'msgestureend',\n 'msgesturehold',\n 'msgesturestart',\n 'msgesturetap',\n 'msgotpointercapture',\n 'msinertiastart',\n 'mslostpointercapture',\n 'mspointercancel',\n 'mspointerdown',\n 'mspointerenter',\n 'mspointerhover',\n 'mspointerleave',\n 'mspointermove',\n 'mspointerout',\n 'mspointerover',\n 'mspointerup',\n 'pointerout',\n 'mssitemodejumplistitemremoved',\n 'msthumbnailclick',\n 'stop',\n 'storagecommit'\n ];\n var webglEventNames = ['webglcontextrestored', 'webglcontextlost', 'webglcontextcreationerror'];\n var formEventNames = ['autocomplete', 'autocompleteerror'];\n var detailEventNames = ['toggle'];\n var frameEventNames = ['load'];\n var frameSetEventNames = ['blur', 'error', 'focus', 'load', 'resize', 'scroll', 'messageerror'];\n var marqueeEventNames = ['bounce', 'finish', 'start'];\n var XMLHttpRequestEventNames = [\n 'loadstart', 'progress', 'abort', 'error', 'load', 'progress', 'timeout', 'loadend',\n 'readystatechange'\n ];\n var IDBIndexEventNames = ['upgradeneeded', 'complete', 'abort', 'success', 'error', 'blocked', 'versionchange', 'close'];\n var websocketEventNames = ['close', 'error', 'open', 'message'];\n var workerEventNames = ['error', 'message'];\n var eventNames = globalEventHandlersEventNames.concat(webglEventNames, formEventNames, detailEventNames, documentEventNames, windowEventNames, htmlElementEventNames, ieElementEventNames);\n function filterProperties(target, onProperties, ignoreProperties) {\n if (!ignoreProperties || ignoreProperties.length === 0) {\n return onProperties;\n }\n var tip = ignoreProperties.filter(function (ip) { return ip.target === target; });\n if (!tip || tip.length === 0) {\n return onProperties;\n }\n var targetIgnoreProperties = tip[0].ignoreProperties;\n return onProperties.filter(function (op) { return targetIgnoreProperties.indexOf(op) === -1; });\n }\n function patchFilteredProperties(target, onProperties, ignoreProperties, prototype) {\n // check whether target is available, sometimes target will be undefined\n // because different browser or some 3rd party plugin.\n if (!target) {\n return;\n }\n var filteredProperties = filterProperties(target, onProperties, ignoreProperties);\n patchOnProperties(target, filteredProperties, prototype);\n }\n function propertyDescriptorPatch(api, _global) {\n if (isNode && !isMix) {\n return;\n }\n if (Zone[api.symbol('patchEvents')]) {\n // events are already been patched by legacy patch.\n return;\n }\n var supportsWebSocket = typeof WebSocket !== 'undefined';\n var ignoreProperties = _global['__Zone_ignore_on_properties'];\n // for browsers that we can patch the descriptor: Chrome & Firefox\n if (isBrowser) {\n var internalWindow_1 = window;\n var ignoreErrorProperties = isIE() ? [{ target: internalWindow_1, ignoreProperties: ['error'] }] : [];\n // in IE/Edge, onProp not exist in window object, but in WindowPrototype\n // so we need to pass WindowPrototype to check onProp exist or not\n patchFilteredProperties(internalWindow_1, eventNames.concat(['messageerror']), ignoreProperties ? ignoreProperties.concat(ignoreErrorProperties) : ignoreProperties, ObjectGetPrototypeOf(internalWindow_1));\n patchFilteredProperties(Document.prototype, eventNames, ignoreProperties);\n if (typeof internalWindow_1['SVGElement'] !== 'undefined') {\n patchFilteredProperties(internalWindow_1['SVGElement'].prototype, eventNames, ignoreProperties);\n }\n patchFilteredProperties(Element.prototype, eventNames, ignoreProperties);\n patchFilteredProperties(HTMLElement.prototype, eventNames, ignoreProperties);\n patchFilteredProperties(HTMLMediaElement.prototype, mediaElementEventNames, ignoreProperties);\n patchFilteredProperties(HTMLFrameSetElement.prototype, windowEventNames.concat(frameSetEventNames), ignoreProperties);\n patchFilteredProperties(HTMLBodyElement.prototype, windowEventNames.concat(frameSetEventNames), ignoreProperties);\n patchFilteredProperties(HTMLFrameElement.prototype, frameEventNames, ignoreProperties);\n patchFilteredProperties(HTMLIFrameElement.prototype, frameEventNames, ignoreProperties);\n var HTMLMarqueeElement_1 = internalWindow_1['HTMLMarqueeElement'];\n if (HTMLMarqueeElement_1) {\n patchFilteredProperties(HTMLMarqueeElement_1.prototype, marqueeEventNames, ignoreProperties);\n }\n var Worker_1 = internalWindow_1['Worker'];\n if (Worker_1) {\n patchFilteredProperties(Worker_1.prototype, workerEventNames, ignoreProperties);\n }\n }\n var XMLHttpRequest = _global['XMLHttpRequest'];\n if (XMLHttpRequest) {\n // XMLHttpRequest is not available in ServiceWorker, so we need to check here\n patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties);\n }\n var XMLHttpRequestEventTarget = _global['XMLHttpRequestEventTarget'];\n if (XMLHttpRequestEventTarget) {\n patchFilteredProperties(XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype, XMLHttpRequestEventNames, ignoreProperties);\n }\n if (typeof IDBIndex !== 'undefined') {\n patchFilteredProperties(IDBIndex.prototype, IDBIndexEventNames, ignoreProperties);\n patchFilteredProperties(IDBRequest.prototype, IDBIndexEventNames, ignoreProperties);\n patchFilteredProperties(IDBOpenDBRequest.prototype, IDBIndexEventNames, ignoreProperties);\n patchFilteredProperties(IDBDatabase.prototype, IDBIndexEventNames, ignoreProperties);\n patchFilteredProperties(IDBTransaction.prototype, IDBIndexEventNames, ignoreProperties);\n patchFilteredProperties(IDBCursor.prototype, IDBIndexEventNames, ignoreProperties);\n }\n if (supportsWebSocket) {\n patchFilteredProperties(WebSocket.prototype, websocketEventNames, ignoreProperties);\n }\n }\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n Zone.__load_patch('util', function (global, Zone, api) {\n api.patchOnProperties = patchOnProperties;\n api.patchMethod = patchMethod;\n api.bindArguments = bindArguments;\n api.patchMacroTask = patchMacroTask;\n // In earlier version of zone.js (<0.9.0), we use env name `__zone_symbol__BLACK_LISTED_EVENTS` to\n // define which events will not be patched by `Zone.js`.\n // In newer version (>=0.9.0), we change the env name to `__zone_symbol__UNPATCHED_EVENTS` to keep\n // the name consistent with angular repo.\n // The `__zone_symbol__BLACK_LISTED_EVENTS` is deprecated, but it is still be supported for\n // backwards compatibility.\n var SYMBOL_BLACK_LISTED_EVENTS = Zone.__symbol__('BLACK_LISTED_EVENTS');\n var SYMBOL_UNPATCHED_EVENTS = Zone.__symbol__('UNPATCHED_EVENTS');\n if (global[SYMBOL_UNPATCHED_EVENTS]) {\n global[SYMBOL_BLACK_LISTED_EVENTS] = global[SYMBOL_UNPATCHED_EVENTS];\n }\n if (global[SYMBOL_BLACK_LISTED_EVENTS]) {\n Zone[SYMBOL_BLACK_LISTED_EVENTS] = Zone[SYMBOL_UNPATCHED_EVENTS] =\n global[SYMBOL_BLACK_LISTED_EVENTS];\n }\n api.patchEventPrototype = patchEventPrototype;\n api.patchEventTarget = patchEventTarget;\n api.isIEOrEdge = isIEOrEdge;\n api.ObjectDefineProperty = ObjectDefineProperty;\n api.ObjectGetOwnPropertyDescriptor = ObjectGetOwnPropertyDescriptor;\n api.ObjectCreate = ObjectCreate;\n api.ArraySlice = ArraySlice;\n api.patchClass = patchClass;\n api.wrapWithCurrentZone = wrapWithCurrentZone;\n api.filterProperties = filterProperties;\n api.attachOriginToPatched = attachOriginToPatched;\n api._redefineProperty = Object.defineProperty;\n api.patchCallbacks = patchCallbacks;\n api.getGlobalObjects = function () { return ({\n globalSources: globalSources,\n zoneSymbolEventNames: zoneSymbolEventNames$1,\n eventNames: eventNames,\n isBrowser: isBrowser,\n isMix: isMix,\n isNode: isNode,\n TRUE_STR: TRUE_STR,\n FALSE_STR: FALSE_STR,\n ZONE_SYMBOL_PREFIX: ZONE_SYMBOL_PREFIX,\n ADD_EVENT_LISTENER_STR: ADD_EVENT_LISTENER_STR,\n REMOVE_EVENT_LISTENER_STR: REMOVE_EVENT_LISTENER_STR\n }); };\n });\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n /*\n * This is necessary for Chrome and Chrome mobile, to enable\n * things like redefining `createdCallback` on an element.\n */\n var zoneSymbol$1;\n var _defineProperty;\n var _getOwnPropertyDescriptor;\n var _create;\n var unconfigurablesKey;\n function propertyPatch() {\n zoneSymbol$1 = Zone.__symbol__;\n _defineProperty = Object[zoneSymbol$1('defineProperty')] = Object.defineProperty;\n _getOwnPropertyDescriptor = Object[zoneSymbol$1('getOwnPropertyDescriptor')] =\n Object.getOwnPropertyDescriptor;\n _create = Object.create;\n unconfigurablesKey = zoneSymbol$1('unconfigurables');\n Object.defineProperty = function (obj, prop, desc) {\n if (isUnconfigurable(obj, prop)) {\n throw new TypeError('Cannot assign to read only property \\'' + prop + '\\' of ' + obj);\n }\n var originalConfigurableFlag = desc.configurable;\n if (prop !== 'prototype') {\n desc = rewriteDescriptor(obj, prop, desc);\n }\n return _tryDefineProperty(obj, prop, desc, originalConfigurableFlag);\n };\n Object.defineProperties = function (obj, props) {\n Object.keys(props).forEach(function (prop) {\n Object.defineProperty(obj, prop, props[prop]);\n });\n return obj;\n };\n Object.create = function (obj, proto) {\n if (typeof proto === 'object' && !Object.isFrozen(proto)) {\n Object.keys(proto).forEach(function (prop) {\n proto[prop] = rewriteDescriptor(obj, prop, proto[prop]);\n });\n }\n return _create(obj, proto);\n };\n Object.getOwnPropertyDescriptor = function (obj, prop) {\n var desc = _getOwnPropertyDescriptor(obj, prop);\n if (desc && isUnconfigurable(obj, prop)) {\n desc.configurable = false;\n }\n return desc;\n };\n }\n function _redefineProperty(obj, prop, desc) {\n var originalConfigurableFlag = desc.configurable;\n desc = rewriteDescriptor(obj, prop, desc);\n return _tryDefineProperty(obj, prop, desc, originalConfigurableFlag);\n }\n function isUnconfigurable(obj, prop) {\n return obj && obj[unconfigurablesKey] && obj[unconfigurablesKey][prop];\n }\n function rewriteDescriptor(obj, prop, desc) {\n // issue-927, if the desc is frozen, don't try to change the desc\n if (!Object.isFrozen(desc)) {\n desc.configurable = true;\n }\n if (!desc.configurable) {\n // issue-927, if the obj is frozen, don't try to set the desc to obj\n if (!obj[unconfigurablesKey] && !Object.isFrozen(obj)) {\n _defineProperty(obj, unconfigurablesKey, { writable: true, value: {} });\n }\n if (obj[unconfigurablesKey]) {\n obj[unconfigurablesKey][prop] = true;\n }\n }\n return desc;\n }\n function _tryDefineProperty(obj, prop, desc, originalConfigurableFlag) {\n try {\n return _defineProperty(obj, prop, desc);\n }\n catch (error) {\n if (desc.configurable) {\n // In case of errors, when the configurable flag was likely set by rewriteDescriptor(), let's\n // retry with the original flag value\n if (typeof originalConfigurableFlag == 'undefined') {\n delete desc.configurable;\n }\n else {\n desc.configurable = originalConfigurableFlag;\n }\n try {\n return _defineProperty(obj, prop, desc);\n }\n catch (error) {\n var swallowError = false;\n if (prop === 'createdCallback' || prop === 'attachedCallback' ||\n prop === 'detachedCallback' || prop === 'attributeChangedCallback') {\n // We only swallow the error in registerElement patch\n // this is the work around since some applications\n // fail if we throw the error\n swallowError = true;\n }\n if (!swallowError) {\n throw error;\n }\n // TODO: @JiaLiPassion, Some application such as `registerElement` patch\n // still need to swallow the error, in the future after these applications\n // are updated, the following logic can be removed.\n var descJson = null;\n try {\n descJson = JSON.stringify(desc);\n }\n catch (error) {\n descJson = desc.toString();\n }\n console.log(\"Attempting to configure '\" + prop + \"' with descriptor '\" + descJson + \"' on object '\" + obj + \"' and got error, giving up: \" + error);\n }\n }\n else {\n throw error;\n }\n }\n }\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n function eventTargetLegacyPatch(_global, api) {\n var _a = api.getGlobalObjects(), eventNames = _a.eventNames, globalSources = _a.globalSources, zoneSymbolEventNames = _a.zoneSymbolEventNames, TRUE_STR = _a.TRUE_STR, FALSE_STR = _a.FALSE_STR, ZONE_SYMBOL_PREFIX = _a.ZONE_SYMBOL_PREFIX;\n var WTF_ISSUE_555 = 'Anchor,Area,Audio,BR,Base,BaseFont,Body,Button,Canvas,Content,DList,Directory,Div,Embed,FieldSet,Font,Form,Frame,FrameSet,HR,Head,Heading,Html,IFrame,Image,Input,Keygen,LI,Label,Legend,Link,Map,Marquee,Media,Menu,Meta,Meter,Mod,OList,Object,OptGroup,Option,Output,Paragraph,Pre,Progress,Quote,Script,Select,Source,Span,Style,TableCaption,TableCell,TableCol,Table,TableRow,TableSection,TextArea,Title,Track,UList,Unknown,Video';\n var NO_EVENT_TARGET = 'ApplicationCache,EventSource,FileReader,InputMethodContext,MediaController,MessagePort,Node,Performance,SVGElementInstance,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebKitNamedFlow,Window,Worker,WorkerGlobalScope,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload,IDBRequest,IDBOpenDBRequest,IDBDatabase,IDBTransaction,IDBCursor,DBIndex,WebSocket'\n .split(',');\n var EVENT_TARGET = 'EventTarget';\n var apis = [];\n var isWtf = _global['wtf'];\n var WTF_ISSUE_555_ARRAY = WTF_ISSUE_555.split(',');\n if (isWtf) {\n // Workaround for: https://github.com/google/tracing-framework/issues/555\n apis = WTF_ISSUE_555_ARRAY.map(function (v) { return 'HTML' + v + 'Element'; }).concat(NO_EVENT_TARGET);\n }\n else if (_global[EVENT_TARGET]) {\n apis.push(EVENT_TARGET);\n }\n else {\n // Note: EventTarget is not available in all browsers,\n // if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget\n apis = NO_EVENT_TARGET;\n }\n var isDisableIECheck = _global['__Zone_disable_IE_check'] || false;\n var isEnableCrossContextCheck = _global['__Zone_enable_cross_context_check'] || false;\n var ieOrEdge = api.isIEOrEdge();\n var ADD_EVENT_LISTENER_SOURCE = '.addEventListener:';\n var FUNCTION_WRAPPER = '[object FunctionWrapper]';\n var BROWSER_TOOLS = 'function __BROWSERTOOLS_CONSOLE_SAFEFUNC() { [native code] }';\n var pointerEventsMap = {\n 'MSPointerCancel': 'pointercancel',\n 'MSPointerDown': 'pointerdown',\n 'MSPointerEnter': 'pointerenter',\n 'MSPointerHover': 'pointerhover',\n 'MSPointerLeave': 'pointerleave',\n 'MSPointerMove': 'pointermove',\n 'MSPointerOut': 'pointerout',\n 'MSPointerOver': 'pointerover',\n 'MSPointerUp': 'pointerup'\n };\n // predefine all __zone_symbol__ + eventName + true/false string\n for (var i = 0; i < eventNames.length; i++) {\n var eventName = eventNames[i];\n var falseEventName = eventName + FALSE_STR;\n var trueEventName = eventName + TRUE_STR;\n var symbol = ZONE_SYMBOL_PREFIX + falseEventName;\n var symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName;\n zoneSymbolEventNames[eventName] = {};\n zoneSymbolEventNames[eventName][FALSE_STR] = symbol;\n zoneSymbolEventNames[eventName][TRUE_STR] = symbolCapture;\n }\n // predefine all task.source string\n for (var i = 0; i < WTF_ISSUE_555_ARRAY.length; i++) {\n var target = WTF_ISSUE_555_ARRAY[i];\n var targets = globalSources[target] = {};\n for (var j = 0; j < eventNames.length; j++) {\n var eventName = eventNames[j];\n targets[eventName] = target + ADD_EVENT_LISTENER_SOURCE + eventName;\n }\n }\n var checkIEAndCrossContext = function (nativeDelegate, delegate, target, args) {\n if (!isDisableIECheck && ieOrEdge) {\n if (isEnableCrossContextCheck) {\n try {\n var testString = delegate.toString();\n if ((testString === FUNCTION_WRAPPER || testString == BROWSER_TOOLS)) {\n nativeDelegate.apply(target, args);\n return false;\n }\n }\n catch (error) {\n nativeDelegate.apply(target, args);\n return false;\n }\n }\n else {\n var testString = delegate.toString();\n if ((testString === FUNCTION_WRAPPER || testString == BROWSER_TOOLS)) {\n nativeDelegate.apply(target, args);\n return false;\n }\n }\n }\n else if (isEnableCrossContextCheck) {\n try {\n delegate.toString();\n }\n catch (error) {\n nativeDelegate.apply(target, args);\n return false;\n }\n }\n return true;\n };\n var apiTypes = [];\n for (var i = 0; i < apis.length; i++) {\n var type = _global[apis[i]];\n apiTypes.push(type && type.prototype);\n }\n // vh is validateHandler to check event handler\n // is valid or not(for security check)\n api.patchEventTarget(_global, apiTypes, {\n vh: checkIEAndCrossContext,\n transferEventName: function (eventName) {\n var pointerEventName = pointerEventsMap[eventName];\n return pointerEventName || eventName;\n }\n });\n Zone[api.symbol('patchEventTarget')] = !!_global[EVENT_TARGET];\n return true;\n }\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n // we have to patch the instance since the proto is non-configurable\n function apply(api, _global) {\n var _a = api.getGlobalObjects(), ADD_EVENT_LISTENER_STR = _a.ADD_EVENT_LISTENER_STR, REMOVE_EVENT_LISTENER_STR = _a.REMOVE_EVENT_LISTENER_STR;\n var WS = _global.WebSocket;\n // On Safari window.EventTarget doesn't exist so need to patch WS add/removeEventListener\n // On older Chrome, no need since EventTarget was already patched\n if (!_global.EventTarget) {\n api.patchEventTarget(_global, [WS.prototype]);\n }\n _global.WebSocket = function (x, y) {\n var socket = arguments.length > 1 ? new WS(x, y) : new WS(x);\n var proxySocket;\n var proxySocketProto;\n // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance\n var onmessageDesc = api.ObjectGetOwnPropertyDescriptor(socket, 'onmessage');\n if (onmessageDesc && onmessageDesc.configurable === false) {\n proxySocket = api.ObjectCreate(socket);\n // socket have own property descriptor 'onopen', 'onmessage', 'onclose', 'onerror'\n // but proxySocket not, so we will keep socket as prototype and pass it to\n // patchOnProperties method\n proxySocketProto = socket;\n [ADD_EVENT_LISTENER_STR, REMOVE_EVENT_LISTENER_STR, 'send', 'close'].forEach(function (propName) {\n proxySocket[propName] = function () {\n var args = api.ArraySlice.call(arguments);\n if (propName === ADD_EVENT_LISTENER_STR || propName === REMOVE_EVENT_LISTENER_STR) {\n var eventName = args.length > 0 ? args[0] : undefined;\n if (eventName) {\n var propertySymbol = Zone.__symbol__('ON_PROPERTY' + eventName);\n socket[propertySymbol] = proxySocket[propertySymbol];\n }\n }\n return socket[propName].apply(socket, args);\n };\n });\n }\n else {\n // we can patch the real socket\n proxySocket = socket;\n }\n api.patchOnProperties(proxySocket, ['close', 'error', 'message', 'open'], proxySocketProto);\n return proxySocket;\n };\n var globalWebSocket = _global['WebSocket'];\n for (var prop in WS) {\n globalWebSocket[prop] = WS[prop];\n }\n }\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n function propertyDescriptorLegacyPatch(api, _global) {\n var _a = api.getGlobalObjects(), isNode = _a.isNode, isMix = _a.isMix;\n if (isNode && !isMix) {\n return;\n }\n if (!canPatchViaPropertyDescriptor(api, _global)) {\n var supportsWebSocket = typeof WebSocket !== 'undefined';\n // Safari, Android browsers (Jelly Bean)\n patchViaCapturingAllTheEvents(api);\n api.patchClass('XMLHttpRequest');\n if (supportsWebSocket) {\n apply(api, _global);\n }\n Zone[api.symbol('patchEvents')] = true;\n }\n }\n function canPatchViaPropertyDescriptor(api, _global) {\n var _a = api.getGlobalObjects(), isBrowser = _a.isBrowser, isMix = _a.isMix;\n if ((isBrowser || isMix) &&\n !api.ObjectGetOwnPropertyDescriptor(HTMLElement.prototype, 'onclick') &&\n typeof Element !== 'undefined') {\n // WebKit https://bugs.webkit.org/show_bug.cgi?id=134364\n // IDL interface attributes are not configurable\n var desc = api.ObjectGetOwnPropertyDescriptor(Element.prototype, 'onclick');\n if (desc && !desc.configurable)\n return false;\n // try to use onclick to detect whether we can patch via propertyDescriptor\n // because XMLHttpRequest is not available in service worker\n if (desc) {\n api.ObjectDefineProperty(Element.prototype, 'onclick', {\n enumerable: true,\n configurable: true,\n get: function () {\n return true;\n }\n });\n var div = document.createElement('div');\n var result = !!div.onclick;\n api.ObjectDefineProperty(Element.prototype, 'onclick', desc);\n return result;\n }\n }\n var XMLHttpRequest = _global['XMLHttpRequest'];\n if (!XMLHttpRequest) {\n // XMLHttpRequest is not available in service worker\n return false;\n }\n var ON_READY_STATE_CHANGE = 'onreadystatechange';\n var XMLHttpRequestPrototype = XMLHttpRequest.prototype;\n var xhrDesc = api.ObjectGetOwnPropertyDescriptor(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE);\n // add enumerable and configurable here because in opera\n // by default XMLHttpRequest.prototype.onreadystatechange is undefined\n // without adding enumerable and configurable will cause onreadystatechange\n // non-configurable\n // and if XMLHttpRequest.prototype.onreadystatechange is undefined,\n // we should set a real desc instead a fake one\n if (xhrDesc) {\n api.ObjectDefineProperty(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE, {\n enumerable: true,\n configurable: true,\n get: function () {\n return true;\n }\n });\n var req = new XMLHttpRequest();\n var result = !!req.onreadystatechange;\n // restore original desc\n api.ObjectDefineProperty(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE, xhrDesc || {});\n return result;\n }\n else {\n var SYMBOL_FAKE_ONREADYSTATECHANGE_1 = api.symbol('fake');\n api.ObjectDefineProperty(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE, {\n enumerable: true,\n configurable: true,\n get: function () {\n return this[SYMBOL_FAKE_ONREADYSTATECHANGE_1];\n },\n set: function (value) {\n this[SYMBOL_FAKE_ONREADYSTATECHANGE_1] = value;\n }\n });\n var req = new XMLHttpRequest();\n var detectFunc = function () { };\n req.onreadystatechange = detectFunc;\n var result = req[SYMBOL_FAKE_ONREADYSTATECHANGE_1] === detectFunc;\n req.onreadystatechange = null;\n return result;\n }\n }\n // Whenever any eventListener fires, we check the eventListener target and all parents\n // for `onwhatever` properties and replace them with zone-bound functions\n // - Chrome (for now)\n function patchViaCapturingAllTheEvents(api) {\n var eventNames = api.getGlobalObjects().eventNames;\n var unboundKey = api.symbol('unbound');\n var _loop_4 = function (i) {\n var property = eventNames[i];\n var onproperty = 'on' + property;\n self.addEventListener(property, function (event) {\n var elt = event.target, bound, source;\n if (elt) {\n source = elt.constructor['name'] + '.' + onproperty;\n }\n else {\n source = 'unknown.' + onproperty;\n }\n while (elt) {\n if (elt[onproperty] && !elt[onproperty][unboundKey]) {\n bound = api.wrapWithCurrentZone(elt[onproperty], source);\n bound[unboundKey] = elt[onproperty];\n elt[onproperty] = bound;\n }\n elt = elt.parentElement;\n }\n }, true);\n };\n for (var i = 0; i < eventNames.length; i++) {\n _loop_4(i);\n }\n }\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n function registerElementPatch(_global, api) {\n var _a = api.getGlobalObjects(), isBrowser = _a.isBrowser, isMix = _a.isMix;\n if ((!isBrowser && !isMix) || !('registerElement' in _global.document)) {\n return;\n }\n var callbacks = ['createdCallback', 'attachedCallback', 'detachedCallback', 'attributeChangedCallback'];\n api.patchCallbacks(api, document, 'Document', 'registerElement', callbacks);\n }\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n (function (_global) {\n var symbolPrefix = _global['__Zone_symbol_prefix'] || '__zone_symbol__';\n function __symbol__(name) {\n return symbolPrefix + name;\n }\n _global[__symbol__('legacyPatch')] = function () {\n var Zone = _global['Zone'];\n Zone.__load_patch('defineProperty', function (global, Zone, api) {\n api._redefineProperty = _redefineProperty;\n propertyPatch();\n });\n Zone.__load_patch('registerElement', function (global, Zone, api) {\n registerElementPatch(global, api);\n });\n Zone.__load_patch('EventTargetLegacy', function (global, Zone, api) {\n eventTargetLegacyPatch(global, api);\n propertyDescriptorLegacyPatch(api, global);\n });\n };\n })(typeof window !== 'undefined' ?\n window :\n typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {});\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n var taskSymbol = zoneSymbol('zoneTask');\n function patchTimer(window, setName, cancelName, nameSuffix) {\n var setNative = null;\n var clearNative = null;\n setName += nameSuffix;\n cancelName += nameSuffix;\n var tasksByHandleId = {};\n function scheduleTask(task) {\n var data = task.data;\n data.args[0] = function () {\n return task.invoke.apply(this, arguments);\n };\n data.handleId = setNative.apply(window, data.args);\n return task;\n }\n function clearTask(task) {\n return clearNative.call(window, task.data.handleId);\n }\n setNative =\n patchMethod(window, setName, function (delegate) { return function (self, args) {\n if (typeof args[0] === 'function') {\n var options_1 = {\n isPeriodic: nameSuffix === 'Interval',\n delay: (nameSuffix === 'Timeout' || nameSuffix === 'Interval') ? args[1] || 0 :\n undefined,\n args: args\n };\n var callback_1 = args[0];\n args[0] = function timer() {\n try {\n return callback_1.apply(this, arguments);\n }\n finally {\n // issue-934, task will be cancelled\n // even it is a periodic task such as\n // setInterval\n // https://github.com/angular/angular/issues/40387\n // Cleanup tasksByHandleId should be handled before scheduleTask\n // Since some zoneSpec may intercept and doesn't trigger\n // scheduleFn(scheduleTask) provided here.\n if (!(options_1.isPeriodic)) {\n if (typeof options_1.handleId === 'number') {\n // in non-nodejs env, we remove timerId\n // from local cache\n delete tasksByHandleId[options_1.handleId];\n }\n else if (options_1.handleId) {\n // Node returns complex objects as handleIds\n // we remove task reference from timer object\n options_1.handleId[taskSymbol] = null;\n }\n }\n }\n };\n var task = scheduleMacroTaskWithCurrentZone(setName, args[0], options_1, scheduleTask, clearTask);\n if (!task) {\n return task;\n }\n // Node.js must additionally support the ref and unref functions.\n var handle = task.data.handleId;\n if (typeof handle === 'number') {\n // for non nodejs env, we save handleId: task\n // mapping in local cache for clearTimeout\n tasksByHandleId[handle] = task;\n }\n else if (handle) {\n // for nodejs env, we save task\n // reference in timerId Object for clearTimeout\n handle[taskSymbol] = task;\n }\n // check whether handle is null, because some polyfill or browser\n // may return undefined from setTimeout/setInterval/setImmediate/requestAnimationFrame\n if (handle && handle.ref && handle.unref && typeof handle.ref === 'function' &&\n typeof handle.unref === 'function') {\n task.ref = handle.ref.bind(handle);\n task.unref = handle.unref.bind(handle);\n }\n if (typeof handle === 'number' || handle) {\n return handle;\n }\n return task;\n }\n else {\n // cause an error by calling it directly.\n return delegate.apply(window, args);\n }\n }; });\n clearNative =\n patchMethod(window, cancelName, function (delegate) { return function (self, args) {\n var id = args[0];\n var task;\n if (typeof id === 'number') {\n // non nodejs env.\n task = tasksByHandleId[id];\n }\n else {\n // nodejs env.\n task = id && id[taskSymbol];\n // other environments.\n if (!task) {\n task = id;\n }\n }\n if (task && typeof task.type === 'string') {\n if (task.state !== 'notScheduled' &&\n (task.cancelFn && task.data.isPeriodic || task.runCount === 0)) {\n if (typeof id === 'number') {\n delete tasksByHandleId[id];\n }\n else if (id) {\n id[taskSymbol] = null;\n }\n // Do not cancel already canceled functions\n task.zone.cancelTask(task);\n }\n }\n else {\n // cause an error by calling it directly.\n delegate.apply(window, args);\n }\n }; });\n }\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n function patchCustomElements(_global, api) {\n var _a = api.getGlobalObjects(), isBrowser = _a.isBrowser, isMix = _a.isMix;\n if ((!isBrowser && !isMix) || !_global['customElements'] || !('customElements' in _global)) {\n return;\n }\n var callbacks = ['connectedCallback', 'disconnectedCallback', 'adoptedCallback', 'attributeChangedCallback'];\n api.patchCallbacks(api, _global.customElements, 'customElements', 'define', callbacks);\n }\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n function eventTargetPatch(_global, api) {\n if (Zone[api.symbol('patchEventTarget')]) {\n // EventTarget is already patched.\n return;\n }\n var _a = api.getGlobalObjects(), eventNames = _a.eventNames, zoneSymbolEventNames = _a.zoneSymbolEventNames, TRUE_STR = _a.TRUE_STR, FALSE_STR = _a.FALSE_STR, ZONE_SYMBOL_PREFIX = _a.ZONE_SYMBOL_PREFIX;\n // predefine all __zone_symbol__ + eventName + true/false string\n for (var i = 0; i < eventNames.length; i++) {\n var eventName = eventNames[i];\n var falseEventName = eventName + FALSE_STR;\n var trueEventName = eventName + TRUE_STR;\n var symbol = ZONE_SYMBOL_PREFIX + falseEventName;\n var symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName;\n zoneSymbolEventNames[eventName] = {};\n zoneSymbolEventNames[eventName][FALSE_STR] = symbol;\n zoneSymbolEventNames[eventName][TRUE_STR] = symbolCapture;\n }\n var EVENT_TARGET = _global['EventTarget'];\n if (!EVENT_TARGET || !EVENT_TARGET.prototype) {\n return;\n }\n api.patchEventTarget(_global, [EVENT_TARGET && EVENT_TARGET.prototype]);\n return true;\n }\n function patchEvent(global, api) {\n api.patchEventPrototype(global, api);\n }\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n Zone.__load_patch('legacy', function (global) {\n var legacyPatch = global[Zone.__symbol__('legacyPatch')];\n if (legacyPatch) {\n legacyPatch();\n }\n });\n Zone.__load_patch('queueMicrotask', function (global, Zone, api) {\n api.patchMethod(global, 'queueMicrotask', function (delegate) {\n return function (self, args) {\n Zone.current.scheduleMicroTask('queueMicrotask', args[0]);\n };\n });\n });\n Zone.__load_patch('timers', function (global) {\n var set = 'set';\n var clear = 'clear';\n patchTimer(global, set, clear, 'Timeout');\n patchTimer(global, set, clear, 'Interval');\n patchTimer(global, set, clear, 'Immediate');\n });\n Zone.__load_patch('requestAnimationFrame', function (global) {\n patchTimer(global, 'request', 'cancel', 'AnimationFrame');\n patchTimer(global, 'mozRequest', 'mozCancel', 'AnimationFrame');\n patchTimer(global, 'webkitRequest', 'webkitCancel', 'AnimationFrame');\n });\n Zone.__load_patch('blocking', function (global, Zone) {\n var blockingMethods = ['alert', 'prompt', 'confirm'];\n for (var i = 0; i < blockingMethods.length; i++) {\n var name_2 = blockingMethods[i];\n patchMethod(global, name_2, function (delegate, symbol, name) {\n return function (s, args) {\n return Zone.current.run(delegate, global, args, name);\n };\n });\n }\n });\n Zone.__load_patch('EventTarget', function (global, Zone, api) {\n patchEvent(global, api);\n eventTargetPatch(global, api);\n // patch XMLHttpRequestEventTarget's addEventListener/removeEventListener\n var XMLHttpRequestEventTarget = global['XMLHttpRequestEventTarget'];\n if (XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype) {\n api.patchEventTarget(global, [XMLHttpRequestEventTarget.prototype]);\n }\n });\n Zone.__load_patch('MutationObserver', function (global, Zone, api) {\n patchClass('MutationObserver');\n patchClass('WebKitMutationObserver');\n });\n Zone.__load_patch('IntersectionObserver', function (global, Zone, api) {\n patchClass('IntersectionObserver');\n });\n Zone.__load_patch('FileReader', function (global, Zone, api) {\n patchClass('FileReader');\n });\n Zone.__load_patch('on_property', function (global, Zone, api) {\n propertyDescriptorPatch(api, global);\n });\n Zone.__load_patch('customElements', function (global, Zone, api) {\n patchCustomElements(global, api);\n });\n Zone.__load_patch('XHR', function (global, Zone) {\n // Treat XMLHttpRequest as a macrotask.\n patchXHR(global);\n var XHR_TASK = zoneSymbol('xhrTask');\n var XHR_SYNC = zoneSymbol('xhrSync');\n var XHR_LISTENER = zoneSymbol('xhrListener');\n var XHR_SCHEDULED = zoneSymbol('xhrScheduled');\n var XHR_URL = zoneSymbol('xhrURL');\n var XHR_ERROR_BEFORE_SCHEDULED = zoneSymbol('xhrErrorBeforeScheduled');\n function patchXHR(window) {\n var XMLHttpRequest = window['XMLHttpRequest'];\n if (!XMLHttpRequest) {\n // XMLHttpRequest is not available in service worker\n return;\n }\n var XMLHttpRequestPrototype = XMLHttpRequest.prototype;\n function findPendingTask(target) {\n return target[XHR_TASK];\n }\n var oriAddListener = XMLHttpRequestPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];\n var oriRemoveListener = XMLHttpRequestPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];\n if (!oriAddListener) {\n var XMLHttpRequestEventTarget_1 = window['XMLHttpRequestEventTarget'];\n if (XMLHttpRequestEventTarget_1) {\n var XMLHttpRequestEventTargetPrototype = XMLHttpRequestEventTarget_1.prototype;\n oriAddListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];\n oriRemoveListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];\n }\n }\n var READY_STATE_CHANGE = 'readystatechange';\n var SCHEDULED = 'scheduled';\n function scheduleTask(task) {\n var data = task.data;\n var target = data.target;\n target[XHR_SCHEDULED] = false;\n target[XHR_ERROR_BEFORE_SCHEDULED] = false;\n // remove existing event listener\n var listener = target[XHR_LISTENER];\n if (!oriAddListener) {\n oriAddListener = target[ZONE_SYMBOL_ADD_EVENT_LISTENER];\n oriRemoveListener = target[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];\n }\n if (listener) {\n oriRemoveListener.call(target, READY_STATE_CHANGE, listener);\n }\n var newListener = target[XHR_LISTENER] = function () {\n if (target.readyState === target.DONE) {\n // sometimes on some browsers XMLHttpRequest will fire onreadystatechange with\n // readyState=4 multiple times, so we need to check task state here\n if (!data.aborted && target[XHR_SCHEDULED] && task.state === SCHEDULED) {\n // check whether the xhr has registered onload listener\n // if that is the case, the task should invoke after all\n // onload listeners finish.\n // Also if the request failed without response (status = 0), the load event handler\n // will not be triggered, in that case, we should also invoke the placeholder callback\n // to close the XMLHttpRequest::send macroTask.\n // https://github.com/angular/angular/issues/38795\n var loadTasks = target[Zone.__symbol__('loadfalse')];\n if (target.status !== 0 && loadTasks && loadTasks.length > 0) {\n var oriInvoke_1 = task.invoke;\n task.invoke = function () {\n // need to load the tasks again, because in other\n // load listener, they may remove themselves\n var loadTasks = target[Zone.__symbol__('loadfalse')];\n for (var i = 0; i < loadTasks.length; i++) {\n if (loadTasks[i] === task) {\n loadTasks.splice(i, 1);\n }\n }\n if (!data.aborted && task.state === SCHEDULED) {\n oriInvoke_1.call(task);\n }\n };\n loadTasks.push(task);\n }\n else {\n task.invoke();\n }\n }\n else if (!data.aborted && target[XHR_SCHEDULED] === false) {\n // error occurs when xhr.send()\n target[XHR_ERROR_BEFORE_SCHEDULED] = true;\n }\n }\n };\n oriAddListener.call(target, READY_STATE_CHANGE, newListener);\n var storedTask = target[XHR_TASK];\n if (!storedTask) {\n target[XHR_TASK] = task;\n }\n sendNative.apply(target, data.args);\n target[XHR_SCHEDULED] = true;\n return task;\n }\n function placeholderCallback() { }\n function clearTask(task) {\n var data = task.data;\n // Note - ideally, we would call data.target.removeEventListener here, but it's too late\n // to prevent it from firing. So instead, we store info for the event listener.\n data.aborted = true;\n return abortNative.apply(data.target, data.args);\n }\n var openNative = patchMethod(XMLHttpRequestPrototype, 'open', function () { return function (self, args) {\n self[XHR_SYNC] = args[2] == false;\n self[XHR_URL] = args[1];\n return openNative.apply(self, args);\n }; });\n var XMLHTTPREQUEST_SOURCE = 'XMLHttpRequest.send';\n var fetchTaskAborting = zoneSymbol('fetchTaskAborting');\n var fetchTaskScheduling = zoneSymbol('fetchTaskScheduling');\n var sendNative = patchMethod(XMLHttpRequestPrototype, 'send', function () { return function (self, args) {\n if (Zone.current[fetchTaskScheduling] === true) {\n // a fetch is scheduling, so we are using xhr to polyfill fetch\n // and because we already schedule macroTask for fetch, we should\n // not schedule a macroTask for xhr again\n return sendNative.apply(self, args);\n }\n if (self[XHR_SYNC]) {\n // if the XHR is sync there is no task to schedule, just execute the code.\n return sendNative.apply(self, args);\n }\n else {\n var options = { target: self, url: self[XHR_URL], isPeriodic: false, args: args, aborted: false };\n var task = scheduleMacroTaskWithCurrentZone(XMLHTTPREQUEST_SOURCE, placeholderCallback, options, scheduleTask, clearTask);\n if (self && self[XHR_ERROR_BEFORE_SCHEDULED] === true && !options.aborted &&\n task.state === SCHEDULED) {\n // xhr request throw error when send\n // we should invoke task instead of leaving a scheduled\n // pending macroTask\n task.invoke();\n }\n }\n }; });\n var abortNative = patchMethod(XMLHttpRequestPrototype, 'abort', function () { return function (self, args) {\n var task = findPendingTask(self);\n if (task && typeof task.type == 'string') {\n // If the XHR has already completed, do nothing.\n // If the XHR has already been aborted, do nothing.\n // Fix #569, call abort multiple times before done will cause\n // macroTask task count be negative number\n if (task.cancelFn == null || (task.data && task.data.aborted)) {\n return;\n }\n task.zone.cancelTask(task);\n }\n else if (Zone.current[fetchTaskAborting] === true) {\n // the abort is called from fetch polyfill, we need to call native abort of XHR.\n return abortNative.apply(self, args);\n }\n // Otherwise, we are trying to abort an XHR which has not yet been sent, so there is no\n // task\n // to cancel. Do nothing.\n }; });\n }\n });\n Zone.__load_patch('geolocation', function (global) {\n /// GEO_LOCATION\n if (global['navigator'] && global['navigator'].geolocation) {\n patchPrototype(global['navigator'].geolocation, ['getCurrentPosition', 'watchPosition']);\n }\n });\n Zone.__load_patch('PromiseRejectionEvent', function (global, Zone) {\n // handle unhandled promise rejection\n function findPromiseRejectionHandler(evtName) {\n return function (e) {\n var eventTasks = findEventTasks(global, evtName);\n eventTasks.forEach(function (eventTask) {\n // windows has added unhandledrejection event listener\n // trigger the event listener\n var PromiseRejectionEvent = global['PromiseRejectionEvent'];\n if (PromiseRejectionEvent) {\n var evt = new PromiseRejectionEvent(evtName, { promise: e.promise, reason: e.rejection });\n eventTask.invoke(evt);\n }\n });\n };\n }\n if (global['PromiseRejectionEvent']) {\n Zone[zoneSymbol('unhandledPromiseRejectionHandler')] =\n findPromiseRejectionHandler('unhandledrejection');\n Zone[zoneSymbol('rejectionHandledHandler')] =\n findPromiseRejectionHandler('rejectionhandled');\n }\n });\n})));\n","import { Subscriber } from '../Subscriber';\nimport { Subject } from '../Subject';\n\n/**\n * Determines whether the ErrorObserver is closed or stopped or has a\n * destination that is closed or stopped - in which case errors will\n * need to be reported via a different mechanism.\n * @param observer the observer\n */\nexport function canReportError(observer: Subscriber | Subject): boolean {\n while (observer) {\n const { closed, destination, isStopped } = observer as any;\n if (closed || isStopped) {\n return false;\n } else if (destination && destination instanceof Subscriber) {\n observer = destination;\n } else {\n observer = null;\n }\n }\n return true;\n}\n","import { Subject } from './Subject';\nimport { Subscriber } from './Subscriber';\nimport { Subscription } from './Subscription';\nimport { SubscriptionLike } from './types';\nimport { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError';\n\n/**\n * A variant of Subject that requires an initial value and emits its current\n * value whenever it is subscribed to.\n *\n * @class BehaviorSubject\n */\nexport class BehaviorSubject extends Subject {\n\n constructor(private _value: T) {\n super();\n }\n\n get value(): T {\n return this.getValue();\n }\n\n /** @deprecated This is an internal implementation detail, do not use. */\n _subscribe(subscriber: Subscriber): Subscription {\n const subscription = super._subscribe(subscriber);\n if (subscription && !(subscription).closed) {\n subscriber.next(this._value);\n }\n return subscription;\n }\n\n getValue(): T {\n if (this.hasError) {\n throw this.thrownError;\n } else if (this.closed) {\n throw new ObjectUnsubscribedError();\n } else {\n return this._value;\n }\n }\n\n next(value: T): void {\n super.next(this._value = value);\n }\n}\n","export function isFunction(x: any): x is Function {\n return typeof x === 'function';\n}\n","export const isArrayLike = ((x: any): x is ArrayLike => x && typeof x.length === 'number' && typeof x !== 'function');","export interface EmptyError extends Error {\n}\n\nexport interface EmptyErrorCtor {\n new(): EmptyError;\n}\n\nconst EmptyErrorImpl = (() => {\n function EmptyErrorImpl(this: any) {\n Error.call(this);\n this.message = 'no elements in sequence';\n this.name = 'EmptyError';\n return this;\n }\n\n EmptyErrorImpl.prototype = Object.create(Error.prototype);\n\n return EmptyErrorImpl;\n})();\n\n/**\n * An error thrown when an Observable or a sequence was queried but has no\n * elements.\n *\n * @see {@link first}\n * @see {@link last}\n * @see {@link single}\n *\n * @class EmptyError\n */\nexport const EmptyError: EmptyErrorCtor = EmptyErrorImpl as any;","import { PartialObserver } from './types';\nimport { Observable } from './Observable';\nimport { empty } from './observable/empty';\nimport { of } from './observable/of';\nimport { throwError } from './observable/throwError';\nimport { deprecate } from 'util';\n\n// TODO: When this enum is removed, replace it with a type alias. See #4556.\n/**\n * @deprecated NotificationKind is deprecated as const enums are not compatible with isolated modules. Use a string literal instead.\n */\nexport enum NotificationKind {\n NEXT = 'N',\n ERROR = 'E',\n COMPLETE = 'C',\n}\n\n/**\n * Represents a push-based event or value that an {@link Observable} can emit.\n * This class is particularly useful for operators that manage notifications,\n * like {@link materialize}, {@link dematerialize}, {@link observeOn}, and\n * others. Besides wrapping the actual delivered value, it also annotates it\n * with metadata of, for instance, what type of push message it is (`next`,\n * `error`, or `complete`).\n *\n * @see {@link materialize}\n * @see {@link dematerialize}\n * @see {@link observeOn}\n *\n * @class Notification\n */\nexport class Notification {\n hasValue: boolean;\n\n constructor(public kind: 'N' | 'E' | 'C', public value?: T, public error?: any) {\n this.hasValue = kind === 'N';\n }\n\n /**\n * Delivers to the given `observer` the value wrapped by this Notification.\n * @param {Observer} observer\n * @return\n */\n observe(observer: PartialObserver): any {\n switch (this.kind) {\n case 'N':\n return observer.next && observer.next(this.value);\n case 'E':\n return observer.error && observer.error(this.error);\n case 'C':\n return observer.complete && observer.complete();\n }\n }\n\n /**\n * Given some {@link Observer} callbacks, deliver the value represented by the\n * current Notification to the correctly corresponding callback.\n * @param {function(value: T): void} next An Observer `next` callback.\n * @param {function(err: any): void} [error] An Observer `error` callback.\n * @param {function(): void} [complete] An Observer `complete` callback.\n * @return {any}\n */\n do(next: (value: T) => void, error?: (err: any) => void, complete?: () => void): any {\n const kind = this.kind;\n switch (kind) {\n case 'N':\n return next && next(this.value);\n case 'E':\n return error && error(this.error);\n case 'C':\n return complete && complete();\n }\n }\n\n /**\n * Takes an Observer or its individual callback functions, and calls `observe`\n * or `do` methods accordingly.\n * @param {Observer|function(value: T): void} nextOrObserver An Observer or\n * the `next` callback.\n * @param {function(err: any): void} [error] An Observer `error` callback.\n * @param {function(): void} [complete] An Observer `complete` callback.\n * @return {any}\n */\n accept(nextOrObserver: PartialObserver | ((value: T) => void), error?: (err: any) => void, complete?: () => void) {\n if (nextOrObserver && typeof (>nextOrObserver).next === 'function') {\n return this.observe(>nextOrObserver);\n } else {\n return this.do(<(value: T) => void>nextOrObserver, error, complete);\n }\n }\n\n /**\n * Returns a simple Observable that just delivers the notification represented\n * by this Notification instance.\n * @return {any}\n */\n toObservable(): Observable {\n const kind = this.kind;\n switch (kind) {\n case 'N':\n return of(this.value);\n case 'E':\n return throwError(this.error);\n case 'C':\n return empty();\n }\n throw new Error('unexpected notification kind value');\n }\n\n private static completeNotification: Notification = new Notification('C');\n private static undefinedValueNotification: Notification = new Notification('N', undefined);\n\n /**\n * A shortcut to create a Notification instance of the type `next` from a\n * given value.\n * @param {T} value The `next` value.\n * @return {Notification} The \"next\" Notification representing the\n * argument.\n * @nocollapse\n */\n static createNext(value: T): Notification {\n if (typeof value !== 'undefined') {\n return new Notification('N', value);\n }\n return Notification.undefinedValueNotification;\n }\n\n /**\n * A shortcut to create a Notification instance of the type `error` from a\n * given error.\n * @param {any} [err] The `error` error.\n * @return {Notification} The \"error\" Notification representing the\n * argument.\n * @nocollapse\n */\n static createError(err?: any): Notification {\n return new Notification('E', undefined, err);\n }\n\n /**\n * A shortcut to create a Notification instance of the type `complete`.\n * @return {Notification} The valueless \"complete\" Notification.\n * @nocollapse\n */\n static createComplete(): Notification {\n return Notification.completeNotification;\n }\n}\n","import { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { Observable } from '../Observable';\nimport { OperatorFunction } from '../types';\n\n/**\n * Applies a given `project` function to each value emitted by the source\n * Observable, and emits the resulting values as an Observable.\n *\n * Like [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map),\n * it passes each source value through a transformation function to get\n * corresponding output values.\n *\n * ![](map.png)\n *\n * Similar to the well known `Array.prototype.map` function, this operator\n * applies a projection to each value and emits that projection in the output\n * Observable.\n *\n * ## Example\n * Map every click to the clientX position of that click\n * ```ts\n * import { fromEvent } from 'rxjs';\n * import { map } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const positions = clicks.pipe(map(ev => ev.clientX));\n * positions.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link mapTo}\n * @see {@link pluck}\n *\n * @param {function(value: T, index: number): R} project The function to apply\n * to each `value` emitted by the source Observable. The `index` parameter is\n * the number `i` for the i-th emission that has happened since the\n * subscription, starting from the number `0`.\n * @param {any} [thisArg] An optional argument to define what `this` is in the\n * `project` function.\n * @return {Observable} An Observable that emits the values from the source\n * Observable transformed by the given `project` function.\n * @method map\n * @owner Observable\n */\nexport function map(project: (value: T, index: number) => R, thisArg?: any): OperatorFunction {\n return function mapOperation(source: Observable): Observable {\n if (typeof project !== 'function') {\n throw new TypeError('argument is not a function. Are you looking for `mapTo()`?');\n }\n return source.lift(new MapOperator(project, thisArg));\n };\n}\n\nexport class MapOperator implements Operator {\n constructor(private project: (value: T, index: number) => R, private thisArg: any) {\n }\n\n call(subscriber: Subscriber, source: any): any {\n return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass MapSubscriber extends Subscriber {\n count: number = 0;\n private thisArg: any;\n\n constructor(destination: Subscriber,\n private project: (value: T, index: number) => R,\n thisArg: any) {\n super(destination);\n this.thisArg = thisArg || this;\n }\n\n // NOTE: This looks unoptimized, but it's actually purposefully NOT\n // using try/catch optimizations.\n protected _next(value: T) {\n let result: R;\n try {\n result = this.project.call(this.thisArg, value, this.count++);\n } catch (err) {\n this.destination.error(err);\n return;\n }\n this.destination.next(result);\n }\n}\n","import { Observer } from './types';\nimport { config } from './config';\nimport { hostReportError } from './util/hostReportError';\n\nexport const empty: Observer = {\n closed: true,\n next(value: any): void { /* noop */},\n error(err: any): void {\n if (config.useDeprecatedSynchronousErrorHandling) {\n throw err;\n } else {\n hostReportError(err);\n }\n },\n complete(): void { /*noop*/ }\n};\n","import { Operator } from './Operator';\nimport { Subscriber } from './Subscriber';\nimport { Subscription } from './Subscription';\nimport { TeardownLogic, OperatorFunction, PartialObserver, Subscribable } from './types';\nimport { canReportError } from './util/canReportError';\nimport { toSubscriber } from './util/toSubscriber';\nimport { iif } from './observable/iif';\nimport { throwError } from './observable/throwError';\nimport { observable as Symbol_observable } from './symbol/observable';\nimport { pipeFromArray } from './util/pipe';\nimport { config } from './config';\n\n/**\n * A representation of any set of values over any amount of time. This is the most basic building block\n * of RxJS.\n *\n * @class Observable\n */\nexport class Observable implements Subscribable {\n\n /** Internal implementation detail, do not use directly. */\n public _isScalar: boolean = false;\n\n /** @deprecated This is an internal implementation detail, do not use. */\n source: Observable;\n\n /** @deprecated This is an internal implementation detail, do not use. */\n operator: Operator;\n\n /**\n * @constructor\n * @param {Function} subscribe the function that is called when the Observable is\n * initially subscribed to. This function is given a Subscriber, to which new values\n * can be `next`ed, or an `error` method can be called to raise an error, or\n * `complete` can be called to notify of a successful completion.\n */\n constructor(subscribe?: (this: Observable, subscriber: Subscriber) => TeardownLogic) {\n if (subscribe) {\n this._subscribe = subscribe;\n }\n }\n\n // HACK: Since TypeScript inherits static properties too, we have to\n // fight against TypeScript here so Subject can have a different static create signature\n /**\n * Creates a new cold Observable by calling the Observable constructor\n * @static true\n * @owner Observable\n * @method create\n * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor\n * @return {Observable} a new cold observable\n * @nocollapse\n * @deprecated use new Observable() instead\n */\n static create: Function = (subscribe?: (subscriber: Subscriber) => TeardownLogic) => {\n return new Observable(subscribe);\n }\n\n /**\n * Creates a new Observable, with this Observable as the source, and the passed\n * operator defined as the new observable's operator.\n * @method lift\n * @param {Operator} operator the operator defining the operation to take on the observable\n * @return {Observable} a new observable with the Operator applied\n */\n lift(operator: Operator): Observable {\n const observable = new Observable();\n observable.source = this;\n observable.operator = operator;\n return observable;\n }\n\n subscribe(observer?: PartialObserver): Subscription;\n /** @deprecated Use an observer instead of a complete callback */\n subscribe(next: null | undefined, error: null | undefined, complete: () => void): Subscription;\n /** @deprecated Use an observer instead of an error callback */\n subscribe(next: null | undefined, error: (error: any) => void, complete?: () => void): Subscription;\n /** @deprecated Use an observer instead of a complete callback */\n subscribe(next: (value: T) => void, error: null | undefined, complete: () => void): Subscription;\n subscribe(next?: (value: T) => void, error?: (error: any) => void, complete?: () => void): Subscription;\n /**\n * Invokes an execution of an Observable and registers Observer handlers for notifications it will emit.\n *\n * Use it when you have all these Observables, but still nothing is happening.\n *\n * `subscribe` is not a regular operator, but a method that calls Observable's internal `subscribe` function. It\n * might be for example a function that you passed to Observable's constructor, but most of the time it is\n * a library implementation, which defines what will be emitted by an Observable, and when it be will emitted. This means\n * that calling `subscribe` is actually the moment when Observable starts its work, not when it is created, as it is often\n * the thought.\n *\n * Apart from starting the execution of an Observable, this method allows you to listen for values\n * that an Observable emits, as well as for when it completes or errors. You can achieve this in two\n * of the following ways.\n *\n * The first way is creating an object that implements {@link Observer} interface. It should have methods\n * defined by that interface, but note that it should be just a regular JavaScript object, which you can create\n * yourself in any way you want (ES6 class, classic function constructor, object literal etc.). In particular do\n * not attempt to use any RxJS implementation details to create Observers - you don't need them. Remember also\n * that your object does not have to implement all methods. If you find yourself creating a method that doesn't\n * do anything, you can simply omit it. Note however, if the `error` method is not provided, all errors will\n * be left uncaught.\n *\n * The second way is to give up on Observer object altogether and simply provide callback functions in place of its methods.\n * This means you can provide three functions as arguments to `subscribe`, where the first function is equivalent\n * of a `next` method, the second of an `error` method and the third of a `complete` method. Just as in case of Observer,\n * if you do not need to listen for something, you can omit a function, preferably by passing `undefined` or `null`,\n * since `subscribe` recognizes these functions by where they were placed in function call. When it comes\n * to `error` function, just as before, if not provided, errors emitted by an Observable will be thrown.\n *\n * Whichever style of calling `subscribe` you use, in both cases it returns a Subscription object.\n * This object allows you to call `unsubscribe` on it, which in turn will stop the work that an Observable does and will clean\n * up all resources that an Observable used. Note that cancelling a subscription will not call `complete` callback\n * provided to `subscribe` function, which is reserved for a regular completion signal that comes from an Observable.\n *\n * Remember that callbacks provided to `subscribe` are not guaranteed to be called asynchronously.\n * It is an Observable itself that decides when these functions will be called. For example {@link of}\n * by default emits all its values synchronously. Always check documentation for how given Observable\n * will behave when subscribed and if its default behavior can be modified with a `scheduler`.\n *\n * ## Example\n * ### Subscribe with an Observer\n * ```ts\n * import { of } from 'rxjs';\n *\n * const sumObserver = {\n * sum: 0,\n * next(value) {\n * console.log('Adding: ' + value);\n * this.sum = this.sum + value;\n * },\n * error() {\n * // We actually could just remove this method,\n * // since we do not really care about errors right now.\n * },\n * complete() {\n * console.log('Sum equals: ' + this.sum);\n * }\n * };\n *\n * of(1, 2, 3) // Synchronously emits 1, 2, 3 and then completes.\n * .subscribe(sumObserver);\n *\n * // Logs:\n * // \"Adding: 1\"\n * // \"Adding: 2\"\n * // \"Adding: 3\"\n * // \"Sum equals: 6\"\n * ```\n *\n * ### Subscribe with functions\n * ```ts\n * import { of } from 'rxjs'\n *\n * let sum = 0;\n *\n * of(1, 2, 3).subscribe(\n * value => {\n * console.log('Adding: ' + value);\n * sum = sum + value;\n * },\n * undefined,\n * () => console.log('Sum equals: ' + sum)\n * );\n *\n * // Logs:\n * // \"Adding: 1\"\n * // \"Adding: 2\"\n * // \"Adding: 3\"\n * // \"Sum equals: 6\"\n * ```\n *\n * ### Cancel a subscription\n * ```ts\n * import { interval } from 'rxjs';\n *\n * const subscription = interval(1000).subscribe(\n * num => console.log(num),\n * undefined,\n * () => {\n * // Will not be called, even when cancelling subscription.\n * console.log('completed!');\n * }\n * );\n *\n * setTimeout(() => {\n * subscription.unsubscribe();\n * console.log('unsubscribed!');\n * }, 2500);\n *\n * // Logs:\n * // 0 after 1s\n * // 1 after 2s\n * // \"unsubscribed!\" after 2.5s\n * ```\n *\n * @param {Observer|Function} observerOrNext (optional) Either an observer with methods to be called,\n * or the first of three possible handlers, which is the handler for each value emitted from the subscribed\n * Observable.\n * @param {Function} error (optional) A handler for a terminal event resulting from an error. If no error handler is provided,\n * the error will be thrown as unhandled.\n * @param {Function} complete (optional) A handler for a terminal event resulting from successful completion.\n * @return {ISubscription} a subscription reference to the registered handlers\n * @method subscribe\n */\n subscribe(observerOrNext?: PartialObserver | ((value: T) => void),\n error?: (error: any) => void,\n complete?: () => void): Subscription {\n\n const { operator } = this;\n const sink = toSubscriber(observerOrNext, error, complete);\n\n if (operator) {\n sink.add(operator.call(sink, this.source));\n } else {\n sink.add(\n this.source || (config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?\n this._subscribe(sink) :\n this._trySubscribe(sink)\n );\n }\n\n if (config.useDeprecatedSynchronousErrorHandling) {\n if (sink.syncErrorThrowable) {\n sink.syncErrorThrowable = false;\n if (sink.syncErrorThrown) {\n throw sink.syncErrorValue;\n }\n }\n }\n\n return sink;\n }\n\n /** @deprecated This is an internal implementation detail, do not use. */\n _trySubscribe(sink: Subscriber): TeardownLogic {\n try {\n return this._subscribe(sink);\n } catch (err) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n sink.syncErrorThrown = true;\n sink.syncErrorValue = err;\n }\n if (canReportError(sink)) {\n sink.error(err);\n } else {\n console.warn(err);\n }\n }\n }\n\n /**\n * @method forEach\n * @param {Function} next a handler for each value emitted by the observable\n * @param {PromiseConstructor} [promiseCtor] a constructor function used to instantiate the Promise\n * @return {Promise} a promise that either resolves on observable completion or\n * rejects with the handled error\n */\n forEach(next: (value: T) => void, promiseCtor?: PromiseConstructorLike): Promise {\n promiseCtor = getPromiseCtor(promiseCtor);\n\n return new promiseCtor((resolve, reject) => {\n // Must be declared in a separate statement to avoid a ReferenceError when\n // accessing subscription below in the closure due to Temporal Dead Zone.\n let subscription: Subscription;\n subscription = this.subscribe((value) => {\n try {\n next(value);\n } catch (err) {\n reject(err);\n if (subscription) {\n subscription.unsubscribe();\n }\n }\n }, reject, resolve);\n }) as Promise;\n }\n\n /** @internal This is an internal implementation detail, do not use. */\n _subscribe(subscriber: Subscriber): TeardownLogic {\n const { source } = this;\n return source && source.subscribe(subscriber);\n }\n\n // `if` and `throw` are special snow flakes, the compiler sees them as reserved words. Deprecated in\n // favor of iif and throwError functions.\n /**\n * @nocollapse\n * @deprecated In favor of iif creation function: import { iif } from 'rxjs';\n */\n static if: typeof iif;\n /**\n * @nocollapse\n * @deprecated In favor of throwError creation function: import { throwError } from 'rxjs';\n */\n static throw: typeof throwError;\n\n /**\n * An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable\n * @method Symbol.observable\n * @return {Observable} this instance of the observable\n */\n [Symbol_observable]() {\n return this;\n }\n\n /* tslint:disable:max-line-length */\n pipe(): Observable;\n pipe(op1: OperatorFunction): Observable;\n pipe(op1: OperatorFunction, op2: OperatorFunction): Observable;\n pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction): Observable;\n pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction): Observable;\n pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction, op5: OperatorFunction): Observable;\n pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction, op5: OperatorFunction, op6: OperatorFunction): Observable;\n pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction, op5: OperatorFunction, op6: OperatorFunction, op7: OperatorFunction): Observable;\n pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction, op5: OperatorFunction, op6: OperatorFunction, op7: OperatorFunction, op8: OperatorFunction): Observable;\n pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction, op5: OperatorFunction, op6: OperatorFunction, op7: OperatorFunction, op8: OperatorFunction, op9: OperatorFunction): Observable;\n pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction, op5: OperatorFunction, op6: OperatorFunction, op7: OperatorFunction, op8: OperatorFunction, op9: OperatorFunction, ...operations: OperatorFunction[]): Observable<{}>;\n /* tslint:enable:max-line-length */\n\n /**\n * Used to stitch together functional operators into a chain.\n * @method pipe\n * @return {Observable} the Observable result of all of the operators having\n * been called in the order they were passed in.\n *\n * ### Example\n * ```ts\n * import { interval } from 'rxjs';\n * import { map, filter, scan } from 'rxjs/operators';\n *\n * interval(1000)\n * .pipe(\n * filter(x => x % 2 === 0),\n * map(x => x + x),\n * scan((acc, x) => acc + x)\n * )\n * .subscribe(x => console.log(x))\n * ```\n */\n pipe(...operations: OperatorFunction[]): Observable {\n if (operations.length === 0) {\n return this as any;\n }\n\n return pipeFromArray(operations)(this);\n }\n\n /* tslint:disable:max-line-length */\n toPromise(this: Observable): Promise;\n toPromise(this: Observable, PromiseCtor: typeof Promise): Promise;\n toPromise(this: Observable, PromiseCtor: PromiseConstructorLike): Promise;\n /* tslint:enable:max-line-length */\n\n toPromise(promiseCtor?: PromiseConstructorLike): Promise {\n promiseCtor = getPromiseCtor(promiseCtor);\n\n return new promiseCtor((resolve, reject) => {\n let value: any;\n this.subscribe((x: T) => value = x, (err: any) => reject(err), () => resolve(value));\n }) as Promise;\n }\n}\n\n/**\n * Decides between a passed promise constructor from consuming code,\n * A default configured promise constructor, and the native promise\n * constructor and returns it. If nothing can be found, it will throw\n * an error.\n * @param promiseCtor The optional promise constructor to passed by consuming code\n */\nfunction getPromiseCtor(promiseCtor: PromiseConstructorLike | undefined) {\n if (!promiseCtor) {\n promiseCtor = config.Promise || Promise;\n }\n\n if (!promiseCtor) {\n throw new Error('no Promise impl found');\n }\n\n return promiseCtor;\n}\n","import { Subscriber } from '../Subscriber';\nimport { rxSubscriber as rxSubscriberSymbol } from '../symbol/rxSubscriber';\nimport { empty as emptyObserver } from '../Observer';\nimport { PartialObserver } from '../types';\n\nexport function toSubscriber(\n nextOrObserver?: PartialObserver | ((value: T) => void),\n error?: (error: any) => void,\n complete?: () => void): Subscriber {\n\n if (nextOrObserver) {\n if (nextOrObserver instanceof Subscriber) {\n return (> nextOrObserver);\n }\n\n if (nextOrObserver[rxSubscriberSymbol]) {\n return nextOrObserver[rxSubscriberSymbol]();\n }\n }\n\n if (!nextOrObserver && !error && !complete) {\n return new Subscriber(emptyObserver);\n }\n\n return new Subscriber(nextOrObserver, error, complete);\n}\n","export interface ObjectUnsubscribedError extends Error {\n}\n\nexport interface ObjectUnsubscribedErrorCtor {\n new(): ObjectUnsubscribedError;\n}\n\nconst ObjectUnsubscribedErrorImpl = (() => {\n function ObjectUnsubscribedErrorImpl(this: any) {\n Error.call(this);\n this.message = 'object unsubscribed';\n this.name = 'ObjectUnsubscribedError';\n return this;\n }\n\n ObjectUnsubscribedErrorImpl.prototype = Object.create(Error.prototype);\n\n return ObjectUnsubscribedErrorImpl;\n})();\n\n/**\n * An error thrown when an action is invalid because the object has been\n * unsubscribed.\n *\n * @see {@link Subject}\n * @see {@link BehaviorSubject}\n *\n * @class ObjectUnsubscribedError\n */\nexport const ObjectUnsubscribedError: ObjectUnsubscribedErrorCtor = ObjectUnsubscribedErrorImpl as any;","import { Scheduler } from '../Scheduler';\nimport { Action } from './Action';\nimport { AsyncAction } from './AsyncAction';\nimport { SchedulerAction } from '../types';\nimport { Subscription } from '../Subscription';\n\nexport class AsyncScheduler extends Scheduler {\n public static delegate?: Scheduler;\n public actions: Array> = [];\n /**\n * A flag to indicate whether the Scheduler is currently executing a batch of\n * queued actions.\n * @type {boolean}\n * @deprecated internal use only\n */\n public active: boolean = false;\n /**\n * An internal ID used to track the latest asynchronous task such as those\n * coming from `setTimeout`, `setInterval`, `requestAnimationFrame`, and\n * others.\n * @type {any}\n * @deprecated internal use only\n */\n public scheduled: any = undefined;\n\n constructor(SchedulerAction: typeof Action,\n now: () => number = Scheduler.now) {\n super(SchedulerAction, () => {\n if (AsyncScheduler.delegate && AsyncScheduler.delegate !== this) {\n return AsyncScheduler.delegate.now();\n } else {\n return now();\n }\n });\n }\n\n public schedule(work: (this: SchedulerAction, state?: T) => void, delay: number = 0, state?: T): Subscription {\n if (AsyncScheduler.delegate && AsyncScheduler.delegate !== this) {\n return AsyncScheduler.delegate.schedule(work, delay, state);\n } else {\n return super.schedule(work, delay, state);\n }\n }\n\n public flush(action: AsyncAction): void {\n\n const {actions} = this;\n\n if (this.active) {\n actions.push(action);\n return;\n }\n\n let error: any;\n this.active = true;\n\n do {\n if (error = action.execute(action.state, action.delay)) {\n break;\n }\n } while (action = actions.shift()); // exhaust the scheduler queue\n\n this.active = false;\n\n if (error) {\n while (action = actions.shift()) {\n action.unsubscribe();\n }\n throw error;\n }\n }\n}\n","/**\n * Throws an error on another job so that it's picked up by the runtime's\n * uncaught error handling mechanism.\n * @param err the error to throw\n */\nexport function hostReportError(err: any) {\n setTimeout(() => { throw err; }, 0);\n}","'use strict';\n/**\n * @license Angular v12.0.0-next.0\n * (c) 2010-2020 Google LLC. https://angular.io/\n * License: MIT\n */\n(function (factory) {\n typeof define === 'function' && define.amd ? define(factory) :\n factory();\n}((function () {\n 'use strict';\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n var ProxyZoneSpec = /** @class */ (function () {\n function ProxyZoneSpec(defaultSpecDelegate) {\n if (defaultSpecDelegate === void 0) { defaultSpecDelegate = null; }\n this.defaultSpecDelegate = defaultSpecDelegate;\n this.name = 'ProxyZone';\n this._delegateSpec = null;\n this.properties = { 'ProxyZoneSpec': this };\n this.propertyKeys = null;\n this.lastTaskState = null;\n this.isNeedToTriggerHasTask = false;\n this.tasks = [];\n this.setDelegate(defaultSpecDelegate);\n }\n ProxyZoneSpec.get = function () {\n return Zone.current.get('ProxyZoneSpec');\n };\n ProxyZoneSpec.isLoaded = function () {\n return ProxyZoneSpec.get() instanceof ProxyZoneSpec;\n };\n ProxyZoneSpec.assertPresent = function () {\n if (!ProxyZoneSpec.isLoaded()) {\n throw new Error(\"Expected to be running in 'ProxyZone', but it was not found.\");\n }\n return ProxyZoneSpec.get();\n };\n ProxyZoneSpec.prototype.setDelegate = function (delegateSpec) {\n var _this = this;\n var isNewDelegate = this._delegateSpec !== delegateSpec;\n this._delegateSpec = delegateSpec;\n this.propertyKeys && this.propertyKeys.forEach(function (key) { return delete _this.properties[key]; });\n this.propertyKeys = null;\n if (delegateSpec && delegateSpec.properties) {\n this.propertyKeys = Object.keys(delegateSpec.properties);\n this.propertyKeys.forEach(function (k) { return _this.properties[k] = delegateSpec.properties[k]; });\n }\n // if a new delegateSpec was set, check if we need to trigger hasTask\n if (isNewDelegate && this.lastTaskState &&\n (this.lastTaskState.macroTask || this.lastTaskState.microTask)) {\n this.isNeedToTriggerHasTask = true;\n }\n };\n ProxyZoneSpec.prototype.getDelegate = function () {\n return this._delegateSpec;\n };\n ProxyZoneSpec.prototype.resetDelegate = function () {\n var delegateSpec = this.getDelegate();\n this.setDelegate(this.defaultSpecDelegate);\n };\n ProxyZoneSpec.prototype.tryTriggerHasTask = function (parentZoneDelegate, currentZone, targetZone) {\n if (this.isNeedToTriggerHasTask && this.lastTaskState) {\n // last delegateSpec has microTask or macroTask\n // should call onHasTask in current delegateSpec\n this.isNeedToTriggerHasTask = false;\n this.onHasTask(parentZoneDelegate, currentZone, targetZone, this.lastTaskState);\n }\n };\n ProxyZoneSpec.prototype.removeFromTasks = function (task) {\n if (!this.tasks) {\n return;\n }\n for (var i = 0; i < this.tasks.length; i++) {\n if (this.tasks[i] === task) {\n this.tasks.splice(i, 1);\n return;\n }\n }\n };\n ProxyZoneSpec.prototype.getAndClearPendingTasksInfo = function () {\n if (this.tasks.length === 0) {\n return '';\n }\n var taskInfo = this.tasks.map(function (task) {\n var dataInfo = task.data &&\n Object.keys(task.data)\n .map(function (key) {\n return key + ':' + task.data[key];\n })\n .join(',');\n return \"type: \" + task.type + \", source: \" + task.source + \", args: {\" + dataInfo + \"}\";\n });\n var pendingTasksInfo = '--Pending async tasks are: [' + taskInfo + ']';\n // clear tasks\n this.tasks = [];\n return pendingTasksInfo;\n };\n ProxyZoneSpec.prototype.onFork = function (parentZoneDelegate, currentZone, targetZone, zoneSpec) {\n if (this._delegateSpec && this._delegateSpec.onFork) {\n return this._delegateSpec.onFork(parentZoneDelegate, currentZone, targetZone, zoneSpec);\n }\n else {\n return parentZoneDelegate.fork(targetZone, zoneSpec);\n }\n };\n ProxyZoneSpec.prototype.onIntercept = function (parentZoneDelegate, currentZone, targetZone, delegate, source) {\n if (this._delegateSpec && this._delegateSpec.onIntercept) {\n return this._delegateSpec.onIntercept(parentZoneDelegate, currentZone, targetZone, delegate, source);\n }\n else {\n return parentZoneDelegate.intercept(targetZone, delegate, source);\n }\n };\n ProxyZoneSpec.prototype.onInvoke = function (parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source) {\n this.tryTriggerHasTask(parentZoneDelegate, currentZone, targetZone);\n if (this._delegateSpec && this._delegateSpec.onInvoke) {\n return this._delegateSpec.onInvoke(parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source);\n }\n else {\n return parentZoneDelegate.invoke(targetZone, delegate, applyThis, applyArgs, source);\n }\n };\n ProxyZoneSpec.prototype.onHandleError = function (parentZoneDelegate, currentZone, targetZone, error) {\n if (this._delegateSpec && this._delegateSpec.onHandleError) {\n return this._delegateSpec.onHandleError(parentZoneDelegate, currentZone, targetZone, error);\n }\n else {\n return parentZoneDelegate.handleError(targetZone, error);\n }\n };\n ProxyZoneSpec.prototype.onScheduleTask = function (parentZoneDelegate, currentZone, targetZone, task) {\n if (task.type !== 'eventTask') {\n this.tasks.push(task);\n }\n if (this._delegateSpec && this._delegateSpec.onScheduleTask) {\n return this._delegateSpec.onScheduleTask(parentZoneDelegate, currentZone, targetZone, task);\n }\n else {\n return parentZoneDelegate.scheduleTask(targetZone, task);\n }\n };\n ProxyZoneSpec.prototype.onInvokeTask = function (parentZoneDelegate, currentZone, targetZone, task, applyThis, applyArgs) {\n if (task.type !== 'eventTask') {\n this.removeFromTasks(task);\n }\n this.tryTriggerHasTask(parentZoneDelegate, currentZone, targetZone);\n if (this._delegateSpec && this._delegateSpec.onInvokeTask) {\n return this._delegateSpec.onInvokeTask(parentZoneDelegate, currentZone, targetZone, task, applyThis, applyArgs);\n }\n else {\n return parentZoneDelegate.invokeTask(targetZone, task, applyThis, applyArgs);\n }\n };\n ProxyZoneSpec.prototype.onCancelTask = function (parentZoneDelegate, currentZone, targetZone, task) {\n if (task.type !== 'eventTask') {\n this.removeFromTasks(task);\n }\n this.tryTriggerHasTask(parentZoneDelegate, currentZone, targetZone);\n if (this._delegateSpec && this._delegateSpec.onCancelTask) {\n return this._delegateSpec.onCancelTask(parentZoneDelegate, currentZone, targetZone, task);\n }\n else {\n return parentZoneDelegate.cancelTask(targetZone, task);\n }\n };\n ProxyZoneSpec.prototype.onHasTask = function (delegate, current, target, hasTaskState) {\n this.lastTaskState = hasTaskState;\n if (this._delegateSpec && this._delegateSpec.onHasTask) {\n this._delegateSpec.onHasTask(delegate, current, target, hasTaskState);\n }\n else {\n delegate.hasTask(target, hasTaskState);\n }\n };\n return ProxyZoneSpec;\n }());\n // Export the class so that new instances can be created with proper\n // constructor params.\n Zone['ProxyZoneSpec'] = ProxyZoneSpec;\n})));\n","import { Subscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\nimport { Observable } from '../Observable';\nimport { Operator } from '../Operator';\nimport { Subject } from '../Subject';\nimport { OperatorFunction } from '../types';\n\n/* tslint:disable:max-line-length */\nexport function groupBy(keySelector: (value: T) => K): OperatorFunction>;\nexport function groupBy(keySelector: (value: T) => K, elementSelector: void, durationSelector: (grouped: GroupedObservable) => Observable): OperatorFunction>;\nexport function groupBy(keySelector: (value: T) => K, elementSelector?: (value: T) => R, durationSelector?: (grouped: GroupedObservable) => Observable): OperatorFunction>;\nexport function groupBy(keySelector: (value: T) => K, elementSelector?: (value: T) => R, durationSelector?: (grouped: GroupedObservable) => Observable, subjectSelector?: () => Subject): OperatorFunction>;\n/* tslint:enable:max-line-length */\n\n/**\n * Groups the items emitted by an Observable according to a specified criterion,\n * and emits these grouped items as `GroupedObservables`, one\n * {@link GroupedObservable} per group.\n *\n * ![](groupBy.png)\n *\n * When the Observable emits an item, a key is computed for this item with the keySelector function.\n *\n * If a {@link GroupedObservable} for this key exists, this {@link GroupedObservable} emits. Elsewhere, a new\n * {@link GroupedObservable} for this key is created and emits.\n *\n * A {@link GroupedObservable} represents values belonging to the same group represented by a common key. The common\n * key is available as the key field of a {@link GroupedObservable} instance.\n *\n * The elements emitted by {@link GroupedObservable}s are by default the items emitted by the Observable, or elements\n * returned by the elementSelector function.\n *\n * ## Examples\n *\n * ### Group objects by id and return as array\n *\n * ```ts\n * import { of } from 'rxjs';\n * import { mergeMap, groupBy, reduce } from 'rxjs/operators';\n *\n * of(\n * {id: 1, name: 'JavaScript'},\n * {id: 2, name: 'Parcel'},\n * {id: 2, name: 'webpack'},\n * {id: 1, name: 'TypeScript'},\n * {id: 3, name: 'TSLint'}\n * ).pipe(\n * groupBy(p => p.id),\n * mergeMap((group$) => group$.pipe(reduce((acc, cur) => [...acc, cur], []))),\n * )\n * .subscribe(p => console.log(p));\n *\n * // displays:\n * // [ { id: 1, name: 'JavaScript'},\n * // { id: 1, name: 'TypeScript'} ]\n * //\n * // [ { id: 2, name: 'Parcel'},\n * // { id: 2, name: 'webpack'} ]\n * //\n * // [ { id: 3, name: 'TSLint'} ]\n * ```\n *\n * ### Pivot data on the id field\n *\n * ```ts\n * import { of } from 'rxjs';\n * import { groupBy, map, mergeMap, reduce } from 'rxjs/operators';\n *\n * of(\n * { id: 1, name: 'JavaScript' },\n * { id: 2, name: 'Parcel' },\n * { id: 2, name: 'webpack' },\n * { id: 1, name: 'TypeScript' },\n * { id: 3, name: 'TSLint' }\n * )\n * .pipe(\n * groupBy(p => p.id, p => p.name),\n * mergeMap(group$ =>\n * group$.pipe(reduce((acc, cur) => [...acc, cur], [`${group$.key}`]))\n * ),\n * map(arr => ({ id: parseInt(arr[0], 10), values: arr.slice(1) }))\n * )\n * .subscribe(p => console.log(p));\n *\n * // displays:\n * // { id: 1, values: [ 'JavaScript', 'TypeScript' ] }\n * // { id: 2, values: [ 'Parcel', 'webpack' ] }\n * // { id: 3, values: [ 'TSLint' ] }\n * ```\n *\n * @param {function(value: T): K} keySelector A function that extracts the key\n * for each item.\n * @param {function(value: T): R} [elementSelector] A function that extracts the\n * return element for each item.\n * @param {function(grouped: GroupedObservable): Observable} [durationSelector]\n * A function that returns an Observable to determine how long each group should\n * exist.\n * @return {Observable>} An Observable that emits\n * GroupedObservables, each of which corresponds to a unique key value and each\n * of which emits those items from the source Observable that share that key\n * value.\n * @method groupBy\n * @owner Observable\n */\nexport function groupBy(keySelector: (value: T) => K,\n elementSelector?: ((value: T) => R) | void,\n durationSelector?: (grouped: GroupedObservable) => Observable,\n subjectSelector?: () => Subject): OperatorFunction> {\n return (source: Observable) =>\n source.lift(new GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector));\n}\n\nexport interface RefCountSubscription {\n count: number;\n unsubscribe: () => void;\n closed: boolean;\n attemptedToUnsubscribe: boolean;\n}\n\nclass GroupByOperator implements Operator> {\n constructor(private keySelector: (value: T) => K,\n private elementSelector?: ((value: T) => R) | void,\n private durationSelector?: (grouped: GroupedObservable) => Observable,\n private subjectSelector?: () => Subject) {\n }\n\n call(subscriber: Subscriber>, source: any): any {\n return source.subscribe(new GroupBySubscriber(\n subscriber, this.keySelector, this.elementSelector, this.durationSelector, this.subjectSelector\n ));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass GroupBySubscriber extends Subscriber implements RefCountSubscription {\n private groups: Map> = null;\n public attemptedToUnsubscribe: boolean = false;\n public count: number = 0;\n\n constructor(destination: Subscriber>,\n private keySelector: (value: T) => K,\n private elementSelector?: ((value: T) => R) | void,\n private durationSelector?: (grouped: GroupedObservable) => Observable,\n private subjectSelector?: () => Subject) {\n super(destination);\n }\n\n protected _next(value: T): void {\n let key: K;\n try {\n key = this.keySelector(value);\n } catch (err) {\n this.error(err);\n return;\n }\n\n this._group(value, key);\n }\n\n private _group(value: T, key: K) {\n let groups = this.groups;\n\n if (!groups) {\n groups = this.groups = new Map>();\n }\n\n let group = groups.get(key);\n\n let element: R;\n if (this.elementSelector) {\n try {\n element = this.elementSelector(value);\n } catch (err) {\n this.error(err);\n }\n } else {\n element = value;\n }\n\n if (!group) {\n group = (this.subjectSelector ? this.subjectSelector() : new Subject()) as Subject;\n groups.set(key, group);\n const groupedObservable = new GroupedObservable(key, group, this);\n this.destination.next(groupedObservable);\n if (this.durationSelector) {\n let duration: any;\n try {\n duration = this.durationSelector(new GroupedObservable(key, >group));\n } catch (err) {\n this.error(err);\n return;\n }\n this.add(duration.subscribe(new GroupDurationSubscriber(key, group, this)));\n }\n }\n\n if (!group.closed) {\n group.next(element);\n }\n }\n\n protected _error(err: any): void {\n const groups = this.groups;\n if (groups) {\n groups.forEach((group, key) => {\n group.error(err);\n });\n\n groups.clear();\n }\n this.destination.error(err);\n }\n\n protected _complete(): void {\n const groups = this.groups;\n if (groups) {\n groups.forEach((group, key) => {\n group.complete();\n });\n\n groups.clear();\n }\n this.destination.complete();\n }\n\n removeGroup(key: K): void {\n this.groups.delete(key);\n }\n\n unsubscribe() {\n if (!this.closed) {\n this.attemptedToUnsubscribe = true;\n if (this.count === 0) {\n super.unsubscribe();\n }\n }\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass GroupDurationSubscriber extends Subscriber {\n constructor(private key: K,\n private group: Subject,\n private parent: GroupBySubscriber) {\n super(group);\n }\n\n protected _next(value: T): void {\n this.complete();\n }\n\n /** @deprecated This is an internal implementation detail, do not use. */\n _unsubscribe() {\n const { parent, key } = this;\n this.key = this.parent = null;\n if (parent) {\n parent.removeGroup(key);\n }\n }\n}\n\n/**\n * An Observable representing values belonging to the same group represented by\n * a common key. The values emitted by a GroupedObservable come from the source\n * Observable. The common key is available as the field `key` on a\n * GroupedObservable instance.\n *\n * @class GroupedObservable\n */\nexport class GroupedObservable extends Observable {\n /** @deprecated Do not construct this type. Internal use only */\n constructor(public key: K,\n private groupSubject: Subject,\n private refCountSubscription?: RefCountSubscription) {\n super();\n }\n\n /** @deprecated This is an internal implementation detail, do not use. */\n _subscribe(subscriber: Subscriber) {\n const subscription = new Subscription();\n const { refCountSubscription, groupSubject } = this;\n if (refCountSubscription && !refCountSubscription.closed) {\n subscription.add(new InnerRefCountSubscription(refCountSubscription));\n }\n subscription.add(groupSubject.subscribe(subscriber));\n return subscription;\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass InnerRefCountSubscription extends Subscription {\n constructor(private parent: RefCountSubscription) {\n super();\n parent.count++;\n }\n\n unsubscribe() {\n const parent = this.parent;\n if (!parent.closed && !this.closed) {\n super.unsubscribe();\n parent.count -= 1;\n if (parent.count === 0 && parent.attemptedToUnsubscribe) {\n parent.unsubscribe();\n }\n }\n }\n}\n","import { Subject } from './Subject';\nimport { Subscriber } from './Subscriber';\nimport { Subscription } from './Subscription';\n\n/**\n * A variant of Subject that only emits a value when it completes. It will emit\n * its latest value to all its observers on completion.\n *\n * @class AsyncSubject\n */\nexport class AsyncSubject extends Subject {\n private value: T = null;\n private hasNext: boolean = false;\n private hasCompleted: boolean = false;\n\n /** @deprecated This is an internal implementation detail, do not use. */\n _subscribe(subscriber: Subscriber): Subscription {\n if (this.hasError) {\n subscriber.error(this.thrownError);\n return Subscription.EMPTY;\n } else if (this.hasCompleted && this.hasNext) {\n subscriber.next(this.value);\n subscriber.complete();\n return Subscription.EMPTY;\n }\n return super._subscribe(subscriber);\n }\n\n next(value: T): void {\n if (!this.hasCompleted) {\n this.value = value;\n this.hasNext = true;\n }\n }\n\n error(error: any): void {\n if (!this.hasCompleted) {\n super.error(error);\n }\n }\n\n complete(): void {\n this.hasCompleted = true;\n if (this.hasNext) {\n super.next(this.value);\n }\n super.complete();\n }\n}\n","import { AsyncAction } from './AsyncAction';\nimport { Subscription } from '../Subscription';\nimport { AsyncScheduler } from './AsyncScheduler';\nimport { SchedulerAction } from '../types';\n\nexport class VirtualTimeScheduler extends AsyncScheduler {\n\n protected static frameTimeFactor: number = 10;\n\n public frame: number = 0;\n public index: number = -1;\n\n constructor(SchedulerAction: typeof AsyncAction = VirtualAction as any,\n public maxFrames: number = Number.POSITIVE_INFINITY) {\n super(SchedulerAction, () => this.frame);\n }\n\n /**\n * Prompt the Scheduler to execute all of its queued actions, therefore\n * clearing its queue.\n * @return {void}\n */\n public flush(): void {\n\n const {actions, maxFrames} = this;\n let error: any, action: AsyncAction;\n\n while ((action = actions[0]) && action.delay <= maxFrames) {\n actions.shift();\n this.frame = action.delay;\n\n if (error = action.execute(action.state, action.delay)) {\n break;\n }\n }\n\n if (error) {\n while (action = actions.shift()) {\n action.unsubscribe();\n }\n throw error;\n }\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @nodoc\n */\nexport class VirtualAction extends AsyncAction {\n\n protected active: boolean = true;\n\n constructor(protected scheduler: VirtualTimeScheduler,\n protected work: (this: SchedulerAction, state?: T) => void,\n protected index: number = scheduler.index += 1) {\n super(scheduler, work);\n this.index = scheduler.index = index;\n }\n\n public schedule(state?: T, delay: number = 0): Subscription {\n if (!this.id) {\n return super.schedule(state, delay);\n }\n this.active = false;\n // If an action is rescheduled, we save allocations by mutating its state,\n // pushing it to the end of the scheduler queue, and recycling the action.\n // But since the VirtualTimeScheduler is used for testing, VirtualActions\n // must be immutable so they can be inspected later.\n const action = new VirtualAction(this.scheduler, this.work);\n this.add(action);\n return action.schedule(state, delay);\n }\n\n protected requestAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay: number = 0): any {\n this.delay = scheduler.frame + delay;\n const {actions} = scheduler;\n actions.push(this);\n (actions as Array>).sort(VirtualAction.sortActions);\n return true;\n }\n\n protected recycleAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay: number = 0): any {\n return undefined;\n }\n\n protected _execute(state: T, delay: number): any {\n if (this.active === true) {\n return super._execute(state, delay);\n }\n }\n\n public static sortActions(a: VirtualAction, b: VirtualAction) {\n if (a.delay === b.delay) {\n if (a.index === b.index) {\n return 0;\n } else if (a.index > b.index) {\n return 1;\n } else {\n return -1;\n }\n } else if (a.delay > b.delay) {\n return 1;\n } else {\n return -1;\n }\n }\n}\n","import { Observable } from '../Observable';\nimport { ObservableInput } from '../types';\n\n/**\n * Tests to see if the object is an RxJS {@link Observable}\n * @param obj the object to test\n */\nexport function isObservable(obj: any): obj is Observable {\n return !!obj && (obj instanceof Observable || (typeof obj.lift === 'function' && typeof obj.subscribe === 'function'));\n}\n","export interface TimeoutError extends Error {\n}\n\nexport interface TimeoutErrorCtor {\n new(): TimeoutError;\n}\n\nconst TimeoutErrorImpl = (() => {\n function TimeoutErrorImpl(this: any) {\n Error.call(this);\n this.message = 'Timeout has occurred';\n this.name = 'TimeoutError';\n return this;\n }\n\n TimeoutErrorImpl.prototype = Object.create(Error.prototype);\n\n return TimeoutErrorImpl;\n})();\n\n/**\n * An error thrown when duetime elapses.\n *\n * @see {@link operators/timeout}\n *\n * @class TimeoutError\n */\nexport const TimeoutError: TimeoutErrorCtor = TimeoutErrorImpl as any;\n","import { SchedulerLike, SchedulerAction } from '../types';\nimport { Observable } from '../Observable';\nimport { AsyncSubject } from '../AsyncSubject';\nimport { Subscriber } from '../Subscriber';\nimport { map } from '../operators/map';\nimport { canReportError } from '../util/canReportError';\nimport { isArray } from '../util/isArray';\nimport { isScheduler } from '../util/isScheduler';\n\n// tslint:disable:max-line-length\n/** @deprecated resultSelector is no longer supported, use a mapping function. */\nexport function bindCallback(callbackFunc: Function, resultSelector: Function, scheduler?: SchedulerLike): (...args: any[]) => Observable;\n\nexport function bindCallback(callbackFunc: (callback: (res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): () => Observable;\nexport function bindCallback(callbackFunc: (callback: (res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): () => Observable<[R1, R2, R3]>;\nexport function bindCallback(callbackFunc: (callback: (res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): () => Observable<[R1, R2]>;\nexport function bindCallback(callbackFunc: (callback: (res1: R1) => any) => any, scheduler?: SchedulerLike): () => Observable;\nexport function bindCallback(callbackFunc: (callback: () => any) => any, scheduler?: SchedulerLike): () => Observable;\n\nexport function bindCallback(callbackFunc: (arg1: A1, callback: (res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (arg1: A1) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, callback: (res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1) => Observable<[R1, R2, R3]>;\nexport function bindCallback(callbackFunc: (arg1: A1, callback: (res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1) => Observable<[R1, R2]>;\nexport function bindCallback(callbackFunc: (arg1: A1, callback: (res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, callback: () => any) => any, scheduler?: SchedulerLike): (arg1: A1) => Observable;\n\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, callback: (res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, callback: (res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2) => Observable<[R1, R2, R3]>;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, callback: (res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2) => Observable<[R1, R2]>;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, callback: (res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, callback: () => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2) => Observable;\n\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: (res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: (res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3) => Observable<[R1, R2, R3]>;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: (res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3) => Observable<[R1, R2]>;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: (res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: () => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3) => Observable;\n\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Observable<[R1, R2, R3]>;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Observable<[R1, R2]>;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: () => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Observable;\n\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Observable<[R1, R2, R3]>;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Observable<[R1, R2]>;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: () => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Observable;\n\nexport function bindCallback(callbackFunc: (...args: Array any)>) => any, scheduler?: SchedulerLike): (...args: A[]) => Observable;\nexport function bindCallback(callbackFunc: (...args: Array any)>) => any, scheduler?: SchedulerLike): (...args: A[]) => Observable;\n\nexport function bindCallback(callbackFunc: Function, scheduler?: SchedulerLike): (...args: any[]) => Observable;\n\n// tslint:enable:max-line-length\n\n/**\n * Converts a callback API to a function that returns an Observable.\n *\n * Give it a function `f` of type `f(x, callback)` and\n * it will return a function `g` that when called as `g(x)` will output an\n * Observable.\n *\n * `bindCallback` is not an operator because its input and output are not\n * Observables. The input is a function `func` with some parameters. The\n * last parameter must be a callback function that `func` calls when it is\n * done.\n *\n * The output of `bindCallback` is a function that takes the same parameters\n * as `func`, except the last one (the callback). When the output function\n * is called with arguments it will return an Observable. If function `func`\n * calls its callback with one argument, the Observable will emit that value.\n * If on the other hand the callback is called with multiple values the resulting\n * Observable will emit an array with said values as arguments.\n *\n * It is **very important** to remember that input function `func` is not called\n * when the output function is, but rather when the Observable returned by the output\n * function is subscribed. This means if `func` makes an AJAX request, that request\n * will be made every time someone subscribes to the resulting Observable, but not before.\n *\n * The last optional parameter - `scheduler` - can be used to control when the call\n * to `func` happens after someone subscribes to Observable, as well as when results\n * passed to callback will be emitted. By default, the subscription to an Observable calls `func`\n * synchronously, but using {@link asyncScheduler} as the last parameter will defer the call to `func`,\n * just like wrapping the call in `setTimeout` with a timeout of `0` would. If you were to use the async Scheduler\n * and call `subscribe` on the output Observable, all function calls that are currently executing\n * will end before `func` is invoked.\n *\n * By default, results passed to the callback are emitted immediately after `func` invokes the callback.\n * In particular, if the callback is called synchronously, then the subscription of the resulting Observable\n * will call the `next` function synchronously as well. If you want to defer that call,\n * you may use {@link asyncScheduler} just as before. This means that by using `Scheduler.async` you can\n * ensure that `func` always calls its callback asynchronously, thus avoiding terrifying Zalgo.\n *\n * Note that the Observable created by the output function will always emit a single value\n * and then complete immediately. If `func` calls the callback multiple times, values from subsequent\n * calls will not appear in the stream. If you need to listen for multiple calls,\n * you probably want to use {@link fromEvent} or {@link fromEventPattern} instead.\n *\n * If `func` depends on some context (`this` property) and is not already bound, the context of `func`\n * will be the context that the output function has at call time. In particular, if `func`\n * is called as a method of some objec and if `func` is not already bound, in order to preserve the context\n * it is recommended that the context of the output function is set to that object as well.\n *\n * If the input function calls its callback in the \"node style\" (i.e. first argument to callback is\n * optional error parameter signaling whether the call failed or not), {@link bindNodeCallback}\n * provides convenient error handling and probably is a better choice.\n * `bindCallback` will treat such functions the same as any other and error parameters\n * (whether passed or not) will always be interpreted as regular callback argument.\n *\n * ## Examples\n *\n * ### Convert jQuery's getJSON to an Observable API\n * ```ts\n * import { bindCallback } from 'rxjs';\n * import * as jQuery from 'jquery';\n *\n * // Suppose we have jQuery.getJSON('/my/url', callback)\n * const getJSONAsObservable = bindCallback(jQuery.getJSON);\n * const result = getJSONAsObservable('/my/url');\n * result.subscribe(x => console.log(x), e => console.error(e));\n * ```\n *\n * ### Receive an array of arguments passed to a callback\n * ```ts\n * import { bindCallback } from 'rxjs';\n *\n * const someFunction = (a, b, c) => {\n * console.log(a); // 5\n * console.log(b); // 'some string'\n * console.log(c); // {someProperty: 'someValue'}\n * };\n *\n * const boundSomeFunction = bindCallback(someFunction);\n * boundSomeFunction().subscribe(values => {\n * console.log(values) // [5, 'some string', {someProperty: 'someValue'}]\n * });\n * ```\n *\n * ### Compare behaviour with and without async Scheduler\n * ```ts\n * import { bindCallback } from 'rxjs';\n *\n * function iCallMyCallbackSynchronously(cb) {\n * cb();\n * }\n *\n * const boundSyncFn = bindCallback(iCallMyCallbackSynchronously);\n * const boundAsyncFn = bindCallback(iCallMyCallbackSynchronously, null, Rx.Scheduler.async);\n *\n * boundSyncFn().subscribe(() => console.log('I was sync!'));\n * boundAsyncFn().subscribe(() => console.log('I was async!'));\n * console.log('This happened...');\n *\n * // Logs:\n * // I was sync!\n * // This happened...\n * // I was async!\n * ```\n *\n * ### Use bindCallback on an object method\n * ```ts\n * import { bindCallback } from 'rxjs';\n *\n * const boundMethod = bindCallback(someObject.methodWithCallback);\n * boundMethod.call(someObject) // make sure methodWithCallback has access to someObject\n * .subscribe(subscriber);\n * ```\n *\n * @see {@link bindNodeCallback}\n * @see {@link from}\n *\n * @param {function} func A function with a callback as the last parameter.\n * @param {SchedulerLike} [scheduler] The scheduler on which to schedule the\n * callbacks.\n * @return {function(...params: *): Observable} A function which returns the\n * Observable that delivers the same values the callback would deliver.\n * @name bindCallback\n */\nexport function bindCallback(\n callbackFunc: Function,\n resultSelector?: Function|SchedulerLike,\n scheduler?: SchedulerLike\n): (...args: any[]) => Observable {\n if (resultSelector) {\n if (isScheduler(resultSelector)) {\n scheduler = resultSelector;\n } else {\n // DEPRECATED PATH\n return (...args: any[]) => bindCallback(callbackFunc, scheduler)(...args).pipe(\n map((args) => isArray(args) ? resultSelector(...args) : resultSelector(args)),\n );\n }\n }\n\n return function (this: any, ...args: any[]): Observable {\n const context = this;\n let subject: AsyncSubject;\n const params = {\n context,\n subject,\n callbackFunc,\n scheduler,\n };\n return new Observable(subscriber => {\n if (!scheduler) {\n if (!subject) {\n subject = new AsyncSubject();\n const handler = (...innerArgs: any[]) => {\n subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs);\n subject.complete();\n };\n\n try {\n callbackFunc.apply(context, [...args, handler]);\n } catch (err) {\n if (canReportError(subject)) {\n subject.error(err);\n } else {\n console.warn(err);\n }\n }\n }\n return subject.subscribe(subscriber);\n } else {\n const state: DispatchState = {\n args, subscriber, params,\n };\n return scheduler.schedule>(dispatch, 0, state);\n }\n });\n };\n}\n\ninterface DispatchState {\n args: any[];\n subscriber: Subscriber;\n params: ParamsContext;\n}\n\ninterface ParamsContext {\n callbackFunc: Function;\n scheduler: SchedulerLike;\n context: any;\n subject: AsyncSubject;\n}\n\nfunction dispatch(this: SchedulerAction>, state: DispatchState) {\n const self = this;\n const { args, subscriber, params } = state;\n const { callbackFunc, context, scheduler } = params;\n let { subject } = params;\n if (!subject) {\n subject = params.subject = new AsyncSubject();\n\n const handler = (...innerArgs: any[]) => {\n const value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs;\n this.add(scheduler.schedule>(dispatchNext, 0, { value, subject }));\n };\n\n try {\n callbackFunc.apply(context, [...args, handler]);\n } catch (err) {\n subject.error(err);\n }\n }\n\n this.add(subject.subscribe(subscriber));\n}\n\ninterface NextState {\n subject: AsyncSubject;\n value: T;\n}\n\nfunction dispatchNext(this: SchedulerAction>, state: NextState) {\n const { value, subject } = state;\n subject.next(value);\n subject.complete();\n}\n\ninterface ErrorState {\n subject: AsyncSubject;\n err: any;\n}\n\nfunction dispatchError(this: SchedulerAction>, state: ErrorState) {\n const { err, subject } = state;\n subject.error(err);\n}\n","import { Observable } from '../Observable';\nimport { AsyncSubject } from '../AsyncSubject';\nimport { Subscriber } from '../Subscriber';\nimport { SchedulerAction, SchedulerLike } from '../types';\nimport { map } from '../operators/map';\nimport { canReportError } from '../util/canReportError';\nimport { isScheduler } from '../util/isScheduler';\nimport { isArray } from '../util/isArray';\n\n/* tslint:disable:max-line-length */\n/** @deprecated resultSelector is deprecated, pipe to map instead */\nexport function bindNodeCallback(callbackFunc: Function, resultSelector: Function, scheduler?: SchedulerLike): (...args: any[]) => Observable;\n\nexport function bindNodeCallback(callbackFunc: (callback: (err: any, res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (...args: any[]) => Observable;\nexport function bindNodeCallback(callbackFunc: (callback: (err: any, res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): () => Observable<[R1, R2, R3]>;\nexport function bindNodeCallback(callbackFunc: (callback: (err: any, res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): () => Observable<[R1, R2]>;\nexport function bindNodeCallback(callbackFunc: (callback: (err: any, res1: R1) => any) => any, scheduler?: SchedulerLike): () => Observable;\nexport function bindNodeCallback(callbackFunc: (callback: (err: any) => any) => any, scheduler?: SchedulerLike): () => Observable;\n\nexport function bindNodeCallback(callbackFunc: (arg1: A1, callback: (err: any, res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (...args: any[]) => Observable;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, callback: (err: any, res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1) => Observable<[R1, R2, R3]>;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, callback: (err: any, res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1) => Observable<[R1, R2]>;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, callback: (err: any, res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1) => Observable;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, callback: (err: any) => any) => any, scheduler?: SchedulerLike): (arg1: A1) => Observable;\n\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, callback: (err: any, res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (...args: any[]) => Observable;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, callback: (err: any, res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2) => Observable<[R1, R2, R3]>;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, callback: (err: any, res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2) => Observable<[R1, R2]>;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, callback: (err: any, res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2) => Observable;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, callback: (err: any) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2) => Observable;\n\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (...args: any[]) => Observable;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3) => Observable<[R1, R2, R3]>;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3) => Observable<[R1, R2]>;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3) => Observable;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3) => Observable;\n\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (...args: any[]) => Observable;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Observable<[R1, R2, R3]>;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Observable<[R1, R2]>;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Observable;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Observable;\n\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (...args: any[]) => Observable;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Observable<[R1, R2, R3]>;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Observable<[R1, R2]>;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Observable;\nexport function bindNodeCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Observable; /* tslint:enable:max-line-length */\n\nexport function bindNodeCallback(callbackFunc: Function, scheduler?: SchedulerLike): (...args: any[]) => Observable;\n/**\n * Converts a Node.js-style callback API to a function that returns an\n * Observable.\n *\n * It's just like {@link bindCallback}, but the\n * callback is expected to be of type `callback(error, result)`.\n *\n * `bindNodeCallback` is not an operator because its input and output are not\n * Observables. The input is a function `func` with some parameters, but the\n * last parameter must be a callback function that `func` calls when it is\n * done. The callback function is expected to follow Node.js conventions,\n * where the first argument to the callback is an error object, signaling\n * whether call was successful. If that object is passed to callback, it means\n * something went wrong.\n *\n * The output of `bindNodeCallback` is a function that takes the same\n * parameters as `func`, except the last one (the callback). When the output\n * function is called with arguments, it will return an Observable.\n * If `func` calls its callback with error parameter present, Observable will\n * error with that value as well. If error parameter is not passed, Observable will emit\n * second parameter. If there are more parameters (third and so on),\n * Observable will emit an array with all arguments, except first error argument.\n *\n * Note that `func` will not be called at the same time output function is,\n * but rather whenever resulting Observable is subscribed. By default call to\n * `func` will happen synchronously after subscription, but that can be changed\n * with proper `scheduler` provided as optional third parameter. {@link SchedulerLike}\n * can also control when values from callback will be emitted by Observable.\n * To find out more, check out documentation for {@link bindCallback}, where\n * {@link SchedulerLike} works exactly the same.\n *\n * As in {@link bindCallback}, context (`this` property) of input function will be set to context\n * of returned function, when it is called.\n *\n * After Observable emits value, it will complete immediately. This means\n * even if `func` calls callback again, values from second and consecutive\n * calls will never appear on the stream. If you need to handle functions\n * that call callbacks multiple times, check out {@link fromEvent} or\n * {@link fromEventPattern} instead.\n *\n * Note that `bindNodeCallback` can be used in non-Node.js environments as well.\n * \"Node.js-style\" callbacks are just a convention, so if you write for\n * browsers or any other environment and API you use implements that callback style,\n * `bindNodeCallback` can be safely used on that API functions as well.\n *\n * Remember that Error object passed to callback does not have to be an instance\n * of JavaScript built-in `Error` object. In fact, it does not even have to an object.\n * Error parameter of callback function is interpreted as \"present\", when value\n * of that parameter is truthy. It could be, for example, non-zero number, non-empty\n * string or boolean `true`. In all of these cases resulting Observable would error\n * with that value. This means usually regular style callbacks will fail very often when\n * `bindNodeCallback` is used. If your Observable errors much more often then you\n * would expect, check if callback really is called in Node.js-style and, if not,\n * switch to {@link bindCallback} instead.\n *\n * Note that even if error parameter is technically present in callback, but its value\n * is falsy, it still won't appear in array emitted by Observable.\n *\n * ## Examples\n * ### Read a file from the filesystem and get the data as an Observable\n * ```ts\n * import * as fs from 'fs';\n * const readFileAsObservable = bindNodeCallback(fs.readFile);\n * const result = readFileAsObservable('./roadNames.txt', 'utf8');\n * result.subscribe(x => console.log(x), e => console.error(e));\n * ```\n *\n * ### Use on function calling callback with multiple arguments\n * ```ts\n * someFunction((err, a, b) => {\n * console.log(err); // null\n * console.log(a); // 5\n * console.log(b); // \"some string\"\n * });\n * const boundSomeFunction = bindNodeCallback(someFunction);\n * boundSomeFunction()\n * .subscribe(value => {\n * console.log(value); // [5, \"some string\"]\n * });\n * ```\n *\n * ### Use on function calling callback in regular style\n * ```ts\n * someFunction(a => {\n * console.log(a); // 5\n * });\n * const boundSomeFunction = bindNodeCallback(someFunction);\n * boundSomeFunction()\n * .subscribe(\n * value => {} // never gets called\n * err => console.log(err) // 5\n * );\n * ```\n *\n * @see {@link bindCallback}\n * @see {@link from}\n *\n * @param {function} func Function with a Node.js-style callback as the last parameter.\n * @param {SchedulerLike} [scheduler] The scheduler on which to schedule the\n * callbacks.\n * @return {function(...params: *): Observable} A function which returns the\n * Observable that delivers the same values the Node.js callback would\n * deliver.\n * @name bindNodeCallback\n */\nexport function bindNodeCallback(\n callbackFunc: Function,\n resultSelector: Function|SchedulerLike,\n scheduler?: SchedulerLike\n): (...args: any[]) => Observable {\n\n if (resultSelector) {\n if (isScheduler(resultSelector)) {\n scheduler = resultSelector;\n } else {\n // DEPRECATED PATH\n return (...args: any[]) => bindNodeCallback(callbackFunc, scheduler)(...args).pipe(\n map(args => isArray(args) ? resultSelector(...args) : resultSelector(args))\n );\n }\n }\n\n return function(this: any, ...args: any[]): Observable {\n const params: ParamsState = {\n subject: undefined,\n args,\n callbackFunc,\n scheduler,\n context: this,\n };\n return new Observable(subscriber => {\n const { context } = params;\n let { subject } = params;\n if (!scheduler) {\n if (!subject) {\n subject = params.subject = new AsyncSubject();\n const handler = (...innerArgs: any[]) => {\n const err = innerArgs.shift();\n\n if (err) {\n subject.error(err);\n return;\n }\n\n subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs);\n subject.complete();\n };\n\n try {\n callbackFunc.apply(context, [...args, handler]);\n } catch (err) {\n if (canReportError(subject)) {\n subject.error(err);\n } else {\n console.warn(err);\n }\n }\n }\n return subject.subscribe(subscriber);\n } else {\n return scheduler.schedule>(dispatch, 0, { params, subscriber, context });\n }\n });\n };\n}\n\ninterface DispatchState {\n subscriber: Subscriber;\n context: any;\n params: ParamsState;\n}\n\ninterface ParamsState {\n callbackFunc: Function;\n args: any[];\n scheduler: SchedulerLike;\n subject: AsyncSubject;\n context: any;\n}\n\nfunction dispatch(this: SchedulerAction>, state: DispatchState) {\n const { params, subscriber, context } = state;\n const { callbackFunc, args, scheduler } = params;\n let subject = params.subject;\n\n if (!subject) {\n subject = params.subject = new AsyncSubject();\n\n const handler = (...innerArgs: any[]) => {\n const err = innerArgs.shift();\n if (err) {\n this.add(scheduler.schedule>(dispatchError, 0, { err, subject }));\n } else {\n const value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs;\n this.add(scheduler.schedule>(dispatchNext, 0, { value, subject }));\n }\n };\n\n try {\n callbackFunc.apply(context, [...args, handler]);\n } catch (err) {\n this.add(scheduler.schedule>(dispatchError, 0, { err, subject }));\n }\n }\n\n this.add(subject.subscribe(subscriber));\n}\n\ninterface DispatchNextArg {\n subject: AsyncSubject;\n value: T;\n}\n\nfunction dispatchNext(arg: DispatchNextArg) {\n const { value, subject } = arg;\n subject.next(value);\n subject.complete();\n}\n\ninterface DispatchErrorArg {\n subject: AsyncSubject;\n err: any;\n}\n\nfunction dispatchError(arg: DispatchErrorArg) {\n const { err, subject } = arg;\n subject.error(err);\n}\n","import { Observable } from '../Observable';\nimport { isArray } from '../util/isArray';\nimport { isFunction } from '../util/isFunction';\nimport { NodeEventHandler } from './fromEvent';\nimport { map } from '../operators/map';\n\n/* tslint:disable:max-line-length */\nexport function fromEventPattern(addHandler: (handler: NodeEventHandler) => any, removeHandler?: (handler: NodeEventHandler, signal?: any) => void): Observable;\n/** @deprecated resultSelector no longer supported, pipe to map instead */\nexport function fromEventPattern(addHandler: (handler: NodeEventHandler) => any, removeHandler?: (handler: NodeEventHandler, signal?: any) => void, resultSelector?: (...args: any[]) => T): Observable;\n/* tslint:enable:max-line-length */\n\n/**\n * Creates an Observable from an arbitrary API for registering event handlers.\n *\n * When that method for adding event handler was something {@link fromEvent}\n * was not prepared for.\n *\n * ![](fromEventPattern.png)\n *\n * `fromEventPattern` allows you to convert into an Observable any API that supports registering handler functions\n * for events. It is similar to {@link fromEvent}, but far\n * more flexible. In fact, all use cases of {@link fromEvent} could be easily handled by\n * `fromEventPattern` (although in slightly more verbose way).\n *\n * This operator accepts as a first argument an `addHandler` function, which will be injected with\n * handler parameter. That handler is actually an event handler function that you now can pass\n * to API expecting it. `addHandler` will be called whenever Observable\n * returned by the operator is subscribed, so registering handler in API will not\n * necessarily happen when `fromEventPattern` is called.\n *\n * After registration, every time an event that we listen to happens,\n * Observable returned by `fromEventPattern` will emit value that event handler\n * function was called with. Note that if event handler was called with more\n * then one argument, second and following arguments will not appear in the Observable.\n *\n * If API you are using allows to unregister event handlers as well, you can pass to `fromEventPattern`\n * another function - `removeHandler` - as a second parameter. It will be injected\n * with the same handler function as before, which now you can use to unregister\n * it from the API. `removeHandler` will be called when consumer of resulting Observable\n * unsubscribes from it.\n *\n * In some APIs unregistering is actually handled differently. Method registering an event handler\n * returns some kind of token, which is later used to identify which function should\n * be unregistered or it itself has method that unregisters event handler.\n * If that is the case with your API, make sure token returned\n * by registering method is returned by `addHandler`. Then it will be passed\n * as a second argument to `removeHandler`, where you will be able to use it.\n *\n * If you need access to all event handler parameters (not only the first one),\n * or you need to transform them in any way, you can call `fromEventPattern` with optional\n * third parameter - project function which will accept all arguments passed to\n * event handler when it is called. Whatever is returned from project function will appear on\n * resulting stream instead of usual event handlers first argument. This means\n * that default project can be thought of as function that takes its first parameter\n * and ignores the rest.\n *\n * ## Example\n * ### Emits clicks happening on the DOM document\n *\n * ```ts\n * import { fromEventPattern } from 'rxjs';\n *\n * function addClickHandler(handler) {\n * document.addEventListener('click', handler);\n * }\n *\n * function removeClickHandler(handler) {\n * document.removeEventListener('click', handler);\n * }\n *\n * const clicks = fromEventPattern(\n * addClickHandler,\n * removeClickHandler\n * );\n * clicks.subscribe(x => console.log(x));\n *\n * // Whenever you click anywhere in the browser, DOM MouseEvent\n * // object will be logged.\n * ```\n *\n * ## Example\n * ### Use with API that returns cancellation token\n *\n * ```ts\n * import { fromEventPattern } from 'rxjs';\n *\n * const token = someAPI.registerEventHandler(function() {});\n * someAPI.unregisterEventHandler(token); // this APIs cancellation method accepts\n * // not handler itself, but special token.\n *\n * const someAPIObservable = fromEventPattern(\n * function(handler) { return someAPI.registerEventHandler(handler); }, // Note that we return the token here...\n * function(handler, token) { someAPI.unregisterEventHandler(token); } // ...to then use it here.\n * );\n * ```\n *\n * ## Example\n * ### Use with project function\n *\n * ```ts\n * import { fromEventPattern } from 'rxjs';\n *\n * someAPI.registerEventHandler((eventType, eventMessage) => {\n * console.log(eventType, eventMessage); // Logs \"EVENT_TYPE\" \"EVENT_MESSAGE\" to console.\n * });\n *\n * const someAPIObservable = fromEventPattern(\n * handler => someAPI.registerEventHandler(handler),\n * handler => someAPI.unregisterEventHandler(handler)\n * (eventType, eventMessage) => eventType + \" --- \" + eventMessage // without that function only \"EVENT_TYPE\"\n * ); // would be emitted by the Observable\n *\n * someAPIObservable.subscribe(value => console.log(value));\n *\n * // Logs:\n * // \"EVENT_TYPE --- EVENT_MESSAGE\"\n * ```\n *\n * @see {@link fromEvent}\n * @see {@link bindCallback}\n * @see {@link bindNodeCallback}\n *\n * @param {function(handler: Function): any} addHandler A function that takes\n * a `handler` function as argument and attaches it somehow to the actual\n * source of events.\n * @param {function(handler: Function, token?: any): void} [removeHandler] A function that\n * takes a `handler` function as an argument and removes it from the event source. If `addHandler`\n * returns some kind of token, `removeHandler` function will have it as a second parameter.\n * @param {function(...args: any): T} [project] A function to\n * transform results. It takes the arguments from the event handler and\n * should return a single value.\n * @return {Observable} Observable which, when an event happens, emits first parameter\n * passed to registered event handler. Alternatively it emits whatever project function returns\n * at that moment.\n * @static true\n * @name fromEventPattern\n * @owner Observable\n */\n\nexport function fromEventPattern(addHandler: (handler: NodeEventHandler) => any,\n removeHandler?: (handler: NodeEventHandler, signal?: any) => void,\n resultSelector?: (...args: any[]) => T): Observable {\n\n if (resultSelector) {\n // DEPRECATED PATH\n return fromEventPattern(addHandler, removeHandler).pipe(\n map(args => isArray(args) ? resultSelector(...args) : resultSelector(args))\n );\n }\n\n return new Observable(subscriber => {\n const handler = (...e: T[]) => subscriber.next(e.length === 1 ? e[0] : e);\n\n let retValue: any;\n try {\n retValue = addHandler(handler);\n } catch (err) {\n subscriber.error(err);\n return undefined;\n }\n\n if (!isFunction(removeHandler)) {\n return undefined;\n }\n\n return () => removeHandler(handler, retValue) ;\n });\n}\n","import { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { identity } from '../util/identity';\nimport { SchedulerAction, SchedulerLike } from '../types';\nimport { isScheduler } from '../util/isScheduler';\n\nexport type ConditionFunc = (state: S) => boolean;\nexport type IterateFunc = (state: S) => S;\nexport type ResultFunc = (state: S) => T;\n\ninterface SchedulerState {\n needIterate?: boolean;\n state: S;\n subscriber: Subscriber;\n condition?: ConditionFunc;\n iterate: IterateFunc;\n resultSelector: ResultFunc;\n}\n\nexport interface GenerateBaseOptions {\n /**\n * Initial state.\n */\n initialState: S;\n /**\n * Condition function that accepts state and returns boolean.\n * When it returns false, the generator stops.\n * If not specified, a generator never stops.\n */\n condition?: ConditionFunc;\n /**\n * Iterate function that accepts state and returns new state.\n */\n iterate: IterateFunc;\n /**\n * SchedulerLike to use for generation process.\n * By default, a generator starts immediately.\n */\n scheduler?: SchedulerLike;\n}\n\nexport interface GenerateOptions extends GenerateBaseOptions {\n /**\n * Result selection function that accepts state and returns a value to emit.\n */\n resultSelector: ResultFunc;\n}\n\n/**\n * Generates an observable sequence by running a state-driven loop\n * producing the sequence's elements, using the specified scheduler\n * to send out observer messages.\n *\n * ![](generate.png)\n *\n * @example Produces sequence of 0, 1, 2, ... 9, then completes.\n * const res = generate(0, x => x < 10, x => x + 1, x => x);\n *\n * @example Using asap scheduler, produces sequence of 2, 3, 5, then completes.\n * const res = generate(1, x => x < 5, x => x * 2, x => x + 1, asap);\n *\n * @see {@link from}\n * @see {@link Observable}\n *\n * @param {S} initialState Initial state.\n * @param {function (state: S): boolean} condition Condition to terminate generation (upon returning false).\n * @param {function (state: S): S} iterate Iteration step function.\n * @param {function (state: S): T} resultSelector Selector function for results produced in the sequence. (deprecated)\n * @param {SchedulerLike} [scheduler] A {@link SchedulerLike} on which to run the generator loop. If not provided, defaults to emit immediately.\n * @returns {Observable} The generated sequence.\n */\n export function generate(initialState: S,\n condition: ConditionFunc,\n iterate: IterateFunc,\n resultSelector: ResultFunc,\n scheduler?: SchedulerLike): Observable;\n\n/**\n * Generates an Observable by running a state-driven loop\n * that emits an element on each iteration.\n *\n * Use it instead of nexting values in a for loop.\n *\n * \n *\n * `generate` allows you to create stream of values generated with a loop very similar to\n * traditional for loop. First argument of `generate` is a beginning value. Second argument\n * is a function that accepts this value and tests if some condition still holds. If it does,\n * loop continues, if not, it stops. Third value is a function which takes previously defined\n * value and modifies it in some way on each iteration. Note how these three parameters\n * are direct equivalents of three expressions in regular for loop: first expression\n * initializes some state (for example numeric index), second tests if loop can make next\n * iteration (for example if index is lower than 10) and third states how defined value\n * will be modified on every step (index will be incremented by one).\n *\n * Return value of a `generate` operator is an Observable that on each loop iteration\n * emits a value. First, condition function is ran. If it returned true, Observable\n * emits currently stored value (initial value at the first iteration) and then updates\n * that value with iterate function. If at some point condition returned false, Observable\n * completes at that moment.\n *\n * Optionally you can pass fourth parameter to `generate` - a result selector function which allows you\n * to immediately map value that would normally be emitted by an Observable.\n *\n * If you find three anonymous functions in `generate` call hard to read, you can provide\n * single object to the operator instead. That object has properties: `initialState`,\n * `condition`, `iterate` and `resultSelector`, which should have respective values that you\n * would normally pass to `generate`. `resultSelector` is still optional, but that form\n * of calling `generate` allows you to omit `condition` as well. If you omit it, that means\n * condition always holds, so output Observable will never complete.\n *\n * Both forms of `generate` can optionally accept a scheduler. In case of multi-parameter call,\n * scheduler simply comes as a last argument (no matter if there is resultSelector\n * function or not). In case of single-parameter call, you can provide it as a\n * `scheduler` property on object passed to the operator. In both cases scheduler decides when\n * next iteration of the loop will happen and therefore when next value will be emitted\n * by the Observable. For example to ensure that each value is pushed to the observer\n * on separate task in event loop, you could use `async` scheduler. Note that\n * by default (when no scheduler is passed) values are simply emitted synchronously.\n *\n *\n * @example Use with condition and iterate functions.\n * const generated = generate(0, x => x < 3, x => x + 1);\n *\n * generated.subscribe(\n * value => console.log(value),\n * err => {},\n * () => console.log('Yo!')\n * );\n *\n * // Logs:\n * // 0\n * // 1\n * // 2\n * // \"Yo!\"\n *\n *\n * @example Use with condition, iterate and resultSelector functions.\n * const generated = generate(0, x => x < 3, x => x + 1, x => x * 1000);\n *\n * generated.subscribe(\n * value => console.log(value),\n * err => {},\n * () => console.log('Yo!')\n * );\n *\n * // Logs:\n * // 0\n * // 1000\n * // 2000\n * // \"Yo!\"\n *\n *\n * @example Use with options object.\n * const generated = generate({\n * initialState: 0,\n * condition(value) { return value < 3; },\n * iterate(value) { return value + 1; },\n * resultSelector(value) { return value * 1000; }\n * });\n *\n * generated.subscribe(\n * value => console.log(value),\n * err => {},\n * () => console.log('Yo!')\n * );\n *\n * // Logs:\n * // 0\n * // 1000\n * // 2000\n * // \"Yo!\"\n *\n * @example Use options object without condition function.\n * const generated = generate({\n * initialState: 0,\n * iterate(value) { return value + 1; },\n * resultSelector(value) { return value * 1000; }\n * });\n *\n * generated.subscribe(\n * value => console.log(value),\n * err => {},\n * () => console.log('Yo!') // This will never run.\n * );\n *\n * // Logs:\n * // 0\n * // 1000\n * // 2000\n * // 3000\n * // ...and never stops.\n *\n *\n * @see {@link from}\n * @see {@link index/Observable.create}\n *\n * @param {S} initialState Initial state.\n * @param {function (state: S): boolean} condition Condition to terminate generation (upon returning false).\n * @param {function (state: S): S} iterate Iteration step function.\n * @param {function (state: S): T} [resultSelector] Selector function for results produced in the sequence.\n * @param {Scheduler} [scheduler] A {@link Scheduler} on which to run the generator loop. If not provided, defaults to emitting immediately.\n * @return {Observable} The generated sequence.\n */\nexport function generate(initialState: S,\n condition: ConditionFunc,\n iterate: IterateFunc,\n scheduler?: SchedulerLike): Observable;\n\n/**\n * Generates an observable sequence by running a state-driven loop\n * producing the sequence's elements, using the specified scheduler\n * to send out observer messages.\n * The overload accepts options object that might contain initial state, iterate,\n * condition and scheduler.\n *\n * ![](generate.png)\n *\n * @example Produces sequence of 0, 1, 2, ... 9, then completes.\n * const res = generate({\n * initialState: 0,\n * condition: x => x < 10,\n * iterate: x => x + 1,\n * });\n *\n * @see {@link from}\n * @see {@link Observable}\n *\n * @param {GenerateBaseOptions} options Object that must contain initialState, iterate and might contain condition and scheduler.\n * @returns {Observable} The generated sequence.\n */\nexport function generate(options: GenerateBaseOptions): Observable;\n\n/**\n * Generates an observable sequence by running a state-driven loop\n * producing the sequence's elements, using the specified scheduler\n * to send out observer messages.\n * The overload accepts options object that might contain initial state, iterate,\n * condition, result selector and scheduler.\n *\n * ![](generate.png)\n *\n * @example Produces sequence of 0, 1, 2, ... 9, then completes.\n * const res = generate({\n * initialState: 0,\n * condition: x => x < 10,\n * iterate: x => x + 1,\n * resultSelector: x => x,\n * });\n *\n * @see {@link from}\n * @see {@link Observable}\n *\n * @param {GenerateOptions} options Object that must contain initialState, iterate, resultSelector and might contain condition and scheduler.\n * @returns {Observable} The generated sequence.\n */\nexport function generate(options: GenerateOptions): Observable;\n\nexport function generate(initialStateOrOptions: S | GenerateOptions,\n condition?: ConditionFunc,\n iterate?: IterateFunc,\n resultSelectorOrObservable?: (ResultFunc) | SchedulerLike,\n scheduler?: SchedulerLike): Observable {\n\n let resultSelector: ResultFunc;\n let initialState: S;\n\n if (arguments.length == 1) {\n const options = initialStateOrOptions as GenerateOptions;\n initialState = options.initialState;\n condition = options.condition;\n iterate = options.iterate;\n resultSelector = options.resultSelector || identity as ResultFunc;\n scheduler = options.scheduler;\n } else if (resultSelectorOrObservable === undefined || isScheduler(resultSelectorOrObservable)) {\n initialState = initialStateOrOptions as S;\n resultSelector = identity as ResultFunc;\n scheduler = resultSelectorOrObservable as SchedulerLike;\n } else {\n initialState = initialStateOrOptions as S;\n resultSelector = resultSelectorOrObservable as ResultFunc;\n }\n\n return new Observable(subscriber => {\n let state = initialState;\n if (scheduler) {\n return scheduler.schedule>(dispatch, 0, {\n subscriber,\n iterate,\n condition,\n resultSelector,\n state\n });\n }\n\n do {\n if (condition) {\n let conditionResult: boolean;\n try {\n conditionResult = condition(state);\n } catch (err) {\n subscriber.error(err);\n return undefined;\n }\n if (!conditionResult) {\n subscriber.complete();\n break;\n }\n }\n let value: T;\n try {\n value = resultSelector(state);\n } catch (err) {\n subscriber.error(err);\n return undefined;\n }\n subscriber.next(value);\n if (subscriber.closed) {\n break;\n }\n try {\n state = iterate(state);\n } catch (err) {\n subscriber.error(err);\n return undefined;\n }\n } while (true);\n\n return undefined;\n });\n}\n\nfunction dispatch(this: SchedulerAction>, state: SchedulerState) {\n const { subscriber, condition } = state;\n if (subscriber.closed) {\n return undefined;\n }\n if (state.needIterate) {\n try {\n state.state = state.iterate(state.state);\n } catch (err) {\n subscriber.error(err);\n return undefined;\n }\n } else {\n state.needIterate = true;\n }\n if (condition) {\n let conditionResult: boolean;\n try {\n conditionResult = condition(state.state);\n } catch (err) {\n subscriber.error(err);\n return undefined;\n }\n if (!conditionResult) {\n subscriber.complete();\n return undefined;\n }\n if (subscriber.closed) {\n return undefined;\n }\n }\n let value: T;\n try {\n value = state.resultSelector(state.state);\n } catch (err) {\n subscriber.error(err);\n return undefined;\n }\n if (subscriber.closed) {\n return undefined;\n }\n subscriber.next(value);\n if (subscriber.closed) {\n return undefined;\n }\n return this.schedule(state);\n}\n","import { Observable } from '../Observable';\nimport { ObservableInput } from '../types';\nimport { from } from './from';\nimport { isArray } from '../util/isArray';\nimport { EMPTY } from './empty';\n\n/* tslint:disable:max-line-length */\nexport function onErrorResumeNext(v: ObservableInput): Observable;\nexport function onErrorResumeNext(v2: ObservableInput, v3: ObservableInput): Observable;\nexport function onErrorResumeNext(v2: ObservableInput, v3: ObservableInput, v4: ObservableInput): Observable;\nexport function onErrorResumeNext(v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput): Observable;\nexport function onErrorResumeNext(v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput): Observable;\n\nexport function onErrorResumeNext(...observables: Array | ((...values: Array) => R)>): Observable;\nexport function onErrorResumeNext(array: ObservableInput[]): Observable;\n/* tslint:enable:max-line-length */\n\n/**\n * When any of the provided Observable emits an complete or error notification, it immediately subscribes to the next one\n * that was passed.\n *\n * Execute series of Observables no matter what, even if it means swallowing errors.\n *\n * ![](onErrorResumeNext.png)\n *\n * `onErrorResumeNext` Will subscribe to each observable source it is provided, in order.\n * If the source it's subscribed to emits an error or completes, it will move to the next source\n * without error.\n *\n * If `onErrorResumeNext` is provided no arguments, or a single, empty array, it will return {@link index/EMPTY}.\n *\n * `onErrorResumeNext` is basically {@link concat}, only it will continue, even if one of its\n * sources emits an error.\n *\n * Note that there is no way to handle any errors thrown by sources via the result of\n * `onErrorResumeNext`. If you want to handle errors thrown in any given source, you can\n * always use the {@link catchError} operator on them before passing them into `onErrorResumeNext`.\n *\n * ## Example\n * Subscribe to the next Observable after map fails\n * ```ts\n * import { onErrorResumeNext, of } from 'rxjs';\n * import { map } from 'rxjs/operators';\n *\n * onErrorResumeNext(\n * of(1, 2, 3, 0).pipe(\n * map(x => {\n * if (x === 0) throw Error();\n * return 10 / x;\n * })\n * ),\n * of(1, 2, 3),\n * )\n * .subscribe(\n * val => console.log(val),\n * err => console.log(err), // Will never be called.\n * () => console.log('done'),\n * );\n *\n * // Logs:\n * // 10\n * // 5\n * // 3.3333333333333335\n * // 1\n * // 2\n * // 3\n * // \"done\"\n * ```\n *\n * @see {@link concat}\n * @see {@link catchError}\n *\n * @param {...ObservableInput} sources Observables (or anything that *is* observable) passed either directly or as an array.\n * @return {Observable} An Observable that concatenates all sources, one after the other,\n * ignoring all errors, such that any error causes it to move on to the next source.\n */\nexport function onErrorResumeNext(...sources: Array |\n Array> |\n ((...values: Array) => R)>): Observable {\n\n if (sources.length === 0) {\n return EMPTY;\n }\n\n const [ first, ...remainder ] = sources;\n\n if (sources.length === 1 && isArray(first)) {\n return onErrorResumeNext(...first);\n }\n\n return new Observable(subscriber => {\n const subNext = () => subscriber.add(\n onErrorResumeNext(...remainder).subscribe(subscriber)\n );\n\n return from(first).subscribe({\n next(value) { subscriber.next(value); },\n error: subNext,\n complete: subNext,\n });\n });\n}\n","import { Observable } from '../Observable';\nimport { SchedulerAction, SchedulerLike } from '../types';\nimport { Subscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\n\n/**\n * Convert an object into an Observable of `[key, value]` pairs.\n *\n * Turn entries of an object into a stream.\n *\n * \n *\n * `pairs` takes an arbitrary object and returns an Observable that emits arrays. Each\n * emitted array has exactly two elements - the first is a key from the object\n * and the second is a value corresponding to that key. Keys are extracted from\n * an object via `Object.keys` function, which means that they will be only\n * enumerable keys that are present on an object directly - not ones inherited\n * via prototype chain.\n *\n * By default these arrays are emitted synchronously. To change that you can\n * pass a {@link SchedulerLike} as a second argument to `pairs`.\n *\n * @example Converts a javascript object to an Observable\n * ```ts\n * import { pairs } from 'rxjs';\n *\n * const obj = {\n * foo: 42,\n * bar: 56,\n * baz: 78\n * };\n *\n * pairs(obj)\n * .subscribe(\n * value => console.log(value),\n * err => {},\n * () => console.log('the end!')\n * );\n *\n * // Logs:\n * // [\"foo\", 42],\n * // [\"bar\", 56],\n * // [\"baz\", 78],\n * // \"the end!\"\n * ```\n *\n * @param {Object} obj The object to inspect and turn into an\n * Observable sequence.\n * @param {Scheduler} [scheduler] An optional IScheduler to schedule\n * when resulting Observable will emit values.\n * @returns {(Observable>)} An observable sequence of\n * [key, value] pairs from the object.\n */\nexport function pairs(obj: Object, scheduler?: SchedulerLike): Observable<[string, T]> {\n if (!scheduler) {\n return new Observable<[string, T]>(subscriber => {\n const keys = Object.keys(obj);\n for (let i = 0; i < keys.length && !subscriber.closed; i++) {\n const key = keys[i];\n if (obj.hasOwnProperty(key)) {\n subscriber.next([key, obj[key]]);\n }\n }\n subscriber.complete();\n });\n } else {\n return new Observable<[string, T]>(subscriber => {\n const keys = Object.keys(obj);\n const subscription = new Subscription();\n subscription.add(\n scheduler.schedule<{ keys: string[], index: number, subscriber: Subscriber<[string, T]>, subscription: Subscription, obj: Object }>\n (dispatch, 0, { keys, index: 0, subscriber, subscription, obj }));\n return subscription;\n });\n }\n}\n\n/** @internal */\nexport function dispatch(this: SchedulerAction,\n state: { keys: string[], index: number, subscriber: Subscriber<[string, T]>, subscription: Subscription, obj: Object }) {\n const { keys, index, subscriber, subscription, obj } = state;\n if (!subscriber.closed) {\n if (index < keys.length) {\n const key = keys[index];\n subscriber.next([key, obj[key]]);\n subscription.add(this.schedule({ keys, index: index + 1, subscriber, subscription, obj }));\n } else {\n subscriber.complete();\n }\n }\n}\n","export function not(pred: Function, thisArg: any): Function {\n function notPred(): any {\n return !(( notPred).pred.apply(( notPred).thisArg, arguments));\n }\n ( notPred).pred = pred;\n ( notPred).thisArg = thisArg;\n return notPred;\n}","import { not } from '../util/not';\nimport { subscribeTo } from '../util/subscribeTo';\nimport { filter } from '../operators/filter';\nimport { ObservableInput } from '../types';\nimport { Observable } from '../Observable';\n\n/**\n * Splits the source Observable into two, one with values that satisfy a\n * predicate, and another with values that don't satisfy the predicate.\n *\n * It's like {@link filter}, but returns two Observables:\n * one like the output of {@link filter}, and the other with values that did not\n * pass the condition.\n *\n * ![](partition.png)\n *\n * `partition` outputs an array with two Observables that partition the values\n * from the source Observable through the given `predicate` function. The first\n * Observable in that array emits source values for which the predicate argument\n * returns true. The second Observable emits source values for which the\n * predicate returns false. The first behaves like {@link filter} and the second\n * behaves like {@link filter} with the predicate negated.\n *\n * ## Example\n * Partition a set of numbers into odds and evens observables\n * ```ts\n * import { of, partition } from 'rxjs';\n *\n * const observableValues = of(1, 2, 3, 4, 5, 6);\n * const [evens$, odds$] = partition(observableValues, (value, index) => value % 2 === 0);\n *\n * odds$.subscribe(x => console.log('odds', x));\n * evens$.subscribe(x => console.log('evens', x));\n *\n * // Logs:\n * // odds 1\n * // odds 3\n * // odds 5\n * // evens 2\n * // evens 4\n * // evens 6\n * ```\n *\n * @see {@link filter}\n *\n * @param {function(value: T, index: number): boolean} predicate A function that\n * evaluates each value emitted by the source Observable. If it returns `true`,\n * the value is emitted on the first Observable in the returned array, if\n * `false` the value is emitted on the second Observable in the array. The\n * `index` parameter is the number `i` for the i-th source emission that has\n * happened since the subscription, starting from the number `0`.\n * @param {any} [thisArg] An optional argument to determine the value of `this`\n * in the `predicate` function.\n * @return {[Observable, Observable]} An array with two Observables: one\n * with values that passed the predicate, and another with values that did not\n * pass the predicate.\n */\nexport function partition(\n source: ObservableInput,\n predicate: (value: T, index: number) => boolean,\n thisArg?: any\n): [Observable, Observable] {\n return [\n filter(predicate, thisArg)(new Observable(subscribeTo(source))),\n filter(not(predicate, thisArg) as any)(new Observable(subscribeTo(source)))\n ] as [Observable, Observable];\n}\n","import { SchedulerAction, SchedulerLike } from '../types';\nimport { Observable } from '../Observable';\n\n/**\n * Creates an Observable that emits a sequence of numbers within a specified\n * range.\n *\n * Emits a sequence of numbers in a range.\n *\n * ![](range.png)\n *\n * `range` operator emits a range of sequential integers, in order, where you\n * select the `start` of the range and its `length`. By default, uses no\n * {@link SchedulerLike} and just delivers the notifications synchronously, but may use\n * an optional {@link SchedulerLike} to regulate those deliveries.\n *\n * ## Example\n * Emits the numbers 1 to 10\n * ```ts\n * import { range } from 'rxjs';\n *\n * const numbers = range(1, 10);\n * numbers.subscribe(x => console.log(x));\n * ```\n * @see {@link timer}\n * @see {@link index/interval}\n *\n * @param {number} [start=0] The value of the first integer in the sequence.\n * @param {number} count The number of sequential integers to generate.\n * @param {SchedulerLike} [scheduler] A {@link SchedulerLike} to use for scheduling\n * the emissions of the notifications.\n * @return {Observable} An Observable of numbers that emits a finite range of\n * sequential integers.\n * @static true\n * @name range\n * @owner Observable\n */\nexport function range(start: number = 0,\n count?: number,\n scheduler?: SchedulerLike): Observable {\n return new Observable(subscriber => {\n if (count === undefined) {\n count = start;\n start = 0;\n }\n\n let index = 0;\n let current = start;\n\n if (scheduler) {\n return scheduler.schedule(dispatch, 0, {\n index, count, start, subscriber\n });\n } else {\n do {\n if (index++ >= count) {\n subscriber.complete();\n break;\n }\n subscriber.next(current++);\n if (subscriber.closed) {\n break;\n }\n } while (true);\n }\n\n return undefined;\n });\n}\n\n/** @internal */\nexport function dispatch(this: SchedulerAction, state: any) {\n const { start, index, count, subscriber } = state;\n\n if (index >= count) {\n subscriber.complete();\n return;\n }\n\n subscriber.next(start);\n\n if (subscriber.closed) {\n return;\n }\n\n state.index = index + 1;\n state.start = start + 1;\n\n this.schedule(state);\n}\n","import { Observable } from '../Observable';\nimport { Unsubscribable, ObservableInput } from '../types';\nimport { from } from './from'; // from from from! LAWL\nimport { EMPTY } from './empty';\n\n/**\n * Creates an Observable that uses a resource which will be disposed at the same time as the Observable.\n *\n * Use it when you catch yourself cleaning up after an Observable.\n *\n * `using` is a factory operator, which accepts two functions. First function returns a disposable resource.\n * It can be an arbitrary object that implements `unsubscribe` method. Second function will be injected with\n * that object and should return an Observable. That Observable can use resource object during its execution.\n * Both functions passed to `using` will be called every time someone subscribes - neither an Observable nor\n * resource object will be shared in any way between subscriptions.\n *\n * When Observable returned by `using` is subscribed, Observable returned from the second function will be subscribed\n * as well. All its notifications (nexted values, completion and error events) will be emitted unchanged by the output\n * Observable. If however someone unsubscribes from the Observable or source Observable completes or errors by itself,\n * the `unsubscribe` method on resource object will be called. This can be used to do any necessary clean up, which\n * otherwise would have to be handled by hand. Note that complete or error notifications are not emitted when someone\n * cancels subscription to an Observable via `unsubscribe`, so `using` can be used as a hook, allowing you to make\n * sure that all resources which need to exist during an Observable execution will be disposed at appropriate time.\n *\n * @see {@link defer}\n *\n * @param {function(): ISubscription} resourceFactory A function which creates any resource object\n * that implements `unsubscribe` method.\n * @param {function(resource: ISubscription): Observable} observableFactory A function which\n * creates an Observable, that can use injected resource object.\n * @return {Observable} An Observable that behaves the same as Observable returned by `observableFactory`, but\n * which - when completed, errored or unsubscribed - will also call `unsubscribe` on created resource object.\n */\nexport function using(resourceFactory: () => Unsubscribable | void,\n observableFactory: (resource: Unsubscribable | void) => ObservableInput | void): Observable {\n return new Observable(subscriber => {\n let resource: Unsubscribable | void;\n\n try {\n resource = resourceFactory();\n } catch (err) {\n subscriber.error(err);\n return undefined;\n }\n\n let result: ObservableInput | void;\n try {\n result = observableFactory(resource);\n } catch (err) {\n subscriber.error(err);\n return undefined;\n }\n\n const source = result ? from(result) : EMPTY;\n const subscription = source.subscribe(subscriber);\n return () => {\n subscription.unsubscribe();\n if (resource) {\n resource.unsubscribe();\n }\n };\n });\n}\n","import { Observable } from '../Observable';\nimport { fromArray } from './fromArray';\nimport { isArray } from '../util/isArray';\nimport { Operator } from '../Operator';\nimport { ObservableInput, PartialObserver, ObservedValueOf } from '../types';\nimport { Subscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { InnerSubscriber } from '../InnerSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nimport { iterator as Symbol_iterator } from '../../internal/symbol/iterator';\n\n/* tslint:disable:max-line-length */\n/** @deprecated resultSelector is no longer supported, pipe to map instead */\nexport function zip, R>(v1: O1, resultSelector: (v1: ObservedValueOf) => R): Observable;\n/** @deprecated resultSelector is no longer supported, pipe to map instead */\nexport function zip, O2 extends ObservableInput, R>(v1: O1, v2: O2, resultSelector: (v1: ObservedValueOf, v2: ObservedValueOf) => R): Observable;\n/** @deprecated resultSelector is no longer supported, pipe to map instead */\nexport function zip, O2 extends ObservableInput, O3 extends ObservableInput, R>(v1: O1, v2: O2, v3: O3, resultSelector: (v1: ObservedValueOf, v2: ObservedValueOf, v3: ObservedValueOf) => R): Observable;\n/** @deprecated resultSelector is no longer supported, pipe to map instead */\nexport function zip, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, R>(v1: O1, v2: O2, v3: O3, v4: O4, resultSelector: (v1: ObservedValueOf, v2: ObservedValueOf, v3: ObservedValueOf, v4: ObservedValueOf) => R): Observable;\n/** @deprecated resultSelector is no longer supported, pipe to map instead */\nexport function zip, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, O5 extends ObservableInput, R>(v1: O1, v2: O2, v3: O3, v4: O4, v5: O5, resultSelector: (v1: ObservedValueOf, v2: ObservedValueOf, v3: ObservedValueOf, v4: ObservedValueOf, v5: ObservedValueOf) => R): Observable;\n/** @deprecated resultSelector is no longer supported, pipe to map instead */\nexport function zip, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, O5 extends ObservableInput, O6 extends ObservableInput, R>(v1: O1, v2: O2, v3: O3, v4: O4, v5: O5, v6: O6, resultSelector: (v1: ObservedValueOf, v2: ObservedValueOf, v3: ObservedValueOf, v4: ObservedValueOf, v5: ObservedValueOf, v6: ObservedValueOf) => R): Observable;\n\nexport function zip, O2 extends ObservableInput>(v1: O1, v2: O2): Observable<[ObservedValueOf, ObservedValueOf]>;\nexport function zip, O2 extends ObservableInput, O3 extends ObservableInput>(v1: O1, v2: O2, v3: O3): Observable<[ObservedValueOf, ObservedValueOf, ObservedValueOf]>;\nexport function zip, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput>(v1: O1, v2: O2, v3: O3, v4: O4): Observable<[ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf]>;\nexport function zip, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, O5 extends ObservableInput>(v1: O1, v2: O2, v3: O3, v4: O4, v5: O5): Observable<[ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf]>;\nexport function zip, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, O5 extends ObservableInput, O6 extends ObservableInput>(v1: O1, v2: O2, v3: O3, v4: O4, v5: O5, v6: O6): Observable<[ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf]>;\n\nexport function zip>(array: O[]): Observable[]>;\nexport function zip(array: ObservableInput[]): Observable;\n/** @deprecated resultSelector is no longer supported, pipe to map instead */\nexport function zip, R>(array: O[], resultSelector: (...values: ObservedValueOf[]) => R): Observable;\n/** @deprecated resultSelector is no longer supported, pipe to map instead */\nexport function zip(array: ObservableInput[], resultSelector: (...values: any[]) => R): Observable;\n\nexport function zip>(...observables: O[]): Observable[]>;\nexport function zip, R>(...observables: Array[]) => R)>): Observable;\nexport function zip(...observables: Array | ((...values: Array) => R)>): Observable;\n/* tslint:enable:max-line-length */\n\n/**\n * Combines multiple Observables to create an Observable whose values are calculated from the values, in order, of each\n * of its input Observables.\n *\n * If the last parameter is a function, this function is used to compute the created value from the input values.\n * Otherwise, an array of the input values is returned.\n *\n * ## Example\n * Combine age and name from different sources\n * ```ts\n * import { zip, of } from 'rxjs';\n * import { map } from 'rxjs/operators';\n *\n * let age$ = of(27, 25, 29);\n * let name$ = of('Foo', 'Bar', 'Beer');\n * let isDev$ = of(true, true, false);\n *\n * zip(age$, name$, isDev$).pipe(\n * map(([age, name, isDev]) => ({ age, name, isDev })),\n * )\n * .subscribe(x => console.log(x));\n *\n * // outputs\n * // { age: 27, name: 'Foo', isDev: true }\n * // { age: 25, name: 'Bar', isDev: true }\n * // { age: 29, name: 'Beer', isDev: false }\n * ```\n * @param observables\n * @return {Observable}\n * @static true\n * @name zip\n * @owner Observable\n */\nexport function zip, R>(\n ...observables: Array[]) => R)>\n): Observable[]|R> {\n const resultSelector = <((...ys: Array) => R)> observables[observables.length - 1];\n if (typeof resultSelector === 'function') {\n observables.pop();\n }\n return fromArray(observables, undefined).lift(new ZipOperator(resultSelector));\n}\n\nexport class ZipOperator implements Operator {\n\n resultSelector: (...values: Array) => R;\n\n constructor(resultSelector?: (...values: Array) => R) {\n this.resultSelector = resultSelector;\n }\n\n call(subscriber: Subscriber, source: any): any {\n return source.subscribe(new ZipSubscriber(subscriber, this.resultSelector));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class ZipSubscriber extends Subscriber {\n private values: any;\n private resultSelector: (...values: Array) => R;\n private iterators: LookAheadIterator[] = [];\n private active = 0;\n\n constructor(destination: Subscriber,\n resultSelector?: (...values: Array) => R,\n values: any = Object.create(null)) {\n super(destination);\n this.resultSelector = (typeof resultSelector === 'function') ? resultSelector : null;\n this.values = values;\n }\n\n protected _next(value: any) {\n const iterators = this.iterators;\n if (isArray(value)) {\n iterators.push(new StaticArrayIterator(value));\n } else if (typeof value[Symbol_iterator] === 'function') {\n iterators.push(new StaticIterator(value[Symbol_iterator]()));\n } else {\n iterators.push(new ZipBufferIterator(this.destination, this, value));\n }\n }\n\n protected _complete() {\n const iterators = this.iterators;\n const len = iterators.length;\n\n this.unsubscribe();\n\n if (len === 0) {\n this.destination.complete();\n return;\n }\n\n this.active = len;\n for (let i = 0; i < len; i++) {\n let iterator: ZipBufferIterator = iterators[i];\n if (iterator.stillUnsubscribed) {\n const destination = this.destination as Subscription;\n destination.add(iterator.subscribe(iterator, i));\n } else {\n this.active--; // not an observable\n }\n }\n }\n\n notifyInactive() {\n this.active--;\n if (this.active === 0) {\n this.destination.complete();\n }\n }\n\n checkIterators() {\n const iterators = this.iterators;\n const len = iterators.length;\n const destination = this.destination;\n\n // abort if not all of them have values\n for (let i = 0; i < len; i++) {\n let iterator = iterators[i];\n if (typeof iterator.hasValue === 'function' && !iterator.hasValue()) {\n return;\n }\n }\n\n let shouldComplete = false;\n const args: any[] = [];\n for (let i = 0; i < len; i++) {\n let iterator = iterators[i];\n let result = iterator.next();\n\n // check to see if it's completed now that you've gotten\n // the next value.\n if (iterator.hasCompleted()) {\n shouldComplete = true;\n }\n\n if (result.done) {\n destination.complete();\n return;\n }\n\n args.push(result.value);\n }\n\n if (this.resultSelector) {\n this._tryresultSelector(args);\n } else {\n destination.next(args);\n }\n\n if (shouldComplete) {\n destination.complete();\n }\n }\n\n protected _tryresultSelector(args: any[]) {\n let result: any;\n try {\n result = this.resultSelector.apply(this, args);\n } catch (err) {\n this.destination.error(err);\n return;\n }\n this.destination.next(result);\n }\n}\n\ninterface LookAheadIterator extends Iterator {\n hasValue(): boolean;\n hasCompleted(): boolean;\n}\n\nclass StaticIterator implements LookAheadIterator {\n private nextResult: IteratorResult;\n\n constructor(private iterator: Iterator) {\n this.nextResult = iterator.next();\n }\n\n hasValue() {\n return true;\n }\n\n next(): IteratorResult {\n const result = this.nextResult;\n this.nextResult = this.iterator.next();\n return result;\n }\n\n hasCompleted() {\n const nextResult = this.nextResult;\n return nextResult && nextResult.done;\n }\n}\n\nclass StaticArrayIterator implements LookAheadIterator {\n private index = 0;\n private length = 0;\n\n constructor(private array: T[]) {\n this.length = array.length;\n }\n\n [Symbol_iterator]() {\n return this;\n }\n\n next(value?: any): IteratorResult {\n const i = this.index++;\n const array = this.array;\n return i < this.length ? { value: array[i], done: false } : { value: null, done: true };\n }\n\n hasValue() {\n return this.array.length > this.index;\n }\n\n hasCompleted() {\n return this.array.length === this.index;\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass ZipBufferIterator extends OuterSubscriber implements LookAheadIterator {\n stillUnsubscribed = true;\n buffer: T[] = [];\n isComplete = false;\n\n constructor(destination: PartialObserver,\n private parent: ZipSubscriber,\n private observable: Observable) {\n super(destination);\n }\n\n [Symbol_iterator]() {\n return this;\n }\n\n // NOTE: there is actually a name collision here with Subscriber.next and Iterator.next\n // this is legit because `next()` will never be called by a subscription in this case.\n next(): IteratorResult {\n const buffer = this.buffer;\n if (buffer.length === 0 && this.isComplete) {\n return { value: null, done: true };\n } else {\n return { value: buffer.shift(), done: false };\n }\n }\n\n hasValue() {\n return this.buffer.length > 0;\n }\n\n hasCompleted() {\n return this.buffer.length === 0 && this.isComplete;\n }\n\n notifyComplete() {\n if (this.buffer.length > 0) {\n this.isComplete = true;\n this.parent.notifyInactive();\n } else {\n this.destination.complete();\n }\n }\n\n notifyNext(outerValue: T, innerValue: any,\n outerIndex: number, innerIndex: number,\n innerSub: InnerSubscriber): void {\n this.buffer.push(innerValue);\n this.parent.checkIterators();\n }\n\n subscribe(value: any, index: number) {\n return subscribeToResult(this, this.observable, this, index);\n }\n}\n","/* Observable */\nexport { Observable } from './internal/Observable';\nexport { ConnectableObservable } from './internal/observable/ConnectableObservable';\nexport { GroupedObservable } from './internal/operators/groupBy';\nexport { Operator } from './internal/Operator';\nexport { observable } from './internal/symbol/observable';\n\n/* Subjects */\nexport { Subject } from './internal/Subject';\nexport { BehaviorSubject } from './internal/BehaviorSubject';\nexport { ReplaySubject } from './internal/ReplaySubject';\nexport { AsyncSubject } from './internal/AsyncSubject';\n\n/* Schedulers */\nexport { asap as asapScheduler } from './internal/scheduler/asap';\nexport { async as asyncScheduler } from './internal/scheduler/async';\nexport { queue as queueScheduler } from './internal/scheduler/queue';\nexport { animationFrame as animationFrameScheduler } from './internal/scheduler/animationFrame';\nexport { VirtualTimeScheduler, VirtualAction } from './internal/scheduler/VirtualTimeScheduler';\nexport { Scheduler } from './internal/Scheduler';\n\n/* Subscription */\nexport { Subscription } from './internal/Subscription';\nexport { Subscriber } from './internal/Subscriber';\n\n/* Notification */\nexport { Notification, NotificationKind } from './internal/Notification';\n\n/* Utils */\nexport { pipe } from './internal/util/pipe';\nexport { noop } from './internal/util/noop';\nexport { identity } from './internal/util/identity';\nexport { isObservable } from './internal/util/isObservable';\n\n/* Error types */\nexport { ArgumentOutOfRangeError } from './internal/util/ArgumentOutOfRangeError';\nexport { EmptyError } from './internal/util/EmptyError';\nexport { ObjectUnsubscribedError } from './internal/util/ObjectUnsubscribedError';\nexport { UnsubscriptionError } from './internal/util/UnsubscriptionError';\nexport { TimeoutError } from './internal/util/TimeoutError';\n\n/* Static observable creation exports */\nexport { bindCallback } from './internal/observable/bindCallback';\nexport { bindNodeCallback } from './internal/observable/bindNodeCallback';\nexport { combineLatest } from './internal/observable/combineLatest';\nexport { concat } from './internal/observable/concat';\nexport { defer } from './internal/observable/defer';\nexport { empty } from './internal/observable/empty';\nexport { forkJoin } from './internal/observable/forkJoin';\nexport { from } from './internal/observable/from';\nexport { fromEvent } from './internal/observable/fromEvent';\nexport { fromEventPattern } from './internal/observable/fromEventPattern';\nexport { generate } from './internal/observable/generate';\nexport { iif } from './internal/observable/iif';\nexport { interval } from './internal/observable/interval';\nexport { merge } from './internal/observable/merge';\nexport { never } from './internal/observable/never';\nexport { of } from './internal/observable/of';\nexport { onErrorResumeNext } from './internal/observable/onErrorResumeNext';\nexport { pairs } from './internal/observable/pairs';\nexport { partition } from './internal/observable/partition';\nexport { race } from './internal/observable/race';\nexport { range } from './internal/observable/range';\nexport { throwError } from './internal/observable/throwError';\nexport { timer } from './internal/observable/timer';\nexport { using } from './internal/observable/using';\nexport { zip } from './internal/observable/zip';\nexport { scheduled } from './internal/scheduled/scheduled';\n\n/* Constants */\nexport { EMPTY } from './internal/observable/empty';\nexport { NEVER } from './internal/observable/never';\n\n/* Types */\nexport * from './internal/types';\n\n/* Config */\nexport { config } from './internal/config';\n","export function getSymbolIterator(): symbol {\n if (typeof Symbol !== 'function' || !Symbol.iterator) {\n return '@@iterator' as any;\n }\n\n return Symbol.iterator;\n}\n\nexport const iterator = getSymbolIterator();\n\n/**\n * @deprecated use {@link iterator} instead\n */\nexport const $$iterator = iterator;\n","import { SchedulerLike } from '../types';\nimport { isScheduler } from '../util/isScheduler';\nimport { fromArray } from './fromArray';\nimport { Observable } from '../Observable';\nimport { scheduleArray } from '../scheduled/scheduleArray';\n\n/* tslint:disable:max-line-length */\n/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */\nexport function of(a: T, scheduler: SchedulerLike): Observable;\n/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */\nexport function of(a: T, b: T2, scheduler: SchedulerLike): Observable;\n/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */\nexport function of(a: T, b: T2, c: T3, scheduler: SchedulerLike): Observable;\n/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */\nexport function of(a: T, b: T2, c: T3, d: T4, scheduler: SchedulerLike): Observable;\n/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */\nexport function of(a: T, b: T2, c: T3, d: T4, e: T5, scheduler: SchedulerLike): Observable;\n/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */\nexport function of(a: T, b: T2, c: T3, d: T4, e: T5, f: T6, scheduler: SchedulerLike): Observable;\n/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */\nexport function of(a: T, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7, scheduler: SchedulerLike):\n Observable;\n/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */\nexport function of(a: T, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7, h: T8, scheduler: SchedulerLike):\n Observable;\n/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */\nexport function of(a: T, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7, h: T8, i: T9, scheduler: SchedulerLike):\n Observable;\nexport function of(...args: (T | SchedulerLike)[]): Observable;\n\n// TODO(benlesh): Update the typings for this when we can switch to TS 3.x\nexport function of(a: T): Observable;\nexport function of(a: T, b: T2): Observable;\nexport function of(a: T, b: T2, c: T3): Observable;\nexport function of(a: T, b: T2, c: T3, d: T4): Observable;\nexport function of(a: T, b: T2, c: T3, d: T4, e: T5): Observable;\nexport function of(a: T, b: T2, c: T3, d: T4, e: T5, f: T6): Observable;\nexport function of(a: T, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7):\n Observable;\nexport function of(a: T, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7, h: T8):\n Observable;\nexport function of(a: T, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7, h: T8, i: T9):\n Observable;\nexport function of(...args: T[]): Observable;\n/* tslint:enable:max-line-length */\n\n/**\n * Converts the arguments to an observable sequence.\n *\n * Each argument becomes a `next` notification.\n *\n * ![](of.png)\n *\n * Unlike {@link from}, it does not do any flattening and emits each argument in whole\n * as a separate `next` notification.\n *\n * ## Examples\n *\n * Emit the values `10, 20, 30`\n *\n * ```ts\n * import { of } from 'rxjs';\n *\n * of(10, 20, 30)\n * .subscribe(\n * next => console.log('next:', next),\n * err => console.log('error:', err),\n * () => console.log('the end'),\n * );\n * // result:\n * // 'next: 10'\n * // 'next: 20'\n * // 'next: 30'\n *\n * ```\n *\n * Emit the array `[1,2,3]`\n *\n * ```ts\n * import { of } from 'rxjs';\n *\n * of([1,2,3])\n * .subscribe(\n * next => console.log('next:', next),\n * err => console.log('error:', err),\n * () => console.log('the end'),\n * );\n * // result:\n * // 'next: [1,2,3]'\n * ```\n *\n * @see {@link from}\n * @see {@link range}\n *\n * @param {...T} values A comma separated list of arguments you want to be emitted\n * @return {Observable} An Observable that emits the arguments\n * described above and then completes.\n * @method of\n * @owner Observable\n */\n\nexport function of(...args: Array): Observable {\n let scheduler = args[args.length - 1] as SchedulerLike;\n if (isScheduler(scheduler)) {\n args.pop();\n return scheduleArray(args as T[], scheduler);\n } else {\n return fromArray(args as T[]);\n }\n}\n","import { isFunction } from './util/isFunction';\nimport { empty as emptyObserver } from './Observer';\nimport { Observer, PartialObserver, TeardownLogic } from './types';\nimport { Subscription } from './Subscription';\nimport { rxSubscriber as rxSubscriberSymbol } from '../internal/symbol/rxSubscriber';\nimport { config } from './config';\nimport { hostReportError } from './util/hostReportError';\n\n/**\n * Implements the {@link Observer} interface and extends the\n * {@link Subscription} class. While the {@link Observer} is the public API for\n * consuming the values of an {@link Observable}, all Observers get converted to\n * a Subscriber, in order to provide Subscription-like capabilities such as\n * `unsubscribe`. Subscriber is a common type in RxJS, and crucial for\n * implementing operators, but it is rarely used as a public API.\n *\n * @class Subscriber\n */\nexport class Subscriber extends Subscription implements Observer {\n\n [rxSubscriberSymbol]() { return this; }\n\n /**\n * A static factory for a Subscriber, given a (potentially partial) definition\n * of an Observer.\n * @param {function(x: ?T): void} [next] The `next` callback of an Observer.\n * @param {function(e: ?any): void} [error] The `error` callback of an\n * Observer.\n * @param {function(): void} [complete] The `complete` callback of an\n * Observer.\n * @return {Subscriber} A Subscriber wrapping the (partially defined)\n * Observer represented by the given arguments.\n * @nocollapse\n */\n static create(next?: (x?: T) => void,\n error?: (e?: any) => void,\n complete?: () => void): Subscriber {\n const subscriber = new Subscriber(next, error, complete);\n subscriber.syncErrorThrowable = false;\n return subscriber;\n }\n\n /** @internal */ syncErrorValue: any = null;\n /** @internal */ syncErrorThrown: boolean = false;\n /** @internal */ syncErrorThrowable: boolean = false;\n\n protected isStopped: boolean = false;\n protected destination: PartialObserver | Subscriber; // this `any` is the escape hatch to erase extra type param (e.g. R)\n\n /**\n * @param {Observer|function(value: T): void} [destinationOrNext] A partially\n * defined Observer or a `next` callback function.\n * @param {function(e: ?any): void} [error] The `error` callback of an\n * Observer.\n * @param {function(): void} [complete] The `complete` callback of an\n * Observer.\n */\n constructor(destinationOrNext?: PartialObserver | ((value: T) => void),\n error?: (e?: any) => void,\n complete?: () => void) {\n super();\n\n switch (arguments.length) {\n case 0:\n this.destination = emptyObserver;\n break;\n case 1:\n if (!destinationOrNext) {\n this.destination = emptyObserver;\n break;\n }\n if (typeof destinationOrNext === 'object') {\n if (destinationOrNext instanceof Subscriber) {\n this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;\n this.destination = destinationOrNext;\n destinationOrNext.add(this);\n } else {\n this.syncErrorThrowable = true;\n this.destination = new SafeSubscriber(this, > destinationOrNext);\n }\n break;\n }\n default:\n this.syncErrorThrowable = true;\n this.destination = new SafeSubscriber(this, <((value: T) => void)> destinationOrNext, error, complete);\n break;\n }\n }\n\n /**\n * The {@link Observer} callback to receive notifications of type `next` from\n * the Observable, with a value. The Observable may call this method 0 or more\n * times.\n * @param {T} [value] The `next` value.\n * @return {void}\n */\n next(value?: T): void {\n if (!this.isStopped) {\n this._next(value);\n }\n }\n\n /**\n * The {@link Observer} callback to receive notifications of type `error` from\n * the Observable, with an attached `Error`. Notifies the Observer that\n * the Observable has experienced an error condition.\n * @param {any} [err] The `error` exception.\n * @return {void}\n */\n error(err?: any): void {\n if (!this.isStopped) {\n this.isStopped = true;\n this._error(err);\n }\n }\n\n /**\n * The {@link Observer} callback to receive a valueless notification of type\n * `complete` from the Observable. Notifies the Observer that the Observable\n * has finished sending push-based notifications.\n * @return {void}\n */\n complete(): void {\n if (!this.isStopped) {\n this.isStopped = true;\n this._complete();\n }\n }\n\n unsubscribe(): void {\n if (this.closed) {\n return;\n }\n this.isStopped = true;\n super.unsubscribe();\n }\n\n protected _next(value: T): void {\n this.destination.next(value);\n }\n\n protected _error(err: any): void {\n this.destination.error(err);\n this.unsubscribe();\n }\n\n protected _complete(): void {\n this.destination.complete();\n this.unsubscribe();\n }\n\n /** @deprecated This is an internal implementation detail, do not use. */\n _unsubscribeAndRecycle(): Subscriber {\n const { _parentOrParents } = this;\n this._parentOrParents = null;\n this.unsubscribe();\n this.closed = false;\n this.isStopped = false;\n this._parentOrParents = _parentOrParents;\n return this;\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class SafeSubscriber extends Subscriber {\n\n private _context: any;\n\n constructor(private _parentSubscriber: Subscriber,\n observerOrNext?: PartialObserver | ((value: T) => void),\n error?: (e?: any) => void,\n complete?: () => void) {\n super();\n\n let next: ((value: T) => void);\n let context: any = this;\n\n if (isFunction(observerOrNext)) {\n next = (<((value: T) => void)> observerOrNext);\n } else if (observerOrNext) {\n next = (> observerOrNext).next;\n error = (> observerOrNext).error;\n complete = (> observerOrNext).complete;\n if (observerOrNext !== emptyObserver) {\n context = Object.create(observerOrNext);\n if (isFunction(context.unsubscribe)) {\n this.add(<() => void> context.unsubscribe.bind(context));\n }\n context.unsubscribe = this.unsubscribe.bind(this);\n }\n }\n\n this._context = context;\n this._next = next;\n this._error = error;\n this._complete = complete;\n }\n\n next(value?: T): void {\n if (!this.isStopped && this._next) {\n const { _parentSubscriber } = this;\n if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {\n this.__tryOrUnsub(this._next, value);\n } else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {\n this.unsubscribe();\n }\n }\n }\n\n error(err?: any): void {\n if (!this.isStopped) {\n const { _parentSubscriber } = this;\n const { useDeprecatedSynchronousErrorHandling } = config;\n if (this._error) {\n if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {\n this.__tryOrUnsub(this._error, err);\n this.unsubscribe();\n } else {\n this.__tryOrSetError(_parentSubscriber, this._error, err);\n this.unsubscribe();\n }\n } else if (!_parentSubscriber.syncErrorThrowable) {\n this.unsubscribe();\n if (useDeprecatedSynchronousErrorHandling) {\n throw err;\n }\n hostReportError(err);\n } else {\n if (useDeprecatedSynchronousErrorHandling) {\n _parentSubscriber.syncErrorValue = err;\n _parentSubscriber.syncErrorThrown = true;\n } else {\n hostReportError(err);\n }\n this.unsubscribe();\n }\n }\n }\n\n complete(): void {\n if (!this.isStopped) {\n const { _parentSubscriber } = this;\n if (this._complete) {\n const wrappedComplete = () => this._complete.call(this._context);\n\n if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {\n this.__tryOrUnsub(wrappedComplete);\n this.unsubscribe();\n } else {\n this.__tryOrSetError(_parentSubscriber, wrappedComplete);\n this.unsubscribe();\n }\n } else {\n this.unsubscribe();\n }\n }\n }\n\n private __tryOrUnsub(fn: Function, value?: any): void {\n try {\n fn.call(this._context, value);\n } catch (err) {\n this.unsubscribe();\n if (config.useDeprecatedSynchronousErrorHandling) {\n throw err;\n } else {\n hostReportError(err);\n }\n }\n }\n\n private __tryOrSetError(parent: Subscriber, fn: Function, value?: any): boolean {\n if (!config.useDeprecatedSynchronousErrorHandling) {\n throw new Error('bad call');\n }\n try {\n fn.call(this._context, value);\n } catch (err) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n parent.syncErrorValue = err;\n parent.syncErrorThrown = true;\n return true;\n } else {\n hostReportError(err);\n return true;\n }\n }\n return false;\n }\n\n /** @internal This is an internal implementation detail, do not use. */\n _unsubscribe(): void {\n const { _parentSubscriber } = this;\n this._context = null;\n this._parentSubscriber = null;\n _parentSubscriber.unsubscribe();\n }\n}\n","import { ObservableInput } from '../types';\nimport { subscribeToArray } from './subscribeToArray';\nimport { subscribeToPromise } from './subscribeToPromise';\nimport { subscribeToIterable } from './subscribeToIterable';\nimport { subscribeToObservable } from './subscribeToObservable';\nimport { isArrayLike } from './isArrayLike';\nimport { isPromise } from './isPromise';\nimport { isObject } from './isObject';\nimport { iterator as Symbol_iterator } from '../symbol/iterator';\nimport { observable as Symbol_observable } from '../symbol/observable';\nimport { Subscription } from '../Subscription';\nimport { Subscriber } from '../Subscriber';\n\nexport const subscribeTo = (result: ObservableInput): (subscriber: Subscriber) => Subscription | void => {\n if (!!result && typeof result[Symbol_observable] === 'function') {\n return subscribeToObservable(result as any);\n } else if (isArrayLike(result)) {\n return subscribeToArray(result);\n } else if (isPromise(result)) {\n return subscribeToPromise(result as Promise);\n } else if (!!result && typeof result[Symbol_iterator] === 'function') {\n return subscribeToIterable(result as any);\n } else {\n const value = isObject(result) ? 'an invalid object' : `'${result}'`;\n const msg = `You provided ${value} where a stream was expected.`\n + ' You can provide an Observable, Promise, Array, or Iterable.';\n throw new TypeError(msg);\n }\n};\n","import { Subscriber } from '../Subscriber';\nimport { observable as Symbol_observable } from '../symbol/observable';\n\n/**\n * Subscribes to an object that implements Symbol.observable with the given\n * Subscriber.\n * @param obj An object that implements Symbol.observable\n */\nexport const subscribeToObservable = (obj: any) => (subscriber: Subscriber) => {\n const obs = obj[Symbol_observable]();\n if (typeof obs.subscribe !== 'function') {\n // Should be caught by observable subscribe function error handling.\n throw new TypeError('Provided object does not correctly implement Symbol.observable');\n } else {\n return obs.subscribe(subscriber);\n }\n};\n","import { Subscriber } from '../Subscriber';\nimport { hostReportError } from './hostReportError';\n\nexport const subscribeToPromise = (promise: PromiseLike) => (subscriber: Subscriber) => {\n promise.then(\n (value) => {\n if (!subscriber.closed) {\n subscriber.next(value);\n subscriber.complete();\n }\n },\n (err: any) => subscriber.error(err)\n )\n .then(null, hostReportError);\n return subscriber;\n};\n","import { Subscriber } from '../Subscriber';\nimport { iterator as Symbol_iterator } from '../symbol/iterator';\n\nexport const subscribeToIterable = (iterable: Iterable) => (subscriber: Subscriber) => {\n const iterator = iterable[Symbol_iterator]();\n do {\n const item = iterator.next();\n if (item.done) {\n subscriber.complete();\n break;\n }\n subscriber.next(item.value);\n if (subscriber.closed) {\n break;\n }\n } while (true);\n\n // Finalize the iterator if it happens to be a Generator\n if (typeof iterator.return === 'function') {\n subscriber.add(() => {\n if (iterator.return) {\n iterator.return();\n }\n });\n }\n\n return subscriber;\n};\n","import { Observable } from '../Observable';\nimport { SchedulerLike } from '../types';\n\n/**\n * The same Observable instance returned by any call to {@link empty} without a\n * `scheduler`. It is preferrable to use this over `empty()`.\n */\nexport const EMPTY = new Observable(subscriber => subscriber.complete());\n\n/**\n * Creates an Observable that emits no items to the Observer and immediately\n * emits a complete notification.\n *\n * Just emits 'complete', and nothing else.\n * \n *\n * ![](empty.png)\n *\n * This static operator is useful for creating a simple Observable that only\n * emits the complete notification. It can be used for composing with other\n * Observables, such as in a {@link mergeMap}.\n *\n * ## Examples\n * ### Emit the number 7, then complete\n * ```ts\n * import { empty } from 'rxjs';\n * import { startWith } from 'rxjs/operators';\n *\n * const result = empty().pipe(startWith(7));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * ### Map and flatten only odd numbers to the sequence 'a', 'b', 'c'\n * ```ts\n * import { empty, interval, of } from 'rxjs';\n * import { mergeMap } from 'rxjs/operators';\n *\n * const interval$ = interval(1000);\n * const result = interval$.pipe(\n * mergeMap(x => x % 2 === 1 ? of('a', 'b', 'c') : empty()),\n * );\n * result.subscribe(x => console.log(x));\n *\n * // Results in the following to the console:\n * // x is equal to the count on the interval eg(0,1,2,3,...)\n * // x will occur every 1000ms\n * // if x % 2 is equal to 1 print abc\n * // if x % 2 is not equal to 1 nothing will be output\n * ```\n *\n * @see {@link Observable}\n * @see {@link never}\n * @see {@link of}\n * @see {@link throwError}\n *\n * @param scheduler A {@link SchedulerLike} to use for scheduling\n * the emission of the complete notification.\n * @return An \"empty\" Observable: emits only the complete\n * notification.\n * @deprecated Deprecated in favor of using {@link EMPTY} constant, or {@link scheduled} (e.g. `scheduled([], scheduler)`)\n */\nexport function empty(scheduler?: SchedulerLike) {\n return scheduler ? emptyScheduled(scheduler) : EMPTY;\n}\n\nfunction emptyScheduled(scheduler: SchedulerLike) {\n return new Observable(subscriber => scheduler.schedule(() => subscriber.complete()));\n}\n","import { Observable } from '../Observable';\nimport { noop } from '../util/noop';\n\n/**\n * An Observable that emits no items to the Observer and never completes.\n *\n * ![](never.png)\n *\n * A simple Observable that emits neither values nor errors nor the completion\n * notification. It can be used for testing purposes or for composing with other\n * Observables. Please note that by never emitting a complete notification, this\n * Observable keeps the subscription from being disposed automatically.\n * Subscriptions need to be manually disposed.\n *\n * ## Example\n * ### Emit the number 7, then never emit anything else (not even complete)\n * ```ts\n * import { NEVER } from 'rxjs';\n * import { startWith } from 'rxjs/operators';\n *\n * function info() {\n * console.log('Will not be called');\n * }\n * const result = NEVER.pipe(startWith(7));\n * result.subscribe(x => console.log(x), info, info);\n *\n * ```\n *\n * @see {@link Observable}\n * @see {@link index/EMPTY}\n * @see {@link of}\n * @see {@link throwError}\n */\nexport const NEVER = new Observable(noop);\n\n/**\n * @deprecated Deprecated in favor of using {@link NEVER} constant.\n */\nexport function never () {\n return NEVER;\n}\n","import { Observable } from '../Observable';\nimport { SchedulerLike } from '../types';\nimport { subscribeToArray } from '../util/subscribeToArray';\nimport { scheduleArray } from '../scheduled/scheduleArray';\n\nexport function fromArray(input: ArrayLike, scheduler?: SchedulerLike) {\n if (!scheduler) {\n return new Observable(subscribeToArray(input));\n } else {\n return scheduleArray(input, scheduler);\n }\n}\n","import { Observable } from '../Observable';\nimport { SchedulerLike } from '../types';\nimport { Subscription } from '../Subscription';\n\nexport function scheduleArray(input: ArrayLike, scheduler: SchedulerLike) {\n return new Observable(subscriber => {\n const sub = new Subscription();\n let i = 0;\n sub.add(scheduler.schedule(function () {\n if (i === input.length) {\n subscriber.complete();\n return;\n }\n subscriber.next(input[i++]);\n if (!subscriber.closed) {\n sub.add(this.schedule());\n }\n }));\n return sub;\n });\n}\n","import { Operator } from './Operator';\nimport { Observable } from './Observable';\nimport { Subscriber } from './Subscriber';\nimport { Subscription } from './Subscription';\nimport { Observer, SubscriptionLike, TeardownLogic } from './types';\nimport { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError';\nimport { SubjectSubscription } from './SubjectSubscription';\nimport { rxSubscriber as rxSubscriberSymbol } from '../internal/symbol/rxSubscriber';\n\n/**\n * @class SubjectSubscriber\n */\nexport class SubjectSubscriber extends Subscriber {\n constructor(protected destination: Subject) {\n super(destination);\n }\n}\n\n/**\n * A Subject is a special type of Observable that allows values to be\n * multicasted to many Observers. Subjects are like EventEmitters.\n *\n * Every Subject is an Observable and an Observer. You can subscribe to a\n * Subject, and you can call next to feed values as well as error and complete.\n *\n * @class Subject\n */\nexport class Subject extends Observable implements SubscriptionLike {\n\n [rxSubscriberSymbol]() {\n return new SubjectSubscriber(this);\n }\n\n observers: Observer[] = [];\n\n closed = false;\n\n isStopped = false;\n\n hasError = false;\n\n thrownError: any = null;\n\n constructor() {\n super();\n }\n\n /**@nocollapse\n * @deprecated use new Subject() instead\n */\n static create: Function = (destination: Observer, source: Observable): AnonymousSubject => {\n return new AnonymousSubject(destination, source);\n }\n\n lift(operator: Operator): Observable {\n const subject = new AnonymousSubject(this, this);\n subject.operator = operator;\n return subject;\n }\n\n next(value?: T) {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n if (!this.isStopped) {\n const { observers } = this;\n const len = observers.length;\n const copy = observers.slice();\n for (let i = 0; i < len; i++) {\n copy[i].next(value);\n }\n }\n }\n\n error(err: any) {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n this.hasError = true;\n this.thrownError = err;\n this.isStopped = true;\n const { observers } = this;\n const len = observers.length;\n const copy = observers.slice();\n for (let i = 0; i < len; i++) {\n copy[i].error(err);\n }\n this.observers.length = 0;\n }\n\n complete() {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n this.isStopped = true;\n const { observers } = this;\n const len = observers.length;\n const copy = observers.slice();\n for (let i = 0; i < len; i++) {\n copy[i].complete();\n }\n this.observers.length = 0;\n }\n\n unsubscribe() {\n this.isStopped = true;\n this.closed = true;\n this.observers = null;\n }\n\n /** @deprecated This is an internal implementation detail, do not use. */\n _trySubscribe(subscriber: Subscriber): TeardownLogic {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n } else {\n return super._trySubscribe(subscriber);\n }\n }\n\n /** @deprecated This is an internal implementation detail, do not use. */\n _subscribe(subscriber: Subscriber): Subscription {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n } else if (this.hasError) {\n subscriber.error(this.thrownError);\n return Subscription.EMPTY;\n } else if (this.isStopped) {\n subscriber.complete();\n return Subscription.EMPTY;\n } else {\n this.observers.push(subscriber);\n return new SubjectSubscription(this, subscriber);\n }\n }\n\n /**\n * Creates a new Observable with this Subject as the source. You can do this\n * to create customize Observer-side logic of the Subject and conceal it from\n * code that uses the Observable.\n * @return {Observable} Observable that the Subject casts to\n */\n asObservable(): Observable {\n const observable = new Observable();\n (observable).source = this;\n return observable;\n }\n}\n\n/**\n * @class AnonymousSubject\n */\nexport class AnonymousSubject extends Subject {\n constructor(protected destination?: Observer, source?: Observable) {\n super();\n this.source = source;\n }\n\n next(value: T) {\n const { destination } = this;\n if (destination && destination.next) {\n destination.next(value);\n }\n }\n\n error(err: any) {\n const { destination } = this;\n if (destination && destination.error) {\n this.destination.error(err);\n }\n }\n\n complete() {\n const { destination } = this;\n if (destination && destination.complete) {\n this.destination.complete();\n }\n }\n\n /** @deprecated This is an internal implementation detail, do not use. */\n _subscribe(subscriber: Subscriber): Subscription {\n const { source } = this;\n if (source) {\n return this.source.subscribe(subscriber);\n } else {\n return Subscription.EMPTY;\n }\n }\n}\n","let nextHandle = 1;\nconst RESOLVED = (() => Promise.resolve())();\nconst activeHandles: { [key: number]: any } = {};\n\n/**\n * Finds the handle in the list of active handles, and removes it.\n * Returns `true` if found, `false` otherwise. Used both to clear\n * Immediate scheduled tasks, and to identify if a task should be scheduled.\n */\nfunction findAndClearHandle(handle: number): boolean {\n if (handle in activeHandles) {\n delete activeHandles[handle];\n return true;\n }\n return false;\n}\n\n/**\n * Helper functions to schedule and unschedule microtasks.\n */\nexport const Immediate = {\n setImmediate(cb: () => void): number {\n const handle = nextHandle++;\n activeHandles[handle] = true;\n RESOLVED.then(() => findAndClearHandle(handle) && cb());\n return handle;\n },\n\n clearImmediate(handle: number): void {\n findAndClearHandle(handle);\n },\n};\n\n/**\n * Used for internal testing purposes only. Do not export from library.\n */\nexport const TestTools = {\n pending() {\n return Object.keys(activeHandles).length;\n }\n};\n","import { Immediate } from '../util/Immediate';\nimport { AsyncAction } from './AsyncAction';\nimport { AsapScheduler } from './AsapScheduler';\nimport { SchedulerAction } from '../types';\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class AsapAction extends AsyncAction {\n\n constructor(protected scheduler: AsapScheduler,\n protected work: (this: SchedulerAction, state?: T) => void) {\n super(scheduler, work);\n }\n\n protected requestAsyncId(scheduler: AsapScheduler, id?: any, delay: number = 0): any {\n // If delay is greater than 0, request as an async action.\n if (delay !== null && delay > 0) {\n return super.requestAsyncId(scheduler, id, delay);\n }\n // Push the action to the end of the scheduler queue.\n scheduler.actions.push(this);\n // If a microtask has already been scheduled, don't schedule another\n // one. If a microtask hasn't been scheduled yet, schedule one now. Return\n // the current scheduled microtask id.\n return scheduler.scheduled || (scheduler.scheduled = Immediate.setImmediate(\n scheduler.flush.bind(scheduler, null)\n ));\n }\n protected recycleAsyncId(scheduler: AsapScheduler, id?: any, delay: number = 0): any {\n // If delay exists and is greater than 0, or if the delay is null (the\n // action wasn't rescheduled) but was originally scheduled as an async\n // action, then recycle as an async action.\n if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {\n return super.recycleAsyncId(scheduler, id, delay);\n }\n // If the scheduler queue is empty, cancel the requested microtask and\n // set the scheduled flag to undefined so the next AsapAction will schedule\n // its own.\n if (scheduler.actions.length === 0) {\n Immediate.clearImmediate(id);\n scheduler.scheduled = undefined;\n }\n // Return undefined so the action knows to request a new async id if it's rescheduled.\n return undefined;\n }\n}\n","import { AsyncAction } from './AsyncAction';\nimport { AsyncScheduler } from './AsyncScheduler';\n\nexport class AsapScheduler extends AsyncScheduler {\n public flush(action?: AsyncAction): void {\n\n this.active = true;\n this.scheduled = undefined;\n\n const {actions} = this;\n let error: any;\n let index: number = -1;\n let count: number = actions.length;\n action = action || actions.shift();\n\n do {\n if (error = action.execute(action.state, action.delay)) {\n break;\n }\n } while (++index < count && (action = actions.shift()));\n\n this.active = false;\n\n if (error) {\n while (++index < count && (action = actions.shift())) {\n action.unsubscribe();\n }\n throw error;\n }\n }\n}\n","import { AsapAction } from './AsapAction';\nimport { AsapScheduler } from './AsapScheduler';\n\n/**\n *\n * Asap Scheduler\n *\n * Perform task as fast as it can be performed asynchronously\n *\n * `asap` scheduler behaves the same as {@link asyncScheduler} scheduler when you use it to delay task\n * in time. If however you set delay to `0`, `asap` will wait for current synchronously executing\n * code to end and then it will try to execute given task as fast as possible.\n *\n * `asap` scheduler will do its best to minimize time between end of currently executing code\n * and start of scheduled task. This makes it best candidate for performing so called \"deferring\".\n * Traditionally this was achieved by calling `setTimeout(deferredTask, 0)`, but that technique involves\n * some (although minimal) unwanted delay.\n *\n * Note that using `asap` scheduler does not necessarily mean that your task will be first to process\n * after currently executing code. In particular, if some task was also scheduled with `asap` before,\n * that task will execute first. That being said, if you need to schedule task asynchronously, but\n * as soon as possible, `asap` scheduler is your best bet.\n *\n * ## Example\n * Compare async and asap scheduler<\n * ```ts\n * import { asapScheduler, asyncScheduler } from 'rxjs';\n *\n * asyncScheduler.schedule(() => console.log('async')); // scheduling 'async' first...\n * asapScheduler.schedule(() => console.log('asap'));\n *\n * // Logs:\n * // \"asap\"\n * // \"async\"\n * // ... but 'asap' goes first!\n * ```\n * @static true\n * @name asap\n * @owner Scheduler\n */\n\nexport const asap = new AsapScheduler(AsapAction);\n","import { Subject, SubjectSubscriber } from '../Subject';\nimport { Operator } from '../Operator';\nimport { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\nimport { TeardownLogic } from '../types';\nimport { refCount as higherOrderRefCount } from '../operators/refCount';\n\n/**\n * @class ConnectableObservable\n */\nexport class ConnectableObservable extends Observable {\n\n protected _subject: Subject;\n protected _refCount: number = 0;\n protected _connection: Subscription;\n /** @internal */\n _isComplete = false;\n\n constructor(public source: Observable,\n protected subjectFactory: () => Subject) {\n super();\n }\n\n /** @deprecated This is an internal implementation detail, do not use. */\n _subscribe(subscriber: Subscriber) {\n return this.getSubject().subscribe(subscriber);\n }\n\n protected getSubject(): Subject {\n const subject = this._subject;\n if (!subject || subject.isStopped) {\n this._subject = this.subjectFactory();\n }\n return this._subject;\n }\n\n connect(): Subscription {\n let connection = this._connection;\n if (!connection) {\n this._isComplete = false;\n connection = this._connection = new Subscription();\n connection.add(this.source\n .subscribe(new ConnectableSubscriber(this.getSubject(), this)));\n if (connection.closed) {\n this._connection = null;\n connection = Subscription.EMPTY;\n }\n }\n return connection;\n }\n\n refCount(): Observable {\n return higherOrderRefCount()(this) as Observable;\n }\n}\n\nexport const connectableObservableDescriptor: PropertyDescriptorMap = (() => {\n const connectableProto = ConnectableObservable.prototype;\n return {\n operator: { value: null as null },\n _refCount: { value: 0, writable: true },\n _subject: { value: null as null, writable: true },\n _connection: { value: null as null, writable: true },\n _subscribe: { value: connectableProto._subscribe },\n _isComplete: { value: connectableProto._isComplete, writable: true },\n getSubject: { value: connectableProto.getSubject },\n connect: { value: connectableProto.connect },\n refCount: { value: connectableProto.refCount }\n };\n})();\n\nclass ConnectableSubscriber extends SubjectSubscriber {\n constructor(destination: Subject,\n private connectable: ConnectableObservable) {\n super(destination);\n }\n protected _error(err: any): void {\n this._unsubscribe();\n super._error(err);\n }\n protected _complete(): void {\n this.connectable._isComplete = true;\n this._unsubscribe();\n super._complete();\n }\n protected _unsubscribe() {\n const connectable = this.connectable;\n if (connectable) {\n this.connectable = null;\n const connection = connectable._connection;\n connectable._refCount = 0;\n connectable._subject = null;\n connectable._connection = null;\n if (connection) {\n connection.unsubscribe();\n }\n }\n }\n}\n\nclass RefCountOperator implements Operator {\n constructor(private connectable: ConnectableObservable) {\n }\n call(subscriber: Subscriber, source: any): TeardownLogic {\n\n const { connectable } = this;\n ( connectable)._refCount++;\n\n const refCounter = new RefCountSubscriber(subscriber, connectable);\n const subscription = source.subscribe(refCounter);\n\n if (!refCounter.closed) {\n ( refCounter).connection = connectable.connect();\n }\n\n return subscription;\n }\n}\n\nclass RefCountSubscriber extends Subscriber {\n\n private connection: Subscription;\n\n constructor(destination: Subscriber,\n private connectable: ConnectableObservable) {\n super(destination);\n }\n\n protected _unsubscribe() {\n\n const { connectable } = this;\n if (!connectable) {\n this.connection = null;\n return;\n }\n\n this.connectable = null;\n const refCount = ( connectable)._refCount;\n if (refCount <= 0) {\n this.connection = null;\n return;\n }\n\n ( connectable)._refCount = refCount - 1;\n if (refCount > 1) {\n this.connection = null;\n return;\n }\n\n ///\n // Compare the local RefCountSubscriber's connection Subscription to the\n // connection Subscription on the shared ConnectableObservable. In cases\n // where the ConnectableObservable source synchronously emits values, and\n // the RefCountSubscriber's downstream Observers synchronously unsubscribe,\n // execution continues to here before the RefCountOperator has a chance to\n // supply the RefCountSubscriber with the shared connection Subscription.\n // For example:\n // ```\n // range(0, 10).pipe(\n // publish(),\n // refCount(),\n // take(5),\n // ).subscribe();\n // ```\n // In order to account for this case, RefCountSubscriber should only dispose\n // the ConnectableObservable's shared connection Subscription if the\n // connection Subscription exists, *and* either:\n // a. RefCountSubscriber doesn't have a reference to the shared connection\n // Subscription yet, or,\n // b. RefCountSubscriber's connection Subscription reference is identical\n // to the shared connection Subscription\n ///\n const { connection } = this;\n const sharedConnection = ( connectable)._connection;\n this.connection = null;\n\n if (sharedConnection && (!connection || sharedConnection === connection)) {\n sharedConnection.unsubscribe();\n }\n }\n}\n","/** @deprecated do not use, this is no longer checked by RxJS internals */\nexport const rxSubscriber = (() =>\n typeof Symbol === 'function'\n ? Symbol('rxSubscriber')\n : '@@rxSubscriber_' + Math.random())();\n\n/**\n * @deprecated use rxSubscriber instead\n */\nexport const $$rxSubscriber = rxSubscriber;\n","import { Subscriber } from './Subscriber';\nimport { InnerSubscriber } from './InnerSubscriber';\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class OuterSubscriber extends Subscriber {\n notifyNext(outerValue: T, innerValue: R,\n outerIndex: number, innerIndex: number,\n innerSub: InnerSubscriber): void {\n this.destination.next(innerValue);\n }\n\n notifyError(error: any, innerSub: InnerSubscriber): void {\n this.destination.error(error);\n }\n\n notifyComplete(innerSub: InnerSubscriber): void {\n this.destination.complete();\n }\n}\n","export function isObject(x: any): x is Object {\n return x !== null && typeof x === 'object';\n}\n","import { Observable } from '../Observable';\nimport { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\nimport { Notification } from '../Notification';\nimport { MonoTypeOperatorFunction, PartialObserver, SchedulerAction, SchedulerLike, TeardownLogic } from '../types';\n\n/**\n *\n * Re-emits all notifications from source Observable with specified scheduler.\n *\n * Ensure a specific scheduler is used, from outside of an Observable.\n *\n * `observeOn` is an operator that accepts a scheduler as a first parameter, which will be used to reschedule\n * notifications emitted by the source Observable. It might be useful, if you do not have control over\n * internal scheduler of a given Observable, but want to control when its values are emitted nevertheless.\n *\n * Returned Observable emits the same notifications (nexted values, complete and error events) as the source Observable,\n * but rescheduled with provided scheduler. Note that this doesn't mean that source Observables internal\n * scheduler will be replaced in any way. Original scheduler still will be used, but when the source Observable emits\n * notification, it will be immediately scheduled again - this time with scheduler passed to `observeOn`.\n * An anti-pattern would be calling `observeOn` on Observable that emits lots of values synchronously, to split\n * that emissions into asynchronous chunks. For this to happen, scheduler would have to be passed into the source\n * Observable directly (usually into the operator that creates it). `observeOn` simply delays notifications a\n * little bit more, to ensure that they are emitted at expected moments.\n *\n * As a matter of fact, `observeOn` accepts second parameter, which specifies in milliseconds with what delay notifications\n * will be emitted. The main difference between {@link delay} operator and `observeOn` is that `observeOn`\n * will delay all notifications - including error notifications - while `delay` will pass through error\n * from source Observable immediately when it is emitted. In general it is highly recommended to use `delay` operator\n * for any kind of delaying of values in the stream, while using `observeOn` to specify which scheduler should be used\n * for notification emissions in general.\n *\n * ## Example\n * Ensure values in subscribe are called just before browser repaint.\n * ```ts\n * import { interval } from 'rxjs';\n * import { observeOn } from 'rxjs/operators';\n *\n * const intervals = interval(10); // Intervals are scheduled\n * // with async scheduler by default...\n * intervals.pipe(\n * observeOn(animationFrameScheduler), // ...but we will observe on animationFrame\n * ) // scheduler to ensure smooth animation.\n * .subscribe(val => {\n * someDiv.style.height = val + 'px';\n * });\n * ```\n *\n * @see {@link delay}\n *\n * @param {SchedulerLike} scheduler Scheduler that will be used to reschedule notifications from source Observable.\n * @param {number} [delay] Number of milliseconds that states with what delay every notification should be rescheduled.\n * @return {Observable} Observable that emits the same notifications as the source Observable,\n * but with provided scheduler.\n *\n * @method observeOn\n * @owner Observable\n */\nexport function observeOn(scheduler: SchedulerLike, delay: number = 0): MonoTypeOperatorFunction {\n return function observeOnOperatorFunction(source: Observable): Observable {\n return source.lift(new ObserveOnOperator(scheduler, delay));\n };\n}\n\nexport class ObserveOnOperator implements Operator {\n constructor(private scheduler: SchedulerLike, private delay: number = 0) {\n }\n\n call(subscriber: Subscriber, source: any): TeardownLogic {\n return source.subscribe(new ObserveOnSubscriber(subscriber, this.scheduler, this.delay));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class ObserveOnSubscriber extends Subscriber {\n /** @nocollapse */\n static dispatch(this: SchedulerAction, arg: ObserveOnMessage) {\n const { notification, destination } = arg;\n notification.observe(destination);\n this.unsubscribe();\n }\n\n constructor(destination: Subscriber,\n private scheduler: SchedulerLike,\n private delay: number = 0) {\n super(destination);\n }\n\n private scheduleMessage(notification: Notification): void {\n const destination = this.destination as Subscription;\n destination.add(this.scheduler.schedule(\n ObserveOnSubscriber.dispatch,\n this.delay,\n new ObserveOnMessage(notification, this.destination)\n ));\n }\n\n protected _next(value: T): void {\n this.scheduleMessage(Notification.createNext(value));\n }\n\n protected _error(err: any): void {\n this.scheduleMessage(Notification.createError(err));\n this.unsubscribe();\n }\n\n protected _complete(): void {\n this.scheduleMessage(Notification.createComplete());\n this.unsubscribe();\n }\n}\n\nexport class ObserveOnMessage {\n constructor(public notification: Notification,\n public destination: PartialObserver) {\n }\n}\n","import { Subject } from './Subject';\nimport { SchedulerLike } from './types';\nimport { queue } from './scheduler/queue';\nimport { Subscriber } from './Subscriber';\nimport { Subscription } from './Subscription';\nimport { ObserveOnSubscriber } from './operators/observeOn';\nimport { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError';\nimport { SubjectSubscription } from './SubjectSubscription';\n/**\n * A variant of Subject that \"replays\" or emits old values to new subscribers.\n * It buffers a set number of values and will emit those values immediately to\n * any new subscribers in addition to emitting new values to existing subscribers.\n *\n * @class ReplaySubject\n */\nexport class ReplaySubject extends Subject {\n private _events: (ReplayEvent | T)[] = [];\n private _bufferSize: number;\n private _windowTime: number;\n private _infiniteTimeWindow: boolean = false;\n\n constructor(bufferSize: number = Number.POSITIVE_INFINITY,\n windowTime: number = Number.POSITIVE_INFINITY,\n private scheduler?: SchedulerLike) {\n super();\n this._bufferSize = bufferSize < 1 ? 1 : bufferSize;\n this._windowTime = windowTime < 1 ? 1 : windowTime;\n\n if (windowTime === Number.POSITIVE_INFINITY) {\n this._infiniteTimeWindow = true;\n this.next = this.nextInfiniteTimeWindow;\n } else {\n this.next = this.nextTimeWindow;\n }\n }\n\n private nextInfiniteTimeWindow(value: T): void {\n const _events = this._events;\n _events.push(value);\n // Since this method is invoked in every next() call than the buffer\n // can overgrow the max size only by one item\n if (_events.length > this._bufferSize) {\n _events.shift();\n }\n\n super.next(value);\n }\n\n private nextTimeWindow(value: T): void {\n this._events.push(new ReplayEvent(this._getNow(), value));\n this._trimBufferThenGetEvents();\n\n super.next(value);\n }\n\n /** @deprecated This is an internal implementation detail, do not use. */\n _subscribe(subscriber: Subscriber): Subscription {\n // When `_infiniteTimeWindow === true` then the buffer is already trimmed\n const _infiniteTimeWindow = this._infiniteTimeWindow;\n const _events = _infiniteTimeWindow ? this._events : this._trimBufferThenGetEvents();\n const scheduler = this.scheduler;\n const len = _events.length;\n let subscription: Subscription;\n\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n } else if (this.isStopped || this.hasError) {\n subscription = Subscription.EMPTY;\n } else {\n this.observers.push(subscriber);\n subscription = new SubjectSubscription(this, subscriber);\n }\n\n if (scheduler) {\n subscriber.add(subscriber = new ObserveOnSubscriber(subscriber, scheduler));\n }\n\n if (_infiniteTimeWindow) {\n for (let i = 0; i < len && !subscriber.closed; i++) {\n subscriber.next(_events[i]);\n }\n } else {\n for (let i = 0; i < len && !subscriber.closed; i++) {\n subscriber.next((>_events[i]).value);\n }\n }\n\n if (this.hasError) {\n subscriber.error(this.thrownError);\n } else if (this.isStopped) {\n subscriber.complete();\n }\n\n return subscription;\n }\n\n _getNow(): number {\n return (this.scheduler || queue).now();\n }\n\n private _trimBufferThenGetEvents(): ReplayEvent[] {\n const now = this._getNow();\n const _bufferSize = this._bufferSize;\n const _windowTime = this._windowTime;\n const _events = []>this._events;\n\n const eventsCount = _events.length;\n let spliceCount = 0;\n\n // Trim events that fall out of the time window.\n // Start at the front of the list. Break early once\n // we encounter an event that falls within the window.\n while (spliceCount < eventsCount) {\n if ((now - _events[spliceCount].time) < _windowTime) {\n break;\n }\n spliceCount++;\n }\n\n if (eventsCount > _bufferSize) {\n spliceCount = Math.max(spliceCount, eventsCount - _bufferSize);\n }\n\n if (spliceCount > 0) {\n _events.splice(0, spliceCount);\n }\n\n return _events;\n }\n\n}\n\nclass ReplayEvent {\n constructor(public time: number, public value: T) {\n }\n}\n","import { AsyncAction } from './AsyncAction';\nimport { AsyncScheduler } from './AsyncScheduler';\n\n/**\n *\n * Async Scheduler\n *\n * Schedule task as if you used setTimeout(task, duration)\n *\n * `async` scheduler schedules tasks asynchronously, by putting them on the JavaScript\n * event loop queue. It is best used to delay tasks in time or to schedule tasks repeating\n * in intervals.\n *\n * If you just want to \"defer\" task, that is to perform it right after currently\n * executing synchronous code ends (commonly achieved by `setTimeout(deferredTask, 0)`),\n * better choice will be the {@link asapScheduler} scheduler.\n *\n * ## Examples\n * Use async scheduler to delay task\n * ```ts\n * import { asyncScheduler } from 'rxjs';\n *\n * const task = () => console.log('it works!');\n *\n * asyncScheduler.schedule(task, 2000);\n *\n * // After 2 seconds logs:\n * // \"it works!\"\n * ```\n *\n * Use async scheduler to repeat task in intervals\n * ```ts\n * import { asyncScheduler } from 'rxjs';\n *\n * function task(state) {\n * console.log(state);\n * this.schedule(state + 1, 1000); // `this` references currently executing Action,\n * // which we reschedule with new state and delay\n * }\n *\n * asyncScheduler.schedule(task, 3000, 0);\n *\n * // Logs:\n * // 0 after 3s\n * // 1 after 4s\n * // 2 after 5s\n * // 3 after 6s\n * ```\n *\n * @static true\n * @name async\n * @owner Scheduler\n */\n\nexport const async = new AsyncScheduler(AsyncAction);\n","import { Observable } from '../Observable';\nimport { ObservableInput, ObservedValuesFromArray, ObservedValueOf, SubscribableOrPromise } from '../types';\nimport { isArray } from '../util/isArray';\nimport { map } from '../operators/map';\nimport { isObject } from '../util/isObject';\nimport { isObservable } from '../util/isObservable';\nimport { from } from './from';\n\n/* tslint:disable:max-line-length */\n\n// forkJoin(a$, b$, c$)\n/** @deprecated Use the version that takes an array of Observables instead */\nexport function forkJoin(v1: SubscribableOrPromise): Observable<[T]>;\n/** @deprecated Use the version that takes an array of Observables instead */\nexport function forkJoin(v1: ObservableInput, v2: ObservableInput): Observable<[T, T2]>;\n/** @deprecated Use the version that takes an array of Observables instead */\nexport function forkJoin(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput): Observable<[T, T2, T3]>;\n/** @deprecated Use the version that takes an array of Observables instead */\nexport function forkJoin(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput): Observable<[T, T2, T3, T4]>;\n/** @deprecated Use the version that takes an array of Observables instead */\nexport function forkJoin(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput): Observable<[T, T2, T3, T4, T5]>;\n/** @deprecated Use the version that takes an array of Observables instead */\nexport function forkJoin(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput): Observable<[T, T2, T3, T4, T5, T6]>;\n\n// forkJoin([a$, b$, c$]);\n// TODO(benlesh): Uncomment for TS 3.0\n// export function forkJoin(sources: []): Observable;\nexport function forkJoin(sources: [ObservableInput]): Observable<[A]>;\nexport function forkJoin(sources: [ObservableInput, ObservableInput]): Observable<[A, B]>;\nexport function forkJoin(sources: [ObservableInput, ObservableInput, ObservableInput]): Observable<[A, B, C]>;\nexport function forkJoin(sources: [ObservableInput, ObservableInput, ObservableInput, ObservableInput]): Observable<[A, B, C, D]>;\nexport function forkJoin(sources: [ObservableInput, ObservableInput, ObservableInput, ObservableInput, ObservableInput]): Observable<[A, B, C, D, E]>;\nexport function forkJoin(sources: [ObservableInput, ObservableInput, ObservableInput, ObservableInput, ObservableInput, ObservableInput]): Observable<[A, B, C, D, E, F]>;\nexport function forkJoin[]>(sources: A): Observable[]>;\n\n// forkJoin({})\nexport function forkJoin(sourcesObject: {}): Observable;\nexport function forkJoin(sourcesObject: T): Observable<{ [K in keyof T]: ObservedValueOf }>;\n\n/** @deprecated resultSelector is deprecated, pipe to map instead */\nexport function forkJoin(...args: Array|Function>): Observable;\n/** @deprecated Use the version that takes an array of Observables instead */\nexport function forkJoin(...sources: ObservableInput[]): Observable;\n/* tslint:enable:max-line-length */\n\n/**\n * Accepts an `Array` of {@link ObservableInput} or a dictionary `Object` of {@link ObservableInput} and returns\n * an {@link Observable} that emits either an array of values in the exact same order as the passed array,\n * or a dictionary of values in the same shape as the passed dictionary.\n *\n * Wait for Observables to complete and then combine last values they emitted.\n *\n * ![](forkJoin.png)\n *\n * `forkJoin` is an operator that takes any number of input observables which can be passed either as an array\n * or a dictionary of input observables. If no input observables are provided, resulting stream will complete\n * immediately.\n *\n * `forkJoin` will wait for all passed observables to complete and then it will emit an array or an object with last\n * values from corresponding observables.\n *\n * If you pass an array of `n` observables to the operator, resulting\n * array will have `n` values, where first value is the last thing emitted by the first observable,\n * second value is the last thing emitted by the second observable and so on.\n *\n * If you pass a dictionary of observables to the operator, resulting\n * objects will have the same keys as the dictionary passed, with their last values they've emitted\n * located at the corresponding key.\n *\n * That means `forkJoin` will not emit more than once and it will complete after that. If you need to emit combined\n * values not only at the end of lifecycle of passed observables, but also throughout it, try out {@link combineLatest}\n * or {@link zip} instead.\n *\n * In order for resulting array to have the same length as the number of input observables, whenever any of\n * that observables completes without emitting any value, `forkJoin` will complete at that moment as well\n * and it will not emit anything either, even if it already has some last values from other observables.\n * Conversely, if there is an observable that never completes, `forkJoin` will never complete as well,\n * unless at any point some other observable completes without emitting value, which brings us back to\n * the previous case. Overall, in order for `forkJoin` to emit a value, all observables passed as arguments\n * have to emit something at least once and complete.\n *\n * If any input observable errors at some point, `forkJoin` will error as well and all other observables\n * will be immediately unsubscribed.\n *\n * Optionally `forkJoin` accepts project function, that will be called with values which normally\n * would land in emitted array. Whatever is returned by project function, will appear in output\n * observable instead. This means that default project can be thought of as a function that takes\n * all its arguments and puts them into an array. Note that project function will be called only\n * when output observable is supposed to emit a result.\n *\n * ## Examples\n *\n * ### Use forkJoin with a dictionary of observable inputs\n * ```ts\n * import { forkJoin, of, timer } from 'rxjs';\n *\n * const observable = forkJoin({\n * foo: of(1, 2, 3, 4),\n * bar: Promise.resolve(8),\n * baz: timer(4000),\n * });\n * observable.subscribe({\n * next: value => console.log(value),\n * complete: () => console.log('This is how it ends!'),\n * });\n *\n * // Logs:\n * // { foo: 4, bar: 8, baz: 0 } after 4 seconds\n * // \"This is how it ends!\" immediately after\n * ```\n *\n * ### Use forkJoin with an array of observable inputs\n * ```ts\n * import { forkJoin, of } from 'rxjs';\n *\n * const observable = forkJoin([\n * of(1, 2, 3, 4),\n * Promise.resolve(8),\n * timer(4000),\n * ]);\n * observable.subscribe({\n * next: value => console.log(value),\n * complete: () => console.log('This is how it ends!'),\n * });\n *\n * // Logs:\n * // [4, 8, 0] after 4 seconds\n * // \"This is how it ends!\" immediately after\n * ```\n *\n * @see {@link combineLatest}\n * @see {@link zip}\n *\n * @param {...ObservableInput} sources Any number of Observables provided either as an array or as an arguments\n * passed directly to the operator.\n * @param {function} [project] Function that takes values emitted by input Observables and returns value\n * that will appear in resulting Observable instead of default array.\n * @return {Observable} Observable emitting either an array of last values emitted by passed Observables\n * or value from project function.\n */\nexport function forkJoin(\n ...sources: any[]\n): Observable {\n if (sources.length === 1) {\n const first = sources[0];\n if (isArray(first)) {\n return forkJoinInternal(first, null);\n }\n // TODO(benlesh): isObservable check will not be necessary when deprecated path is removed.\n if (isObject(first) && Object.getPrototypeOf(first) === Object.prototype) {\n const keys = Object.keys(first);\n return forkJoinInternal(keys.map(key => first[key]), keys);\n }\n }\n\n // DEPRECATED PATHS BELOW HERE\n if (typeof sources[sources.length - 1] === 'function') {\n const resultSelector = sources.pop() as Function;\n sources = (sources.length === 1 && isArray(sources[0])) ? sources[0] : sources;\n return forkJoinInternal(sources, null).pipe(\n map((args: any[]) => resultSelector(...args))\n );\n }\n\n return forkJoinInternal(sources, null);\n}\n\nfunction forkJoinInternal(sources: ObservableInput[], keys: string[] | null): Observable {\n return new Observable(subscriber => {\n const len = sources.length;\n if (len === 0) {\n subscriber.complete();\n return;\n }\n const values = new Array(len);\n let completed = 0;\n let emitted = 0;\n for (let i = 0; i < len; i++) {\n const source = from(sources[i]);\n let hasValue = false;\n subscriber.add(source.subscribe({\n next: value => {\n if (!hasValue) {\n hasValue = true;\n emitted++;\n }\n values[i] = value;\n },\n error: err => subscriber.error(err),\n complete: () => {\n completed++;\n if (completed === len || !hasValue) {\n if (emitted === len) {\n subscriber.next(keys ?\n keys.reduce((result, key, i) => (result[key] = values[i], result), {}) :\n values);\n }\n subscriber.complete();\n }\n }\n }));\n }\n });\n}\n","import { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { Observable } from '../Observable';\nimport { OperatorFunction, MonoTypeOperatorFunction, TeardownLogic } from '../types';\n\n/* tslint:disable:max-line-length */\nexport function filter(predicate: (value: T, index: number) => value is S,\n thisArg?: any): OperatorFunction;\nexport function filter(predicate: (value: T, index: number) => boolean,\n thisArg?: any): MonoTypeOperatorFunction;\n/* tslint:enable:max-line-length */\n\n/**\n * Filter items emitted by the source Observable by only emitting those that\n * satisfy a specified predicate.\n *\n * Like\n * [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter),\n * it only emits a value from the source if it passes a criterion function.\n *\n * ![](filter.png)\n *\n * Similar to the well-known `Array.prototype.filter` method, this operator\n * takes values from the source Observable, passes them through a `predicate`\n * function and only emits those values that yielded `true`.\n *\n * ## Example\n * Emit only click events whose target was a DIV element\n * ```ts\n * import { fromEvent } from 'rxjs';\n * import { filter } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const clicksOnDivs = clicks.pipe(filter(ev => ev.target.tagName === 'DIV'));\n * clicksOnDivs.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link distinct}\n * @see {@link distinctUntilChanged}\n * @see {@link distinctUntilKeyChanged}\n * @see {@link ignoreElements}\n * @see {@link partition}\n * @see {@link skip}\n *\n * @param {function(value: T, index: number): boolean} predicate A function that\n * evaluates each value emitted by the source Observable. If it returns `true`,\n * the value is emitted, if `false` the value is not passed to the output\n * Observable. The `index` parameter is the number `i` for the i-th source\n * emission that has happened since the subscription, starting from the number\n * `0`.\n * @param {any} [thisArg] An optional argument to determine the value of `this`\n * in the `predicate` function.\n * @return {Observable} An Observable of values from the source that were\n * allowed by the `predicate` function.\n * @method filter\n * @owner Observable\n */\nexport function filter(predicate: (value: T, index: number) => boolean,\n thisArg?: any): MonoTypeOperatorFunction {\n return function filterOperatorFunction(source: Observable): Observable {\n return source.lift(new FilterOperator(predicate, thisArg));\n };\n}\n\nclass FilterOperator implements Operator {\n constructor(private predicate: (value: T, index: number) => boolean,\n private thisArg?: any) {\n }\n\n call(subscriber: Subscriber, source: any): TeardownLogic {\n return source.subscribe(new FilterSubscriber(subscriber, this.predicate, this.thisArg));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass FilterSubscriber extends Subscriber {\n\n count: number = 0;\n\n constructor(destination: Subscriber,\n private predicate: (value: T, index: number) => boolean,\n private thisArg: any) {\n super(destination);\n }\n\n // the try catch block below is left specifically for\n // optimization and perf reasons. a tryCatcher is not necessary here.\n protected _next(value: T) {\n let result: any;\n try {\n result = this.predicate.call(this.thisArg, value, this.count++);\n } catch (err) {\n this.destination.error(err);\n return;\n }\n if (result) {\n this.destination.next(value);\n }\n }\n}\n","import { Observable } from '../Observable';\nimport { isArray } from '../util/isArray';\nimport { fromArray } from './fromArray';\nimport { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\nimport { TeardownLogic, ObservableInput } from '../types';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { InnerSubscriber } from '../InnerSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\n\n// tslint:disable:max-line-length\nexport function race(arg: [ObservableInput]): Observable;\nexport function race(arg: [ObservableInput, ObservableInput]): Observable;\nexport function race(arg: [ObservableInput, ObservableInput, ObservableInput]): Observable;\nexport function race(arg: [ObservableInput, ObservableInput, ObservableInput, ObservableInput]): Observable;\nexport function race(arg: [ObservableInput, ObservableInput, ObservableInput, ObservableInput, ObservableInput]): Observable;\nexport function race(arg: ObservableInput[]): Observable;\nexport function race(arg: ObservableInput[]): Observable<{}>;\n\nexport function race(a: ObservableInput): Observable;\nexport function race(a: ObservableInput, b: ObservableInput): Observable;\nexport function race(a: ObservableInput, b: ObservableInput, c: ObservableInput): Observable;\nexport function race(a: ObservableInput, b: ObservableInput, c: ObservableInput, d: ObservableInput): Observable;\nexport function race(a: ObservableInput, b: ObservableInput, c: ObservableInput, d: ObservableInput, e: ObservableInput): Observable;\n// tslint:enable:max-line-length\n\nexport function race(observables: ObservableInput[]): Observable;\nexport function race(observables: ObservableInput[]): Observable<{}>;\nexport function race(...observables: ObservableInput[]): Observable;\nexport function race(...observables: ObservableInput[]): Observable<{}>;\n\n/**\n * Returns an Observable that mirrors the first source Observable to emit an item.\n *\n * ## Example\n * ### Subscribes to the observable that was the first to start emitting.\n *\n * ```ts\n * import { race, interval } from 'rxjs';\n * import { mapTo } from 'rxjs/operators';\n *\n * const obs1 = interval(1000).pipe(mapTo('fast one'));\n * const obs2 = interval(3000).pipe(mapTo('medium one'));\n * const obs3 = interval(5000).pipe(mapTo('slow one'));\n *\n * race(obs3, obs1, obs2)\n * .subscribe(\n * winner => console.log(winner)\n * );\n *\n * // result:\n * // a series of 'fast one'\n * ```\n *\n * @param {...Observables} ...observables sources used to race for which Observable emits first.\n * @return {Observable} an Observable that mirrors the output of the first Observable to emit an item.\n * @static true\n * @name race\n * @owner Observable\n */\nexport function race(...observables: ObservableInput[]): Observable {\n // if the only argument is an array, it was most likely called with\n // `race([obs1, obs2, ...])`\n if (observables.length === 1) {\n if (isArray(observables[0])) {\n observables = observables[0] as Observable[];\n } else {\n return observables[0] as Observable;\n }\n }\n\n return fromArray(observables, undefined).lift(new RaceOperator());\n}\n\nexport class RaceOperator implements Operator {\n call(subscriber: Subscriber, source: any): TeardownLogic {\n return source.subscribe(new RaceSubscriber(subscriber));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class RaceSubscriber extends OuterSubscriber {\n private hasFirst: boolean = false;\n private observables: Observable[] = [];\n private subscriptions: Subscription[] = [];\n\n constructor(destination: Subscriber) {\n super(destination);\n }\n\n protected _next(observable: any): void {\n this.observables.push(observable);\n }\n\n protected _complete() {\n const observables = this.observables;\n const len = observables.length;\n\n if (len === 0) {\n this.destination.complete();\n } else {\n for (let i = 0; i < len && !this.hasFirst; i++) {\n let observable = observables[i];\n let subscription = subscribeToResult(this, observable, observable as any, i);\n\n if (this.subscriptions) {\n this.subscriptions.push(subscription);\n }\n this.add(subscription);\n }\n this.observables = null;\n }\n }\n\n notifyNext(outerValue: T, innerValue: T,\n outerIndex: number, innerIndex: number,\n innerSub: InnerSubscriber): void {\n if (!this.hasFirst) {\n this.hasFirst = true;\n\n for (let i = 0; i < this.subscriptions.length; i++) {\n if (i !== outerIndex) {\n let subscription = this.subscriptions[i];\n\n subscription.unsubscribe();\n this.remove(subscription);\n }\n }\n\n this.subscriptions = null;\n }\n\n this.destination.next(innerValue);\n }\n}\n","import { Observable } from '../Observable';\nimport { SchedulerLike } from '../types';\nimport { Subscriber } from '../Subscriber';\n\n/**\n * Creates an Observable that emits no items to the Observer and immediately\n * emits an error notification.\n *\n * Just emits 'error', and nothing else.\n * \n *\n * ![](throw.png)\n *\n * This static operator is useful for creating a simple Observable that only\n * emits the error notification. It can be used for composing with other\n * Observables, such as in a {@link mergeMap}.\n *\n * ## Examples\n * ### Emit the number 7, then emit an error\n * ```ts\n * import { throwError, concat, of } from 'rxjs';\n *\n * const result = concat(of(7), throwError(new Error('oops!')));\n * result.subscribe(x => console.log(x), e => console.error(e));\n *\n * // Logs:\n * // 7\n * // Error: oops!\n * ```\n *\n * ---\n *\n * ### Map and flatten numbers to the sequence 'a', 'b', 'c', but throw an error for 2\n * ```ts\n * import { throwError, interval, of } from 'rxjs';\n * import { mergeMap } from 'rxjs/operators';\n *\n * interval(1000).pipe(\n * mergeMap(x => x === 2\n * ? throwError('Twos are bad')\n * : of('a', 'b', 'c')\n * ),\n * ).subscribe(x => console.log(x), e => console.error(e));\n *\n * // Logs:\n * // a\n * // b\n * // c\n * // a\n * // b\n * // c\n * // Twos are bad\n * ```\n *\n * @see {@link Observable}\n * @see {@link empty}\n * @see {@link never}\n * @see {@link of}\n *\n * @param {any} error The particular Error to pass to the error notification.\n * @param {SchedulerLike} [scheduler] A {@link SchedulerLike} to use for scheduling\n * the emission of the error notification.\n * @return {Observable} An error Observable: emits only the error notification\n * using the given error argument.\n * @static true\n * @name throwError\n * @owner Observable\n */\nexport function throwError(error: any, scheduler?: SchedulerLike): Observable {\n if (!scheduler) {\n return new Observable(subscriber => subscriber.error(error));\n } else {\n return new Observable(subscriber => scheduler.schedule(dispatch, 0, { error, subscriber }));\n }\n}\n\ninterface DispatchArg {\n error: any;\n subscriber: Subscriber;\n}\n\nfunction dispatch({ error, subscriber }: DispatchArg) {\n subscriber.error(error);\n}\n","\nimport { mergeMap } from './mergeMap';\nimport { identity } from '../util/identity';\nimport { OperatorFunction, ObservableInput } from '../types';\n\n/**\n * Converts a higher-order Observable into a first-order Observable which\n * concurrently delivers all values that are emitted on the inner Observables.\n *\n * Flattens an Observable-of-Observables.\n *\n * ![](mergeAll.png)\n *\n * `mergeAll` subscribes to an Observable that emits Observables, also known as\n * a higher-order Observable. Each time it observes one of these emitted inner\n * Observables, it subscribes to that and delivers all the values from the\n * inner Observable on the output Observable. The output Observable only\n * completes once all inner Observables have completed. Any error delivered by\n * a inner Observable will be immediately emitted on the output Observable.\n *\n * ## Examples\n * Spawn a new interval Observable for each click event, and blend their outputs as one Observable\n * ```ts\n * import { fromEvent, interval } from 'rxjs';\n * import { map, mergeAll } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const higherOrder = clicks.pipe(map((ev) => interval(1000)));\n * const firstOrder = higherOrder.pipe(mergeAll());\n * firstOrder.subscribe(x => console.log(x));\n * ```\n *\n * Count from 0 to 9 every second for each click, but only allow 2 concurrent timers\n * ```ts\n * import { fromEvent, interval } from 'rxjs';\n * import { take, map, mergeAll } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const higherOrder = clicks.pipe(\n * map((ev) => interval(1000).pipe(take(10))),\n * );\n * const firstOrder = higherOrder.pipe(mergeAll(2));\n * firstOrder.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link combineAll}\n * @see {@link concatAll}\n * @see {@link exhaust}\n * @see {@link merge}\n * @see {@link mergeMap}\n * @see {@link mergeMapTo}\n * @see {@link mergeScan}\n * @see {@link switchAll}\n * @see {@link switchMap}\n * @see {@link zipAll}\n *\n * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of inner\n * Observables being subscribed to concurrently.\n * @return {Observable} An Observable that emits values coming from all the\n * inner Observables emitted by the source Observable.\n * @method mergeAll\n * @owner Observable\n */\nexport function mergeAll(concurrent: number = Number.POSITIVE_INFINITY): OperatorFunction, T> {\n return mergeMap(identity, concurrent);\n}\n","export interface UnsubscriptionError extends Error {\n readonly errors: any[];\n}\n\nexport interface UnsubscriptionErrorCtor {\n new(errors: any[]): UnsubscriptionError;\n}\n\nconst UnsubscriptionErrorImpl = (() => {\n function UnsubscriptionErrorImpl(this: any, errors: any[]) {\n Error.call(this);\n this.message = errors ?\n `${errors.length} errors occurred during unsubscription:\n${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\\n ')}` : '';\n this.name = 'UnsubscriptionError';\n this.errors = errors;\n return this;\n }\n\n UnsubscriptionErrorImpl.prototype = Object.create(Error.prototype);\n\n return UnsubscriptionErrorImpl;\n})();\n\n/**\n * An error thrown when one or more errors have occurred during the\n * `unsubscribe` of a {@link Subscription}.\n */\nexport const UnsubscriptionError: UnsubscriptionErrorCtor = UnsubscriptionErrorImpl as any;","export interface ArgumentOutOfRangeError extends Error {\n}\n\nexport interface ArgumentOutOfRangeErrorCtor {\n new(): ArgumentOutOfRangeError;\n}\n\nconst ArgumentOutOfRangeErrorImpl = (() => {\n function ArgumentOutOfRangeErrorImpl(this: any) {\n Error.call(this);\n this.message = 'argument out of range';\n this.name = 'ArgumentOutOfRangeError';\n return this;\n }\n\n ArgumentOutOfRangeErrorImpl.prototype = Object.create(Error.prototype);\n\n return ArgumentOutOfRangeErrorImpl;\n})();\n\n/**\n * An error thrown when an element was queried at a certain index of an\n * Observable, but no such index or position exists in that sequence.\n *\n * @see {@link elementAt}\n * @see {@link take}\n * @see {@link takeLast}\n *\n * @class ArgumentOutOfRangeError\n */\nexport const ArgumentOutOfRangeError: ArgumentOutOfRangeErrorCtor = ArgumentOutOfRangeErrorImpl as any;","import { Observable } from '../Observable';\nimport { isArray } from '../util/isArray';\nimport { isFunction } from '../util/isFunction';\nimport { Subscriber } from '../Subscriber';\nimport { map } from '../operators/map';\n\nconst toString: Function = (() => Object.prototype.toString)();\n\nexport interface NodeStyleEventEmitter {\n addListener: (eventName: string | symbol, handler: NodeEventHandler) => this;\n removeListener: (eventName: string | symbol, handler: NodeEventHandler) => this;\n}\n\nexport type NodeEventHandler = (...args: any[]) => void;\n\n// For APIs that implement `addListener` and `removeListener` methods that may\n// not use the same arguments or return EventEmitter values\n// such as React Native\nexport interface NodeCompatibleEventEmitter {\n addListener: (eventName: string, handler: NodeEventHandler) => void | {};\n removeListener: (eventName: string, handler: NodeEventHandler) => void | {};\n}\n\nexport interface JQueryStyleEventEmitter {\n on: (eventName: string, handler: Function) => void;\n off: (eventName: string, handler: Function) => void;\n}\n\nexport interface HasEventTargetAddRemove {\n addEventListener(type: string, listener: ((evt: E) => void) | null, options?: boolean | AddEventListenerOptions): void;\n removeEventListener(type: string, listener?: ((evt: E) => void) | null, options?: EventListenerOptions | boolean): void;\n}\n\nexport type EventTargetLike = HasEventTargetAddRemove | NodeStyleEventEmitter | NodeCompatibleEventEmitter | JQueryStyleEventEmitter;\n\nexport type FromEventTarget = EventTargetLike | ArrayLike>;\n\nexport interface EventListenerOptions {\n capture?: boolean;\n passive?: boolean;\n once?: boolean;\n}\n\nexport interface AddEventListenerOptions extends EventListenerOptions {\n once?: boolean;\n passive?: boolean;\n}\n\n/* tslint:disable:max-line-length */\nexport function fromEvent(target: FromEventTarget, eventName: string): Observable;\n/** @deprecated resultSelector no longer supported, pipe to map instead */\nexport function fromEvent(target: FromEventTarget, eventName: string, resultSelector: (...args: any[]) => T): Observable;\nexport function fromEvent(target: FromEventTarget, eventName: string, options: EventListenerOptions): Observable;\n/** @deprecated resultSelector no longer supported, pipe to map instead */\nexport function fromEvent(target: FromEventTarget, eventName: string, options: EventListenerOptions, resultSelector: (...args: any[]) => T): Observable;\n/* tslint:enable:max-line-length */\n\n/**\n * Creates an Observable that emits events of a specific type coming from the\n * given event target.\n *\n * Creates an Observable from DOM events, or Node.js\n * EventEmitter events or others.\n *\n * ![](fromEvent.png)\n *\n * `fromEvent` accepts as a first argument event target, which is an object with methods\n * for registering event handler functions. As a second argument it takes string that indicates\n * type of event we want to listen for. `fromEvent` supports selected types of event targets,\n * which are described in detail below. If your event target does not match any of the ones listed,\n * you should use {@link fromEventPattern}, which can be used on arbitrary APIs.\n * When it comes to APIs supported by `fromEvent`, their methods for adding and removing event\n * handler functions have different names, but they all accept a string describing event type\n * and function itself, which will be called whenever said event happens.\n *\n * Every time resulting Observable is subscribed, event handler function will be registered\n * to event target on given event type. When that event fires, value\n * passed as a first argument to registered function will be emitted by output Observable.\n * When Observable is unsubscribed, function will be unregistered from event target.\n *\n * Note that if event target calls registered function with more than one argument, second\n * and following arguments will not appear in resulting stream. In order to get access to them,\n * you can pass to `fromEvent` optional project function, which will be called with all arguments\n * passed to event handler. Output Observable will then emit value returned by project function,\n * instead of the usual value.\n *\n * Remember that event targets listed below are checked via duck typing. It means that\n * no matter what kind of object you have and no matter what environment you work in,\n * you can safely use `fromEvent` on that object if it exposes described methods (provided\n * of course they behave as was described above). So for example if Node.js library exposes\n * event target which has the same method names as DOM EventTarget, `fromEvent` is still\n * a good choice.\n *\n * If the API you use is more callback then event handler oriented (subscribed\n * callback function fires only once and thus there is no need to manually\n * unregister it), you should use {@link bindCallback} or {@link bindNodeCallback}\n * instead.\n *\n * `fromEvent` supports following types of event targets:\n *\n * **DOM EventTarget**\n *\n * This is an object with `addEventListener` and `removeEventListener` methods.\n *\n * In the browser, `addEventListener` accepts - apart from event type string and event\n * handler function arguments - optional third parameter, which is either an object or boolean,\n * both used for additional configuration how and when passed function will be called. When\n * `fromEvent` is used with event target of that type, you can provide this values\n * as third parameter as well.\n *\n * **Node.js EventEmitter**\n *\n * An object with `addListener` and `removeListener` methods.\n *\n * **JQuery-style event target**\n *\n * An object with `on` and `off` methods\n *\n * **DOM NodeList**\n *\n * List of DOM Nodes, returned for example by `document.querySelectorAll` or `Node.childNodes`.\n *\n * Although this collection is not event target in itself, `fromEvent` will iterate over all Nodes\n * it contains and install event handler function in every of them. When returned Observable\n * is unsubscribed, function will be removed from all Nodes.\n *\n * **DOM HtmlCollection**\n *\n * Just as in case of NodeList it is a collection of DOM nodes. Here as well event handler function is\n * installed and removed in each of elements.\n *\n *\n * ## Examples\n * ### Emits clicks happening on the DOM document\n * ```ts\n * import { fromEvent } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * clicks.subscribe(x => console.log(x));\n *\n * // Results in:\n * // MouseEvent object logged to console every time a click\n * // occurs on the document.\n * ```\n *\n * ### Use addEventListener with capture option\n * ```ts\n * import { fromEvent } from 'rxjs';\n *\n * const clicksInDocument = fromEvent(document, 'click', true); // note optional configuration parameter\n * // which will be passed to addEventListener\n * const clicksInDiv = fromEvent(someDivInDocument, 'click');\n *\n * clicksInDocument.subscribe(() => console.log('document'));\n * clicksInDiv.subscribe(() => console.log('div'));\n *\n * // By default events bubble UP in DOM tree, so normally\n * // when we would click on div in document\n * // \"div\" would be logged first and then \"document\".\n * // Since we specified optional `capture` option, document\n * // will catch event when it goes DOWN DOM tree, so console\n * // will log \"document\" and then \"div\".\n * ```\n *\n * @see {@link bindCallback}\n * @see {@link bindNodeCallback}\n * @see {@link fromEventPattern}\n *\n * @param {FromEventTarget} target The DOM EventTarget, Node.js\n * EventEmitter, JQuery-like event target, NodeList or HTMLCollection to attach the event handler to.\n * @param {string} eventName The event name of interest, being emitted by the\n * `target`.\n * @param {EventListenerOptions} [options] Options to pass through to addEventListener\n * @return {Observable}\n * @name fromEvent\n */\nexport function fromEvent(\n target: FromEventTarget,\n eventName: string,\n options?: EventListenerOptions | ((...args: any[]) => T),\n resultSelector?: ((...args: any[]) => T)\n): Observable {\n\n if (isFunction(options)) {\n // DEPRECATED PATH\n resultSelector = options;\n options = undefined;\n }\n if (resultSelector) {\n // DEPRECATED PATH\n return fromEvent(target, eventName, options).pipe(\n map(args => isArray(args) ? resultSelector(...args) : resultSelector(args))\n );\n }\n\n return new Observable(subscriber => {\n function handler(e: T) {\n if (arguments.length > 1) {\n subscriber.next(Array.prototype.slice.call(arguments));\n } else {\n subscriber.next(e);\n }\n }\n setupSubscription(target, eventName, handler, subscriber, options as EventListenerOptions);\n });\n}\n\nfunction setupSubscription(sourceObj: FromEventTarget, eventName: string,\n handler: (...args: any[]) => void, subscriber: Subscriber,\n options?: EventListenerOptions) {\n let unsubscribe: () => void;\n if (isEventTarget(sourceObj)) {\n const source = sourceObj;\n sourceObj.addEventListener(eventName, handler, options);\n unsubscribe = () => source.removeEventListener(eventName, handler, options);\n } else if (isJQueryStyleEventEmitter(sourceObj)) {\n const source = sourceObj;\n sourceObj.on(eventName, handler);\n unsubscribe = () => source.off(eventName, handler);\n } else if (isNodeStyleEventEmitter(sourceObj)) {\n const source = sourceObj;\n sourceObj.addListener(eventName, handler as NodeEventHandler);\n unsubscribe = () => source.removeListener(eventName, handler as NodeEventHandler);\n } else if (sourceObj && (sourceObj as any).length) {\n for (let i = 0, len = (sourceObj as any).length; i < len; i++) {\n setupSubscription(sourceObj[i], eventName, handler, subscriber, options);\n }\n } else {\n throw new TypeError('Invalid event target');\n }\n\n subscriber.add(unsubscribe);\n}\n\nfunction isNodeStyleEventEmitter(sourceObj: any): sourceObj is NodeStyleEventEmitter {\n return sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function';\n}\n\nfunction isJQueryStyleEventEmitter(sourceObj: any): sourceObj is JQueryStyleEventEmitter {\n return sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function';\n}\n\nfunction isEventTarget(sourceObj: any): sourceObj is HasEventTargetAddRemove {\n return sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function';\n}\n","\nimport { mergeAll } from './mergeAll';\nimport { OperatorFunction, ObservableInput } from '../types';\n\nexport function concatAll(): OperatorFunction, T>;\nexport function concatAll(): OperatorFunction;\n\n/**\n * Converts a higher-order Observable into a first-order Observable by\n * concatenating the inner Observables in order.\n *\n * Flattens an Observable-of-Observables by putting one\n * inner Observable after the other.\n *\n * ![](concatAll.png)\n *\n * Joins every Observable emitted by the source (a higher-order Observable), in\n * a serial fashion. It subscribes to each inner Observable only after the\n * previous inner Observable has completed, and merges all of their values into\n * the returned observable.\n *\n * __Warning:__ If the source Observable emits Observables quickly and\n * endlessly, and the inner Observables it emits generally complete slower than\n * the source emits, you can run into memory issues as the incoming Observables\n * collect in an unbounded buffer.\n *\n * Note: `concatAll` is equivalent to `mergeAll` with concurrency parameter set\n * to `1`.\n *\n * ## Example\n *\n * For each click event, tick every second from 0 to 3, with no concurrency\n * ```ts\n * import { fromEvent, interval } from 'rxjs';\n * import { map, take, concatAll } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const higherOrder = clicks.pipe(\n * map(ev => interval(1000).pipe(take(4))),\n * );\n * const firstOrder = higherOrder.pipe(concatAll());\n * firstOrder.subscribe(x => console.log(x));\n *\n * // Results in the following:\n * // (results are not concurrent)\n * // For every click on the \"document\" it will emit values 0 to 3 spaced\n * // on a 1000ms interval\n * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3\n * ```\n *\n * @see {@link combineAll}\n * @see {@link concat}\n * @see {@link concatMap}\n * @see {@link concatMapTo}\n * @see {@link exhaust}\n * @see {@link mergeAll}\n * @see {@link switchAll}\n * @see {@link switchMap}\n * @see {@link zipAll}\n *\n * @return {Observable} An Observable emitting values from all the inner\n * Observables concatenated.\n * @method concatAll\n * @owner Observable\n */\nexport function concatAll(): OperatorFunction, T> {\n return mergeAll(1);\n}\n","import { Observable } from '../Observable';\nimport { ObservableInput, SchedulerLike, ObservedValueOf } from '../types';\nimport { isScheduler } from '../util/isScheduler';\nimport { of } from './of';\nimport { from } from './from';\nimport { concatAll } from '../operators/concatAll';\n\n/* tslint:disable:max-line-length */\n/** @deprecated Use {@link scheduled} and {@link concatAll} (e.g. `scheduled([o1, o2, o3], scheduler).pipe(concatAll())`) */\nexport function concat>(v1: O1, scheduler: SchedulerLike): Observable>;\n/** @deprecated Use {@link scheduled} and {@link concatAll} (e.g. `scheduled([o1, o2, o3], scheduler).pipe(concatAll())`) */\nexport function concat, O2 extends ObservableInput>(v1: O1, v2: O2, scheduler: SchedulerLike): Observable | ObservedValueOf>;\n/** @deprecated Use {@link scheduled} and {@link concatAll} (e.g. `scheduled([o1, o2, o3], scheduler).pipe(concatAll())`) */\nexport function concat, O2 extends ObservableInput, O3 extends ObservableInput>(v1: O1, v2: O2, v3: O3, scheduler: SchedulerLike): Observable | ObservedValueOf | ObservedValueOf>;\n/** @deprecated Use {@link scheduled} and {@link concatAll} (e.g. `scheduled([o1, o2, o3], scheduler).pipe(concatAll())`) */\nexport function concat, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput>(v1: O1, v2: O2, v3: O3, v4: O4, scheduler: SchedulerLike): Observable | ObservedValueOf | ObservedValueOf | ObservedValueOf>;\n/** @deprecated Use {@link scheduled} and {@link concatAll} (e.g. `scheduled([o1, o2, o3], scheduler).pipe(concatAll())`) */\nexport function concat, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, O5 extends ObservableInput>(v1: O1, v2: O2, v3: O3, v4: O4, v5: O5, scheduler: SchedulerLike): Observable | ObservedValueOf | ObservedValueOf | ObservedValueOf | ObservedValueOf>;\n/** @deprecated Use {@link scheduled} and {@link concatAll} (e.g. `scheduled([o1, o2, o3], scheduler).pipe(concatAll())`) */\nexport function concat, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, O5 extends ObservableInput, O6 extends ObservableInput>(v1: O1, v2: O2, v3: O3, v4: O4, v5: O5, v6: O6, scheduler: SchedulerLike): Observable | ObservedValueOf | ObservedValueOf | ObservedValueOf | ObservedValueOf | ObservedValueOf>;\n\nexport function concat>(v1: O1): Observable>;\nexport function concat, O2 extends ObservableInput>(v1: O1, v2: O2): Observable | ObservedValueOf>;\nexport function concat, O2 extends ObservableInput, O3 extends ObservableInput>(v1: O1, v2: O2, v3: O3): Observable | ObservedValueOf | ObservedValueOf>;\nexport function concat, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput>(v1: O1, v2: O2, v3: O3, v4: O4): Observable | ObservedValueOf | ObservedValueOf | ObservedValueOf>;\nexport function concat, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, O5 extends ObservableInput>(v1: O1, v2: O2, v3: O3, v4: O4, v5: O5): Observable | ObservedValueOf | ObservedValueOf | ObservedValueOf | ObservedValueOf>;\nexport function concat, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, O5 extends ObservableInput, O6 extends ObservableInput>(v1: O1, v2: O2, v3: O3, v4: O4, v5: O5, v6: O6): Observable | ObservedValueOf | ObservedValueOf | ObservedValueOf | ObservedValueOf | ObservedValueOf>;\nexport function concat>(...observables: O[]): Observable>;\n/** @deprecated Use {@link scheduled} and {@link concatAll} (e.g. `scheduled([o1, o2, o3], scheduler).pipe(concatAll())`) */\nexport function concat>(...observables: (O | SchedulerLike)[]): Observable>;\nexport function concat(...observables: ObservableInput[]): Observable;\n/** @deprecated Use {@link scheduled} and {@link concatAll} (e.g. `scheduled([o1, o2, o3], scheduler).pipe(concatAll())`) */\nexport function concat(...observables: (ObservableInput | SchedulerLike)[]): Observable;\n/* tslint:enable:max-line-length */\n/**\n * Creates an output Observable which sequentially emits all values from given\n * Observable and then moves on to the next.\n *\n * Concatenates multiple Observables together by\n * sequentially emitting their values, one Observable after the other.\n *\n * ![](concat.png)\n *\n * `concat` joins multiple Observables together, by subscribing to them one at a time and\n * merging their results into the output Observable. You can pass either an array of\n * Observables, or put them directly as arguments. Passing an empty array will result\n * in Observable that completes immediately.\n *\n * `concat` will subscribe to first input Observable and emit all its values, without\n * changing or affecting them in any way. When that Observable completes, it will\n * subscribe to then next Observable passed and, again, emit its values. This will be\n * repeated, until the operator runs out of Observables. When last input Observable completes,\n * `concat` will complete as well. At any given moment only one Observable passed to operator\n * emits values. If you would like to emit values from passed Observables concurrently, check out\n * {@link merge} instead, especially with optional `concurrent` parameter. As a matter of fact,\n * `concat` is an equivalent of `merge` operator with `concurrent` parameter set to `1`.\n *\n * Note that if some input Observable never completes, `concat` will also never complete\n * and Observables following the one that did not complete will never be subscribed. On the other\n * hand, if some Observable simply completes immediately after it is subscribed, it will be\n * invisible for `concat`, which will just move on to the next Observable.\n *\n * If any Observable in chain errors, instead of passing control to the next Observable,\n * `concat` will error immediately as well. Observables that would be subscribed after\n * the one that emitted error, never will.\n *\n * If you pass to `concat` the same Observable many times, its stream of values\n * will be \"replayed\" on every subscription, which means you can repeat given Observable\n * as many times as you like. If passing the same Observable to `concat` 1000 times becomes tedious,\n * you can always use {@link repeat}.\n *\n * ## Examples\n * ### Concatenate a timer counting from 0 to 3 with a synchronous sequence from 1 to 10\n * ```ts\n * import { concat, interval, range } from 'rxjs';\n * import { take } from 'rxjs/operators';\n *\n * const timer = interval(1000).pipe(take(4));\n * const sequence = range(1, 10);\n * const result = concat(timer, sequence);\n * result.subscribe(x => console.log(x));\n *\n * // results in:\n * // 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 -immediate-> 1 ... 10\n * ```\n *\n * ### Concatenate 3 Observables\n * ```ts\n * import { concat, interval } from 'rxjs';\n * import { take } from 'rxjs/operators';\n *\n * const timer1 = interval(1000).pipe(take(10));\n * const timer2 = interval(2000).pipe(take(6));\n * const timer3 = interval(500).pipe(take(10));\n *\n * const result = concat(timer1, timer2, timer3);\n * result.subscribe(x => console.log(x));\n *\n * // results in the following:\n * // (Prints to console sequentially)\n * // -1000ms-> 0 -1000ms-> 1 -1000ms-> ... 9\n * // -2000ms-> 0 -2000ms-> 1 -2000ms-> ... 5\n * // -500ms-> 0 -500ms-> 1 -500ms-> ... 9\n * ```\n *\n * ### Concatenate the same Observable to repeat it\n * ```ts\n * import { concat, interval } from 'rxjs';\n * import { take } from 'rxjs/operators';\n *\n * const timer = interval(1000).pipe(take(2));\n *\n * concat(timer, timer) // concatenating the same Observable!\n * .subscribe(\n * value => console.log(value),\n * err => {},\n * () => console.log('...and it is done!')\n * );\n *\n * // Logs:\n * // 0 after 1s\n * // 1 after 2s\n * // 0 after 3s\n * // 1 after 4s\n * // \"...and it is done!\" also after 4s\n * ```\n *\n * @see {@link concatAll}\n * @see {@link concatMap}\n * @see {@link concatMapTo}\n * @see {@link startWith}\n * @see {@link endWith}\n *\n * @param {ObservableInput} input1 An input Observable to concatenate with others.\n * @param {ObservableInput} input2 An input Observable to concatenate with others.\n * More than one input Observables may be given as argument.\n * @param {SchedulerLike} [scheduler=null] An optional {@link SchedulerLike} to schedule each\n * Observable subscription on.\n * @return {Observable} All values of each passed Observable merged into a\n * single Observable, in order, in serial fashion.\n * @static true\n * @name concat\n * @owner Observable\n */\nexport function concat, R>(...observables: Array): Observable | R> {\n return concatAll()(of(...observables));\n}\n","import { Observable } from '../Observable';\nimport { ObservableInput, SchedulerLike, ObservedValueOf } from '../types';\nimport { isScheduler } from '../util/isScheduler';\nimport { isArray } from '../util/isArray';\nimport { Subscriber } from '../Subscriber';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { Operator } from '../Operator';\nimport { InnerSubscriber } from '../InnerSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nimport { fromArray } from './fromArray';\n\nconst NONE = {};\n\n/* tslint:disable:max-line-length */\n\n// If called with a single array, it \"auto-spreads\" the array, with result selector\n/** @deprecated resultSelector no longer supported, pipe to map instead */\nexport function combineLatest, R>(sources: [O1], resultSelector: (v1: ObservedValueOf) => R, scheduler?: SchedulerLike): Observable;\n/** @deprecated resultSelector no longer supported, pipe to map instead */\nexport function combineLatest, O2 extends ObservableInput, R>(sources: [O1, O2], resultSelector: (v1: ObservedValueOf, v2: ObservedValueOf) => R, scheduler?: SchedulerLike): Observable;\n/** @deprecated resultSelector no longer supported, pipe to map instead */\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput, R>(sources: [O1, O2, O3], resultSelector: (v1: ObservedValueOf, v2: ObservedValueOf, v3: ObservedValueOf) => R, scheduler?: SchedulerLike): Observable;\n/** @deprecated resultSelector no longer supported, pipe to map instead */\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, R>(sources: [O1, O2, O3, O4], resultSelector: (v1: ObservedValueOf, v2: ObservedValueOf, v3: ObservedValueOf, v4: ObservedValueOf) => R, scheduler?: SchedulerLike): Observable;\n/** @deprecated resultSelector no longer supported, pipe to map instead */\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, O5 extends ObservableInput, R>(sources: [O1, O2, O3, O4, O5], resultSelector: (v1: ObservedValueOf, v2: ObservedValueOf, v3: ObservedValueOf, v4: ObservedValueOf, v5: ObservedValueOf) => R, scheduler?: SchedulerLike): Observable;\n/** @deprecated resultSelector no longer supported, pipe to map instead */\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, O5 extends ObservableInput, O6 extends ObservableInput, R>(sources: [O1, O2, O3, O4, O5, O6], resultSelector: (v1: ObservedValueOf, v2: ObservedValueOf, v3: ObservedValueOf, v4: ObservedValueOf, v5: ObservedValueOf, v6: ObservedValueOf) => R, scheduler?: SchedulerLike): Observable;\n/** @deprecated resultSelector no longer supported, pipe to map instead */\nexport function combineLatest, R>(sources: O[], resultSelector: (...args: ObservedValueOf[]) => R, scheduler?: SchedulerLike): Observable;\n\n// standard call, but with a result selector\n/** @deprecated resultSelector no longer supported, pipe to map instead */\nexport function combineLatest, R>(v1: O1, resultSelector: (v1: ObservedValueOf) => R, scheduler?: SchedulerLike): Observable;\n/** @deprecated resultSelector no longer supported, pipe to map instead */\nexport function combineLatest, O2 extends ObservableInput, R>(v1: O1, v2: O2, resultSelector: (v1: ObservedValueOf, v2: ObservedValueOf) => R, scheduler?: SchedulerLike): Observable;\n/** @deprecated resultSelector no longer supported, pipe to map instead */\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput, R>(v1: O1, v2: O2, v3: O3, resultSelector: (v1: ObservedValueOf, v2: ObservedValueOf, v3: ObservedValueOf) => R, scheduler?: SchedulerLike): Observable;\n/** @deprecated resultSelector no longer supported, pipe to map instead */\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, R>(v1: O1, v2: O2, v3: O3, v4: O4, resultSelector: (v1: ObservedValueOf, v2: ObservedValueOf, v3: ObservedValueOf, v4: ObservedValueOf) => R, scheduler?: SchedulerLike): Observable;\n/** @deprecated resultSelector no longer supported, pipe to map instead */\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, O5 extends ObservableInput, R>(v1: O1, v2: O2, v3: O3, v4: O4, v5: O5, resultSelector: (v1: ObservedValueOf, v2: ObservedValueOf, v3: ObservedValueOf, v4: ObservedValueOf, v5: ObservedValueOf) => R, scheduler?: SchedulerLike): Observable;\n/** @deprecated resultSelector no longer supported, pipe to map instead */\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, O5 extends ObservableInput, O6 extends ObservableInput, R>(v1: O1, v2: O2, v3: O3, v4: O4, v5: O5, v6: O6, resultSelector: (v1: ObservedValueOf, v2: ObservedValueOf, v3: ObservedValueOf, v4: ObservedValueOf, v5: ObservedValueOf, v6: ObservedValueOf) => R, scheduler?: SchedulerLike): Observable;\n\n// With a scheduler (deprecated)\n/** @deprecated Passing a scheduler here is deprecated, use {@link subscribeOn} and/or {@link observeOn} instead */\nexport function combineLatest>(sources: [O1], scheduler: SchedulerLike): Observable<[ObservedValueOf]>;\n/** @deprecated Passing a scheduler here is deprecated, use {@link subscribeOn} and/or {@link observeOn} instead */\nexport function combineLatest, O2 extends ObservableInput>(sources: [O1, O2], scheduler: SchedulerLike): Observable<[ObservedValueOf, ObservedValueOf]>;\n/** @deprecated Passing a scheduler here is deprecated, use {@link subscribeOn} and/or {@link observeOn} instead */\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput>(sources: [O1, O2, O3], scheduler: SchedulerLike): Observable<[ObservedValueOf, ObservedValueOf, ObservedValueOf]>;\n/** @deprecated Passing a scheduler here is deprecated, use {@link subscribeOn} and/or {@link observeOn} instead */\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput>(sources: [O1, O2, O3, O4], scheduler: SchedulerLike): Observable<[ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf]>;\n/** @deprecated Passing a scheduler here is deprecated, use {@link subscribeOn} and/or {@link observeOn} instead */\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, O5 extends ObservableInput>(sources: [O1, O2, O3, O4, O5], scheduler: SchedulerLike): Observable<[ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf]>;\n/** @deprecated Passing a scheduler here is deprecated, use {@link subscribeOn} and/or {@link observeOn} instead */\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, O5 extends ObservableInput, O6 extends ObservableInput>(sources: [O1, O2, O3, O4, O5, O6], scheduler: SchedulerLike): Observable<[ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf]>;\n/** @deprecated Passing a scheduler here is deprecated, use {@link subscribeOn} and/or {@link observeOn} instead */\nexport function combineLatest>(sources: O[], scheduler: SchedulerLike): Observable[]>;\n\n// Best case\nexport function combineLatest>(sources: [O1]): Observable<[ObservedValueOf]>;\nexport function combineLatest, O2 extends ObservableInput>(sources: [O1, O2]): Observable<[ObservedValueOf, ObservedValueOf]>;\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput>(sources: [O1, O2, O3]): Observable<[ObservedValueOf, ObservedValueOf, ObservedValueOf]>;\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput>(sources: [O1, O2, O3, O4]): Observable<[ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf]>;\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, O5 extends ObservableInput>(sources: [O1, O2, O3, O4, O5]): Observable<[ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf]>;\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, O5 extends ObservableInput, O6 extends ObservableInput>(sources: [O1, O2, O3, O4, O5, O6]): Observable<[ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf]>;\nexport function combineLatest>(sources: O[]): Observable[]>;\n\n// Standard calls\n/** @deprecated Pass arguments in a single array instead `combineLatest([a, b, c])` */\nexport function combineLatest>(v1: O1, scheduler?: SchedulerLike): Observable<[ObservedValueOf]>;\n/** @deprecated Pass arguments in a single array instead `combineLatest([a, b, c])` */\nexport function combineLatest, O2 extends ObservableInput>(v1: O1, v2: O2, scheduler?: SchedulerLike): Observable<[ObservedValueOf, ObservedValueOf]>;\n/** @deprecated Pass arguments in a single array instead `combineLatest([a, b, c])` */\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput>(v1: O1, v2: O2, v3: O3, scheduler?: SchedulerLike): Observable<[ObservedValueOf, ObservedValueOf, ObservedValueOf]>;\n/** @deprecated Pass arguments in a single array instead `combineLatest([a, b, c])` */\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput>(v1: O1, v2: O2, v3: O3, v4: O4, scheduler?: SchedulerLike): Observable<[ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf]>;\n/** @deprecated Pass arguments in a single array instead `combineLatest([a, b, c])` */\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, O5 extends ObservableInput>(v1: O1, v2: O2, v3: O3, v4: O4, v5: O5, scheduler?: SchedulerLike): Observable<[ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf]>;\n/** @deprecated Pass arguments in a single array instead `combineLatest([a, b, c])` */\nexport function combineLatest, O2 extends ObservableInput, O3 extends ObservableInput, O4 extends ObservableInput, O5 extends ObservableInput, O6 extends ObservableInput>(v1: O1, v2: O2, v3: O3, v4: O4, v5: O5, v6: O6, scheduler?: SchedulerLike): Observable<[ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf, ObservedValueOf]>;\n\n/** @deprecated Pass arguments in a single array instead `combineLatest([a, b, c])` */\nexport function combineLatest>(...observables: O[]): Observable;\n\n/** @deprecated Pass arguments in a single array instead `combineLatest([a, b, c])` */\nexport function combineLatest, R>(...observables: Array | ((...values: Array) => R)>): Observable;\n\n/** @deprecated resultSelector no longer supported, pipe to map instead */\nexport function combineLatest, R>(array: O[], resultSelector: (...values: ObservedValueOf[]) => R, scheduler?: SchedulerLike): Observable;\n\n/** @deprecated Passing a scheduler here is deprecated, use {@link subscribeOn} and/or {@link observeOn} instead */\nexport function combineLatest>(...observables: Array): Observable;\n\n/** @deprecated Passing a scheduler here is deprecated, use {@link subscribeOn} and/or {@link observeOn} instead */\nexport function combineLatest, R>(...observables: Array[]) => R) | SchedulerLike>): Observable;\n\n/** @deprecated Passing a scheduler here is deprecated, use {@link subscribeOn} and/or {@link observeOn} instead */\nexport function combineLatest(...observables: Array | ((...values: Array) => R) | SchedulerLike>): Observable;\n/* tslint:enable:max-line-length */\n\n/**\n * Combines multiple Observables to create an Observable whose values are\n * calculated from the latest values of each of its input Observables.\n *\n * Whenever any input Observable emits a value, it\n * computes a formula using the latest values from all the inputs, then emits\n * the output of that formula.\n *\n * ![](combineLatest.png)\n *\n * `combineLatest` combines the values from all the Observables passed as\n * arguments. This is done by subscribing to each Observable in order and,\n * whenever any Observable emits, collecting an array of the most recent\n * values from each Observable. So if you pass `n` Observables to operator,\n * returned Observable will always emit an array of `n` values, in order\n * corresponding to order of passed Observables (value from the first Observable\n * on the first place and so on).\n *\n * Static version of `combineLatest` accepts either an array of Observables\n * or each Observable can be put directly as an argument. Note that array of\n * Observables is good choice, if you don't know beforehand how many Observables\n * you will combine. Passing empty array will result in Observable that\n * completes immediately.\n *\n * To ensure output array has always the same length, `combineLatest` will\n * actually wait for all input Observables to emit at least once,\n * before it starts emitting results. This means if some Observable emits\n * values before other Observables started emitting, all these values but the last\n * will be lost. On the other hand, if some Observable does not emit a value but\n * completes, resulting Observable will complete at the same moment without\n * emitting anything, since it will be now impossible to include value from\n * completed Observable in resulting array. Also, if some input Observable does\n * not emit any value and never completes, `combineLatest` will also never emit\n * and never complete, since, again, it will wait for all streams to emit some\n * value.\n *\n * If at least one Observable was passed to `combineLatest` and all passed Observables\n * emitted something, resulting Observable will complete when all combined\n * streams complete. So even if some Observable completes, result of\n * `combineLatest` will still emit values when other Observables do. In case\n * of completed Observable, its value from now on will always be the last\n * emitted value. On the other hand, if any Observable errors, `combineLatest`\n * will error immediately as well, and all other Observables will be unsubscribed.\n *\n * `combineLatest` accepts as optional parameter `project` function, which takes\n * as arguments all values that would normally be emitted by resulting Observable.\n * `project` can return any kind of value, which will be then emitted by Observable\n * instead of default array. Note that `project` does not take as argument that array\n * of values, but values themselves. That means default `project` can be imagined\n * as function that takes all its arguments and puts them into an array.\n *\n * ## Examples\n * ### Combine two timer Observables\n * ```ts\n * import { combineLatest, timer } from 'rxjs';\n *\n * const firstTimer = timer(0, 1000); // emit 0, 1, 2... after every second, starting from now\n * const secondTimer = timer(500, 1000); // emit 0, 1, 2... after every second, starting 0,5s from now\n * const combinedTimers = combineLatest(firstTimer, secondTimer);\n * combinedTimers.subscribe(value => console.log(value));\n * // Logs\n * // [0, 0] after 0.5s\n * // [1, 0] after 1s\n * // [1, 1] after 1.5s\n * // [2, 1] after 2s\n * ```\n *\n * ### Combine an array of Observables\n * ```ts\n * import { combineLatest, of } from 'rxjs';\n * import { delay, starWith } from 'rxjs/operators';\n *\n * const observables = [1, 5, 10].map(\n * n => of(n).pipe(\n * delay(n * 1000), // emit 0 and then emit n after n seconds\n * startWith(0),\n * )\n * );\n * const combined = combineLatest(observables);\n * combined.subscribe(value => console.log(value));\n * // Logs\n * // [0, 0, 0] immediately\n * // [1, 0, 0] after 1s\n * // [1, 5, 0] after 5s\n * // [1, 5, 10] after 10s\n * ```\n *\n *\n * ### Use project function to dynamically calculate the Body-Mass Index\n * ```ts\n * import { combineLatest, of } from 'rxjs';\n * import { map } from 'rxjs/operators';\n *\n * const weight = of(70, 72, 76, 79, 75);\n * const height = of(1.76, 1.77, 1.78);\n * const bmi = combineLatest(weight, height).pipe(\n * map(([w, h]) => w / (h * h)),\n * );\n * bmi.subscribe(x => console.log('BMI is ' + x));\n *\n * // With output to console:\n * // BMI is 24.212293388429753\n * // BMI is 23.93948099205209\n * // BMI is 23.671253629592222\n * ```\n *\n * @see {@link combineAll}\n * @see {@link merge}\n * @see {@link withLatestFrom}\n *\n * @param {ObservableInput} observable1 An input Observable to combine with other Observables.\n * @param {ObservableInput} observable2 An input Observable to combine with other Observables.\n * More than one input Observables may be given as arguments\n * or an array of Observables may be given as the first argument.\n * @param {function} [project] An optional function to project the values from\n * the combined latest values into a new value on the output Observable.\n * @param {SchedulerLike} [scheduler=null] The {@link SchedulerLike} to use for subscribing to\n * each input Observable.\n * @return {Observable} An Observable of projected values from the most recent\n * values from each input Observable, or an array of the most recent values from\n * each input Observable.\n */\nexport function combineLatest, R>(\n ...observables: (O | ((...values: ObservedValueOf[]) => R) | SchedulerLike)[]\n): Observable {\n let resultSelector: (...values: Array) => R = null;\n let scheduler: SchedulerLike = null;\n\n if (isScheduler(observables[observables.length - 1])) {\n scheduler = observables.pop() as SchedulerLike;\n }\n\n if (typeof observables[observables.length - 1] === 'function') {\n resultSelector = observables.pop() as (...values: Array) => R;\n }\n\n // if the first and only other argument besides the resultSelector is an array\n // assume it's been called with `combineLatest([obs1, obs2, obs3], resultSelector)`\n if (observables.length === 1 && isArray(observables[0])) {\n observables = observables[0] as any;\n }\n\n return fromArray(observables, scheduler).lift(new CombineLatestOperator, R>(resultSelector));\n}\n\nexport class CombineLatestOperator implements Operator {\n constructor(private resultSelector?: (...values: Array) => R) {\n }\n\n call(subscriber: Subscriber, source: any): any {\n return source.subscribe(new CombineLatestSubscriber(subscriber, this.resultSelector));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class CombineLatestSubscriber extends OuterSubscriber {\n private active: number = 0;\n private values: any[] = [];\n private observables: any[] = [];\n private toRespond: number;\n\n constructor(destination: Subscriber, private resultSelector?: (...values: Array) => R) {\n super(destination);\n }\n\n protected _next(observable: any) {\n this.values.push(NONE);\n this.observables.push(observable);\n }\n\n protected _complete() {\n const observables = this.observables;\n const len = observables.length;\n if (len === 0) {\n this.destination.complete();\n } else {\n this.active = len;\n this.toRespond = len;\n for (let i = 0; i < len; i++) {\n const observable = observables[i];\n this.add(subscribeToResult(this, observable, observable, i));\n }\n }\n }\n\n notifyComplete(unused: Subscriber): void {\n if ((this.active -= 1) === 0) {\n this.destination.complete();\n }\n }\n\n notifyNext(outerValue: T, innerValue: R,\n outerIndex: number, innerIndex: number,\n innerSub: InnerSubscriber): void {\n const values = this.values;\n const oldVal = values[outerIndex];\n const toRespond = !this.toRespond\n ? 0\n : oldVal === NONE ? --this.toRespond : this.toRespond;\n values[outerIndex] = innerValue;\n\n if (toRespond === 0) {\n if (this.resultSelector) {\n this._tryResultSelector(values);\n } else {\n this.destination.next(values.slice());\n }\n }\n }\n\n private _tryResultSelector(values: any[]) {\n let result: any;\n try {\n result = this.resultSelector.apply(this, values);\n } catch (err) {\n this.destination.error(err);\n return;\n }\n this.destination.next(result);\n }\n}\n","import { Observable } from '../Observable';\nimport { SchedulerAction, SchedulerLike } from '../types';\nimport { async } from '../scheduler/async';\nimport { isNumeric } from '../util/isNumeric';\nimport { isScheduler } from '../util/isScheduler';\nimport { Subscriber } from '../Subscriber';\n\n/**\n * Creates an Observable that starts emitting after an `dueTime` and\n * emits ever increasing numbers after each `period` of time thereafter.\n *\n * Its like {@link index/interval}, but you can specify when\n * should the emissions start.\n *\n * ![](timer.png)\n *\n * `timer` returns an Observable that emits an infinite sequence of ascending\n * integers, with a constant interval of time, `period` of your choosing\n * between those emissions. The first emission happens after the specified\n * `dueTime`. The initial delay may be a `Date`. By default, this\n * operator uses the {@link asyncScheduler} {@link SchedulerLike} to provide a notion of time, but you\n * may pass any {@link SchedulerLike} to it. If `period` is not specified, the output\n * Observable emits only one value, `0`. Otherwise, it emits an infinite\n * sequence.\n *\n * ## Examples\n * ### Emits ascending numbers, one every second (1000ms), starting after 3 seconds\n * ```ts\n * import { timer } from 'rxjs';\n *\n * const numbers = timer(3000, 1000);\n * numbers.subscribe(x => console.log(x));\n * ```\n *\n * ### Emits one number after five seconds\n * ```ts\n * import { timer } from 'rxjs';\n *\n * const numbers = timer(5000);\n * numbers.subscribe(x => console.log(x));\n * ```\n * @see {@link index/interval}\n * @see {@link delay}\n *\n * @param {number|Date} [dueTime] The initial delay time specified as a Date object or as an integer denoting\n * milliseconds to wait before emitting the first value of 0`.\n * @param {number|SchedulerLike} [periodOrScheduler] The period of time between emissions of the\n * subsequent numbers.\n * @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for scheduling\n * the emission of values, and providing a notion of \"time\".\n * @return {Observable} An Observable that emits a `0` after the\n * `dueTime` and ever increasing numbers after each `period` of time\n * thereafter.\n * @static true\n * @name timer\n * @owner Observable\n */\nexport function timer(dueTime: number | Date = 0,\n periodOrScheduler?: number | SchedulerLike,\n scheduler?: SchedulerLike): Observable {\n let period = -1;\n if (isNumeric(periodOrScheduler)) {\n period = Number(periodOrScheduler) < 1 && 1 || Number(periodOrScheduler);\n } else if (isScheduler(periodOrScheduler)) {\n scheduler = periodOrScheduler as any;\n }\n\n if (!isScheduler(scheduler)) {\n scheduler = async;\n }\n\n return new Observable(subscriber => {\n const due = isNumeric(dueTime)\n ? (dueTime as number)\n : (+dueTime - scheduler.now());\n\n return scheduler.schedule(dispatch, due, {\n index: 0, period, subscriber\n });\n });\n}\n\ninterface TimerState {\n index: number;\n period: number;\n subscriber: Subscriber;\n}\n\nfunction dispatch(this: SchedulerAction, state: TimerState) {\n const { index, period, subscriber } = state;\n subscriber.next(index);\n\n if (subscriber.closed) {\n return;\n } else if (period === -1) {\n return subscriber.complete();\n }\n\n state.index = index + 1;\n this.schedule(state, period);\n}\n","import { Scheduler } from '../Scheduler';\nimport { Subscription } from '../Subscription';\nimport { SchedulerAction } from '../types';\n\n/**\n * A unit of work to be executed in a `scheduler`. An action is typically\n * created from within a {@link SchedulerLike} and an RxJS user does not need to concern\n * themselves about creating and manipulating an Action.\n *\n * ```ts\n * class Action extends Subscription {\n * new (scheduler: Scheduler, work: (state?: T) => void);\n * schedule(state?: T, delay: number = 0): Subscription;\n * }\n * ```\n *\n * @class Action\n */\nexport class Action extends Subscription {\n constructor(scheduler: Scheduler, work: (this: SchedulerAction, state?: T) => void) {\n super();\n }\n /**\n * Schedules this action on its parent {@link SchedulerLike} for execution. May be passed\n * some context object, `state`. May happen at some point in the future,\n * according to the `delay` parameter, if specified.\n * @param {T} [state] Some contextual data that the `work` function uses when\n * called by the Scheduler.\n * @param {number} [delay] Time to wait before executing the work, where the\n * time unit is implicit and defined by the Scheduler.\n * @return {void}\n */\n public schedule(state?: T, delay: number = 0): Subscription {\n return this;\n }\n}\n","import { Action } from './Action';\nimport { SchedulerAction } from '../types';\nimport { Subscription } from '../Subscription';\nimport { AsyncScheduler } from './AsyncScheduler';\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class AsyncAction extends Action {\n\n public id: any;\n public state: T;\n public delay: number;\n protected pending: boolean = false;\n\n constructor(protected scheduler: AsyncScheduler,\n protected work: (this: SchedulerAction, state?: T) => void) {\n super(scheduler, work);\n }\n\n public schedule(state?: T, delay: number = 0): Subscription {\n\n if (this.closed) {\n return this;\n }\n\n // Always replace the current state with the new state.\n this.state = state;\n\n const id = this.id;\n const scheduler = this.scheduler;\n\n //\n // Important implementation note:\n //\n // Actions only execute once by default, unless rescheduled from within the\n // scheduled callback. This allows us to implement single and repeat\n // actions via the same code path, without adding API surface area, as well\n // as mimic traditional recursion but across asynchronous boundaries.\n //\n // However, JS runtimes and timers distinguish between intervals achieved by\n // serial `setTimeout` calls vs. a single `setInterval` call. An interval of\n // serial `setTimeout` calls can be individually delayed, which delays\n // scheduling the next `setTimeout`, and so on. `setInterval` attempts to\n // guarantee the interval callback will be invoked more precisely to the\n // interval period, regardless of load.\n //\n // Therefore, we use `setInterval` to schedule single and repeat actions.\n // If the action reschedules itself with the same delay, the interval is not\n // canceled. If the action doesn't reschedule, or reschedules with a\n // different delay, the interval will be canceled after scheduled callback\n // execution.\n //\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, delay);\n }\n\n // Set the pending flag indicating that this action has been scheduled, or\n // has recursively rescheduled itself.\n this.pending = true;\n\n this.delay = delay;\n // If this action has already an async Id, don't request a new one.\n this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);\n\n return this;\n }\n\n protected requestAsyncId(scheduler: AsyncScheduler, id?: any, delay: number = 0): any {\n return setInterval(scheduler.flush.bind(scheduler, this), delay);\n }\n\n protected recycleAsyncId(scheduler: AsyncScheduler, id: any, delay: number = 0): any {\n // If this action is rescheduled with the same delay time, don't clear the interval id.\n if (delay !== null && this.delay === delay && this.pending === false) {\n return id;\n }\n // Otherwise, if the action's delay time is different from the current delay,\n // or the action has been rescheduled before it's executed, clear the interval id\n clearInterval(id);\n return undefined;\n }\n\n /**\n * Immediately executes this action and the `work` it contains.\n * @return {any}\n */\n public execute(state: T, delay: number): any {\n\n if (this.closed) {\n return new Error('executing a cancelled action');\n }\n\n this.pending = false;\n const error = this._execute(state, delay);\n if (error) {\n return error;\n } else if (this.pending === false && this.id != null) {\n // Dequeue if the action didn't reschedule itself. Don't call\n // unsubscribe(), because the action could reschedule later.\n // For example:\n // ```\n // scheduler.schedule(function doWork(counter) {\n // /* ... I'm a busy worker bee ... */\n // var originalAction = this;\n // /* wait 100ms before rescheduling the action */\n // setTimeout(function () {\n // originalAction.schedule(counter + 1);\n // }, 100);\n // }, 1000);\n // ```\n this.id = this.recycleAsyncId(this.scheduler, this.id, null);\n }\n }\n\n protected _execute(state: T, delay: number): any {\n let errored: boolean = false;\n let errorValue: any = undefined;\n try {\n this.work(state);\n } catch (e) {\n errored = true;\n errorValue = !!e && e || new Error(e);\n }\n if (errored) {\n this.unsubscribe();\n return errorValue;\n }\n }\n\n /** @deprecated This is an internal implementation detail, do not use. */\n _unsubscribe() {\n\n const id = this.id;\n const scheduler = this.scheduler;\n const actions = scheduler.actions;\n const index = actions.indexOf(this);\n\n this.work = null;\n this.state = null;\n this.pending = false;\n this.scheduler = null;\n\n if (index !== -1) {\n actions.splice(index, 1);\n }\n\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, null);\n }\n\n this.delay = null;\n }\n}\n","/**\n * This file includes polyfills needed by Angular and is loaded before the app.\n * You can add your own extra polyfills to this file.\n *\n * This file is divided into 2 sections:\n * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.\n * 2. Application imports. Files imported after ZoneJS that should be loaded before your main\n * file.\n *\n * The current setup is for so-called \"evergreen\" browsers; the last versions of browsers that\n * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),\n * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.\n *\n * Learn more in https://angular.io/guide/browser-support\n */\n\n/***************************************************************************************************\n * BROWSER POLYFILLS\n */\n\n/** IE10 and IE11 requires the following for NgClass support on SVG elements */\n// import 'classlist.js'; // Run `npm install --save classlist.js`.\n\n/**\n * Web Animations `@angular/platform-browser/animations`\n * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.\n * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).\n */\n// import 'web-animations-js'; // Run `npm install --save web-animations-js`.\n\n/**\n * By default, zone.js will patch all possible macroTask and DomEvents\n * user can disable parts of macroTask/DomEvents patch by setting following flags\n * because those flags need to be set before `zone.js` being loaded, and webpack\n * will put import in the top of bundle, so user need to create a separate file\n * in this directory (for example: zone-flags.ts), and put the following flags\n * into that file, and then add the following code before importing zone.js.\n * import './zone-flags.ts';\n *\n * The flags allowed in zone-flags.ts are listed here.\n *\n * The following flags will work for all browsers.\n *\n * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame\n * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick\n * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames\n *\n * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js\n * with the following flag, it will bypass `zone.js` patch for IE/Edge\n *\n * (window as any).__Zone_enable_cross_context_check = true;\n *\n */\n\n/***************************************************************************************************\n * Zone JS is required by default for Angular itself.\n */\nimport 'zone.js/dist/zone'; // Included with Angular CLI.\nimport 'zone.js/dist/zone-patch-rxjs';\nimport 'zone.js/dist/zone-patch-rxjs-fake-async';\n\n\n/***************************************************************************************************\n * APPLICATION IMPORTS\n */\n\n// Required in order to to load d3 (v3) from frontend/package.json\n// Ideally, we should use a more recent version of d3 which doesn't register itself globally\n(window as any).global = window;\n","import { scheduleObservable } from './scheduleObservable';\nimport { schedulePromise } from './schedulePromise';\nimport { scheduleArray } from './scheduleArray';\nimport { scheduleIterable } from './scheduleIterable';\nimport { ObservableInput, SchedulerLike, Observable } from 'rxjs';\nimport { isInteropObservable } from '../util/isInteropObservable';\nimport { isPromise } from '../util/isPromise';\nimport { isArrayLike } from '../util/isArrayLike';\nimport { isIterable } from '../util/isIterable';\n\n/**\n * Converts from a common {@link ObservableInput} type to an observable where subscription and emissions\n * are scheduled on the provided scheduler.\n *\n * @see from\n * @see of\n *\n * @param input The observable, array, promise, iterable, etc you would like to schedule\n * @param scheduler The scheduler to use to schedule the subscription and emissions from\n * the returned observable.\n */\nexport function scheduled(input: ObservableInput, scheduler: SchedulerLike): Observable {\n if (input != null) {\n if (isInteropObservable(input)) {\n return scheduleObservable(input, scheduler);\n } else if (isPromise(input)) {\n return schedulePromise(input, scheduler);\n } else if (isArrayLike(input)) {\n return scheduleArray(input, scheduler);\n } else if (isIterable(input) || typeof input === 'string') {\n return scheduleIterable(input, scheduler);\n }\n }\n\n throw new TypeError((input !== null && typeof input || input) + ' is not observable');\n}\n","import { InteropObservable } from '../types';\nimport { observable as Symbol_observable } from '../symbol/observable';\n\n/** Identifies an input as being Observable (but not necessary an Rx Observable) */\nexport function isInteropObservable(input: any): input is InteropObservable {\n return input && typeof input[Symbol_observable] === 'function';\n}\n","import { Observable } from '../Observable';\nimport { Subscription } from '../Subscription';\nimport { observable as Symbol_observable } from '../symbol/observable';\nimport { InteropObservable, SchedulerLike, Subscribable } from '../types';\n\nexport function scheduleObservable(input: InteropObservable, scheduler: SchedulerLike) {\n return new Observable(subscriber => {\n const sub = new Subscription();\n sub.add(scheduler.schedule(() => {\n const observable: Subscribable = input[Symbol_observable]();\n sub.add(observable.subscribe({\n next(value) { sub.add(scheduler.schedule(() => subscriber.next(value))); },\n error(err) { sub.add(scheduler.schedule(() => subscriber.error(err))); },\n complete() { sub.add(scheduler.schedule(() => subscriber.complete())); },\n }));\n }));\n return sub;\n });\n}\n","import { Observable } from '../Observable';\nimport { SchedulerLike } from '../types';\nimport { Subscription } from '../Subscription';\n\nexport function schedulePromise(input: PromiseLike, scheduler: SchedulerLike) {\n return new Observable(subscriber => {\n const sub = new Subscription();\n sub.add(scheduler.schedule(() => input.then(\n value => {\n sub.add(scheduler.schedule(() => {\n subscriber.next(value);\n sub.add(scheduler.schedule(() => subscriber.complete()));\n }));\n },\n err => {\n sub.add(scheduler.schedule(() => subscriber.error(err)));\n }\n )));\n return sub;\n });\n}\n","import { iterator as Symbol_iterator } from '../symbol/iterator';\n\n/** Identifies an input as being an Iterable */\nexport function isIterable(input: any): input is Iterable {\n return input && typeof input[Symbol_iterator] === 'function';\n}\n","import { Observable } from '../Observable';\nimport { SchedulerLike } from '../types';\nimport { Subscription } from '../Subscription';\nimport { iterator as Symbol_iterator } from '../symbol/iterator';\n\nexport function scheduleIterable(input: Iterable, scheduler: SchedulerLike) {\n if (!input) {\n throw new Error('Iterable cannot be null');\n }\n return new Observable(subscriber => {\n const sub = new Subscription();\n let iterator: Iterator;\n sub.add(() => {\n // Finalize generators\n if (iterator && typeof iterator.return === 'function') {\n iterator.return();\n }\n });\n sub.add(scheduler.schedule(() => {\n iterator = input[Symbol_iterator]();\n sub.add(scheduler.schedule(function () {\n if (subscriber.closed) {\n return;\n }\n let value: T;\n let done: boolean;\n try {\n const result = iterator.next();\n value = result.value;\n done = result.done;\n } catch (err) {\n subscriber.error(err);\n return;\n }\n if (done) {\n subscriber.complete();\n } else {\n subscriber.next(value);\n this.schedule();\n }\n }));\n }));\n return sub;\n });\n}\n","let _enable_super_gross_mode_that_will_cause_bad_things = false;\n\n/**\n * The global configuration object for RxJS, used to configure things\n * like what Promise contructor should used to create Promises\n */\nexport const config = {\n /**\n * The promise constructor used by default for methods such as\n * {@link toPromise} and {@link forEach}\n */\n Promise: undefined as PromiseConstructorLike,\n\n /**\n * If true, turns on synchronous error rethrowing, which is a deprecated behavior\n * in v6 and higher. This behavior enables bad patterns like wrapping a subscribe\n * call in a try/catch block. It also enables producer interference, a nasty bug\n * where a multicast can be broken for all observers by a downstream consumer with\n * an unhandled error. DO NOT USE THIS FLAG UNLESS IT'S NEEDED TO BY TIME\n * FOR MIGRATION REASONS.\n */\n set useDeprecatedSynchronousErrorHandling(value: boolean) {\n if (value) {\n const error = new Error();\n console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \\n' + error.stack);\n } else if (_enable_super_gross_mode_that_will_cause_bad_things) {\n console.log('RxJS: Back to a better error behavior. Thank you. <3');\n }\n _enable_super_gross_mode_that_will_cause_bad_things = value;\n },\n\n get useDeprecatedSynchronousErrorHandling() {\n return _enable_super_gross_mode_that_will_cause_bad_things;\n },\n};\n","export const isArray = (() => Array.isArray || ((x: any): x is T[] => x && typeof x.length === 'number'))();\n","'use strict';\n/**\n * @license Angular v12.0.0-next.0\n * (c) 2010-2020 Google LLC. https://angular.io/\n * License: MIT\n */\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('rxjs')) :\n typeof define === 'function' && define.amd ? define(['rxjs'], factory) :\n (global = global || self, factory(global.rxjs));\n}(this, (function (rxjs) {\n 'use strict';\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n Zone.__load_patch('rxjs', function (global, Zone, api) {\n var symbol = Zone.__symbol__;\n var nextSource = 'rxjs.Subscriber.next';\n var errorSource = 'rxjs.Subscriber.error';\n var completeSource = 'rxjs.Subscriber.complete';\n var ObjectDefineProperties = Object.defineProperties;\n var patchObservable = function () {\n var ObservablePrototype = rxjs.Observable.prototype;\n var _symbolSubscribe = symbol('_subscribe');\n var _subscribe = ObservablePrototype[_symbolSubscribe] = ObservablePrototype._subscribe;\n ObjectDefineProperties(rxjs.Observable.prototype, {\n _zone: { value: null, writable: true, configurable: true },\n _zoneSource: { value: null, writable: true, configurable: true },\n _zoneSubscribe: { value: null, writable: true, configurable: true },\n source: {\n configurable: true,\n get: function () {\n return this._zoneSource;\n },\n set: function (source) {\n this._zone = Zone.current;\n this._zoneSource = source;\n }\n },\n _subscribe: {\n configurable: true,\n get: function () {\n if (this._zoneSubscribe) {\n return this._zoneSubscribe;\n }\n else if (this.constructor === rxjs.Observable) {\n return _subscribe;\n }\n var proto = Object.getPrototypeOf(this);\n return proto && proto._subscribe;\n },\n set: function (subscribe) {\n this._zone = Zone.current;\n if (!subscribe) {\n this._zoneSubscribe = subscribe;\n }\n else {\n this._zoneSubscribe = function () {\n if (this._zone && this._zone !== Zone.current) {\n var tearDown_1 = this._zone.run(subscribe, this, arguments);\n if (typeof tearDown_1 === 'function') {\n var zone_1 = this._zone;\n return function () {\n if (zone_1 !== Zone.current) {\n return zone_1.run(tearDown_1, this, arguments);\n }\n return tearDown_1.apply(this, arguments);\n };\n }\n else {\n return tearDown_1;\n }\n }\n else {\n return subscribe.apply(this, arguments);\n }\n };\n }\n }\n },\n subjectFactory: {\n get: function () {\n return this._zoneSubjectFactory;\n },\n set: function (factory) {\n var zone = this._zone;\n this._zoneSubjectFactory = function () {\n if (zone && zone !== Zone.current) {\n return zone.run(factory, this, arguments);\n }\n return factory.apply(this, arguments);\n };\n }\n }\n });\n };\n api.patchMethod(rxjs.Observable.prototype, 'lift', function (delegate) { return function (self, args) {\n var observable = delegate.apply(self, args);\n if (observable.operator) {\n observable.operator._zone = Zone.current;\n api.patchMethod(observable.operator, 'call', function (operatorDelegate) { return function (operatorSelf, operatorArgs) {\n if (operatorSelf._zone && operatorSelf._zone !== Zone.current) {\n return operatorSelf._zone.run(operatorDelegate, operatorSelf, operatorArgs);\n }\n return operatorDelegate.apply(operatorSelf, operatorArgs);\n }; });\n }\n return observable;\n }; });\n var patchSubscription = function () {\n ObjectDefineProperties(rxjs.Subscription.prototype, {\n _zone: { value: null, writable: true, configurable: true },\n _zoneUnsubscribe: { value: null, writable: true, configurable: true },\n _unsubscribe: {\n get: function () {\n if (this._zoneUnsubscribe || this._zoneUnsubscribeCleared) {\n return this._zoneUnsubscribe;\n }\n var proto = Object.getPrototypeOf(this);\n return proto && proto._unsubscribe;\n },\n set: function (unsubscribe) {\n this._zone = Zone.current;\n if (!unsubscribe) {\n this._zoneUnsubscribe = unsubscribe;\n // In some operator such as `retryWhen`, the _unsubscribe\n // method will be set to null, so we need to set another flag\n // to tell that we should return null instead of finding\n // in the prototype chain.\n this._zoneUnsubscribeCleared = true;\n }\n else {\n this._zoneUnsubscribeCleared = false;\n this._zoneUnsubscribe = function () {\n if (this._zone && this._zone !== Zone.current) {\n return this._zone.run(unsubscribe, this, arguments);\n }\n else {\n return unsubscribe.apply(this, arguments);\n }\n };\n }\n }\n }\n });\n };\n var patchSubscriber = function () {\n var next = rxjs.Subscriber.prototype.next;\n var error = rxjs.Subscriber.prototype.error;\n var complete = rxjs.Subscriber.prototype.complete;\n Object.defineProperty(rxjs.Subscriber.prototype, 'destination', {\n configurable: true,\n get: function () {\n return this._zoneDestination;\n },\n set: function (destination) {\n this._zone = Zone.current;\n this._zoneDestination = destination;\n }\n });\n // patch Subscriber.next to make sure it run\n // into SubscriptionZone\n rxjs.Subscriber.prototype.next = function () {\n var currentZone = Zone.current;\n var subscriptionZone = this._zone;\n // for performance concern, check Zone.current\n // equal with this._zone(SubscriptionZone) or not\n if (subscriptionZone && subscriptionZone !== currentZone) {\n return subscriptionZone.run(next, this, arguments, nextSource);\n }\n else {\n return next.apply(this, arguments);\n }\n };\n rxjs.Subscriber.prototype.error = function () {\n var currentZone = Zone.current;\n var subscriptionZone = this._zone;\n // for performance concern, check Zone.current\n // equal with this._zone(SubscriptionZone) or not\n if (subscriptionZone && subscriptionZone !== currentZone) {\n return subscriptionZone.run(error, this, arguments, errorSource);\n }\n else {\n return error.apply(this, arguments);\n }\n };\n rxjs.Subscriber.prototype.complete = function () {\n var currentZone = Zone.current;\n var subscriptionZone = this._zone;\n // for performance concern, check Zone.current\n // equal with this._zone(SubscriptionZone) or not\n if (subscriptionZone && subscriptionZone !== currentZone) {\n return subscriptionZone.run(complete, this, arguments, completeSource);\n }\n else {\n return complete.call(this);\n }\n };\n };\n patchObservable();\n patchSubscription();\n patchSubscriber();\n });\n})));\n","import { Observable } from '../Observable';\nimport { SubscribableOrPromise, ObservedValueOf, ObservableInput } from '../types';\nimport { from } from './from'; // lol\nimport { empty } from './empty';\n\n/**\n * Creates an Observable that, on subscribe, calls an Observable factory to\n * make an Observable for each new Observer.\n *\n * Creates the Observable lazily, that is, only when it\n * is subscribed.\n * \n *\n * ![](defer.png)\n *\n * `defer` allows you to create the Observable only when the Observer\n * subscribes, and create a fresh Observable for each Observer. It waits until\n * an Observer subscribes to it, and then it generates an Observable,\n * typically with an Observable factory function. It does this afresh for each\n * subscriber, so although each subscriber may think it is subscribing to the\n * same Observable, in fact each subscriber gets its own individual\n * Observable.\n *\n * ## Example\n * ### Subscribe to either an Observable of clicks or an Observable of interval, at random\n * ```ts\n * import { defer, fromEvent, interval } from 'rxjs';\n *\n * const clicksOrInterval = defer(function () {\n * return Math.random() > 0.5\n * ? fromEvent(document, 'click')\n * : interval(1000);\n * });\n * clicksOrInterval.subscribe(x => console.log(x));\n *\n * // Results in the following behavior:\n * // If the result of Math.random() is greater than 0.5 it will listen\n * // for clicks anywhere on the \"document\"; when document is clicked it\n * // will log a MouseEvent object to the console. If the result is less\n * // than 0.5 it will emit ascending numbers, one every second(1000ms).\n * ```\n *\n * @see {@link Observable}\n *\n * @param {function(): SubscribableOrPromise} observableFactory The Observable\n * factory function to invoke for each Observer that subscribes to the output\n * Observable. May also return a Promise, which will be converted on the fly\n * to an Observable.\n * @return {Observable} An Observable whose Observers' subscriptions trigger\n * an invocation of the given Observable factory function.\n * @static true\n * @name defer\n * @owner Observable\n */\nexport function defer | void>(observableFactory: () => R): Observable> {\n return new Observable>(subscriber => {\n let input: R | void;\n try {\n input = observableFactory();\n } catch (err) {\n subscriber.error(err);\n return undefined;\n }\n const source = input ? from(input as ObservableInput>) : empty();\n return source.subscribe(subscriber);\n });\n}\n","export function identity(x: T): T {\n return x;\n}\n","import { Observable } from '../Observable';\nimport { defer } from './defer';\nimport { EMPTY } from './empty';\nimport { SubscribableOrPromise } from '../types';\n\n/**\n * Decides at subscription time which Observable will actually be subscribed.\n *\n * `If` statement for Observables.\n *\n * `iif` accepts a condition function and two Observables. When\n * an Observable returned by the operator is subscribed, condition function will be called.\n * Based on what boolean it returns at that moment, consumer will subscribe either to\n * the first Observable (if condition was true) or to the second (if condition was false). Condition\n * function may also not return anything - in that case condition will be evaluated as false and\n * second Observable will be subscribed.\n *\n * Note that Observables for both cases (true and false) are optional. If condition points to an Observable that\n * was left undefined, resulting stream will simply complete immediately. That allows you to, rather\n * than controlling which Observable will be subscribed, decide at runtime if consumer should have access\n * to given Observable or not.\n *\n * If you have more complex logic that requires decision between more than two Observables, {@link defer}\n * will probably be a better choice. Actually `iif` can be easily implemented with {@link defer}\n * and exists only for convenience and readability reasons.\n *\n *\n * ## Examples\n * ### Change at runtime which Observable will be subscribed\n * ```ts\n * import { iif, of } from 'rxjs';\n *\n * let subscribeToFirst;\n * const firstOrSecond = iif(\n * () => subscribeToFirst,\n * of('first'),\n * of('second'),\n * );\n *\n * subscribeToFirst = true;\n * firstOrSecond.subscribe(value => console.log(value));\n *\n * // Logs:\n * // \"first\"\n *\n * subscribeToFirst = false;\n * firstOrSecond.subscribe(value => console.log(value));\n *\n * // Logs:\n * // \"second\"\n *\n * ```\n *\n * ### Control an access to an Observable\n * ```ts\n * let accessGranted;\n * const observableIfYouHaveAccess = iif(\n * () => accessGranted,\n * of('It seems you have an access...'), // Note that only one Observable is passed to the operator.\n * );\n *\n * accessGranted = true;\n * observableIfYouHaveAccess.subscribe(\n * value => console.log(value),\n * err => {},\n * () => console.log('The end'),\n * );\n *\n * // Logs:\n * // \"It seems you have an access...\"\n * // \"The end\"\n *\n * accessGranted = false;\n * observableIfYouHaveAccess.subscribe(\n * value => console.log(value),\n * err => {},\n * () => console.log('The end'),\n * );\n *\n * // Logs:\n * // \"The end\"\n * ```\n *\n * @see {@link defer}\n *\n * @param {function(): boolean} condition Condition which Observable should be chosen.\n * @param {Observable} [trueObservable] An Observable that will be subscribed if condition is true.\n * @param {Observable} [falseObservable] An Observable that will be subscribed if condition is false.\n * @return {Observable} Either first or second Observable, depending on condition.\n * @static true\n * @name iif\n * @owner Observable\n*/\nexport function iif(\n condition: () => boolean,\n trueResult: SubscribableOrPromise = EMPTY,\n falseResult: SubscribableOrPromise = EMPTY\n): Observable {\n return defer(() => condition() ? trueResult : falseResult);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","import { SchedulerLike } from '../types';\n\nexport function isScheduler(value: any): value is SchedulerLike {\n return value && typeof (value).schedule === 'function';\n}\n","import { Observable } from '../Observable';\nimport { ObservableInput, SchedulerLike} from '../types';\nimport { isScheduler } from '../util/isScheduler';\nimport { mergeAll } from '../operators/mergeAll';\nimport { fromArray } from './fromArray';\n\n/* tslint:disable:max-line-length */\n/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/\nexport function merge(v1: ObservableInput, scheduler: SchedulerLike): Observable;\n/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/\nexport function merge(v1: ObservableInput, concurrent: number, scheduler: SchedulerLike): Observable;\n/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/\nexport function merge(v1: ObservableInput, v2: ObservableInput, scheduler: SchedulerLike): Observable;\n/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/\nexport function merge(v1: ObservableInput, v2: ObservableInput, concurrent: number, scheduler: SchedulerLike): Observable;\n/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/\nexport function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, scheduler: SchedulerLike): Observable;\n/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/\nexport function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, concurrent: number, scheduler: SchedulerLike): Observable;\n/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/\nexport function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, scheduler: SchedulerLike): Observable;\n/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/\nexport function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, concurrent: number, scheduler: SchedulerLike): Observable;\n/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/\nexport function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, scheduler: SchedulerLike): Observable;\n/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/\nexport function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, concurrent: number, scheduler: SchedulerLike): Observable;\n/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/\nexport function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput, scheduler: SchedulerLike): Observable;\n/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/\nexport function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput, concurrent: number, scheduler: SchedulerLike): Observable;\n\nexport function merge(v1: ObservableInput): Observable;\nexport function merge(v1: ObservableInput, concurrent?: number): Observable;\nexport function merge(v1: ObservableInput, v2: ObservableInput): Observable;\nexport function merge(v1: ObservableInput, v2: ObservableInput, concurrent?: number): Observable;\nexport function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput): Observable;\nexport function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, concurrent?: number): Observable;\nexport function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput): Observable;\nexport function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, concurrent?: number): Observable;\nexport function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput): Observable;\nexport function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, concurrent?: number): Observable;\nexport function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput): Observable;\nexport function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput, concurrent?: number): Observable;\nexport function merge(...observables: (ObservableInput | number)[]): Observable;\n/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/\nexport function merge(...observables: (ObservableInput | SchedulerLike | number)[]): Observable;\nexport function merge(...observables: (ObservableInput | number)[]): Observable;\n/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/\nexport function merge(...observables: (ObservableInput | SchedulerLike | number)[]): Observable;\n/* tslint:enable:max-line-length */\n/**\n * Creates an output Observable which concurrently emits all values from every\n * given input Observable.\n *\n * Flattens multiple Observables together by blending\n * their values into one Observable.\n *\n * ![](merge.png)\n *\n * `merge` subscribes to each given input Observable (as arguments), and simply\n * forwards (without doing any transformation) all the values from all the input\n * Observables to the output Observable. The output Observable only completes\n * once all input Observables have completed. Any error delivered by an input\n * Observable will be immediately emitted on the output Observable.\n *\n * ## Examples\n * ### Merge together two Observables: 1s interval and clicks\n * ```ts\n * import { merge, fromEvent, interval } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const timer = interval(1000);\n * const clicksOrTimer = merge(clicks, timer);\n * clicksOrTimer.subscribe(x => console.log(x));\n *\n * // Results in the following:\n * // timer will emit ascending values, one every second(1000ms) to console\n * // clicks logs MouseEvents to console everytime the \"document\" is clicked\n * // Since the two streams are merged you see these happening\n * // as they occur.\n * ```\n *\n * ### Merge together 3 Observables, but only 2 run concurrently\n * ```ts\n * import { merge, interval } from 'rxjs';\n * import { take } from 'rxjs/operators';\n *\n * const timer1 = interval(1000).pipe(take(10));\n * const timer2 = interval(2000).pipe(take(6));\n * const timer3 = interval(500).pipe(take(10));\n * const concurrent = 2; // the argument\n * const merged = merge(timer1, timer2, timer3, concurrent);\n * merged.subscribe(x => console.log(x));\n *\n * // Results in the following:\n * // - First timer1 and timer2 will run concurrently\n * // - timer1 will emit a value every 1000ms for 10 iterations\n * // - timer2 will emit a value every 2000ms for 6 iterations\n * // - after timer1 hits it's max iteration, timer2 will\n * // continue, and timer3 will start to run concurrently with timer2\n * // - when timer2 hits it's max iteration it terminates, and\n * // timer3 will continue to emit a value every 500ms until it is complete\n * ```\n *\n * @see {@link mergeAll}\n * @see {@link mergeMap}\n * @see {@link mergeMapTo}\n * @see {@link mergeScan}\n *\n * @param {...ObservableInput} observables Input Observables to merge together.\n * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input\n * Observables being subscribed to concurrently.\n * @param {SchedulerLike} [scheduler=null] The {@link SchedulerLike} to use for managing\n * concurrency of input Observables.\n * @return {Observable} an Observable that emits items that are the result of\n * every input Observable.\n * @static true\n * @name merge\n * @owner Observable\n */\nexport function merge(...observables: Array | SchedulerLike | number>): Observable {\n let concurrent = Number.POSITIVE_INFINITY;\n let scheduler: SchedulerLike = null;\n let last: any = observables[observables.length - 1];\n if (isScheduler(last)) {\n scheduler = observables.pop();\n if (observables.length > 1 && typeof observables[observables.length - 1] === 'number') {\n concurrent = observables.pop();\n }\n } else if (typeof last === 'number') {\n concurrent = observables.pop();\n }\n\n if (scheduler === null && observables.length === 1 && observables[0] instanceof Observable) {\n return >observables[0];\n }\n\n return mergeAll(concurrent)(fromArray(observables, scheduler));\n}\n","import { Observable } from '../Observable';\nimport { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\nimport { subscribeToResult } from '../util/subscribeToResult';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { InnerSubscriber } from '../InnerSubscriber';\nimport { ObservableInput, OperatorFunction, ObservedValueOf } from '../types';\nimport { map } from './map';\nimport { from } from '../observable/from';\n\n/* tslint:disable:max-line-length */\nexport function mergeMap>(project: (value: T, index: number) => O, concurrent?: number): OperatorFunction>;\n/** @deprecated resultSelector no longer supported, use inner map instead */\nexport function mergeMap>(project: (value: T, index: number) => O, resultSelector: undefined, concurrent?: number): OperatorFunction>;\n/** @deprecated resultSelector no longer supported, use inner map instead */\nexport function mergeMap>(project: (value: T, index: number) => O, resultSelector: (outerValue: T, innerValue: ObservedValueOf, outerIndex: number, innerIndex: number) => R, concurrent?: number): OperatorFunction;\n/* tslint:enable:max-line-length */\n\n/**\n * Projects each source value to an Observable which is merged in the output\n * Observable.\n *\n * Maps each value to an Observable, then flattens all of\n * these inner Observables using {@link mergeAll}.\n *\n * ![](mergeMap.png)\n *\n * Returns an Observable that emits items based on applying a function that you\n * supply to each item emitted by the source Observable, where that function\n * returns an Observable, and then merging those resulting Observables and\n * emitting the results of this merger.\n *\n * ## Example\n * Map and flatten each letter to an Observable ticking every 1 second\n * ```ts\n * import { of, interval } from 'rxjs';\n * import { mergeMap, map } from 'rxjs/operators';\n *\n * const letters = of('a', 'b', 'c');\n * const result = letters.pipe(\n * mergeMap(x => interval(1000).pipe(map(i => x+i))),\n * );\n * result.subscribe(x => console.log(x));\n *\n * // Results in the following:\n * // a0\n * // b0\n * // c0\n * // a1\n * // b1\n * // c1\n * // continues to list a,b,c with respective ascending integers\n * ```\n *\n * @see {@link concatMap}\n * @see {@link exhaustMap}\n * @see {@link merge}\n * @see {@link mergeAll}\n * @see {@link mergeMapTo}\n * @see {@link mergeScan}\n * @see {@link switchMap}\n *\n * @param {function(value: T, ?index: number): ObservableInput} project A function\n * that, when applied to an item emitted by the source Observable, returns an\n * Observable.\n * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input\n * Observables being subscribed to concurrently.\n * @return {Observable} An Observable that emits the result of applying the\n * projection function (and the optional deprecated `resultSelector`) to each item\n * emitted by the source Observable and merging the results of the Observables\n * obtained from this transformation.\n * @method mergeMap\n * @owner Observable\n */\nexport function mergeMap>(\n project: (value: T, index: number) => O,\n resultSelector?: ((outerValue: T, innerValue: ObservedValueOf, outerIndex: number, innerIndex: number) => R) | number,\n concurrent: number = Number.POSITIVE_INFINITY\n): OperatorFunction|R> {\n if (typeof resultSelector === 'function') {\n // DEPRECATED PATH\n return (source: Observable) => source.pipe(\n mergeMap((a, i) => from(project(a, i)).pipe(\n map((b: any, ii: number) => resultSelector(a, b, i, ii)),\n ), concurrent)\n );\n } else if (typeof resultSelector === 'number') {\n concurrent = resultSelector;\n }\n return (source: Observable) => source.lift(new MergeMapOperator(project, concurrent));\n}\n\nexport class MergeMapOperator implements Operator {\n constructor(private project: (value: T, index: number) => ObservableInput,\n private concurrent: number = Number.POSITIVE_INFINITY) {\n }\n\n call(observer: Subscriber, source: any): any {\n return source.subscribe(new MergeMapSubscriber(\n observer, this.project, this.concurrent\n ));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class MergeMapSubscriber extends OuterSubscriber {\n private hasCompleted: boolean = false;\n private buffer: T[] = [];\n private active: number = 0;\n protected index: number = 0;\n\n constructor(destination: Subscriber,\n private project: (value: T, index: number) => ObservableInput,\n private concurrent: number = Number.POSITIVE_INFINITY) {\n super(destination);\n }\n\n protected _next(value: T): void {\n if (this.active < this.concurrent) {\n this._tryNext(value);\n } else {\n this.buffer.push(value);\n }\n }\n\n protected _tryNext(value: T) {\n let result: ObservableInput;\n const index = this.index++;\n try {\n result = this.project(value, index);\n } catch (err) {\n this.destination.error(err);\n return;\n }\n this.active++;\n this._innerSub(result, value, index);\n }\n\n private _innerSub(ish: ObservableInput, value: T, index: number): void {\n const innerSubscriber = new InnerSubscriber(this, value, index);\n const destination = this.destination as Subscription;\n destination.add(innerSubscriber);\n const innerSubscription = subscribeToResult(this, ish, undefined, undefined, innerSubscriber);\n // The returned subscription will usually be the subscriber that was\n // passed. However, interop subscribers will be wrapped and for\n // unsubscriptions to chain correctly, the wrapper needs to be added, too.\n if (innerSubscription !== innerSubscriber) {\n destination.add(innerSubscription);\n }\n }\n\n protected _complete(): void {\n this.hasCompleted = true;\n if (this.active === 0 && this.buffer.length === 0) {\n this.destination.complete();\n }\n this.unsubscribe();\n }\n\n notifyNext(outerValue: T, innerValue: R,\n outerIndex: number, innerIndex: number,\n innerSub: InnerSubscriber): void {\n this.destination.next(innerValue);\n }\n\n notifyComplete(innerSub: Subscription): void {\n const buffer = this.buffer;\n this.remove(innerSub);\n this.active--;\n if (buffer.length > 0) {\n this._next(buffer.shift());\n } else if (this.active === 0 && this.hasCompleted) {\n this.destination.complete();\n }\n }\n}\n","import { isArray } from './util/isArray';\nimport { isObject } from './util/isObject';\nimport { isFunction } from './util/isFunction';\nimport { UnsubscriptionError } from './util/UnsubscriptionError';\nimport { SubscriptionLike, TeardownLogic } from './types';\n\n/**\n * Represents a disposable resource, such as the execution of an Observable. A\n * Subscription has one important method, `unsubscribe`, that takes no argument\n * and just disposes the resource held by the subscription.\n *\n * Additionally, subscriptions may be grouped together through the `add()`\n * method, which will attach a child Subscription to the current Subscription.\n * When a Subscription is unsubscribed, all its children (and its grandchildren)\n * will be unsubscribed as well.\n *\n * @class Subscription\n */\nexport class Subscription implements SubscriptionLike {\n /** @nocollapse */\n public static EMPTY: Subscription = (function(empty: any) {\n empty.closed = true;\n return empty;\n }(new Subscription()));\n\n /**\n * A flag to indicate whether this Subscription has already been unsubscribed.\n * @type {boolean}\n */\n public closed: boolean = false;\n\n /** @internal */\n protected _parentOrParents: Subscription | Subscription[] = null;\n /** @internal */\n private _subscriptions: SubscriptionLike[] = null;\n\n /**\n * @param {function(): void} [unsubscribe] A function describing how to\n * perform the disposal of resources when the `unsubscribe` method is called.\n */\n constructor(unsubscribe?: () => void) {\n if (unsubscribe) {\n ( this)._unsubscribe = unsubscribe;\n }\n }\n\n /**\n * Disposes the resources held by the subscription. May, for instance, cancel\n * an ongoing Observable execution or cancel any other type of work that\n * started when the Subscription was created.\n * @return {void}\n */\n unsubscribe(): void {\n let errors: any[];\n\n if (this.closed) {\n return;\n }\n\n let { _parentOrParents, _unsubscribe, _subscriptions } = ( this);\n\n this.closed = true;\n this._parentOrParents = null;\n // null out _subscriptions first so any child subscriptions that attempt\n // to remove themselves from this subscription will noop\n this._subscriptions = null;\n\n if (_parentOrParents instanceof Subscription) {\n _parentOrParents.remove(this);\n } else if (_parentOrParents !== null) {\n for (let index = 0; index < _parentOrParents.length; ++index) {\n const parent = _parentOrParents[index];\n parent.remove(this);\n }\n }\n\n if (isFunction(_unsubscribe)) {\n try {\n _unsubscribe.call(this);\n } catch (e) {\n errors = e instanceof UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e];\n }\n }\n\n if (isArray(_subscriptions)) {\n let index = -1;\n let len = _subscriptions.length;\n\n while (++index < len) {\n const sub = _subscriptions[index];\n if (isObject(sub)) {\n try {\n sub.unsubscribe();\n } catch (e) {\n errors = errors || [];\n if (e instanceof UnsubscriptionError) {\n errors = errors.concat(flattenUnsubscriptionErrors(e.errors));\n } else {\n errors.push(e);\n }\n }\n }\n }\n }\n\n if (errors) {\n throw new UnsubscriptionError(errors);\n }\n }\n\n /**\n * Adds a tear down to be called during the unsubscribe() of this\n * Subscription. Can also be used to add a child subscription.\n *\n * If the tear down being added is a subscription that is already\n * unsubscribed, is the same reference `add` is being called on, or is\n * `Subscription.EMPTY`, it will not be added.\n *\n * If this subscription is already in an `closed` state, the passed\n * tear down logic will be executed immediately.\n *\n * When a parent subscription is unsubscribed, any child subscriptions that were added to it are also unsubscribed.\n *\n * @param {TeardownLogic} teardown The additional logic to execute on\n * teardown.\n * @return {Subscription} Returns the Subscription used or created to be\n * added to the inner subscriptions list. This Subscription can be used with\n * `remove()` to remove the passed teardown logic from the inner subscriptions\n * list.\n */\n add(teardown: TeardownLogic): Subscription {\n let subscription = (teardown);\n\n if (!(teardown)) {\n return Subscription.EMPTY;\n }\n\n switch (typeof teardown) {\n case 'function':\n subscription = new Subscription(<(() => void)>teardown);\n case 'object':\n if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== 'function') {\n // This also covers the case where `subscription` is `Subscription.EMPTY`, which is always in `closed` state.\n return subscription;\n } else if (this.closed) {\n subscription.unsubscribe();\n return subscription;\n } else if (!(subscription instanceof Subscription)) {\n const tmp = subscription;\n subscription = new Subscription();\n subscription._subscriptions = [tmp];\n }\n break;\n default: {\n throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');\n }\n }\n\n // Add `this` as parent of `subscription` if that's not already the case.\n let { _parentOrParents } = subscription;\n if (_parentOrParents === null) {\n // If we don't have a parent, then set `subscription._parents` to\n // the `this`, which is the common case that we optimize for.\n subscription._parentOrParents = this;\n } else if (_parentOrParents instanceof Subscription) {\n if (_parentOrParents === this) {\n // The `subscription` already has `this` as a parent.\n return subscription;\n }\n // If there's already one parent, but not multiple, allocate an\n // Array to store the rest of the parent Subscriptions.\n subscription._parentOrParents = [_parentOrParents, this];\n } else if (_parentOrParents.indexOf(this) === -1) {\n // Only add `this` to the _parentOrParents list if it's not already there.\n _parentOrParents.push(this);\n } else {\n // The `subscription` already has `this` as a parent.\n return subscription;\n }\n\n // Optimize for the common case when adding the first subscription.\n const subscriptions = this._subscriptions;\n if (subscriptions === null) {\n this._subscriptions = [subscription];\n } else {\n subscriptions.push(subscription);\n }\n\n return subscription;\n }\n\n /**\n * Removes a Subscription from the internal list of subscriptions that will\n * unsubscribe during the unsubscribe process of this Subscription.\n * @param {Subscription} subscription The subscription to remove.\n * @return {void}\n */\n remove(subscription: Subscription): void {\n const subscriptions = this._subscriptions;\n if (subscriptions) {\n const subscriptionIndex = subscriptions.indexOf(subscription);\n if (subscriptionIndex !== -1) {\n subscriptions.splice(subscriptionIndex, 1);\n }\n }\n }\n}\n\nfunction flattenUnsubscriptionErrors(errors: any[]) {\n return errors.reduce((errs, err) => errs.concat((err instanceof UnsubscriptionError) ? err.errors : err), []);\n}\n","import { Subscriber } from './Subscriber';\nimport { OuterSubscriber } from './OuterSubscriber';\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class InnerSubscriber extends Subscriber {\n private index = 0;\n\n constructor(private parent: OuterSubscriber, public outerValue: T, public outerIndex: number) {\n super();\n }\n\n protected _next(value: R): void {\n this.parent.notifyNext(this.outerValue, value, this.outerIndex, this.index++, this);\n }\n\n protected _error(error: any): void {\n this.parent.notifyError(error, this);\n this.unsubscribe();\n }\n\n protected _complete(): void {\n this.parent.notifyComplete(this);\n this.unsubscribe();\n }\n}\n","import { Action } from './scheduler/Action';\nimport { Subscription } from './Subscription';\nimport { SchedulerLike, SchedulerAction } from './types';\n\n/**\n * An execution context and a data structure to order tasks and schedule their\n * execution. Provides a notion of (potentially virtual) time, through the\n * `now()` getter method.\n *\n * Each unit of work in a Scheduler is called an `Action`.\n *\n * ```ts\n * class Scheduler {\n * now(): number;\n * schedule(work, delay?, state?): Subscription;\n * }\n * ```\n *\n * @class Scheduler\n * @deprecated Scheduler is an internal implementation detail of RxJS, and\n * should not be used directly. Rather, create your own class and implement\n * {@link SchedulerLike}\n */\nexport class Scheduler implements SchedulerLike {\n\n /**\n * Note: the extra arrow function wrapper is to make testing by overriding\n * Date.now easier.\n * @nocollapse\n */\n public static now: () => number = () => Date.now();\n\n constructor(private SchedulerAction: typeof Action,\n now: () => number = Scheduler.now) {\n this.now = now;\n }\n\n /**\n * A getter method that returns a number representing the current time\n * (at the time this function was called) according to the scheduler's own\n * internal clock.\n * @return {number} A number that represents the current time. May or may not\n * have a relation to wall-clock time. May or may not refer to a time unit\n * (e.g. milliseconds).\n */\n public now: () => number;\n\n /**\n * Schedules a function, `work`, for execution. May happen at some point in\n * the future, according to the `delay` parameter, if specified. May be passed\n * some context object, `state`, which will be passed to the `work` function.\n *\n * The given arguments will be processed an stored as an Action object in a\n * queue of actions.\n *\n * @param {function(state: ?T): ?Subscription} work A function representing a\n * task, or some unit of work to be executed by the Scheduler.\n * @param {number} [delay] Time to wait before executing the work, where the\n * time unit is implicit and defined by the Scheduler itself.\n * @param {T} [state] Some contextual data that the `work` function uses when\n * called by the Scheduler.\n * @return {Subscription} A subscription in order to be able to unsubscribe\n * the scheduled work.\n */\n public schedule(work: (this: SchedulerAction, state?: T) => void, delay: number = 0, state?: T): Subscription {\n return new this.SchedulerAction(this, work).schedule(state, delay);\n }\n}\n","import { AsyncAction } from './AsyncAction';\nimport { AnimationFrameScheduler } from './AnimationFrameScheduler';\nimport { SchedulerAction } from '../types';\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class AnimationFrameAction extends AsyncAction {\n\n constructor(protected scheduler: AnimationFrameScheduler,\n protected work: (this: SchedulerAction, state?: T) => void) {\n super(scheduler, work);\n }\n\n protected requestAsyncId(scheduler: AnimationFrameScheduler, id?: any, delay: number = 0): any {\n // If delay is greater than 0, request as an async action.\n if (delay !== null && delay > 0) {\n return super.requestAsyncId(scheduler, id, delay);\n }\n // Push the action to the end of the scheduler queue.\n scheduler.actions.push(this);\n // If an animation frame has already been requested, don't request another\n // one. If an animation frame hasn't been requested yet, request one. Return\n // the current animation frame request id.\n return scheduler.scheduled || (scheduler.scheduled = requestAnimationFrame(\n () => scheduler.flush(null)));\n }\n protected recycleAsyncId(scheduler: AnimationFrameScheduler, id?: any, delay: number = 0): any {\n // If delay exists and is greater than 0, or if the delay is null (the\n // action wasn't rescheduled) but was originally scheduled as an async\n // action, then recycle as an async action.\n if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {\n return super.recycleAsyncId(scheduler, id, delay);\n }\n // If the scheduler queue is empty, cancel the requested animation frame and\n // set the scheduled flag to undefined so the next AnimationFrameAction will\n // request its own.\n if (scheduler.actions.length === 0) {\n cancelAnimationFrame(id);\n scheduler.scheduled = undefined;\n }\n // Return undefined so the action knows to request a new async id if it's rescheduled.\n return undefined;\n }\n}\n","import { AsyncAction } from './AsyncAction';\nimport { AsyncScheduler } from './AsyncScheduler';\n\nexport class AnimationFrameScheduler extends AsyncScheduler {\n public flush(action?: AsyncAction): void {\n\n this.active = true;\n this.scheduled = undefined;\n\n const {actions} = this;\n let error: any;\n let index: number = -1;\n let count: number = actions.length;\n action = action || actions.shift();\n\n do {\n if (error = action.execute(action.state, action.delay)) {\n break;\n }\n } while (++index < count && (action = actions.shift()));\n\n this.active = false;\n\n if (error) {\n while (++index < count && (action = actions.shift())) {\n action.unsubscribe();\n }\n throw error;\n }\n }\n}\n","import { AnimationFrameAction } from './AnimationFrameAction';\nimport { AnimationFrameScheduler } from './AnimationFrameScheduler';\n\n/**\n *\n * Animation Frame Scheduler\n *\n * Perform task when `window.requestAnimationFrame` would fire\n *\n * When `animationFrame` scheduler is used with delay, it will fall back to {@link asyncScheduler} scheduler\n * behaviour.\n *\n * Without delay, `animationFrame` scheduler can be used to create smooth browser animations.\n * It makes sure scheduled task will happen just before next browser content repaint,\n * thus performing animations as efficiently as possible.\n *\n * ## Example\n * Schedule div height animation\n * ```ts\n * // html:
\n * import { animationFrameScheduler } from 'rxjs';\n *\n * const div = document.querySelector('div');\n *\n * animationFrameScheduler.schedule(function(height) {\n * div.style.height = height + \"px\";\n *\n * this.schedule(height + 1); // `this` references currently executing Action,\n * // which we reschedule with new state\n * }, 0, 0);\n *\n * // You will see a div element growing in height\n * ```\n *\n * @static true\n * @name animationFrame\n * @owner Scheduler\n */\n\nexport const animationFrame = new AnimationFrameScheduler(AnimationFrameAction);\n","import { Subject } from './Subject';\nimport { Observer } from './types';\nimport { Subscription } from './Subscription';\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class SubjectSubscription extends Subscription {\n closed: boolean = false;\n\n constructor(public subject: Subject, public subscriber: Observer) {\n super();\n }\n\n unsubscribe() {\n if (this.closed) {\n return;\n }\n\n this.closed = true;\n\n const subject = this.subject;\n const observers = subject.observers;\n\n this.subject = null;\n\n if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {\n return;\n }\n\n const subscriberIndex = observers.indexOf(this.subscriber);\n\n if (subscriberIndex !== -1) {\n observers.splice(subscriberIndex, 1);\n }\n }\n}\n","/** Symbol.observable addition */\n/* Note: This will add Symbol.observable globally for all TypeScript users,\n however, we are no longer polyfilling Symbol.observable */\ndeclare global {\n interface SymbolConstructor {\n readonly observable: symbol;\n }\n}\n\n/** Symbol.observable or a string \"@@observable\". Used for interop */\nexport const observable = (() => typeof Symbol === 'function' && Symbol.observable || '@@observable')();\n","import { Observable } from '../Observable';\nimport { async } from '../scheduler/async';\nimport { SchedulerAction, SchedulerLike } from '../types';\nimport { isNumeric } from '../util/isNumeric';\nimport { Subscriber } from '../Subscriber';\n\n/**\n * Creates an Observable that emits sequential numbers every specified\n * interval of time, on a specified {@link SchedulerLike}.\n *\n * Emits incremental numbers periodically in time.\n * \n *\n * ![](interval.png)\n *\n * `interval` returns an Observable that emits an infinite sequence of\n * ascending integers, with a constant interval of time of your choosing\n * between those emissions. The first emission is not sent immediately, but\n * only after the first period has passed. By default, this operator uses the\n * `async` {@link SchedulerLike} to provide a notion of time, but you may pass any\n * {@link SchedulerLike} to it.\n *\n * ## Example\n * Emits ascending numbers, one every second (1000ms) up to the number 3\n * ```ts\n * import { interval } from 'rxjs';\n * import { take } from 'rxjs/operators';\n *\n * const numbers = interval(1000);\n *\n * const takeFourNumbers = numbers.pipe(take(4));\n *\n * takeFourNumbers.subscribe(x => console.log('Next: ', x));\n *\n * // Logs:\n * // Next: 0\n * // Next: 1\n * // Next: 2\n * // Next: 3\n * ```\n *\n * @see {@link timer}\n * @see {@link delay}\n *\n * @param {number} [period=0] The interval size in milliseconds (by default)\n * or the time unit determined by the scheduler's clock.\n * @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for scheduling\n * the emission of values, and providing a notion of \"time\".\n * @return {Observable} An Observable that emits a sequential number each time\n * interval.\n * @static true\n * @name interval\n * @owner Observable\n */\nexport function interval(period = 0,\n scheduler: SchedulerLike = async): Observable {\n if (!isNumeric(period) || period < 0) {\n period = 0;\n }\n\n if (!scheduler || typeof scheduler.schedule !== 'function') {\n scheduler = async;\n }\n\n return new Observable(subscriber => {\n subscriber.add(\n scheduler.schedule(dispatch, period, { subscriber, counter: 0, period })\n );\n return subscriber;\n });\n}\n\nfunction dispatch(this: SchedulerAction, state: IntervalState) {\n const { subscriber, counter, period } = state;\n subscriber.next(counter);\n this.schedule({ subscriber, counter: counter + 1, period }, period);\n}\n\ninterface IntervalState {\n subscriber: Subscriber;\n counter: number;\n period: number;\n}\n","import { noop } from './noop';\nimport { UnaryFunction } from '../types';\n\n/* tslint:disable:max-line-length */\nexport function pipe(): UnaryFunction;\nexport function pipe(fn1: UnaryFunction): UnaryFunction;\nexport function pipe(fn1: UnaryFunction, fn2: UnaryFunction): UnaryFunction;\nexport function pipe(fn1: UnaryFunction, fn2: UnaryFunction, fn3: UnaryFunction): UnaryFunction;\nexport function pipe(fn1: UnaryFunction, fn2: UnaryFunction, fn3: UnaryFunction, fn4: UnaryFunction): UnaryFunction;\nexport function pipe(fn1: UnaryFunction, fn2: UnaryFunction, fn3: UnaryFunction, fn4: UnaryFunction, fn5: UnaryFunction): UnaryFunction;\nexport function pipe(fn1: UnaryFunction, fn2: UnaryFunction, fn3: UnaryFunction, fn4: UnaryFunction, fn5: UnaryFunction, fn6: UnaryFunction): UnaryFunction;\nexport function pipe(fn1: UnaryFunction, fn2: UnaryFunction, fn3: UnaryFunction, fn4: UnaryFunction, fn5: UnaryFunction, fn6: UnaryFunction, fn7: UnaryFunction): UnaryFunction;\nexport function pipe(fn1: UnaryFunction, fn2: UnaryFunction, fn3: UnaryFunction, fn4: UnaryFunction, fn5: UnaryFunction, fn6: UnaryFunction, fn7: UnaryFunction, fn8: UnaryFunction): UnaryFunction;\nexport function pipe(fn1: UnaryFunction, fn2: UnaryFunction, fn3: UnaryFunction, fn4: UnaryFunction, fn5: UnaryFunction, fn6: UnaryFunction, fn7: UnaryFunction, fn8: UnaryFunction, fn9: UnaryFunction): UnaryFunction;\nexport function pipe(fn1: UnaryFunction, fn2: UnaryFunction, fn3: UnaryFunction, fn4: UnaryFunction, fn5: UnaryFunction, fn6: UnaryFunction, fn7: UnaryFunction, fn8: UnaryFunction, fn9: UnaryFunction, ...fns: UnaryFunction[]): UnaryFunction;\n/* tslint:enable:max-line-length */\n\nexport function pipe(...fns: Array>): UnaryFunction {\n return pipeFromArray(fns);\n}\n\n/** @internal */\nexport function pipeFromArray(fns: Array>): UnaryFunction {\n if (!fns) {\n return noop as UnaryFunction;\n }\n\n if (fns.length === 1) {\n return fns[0];\n }\n\n return function piped(input: T): R {\n return fns.reduce((prev: any, fn: UnaryFunction) => fn(prev), input as any);\n };\n}\n","import { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\nimport { MonoTypeOperatorFunction, TeardownLogic } from '../types';\nimport { ConnectableObservable } from '../observable/ConnectableObservable';\nimport { Observable } from '../Observable';\n\n/**\n * Make a {@link ConnectableObservable} behave like a ordinary observable and automates the way\n * you can connect to it.\n *\n * Internally it counts the subscriptions to the observable and subscribes (only once) to the source if\n * the number of subscriptions is larger than 0. If the number of subscriptions is smaller than 1, it\n * unsubscribes from the source. This way you can make sure that everything before the *published*\n * refCount has only a single subscription independently of the number of subscribers to the target\n * observable.\n *\n * Note that using the {@link share} operator is exactly the same as using the *publish* operator\n * (making the observable hot) and the *refCount* operator in a sequence.\n *\n * ![](refCount.png)\n *\n * ## Example\n *\n * In the following example there are two intervals turned into connectable observables\n * by using the *publish* operator. The first one uses the *refCount* operator, the\n * second one does not use it. You will notice that a connectable observable does nothing\n * until you call its connect function.\n *\n * ```ts\n * import { interval } from 'rxjs';\n * import { tap, publish, refCount } from 'rxjs/operators';\n *\n * // Turn the interval observable into a ConnectableObservable (hot)\n * const refCountInterval = interval(400).pipe(\n * tap((num) => console.log(`refCount ${num}`)),\n * publish(),\n * refCount()\n * );\n *\n * const publishedInterval = interval(400).pipe(\n * tap((num) => console.log(`publish ${num}`)),\n * publish()\n * );\n *\n * refCountInterval.subscribe();\n * refCountInterval.subscribe();\n * // 'refCount 0' -----> 'refCount 1' -----> etc\n * // All subscriptions will receive the same value and the tap (and\n * // every other operator) before the publish operator will be executed\n * // only once per event independently of the number of subscriptions.\n *\n * publishedInterval.subscribe();\n * // Nothing happens until you call .connect() on the observable.\n * ```\n *\n * @see {@link ConnectableObservable}\n * @see {@link share}\n * @see {@link publish}\n */\nexport function refCount(): MonoTypeOperatorFunction {\n return function refCountOperatorFunction(source: ConnectableObservable): Observable {\n return source.lift(new RefCountOperator(source));\n } as MonoTypeOperatorFunction;\n}\n\nclass RefCountOperator implements Operator {\n constructor(private connectable: ConnectableObservable) {\n }\n call(subscriber: Subscriber, source: any): TeardownLogic {\n\n const { connectable } = this;\n ( connectable)._refCount++;\n\n const refCounter = new RefCountSubscriber(subscriber, connectable);\n const subscription = source.subscribe(refCounter);\n\n if (!refCounter.closed) {\n ( refCounter).connection = connectable.connect();\n }\n\n return subscription;\n }\n}\n\nclass RefCountSubscriber extends Subscriber {\n\n private connection: Subscription;\n\n constructor(destination: Subscriber,\n private connectable: ConnectableObservable) {\n super(destination);\n }\n\n protected _unsubscribe() {\n\n const { connectable } = this;\n if (!connectable) {\n this.connection = null;\n return;\n }\n\n this.connectable = null;\n const refCount = ( connectable)._refCount;\n if (refCount <= 0) {\n this.connection = null;\n return;\n }\n\n ( connectable)._refCount = refCount - 1;\n if (refCount > 1) {\n this.connection = null;\n return;\n }\n\n ///\n // Compare the local RefCountSubscriber's connection Subscription to the\n // connection Subscription on the shared ConnectableObservable. In cases\n // where the ConnectableObservable source synchronously emits values, and\n // the RefCountSubscriber's downstream Observers synchronously unsubscribe,\n // execution continues to here before the RefCountOperator has a chance to\n // supply the RefCountSubscriber with the shared connection Subscription.\n // For example:\n // ```\n // range(0, 10).pipe(\n // publish(),\n // refCount(),\n // take(5),\n // )\n // .subscribe();\n // ```\n // In order to account for this case, RefCountSubscriber should only dispose\n // the ConnectableObservable's shared connection Subscription if the\n // connection Subscription exists, *and* either:\n // a. RefCountSubscriber doesn't have a reference to the shared connection\n // Subscription yet, or,\n // b. RefCountSubscriber's connection Subscription reference is identical\n // to the shared connection Subscription\n ///\n const { connection } = this;\n const sharedConnection = ( connectable)._connection;\n this.connection = null;\n\n if (sharedConnection && (!connection || sharedConnection === connection)) {\n sharedConnection.unsubscribe();\n }\n }\n}\n","import { AsyncAction } from './AsyncAction';\nimport { Subscription } from '../Subscription';\nimport { QueueScheduler } from './QueueScheduler';\nimport { SchedulerAction } from '../types';\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class QueueAction extends AsyncAction {\n\n constructor(protected scheduler: QueueScheduler,\n protected work: (this: SchedulerAction, state?: T) => void) {\n super(scheduler, work);\n }\n\n public schedule(state?: T, delay: number = 0): Subscription {\n if (delay > 0) {\n return super.schedule(state, delay);\n }\n this.delay = delay;\n this.state = state;\n this.scheduler.flush(this);\n return this;\n }\n\n public execute(state: T, delay: number): any {\n return (delay > 0 || this.closed) ?\n super.execute(state, delay) :\n this._execute(state, delay) ;\n }\n\n protected requestAsyncId(scheduler: QueueScheduler, id?: any, delay: number = 0): any {\n // If delay exists and is greater than 0, or if the delay is null (the\n // action wasn't rescheduled) but was originally scheduled as an async\n // action, then recycle as an async action.\n if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {\n return super.requestAsyncId(scheduler, id, delay);\n }\n // Otherwise flush the scheduler starting with this action.\n return scheduler.flush(this);\n }\n}\n","import { AsyncScheduler } from './AsyncScheduler';\n\nexport class QueueScheduler extends AsyncScheduler {\n}\n","import { QueueAction } from './QueueAction';\nimport { QueueScheduler } from './QueueScheduler';\n\n/**\n *\n * Queue Scheduler\n *\n * Put every next task on a queue, instead of executing it immediately\n *\n * `queue` scheduler, when used with delay, behaves the same as {@link asyncScheduler} scheduler.\n *\n * When used without delay, it schedules given task synchronously - executes it right when\n * it is scheduled. However when called recursively, that is when inside the scheduled task,\n * another task is scheduled with queue scheduler, instead of executing immediately as well,\n * that task will be put on a queue and wait for current one to finish.\n *\n * This means that when you execute task with `queue` scheduler, you are sure it will end\n * before any other task scheduled with that scheduler will start.\n *\n * ## Examples\n * Schedule recursively first, then do something\n * ```ts\n * import { queueScheduler } from 'rxjs';\n *\n * queueScheduler.schedule(() => {\n * queueScheduler.schedule(() => console.log('second')); // will not happen now, but will be put on a queue\n *\n * console.log('first');\n * });\n *\n * // Logs:\n * // \"first\"\n * // \"second\"\n * ```\n *\n * Reschedule itself recursively\n * ```ts\n * import { queueScheduler } from 'rxjs';\n *\n * queueScheduler.schedule(function(state) {\n * if (state !== 0) {\n * console.log('before', state);\n * this.schedule(state - 1); // `this` references currently executing Action,\n * // which we reschedule with new state\n * console.log('after', state);\n * }\n * }, 0, 3);\n *\n * // In scheduler that runs recursively, you would expect:\n * // \"before\", 3\n * // \"before\", 2\n * // \"before\", 1\n * // \"after\", 1\n * // \"after\", 2\n * // \"after\", 3\n *\n * // But with queue it logs:\n * // \"before\", 3\n * // \"after\", 3\n * // \"before\", 2\n * // \"after\", 2\n * // \"before\", 1\n * // \"after\", 1\n * ```\n *\n * @static true\n * @name queue\n * @owner Scheduler\n */\n\nexport const queue = new QueueScheduler(QueueAction);\n","import { Subscription } from '../Subscription';\nimport { InnerSubscriber } from '../InnerSubscriber';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { Subscriber } from '../Subscriber';\nimport { subscribeTo } from './subscribeTo';\nimport { Observable } from '../Observable';\n\nexport function subscribeToResult(\n outerSubscriber: OuterSubscriber,\n result: any,\n outerValue: undefined,\n outerIndex: undefined,\n innerSubscriber: InnerSubscriber\n): Subscription | undefined;\n\nexport function subscribeToResult(\n outerSubscriber: OuterSubscriber,\n result: any,\n outerValue?: T,\n outerIndex?: number\n): Subscription | undefined;\n\nexport function subscribeToResult(\n outerSubscriber: OuterSubscriber,\n result: any,\n outerValue?: T,\n outerIndex?: number,\n innerSubscriber: Subscriber = new InnerSubscriber(outerSubscriber, outerValue, outerIndex)\n): Subscription | undefined {\n if (innerSubscriber.closed) {\n return undefined;\n }\n if (result instanceof Observable) {\n return result.subscribe(innerSubscriber);\n }\n return subscribeTo(result)(innerSubscriber) as Subscription;\n}\n"],"sourceRoot":"webpack:///"}