@lambforge/agent-chat 0.0.0-stage → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../node_modules/tslib/tslib.es6.mjs", "../../../node_modules/rxjs/src/internal/util/isFunction.ts", "../../../node_modules/rxjs/src/internal/util/createErrorClass.ts", "../../../node_modules/rxjs/src/internal/util/UnsubscriptionError.ts", "../../../node_modules/rxjs/src/internal/util/arrRemove.ts", "../../../node_modules/rxjs/src/internal/Subscription.ts", "../../../node_modules/rxjs/src/internal/config.ts", "../../../node_modules/rxjs/src/internal/scheduler/timeoutProvider.ts", "../../../node_modules/rxjs/src/internal/util/reportUnhandledError.ts", "../../../node_modules/rxjs/src/internal/util/noop.ts", "../../../node_modules/rxjs/src/internal/NotificationFactories.ts", "../../../node_modules/rxjs/src/internal/util/errorContext.ts", "../../../node_modules/rxjs/src/internal/Subscriber.ts", "../../../node_modules/rxjs/src/internal/symbol/observable.ts", "../../../node_modules/rxjs/src/internal/util/identity.ts", "../../../node_modules/rxjs/src/internal/util/pipe.ts", "../../../node_modules/rxjs/src/internal/Observable.ts", "../../../node_modules/rxjs/src/internal/util/lift.ts", "../../../node_modules/rxjs/src/internal/operators/OperatorSubscriber.ts", "../../../node_modules/rxjs/src/internal/operators/refCount.ts", "../../../node_modules/rxjs/src/internal/observable/ConnectableObservable.ts", "../../../node_modules/rxjs/src/internal/scheduler/performanceTimestampProvider.ts", "../../../node_modules/rxjs/src/internal/scheduler/animationFrameProvider.ts", "../../../node_modules/rxjs/src/internal/observable/dom/animationFrames.ts", "../../../node_modules/rxjs/src/internal/util/ObjectUnsubscribedError.ts", "../../../node_modules/rxjs/src/internal/Subject.ts", "../../../node_modules/rxjs/src/internal/BehaviorSubject.ts", "../../../node_modules/rxjs/src/internal/scheduler/dateTimestampProvider.ts", "../../../node_modules/rxjs/src/internal/ReplaySubject.ts", "../../../node_modules/rxjs/src/internal/AsyncSubject.ts", "../../../node_modules/rxjs/src/internal/scheduler/Action.ts", "../../../node_modules/rxjs/src/internal/scheduler/intervalProvider.ts", "../../../node_modules/rxjs/src/internal/scheduler/AsyncAction.ts", "../../../node_modules/rxjs/src/internal/util/Immediate.ts", "../../../node_modules/rxjs/src/internal/scheduler/immediateProvider.ts", "../../../node_modules/rxjs/src/internal/scheduler/AsapAction.ts", "../../../node_modules/rxjs/src/internal/Scheduler.ts", "../../../node_modules/rxjs/src/internal/scheduler/AsyncScheduler.ts", "../../../node_modules/rxjs/src/internal/scheduler/AsapScheduler.ts", "../../../node_modules/rxjs/src/internal/scheduler/asap.ts", "../../../node_modules/rxjs/src/internal/scheduler/async.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/scheduler/AnimationFrameAction.ts", "../../../node_modules/rxjs/src/internal/scheduler/AnimationFrameScheduler.ts", "../../../node_modules/rxjs/src/internal/scheduler/animationFrame.ts", "../../../node_modules/rxjs/src/internal/scheduler/VirtualTimeScheduler.ts", "../../../node_modules/rxjs/src/internal/observable/empty.ts", "../../../node_modules/rxjs/src/internal/util/isScheduler.ts", "../../../node_modules/rxjs/src/internal/util/args.ts", "../../../node_modules/rxjs/src/internal/util/isArrayLike.ts", "../../../node_modules/rxjs/src/internal/util/isPromise.ts", "../../../node_modules/rxjs/src/internal/util/isInteropObservable.ts", "../../../node_modules/rxjs/src/internal/util/isAsyncIterable.ts", "../../../node_modules/rxjs/src/internal/util/throwUnobservableError.ts", "../../../node_modules/rxjs/src/internal/symbol/iterator.ts", "../../../node_modules/rxjs/src/internal/util/isIterable.ts", "../../../node_modules/rxjs/src/internal/util/isReadableStreamLike.ts", "../../../node_modules/rxjs/src/internal/observable/innerFrom.ts", "../../../node_modules/rxjs/src/internal/util/executeSchedule.ts", "../../../node_modules/rxjs/src/internal/operators/observeOn.ts", "../../../node_modules/rxjs/src/internal/operators/subscribeOn.ts", "../../../node_modules/rxjs/src/internal/scheduled/scheduleObservable.ts", "../../../node_modules/rxjs/src/internal/scheduled/schedulePromise.ts", "../../../node_modules/rxjs/src/internal/scheduled/scheduleArray.ts", "../../../node_modules/rxjs/src/internal/scheduled/scheduleIterable.ts", "../../../node_modules/rxjs/src/internal/scheduled/scheduleAsyncIterable.ts", "../../../node_modules/rxjs/src/internal/scheduled/scheduleReadableStreamLike.ts", "../../../node_modules/rxjs/src/internal/scheduled/scheduled.ts", "../../../node_modules/rxjs/src/internal/observable/from.ts", "../../../node_modules/rxjs/src/internal/observable/of.ts", "../../../node_modules/rxjs/src/internal/observable/throwError.ts", "../../../node_modules/rxjs/src/internal/Notification.ts", "../../../node_modules/rxjs/src/internal/util/isObservable.ts", "../../../node_modules/rxjs/src/internal/util/EmptyError.ts", "../../../node_modules/rxjs/src/internal/lastValueFrom.ts", "../../../node_modules/rxjs/src/internal/firstValueFrom.ts", "../../../node_modules/rxjs/src/internal/util/ArgumentOutOfRangeError.ts", "../../../node_modules/rxjs/src/internal/util/NotFoundError.ts", "../../../node_modules/rxjs/src/internal/util/SequenceError.ts", "../../../node_modules/rxjs/src/internal/util/isDate.ts", "../../../node_modules/rxjs/src/internal/operators/timeout.ts", "../../../node_modules/rxjs/src/internal/operators/map.ts", "../../../node_modules/rxjs/src/internal/util/mapOneOrManyArgs.ts", "../../../node_modules/rxjs/src/internal/observable/bindCallbackInternals.ts", "../../../node_modules/rxjs/src/internal/observable/bindCallback.ts", "../../../node_modules/rxjs/src/internal/observable/bindNodeCallback.ts", "../../../node_modules/rxjs/src/internal/util/argsArgArrayOrObject.ts", "../../../node_modules/rxjs/src/internal/util/createObject.ts", "../../../node_modules/rxjs/src/internal/observable/combineLatest.ts", "../../../node_modules/rxjs/src/internal/operators/mergeInternals.ts", "../../../node_modules/rxjs/src/internal/operators/mergeMap.ts", "../../../node_modules/rxjs/src/internal/operators/mergeAll.ts", "../../../node_modules/rxjs/src/internal/operators/concatAll.ts", "../../../node_modules/rxjs/src/internal/observable/concat.ts", "../../../node_modules/rxjs/src/internal/observable/defer.ts", "../../../node_modules/rxjs/src/internal/observable/connectable.ts", "../../../node_modules/rxjs/src/internal/observable/forkJoin.ts", "../../../node_modules/rxjs/src/internal/observable/fromEvent.ts", "../../../node_modules/rxjs/src/internal/observable/fromEventPattern.ts", "../../../node_modules/rxjs/src/internal/observable/generate.ts", "../../../node_modules/rxjs/src/internal/observable/iif.ts", "../../../node_modules/rxjs/src/internal/observable/timer.ts", "../../../node_modules/rxjs/src/internal/observable/interval.ts", "../../../node_modules/rxjs/src/internal/observable/merge.ts", "../../../node_modules/rxjs/src/internal/observable/never.ts", "../../../node_modules/rxjs/src/internal/util/argsOrArgArray.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/operators/filter.ts", "../../../node_modules/rxjs/src/internal/observable/partition.ts", "../../../node_modules/rxjs/src/internal/observable/race.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/dist/esm5/internal/types.js", "../../../node_modules/rxjs/src/internal/operators/audit.ts", "../../../node_modules/rxjs/src/internal/operators/auditTime.ts", "../../../node_modules/rxjs/src/internal/operators/buffer.ts", "../../../node_modules/rxjs/src/internal/operators/bufferCount.ts", "../../../node_modules/rxjs/src/internal/operators/bufferTime.ts", "../../../node_modules/rxjs/src/internal/operators/bufferToggle.ts", "../../../node_modules/rxjs/src/internal/operators/bufferWhen.ts", "../../../node_modules/rxjs/src/internal/operators/catchError.ts", "../../../node_modules/rxjs/src/internal/operators/scanInternals.ts", "../../../node_modules/rxjs/src/internal/operators/reduce.ts", "../../../node_modules/rxjs/src/internal/operators/toArray.ts", "../../../node_modules/rxjs/src/internal/operators/joinAllInternals.ts", "../../../node_modules/rxjs/src/internal/operators/combineLatestAll.ts", "../../../node_modules/rxjs/src/internal/operators/combineAll.ts", "../../../node_modules/rxjs/src/internal/operators/combineLatest.ts", "../../../node_modules/rxjs/src/internal/operators/combineLatestWith.ts", "../../../node_modules/rxjs/src/internal/operators/concatMap.ts", "../../../node_modules/rxjs/src/internal/operators/concatMapTo.ts", "../../../node_modules/rxjs/src/internal/operators/concat.ts", "../../../node_modules/rxjs/src/internal/operators/concatWith.ts", "../../../node_modules/rxjs/src/internal/observable/fromSubscribable.ts", "../../../node_modules/rxjs/src/internal/operators/connect.ts", "../../../node_modules/rxjs/src/internal/operators/count.ts", "../../../node_modules/rxjs/src/internal/operators/debounce.ts", "../../../node_modules/rxjs/src/internal/operators/debounceTime.ts", "../../../node_modules/rxjs/src/internal/operators/defaultIfEmpty.ts", "../../../node_modules/rxjs/src/internal/operators/take.ts", "../../../node_modules/rxjs/src/internal/operators/ignoreElements.ts", "../../../node_modules/rxjs/src/internal/operators/mapTo.ts", "../../../node_modules/rxjs/src/internal/operators/delayWhen.ts", "../../../node_modules/rxjs/src/internal/operators/delay.ts", "../../../node_modules/rxjs/src/internal/operators/dematerialize.ts", "../../../node_modules/rxjs/src/internal/operators/distinct.ts", "../../../node_modules/rxjs/src/internal/operators/distinctUntilChanged.ts", "../../../node_modules/rxjs/src/internal/operators/distinctUntilKeyChanged.ts", "../../../node_modules/rxjs/src/internal/operators/throwIfEmpty.ts", "../../../node_modules/rxjs/src/internal/operators/elementAt.ts", "../../../node_modules/rxjs/src/internal/operators/endWith.ts", "../../../node_modules/rxjs/src/internal/operators/every.ts", "../../../node_modules/rxjs/src/internal/operators/exhaustMap.ts", "../../../node_modules/rxjs/src/internal/operators/exhaustAll.ts", "../../../node_modules/rxjs/src/internal/operators/exhaust.ts", "../../../node_modules/rxjs/src/internal/operators/expand.ts", "../../../node_modules/rxjs/src/internal/operators/finalize.ts", "../../../node_modules/rxjs/src/internal/operators/find.ts", "../../../node_modules/rxjs/src/internal/operators/findIndex.ts", "../../../node_modules/rxjs/src/internal/operators/first.ts", "../../../node_modules/rxjs/src/internal/operators/groupBy.ts", "../../../node_modules/rxjs/src/internal/operators/isEmpty.ts", "../../../node_modules/rxjs/src/internal/operators/takeLast.ts", "../../../node_modules/rxjs/src/internal/operators/last.ts", "../../../node_modules/rxjs/src/internal/operators/materialize.ts", "../../../node_modules/rxjs/src/internal/operators/max.ts", "../../../node_modules/rxjs/src/internal/operators/flatMap.ts", "../../../node_modules/rxjs/src/internal/operators/mergeMapTo.ts", "../../../node_modules/rxjs/src/internal/operators/mergeScan.ts", "../../../node_modules/rxjs/src/internal/operators/merge.ts", "../../../node_modules/rxjs/src/internal/operators/mergeWith.ts", "../../../node_modules/rxjs/src/internal/operators/min.ts", "../../../node_modules/rxjs/src/internal/operators/multicast.ts", "../../../node_modules/rxjs/src/internal/operators/onErrorResumeNextWith.ts", "../../../node_modules/rxjs/src/internal/operators/pairwise.ts", "../../../node_modules/rxjs/src/internal/operators/pluck.ts", "../../../node_modules/rxjs/src/internal/operators/publish.ts", "../../../node_modules/rxjs/src/internal/operators/publishBehavior.ts", "../../../node_modules/rxjs/src/internal/operators/publishLast.ts", "../../../node_modules/rxjs/src/internal/operators/publishReplay.ts", "../../../node_modules/rxjs/src/internal/operators/raceWith.ts", "../../../node_modules/rxjs/src/internal/operators/repeat.ts", "../../../node_modules/rxjs/src/internal/operators/repeatWhen.ts", "../../../node_modules/rxjs/src/internal/operators/retry.ts", "../../../node_modules/rxjs/src/internal/operators/retryWhen.ts", "../../../node_modules/rxjs/src/internal/operators/sample.ts", "../../../node_modules/rxjs/src/internal/operators/sampleTime.ts", "../../../node_modules/rxjs/src/internal/operators/scan.ts", "../../../node_modules/rxjs/src/internal/operators/sequenceEqual.ts", "../../../node_modules/rxjs/src/internal/operators/share.ts", "../../../node_modules/rxjs/src/internal/operators/shareReplay.ts", "../../../node_modules/rxjs/src/internal/operators/single.ts", "../../../node_modules/rxjs/src/internal/operators/skip.ts", "../../../node_modules/rxjs/src/internal/operators/skipLast.ts", "../../../node_modules/rxjs/src/internal/operators/skipUntil.ts", "../../../node_modules/rxjs/src/internal/operators/skipWhile.ts", "../../../node_modules/rxjs/src/internal/operators/startWith.ts", "../../../node_modules/rxjs/src/internal/operators/switchMap.ts", "../../../node_modules/rxjs/src/internal/operators/switchAll.ts", "../../../node_modules/rxjs/src/internal/operators/switchMapTo.ts", "../../../node_modules/rxjs/src/internal/operators/switchScan.ts", "../../../node_modules/rxjs/src/internal/operators/takeUntil.ts", "../../../node_modules/rxjs/src/internal/operators/takeWhile.ts", "../../../node_modules/rxjs/src/internal/operators/tap.ts", "../../../node_modules/rxjs/src/internal/operators/throttle.ts", "../../../node_modules/rxjs/src/internal/operators/throttleTime.ts", "../../../node_modules/rxjs/src/internal/operators/timeInterval.ts", "../../../node_modules/rxjs/src/internal/operators/timeoutWith.ts", "../../../node_modules/rxjs/src/internal/operators/timestamp.ts", "../../../node_modules/rxjs/src/internal/operators/window.ts", "../../../node_modules/rxjs/src/internal/operators/windowCount.ts", "../../../node_modules/rxjs/src/internal/operators/windowTime.ts", "../../../node_modules/rxjs/src/internal/operators/windowToggle.ts", "../../../node_modules/rxjs/src/internal/operators/windowWhen.ts", "../../../node_modules/rxjs/src/internal/operators/withLatestFrom.ts", "../../../node_modules/rxjs/src/internal/operators/zipAll.ts", "../../../node_modules/rxjs/src/internal/operators/zip.ts", "../../../node_modules/rxjs/src/internal/operators/zipWith.ts", "../../../node_modules/rxjs/src/index.ts", "../../../node_modules/rxjs/src/internal/operators/partition.ts", "../../../node_modules/rxjs/src/internal/operators/race.ts", "../../../node_modules/rxjs/src/operators/index.ts", "../../../node_modules/lit-html/src/lit-html.ts", "../../../node_modules/@rxdi/lit-html/dist/decorators/component.decorator.js", "../../../node_modules/@rxdi/lit-html/dist/decorators/hooks/index.js", "../../../node_modules/@rxdi/lit-html/dist/decorators/index.js", "../../../node_modules/lit-html/src/directive.ts", "../../../node_modules/lit-html/src/directive-helpers.ts", "../../../node_modules/lit-html/src/async-directive.ts", "../../../node_modules/@rxdi/lit-html/dist/async.js", "../../../node_modules/lit-html/src/experimental-hydrate.ts", "../../../node_modules/lit-element/src/experimental-hydrate-support.ts", "../../../node_modules/lit-html/src/polyfill-support.ts", "../../../node_modules/@lit/reactive-element/src/css-tag.ts", "../../../node_modules/@lit/reactive-element/src/reactive-element.ts", "../../../node_modules/lit-element/src/lit-element.ts", "../../../node_modules/@lit/reactive-element/src/decorators/base.ts", "../../../node_modules/@lit/reactive-element/src/decorators/custom-element.ts", "../../../node_modules/@lit/reactive-element/src/decorators/property.ts", "../../../node_modules/@lit/reactive-element/src/decorators/state.ts", "../../../node_modules/@lit/reactive-element/src/decorators/event-options.ts", "../../../node_modules/@lit/reactive-element/src/decorators/query.ts", "../../../node_modules/@lit/reactive-element/src/decorators/query-all.ts", "../../../node_modules/@lit/reactive-element/src/decorators/query-async.ts", "../../../node_modules/@lit/reactive-element/src/decorators/query-assigned-elements.ts", "../../../node_modules/@lit/reactive-element/src/decorators/query-assigned-nodes.ts", "../../../node_modules/lit-element/src/index.ts", "../../../node_modules/lit-html/src/directives/class-map.ts", "../../../node_modules/lit-html/src/directives/private-async-helpers.ts", "../../../node_modules/lit-html/src/directives/async-replace.ts", "../../../node_modules/lit-html/src/directives/async-append.ts", "../../../node_modules/lit-html/src/directives/cache.ts", "../../../node_modules/lit-html/src/directives/guard.ts", "../../../node_modules/lit-html/src/directives/if-defined.ts", "../../../node_modules/lit-html/src/directives/live.ts", "../../../node_modules/lit-html/src/directives/ref.ts", "../../../node_modules/lit-html/src/directives/repeat.ts", "../../../node_modules/lit-html/src/directives/style-map.ts", "../../../node_modules/lit-html/src/directives/template-content.ts", "../../../node_modules/lit-html/src/directives/unsafe-html.ts", "../../../node_modules/lit-html/src/directives/unsafe-svg.ts", "../../../node_modules/lit-html/src/directives/until.ts", "../../../node_modules/lit-html/src/directives/choose.ts", "../../../node_modules/lit-html/src/directives/join.ts", "../../../node_modules/lit-html/src/directives/keyed.ts", "../../../node_modules/lit-html/src/directives/map.ts", "../../../node_modules/lit-html/src/directives/range.ts", "../../../node_modules/lit-html/src/directives/when.ts", "../../../node_modules/@rxdi/lit-html/dist/index.js", "../../../node_modules/@rhtml/renderer/src/renderer.ts", "../../../node_modules/@rhtml/renderer/src/index.ts", "../../../node_modules/@rhtml/component/src/index.ts", "../../../node_modules/@rxdi/redux-store/dist/interfaces.js", "../../../node_modules/@rxdi/redux-store/dist/utils.js", "../../../node_modules/@rxdi/redux-store/dist/reducer.factory.js", "../../../node_modules/@rxdi/redux-store/dist/defaults.js", "../../../node_modules/@rxdi/redux-store/dist/devtools.js", "../../../node_modules/@rxdi/redux-store/dist/store.js", "../../../node_modules/@rxdi/redux-store/dist/middleware.js", "../../../node_modules/@rxdi/redux-store/dist/effects.js", "../../../node_modules/@rxdi/redux-store/dist/index.js", "../../agents/src/client.ts", "../../agents/src/documents.ts", "../../agents/src/errors.ts", "../../agents/src/http.ts", "../../agents/src/ws.ts", "../src/element.ts", "../src/markdown.ts", "../../../node_modules/ts-action/esm5/action.js", "../../../node_modules/ts-action/esm5/reducer.js", "../src/store/chat-actions.ts", "../src/store/chat-effects.ts", "../src/store/chat-state.ts", "../src/store/chat-reducer.ts", "../src/store/chat-store.ts", "../src/strings.ts", "../src/styles.ts", "../src/turnstile.ts", "../src/auto.ts"],
4
+ "sourcesContent": ["/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\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;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\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;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\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);\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); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nvar ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n var r, s = 0;\n function next() {\n while (r = env.stack.pop()) {\n try {\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\n if (r.dispose) {\n var result = r.dispose.call(r.value);\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n else s |= 1;\n }\n catch (e) {\n fail(e);\n }\n }\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport function __rewriteRelativeImportExtension(path, preserveJsx, extraExtensions, ignoreCase) {\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\n if (extraExtensions) {\n for (var extension in extraExtensions) {\n var suffix = path.slice(-extension.length);\n if (suffix === extension || ignoreCase && suffix.toLowerCase() === extension.toLowerCase()) {\n var output = extraExtensions[extension];\n return output === extension ? path : path.slice(0, -extension.length) + output;\n }\n }\n }\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\n });\n }\n return path;\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __esDecorate,\n __runInitializers,\n __propKey,\n __setFunctionName,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n __rewriteRelativeImportExtension,\n};\n", "/**\n * Returns true if the object is a function.\n * @param value The value to check\n */\nexport function isFunction(value: any): value is (...args: any[]) => any {\n return typeof value === 'function';\n}\n", "/**\n * Used to create Error subclasses until the community moves away from ES5.\n *\n * This is because compiling from TypeScript down to ES5 has issues with subclassing Errors\n * as well as other built-in types: https://github.com/Microsoft/TypeScript/issues/12123\n *\n * @param createImpl A factory function to create the actual constructor implementation. The returned\n * function should be a named function that calls `_super` internally.\n */\nexport function createErrorClass<T>(createImpl: (_super: any) => any): T {\n const _super = (instance: any) => {\n Error.call(instance);\n instance.stack = new Error().stack;\n };\n\n const ctorFunc = createImpl(_super);\n ctorFunc.prototype = Object.create(Error.prototype);\n ctorFunc.prototype.constructor = ctorFunc;\n return ctorFunc;\n}\n", "import { createErrorClass } from './createErrorClass';\n\nexport interface UnsubscriptionError extends Error {\n readonly errors: any[];\n}\n\nexport interface UnsubscriptionErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new (errors: any[]): UnsubscriptionError;\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 = createErrorClass(\n (_super) =>\n function UnsubscriptionErrorImpl(this: any, errors: (Error | string)[]) {\n _super(this);\n this.message = errors\n ? `${errors.length} errors occurred during unsubscription:\n${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\\n ')}`\n : '';\n this.name = 'UnsubscriptionError';\n this.errors = errors;\n }\n);\n", "/**\n * Removes an item from an array, mutating it.\n * @param arr The array to remove the item from\n * @param item The item to remove\n */\nexport function arrRemove<T>(arr: T[] | undefined | null, item: T) {\n if (arr) {\n const index = arr.indexOf(item);\n 0 <= index && arr.splice(index, 1);\n }\n}\n", "import { isFunction } from './util/isFunction';\nimport { UnsubscriptionError } from './util/UnsubscriptionError';\nimport { SubscriptionLike, TeardownLogic, Unsubscribable } from './types';\nimport { arrRemove } from './util/arrRemove';\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 */\nexport class Subscription implements SubscriptionLike {\n public static EMPTY = (() => {\n const empty = new Subscription();\n empty.closed = true;\n return empty;\n })();\n\n /**\n * A flag to indicate whether this Subscription has already been unsubscribed.\n */\n public closed = false;\n\n private _parentage: Subscription[] | Subscription | null = null;\n\n /**\n * The list of registered finalizers to execute upon unsubscription. Adding and removing from this\n * list occurs in the {@link #add} and {@link #remove} methods.\n */\n private _finalizers: Exclude<TeardownLogic, void>[] | null = null;\n\n /**\n * @param initialTeardown A function executed first as part of the finalization\n * process that is kicked off when {@link #unsubscribe} is called.\n */\n constructor(private initialTeardown?: () => void) {}\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 */\n unsubscribe(): void {\n let errors: any[] | undefined;\n\n if (!this.closed) {\n this.closed = true;\n\n // Remove this from it's parents.\n const { _parentage } = this;\n if (_parentage) {\n this._parentage = null;\n if (Array.isArray(_parentage)) {\n for (const parent of _parentage) {\n parent.remove(this);\n }\n } else {\n _parentage.remove(this);\n }\n }\n\n const { initialTeardown: initialFinalizer } = this;\n if (isFunction(initialFinalizer)) {\n try {\n initialFinalizer();\n } catch (e) {\n errors = e instanceof UnsubscriptionError ? e.errors : [e];\n }\n }\n\n const { _finalizers } = this;\n if (_finalizers) {\n this._finalizers = null;\n for (const finalizer of _finalizers) {\n try {\n execFinalizer(finalizer);\n } catch (err) {\n errors = errors ?? [];\n if (err instanceof UnsubscriptionError) {\n errors = [...errors, ...err.errors];\n } else {\n errors.push(err);\n }\n }\n }\n }\n\n if (errors) {\n throw new UnsubscriptionError(errors);\n }\n }\n }\n\n /**\n * Adds a finalizer to this subscription, so that finalization will be unsubscribed/called\n * when this subscription is unsubscribed. If this subscription is already {@link #closed},\n * because it has already been unsubscribed, then whatever finalizer is passed to it\n * will automatically be executed (unless the finalizer itself is also a closed subscription).\n *\n * Closed Subscriptions cannot be added as finalizers to any subscription. Adding a closed\n * subscription to a any subscription will result in no operation. (A noop).\n *\n * Adding a subscription to itself, or adding `null` or `undefined` will not perform any\n * operation at all. (A noop).\n *\n * `Subscription` instances that are added to this instance will automatically remove themselves\n * if they are unsubscribed. Functions and {@link Unsubscribable} objects that you wish to remove\n * will need to be removed manually with {@link #remove}\n *\n * @param teardown The finalization logic to add to this subscription.\n */\n add(teardown: TeardownLogic): void {\n // Only add the finalizer if it's not undefined\n // and don't add a subscription to itself.\n if (teardown && teardown !== this) {\n if (this.closed) {\n // If this subscription is already closed,\n // execute whatever finalizer is handed to it automatically.\n execFinalizer(teardown);\n } else {\n if (teardown instanceof Subscription) {\n // We don't add closed subscriptions, and we don't add the same subscription\n // twice. Subscription unsubscribe is idempotent.\n if (teardown.closed || teardown._hasParent(this)) {\n return;\n }\n teardown._addParent(this);\n }\n (this._finalizers = this._finalizers ?? []).push(teardown);\n }\n }\n }\n\n /**\n * Checks to see if a this subscription already has a particular parent.\n * This will signal that this subscription has already been added to the parent in question.\n * @param parent the parent to check for\n */\n private _hasParent(parent: Subscription) {\n const { _parentage } = this;\n return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));\n }\n\n /**\n * Adds a parent to this subscription so it can be removed from the parent if it\n * unsubscribes on it's own.\n *\n * NOTE: THIS ASSUMES THAT {@link _hasParent} HAS ALREADY BEEN CHECKED.\n * @param parent The parent subscription to add\n */\n private _addParent(parent: Subscription) {\n const { _parentage } = this;\n this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;\n }\n\n /**\n * Called on a child when it is removed via {@link #remove}.\n * @param parent The parent to remove\n */\n private _removeParent(parent: Subscription) {\n const { _parentage } = this;\n if (_parentage === parent) {\n this._parentage = null;\n } else if (Array.isArray(_parentage)) {\n arrRemove(_parentage, parent);\n }\n }\n\n /**\n * Removes a finalizer from this subscription that was previously added with the {@link #add} method.\n *\n * Note that `Subscription` instances, when unsubscribed, will automatically remove themselves\n * from every other `Subscription` they have been added to. This means that using the `remove` method\n * is not a common thing and should be used thoughtfully.\n *\n * If you add the same finalizer instance of a function or an unsubscribable object to a `Subscription` instance\n * more than once, you will need to call `remove` the same number of times to remove all instances.\n *\n * All finalizer instances are removed to free up memory upon unsubscription.\n *\n * @param teardown The finalizer to remove from this subscription\n */\n remove(teardown: Exclude<TeardownLogic, void>): void {\n const { _finalizers } = this;\n _finalizers && arrRemove(_finalizers, teardown);\n\n if (teardown instanceof Subscription) {\n teardown._removeParent(this);\n }\n }\n}\n\nexport const EMPTY_SUBSCRIPTION = Subscription.EMPTY;\n\nexport function isSubscription(value: any): value is Subscription {\n return (\n value instanceof Subscription ||\n (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe))\n );\n}\n\nfunction execFinalizer(finalizer: Unsubscribable | (() => void)) {\n if (isFunction(finalizer)) {\n finalizer();\n } else {\n finalizer.unsubscribe();\n }\n}\n", "import { Subscriber } from './Subscriber';\nimport { ObservableNotification } from './types';\n\n/**\n * The {@link GlobalConfig} object for RxJS. It is used to configure things\n * like how to react on unhandled errors.\n */\nexport const config: GlobalConfig = {\n onUnhandledError: null,\n onStoppedNotification: null,\n Promise: undefined,\n useDeprecatedSynchronousErrorHandling: false,\n useDeprecatedNextContext: false,\n};\n\n/**\n * The global configuration object for RxJS, used to configure things\n * like how to react on unhandled errors. Accessible via {@link config}\n * object.\n */\nexport interface GlobalConfig {\n /**\n * A registration point for unhandled errors from RxJS. These are errors that\n * cannot were not handled by consuming code in the usual subscription path. For\n * example, if you have this configured, and you subscribe to an observable without\n * providing an error handler, errors from that subscription will end up here. This\n * will _always_ be called asynchronously on another job in the runtime. This is because\n * we do not want errors thrown in this user-configured handler to interfere with the\n * behavior of the library.\n */\n onUnhandledError: ((err: any) => void) | null;\n\n /**\n * A registration point for notifications that cannot be sent to subscribers because they\n * have completed, errored or have been explicitly unsubscribed. By default, next, complete\n * and error notifications sent to stopped subscribers are noops. However, sometimes callers\n * might want a different behavior. For example, with sources that attempt to report errors\n * to stopped subscribers, a caller can configure RxJS to throw an unhandled error instead.\n * This will _always_ be called asynchronously on another job in the runtime. This is because\n * we do not want errors thrown in this user-configured handler to interfere with the\n * behavior of the library.\n */\n onStoppedNotification: ((notification: ObservableNotification<any>, subscriber: Subscriber<any>) => void) | null;\n\n /**\n * The promise constructor used by default for {@link Observable#toPromise toPromise} and {@link Observable#forEach forEach}\n * methods.\n *\n * @deprecated As of version 8, RxJS will no longer support this sort of injection of a\n * Promise constructor. If you need a Promise implementation other than native promises,\n * please polyfill/patch Promise as you see appropriate. Will be removed in v8.\n */\n Promise?: 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 BUY TIME\n * FOR MIGRATION REASONS.\n *\n * @deprecated As of version 8, RxJS will no longer support synchronous throwing\n * of unhandled errors. All errors will be thrown on a separate call stack to prevent bad\n * behaviors described above. Will be removed in v8.\n */\n useDeprecatedSynchronousErrorHandling: boolean;\n\n /**\n * If true, enables an as-of-yet undocumented feature from v5: The ability to access\n * `unsubscribe()` via `this` context in `next` functions created in observers passed\n * to `subscribe`.\n *\n * This is being removed because the performance was severely problematic, and it could also cause\n * issues when types other than POJOs are passed to subscribe as subscribers, as they will likely have\n * their `this` context overwritten.\n *\n * @deprecated As of version 8, RxJS will no longer support altering the\n * context of next functions provided as part of an observer to Subscribe. Instead,\n * you will have access to a subscription or a signal or token that will allow you to do things like\n * unsubscribe and test closed status. Will be removed in v8.\n */\n useDeprecatedNextContext: boolean;\n}\n", "import type { TimerHandle } from './timerHandle';\ntype SetTimeoutFunction = (handler: () => void, timeout?: number, ...args: any[]) => TimerHandle;\ntype ClearTimeoutFunction = (handle: TimerHandle) => void;\n\ninterface TimeoutProvider {\n setTimeout: SetTimeoutFunction;\n clearTimeout: ClearTimeoutFunction;\n delegate:\n | {\n setTimeout: SetTimeoutFunction;\n clearTimeout: ClearTimeoutFunction;\n }\n | undefined;\n}\n\nexport const timeoutProvider: TimeoutProvider = {\n // When accessing the delegate, use the variable rather than `this` so that\n // the functions can be called without being bound to the provider.\n setTimeout(handler: () => void, timeout?: number, ...args) {\n const { delegate } = timeoutProvider;\n if (delegate?.setTimeout) {\n return delegate.setTimeout(handler, timeout, ...args);\n }\n return setTimeout(handler, timeout, ...args);\n },\n clearTimeout(handle) {\n const { delegate } = timeoutProvider;\n return (delegate?.clearTimeout || clearTimeout)(handle as any);\n },\n delegate: undefined,\n};\n", "import { config } from '../config';\nimport { timeoutProvider } from '../scheduler/timeoutProvider';\n\n/**\n * Handles an error on another job either with the user-configured {@link onUnhandledError},\n * or by throwing it on that new job so it can be picked up by `window.onerror`, `process.on('error')`, etc.\n *\n * This should be called whenever there is an error that is out-of-band with the subscription\n * or when an error hits a terminal boundary of the subscription and no error handler was provided.\n *\n * @param err the error to report\n */\nexport function reportUnhandledError(err: any) {\n timeoutProvider.setTimeout(() => {\n const { onUnhandledError } = config;\n if (onUnhandledError) {\n // Execute the user-configured error handler.\n onUnhandledError(err);\n } else {\n // Throw so it is picked up by the runtime's uncaught error mechanism.\n throw err;\n }\n });\n}\n", "/* tslint:disable:no-empty */\nexport function noop() { }\n", "import { CompleteNotification, NextNotification, ErrorNotification } from './types';\n\n/**\n * A completion object optimized for memory use and created to be the\n * same \"shape\" as other notifications in v8.\n * @internal\n */\nexport const COMPLETE_NOTIFICATION = (() => createNotification('C', undefined, undefined) as CompleteNotification)();\n\n/**\n * Internal use only. Creates an optimized error notification that is the same \"shape\"\n * as other notifications.\n * @internal\n */\nexport function errorNotification(error: any): ErrorNotification {\n return createNotification('E', undefined, error) as any;\n}\n\n/**\n * Internal use only. Creates an optimized next notification that is the same \"shape\"\n * as other notifications.\n * @internal\n */\nexport function nextNotification<T>(value: T) {\n return createNotification('N', value, undefined) as NextNotification<T>;\n}\n\n/**\n * Ensures that all notifications created internally have the same \"shape\" in v8.\n *\n * TODO: This is only exported to support a crazy legacy test in `groupBy`.\n * @internal\n */\nexport function createNotification(kind: 'N' | 'E' | 'C', value: any, error: any) {\n return {\n kind,\n value,\n error,\n };\n}\n", "import { config } from '../config';\n\nlet context: { errorThrown: boolean; error: any } | null = null;\n\n/**\n * Handles dealing with errors for super-gross mode. Creates a context, in which\n * any synchronously thrown errors will be passed to {@link captureError}. Which\n * will record the error such that it will be rethrown after the call back is complete.\n * TODO: Remove in v8\n * @param cb An immediately executed function.\n */\nexport function errorContext(cb: () => void) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n const isRoot = !context;\n if (isRoot) {\n context = { errorThrown: false, error: null };\n }\n cb();\n if (isRoot) {\n const { errorThrown, error } = context!;\n context = null;\n if (errorThrown) {\n throw error;\n }\n }\n } else {\n // This is the general non-deprecated path for everyone that\n // isn't crazy enough to use super-gross mode (useDeprecatedSynchronousErrorHandling)\n cb();\n }\n}\n\n/**\n * Captures errors only in super-gross mode.\n * @param err the error to capture\n */\nexport function captureError(err: any) {\n if (config.useDeprecatedSynchronousErrorHandling && context) {\n context.errorThrown = true;\n context.error = err;\n }\n}\n", "import { isFunction } from './util/isFunction';\nimport { Observer, ObservableNotification } from './types';\nimport { isSubscription, Subscription } from './Subscription';\nimport { config } from './config';\nimport { reportUnhandledError } from './util/reportUnhandledError';\nimport { noop } from './util/noop';\nimport { nextNotification, errorNotification, COMPLETE_NOTIFICATION } from './NotificationFactories';\nimport { timeoutProvider } from './scheduler/timeoutProvider';\nimport { captureError } from './util/errorContext';\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 */\nexport class Subscriber<T> extends Subscription implements Observer<T> {\n /**\n * A static factory for a Subscriber, given a (potentially partial) definition\n * of an Observer.\n * @param next The `next` callback of an Observer.\n * @param error The `error` callback of an\n * Observer.\n * @param complete The `complete` callback of an\n * Observer.\n * @return A Subscriber wrapping the (partially defined)\n * Observer represented by the given arguments.\n * @deprecated Do not use. Will be removed in v8. There is no replacement for this\n * method, and there is no reason to be creating instances of `Subscriber` directly.\n * If you have a specific use case, please file an issue.\n */\n static create<T>(next?: (x?: T) => void, error?: (e?: any) => void, complete?: () => void): Subscriber<T> {\n return new SafeSubscriber(next, error, complete);\n }\n\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n protected isStopped: boolean = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n protected destination: Subscriber<any> | Observer<any>; // this `any` is the escape hatch to erase extra type param (e.g. R)\n\n /**\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n * There is no reason to directly create an instance of Subscriber. This type is exported for typings reasons.\n */\n constructor(destination?: Subscriber<any> | Observer<any>) {\n super();\n if (destination) {\n this.destination = destination;\n // Automatically chain subscriptions together here.\n // if destination is a Subscription, then it is a Subscriber.\n if (isSubscription(destination)) {\n destination.add(this);\n }\n } else {\n this.destination = EMPTY_OBSERVER;\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 value The `next` value.\n */\n next(value: T): void {\n if (this.isStopped) {\n handleStoppedNotification(nextNotification(value), this);\n } else {\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 err The `error` exception.\n */\n error(err?: any): void {\n if (this.isStopped) {\n handleStoppedNotification(errorNotification(err), this);\n } else {\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 */\n complete(): void {\n if (this.isStopped) {\n handleStoppedNotification(COMPLETE_NOTIFICATION, this);\n } else {\n this.isStopped = true;\n this._complete();\n }\n }\n\n unsubscribe(): void {\n if (!this.closed) {\n this.isStopped = true;\n super.unsubscribe();\n this.destination = null!;\n }\n }\n\n protected _next(value: T): void {\n this.destination.next(value);\n }\n\n protected _error(err: any): void {\n try {\n this.destination.error(err);\n } finally {\n this.unsubscribe();\n }\n }\n\n protected _complete(): void {\n try {\n this.destination.complete();\n } finally {\n this.unsubscribe();\n }\n }\n}\n\n/**\n * This bind is captured here because we want to be able to have\n * compatibility with monoid libraries that tend to use a method named\n * `bind`. In particular, a library called Monio requires this.\n */\nconst _bind = Function.prototype.bind;\n\nfunction bind<Fn extends (...args: any[]) => any>(fn: Fn, thisArg: any): Fn {\n return _bind.call(fn, thisArg);\n}\n\n/**\n * Internal optimization only, DO NOT EXPOSE.\n * @internal\n */\nclass ConsumerObserver<T> implements Observer<T> {\n constructor(private partialObserver: Partial<Observer<T>>) {}\n\n next(value: T): void {\n const { partialObserver } = this;\n if (partialObserver.next) {\n try {\n partialObserver.next(value);\n } catch (error) {\n handleUnhandledError(error);\n }\n }\n }\n\n error(err: any): void {\n const { partialObserver } = this;\n if (partialObserver.error) {\n try {\n partialObserver.error(err);\n } catch (error) {\n handleUnhandledError(error);\n }\n } else {\n handleUnhandledError(err);\n }\n }\n\n complete(): void {\n const { partialObserver } = this;\n if (partialObserver.complete) {\n try {\n partialObserver.complete();\n } catch (error) {\n handleUnhandledError(error);\n }\n }\n }\n}\n\nexport class SafeSubscriber<T> extends Subscriber<T> {\n constructor(\n observerOrNext?: Partial<Observer<T>> | ((value: T) => void) | null,\n error?: ((e?: any) => void) | null,\n complete?: (() => void) | null\n ) {\n super();\n\n let partialObserver: Partial<Observer<T>>;\n if (isFunction(observerOrNext) || !observerOrNext) {\n // The first argument is a function, not an observer. The next\n // two arguments *could* be observers, or they could be empty.\n partialObserver = {\n next: (observerOrNext ?? undefined) as ((value: T) => void) | undefined,\n error: error ?? undefined,\n complete: complete ?? undefined,\n };\n } else {\n // The first argument is a partial observer.\n let context: any;\n if (this && config.useDeprecatedNextContext) {\n // This is a deprecated path that made `this.unsubscribe()` available in\n // next handler functions passed to subscribe. This only exists behind a flag\n // now, as it is *very* slow.\n context = Object.create(observerOrNext);\n context.unsubscribe = () => this.unsubscribe();\n partialObserver = {\n next: observerOrNext.next && bind(observerOrNext.next, context),\n error: observerOrNext.error && bind(observerOrNext.error, context),\n complete: observerOrNext.complete && bind(observerOrNext.complete, context),\n };\n } else {\n // The \"normal\" path. Just use the partial observer directly.\n partialObserver = observerOrNext;\n }\n }\n\n // Wrap the partial observer to ensure it's a full observer, and\n // make sure proper error handling is accounted for.\n this.destination = new ConsumerObserver(partialObserver);\n }\n}\n\nfunction handleUnhandledError(error: any) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n captureError(error);\n } else {\n // Ideal path, we report this as an unhandled error,\n // which is thrown on a new call stack.\n reportUnhandledError(error);\n }\n}\n\n/**\n * An error handler used when no error handler was supplied\n * to the SafeSubscriber -- meaning no error handler was supplied\n * do the `subscribe` call on our observable.\n * @param err The error to handle\n */\nfunction defaultErrorHandler(err: any) {\n throw err;\n}\n\n/**\n * A handler for notifications that cannot be sent to a stopped subscriber.\n * @param notification The notification being sent.\n * @param subscriber The stopped subscriber.\n */\nfunction handleStoppedNotification(notification: ObservableNotification<any>, subscriber: Subscriber<any>) {\n const { onStoppedNotification } = config;\n onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber));\n}\n\n/**\n * The observer used as a stub for subscriptions where the user did not\n * pass any arguments to `subscribe`. Comes with the default error handling\n * behavior.\n */\nexport const EMPTY_OBSERVER: Readonly<Observer<any>> & { closed: true } = {\n closed: true,\n next: noop,\n error: defaultErrorHandler,\n complete: noop,\n};\n", "/**\n * Symbol.observable or a string \"@@observable\". Used for interop\n *\n * @deprecated We will no longer be exporting this symbol in upcoming versions of RxJS.\n * Instead polyfill and use Symbol.observable directly *or* use https://www.npmjs.com/package/symbol-observable\n */\nexport const observable: string | symbol = (() => (typeof Symbol === 'function' && Symbol.observable) || '@@observable')();\n", "/**\n * This function takes one parameter and just returns it. Simply put,\n * this is like `<T>(x: T): T => x`.\n *\n * ## Examples\n *\n * This is useful in some cases when using things like `mergeMap`\n *\n * ```ts\n * import { interval, take, map, range, mergeMap, identity } from 'rxjs';\n *\n * const source$ = interval(1000).pipe(take(5));\n *\n * const result$ = source$.pipe(\n * map(i => range(i)),\n * mergeMap(identity) // same as mergeMap(x => x)\n * );\n *\n * result$.subscribe({\n * next: console.log\n * });\n * ```\n *\n * Or when you want to selectively apply an operator\n *\n * ```ts\n * import { interval, take, identity } from 'rxjs';\n *\n * const shouldLimit = () => Math.random() < 0.5;\n *\n * const source$ = interval(1000);\n *\n * const result$ = source$.pipe(shouldLimit() ? take(5) : identity);\n *\n * result$.subscribe({\n * next: console.log\n * });\n * ```\n *\n * @param x Any value that is returned by this function\n * @returns The value passed as the first parameter to this function\n */\nexport function identity<T>(x: T): T {\n return x;\n}\n", "import { identity } from './identity';\nimport { UnaryFunction } from '../types';\n\nexport function pipe(): typeof identity;\nexport function pipe<T, A>(fn1: UnaryFunction<T, A>): UnaryFunction<T, A>;\nexport function pipe<T, A, B>(fn1: UnaryFunction<T, A>, fn2: UnaryFunction<A, B>): UnaryFunction<T, B>;\nexport function pipe<T, A, B, C>(fn1: UnaryFunction<T, A>, fn2: UnaryFunction<A, B>, fn3: UnaryFunction<B, C>): UnaryFunction<T, C>;\nexport function pipe<T, A, B, C, D>(\n fn1: UnaryFunction<T, A>,\n fn2: UnaryFunction<A, B>,\n fn3: UnaryFunction<B, C>,\n fn4: UnaryFunction<C, D>\n): UnaryFunction<T, D>;\nexport function pipe<T, A, B, C, D, E>(\n fn1: UnaryFunction<T, A>,\n fn2: UnaryFunction<A, B>,\n fn3: UnaryFunction<B, C>,\n fn4: UnaryFunction<C, D>,\n fn5: UnaryFunction<D, E>\n): UnaryFunction<T, E>;\nexport function pipe<T, A, B, C, D, E, F>(\n fn1: UnaryFunction<T, A>,\n fn2: UnaryFunction<A, B>,\n fn3: UnaryFunction<B, C>,\n fn4: UnaryFunction<C, D>,\n fn5: UnaryFunction<D, E>,\n fn6: UnaryFunction<E, F>\n): UnaryFunction<T, F>;\nexport function pipe<T, A, B, C, D, E, F, G>(\n fn1: UnaryFunction<T, A>,\n fn2: UnaryFunction<A, B>,\n fn3: UnaryFunction<B, C>,\n fn4: UnaryFunction<C, D>,\n fn5: UnaryFunction<D, E>,\n fn6: UnaryFunction<E, F>,\n fn7: UnaryFunction<F, G>\n): UnaryFunction<T, G>;\nexport function pipe<T, A, B, C, D, E, F, G, H>(\n fn1: UnaryFunction<T, A>,\n fn2: UnaryFunction<A, B>,\n fn3: UnaryFunction<B, C>,\n fn4: UnaryFunction<C, D>,\n fn5: UnaryFunction<D, E>,\n fn6: UnaryFunction<E, F>,\n fn7: UnaryFunction<F, G>,\n fn8: UnaryFunction<G, H>\n): UnaryFunction<T, H>;\nexport function pipe<T, A, B, C, D, E, F, G, H, I>(\n fn1: UnaryFunction<T, A>,\n fn2: UnaryFunction<A, B>,\n fn3: UnaryFunction<B, C>,\n fn4: UnaryFunction<C, D>,\n fn5: UnaryFunction<D, E>,\n fn6: UnaryFunction<E, F>,\n fn7: UnaryFunction<F, G>,\n fn8: UnaryFunction<G, H>,\n fn9: UnaryFunction<H, I>\n): UnaryFunction<T, I>;\nexport function pipe<T, A, B, C, D, E, F, G, H, I>(\n fn1: UnaryFunction<T, A>,\n fn2: UnaryFunction<A, B>,\n fn3: UnaryFunction<B, C>,\n fn4: UnaryFunction<C, D>,\n fn5: UnaryFunction<D, E>,\n fn6: UnaryFunction<E, F>,\n fn7: UnaryFunction<F, G>,\n fn8: UnaryFunction<G, H>,\n fn9: UnaryFunction<H, I>,\n ...fns: UnaryFunction<any, any>[]\n): UnaryFunction<T, unknown>;\n\n/**\n * pipe() can be called on one or more functions, each of which can take one argument (\"UnaryFunction\")\n * and uses it to return a value.\n * It returns a function that takes one argument, passes it to the first UnaryFunction, and then\n * passes the result to the next one, passes that result to the next one, and so on. \n */\nexport function pipe(...fns: Array<UnaryFunction<any, any>>): UnaryFunction<any, any> {\n return pipeFromArray(fns);\n}\n\n/** @internal */\nexport function pipeFromArray<T, R>(fns: Array<UnaryFunction<T, R>>): UnaryFunction<T, R> {\n if (fns.length === 0) {\n return identity as UnaryFunction<any, any>;\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<T, R>) => fn(prev), input as any);\n };\n}\n", "import { Operator } from './Operator';\nimport { SafeSubscriber, Subscriber } from './Subscriber';\nimport { isSubscription, Subscription } from './Subscription';\nimport { TeardownLogic, OperatorFunction, Subscribable, Observer } from './types';\nimport { observable as Symbol_observable } from './symbol/observable';\nimport { pipeFromArray } from './util/pipe';\nimport { config } from './config';\nimport { isFunction } from './util/isFunction';\nimport { errorContext } from './util/errorContext';\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 */\nexport class Observable<T> implements Subscribable<T> {\n /**\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n */\n source: Observable<any> | undefined;\n\n /**\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n */\n operator: Operator<any, T> | undefined;\n\n /**\n * @param 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<T>, subscriber: Subscriber<T>) => 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 Observable by calling the Observable constructor\n * @param subscribe the subscriber function to be passed to the Observable constructor\n * @return A new observable.\n * @deprecated Use `new Observable()` instead. Will be removed in v8.\n */\n static create: (...args: any[]) => any = <T>(subscribe?: (subscriber: Subscriber<T>) => TeardownLogic) => {\n return new Observable<T>(subscribe);\n };\n\n /**\n * Creates a new Observable, with this Observable instance as the source, and the passed\n * operator defined as the new observable's operator.\n * @param operator the operator defining the operation to take on the observable\n * @return A new observable with the Operator applied.\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n * If you have implemented an operator using `lift`, it is recommended that you create an\n * operator by simply returning `new Observable()` directly. See \"Creating new operators from\n * scratch\" section here: https://rxjs.dev/guide/operators\n */\n lift<R>(operator?: Operator<T, R>): Observable<R> {\n const observable = new Observable<R>();\n observable.source = this;\n observable.operator = operator;\n return observable;\n }\n\n subscribe(observerOrNext?: Partial<Observer<T>> | ((value: T) => void)): Subscription;\n /** @deprecated Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments */\n subscribe(next?: ((value: T) => void) | null, error?: ((error: any) => void) | null, complete?: (() => void) | null): Subscription;\n /**\n * Invokes an execution of an Observable and registers Observer handlers for notifications it will emit.\n *\n * <span class=\"informal\">Use it when you have all these Observables, but still nothing is happening.</span>\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 and an error happens,\n * it will be thrown asynchronously. Errors thrown asynchronously cannot be caught using `try`/`catch`. Instead,\n * use the {@link onUnhandledError} configuration option or use a runtime handler (like `window.onerror` or\n * `process.on('error)`) to be notified of unhandled errors. Because of this, it's recommended that you provide\n * an `error` method to avoid missing thrown errors.\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 an Observer,\n * if you do not need to listen for something, you can omit a function by passing `undefined` or `null`,\n * since `subscribe` recognizes these functions by where they were placed in function call. When it comes\n * to the `error` function, as with an Observer, if not provided, errors emitted by an Observable will be thrown asynchronously.\n *\n * You can, however, subscribe with no parameters at all. This may be the case where you're not interested in terminal events\n * and you also handled emissions internally by using operators (e.g. using `tap`).\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 * #### Examples\n *\n * Subscribe with an {@link guide/observer Observer}\n *\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 ({@link deprecations/subscribe-arguments deprecated})\n *\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 *\n * ```ts\n * import { interval } from 'rxjs';\n *\n * const subscription = interval(1000).subscribe({\n * next(num) {\n * console.log(num)\n * },\n * complete() {\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 observerOrNext Either an {@link Observer} with some or all callback methods,\n * or the `next` handler that is called for each value emitted from the subscribed Observable.\n * @param error A handler for a terminal event resulting from an error. If no error handler is provided,\n * the error will be thrown asynchronously as unhandled.\n * @param complete A handler for a terminal event resulting from successful completion.\n * @return A subscription reference to the registered handlers.\n */\n subscribe(\n observerOrNext?: Partial<Observer<T>> | ((value: T) => void) | null,\n error?: ((error: any) => void) | null,\n complete?: (() => void) | null\n ): Subscription {\n const subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);\n\n errorContext(() => {\n const { operator, source } = this;\n subscriber.add(\n operator\n ? // We're dealing with a subscription in the\n // operator chain to one of our lifted operators.\n operator.call(subscriber, source)\n : source\n ? // If `source` has a value, but `operator` does not, something that\n // had intimate knowledge of our API, like our `Subject`, must have\n // set it. We're going to just call `_subscribe` directly.\n this._subscribe(subscriber)\n : // In all other cases, we're likely wrapping a user-provided initializer\n // function, so we need to catch errors and handle them appropriately.\n this._trySubscribe(subscriber)\n );\n });\n\n return subscriber;\n }\n\n /** @internal */\n protected _trySubscribe(sink: Subscriber<T>): TeardownLogic {\n try {\n return this._subscribe(sink);\n } catch (err) {\n // We don't need to return anything in this case,\n // because it's just going to try to `add()` to a subscription\n // above.\n sink.error(err);\n }\n }\n\n /**\n * Used as a NON-CANCELLABLE means of subscribing to an observable, for use with\n * APIs that expect promises, like `async/await`. You cannot unsubscribe from this.\n *\n * **WARNING**: Only use this with observables you *know* will complete. If the source\n * observable does not complete, you will end up with a promise that is hung up, and\n * potentially all of the state of an async function hanging out in memory. To avoid\n * this situation, look into adding something like {@link timeout}, {@link take},\n * {@link takeWhile}, or {@link takeUntil} amongst others.\n *\n * #### Example\n *\n * ```ts\n * import { interval, take } from 'rxjs';\n *\n * const source$ = interval(1000).pipe(take(4));\n *\n * async function getTotal() {\n * let total = 0;\n *\n * await source$.forEach(value => {\n * total += value;\n * console.log('observable -> ' + value);\n * });\n *\n * return total;\n * }\n *\n * getTotal().then(\n * total => console.log('Total: ' + total)\n * );\n *\n * // Expected:\n * // 'observable -> 0'\n * // 'observable -> 1'\n * // 'observable -> 2'\n * // 'observable -> 3'\n * // 'Total: 6'\n * ```\n *\n * @param next A handler for each value emitted by the observable.\n * @return A promise that either resolves on observable completion or\n * rejects with the handled error.\n */\n forEach(next: (value: T) => void): Promise<void>;\n\n /**\n * @param next a handler for each value emitted by the observable\n * @param promiseCtor a constructor function used to instantiate the Promise\n * @return a promise that either resolves on observable completion or\n * rejects with the handled error\n * @deprecated Passing a Promise constructor will no longer be available\n * in upcoming versions of RxJS. This is because it adds weight to the library, for very\n * little benefit. If you need this functionality, it is recommended that you either\n * polyfill Promise, or you create an adapter to convert the returned native promise\n * to whatever promise implementation you wanted. Will be removed in v8.\n */\n forEach(next: (value: T) => void, promiseCtor: PromiseConstructorLike): Promise<void>;\n\n forEach(next: (value: T) => void, promiseCtor?: PromiseConstructorLike): Promise<void> {\n promiseCtor = getPromiseCtor(promiseCtor);\n\n return new promiseCtor<void>((resolve, reject) => {\n const subscriber = new SafeSubscriber<T>({\n next: (value) => {\n try {\n next(value);\n } catch (err) {\n reject(err);\n subscriber.unsubscribe();\n }\n },\n error: reject,\n complete: resolve,\n });\n this.subscribe(subscriber);\n }) as Promise<void>;\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber<any>): TeardownLogic {\n return this.source?.subscribe(subscriber);\n }\n\n /**\n * An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable\n * @return This instance of the observable.\n */\n [Symbol_observable]() {\n return this;\n }\n\n /* tslint:disable:max-line-length */\n pipe(): Observable<T>;\n pipe<A>(op1: OperatorFunction<T, A>): Observable<A>;\n pipe<A, B>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>): Observable<B>;\n pipe<A, B, C>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>): Observable<C>;\n pipe<A, B, C, D>(\n op1: OperatorFunction<T, A>,\n op2: OperatorFunction<A, B>,\n op3: OperatorFunction<B, C>,\n op4: OperatorFunction<C, D>\n ): Observable<D>;\n pipe<A, B, C, D, E>(\n op1: OperatorFunction<T, A>,\n op2: OperatorFunction<A, B>,\n op3: OperatorFunction<B, C>,\n op4: OperatorFunction<C, D>,\n op5: OperatorFunction<D, E>\n ): Observable<E>;\n pipe<A, B, C, D, E, F>(\n op1: OperatorFunction<T, A>,\n op2: OperatorFunction<A, B>,\n op3: OperatorFunction<B, C>,\n op4: OperatorFunction<C, D>,\n op5: OperatorFunction<D, E>,\n op6: OperatorFunction<E, F>\n ): Observable<F>;\n pipe<A, B, C, D, E, F, G>(\n op1: OperatorFunction<T, A>,\n op2: OperatorFunction<A, B>,\n op3: OperatorFunction<B, C>,\n op4: OperatorFunction<C, D>,\n op5: OperatorFunction<D, E>,\n op6: OperatorFunction<E, F>,\n op7: OperatorFunction<F, G>\n ): Observable<G>;\n pipe<A, B, C, D, E, F, G, H>(\n op1: OperatorFunction<T, A>,\n op2: OperatorFunction<A, B>,\n op3: OperatorFunction<B, C>,\n op4: OperatorFunction<C, D>,\n op5: OperatorFunction<D, E>,\n op6: OperatorFunction<E, F>,\n op7: OperatorFunction<F, G>,\n op8: OperatorFunction<G, H>\n ): Observable<H>;\n pipe<A, B, C, D, E, F, G, H, I>(\n op1: OperatorFunction<T, A>,\n op2: OperatorFunction<A, B>,\n op3: OperatorFunction<B, C>,\n op4: OperatorFunction<C, D>,\n op5: OperatorFunction<D, E>,\n op6: OperatorFunction<E, F>,\n op7: OperatorFunction<F, G>,\n op8: OperatorFunction<G, H>,\n op9: OperatorFunction<H, I>\n ): Observable<I>;\n pipe<A, B, C, D, E, F, G, H, I>(\n op1: OperatorFunction<T, A>,\n op2: OperatorFunction<A, B>,\n op3: OperatorFunction<B, C>,\n op4: OperatorFunction<C, D>,\n op5: OperatorFunction<D, E>,\n op6: OperatorFunction<E, F>,\n op7: OperatorFunction<F, G>,\n op8: OperatorFunction<G, H>,\n op9: OperatorFunction<H, I>,\n ...operations: OperatorFunction<any, any>[]\n ): Observable<unknown>;\n /* tslint:enable:max-line-length */\n\n /**\n * Used to stitch together functional operators into a chain.\n *\n * ## Example\n *\n * ```ts\n * import { interval, filter, map, scan } from 'rxjs';\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 * @return The Observable result of all the operators having been called\n * in the order they were passed in.\n */\n pipe(...operations: OperatorFunction<any, any>[]): Observable<any> {\n return pipeFromArray(operations)(this);\n }\n\n /* tslint:disable:max-line-length */\n /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */\n toPromise(): Promise<T | undefined>;\n /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */\n toPromise(PromiseCtor: typeof Promise): Promise<T | undefined>;\n /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */\n toPromise(PromiseCtor: PromiseConstructorLike): Promise<T | undefined>;\n /* tslint:enable:max-line-length */\n\n /**\n * Subscribe to this Observable and get a Promise resolving on\n * `complete` with the last emission (if any).\n *\n * **WARNING**: Only use this with observables you *know* will complete. If the source\n * observable does not complete, you will end up with a promise that is hung up, and\n * potentially all of the state of an async function hanging out in memory. To avoid\n * this situation, look into adding something like {@link timeout}, {@link take},\n * {@link takeWhile}, or {@link takeUntil} amongst others.\n *\n * @param [promiseCtor] a constructor function used to instantiate\n * the Promise\n * @return A Promise that resolves with the last value emit, or\n * rejects on an error. If there were no emissions, Promise\n * resolves with undefined.\n * @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise\n */\n toPromise(promiseCtor?: PromiseConstructorLike): Promise<T | undefined> {\n promiseCtor = getPromiseCtor(promiseCtor);\n\n return new promiseCtor((resolve, reject) => {\n let value: T | undefined;\n this.subscribe(\n (x: T) => (value = x),\n (err: any) => reject(err),\n () => resolve(value)\n );\n }) as Promise<T | undefined>;\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 return promiseCtor ?? config.Promise ?? Promise;\n}\n\nfunction isObserver<T>(value: any): value is Observer<T> {\n return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);\n}\n\nfunction isSubscriber<T>(value: any): value is Subscriber<T> {\n return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));\n}\n", "import { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { OperatorFunction } from '../types';\nimport { isFunction } from './isFunction';\n\n/**\n * Used to determine if an object is an Observable with a lift function.\n */\nexport function hasLift(source: any): source is { lift: InstanceType<typeof Observable>['lift'] } {\n return isFunction(source?.lift);\n}\n\n/**\n * Creates an `OperatorFunction`. Used to define operators throughout the library in a concise way.\n * @param init The logic to connect the liftedSource to the subscriber at the moment of subscription.\n */\nexport function operate<T, R>(\n init: (liftedSource: Observable<T>, subscriber: Subscriber<R>) => (() => void) | void\n): OperatorFunction<T, R> {\n return (source: Observable<T>) => {\n if (hasLift(source)) {\n return source.lift(function (this: Subscriber<R>, liftedSource: Observable<T>) {\n try {\n return init(liftedSource, this);\n } catch (err) {\n this.error(err);\n }\n });\n }\n throw new TypeError('Unable to lift unknown Observable type');\n };\n}\n", "import { Subscriber } from '../Subscriber';\n\n/**\n * Creates an instance of an `OperatorSubscriber`.\n * @param destination The downstream subscriber.\n * @param onNext Handles next values, only called if this subscriber is not stopped or closed. Any\n * error that occurs in this function is caught and sent to the `error` method of this subscriber.\n * @param onError Handles errors from the subscription, any errors that occur in this handler are caught\n * and send to the `destination` error handler.\n * @param onComplete Handles completion notification from the subscription. Any errors that occur in\n * this handler are sent to the `destination` error handler.\n * @param onFinalize Additional teardown logic here. This will only be called on teardown if the\n * subscriber itself is not already closed. This is called after all other teardown logic is executed.\n */\nexport function createOperatorSubscriber<T>(\n destination: Subscriber<any>,\n onNext?: (value: T) => void,\n onComplete?: () => void,\n onError?: (err: any) => void,\n onFinalize?: () => void\n): Subscriber<T> {\n return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);\n}\n\n/**\n * A generic helper for allowing operators to be created with a Subscriber and\n * use closures to capture necessary state from the operator function itself.\n */\nexport class OperatorSubscriber<T> extends Subscriber<T> {\n /**\n * Creates an instance of an `OperatorSubscriber`.\n * @param destination The downstream subscriber.\n * @param onNext Handles next values, only called if this subscriber is not stopped or closed. Any\n * error that occurs in this function is caught and sent to the `error` method of this subscriber.\n * @param onError Handles errors from the subscription, any errors that occur in this handler are caught\n * and send to the `destination` error handler.\n * @param onComplete Handles completion notification from the subscription. Any errors that occur in\n * this handler are sent to the `destination` error handler.\n * @param onFinalize Additional finalization logic here. This will only be called on finalization if the\n * subscriber itself is not already closed. This is called after all other finalization logic is executed.\n * @param shouldUnsubscribe An optional check to see if an unsubscribe call should truly unsubscribe.\n * NOTE: This currently **ONLY** exists to support the strange behavior of {@link groupBy}, where unsubscription\n * to the resulting observable does not actually disconnect from the source if there are active subscriptions\n * to any grouped observable. (DO NOT EXPOSE OR USE EXTERNALLY!!!)\n */\n constructor(\n destination: Subscriber<any>,\n onNext?: (value: T) => void,\n onComplete?: () => void,\n onError?: (err: any) => void,\n private onFinalize?: () => void,\n private shouldUnsubscribe?: () => boolean\n ) {\n // It's important - for performance reasons - that all of this class's\n // members are initialized and that they are always initialized in the same\n // order. This will ensure that all OperatorSubscriber instances have the\n // same hidden class in V8. This, in turn, will help keep the number of\n // hidden classes involved in property accesses within the base class as\n // low as possible. If the number of hidden classes involved exceeds four,\n // the property accesses will become megamorphic and performance penalties\n // will be incurred - i.e. inline caches won't be used.\n //\n // The reasons for ensuring all instances have the same hidden class are\n // further discussed in this blog post from Benedikt Meurer:\n // https://benediktmeurer.de/2018/03/23/impact-of-polymorphism-on-component-based-frameworks-like-react/\n super(destination);\n this._next = onNext\n ? function (this: OperatorSubscriber<T>, value: T) {\n try {\n onNext(value);\n } catch (err) {\n destination.error(err);\n }\n }\n : super._next;\n this._error = onError\n ? function (this: OperatorSubscriber<T>, err: any) {\n try {\n onError(err);\n } catch (err) {\n // Send any errors that occur down stream.\n destination.error(err);\n } finally {\n // Ensure finalization.\n this.unsubscribe();\n }\n }\n : super._error;\n this._complete = onComplete\n ? function (this: OperatorSubscriber<T>) {\n try {\n onComplete();\n } catch (err) {\n // Send any errors that occur down stream.\n destination.error(err);\n } finally {\n // Ensure finalization.\n this.unsubscribe();\n }\n }\n : super._complete;\n }\n\n unsubscribe() {\n if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {\n const { closed } = this;\n super.unsubscribe();\n // Execute additional teardown if we have any and we didn't already do so.\n !closed && this.onFinalize?.();\n }\n }\n}\n", "import { ConnectableObservable } from '../observable/ConnectableObservable';\nimport { Subscription } from '../Subscription';\nimport { MonoTypeOperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\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 `multicast(() => new Subject())` 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, tap, publish, refCount } from 'rxjs';\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 * @return A function that returns an Observable that automates the connection\n * to ConnectableObservable.\n * @see {@link ConnectableObservable}\n * @see {@link share}\n * @see {@link publish}\n * @deprecated Replaced with the {@link share} operator. How `share` is used\n * will depend on the connectable observable you created just prior to the\n * `refCount` operator.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function refCount<T>(): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n let connection: Subscription | null = null;\n\n (source as any)._refCount++;\n\n const refCounter = createOperatorSubscriber(subscriber, undefined, undefined, undefined, () => {\n if (!source || (source as any)._refCount <= 0 || 0 < --(source as any)._refCount) {\n 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\n const sharedConnection = (source as any)._connection;\n const conn = connection;\n connection = null;\n\n if (sharedConnection && (!conn || sharedConnection === conn)) {\n sharedConnection.unsubscribe();\n }\n\n subscriber.unsubscribe();\n });\n\n source.subscribe(refCounter);\n\n if (!refCounter.closed) {\n connection = (source as ConnectableObservable<T>).connect();\n }\n });\n}\n", "import { Subject } from '../Subject';\nimport { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\nimport { refCount as higherOrderRefCount } from '../operators/refCount';\nimport { createOperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { hasLift } from '../util/lift';\n\n/**\n * @class ConnectableObservable<T>\n * @deprecated Will be removed in v8. Use {@link connectable} to create a connectable observable.\n * If you are using the `refCount` method of `ConnectableObservable`, use the {@link share} operator\n * instead.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport class ConnectableObservable<T> extends Observable<T> {\n protected _subject: Subject<T> | null = null;\n protected _refCount: number = 0;\n protected _connection: Subscription | null = null;\n\n /**\n * @param source The source observable\n * @param subjectFactory The factory that creates the subject used internally.\n * @deprecated Will be removed in v8. Use {@link connectable} to create a connectable observable.\n * `new ConnectableObservable(source, factory)` is equivalent to\n * `connectable(source, { connector: factory })`.\n * When the `refCount()` method is needed, the {@link share} operator should be used instead:\n * `new ConnectableObservable(source, factory).refCount()` is equivalent to\n * `source.pipe(share({ connector: factory }))`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\n constructor(public source: Observable<T>, protected subjectFactory: () => Subject<T>) {\n super();\n // If we have lift, monkey patch that here. This is done so custom observable\n // types will compose through multicast. Otherwise the resulting observable would\n // simply be an instance of `ConnectableObservable`.\n if (hasLift(source)) {\n this.lift = source.lift;\n }\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber<T>) {\n return this.getSubject().subscribe(subscriber);\n }\n\n protected getSubject(): Subject<T> {\n const subject = this._subject;\n if (!subject || subject.isStopped) {\n this._subject = this.subjectFactory();\n }\n return this._subject!;\n }\n\n protected _teardown() {\n this._refCount = 0;\n const { _connection } = this;\n this._subject = this._connection = null;\n _connection?.unsubscribe();\n }\n\n /**\n * @deprecated {@link ConnectableObservable} will be removed in v8. Use {@link connectable} instead.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\n connect(): Subscription {\n let connection = this._connection;\n if (!connection) {\n connection = this._connection = new Subscription();\n const subject = this.getSubject();\n connection.add(\n this.source.subscribe(\n createOperatorSubscriber(\n subject as any,\n undefined,\n () => {\n this._teardown();\n subject.complete();\n },\n (err) => {\n this._teardown();\n subject.error(err);\n },\n () => this._teardown()\n )\n )\n );\n\n if (connection.closed) {\n this._connection = null;\n connection = Subscription.EMPTY;\n }\n }\n return connection;\n }\n\n /**\n * @deprecated {@link ConnectableObservable} will be removed in v8. Use the {@link share} operator instead.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\n refCount(): Observable<T> {\n return higherOrderRefCount()(this) as Observable<T>;\n }\n}\n", "import { TimestampProvider } from '../types';\n\ninterface PerformanceTimestampProvider extends TimestampProvider {\n delegate: TimestampProvider | undefined;\n}\n\nexport const performanceTimestampProvider: PerformanceTimestampProvider = {\n now() {\n // Use the variable rather than `this` so that the function can be called\n // without being bound to the provider.\n return (performanceTimestampProvider.delegate || performance).now();\n },\n delegate: undefined,\n};\n", "import { Subscription } from '../Subscription';\n\ninterface AnimationFrameProvider {\n schedule(callback: FrameRequestCallback): Subscription;\n requestAnimationFrame: typeof requestAnimationFrame;\n cancelAnimationFrame: typeof cancelAnimationFrame;\n delegate:\n | {\n requestAnimationFrame: typeof requestAnimationFrame;\n cancelAnimationFrame: typeof cancelAnimationFrame;\n }\n | undefined;\n}\n\nexport const animationFrameProvider: AnimationFrameProvider = {\n // When accessing the delegate, use the variable rather than `this` so that\n // the functions can be called without being bound to the provider.\n schedule(callback) {\n let request = requestAnimationFrame;\n let cancel: typeof cancelAnimationFrame | undefined = cancelAnimationFrame;\n const { delegate } = animationFrameProvider;\n if (delegate) {\n request = delegate.requestAnimationFrame;\n cancel = delegate.cancelAnimationFrame;\n }\n const handle = request((timestamp) => {\n // Clear the cancel function. The request has been fulfilled, so\n // attempting to cancel the request upon unsubscription would be\n // pointless.\n cancel = undefined;\n callback(timestamp);\n });\n return new Subscription(() => cancel?.(handle));\n },\n requestAnimationFrame(...args) {\n const { delegate } = animationFrameProvider;\n return (delegate?.requestAnimationFrame || requestAnimationFrame)(...args);\n },\n cancelAnimationFrame(...args) {\n const { delegate } = animationFrameProvider;\n return (delegate?.cancelAnimationFrame || cancelAnimationFrame)(...args);\n },\n delegate: undefined,\n};\n", "import { Observable } from '../../Observable';\nimport { TimestampProvider } from '../../types';\nimport { performanceTimestampProvider } from '../../scheduler/performanceTimestampProvider';\nimport { animationFrameProvider } from '../../scheduler/animationFrameProvider';\n\n/**\n * An observable of animation frames\n *\n * Emits the amount of time elapsed since subscription and the timestamp on each animation frame.\n * Defaults to milliseconds provided to the requestAnimationFrame's callback. Does not end on its own.\n *\n * Every subscription will start a separate animation loop. Since animation frames are always scheduled\n * by the browser to occur directly before a repaint, scheduling more than one animation frame synchronously\n * should not be much different or have more overhead than looping over an array of events during\n * a single animation frame. However, if for some reason the developer would like to ensure the\n * execution of animation-related handlers are all executed during the same task by the engine,\n * the `share` operator can be used.\n *\n * This is useful for setting up animations with RxJS.\n *\n * ## Examples\n *\n * Tweening a div to move it on the screen\n *\n * ```ts\n * import { animationFrames, map, takeWhile, endWith } from 'rxjs';\n *\n * function tween(start: number, end: number, duration: number) {\n * const diff = end - start;\n * return animationFrames().pipe(\n * // Figure out what percentage of time has passed\n * map(({ elapsed }) => elapsed / duration),\n * // Take the vector while less than 100%\n * takeWhile(v => v < 1),\n * // Finish with 100%\n * endWith(1),\n * // Calculate the distance traveled between start and end\n * map(v => v * diff + start)\n * );\n * }\n *\n * // Setup a div for us to move around\n * const div = document.createElement('div');\n * document.body.appendChild(div);\n * div.style.position = 'absolute';\n * div.style.width = '40px';\n * div.style.height = '40px';\n * div.style.backgroundColor = 'lime';\n * div.style.transform = 'translate3d(10px, 0, 0)';\n *\n * tween(10, 200, 4000).subscribe(x => {\n * div.style.transform = `translate3d(${ x }px, 0, 0)`;\n * });\n * ```\n *\n * Providing a custom timestamp provider\n *\n * ```ts\n * import { animationFrames, TimestampProvider } from 'rxjs';\n *\n * // A custom timestamp provider\n * let now = 0;\n * const customTSProvider: TimestampProvider = {\n * now() { return now++; }\n * };\n *\n * const source$ = animationFrames(customTSProvider);\n *\n * // Log increasing numbers 0...1...2... on every animation frame.\n * source$.subscribe(({ elapsed }) => console.log(elapsed));\n * ```\n *\n * @param timestampProvider An object with a `now` method that provides a numeric timestamp\n */\nexport function animationFrames(timestampProvider?: TimestampProvider) {\n return timestampProvider ? animationFramesFactory(timestampProvider) : DEFAULT_ANIMATION_FRAMES;\n}\n\n/**\n * Does the work of creating the observable for `animationFrames`.\n * @param timestampProvider The timestamp provider to use to create the observable\n */\nfunction animationFramesFactory(timestampProvider?: TimestampProvider) {\n return new Observable<{ timestamp: number; elapsed: number }>((subscriber) => {\n // If no timestamp provider is specified, use performance.now() - as it\n // will return timestamps 'compatible' with those passed to the run\n // callback and won't be affected by NTP adjustments, etc.\n const provider = timestampProvider || performanceTimestampProvider;\n\n // Capture the start time upon subscription, as the run callback can remain\n // queued for a considerable period of time and the elapsed time should\n // represent the time elapsed since subscription - not the time since the\n // first rendered animation frame.\n const start = provider.now();\n\n let id = 0;\n const run = () => {\n if (!subscriber.closed) {\n id = animationFrameProvider.requestAnimationFrame((timestamp: DOMHighResTimeStamp | number) => {\n id = 0;\n // Use the provider's timestamp to calculate the elapsed time. Note that\n // this means - if the caller hasn't passed a provider - that\n // performance.now() will be used instead of the timestamp that was\n // passed to the run callback. The reason for this is that the timestamp\n // passed to the callback can be earlier than the start time, as it\n // represents the time at which the browser decided it would render any\n // queued frames - and that time can be earlier the captured start time.\n const now = provider.now();\n subscriber.next({\n timestamp: timestampProvider ? now : timestamp,\n elapsed: now - start,\n });\n run();\n });\n }\n };\n\n run();\n\n return () => {\n if (id) {\n animationFrameProvider.cancelAnimationFrame(id);\n }\n };\n });\n}\n\n/**\n * In the common case, where the timestamp provided by the rAF API is used,\n * we use this shared observable to reduce overhead.\n */\nconst DEFAULT_ANIMATION_FRAMES = animationFramesFactory();\n", "import { createErrorClass } from './createErrorClass';\n\nexport interface ObjectUnsubscribedError extends Error {}\n\nexport interface ObjectUnsubscribedErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new (): ObjectUnsubscribedError;\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 = createErrorClass(\n (_super) =>\n function ObjectUnsubscribedErrorImpl(this: any) {\n _super(this);\n this.name = 'ObjectUnsubscribedError';\n this.message = 'object unsubscribed';\n }\n);\n", "import { Operator } from './Operator';\nimport { Observable } from './Observable';\nimport { Subscriber } from './Subscriber';\nimport { Subscription, EMPTY_SUBSCRIPTION } from './Subscription';\nimport { Observer, SubscriptionLike, TeardownLogic } from './types';\nimport { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError';\nimport { arrRemove } from './util/arrRemove';\nimport { errorContext } from './util/errorContext';\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 */\nexport class Subject<T> extends Observable<T> implements SubscriptionLike {\n closed = false;\n\n private currentObservers: Observer<T>[] | null = null;\n\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n observers: Observer<T>[] = [];\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n isStopped = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n hasError = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n thrownError: any = null;\n\n /**\n * Creates a \"subject\" by basically gluing an observer to an observable.\n *\n * @deprecated Recommended you do not use. Will be removed at some point in the future. Plans for replacement still under discussion.\n */\n static create: (...args: any[]) => any = <T>(destination: Observer<T>, source: Observable<T>): AnonymousSubject<T> => {\n return new AnonymousSubject<T>(destination, source);\n };\n\n constructor() {\n // NOTE: This must be here to obscure Observable's constructor.\n super();\n }\n\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n lift<R>(operator: Operator<T, R>): Observable<R> {\n const subject = new AnonymousSubject(this, this);\n subject.operator = operator as any;\n return subject as any;\n }\n\n /** @internal */\n protected _throwIfClosed() {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n }\n\n next(value: T) {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n if (!this.currentObservers) {\n this.currentObservers = Array.from(this.observers);\n }\n for (const observer of this.currentObservers) {\n observer.next(value);\n }\n }\n });\n }\n\n error(err: any) {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n this.hasError = this.isStopped = true;\n this.thrownError = err;\n const { observers } = this;\n while (observers.length) {\n observers.shift()!.error(err);\n }\n }\n });\n }\n\n complete() {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n this.isStopped = true;\n const { observers } = this;\n while (observers.length) {\n observers.shift()!.complete();\n }\n }\n });\n }\n\n unsubscribe() {\n this.isStopped = this.closed = true;\n this.observers = this.currentObservers = null!;\n }\n\n get observed() {\n return this.observers?.length > 0;\n }\n\n /** @internal */\n protected _trySubscribe(subscriber: Subscriber<T>): TeardownLogic {\n this._throwIfClosed();\n return super._trySubscribe(subscriber);\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber<T>): Subscription {\n this._throwIfClosed();\n this._checkFinalizedStatuses(subscriber);\n return this._innerSubscribe(subscriber);\n }\n\n /** @internal */\n protected _innerSubscribe(subscriber: Subscriber<any>) {\n const { hasError, isStopped, observers } = this;\n if (hasError || isStopped) {\n return EMPTY_SUBSCRIPTION;\n }\n this.currentObservers = null;\n observers.push(subscriber);\n return new Subscription(() => {\n this.currentObservers = null;\n arrRemove(observers, subscriber);\n });\n }\n\n /** @internal */\n protected _checkFinalizedStatuses(subscriber: Subscriber<any>) {\n const { hasError, thrownError, isStopped } = this;\n if (hasError) {\n subscriber.error(thrownError);\n } else if (isStopped) {\n subscriber.complete();\n }\n }\n\n /**\n * Creates a new Observable with this Subject as the source. You can do this\n * to create custom Observer-side logic of the Subject and conceal it from\n * code that uses the Observable.\n * @return Observable that this Subject casts to.\n */\n asObservable(): Observable<T> {\n const observable: any = new Observable<T>();\n observable.source = this;\n return observable;\n }\n}\n\nexport class AnonymousSubject<T> extends Subject<T> {\n constructor(\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n public destination?: Observer<T>,\n source?: Observable<T>\n ) {\n super();\n this.source = source;\n }\n\n next(value: T) {\n this.destination?.next?.(value);\n }\n\n error(err: any) {\n this.destination?.error?.(err);\n }\n\n complete() {\n this.destination?.complete?.();\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber<T>): Subscription {\n return this.source?.subscribe(subscriber) ?? EMPTY_SUBSCRIPTION;\n }\n}\n", "import { Subject } from './Subject';\nimport { Subscriber } from './Subscriber';\nimport { Subscription } from './Subscription';\n\n/**\n * A variant of Subject that requires an initial value and emits its current\n * value whenever it is subscribed to.\n */\nexport class BehaviorSubject<T> extends Subject<T> {\n constructor(private _value: T) {\n super();\n }\n\n get value(): T {\n return this.getValue();\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber<T>): Subscription {\n const subscription = super._subscribe(subscriber);\n !subscription.closed && subscriber.next(this._value);\n return subscription;\n }\n\n getValue(): T {\n const { hasError, thrownError, _value } = this;\n if (hasError) {\n throw thrownError;\n }\n this._throwIfClosed();\n return _value;\n }\n\n next(value: T): void {\n super.next((this._value = value));\n }\n}\n", "import { TimestampProvider } from '../types';\n\ninterface DateTimestampProvider extends TimestampProvider {\n delegate: TimestampProvider | undefined;\n}\n\nexport const dateTimestampProvider: DateTimestampProvider = {\n now() {\n // Use the variable rather than `this` so that the function can be called\n // without being bound to the provider.\n return (dateTimestampProvider.delegate || Date).now();\n },\n delegate: undefined,\n};\n", "import { Subject } from './Subject';\nimport { TimestampProvider } from './types';\nimport { Subscriber } from './Subscriber';\nimport { Subscription } from './Subscription';\nimport { dateTimestampProvider } from './scheduler/dateTimestampProvider';\n\n/**\n * A variant of {@link Subject} that \"replays\" old values to new subscribers by emitting them when they first subscribe.\n *\n * `ReplaySubject` has an internal buffer that will store a specified number of values that it has observed. Like `Subject`,\n * `ReplaySubject` \"observes\" values by having them passed to its `next` method. When it observes a value, it will store that\n * value for a time determined by the configuration of the `ReplaySubject`, as passed to its constructor.\n *\n * When a new subscriber subscribes to the `ReplaySubject` instance, it will synchronously emit all values in its buffer in\n * a First-In-First-Out (FIFO) manner. The `ReplaySubject` will also complete, if it has observed completion; and it will\n * error if it has observed an error.\n *\n * There are two main configuration items to be concerned with:\n *\n * 1. `bufferSize` - This will determine how many items are stored in the buffer, defaults to infinite.\n * 2. `windowTime` - The amount of time to hold a value in the buffer before removing it from the buffer.\n *\n * Both configurations may exist simultaneously. So if you would like to buffer a maximum of 3 values, as long as the values\n * are less than 2 seconds old, you could do so with a `new ReplaySubject(3, 2000)`.\n *\n * ### Differences with BehaviorSubject\n *\n * `BehaviorSubject` is similar to `new ReplaySubject(1)`, with a couple of exceptions:\n *\n * 1. `BehaviorSubject` comes \"primed\" with a single value upon construction.\n * 2. `ReplaySubject` will replay values, even after observing an error, where `BehaviorSubject` will not.\n *\n * @see {@link Subject}\n * @see {@link BehaviorSubject}\n * @see {@link shareReplay}\n */\nexport class ReplaySubject<T> extends Subject<T> {\n private _buffer: (T | number)[] = [];\n private _infiniteTimeWindow = true;\n\n /**\n * @param _bufferSize The size of the buffer to replay on subscription\n * @param _windowTime The amount of time the buffered items will stay buffered\n * @param _timestampProvider An object with a `now()` method that provides the current timestamp. This is used to\n * calculate the amount of time something has been buffered.\n */\n constructor(\n private _bufferSize = Infinity,\n private _windowTime = Infinity,\n private _timestampProvider: TimestampProvider = dateTimestampProvider\n ) {\n super();\n this._infiniteTimeWindow = _windowTime === Infinity;\n this._bufferSize = Math.max(1, _bufferSize);\n this._windowTime = Math.max(1, _windowTime);\n }\n\n next(value: T): void {\n const { isStopped, _buffer, _infiniteTimeWindow, _timestampProvider, _windowTime } = this;\n if (!isStopped) {\n _buffer.push(value);\n !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);\n }\n this._trimBuffer();\n super.next(value);\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber<T>): Subscription {\n this._throwIfClosed();\n this._trimBuffer();\n\n const subscription = this._innerSubscribe(subscriber);\n\n const { _infiniteTimeWindow, _buffer } = this;\n // We use a copy here, so reentrant code does not mutate our array while we're\n // emitting it to a new subscriber.\n const copy = _buffer.slice();\n for (let i = 0; i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) {\n subscriber.next(copy[i] as T);\n }\n\n this._checkFinalizedStatuses(subscriber);\n\n return subscription;\n }\n\n private _trimBuffer() {\n const { _bufferSize, _timestampProvider, _buffer, _infiniteTimeWindow } = this;\n // If we don't have an infinite buffer size, and we're over the length,\n // use splice to truncate the old buffer values off. Note that we have to\n // double the size for instances where we're not using an infinite time window\n // because we're storing the values and the timestamps in the same array.\n const adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;\n _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);\n\n // Now, if we're not in an infinite time window, remove all values where the time is\n // older than what is allowed.\n if (!_infiniteTimeWindow) {\n const now = _timestampProvider.now();\n let last = 0;\n // Search the array for the first timestamp that isn't expired and\n // truncate the buffer up to that point.\n for (let i = 1; i < _buffer.length && (_buffer[i] as number) <= now; i += 2) {\n last = i;\n }\n last && _buffer.splice(0, last + 1);\n }\n }\n}\n", "import { Subject } from './Subject';\nimport { Subscriber } from './Subscriber';\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 */\nexport class AsyncSubject<T> extends Subject<T> {\n private _value: T | null = null;\n private _hasValue = false;\n private _isComplete = false;\n\n /** @internal */\n protected _checkFinalizedStatuses(subscriber: Subscriber<T>) {\n const { hasError, _hasValue, _value, thrownError, isStopped, _isComplete } = this;\n if (hasError) {\n subscriber.error(thrownError);\n } else if (isStopped || _isComplete) {\n _hasValue && subscriber.next(_value!);\n subscriber.complete();\n }\n }\n\n next(value: T): void {\n if (!this.isStopped) {\n this._value = value;\n this._hasValue = true;\n }\n }\n\n complete(): void {\n const { _hasValue, _value, _isComplete } = this;\n if (!_isComplete) {\n this._isComplete = true;\n _hasValue && super.next(_value!);\n super.complete();\n }\n }\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<T> extends Subscription {\n * new (scheduler: Scheduler, work: (state?: T) => void);\n * schedule(state?: T, delay: number = 0): Subscription;\n * }\n * ```\n */\nexport class Action<T> extends Subscription {\n constructor(scheduler: Scheduler, work: (this: SchedulerAction<T>, 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 state Some contextual data that the `work` function uses when called by the\n * Scheduler.\n * @param delay Time to wait before executing the work, where the time unit is implicit\n * and defined by the Scheduler.\n * @return A subscription in order to be able to unsubscribe the scheduled work.\n */\n public schedule(state?: T, delay: number = 0): Subscription {\n return this;\n }\n}\n", "import type { TimerHandle } from './timerHandle';\ntype SetIntervalFunction = (handler: () => void, timeout?: number, ...args: any[]) => TimerHandle;\ntype ClearIntervalFunction = (handle: TimerHandle) => void;\n\ninterface IntervalProvider {\n setInterval: SetIntervalFunction;\n clearInterval: ClearIntervalFunction;\n delegate:\n | {\n setInterval: SetIntervalFunction;\n clearInterval: ClearIntervalFunction;\n }\n | undefined;\n}\n\nexport const intervalProvider: IntervalProvider = {\n // When accessing the delegate, use the variable rather than `this` so that\n // the functions can be called without being bound to the provider.\n setInterval(handler: () => void, timeout?: number, ...args) {\n const { delegate } = intervalProvider;\n if (delegate?.setInterval) {\n return delegate.setInterval(handler, timeout, ...args);\n }\n return setInterval(handler, timeout, ...args);\n },\n clearInterval(handle) {\n const { delegate } = intervalProvider;\n return (delegate?.clearInterval || clearInterval)(handle as any);\n },\n delegate: undefined,\n};\n", "import { Action } from './Action';\nimport { SchedulerAction } from '../types';\nimport { Subscription } from '../Subscription';\nimport { AsyncScheduler } from './AsyncScheduler';\nimport { intervalProvider } from './intervalProvider';\nimport { arrRemove } from '../util/arrRemove';\nimport { TimerHandle } from './timerHandle';\n\nexport class AsyncAction<T> extends Action<T> {\n public id: TimerHandle | undefined;\n public state?: T;\n // @ts-ignore: Property has no initializer and is not definitely assigned\n public delay: number;\n protected pending: boolean = false;\n\n constructor(protected scheduler: AsyncScheduler, protected work: (this: SchedulerAction<T>, state?: T) => void) {\n super(scheduler, work);\n }\n\n public schedule(state?: T, delay: number = 0): Subscription {\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?: TimerHandle, delay: number = 0): TimerHandle {\n return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);\n }\n\n protected recycleAsyncId(_scheduler: AsyncScheduler, id?: TimerHandle, delay: number | null = 0): TimerHandle | undefined {\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 if (id != null) {\n intervalProvider.clearInterval(id);\n }\n\n return undefined;\n }\n\n /**\n * Immediately executes this action and the `work` it contains.\n */\n public execute(state: T, delay: number): any {\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;\n try {\n this.work(state);\n } catch (e) {\n errored = true;\n // HACK: Since code elsewhere is relying on the \"truthiness\" of the\n // return here, we can't have it return \"\" or 0 or false.\n // TODO: Clean this up when we refactor schedulers mid-version-8 or so.\n errorValue = e ? e : new Error('Scheduled action threw falsy error');\n }\n if (errored) {\n this.unsubscribe();\n return errorValue;\n }\n }\n\n unsubscribe() {\n if (!this.closed) {\n const { id, scheduler } = this;\n const { actions } = scheduler;\n\n this.work = this.state = this.scheduler = null!;\n this.pending = false;\n\n arrRemove(actions, this);\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, null);\n }\n\n this.delay = null!;\n super.unsubscribe();\n }\n }\n}\n", "let nextHandle = 1;\n// The promise needs to be created lazily otherwise it won't be patched by Zones\nlet resolved: Promise<any>;\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 if (!resolved) {\n resolved = Promise.resolve();\n }\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 type { TimerHandle } from './timerHandle';\nconst { setImmediate, clearImmediate } = Immediate;\n\ntype SetImmediateFunction = (handler: () => void, ...args: any[]) => TimerHandle;\ntype ClearImmediateFunction = (handle: TimerHandle) => void;\n\ninterface ImmediateProvider {\n setImmediate: SetImmediateFunction;\n clearImmediate: ClearImmediateFunction;\n delegate:\n | {\n setImmediate: SetImmediateFunction;\n clearImmediate: ClearImmediateFunction;\n }\n | undefined;\n}\n\nexport const immediateProvider: ImmediateProvider = {\n // When accessing the delegate, use the variable rather than `this` so that\n // the functions can be called without being bound to the provider.\n setImmediate(...args) {\n const { delegate } = immediateProvider;\n return (delegate?.setImmediate || setImmediate)(...args);\n },\n clearImmediate(handle) {\n const { delegate } = immediateProvider;\n return (delegate?.clearImmediate || clearImmediate)(handle as any);\n },\n delegate: undefined,\n};\n", "import { AsyncAction } from './AsyncAction';\nimport { AsapScheduler } from './AsapScheduler';\nimport { SchedulerAction } from '../types';\nimport { immediateProvider } from './immediateProvider';\nimport { TimerHandle } from './timerHandle';\n\nexport class AsapAction<T> extends AsyncAction<T> {\n constructor(protected scheduler: AsapScheduler, protected work: (this: SchedulerAction<T>, state?: T) => void) {\n super(scheduler, work);\n }\n\n protected requestAsyncId(scheduler: AsapScheduler, id?: TimerHandle, delay: number = 0): TimerHandle {\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 = immediateProvider.setImmediate(scheduler.flush.bind(scheduler, undefined)));\n }\n\n protected recycleAsyncId(scheduler: AsapScheduler, id?: TimerHandle, delay: number = 0): TimerHandle | undefined {\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 : this.delay > 0) {\n return super.recycleAsyncId(scheduler, id, delay);\n }\n // If the scheduler queue has no remaining actions with the same async id,\n // cancel the requested microtask and set the scheduled flag to undefined\n // so the next AsapAction will request its own.\n const { actions } = scheduler;\n if (id != null && actions[actions.length - 1]?.id !== id) {\n immediateProvider.clearImmediate(id);\n if (scheduler._scheduled === id) {\n scheduler._scheduled = undefined;\n }\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 { Action } from './scheduler/Action';\nimport { Subscription } from './Subscription';\nimport { SchedulerLike, SchedulerAction } from './types';\nimport { dateTimestampProvider } from './scheduler/dateTimestampProvider';\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 * @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}. Will be made internal in v8.\n */\nexport class Scheduler implements SchedulerLike {\n public static now: () => number = dateTimestampProvider.now;\n\n constructor(private schedulerActionCtor: typeof Action, 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 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 work A function representing a task, or some unit of work to be\n * executed by the Scheduler.\n * @param delay Time to wait before executing the work, where the time unit is\n * implicit and defined by the Scheduler itself.\n * @param state Some contextual data that the `work` function uses when called\n * by the Scheduler.\n * @return A subscription in order to be able to unsubscribe the scheduled work.\n */\n public schedule<T>(work: (this: SchedulerAction<T>, state?: T) => void, delay: number = 0, state?: T): Subscription {\n return new this.schedulerActionCtor<T>(this, work).schedule(state, delay);\n }\n}\n", "import { Scheduler } from '../Scheduler';\nimport { Action } from './Action';\nimport { AsyncAction } from './AsyncAction';\nimport { TimerHandle } from './timerHandle';\n\nexport class AsyncScheduler extends Scheduler {\n public actions: Array<AsyncAction<any>> = [];\n /**\n * A flag to indicate whether the Scheduler is currently executing a batch of\n * queued actions.\n * @internal\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 * @internal\n */\n public _scheduled: TimerHandle | undefined;\n\n constructor(SchedulerAction: typeof Action, now: () => number = Scheduler.now) {\n super(SchedulerAction, now);\n }\n\n public flush(action: AsyncAction<any>): void {\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", "import { AsyncAction } from './AsyncAction';\nimport { AsyncScheduler } from './AsyncScheduler';\n\nexport class AsapScheduler extends AsyncScheduler {\n public flush(action?: AsyncAction<any>): void {\n this._active = true;\n // The async id that effects a call to flush is stored in _scheduled.\n // Before executing an action, it's necessary to check the action's async\n // id to determine whether it's supposed to be executed in the current\n // flush.\n // Previous implementations of this method used a count to determine this,\n // but that was unsound, as actions that are unsubscribed - i.e. cancelled -\n // are removed from the actions array and that can shift actions that are\n // scheduled to be executed in a subsequent flush into positions at which\n // they are executed within the current flush.\n const flushId = this._scheduled;\n this._scheduled = undefined;\n\n const { actions } = this;\n let error: any;\n action = action || actions.shift()!;\n\n do {\n if ((error = action.execute(action.state, action.delay))) {\n break;\n }\n } while ((action = actions[0]) && action.id === flushId && actions.shift());\n\n this._active = false;\n\n if (error) {\n while ((action = actions[0]) && action.id === flushId && 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 * <span class=\"informal\">Perform task as fast as it can be performed asynchronously</span>\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 */\n\nexport const asapScheduler = new AsapScheduler(AsapAction);\n\n/**\n * @deprecated Renamed to {@link asapScheduler}. Will be removed in v8.\n */\nexport const asap = asapScheduler;\n", "import { AsyncAction } from './AsyncAction';\nimport { AsyncScheduler } from './AsyncScheduler';\n\n/**\n *\n * Async Scheduler\n *\n * <span class=\"informal\">Schedule task as if you used setTimeout(task, duration)</span>\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\nexport const asyncScheduler = new AsyncScheduler(AsyncAction);\n\n/**\n * @deprecated Renamed to {@link asyncScheduler}. Will be removed in v8.\n */\nexport const async = asyncScheduler;\n", "import { AsyncAction } from './AsyncAction';\nimport { Subscription } from '../Subscription';\nimport { QueueScheduler } from './QueueScheduler';\nimport { SchedulerAction } from '../types';\nimport { TimerHandle } from './timerHandle';\n\nexport class QueueAction<T> extends AsyncAction<T> {\n constructor(protected scheduler: QueueScheduler, protected work: (this: SchedulerAction<T>, 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 ? super.execute(state, delay) : this._execute(state, delay);\n }\n\n protected requestAsyncId(scheduler: QueueScheduler, id?: TimerHandle, delay: number = 0): TimerHandle {\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\n if ((delay != null && delay > 0) || (delay == null && this.delay > 0)) {\n return super.requestAsyncId(scheduler, id, delay);\n }\n\n // Otherwise flush the scheduler starting with this action.\n scheduler.flush(this);\n\n // HACK: In the past, this was returning `void`. However, `void` isn't a valid\n // `TimerHandle`, and generally the return value here isn't really used. So the\n // compromise is to return `0` which is both \"falsy\" and a valid `TimerHandle`,\n // as opposed to refactoring every other instanceo of `requestAsyncId`.\n return 0;\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 * <span class=\"informal\">Put every next task on a queue, instead of executing it immediately</span>\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\nexport const queueScheduler = new QueueScheduler(QueueAction);\n\n/**\n * @deprecated Renamed to {@link queueScheduler}. Will be removed in v8.\n */\nexport const queue = queueScheduler;\n", "import { AsyncAction } from './AsyncAction';\nimport { AnimationFrameScheduler } from './AnimationFrameScheduler';\nimport { SchedulerAction } from '../types';\nimport { animationFrameProvider } from './animationFrameProvider';\nimport { TimerHandle } from './timerHandle';\n\nexport class AnimationFrameAction<T> extends AsyncAction<T> {\n constructor(protected scheduler: AnimationFrameScheduler, protected work: (this: SchedulerAction<T>, state?: T) => void) {\n super(scheduler, work);\n }\n\n protected requestAsyncId(scheduler: AnimationFrameScheduler, id?: TimerHandle, delay: number = 0): TimerHandle {\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 = animationFrameProvider.requestAnimationFrame(() => scheduler.flush(undefined)));\n }\n\n protected recycleAsyncId(scheduler: AnimationFrameScheduler, id?: TimerHandle, delay: number = 0): TimerHandle | undefined {\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 : this.delay > 0) {\n return super.recycleAsyncId(scheduler, id, delay);\n }\n // If the scheduler queue has no remaining actions with the same async id,\n // cancel the requested animation frame and set the scheduled flag to\n // undefined so the next AnimationFrameAction will request its own.\n const { actions } = scheduler;\n if (id != null && id === scheduler._scheduled && actions[actions.length - 1]?.id !== id) {\n animationFrameProvider.cancelAnimationFrame(id as number);\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<any>): void {\n this._active = true;\n // The async id that effects a call to flush is stored in _scheduled.\n // Before executing an action, it's necessary to check the action's async\n // id to determine whether it's supposed to be executed in the current\n // flush.\n // Previous implementations of this method used a count to determine this,\n // but that was unsound, as actions that are unsubscribed - i.e. cancelled -\n // are removed from the actions array and that can shift actions that are\n // scheduled to be executed in a subsequent flush into positions at which\n // they are executed within the current flush.\n let flushId;\n if (action) {\n flushId = action.id;\n } else {\n flushId = this._scheduled;\n this._scheduled = undefined;\n }\n\n const { actions } = this;\n let error: any;\n action = action || actions.shift()!;\n\n do {\n if ((error = action.execute(action.state, action.delay))) {\n break;\n }\n } while ((action = actions[0]) && action.id === flushId && actions.shift());\n\n this._active = false;\n\n if (error) {\n while ((action = actions[0]) && action.id === flushId && 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 * <span class=\"informal\">Perform task when `window.requestAnimationFrame` would fire</span>\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: <div style=\"background: #0ff;\"></div>\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\nexport const animationFrameScheduler = new AnimationFrameScheduler(AnimationFrameAction);\n\n/**\n * @deprecated Renamed to {@link animationFrameScheduler}. Will be removed in v8.\n */\nexport const animationFrame = animationFrameScheduler;\n", "import { AsyncAction } from './AsyncAction';\nimport { Subscription } from '../Subscription';\nimport { AsyncScheduler } from './AsyncScheduler';\nimport { SchedulerAction } from '../types';\nimport { TimerHandle } from './timerHandle';\n\nexport class VirtualTimeScheduler extends AsyncScheduler {\n /** @deprecated Not used in VirtualTimeScheduler directly. Will be removed in v8. */\n static frameTimeFactor = 10;\n\n /**\n * The current frame for the state of the virtual scheduler instance. The difference\n * between two \"frames\" is synonymous with the passage of \"virtual time units\". So if\n * you record `scheduler.frame` to be `1`, then later, observe `scheduler.frame` to be at `11`,\n * that means `10` virtual time units have passed.\n */\n public frame: number = 0;\n\n /**\n * Used internally to examine the current virtual action index being processed.\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n */\n public index: number = -1;\n\n /**\n * This creates an instance of a `VirtualTimeScheduler`. Experts only. The signature of\n * this constructor is likely to change in the long run.\n *\n * @param schedulerActionCtor The type of Action to initialize when initializing actions during scheduling.\n * @param maxFrames The maximum number of frames to process before stopping. Used to prevent endless flush cycles.\n */\n constructor(schedulerActionCtor: typeof AsyncAction = VirtualAction as any, public maxFrames: number = Infinity) {\n super(schedulerActionCtor, () => this.frame);\n }\n\n /**\n * Prompt the Scheduler to execute all of its queued actions, therefore\n * clearing its queue.\n */\n public flush(): void {\n const { actions, maxFrames } = this;\n let error: any;\n let action: AsyncAction<any> | undefined;\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\nexport class VirtualAction<T> extends AsyncAction<T> {\n protected active: boolean = true;\n\n constructor(\n protected scheduler: VirtualTimeScheduler,\n protected work: (this: SchedulerAction<T>, state?: T) => void,\n protected index: number = (scheduler.index += 1)\n ) {\n super(scheduler, work);\n this.index = scheduler.index = index;\n }\n\n public schedule(state?: T, delay: number = 0): Subscription {\n if (Number.isFinite(delay)) {\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 } else {\n // If someone schedules something with Infinity, it'll never happen. So we\n // don't even schedule it.\n return Subscription.EMPTY;\n }\n }\n\n protected requestAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay: number = 0): TimerHandle {\n this.delay = scheduler.frame + delay;\n const { actions } = scheduler;\n actions.push(this);\n (actions as Array<VirtualAction<T>>).sort(VirtualAction.sortActions);\n return 1;\n }\n\n protected recycleAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay: number = 0): TimerHandle | undefined {\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 private static sortActions<T>(a: VirtualAction<T>, b: VirtualAction<T>) {\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 { SchedulerLike } from '../types';\n\n/**\n * A simple Observable that emits no items to the Observer and immediately\n * emits a complete notification.\n *\n * <span class=\"informal\">Just emits 'complete', and nothing else.</span>\n *\n * ![](empty.png)\n *\n * A simple Observable that only emits the complete notification. It can be used\n * for composing with other Observables, such as in a {@link mergeMap}.\n *\n * ## Examples\n *\n * Log complete notification\n *\n * ```ts\n * import { EMPTY } from 'rxjs';\n *\n * EMPTY.subscribe({\n * next: () => console.log('Next'),\n * complete: () => console.log('Complete!')\n * });\n *\n * // Outputs\n * // Complete!\n * ```\n *\n * Emit the number 7, then complete\n *\n * ```ts\n * import { EMPTY, startWith } from 'rxjs';\n *\n * const result = EMPTY.pipe(startWith(7));\n * result.subscribe(x => console.log(x));\n *\n * // Outputs\n * // 7\n * ```\n *\n * Map and flatten only odd numbers to the sequence `'a'`, `'b'`, `'c'`\n *\n * ```ts\n * import { interval, mergeMap, of, EMPTY } from 'rxjs';\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, e.g. (0, 1, 2, 3, ...)\n * // x will occur every 1000ms\n * // if x % 2 is equal to 1, print a, b, c (each on its own)\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 */\nexport const EMPTY = new Observable<never>((subscriber) => subscriber.complete());\n\n/**\n * @param scheduler A {@link SchedulerLike} to use for scheduling\n * the emission of the complete notification.\n * @deprecated Replaced with the {@link EMPTY} constant or {@link scheduled} (e.g. `scheduled([], scheduler)`). Will be removed in v8.\n */\nexport function empty(scheduler?: SchedulerLike) {\n return scheduler ? emptyScheduled(scheduler) : EMPTY;\n}\n\nfunction emptyScheduled(scheduler: SchedulerLike) {\n return new Observable<never>((subscriber) => scheduler.schedule(() => subscriber.complete()));\n}\n", "import { SchedulerLike } from '../types';\nimport { isFunction } from './isFunction';\n\nexport function isScheduler(value: any): value is SchedulerLike {\n return value && isFunction(value.schedule);\n}\n", "import { SchedulerLike } from '../types';\nimport { isFunction } from './isFunction';\nimport { isScheduler } from './isScheduler';\n\nfunction last<T>(arr: T[]): T | undefined {\n return arr[arr.length - 1];\n}\n\nexport function popResultSelector(args: any[]): ((...args: unknown[]) => unknown) | undefined {\n return isFunction(last(args)) ? args.pop() : undefined;\n}\n\nexport function popScheduler(args: any[]): SchedulerLike | undefined {\n return isScheduler(last(args)) ? args.pop() : undefined;\n}\n\nexport function popNumber(args: any[], defaultValue: number): number {\n return typeof last(args) === 'number' ? args.pop()! : defaultValue;\n}\n", "export const isArrayLike = (<T>(x: any): x is ArrayLike<T> => x && typeof x.length === 'number' && typeof x !== 'function');", "import { isFunction } from \"./isFunction\";\n\n/**\n * Tests to see if the object is \"thennable\".\n * @param value the object to test\n */\nexport function isPromise(value: any): value is PromiseLike<any> {\n return isFunction(value?.then);\n}\n", "import { InteropObservable } from '../types';\nimport { observable as Symbol_observable } from '../symbol/observable';\nimport { isFunction } from './isFunction';\n\n/** Identifies an input as being Observable (but not necessary an Rx Observable) */\nexport function isInteropObservable(input: any): input is InteropObservable<any> {\n return isFunction(input[Symbol_observable]);\n}\n", "import { isFunction } from './isFunction';\n\nexport function isAsyncIterable<T>(obj: any): obj is AsyncIterable<T> {\n return Symbol.asyncIterator && isFunction(obj?.[Symbol.asyncIterator]);\n}\n", "/**\n * Creates the TypeError to throw if an invalid object is passed to `from` or `scheduled`.\n * @param input The object that was passed.\n */\nexport function createInvalidObservableTypeError(input: any) {\n // TODO: We should create error codes that can be looked up, so this can be less verbose.\n return new TypeError(\n `You provided ${\n input !== null && typeof input === 'object' ? 'an invalid object' : `'${input}'`\n } where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`\n );\n}\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", "import { iterator as Symbol_iterator } from '../symbol/iterator';\nimport { isFunction } from './isFunction';\n\n/** Identifies an input as being an Iterable */\nexport function isIterable(input: any): input is Iterable<any> {\n return isFunction(input?.[Symbol_iterator]);\n}\n", "import { ReadableStreamLike } from '../types';\nimport { isFunction } from './isFunction';\n\nexport async function* readableStreamLikeToAsyncGenerator<T>(readableStream: ReadableStreamLike<T>): AsyncGenerator<T> {\n const reader = readableStream.getReader();\n try {\n while (true) {\n const { value, done } = await reader.read();\n if (done) {\n return;\n }\n yield value!;\n }\n } finally {\n reader.releaseLock();\n }\n}\n\nexport function isReadableStreamLike<T>(obj: any): obj is ReadableStreamLike<T> {\n // We don't want to use instanceof checks because they would return\n // false for instances from another Realm, like an <iframe>.\n return isFunction(obj?.getReader);\n}\n", "import { isArrayLike } from '../util/isArrayLike';\nimport { isPromise } from '../util/isPromise';\nimport { Observable } from '../Observable';\nimport { ObservableInput, ObservedValueOf, ReadableStreamLike } from '../types';\nimport { isInteropObservable } from '../util/isInteropObservable';\nimport { isAsyncIterable } from '../util/isAsyncIterable';\nimport { createInvalidObservableTypeError } from '../util/throwUnobservableError';\nimport { isIterable } from '../util/isIterable';\nimport { isReadableStreamLike, readableStreamLikeToAsyncGenerator } from '../util/isReadableStreamLike';\nimport { Subscriber } from '../Subscriber';\nimport { isFunction } from '../util/isFunction';\nimport { reportUnhandledError } from '../util/reportUnhandledError';\nimport { observable as Symbol_observable } from '../symbol/observable';\n\nexport function innerFrom<O extends ObservableInput<any>>(input: O): Observable<ObservedValueOf<O>>;\nexport function innerFrom<T>(input: ObservableInput<T>): Observable<T> {\n if (input instanceof Observable) {\n return input;\n }\n if (input != null) {\n if (isInteropObservable(input)) {\n return fromInteropObservable(input);\n }\n if (isArrayLike(input)) {\n return fromArrayLike(input);\n }\n if (isPromise(input)) {\n return fromPromise(input);\n }\n if (isAsyncIterable(input)) {\n return fromAsyncIterable(input);\n }\n if (isIterable(input)) {\n return fromIterable(input);\n }\n if (isReadableStreamLike(input)) {\n return fromReadableStreamLike(input);\n }\n }\n\n throw createInvalidObservableTypeError(input);\n}\n\n/**\n * Creates an RxJS Observable from an object that implements `Symbol.observable`.\n * @param obj An object that properly implements `Symbol.observable`.\n */\nexport function fromInteropObservable<T>(obj: any) {\n return new Observable((subscriber: Subscriber<T>) => {\n const obs = obj[Symbol_observable]();\n if (isFunction(obs.subscribe)) {\n return obs.subscribe(subscriber);\n }\n // Should be caught by observable subscribe function error handling.\n throw new TypeError('Provided object does not correctly implement Symbol.observable');\n });\n}\n\n/**\n * Synchronously emits the values of an array like and completes.\n * This is exported because there are creation functions and operators that need to\n * make direct use of the same logic, and there's no reason to make them run through\n * `from` conditionals because we *know* they're dealing with an array.\n * @param array The array to emit values from\n */\nexport function fromArrayLike<T>(array: ArrayLike<T>) {\n return new Observable((subscriber: Subscriber<T>) => {\n // Loop over the array and emit each value. Note two things here:\n // 1. We're making sure that the subscriber is not closed on each loop.\n // This is so we don't continue looping over a very large array after\n // something like a `take`, `takeWhile`, or other synchronous unsubscription\n // has already unsubscribed.\n // 2. In this form, reentrant code can alter that array we're looping over.\n // This is a known issue, but considered an edge case. The alternative would\n // be to copy the array before executing the loop, but this has\n // performance implications.\n for (let i = 0; i < array.length && !subscriber.closed; i++) {\n subscriber.next(array[i]);\n }\n subscriber.complete();\n });\n}\n\nexport function fromPromise<T>(promise: PromiseLike<T>) {\n return new Observable((subscriber: Subscriber<T>) => {\n promise\n .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, reportUnhandledError);\n });\n}\n\nexport function fromIterable<T>(iterable: Iterable<T>) {\n return new Observable((subscriber: Subscriber<T>) => {\n for (const value of iterable) {\n subscriber.next(value);\n if (subscriber.closed) {\n return;\n }\n }\n subscriber.complete();\n });\n}\n\nexport function fromAsyncIterable<T>(asyncIterable: AsyncIterable<T>) {\n return new Observable((subscriber: Subscriber<T>) => {\n process(asyncIterable, subscriber).catch((err) => subscriber.error(err));\n });\n}\n\nexport function fromReadableStreamLike<T>(readableStream: ReadableStreamLike<T>) {\n return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));\n}\n\nasync function process<T>(asyncIterable: AsyncIterable<T>, subscriber: Subscriber<T>) {\n for await (const value of asyncIterable) {\n subscriber.next(value);\n // A side-effect may have closed our subscriber,\n // check before the next iteration.\n if (subscriber.closed) {\n return;\n }\n }\n subscriber.complete();\n}\n", "import { Subscription } from '../Subscription';\nimport { SchedulerAction, SchedulerLike } from '../types';\n\nexport function executeSchedule(\n parentSubscription: Subscription,\n scheduler: SchedulerLike,\n work: () => void,\n delay: number,\n repeat: true\n): void;\nexport function executeSchedule(\n parentSubscription: Subscription,\n scheduler: SchedulerLike,\n work: () => void,\n delay?: number,\n repeat?: false\n): Subscription;\n\nexport function executeSchedule(\n parentSubscription: Subscription,\n scheduler: SchedulerLike,\n work: () => void,\n delay = 0,\n repeat = false\n): Subscription | void {\n const scheduleSubscription = scheduler.schedule(function (this: SchedulerAction<any>) {\n work();\n if (repeat) {\n parentSubscription.add(this.schedule(null, delay));\n } else {\n this.unsubscribe();\n }\n }, delay);\n\n parentSubscription.add(scheduleSubscription);\n\n if (!repeat) {\n // Because user-land scheduler implementations are unlikely to properly reuse\n // Actions for repeat scheduling, we can't trust that the returned subscription\n // will control repeat subscription scenarios. So we're trying to avoid using them\n // incorrectly within this library.\n return scheduleSubscription;\n }\n}\n", "/** @prettier */\nimport { MonoTypeOperatorFunction, SchedulerLike } from '../types';\nimport { executeSchedule } from '../util/executeSchedule';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Re-emits all notifications from source Observable with specified scheduler.\n *\n * <span class=\"informal\">Ensure a specific scheduler is used, from outside of an Observable.</span>\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 *\n * Ensure values in subscribe are called just before browser repaint\n *\n * ```ts\n * import { interval, observeOn, animationFrameScheduler } from 'rxjs';\n *\n * const someDiv = document.createElement('div');\n * someDiv.style.cssText = 'width: 200px;background: #09c';\n * document.body.appendChild(someDiv);\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 scheduler Scheduler that will be used to reschedule notifications from source Observable.\n * @param delay Number of milliseconds that states with what delay every notification should be rescheduled.\n * @return A function that returns an Observable that emits the same\n * notifications as the source Observable, but with provided scheduler.\n */\nexport function observeOn<T>(scheduler: SchedulerLike, delay = 0): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => executeSchedule(subscriber, scheduler, () => subscriber.next(value), delay),\n () => executeSchedule(subscriber, scheduler, () => subscriber.complete(), delay),\n (err) => executeSchedule(subscriber, scheduler, () => subscriber.error(err), delay)\n )\n );\n });\n}\n", "import { MonoTypeOperatorFunction, SchedulerLike } from '../types';\nimport { operate } from '../util/lift';\n\n/**\n * Asynchronously subscribes Observers to this Observable on the specified {@link SchedulerLike}.\n *\n * With `subscribeOn` you can decide what type of scheduler a specific Observable will be using when it is subscribed to.\n *\n * Schedulers control the speed and order of emissions to observers from an Observable stream.\n *\n * ![](subscribeOn.png)\n *\n * ## Example\n *\n * Given the following code:\n *\n * ```ts\n * import { of, merge } from 'rxjs';\n *\n * const a = of(1, 2, 3);\n * const b = of(4, 5, 6);\n *\n * merge(a, b).subscribe(console.log);\n *\n * // Outputs\n * // 1\n * // 2\n * // 3\n * // 4\n * // 5\n * // 6\n * ```\n *\n * Both Observable `a` and `b` will emit their values directly and synchronously once they are subscribed to.\n *\n * If we instead use the `subscribeOn` operator declaring that we want to use the {@link asyncScheduler} for values emitted by Observable `a`:\n *\n * ```ts\n * import { of, subscribeOn, asyncScheduler, merge } from 'rxjs';\n *\n * const a = of(1, 2, 3).pipe(subscribeOn(asyncScheduler));\n * const b = of(4, 5, 6);\n *\n * merge(a, b).subscribe(console.log);\n *\n * // Outputs\n * // 4\n * // 5\n * // 6\n * // 1\n * // 2\n * // 3\n * ```\n *\n * The reason for this is that Observable `b` emits its values directly and synchronously like before\n * but the emissions from `a` are scheduled on the event loop because we are now using the {@link asyncScheduler} for that specific Observable.\n *\n * @param scheduler The {@link SchedulerLike} to perform subscription actions on.\n * @param delay A delay to pass to the scheduler to delay subscriptions\n * @return A function that returns an Observable modified so that its\n * subscriptions happen on the specified {@link SchedulerLike}.\n */\nexport function subscribeOn<T>(scheduler: SchedulerLike, delay: number = 0): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n subscriber.add(scheduler.schedule(() => source.subscribe(subscriber), delay));\n });\n}\n", "import { innerFrom } from '../observable/innerFrom';\nimport { observeOn } from '../operators/observeOn';\nimport { subscribeOn } from '../operators/subscribeOn';\nimport { InteropObservable, SchedulerLike } from '../types';\n\nexport function scheduleObservable<T>(input: InteropObservable<T>, scheduler: SchedulerLike) {\n return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));\n}\n", "import { innerFrom } from '../observable/innerFrom';\nimport { observeOn } from '../operators/observeOn';\nimport { subscribeOn } from '../operators/subscribeOn';\nimport { SchedulerLike } from '../types';\n\nexport function schedulePromise<T>(input: PromiseLike<T>, scheduler: SchedulerLike) {\n return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));\n}\n", "import { Observable } from '../Observable';\nimport { SchedulerLike } from '../types';\n\nexport function scheduleArray<T>(input: ArrayLike<T>, scheduler: SchedulerLike) {\n return new Observable<T>((subscriber) => {\n // The current array index.\n let i = 0;\n // Start iterating over the array like on a schedule.\n return scheduler.schedule(function () {\n if (i === input.length) {\n // If we have hit the end of the array like in the\n // previous job, we can complete.\n subscriber.complete();\n } else {\n // Otherwise let's next the value at the current index,\n // then increment our index.\n subscriber.next(input[i++]);\n // If the last emission didn't cause us to close the subscriber\n // (via take or some side effect), reschedule the job and we'll\n // make another pass.\n if (!subscriber.closed) {\n this.schedule();\n }\n }\n });\n });\n}\n", "import { Observable } from '../Observable';\nimport { SchedulerLike } from '../types';\nimport { iterator as Symbol_iterator } from '../symbol/iterator';\nimport { isFunction } from '../util/isFunction';\nimport { executeSchedule } from '../util/executeSchedule';\n\n/**\n * Used in {@link scheduled} to create an observable from an Iterable.\n * @param input The iterable to create an observable from\n * @param scheduler The scheduler to use\n */\nexport function scheduleIterable<T>(input: Iterable<T>, scheduler: SchedulerLike) {\n return new Observable<T>((subscriber) => {\n let iterator: Iterator<T, T>;\n\n // Schedule the initial creation of the iterator from\n // the iterable. This is so the code in the iterable is\n // not called until the scheduled job fires.\n executeSchedule(subscriber, scheduler, () => {\n // Create the iterator.\n iterator = (input as any)[Symbol_iterator]();\n\n executeSchedule(\n subscriber,\n scheduler,\n () => {\n let value: T;\n let done: boolean | undefined;\n try {\n // Pull the value out of the iterator\n ({ value, done } = iterator.next());\n } catch (err) {\n // We got an error while pulling from the iterator\n subscriber.error(err);\n return;\n }\n\n if (done) {\n // If it is \"done\" we just complete. This mimics the\n // behavior of JavaScript's `for..of` consumption of\n // iterables, which will not emit the value from an iterator\n // result of `{ done: true: value: 'here' }`.\n subscriber.complete();\n } else {\n // The iterable is not done, emit the value.\n subscriber.next(value);\n }\n },\n 0,\n true\n );\n });\n\n // During finalization, if we see this iterator has a `return` method,\n // then we know it is a Generator, and not just an Iterator. So we call\n // the `return()` function. This will ensure that any `finally { }` blocks\n // inside of the generator we can hit will be hit properly.\n return () => isFunction(iterator?.return) && iterator.return();\n });\n}\n", "import { SchedulerLike } from '../types';\nimport { Observable } from '../Observable';\nimport { executeSchedule } from '../util/executeSchedule';\n\nexport function scheduleAsyncIterable<T>(input: AsyncIterable<T>, scheduler: SchedulerLike) {\n if (!input) {\n throw new Error('Iterable cannot be null');\n }\n return new Observable<T>((subscriber) => {\n executeSchedule(subscriber, scheduler, () => {\n const iterator = input[Symbol.asyncIterator]();\n executeSchedule(\n subscriber,\n scheduler,\n () => {\n iterator.next().then((result) => {\n if (result.done) {\n // This will remove the subscriptions from\n // the parent subscription.\n subscriber.complete();\n } else {\n subscriber.next(result.value);\n }\n });\n },\n 0,\n true\n );\n });\n });\n}\n", "import { SchedulerLike, ReadableStreamLike } from '../types';\nimport { Observable } from '../Observable';\nimport { scheduleAsyncIterable } from './scheduleAsyncIterable';\nimport { readableStreamLikeToAsyncGenerator } from '../util/isReadableStreamLike';\n\nexport function scheduleReadableStreamLike<T>(input: ReadableStreamLike<T>, scheduler: SchedulerLike): Observable<T> {\n return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);\n}\n", "import { scheduleObservable } from './scheduleObservable';\nimport { schedulePromise } from './schedulePromise';\nimport { scheduleArray } from './scheduleArray';\nimport { scheduleIterable } from './scheduleIterable';\nimport { scheduleAsyncIterable } from './scheduleAsyncIterable';\nimport { isInteropObservable } from '../util/isInteropObservable';\nimport { isPromise } from '../util/isPromise';\nimport { isArrayLike } from '../util/isArrayLike';\nimport { isIterable } from '../util/isIterable';\nimport { ObservableInput, SchedulerLike } from '../types';\nimport { Observable } from '../Observable';\nimport { isAsyncIterable } from '../util/isAsyncIterable';\nimport { createInvalidObservableTypeError } from '../util/throwUnobservableError';\nimport { isReadableStreamLike } from '../util/isReadableStreamLike';\nimport { scheduleReadableStreamLike } from './scheduleReadableStreamLike';\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 {@link from}\n * @see {@link 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<T>(input: ObservableInput<T>, scheduler: SchedulerLike): Observable<T> {\n if (input != null) {\n if (isInteropObservable(input)) {\n return scheduleObservable(input, scheduler);\n }\n if (isArrayLike(input)) {\n return scheduleArray(input, scheduler);\n }\n if (isPromise(input)) {\n return schedulePromise(input, scheduler);\n }\n if (isAsyncIterable(input)) {\n return scheduleAsyncIterable(input, scheduler);\n }\n if (isIterable(input)) {\n return scheduleIterable(input, scheduler);\n }\n if (isReadableStreamLike(input)) {\n return scheduleReadableStreamLike(input, scheduler);\n }\n }\n throw createInvalidObservableTypeError(input);\n}\n", "import { Observable } from '../Observable';\nimport { ObservableInput, SchedulerLike, ObservedValueOf } from '../types';\nimport { scheduled } from '../scheduled/scheduled';\nimport { innerFrom } from './innerFrom';\n\nexport function from<O extends ObservableInput<any>>(input: O): Observable<ObservedValueOf<O>>;\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function from<O extends ObservableInput<any>>(input: O, scheduler: SchedulerLike | undefined): Observable<ObservedValueOf<O>>;\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 * <span class=\"informal\">Converts almost anything to an Observable.</span>\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 * <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterable\" target=\"_blank\">iterable</a>\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 * Convert an infinite iterable (from a generator) to an Observable\n *\n * ```ts\n * import { from, take } from 'rxjs';\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 * With `asyncScheduler`\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 input A subscription object, a Promise, an Observable-like,\n * an Array, an iterable, or an array-like object to be converted.\n * @param scheduler An optional {@link SchedulerLike} on which to schedule the emission of values.\n * @return An Observable converted from {@link ObservableInput}.\n */\nexport function from<T>(input: ObservableInput<T>, scheduler?: SchedulerLike): Observable<T> {\n return scheduler ? scheduled(input, scheduler) : innerFrom(input);\n}\n", "import { SchedulerLike, ValueFromArray } from '../types';\nimport { Observable } from '../Observable';\nimport { popScheduler } from '../util/args';\nimport { from } from './from';\n\n// Devs are more likely to pass null or undefined than they are a scheduler\n// without accompanying values. To make things easier for (naughty) devs who\n// use the `strictNullChecks: false` TypeScript compiler option, these\n// overloads with explicit null and undefined values are included.\n\nexport function of(value: null): Observable<null>;\nexport function of(value: undefined): Observable<undefined>;\n\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function of(scheduler: SchedulerLike): Observable<never>;\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function of<A extends readonly unknown[]>(...valuesAndScheduler: [...A, SchedulerLike]): Observable<ValueFromArray<A>>;\n\nexport function of(): Observable<never>;\n/** @deprecated Do not specify explicit type parameters. Signatures with type parameters that cannot be inferred will be removed in v8. */\nexport function of<T>(): Observable<T>;\nexport function of<T>(value: T): Observable<T>;\nexport function of<A extends readonly unknown[]>(...values: A): Observable<ValueFromArray<A>>;\n\n/**\n * Converts the arguments to an observable sequence.\n *\n * <span class=\"informal\">Each argument becomes a `next` notification.</span>\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: value => console.log('next:', value),\n * error: err => console.log('error:', err),\n * complete: () => console.log('the end'),\n * });\n *\n * // Outputs\n * // next: 10\n * // next: 20\n * // next: 30\n * // the end\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: value => console.log('next:', value),\n * error: err => console.log('error:', err),\n * complete: () => console.log('the end'),\n * });\n *\n * // Outputs\n * // next: [1, 2, 3]\n * // the end\n * ```\n *\n * @see {@link from}\n * @see {@link range}\n *\n * @param args A comma separated list of arguments you want to be emitted.\n * @return An Observable that synchronously emits the arguments described\n * above and then immediately completes.\n */\nexport function of<T>(...args: Array<T | SchedulerLike>): Observable<T> {\n const scheduler = popScheduler(args);\n return from(args as T[], scheduler);\n}\n", "import { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { SchedulerLike } from '../types';\nimport { isFunction } from '../util/isFunction';\n\n/**\n * Creates an observable that will create an error instance and push it to the consumer as an error\n * immediately upon subscription.\n *\n * <span class=\"informal\">Just errors and does nothing else</span>\n *\n * ![](throw.png)\n *\n * This creation function is useful for creating an observable that will create an error and error every\n * time it is subscribed to. Generally, inside of most operators when you might want to return an errored\n * observable, this is unnecessary. In most cases, such as in the inner return of {@link concatMap},\n * {@link mergeMap}, {@link defer}, and many others, you can simply throw the error, and RxJS will pick\n * that up and notify the consumer of the error.\n *\n * ## Example\n *\n * Create a simple observable that will create a new error with a timestamp and log it\n * and the message every time you subscribe to it\n *\n * ```ts\n * import { throwError } from 'rxjs';\n *\n * let errorCount = 0;\n *\n * const errorWithTimestamp$ = throwError(() => {\n * const error: any = new Error(`This is error number ${ ++errorCount }`);\n * error.timestamp = Date.now();\n * return error;\n * });\n *\n * errorWithTimestamp$.subscribe({\n * error: err => console.log(err.timestamp, err.message)\n * });\n *\n * errorWithTimestamp$.subscribe({\n * error: err => console.log(err.timestamp, err.message)\n * });\n *\n * // Logs the timestamp and a new error message for each subscription\n * ```\n *\n * ### Unnecessary usage\n *\n * Using `throwError` inside of an operator or creation function\n * with a callback, is usually not necessary\n *\n * ```ts\n * import { of, concatMap, timer, throwError } from 'rxjs';\n *\n * const delays$ = of(1000, 2000, Infinity, 3000);\n *\n * delays$.pipe(\n * concatMap(ms => {\n * if (ms < 10000) {\n * return timer(ms);\n * } else {\n * // This is probably overkill.\n * return throwError(() => new Error(`Invalid time ${ ms }`));\n * }\n * })\n * )\n * .subscribe({\n * next: console.log,\n * error: console.error\n * });\n * ```\n *\n * You can just throw the error instead\n *\n * ```ts\n * import { of, concatMap, timer } from 'rxjs';\n *\n * const delays$ = of(1000, 2000, Infinity, 3000);\n *\n * delays$.pipe(\n * concatMap(ms => {\n * if (ms < 10000) {\n * return timer(ms);\n * } else {\n * // Cleaner and easier to read for most folks.\n * throw new Error(`Invalid time ${ ms }`);\n * }\n * })\n * )\n * .subscribe({\n * next: console.log,\n * error: console.error\n * });\n * ```\n *\n * @param errorFactory A factory function that will create the error instance that is pushed.\n */\nexport function throwError(errorFactory: () => any): Observable<never>;\n\n/**\n * Returns an observable that will error with the specified error immediately upon subscription.\n *\n * @param error The error instance to emit\n * @deprecated Support for passing an error value will be removed in v8. Instead, pass a factory function to `throwError(() => new Error('test'))`. This is\n * because it will create the error at the moment it should be created and capture a more appropriate stack trace. If\n * for some reason you need to create the error ahead of time, you can still do that: `const err = new Error('test'); throwError(() => err);`.\n */\nexport function throwError(error: any): Observable<never>;\n\n/**\n * Notifies the consumer of an error using a given scheduler by scheduling it at delay `0` upon subscription.\n *\n * @param errorOrErrorFactory An error instance or error factory\n * @param scheduler A scheduler to use to schedule the error notification\n * @deprecated The `scheduler` parameter will be removed in v8.\n * Use `throwError` in combination with {@link observeOn}: `throwError(() => new Error('test')).pipe(observeOn(scheduler));`.\n * Details: https://rxjs.dev/deprecations/scheduler-argument\n */\nexport function throwError(errorOrErrorFactory: any, scheduler: SchedulerLike): Observable<never>;\n\nexport function throwError(errorOrErrorFactory: any, scheduler?: SchedulerLike): Observable<never> {\n const errorFactory = isFunction(errorOrErrorFactory) ? errorOrErrorFactory : () => errorOrErrorFactory;\n const init = (subscriber: Subscriber<never>) => subscriber.error(errorFactory());\n return new Observable(scheduler ? (subscriber) => scheduler.schedule(init as any, 0, subscriber) : init);\n}\n", "import { PartialObserver, ObservableNotification, CompleteNotification, NextNotification, ErrorNotification } from './types';\nimport { Observable } from './Observable';\nimport { EMPTY } from './observable/empty';\nimport { of } from './observable/of';\nimport { throwError } from './observable/throwError';\nimport { isFunction } from './util/isFunction';\n\n// TODO: When this enum is removed, replace it with a type alias. See #4556.\n/**\n * @deprecated Use a string literal instead. `NotificationKind` will be replaced with a type alias in v8.\n * It will not be replaced with a const enum as those are not compatible with isolated modules.\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 * @deprecated It is NOT recommended to create instances of `Notification` directly.\n * Rather, try to create POJOs matching the signature outlined in {@link ObservableNotification}.\n * For example: `{ kind: 'N', value: 1 }`, `{ kind: 'E', error: new Error('bad') }`, or `{ kind: 'C' }`.\n * Will be removed in v8.\n */\nexport class Notification<T> {\n /**\n * A value signifying that the notification will \"next\" if observed. In truth,\n * This is really synonymous with just checking `kind === \"N\"`.\n * @deprecated Will be removed in v8. Instead, just check to see if the value of `kind` is `\"N\"`.\n */\n readonly hasValue: boolean;\n\n /**\n * Creates a \"Next\" notification object.\n * @param kind Always `'N'`\n * @param value The value to notify with if observed.\n * @deprecated Internal implementation detail. Use {@link Notification#createNext createNext} instead.\n */\n constructor(kind: 'N', value?: T);\n /**\n * Creates an \"Error\" notification object.\n * @param kind Always `'E'`\n * @param value Always `undefined`\n * @param error The error to notify with if observed.\n * @deprecated Internal implementation detail. Use {@link Notification#createError createError} instead.\n */\n constructor(kind: 'E', value: undefined, error: any);\n /**\n * Creates a \"completion\" notification object.\n * @param kind Always `'C'`\n * @deprecated Internal implementation detail. Use {@link Notification#createComplete createComplete} instead.\n */\n constructor(kind: 'C');\n constructor(public readonly kind: 'N' | 'E' | 'C', public readonly value?: T, public readonly error?: any) {\n this.hasValue = kind === 'N';\n }\n\n /**\n * Executes the appropriate handler on a passed `observer` given the `kind` of notification.\n * If the handler is missing it will do nothing. Even if the notification is an error, if\n * there is no error handler on the observer, an error will not be thrown, it will noop.\n * @param observer The observer to notify.\n */\n observe(observer: PartialObserver<T>): void {\n return observeNotification(this as ObservableNotification<T>, observer);\n }\n\n /**\n * Executes a notification on the appropriate handler from a list provided.\n * If a handler is missing for the kind of notification, nothing is called\n * and no error is thrown, it will be a noop.\n * @param next A next handler\n * @param error An error handler\n * @param complete A complete handler\n * @deprecated Replaced with {@link Notification#observe observe}. Will be removed in v8.\n */\n do(next: (value: T) => void, error: (err: any) => void, complete: () => void): void;\n /**\n * Executes a notification on the appropriate handler from a list provided.\n * If a handler is missing for the kind of notification, nothing is called\n * and no error is thrown, it will be a noop.\n * @param next A next handler\n * @param error An error handler\n * @deprecated Replaced with {@link Notification#observe observe}. Will be removed in v8.\n */\n do(next: (value: T) => void, error: (err: any) => void): void;\n /**\n * Executes the next handler if the Notification is of `kind` `\"N\"`. Otherwise\n * this will not error, and it will be a noop.\n * @param next The next handler\n * @deprecated Replaced with {@link Notification#observe observe}. Will be removed in v8.\n */\n do(next: (value: T) => void): void;\n do(nextHandler: (value: T) => void, errorHandler?: (err: any) => void, completeHandler?: () => void): void {\n const { kind, value, error } = this;\n return kind === 'N' ? nextHandler?.(value!) : kind === 'E' ? errorHandler?.(error) : completeHandler?.();\n }\n\n /**\n * Executes a notification on the appropriate handler from a list provided.\n * If a handler is missing for the kind of notification, nothing is called\n * and no error is thrown, it will be a noop.\n * @param next A next handler\n * @param error An error handler\n * @param complete A complete handler\n * @deprecated Replaced with {@link Notification#observe observe}. Will be removed in v8.\n */\n accept(next: (value: T) => void, error: (err: any) => void, complete: () => void): void;\n /**\n * Executes a notification on the appropriate handler from a list provided.\n * If a handler is missing for the kind of notification, nothing is called\n * and no error is thrown, it will be a noop.\n * @param next A next handler\n * @param error An error handler\n * @deprecated Replaced with {@link Notification#observe observe}. Will be removed in v8.\n */\n accept(next: (value: T) => void, error: (err: any) => void): void;\n /**\n * Executes the next handler if the Notification is of `kind` `\"N\"`. Otherwise\n * this will not error, and it will be a noop.\n * @param next The next handler\n * @deprecated Replaced with {@link Notification#observe observe}. Will be removed in v8.\n */\n accept(next: (value: T) => void): void;\n\n /**\n * Executes the appropriate handler on a passed `observer` given the `kind` of notification.\n * If the handler is missing it will do nothing. Even if the notification is an error, if\n * there is no error handler on the observer, an error will not be thrown, it will noop.\n * @param observer The observer to notify.\n * @deprecated Replaced with {@link Notification#observe observe}. Will be removed in v8.\n */\n accept(observer: PartialObserver<T>): void;\n accept(nextOrObserver: PartialObserver<T> | ((value: T) => void), error?: (err: any) => void, complete?: () => void) {\n return isFunction((nextOrObserver as any)?.next)\n ? this.observe(nextOrObserver as PartialObserver<T>)\n : this.do(nextOrObserver as (value: T) => void, error as any, complete as any);\n }\n\n /**\n * Returns a simple Observable that just delivers the notification represented\n * by this Notification instance.\n *\n * @deprecated Will be removed in v8. To convert a `Notification` to an {@link Observable},\n * use {@link of} and {@link dematerialize}: `of(notification).pipe(dematerialize())`.\n */\n toObservable(): Observable<T> {\n const { kind, value, error } = this;\n // Select the observable to return by `kind`\n const result =\n kind === 'N'\n ? // Next kind. Return an observable of that value.\n of(value!)\n : //\n kind === 'E'\n ? // Error kind. Return an observable that emits the error.\n throwError(() => error)\n : //\n kind === 'C'\n ? // Completion kind. Kind is \"C\", return an observable that just completes.\n EMPTY\n : // Unknown kind, return falsy, so we error below.\n 0;\n if (!result) {\n // TODO: consider removing this check. The only way to cause this would be to\n // use the Notification constructor directly in a way that is not type-safe.\n // and direct use of the Notification constructor is deprecated.\n throw new TypeError(`Unexpected notification kind ${kind}`);\n }\n return result;\n }\n\n private static completeNotification = new Notification('C') as Notification<never> & CompleteNotification;\n /**\n * A shortcut to create a Notification instance of the type `next` from a\n * given value.\n * @param value The `next` value.\n * @return The \"next\" Notification representing the argument.\n * @deprecated It is NOT recommended to create instances of `Notification` directly.\n * Rather, try to create POJOs matching the signature outlined in {@link ObservableNotification}.\n * For example: `{ kind: 'N', value: 1 }`, `{ kind: 'E', error: new Error('bad') }`, or `{ kind: 'C' }`.\n * Will be removed in v8.\n */\n static createNext<T>(value: T) {\n return new Notification('N', value) as Notification<T> & NextNotification<T>;\n }\n\n /**\n * A shortcut to create a Notification instance of the type `error` from a\n * given error.\n * @param err The `error` error.\n * @return The \"error\" Notification representing the argument.\n * @deprecated It is NOT recommended to create instances of `Notification` directly.\n * Rather, try to create POJOs matching the signature outlined in {@link ObservableNotification}.\n * For example: `{ kind: 'N', value: 1 }`, `{ kind: 'E', error: new Error('bad') }`, or `{ kind: 'C' }`.\n * Will be removed in v8.\n */\n static createError(err?: any) {\n return new Notification('E', undefined, err) as Notification<never> & ErrorNotification;\n }\n\n /**\n * A shortcut to create a Notification instance of the type `complete`.\n * @return The valueless \"complete\" Notification.\n * @deprecated It is NOT recommended to create instances of `Notification` directly.\n * Rather, try to create POJOs matching the signature outlined in {@link ObservableNotification}.\n * For example: `{ kind: 'N', value: 1 }`, `{ kind: 'E', error: new Error('bad') }`, or `{ kind: 'C' }`.\n * Will be removed in v8.\n */\n static createComplete(): Notification<never> & CompleteNotification {\n return Notification.completeNotification;\n }\n}\n\n/**\n * Executes the appropriate handler on a passed `observer` given the `kind` of notification.\n * If the handler is missing it will do nothing. Even if the notification is an error, if\n * there is no error handler on the observer, an error will not be thrown, it will noop.\n * @param notification The notification object to observe.\n * @param observer The observer to notify.\n */\nexport function observeNotification<T>(notification: ObservableNotification<T>, observer: PartialObserver<T>) {\n const { kind, value, error } = notification as any;\n if (typeof kind !== 'string') {\n throw new TypeError('Invalid notification, missing \"kind\"');\n }\n kind === 'N' ? observer.next?.(value!) : kind === 'E' ? observer.error?.(error) : observer.complete?.();\n}\n", "/** prettier */\nimport { Observable } from '../Observable';\nimport { isFunction } from './isFunction';\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<unknown> {\n // The !! is to ensure that this publicly exposed function returns\n // `false` if something like `null` or `0` is passed.\n return !!obj && (obj instanceof Observable || (isFunction(obj.lift) && isFunction(obj.subscribe)));\n}\n", "import { createErrorClass } from './createErrorClass';\n\nexport interface EmptyError extends Error {}\n\nexport interface EmptyErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new (): EmptyError;\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 * @see {@link firstValueFrom}\n * @see {@link lastValueFrom}\n */\nexport const EmptyError: EmptyErrorCtor = createErrorClass(\n (_super) =>\n function EmptyErrorImpl(this: any) {\n _super(this);\n this.name = 'EmptyError';\n this.message = 'no elements in sequence';\n }\n);\n", "import { Observable } from './Observable';\nimport { EmptyError } from './util/EmptyError';\n\nexport interface LastValueFromConfig<T> {\n defaultValue: T;\n}\n\nexport function lastValueFrom<T, D>(source: Observable<T>, config: LastValueFromConfig<D>): Promise<T | D>;\nexport function lastValueFrom<T>(source: Observable<T>): Promise<T>;\n\n/**\n * Converts an observable to a promise by subscribing to the observable,\n * waiting for it to complete, and resolving the returned promise with the\n * last value from the observed stream.\n *\n * If the observable stream completes before any values were emitted, the\n * returned promise will reject with {@link EmptyError} or will resolve\n * with the default value if a default was specified.\n *\n * If the observable stream emits an error, the returned promise will reject\n * with that error.\n *\n * **WARNING**: Only use this with observables you *know* will complete. If the source\n * observable does not complete, you will end up with a promise that is hung up, and\n * potentially all of the state of an async function hanging out in memory. To avoid\n * this situation, look into adding something like {@link timeout}, {@link take},\n * {@link takeWhile}, or {@link takeUntil} amongst others.\n *\n * ## Example\n *\n * Wait for the last value from a stream and emit it from a promise in\n * an async function\n *\n * ```ts\n * import { interval, take, lastValueFrom } from 'rxjs';\n *\n * async function execute() {\n * const source$ = interval(2000).pipe(take(10));\n * const finalNumber = await lastValueFrom(source$);\n * console.log(`The final number is ${ finalNumber }`);\n * }\n *\n * execute();\n *\n * // Expected output:\n * // 'The final number is 9'\n * ```\n *\n * @see {@link firstValueFrom}\n *\n * @param source the observable to convert to a promise\n * @param config a configuration object to define the `defaultValue` to use if the source completes without emitting a value\n */\nexport function lastValueFrom<T, D>(source: Observable<T>, config?: LastValueFromConfig<D>): Promise<T | D> {\n const hasConfig = typeof config === 'object';\n return new Promise<T | D>((resolve, reject) => {\n let _hasValue = false;\n let _value: T;\n source.subscribe({\n next: (value) => {\n _value = value;\n _hasValue = true;\n },\n error: reject,\n complete: () => {\n if (_hasValue) {\n resolve(_value);\n } else if (hasConfig) {\n resolve(config!.defaultValue);\n } else {\n reject(new EmptyError());\n }\n },\n });\n });\n}\n", "import { Observable } from './Observable';\nimport { EmptyError } from './util/EmptyError';\nimport { SafeSubscriber } from './Subscriber';\n\nexport interface FirstValueFromConfig<T> {\n defaultValue: T;\n}\n\nexport function firstValueFrom<T, D>(source: Observable<T>, config: FirstValueFromConfig<D>): Promise<T | D>;\nexport function firstValueFrom<T>(source: Observable<T>): Promise<T>;\n\n/**\n * Converts an observable to a promise by subscribing to the observable,\n * and returning a promise that will resolve as soon as the first value\n * arrives from the observable. The subscription will then be closed.\n *\n * If the observable stream completes before any values were emitted, the\n * returned promise will reject with {@link EmptyError} or will resolve\n * with the default value if a default was specified.\n *\n * If the observable stream emits an error, the returned promise will reject\n * with that error.\n *\n * **WARNING**: Only use this with observables you *know* will emit at least one value,\n * *OR* complete. If the source observable does not emit one value or complete, you will\n * end up with a promise that is hung up, and potentially all of the state of an\n * async function hanging out in memory. To avoid this situation, look into adding\n * something like {@link timeout}, {@link take}, {@link takeWhile}, or {@link takeUntil}\n * amongst others.\n *\n * ## Example\n *\n * Wait for the first value from a stream and emit it from a promise in\n * an async function\n *\n * ```ts\n * import { interval, firstValueFrom } from 'rxjs';\n *\n * async function execute() {\n * const source$ = interval(2000);\n * const firstNumber = await firstValueFrom(source$);\n * console.log(`The first number is ${ firstNumber }`);\n * }\n *\n * execute();\n *\n * // Expected output:\n * // 'The first number is 0'\n * ```\n *\n * @see {@link lastValueFrom}\n *\n * @param source the observable to convert to a promise\n * @param config a configuration object to define the `defaultValue` to use if the source completes without emitting a value\n */\nexport function firstValueFrom<T, D>(source: Observable<T>, config?: FirstValueFromConfig<D>): Promise<T | D> {\n const hasConfig = typeof config === 'object';\n return new Promise<T | D>((resolve, reject) => {\n const subscriber = new SafeSubscriber<T>({\n next: (value) => {\n resolve(value);\n subscriber.unsubscribe();\n },\n error: reject,\n complete: () => {\n if (hasConfig) {\n resolve(config!.defaultValue);\n } else {\n reject(new EmptyError());\n }\n },\n });\n source.subscribe(subscriber);\n });\n}\n", "import { createErrorClass } from './createErrorClass';\n\nexport interface ArgumentOutOfRangeError extends Error {}\n\nexport interface ArgumentOutOfRangeErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new (): ArgumentOutOfRangeError;\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 */\nexport const ArgumentOutOfRangeError: ArgumentOutOfRangeErrorCtor = createErrorClass(\n (_super) =>\n function ArgumentOutOfRangeErrorImpl(this: any) {\n _super(this);\n this.name = 'ArgumentOutOfRangeError';\n this.message = 'argument out of range';\n }\n);\n", "import { createErrorClass } from './createErrorClass';\n\nexport interface NotFoundError extends Error {}\n\nexport interface NotFoundErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new (message: string): NotFoundError;\n}\n\n/**\n * An error thrown when a value or values are missing from an\n * observable sequence.\n *\n * @see {@link operators/single}\n */\nexport const NotFoundError: NotFoundErrorCtor = createErrorClass(\n (_super) =>\n function NotFoundErrorImpl(this: any, message: string) {\n _super(this);\n this.name = 'NotFoundError';\n this.message = message;\n }\n);\n", "import { createErrorClass } from './createErrorClass';\n\nexport interface SequenceError extends Error {}\n\nexport interface SequenceErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new (message: string): SequenceError;\n}\n\n/**\n * An error thrown when something is wrong with the sequence of\n * values arriving on the observable.\n *\n * @see {@link operators/single}\n */\nexport const SequenceError: SequenceErrorCtor = createErrorClass(\n (_super) =>\n function SequenceErrorImpl(this: any, message: string) {\n _super(this);\n this.name = 'SequenceError';\n this.message = message;\n }\n);\n", "/**\n * Checks to see if a value is not only a `Date` object,\n * but a *valid* `Date` object that can be converted to a\n * number. For example, `new Date('blah')` is indeed an\n * `instanceof Date`, however it cannot be converted to a\n * number.\n */\nexport function isValidDate(value: any): value is Date {\n return value instanceof Date && !isNaN(value as any);\n}\n", "import { asyncScheduler } from '../scheduler/async';\nimport { MonoTypeOperatorFunction, SchedulerLike, OperatorFunction, ObservableInput, ObservedValueOf } from '../types';\nimport { isValidDate } from '../util/isDate';\nimport { Subscription } from '../Subscription';\nimport { operate } from '../util/lift';\nimport { Observable } from '../Observable';\nimport { innerFrom } from '../observable/innerFrom';\nimport { createErrorClass } from '../util/createErrorClass';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { executeSchedule } from '../util/executeSchedule';\n\nexport interface TimeoutConfig<T, O extends ObservableInput<unknown> = ObservableInput<T>, M = unknown> {\n /**\n * The time allowed between values from the source before timeout is triggered.\n */\n each?: number;\n\n /**\n * The relative time as a `number` in milliseconds, or a specific time as a `Date` object,\n * by which the first value must arrive from the source before timeout is triggered.\n */\n first?: number | Date;\n\n /**\n * The scheduler to use with time-related operations within this operator. Defaults to {@link asyncScheduler}\n */\n scheduler?: SchedulerLike;\n\n /**\n * A factory used to create observable to switch to when timeout occurs. Provides\n * a {@link TimeoutInfo} about the source observable's emissions and what delay or\n * exact time triggered the timeout.\n */\n with?: (info: TimeoutInfo<T, M>) => O;\n\n /**\n * Optional additional metadata you can provide to code that handles\n * the timeout, will be provided through the {@link TimeoutError}.\n * This can be used to help identify the source of a timeout or pass along\n * other information related to the timeout.\n */\n meta?: M;\n}\n\nexport interface TimeoutInfo<T, M = unknown> {\n /** Optional metadata that was provided to the timeout configuration. */\n readonly meta: M;\n /** The number of messages seen before the timeout */\n readonly seen: number;\n /** The last message seen */\n readonly lastValue: T | null;\n}\n\n/**\n * An error emitted when a timeout occurs.\n */\nexport interface TimeoutError<T = unknown, M = unknown> extends Error {\n /**\n * The information provided to the error by the timeout\n * operation that created the error. Will be `null` if\n * used directly in non-RxJS code with an empty constructor.\n * (Note that using this constructor directly is not recommended,\n * you should create your own errors)\n */\n info: TimeoutInfo<T, M> | null;\n}\n\nexport interface TimeoutErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new <T = unknown, M = unknown>(info?: TimeoutInfo<T, M>): TimeoutError<T, M>;\n}\n\n/**\n * An error thrown by the {@link timeout} operator.\n *\n * Provided so users can use as a type and do quality comparisons.\n * We recommend you do not subclass this or create instances of this class directly.\n * If you have need of a error representing a timeout, you should\n * create your own error class and use that.\n *\n * @see {@link timeout}\n */\nexport const TimeoutError: TimeoutErrorCtor = createErrorClass(\n (_super) =>\n function TimeoutErrorImpl(this: any, info: TimeoutInfo<any> | null = null) {\n _super(this);\n this.message = 'Timeout has occurred';\n this.name = 'TimeoutError';\n this.info = info;\n }\n);\n\n/**\n * If `with` is provided, this will return an observable that will switch to a different observable if the source\n * does not push values within the specified time parameters.\n *\n * <span class=\"informal\">The most flexible option for creating a timeout behavior.</span>\n *\n * The first thing to know about the configuration is if you do not provide a `with` property to the configuration,\n * when timeout conditions are met, this operator will emit a {@link TimeoutError}. Otherwise, it will use the factory\n * function provided by `with`, and switch your subscription to the result of that. Timeout conditions are provided by\n * the settings in `first` and `each`.\n *\n * The `first` property can be either a `Date` for a specific time, a `number` for a time period relative to the\n * point of subscription, or it can be skipped. This property is to check timeout conditions for the arrival of\n * the first value from the source _only_. The timings of all subsequent values from the source will be checked\n * against the time period provided by `each`, if it was provided.\n *\n * The `each` property can be either a `number` or skipped. If a value for `each` is provided, it represents the amount of\n * time the resulting observable will wait between the arrival of values from the source before timing out. Note that if\n * `first` is _not_ provided, the value from `each` will be used to check timeout conditions for the arrival of the first\n * value and all subsequent values. If `first` _is_ provided, `each` will only be use to check all values after the first.\n *\n * ## Examples\n *\n * Emit a custom error if there is too much time between values\n *\n * ```ts\n * import { interval, timeout, throwError } from 'rxjs';\n *\n * class CustomTimeoutError extends Error {\n * constructor() {\n * super('It was too slow');\n * this.name = 'CustomTimeoutError';\n * }\n * }\n *\n * const slow$ = interval(900);\n *\n * slow$.pipe(\n * timeout({\n * each: 1000,\n * with: () => throwError(() => new CustomTimeoutError())\n * })\n * )\n * .subscribe({\n * error: console.error\n * });\n * ```\n *\n * Switch to a faster observable if your source is slow.\n *\n * ```ts\n * import { interval, timeout } from 'rxjs';\n *\n * const slow$ = interval(900);\n * const fast$ = interval(500);\n *\n * slow$.pipe(\n * timeout({\n * each: 1000,\n * with: () => fast$,\n * })\n * )\n * .subscribe(console.log);\n * ```\n * @param config The configuration for the timeout.\n */\nexport function timeout<T, O extends ObservableInput<unknown>, M = unknown>(\n config: TimeoutConfig<T, O, M> & { with: (info: TimeoutInfo<T, M>) => O }\n): OperatorFunction<T, T | ObservedValueOf<O>>;\n\n/**\n * Returns an observable that will error or switch to a different observable if the source does not push values\n * within the specified time parameters.\n *\n * <span class=\"informal\">The most flexible option for creating a timeout behavior.</span>\n *\n * The first thing to know about the configuration is if you do not provide a `with` property to the configuration,\n * when timeout conditions are met, this operator will emit a {@link TimeoutError}. Otherwise, it will use the factory\n * function provided by `with`, and switch your subscription to the result of that. Timeout conditions are provided by\n * the settings in `first` and `each`.\n *\n * The `first` property can be either a `Date` for a specific time, a `number` for a time period relative to the\n * point of subscription, or it can be skipped. This property is to check timeout conditions for the arrival of\n * the first value from the source _only_. The timings of all subsequent values from the source will be checked\n * against the time period provided by `each`, if it was provided.\n *\n * The `each` property can be either a `number` or skipped. If a value for `each` is provided, it represents the amount of\n * time the resulting observable will wait between the arrival of values from the source before timing out. Note that if\n * `first` is _not_ provided, the value from `each` will be used to check timeout conditions for the arrival of the first\n * value and all subsequent values. If `first` _is_ provided, `each` will only be use to check all values after the first.\n *\n * ### Handling TimeoutErrors\n *\n * If no `with` property was provided, subscriptions to the resulting observable may emit an error of {@link TimeoutError}.\n * The timeout error provides useful information you can examine when you're handling the error. The most common way to handle\n * the error would be with {@link catchError}, although you could use {@link tap} or just the error handler in your `subscribe` call\n * directly, if your error handling is only a side effect (such as notifying the user, or logging).\n *\n * In this case, you would check the error for `instanceof TimeoutError` to validate that the error was indeed from `timeout`, and\n * not from some other source. If it's not from `timeout`, you should probably rethrow it if you're in a `catchError`.\n *\n * ## Examples\n *\n * Emit a {@link TimeoutError} if the first value, and _only_ the first value, does not arrive within 5 seconds\n *\n * ```ts\n * import { interval, timeout } from 'rxjs';\n *\n * // A random interval that lasts between 0 and 10 seconds per tick\n * const source$ = interval(Math.round(Math.random() * 10_000));\n *\n * source$.pipe(\n * timeout({ first: 5_000 })\n * )\n * .subscribe({\n * next: console.log,\n * error: console.error\n * });\n * ```\n *\n * Emit a {@link TimeoutError} if the source waits longer than 5 seconds between any two values or the first value\n * and subscription.\n *\n * ```ts\n * import { timer, timeout, expand } from 'rxjs';\n *\n * const getRandomTime = () => Math.round(Math.random() * 10_000);\n *\n * // An observable that waits a random amount of time between each delivered value\n * const source$ = timer(getRandomTime())\n * .pipe(expand(() => timer(getRandomTime())));\n *\n * source$\n * .pipe(timeout({ each: 5_000 }))\n * .subscribe({\n * next: console.log,\n * error: console.error\n * });\n * ```\n *\n * Emit a {@link TimeoutError} if the source does not emit before 7 seconds, _or_ if the source waits longer than\n * 5 seconds between any two values after the first.\n *\n * ```ts\n * import { timer, timeout, expand } from 'rxjs';\n *\n * const getRandomTime = () => Math.round(Math.random() * 10_000);\n *\n * // An observable that waits a random amount of time between each delivered value\n * const source$ = timer(getRandomTime())\n * .pipe(expand(() => timer(getRandomTime())));\n *\n * source$\n * .pipe(timeout({ first: 7_000, each: 5_000 }))\n * .subscribe({\n * next: console.log,\n * error: console.error\n * });\n * ```\n */\nexport function timeout<T, M = unknown>(config: Omit<TimeoutConfig<T, any, M>, 'with'>): OperatorFunction<T, T>;\n\n/**\n * Returns an observable that will error if the source does not push its first value before the specified time passed as a `Date`.\n * This is functionally the same as `timeout({ first: someDate })`.\n *\n * <span class=\"informal\">Errors if the first value doesn't show up before the given date and time</span>\n *\n * ![](timeout.png)\n *\n * @param first The date to at which the resulting observable will timeout if the source observable\n * does not emit at least one value.\n * @param scheduler The scheduler to use. Defaults to {@link asyncScheduler}.\n */\nexport function timeout<T>(first: Date, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;\n\n/**\n * Returns an observable that will error if the source does not push a value within the specified time in milliseconds.\n * This is functionally the same as `timeout({ each: milliseconds })`.\n *\n * <span class=\"informal\">Errors if it waits too long between any value</span>\n *\n * ![](timeout.png)\n *\n * @param each The time allowed between each pushed value from the source before the resulting observable\n * will timeout.\n * @param scheduler The scheduler to use. Defaults to {@link asyncScheduler}.\n */\nexport function timeout<T>(each: number, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;\n\n/**\n *\n * Errors if Observable does not emit a value in given time span.\n *\n * <span class=\"informal\">Timeouts on Observable that doesn't emit values fast enough.</span>\n *\n * ![](timeout.png)\n *\n * @see {@link timeoutWith}\n *\n * @return A function that returns an Observable that mirrors behaviour of the\n * source Observable, unless timeout happens when it throws an error.\n */\nexport function timeout<T, O extends ObservableInput<any>, M>(\n config: number | Date | TimeoutConfig<T, O, M>,\n schedulerArg?: SchedulerLike\n): OperatorFunction<T, T | ObservedValueOf<O>> {\n // Intentionally terse code.\n // If the first argument is a valid `Date`, then we use it as the `first` config.\n // Otherwise, if the first argument is a `number`, then we use it as the `each` config.\n // Otherwise, it can be assumed the first argument is the configuration object itself, and\n // we destructure that into what we're going to use, setting important defaults as we do.\n // NOTE: The default for `scheduler` will be the `scheduler` argument if it exists, or\n // it will default to the `asyncScheduler`.\n const {\n first,\n each,\n with: _with = timeoutErrorFactory,\n scheduler = schedulerArg ?? asyncScheduler,\n meta = null!,\n } = (isValidDate(config) ? { first: config } : typeof config === 'number' ? { each: config } : config) as TimeoutConfig<T, O, M>;\n\n if (first == null && each == null) {\n // Ensure timeout was provided at runtime.\n throw new TypeError('No timeout provided.');\n }\n\n return operate((source, subscriber) => {\n // This subscription encapsulates our subscription to the\n // source for this operator. We're capturing it separately,\n // because if there is a `with` observable to fail over to,\n // we want to unsubscribe from our original subscription, and\n // hand of the subscription to that one.\n let originalSourceSubscription: Subscription;\n // The subscription for our timeout timer. This changes\n // every time we get a new value.\n let timerSubscription: Subscription;\n // A bit of state we pass to our with and error factories to\n // tell what the last value we saw was.\n let lastValue: T | null = null;\n // A bit of state we pass to the with and error factories to\n // tell how many values we have seen so far.\n let seen = 0;\n const startTimer = (delay: number) => {\n timerSubscription = executeSchedule(\n subscriber,\n scheduler,\n () => {\n try {\n originalSourceSubscription.unsubscribe();\n innerFrom(\n _with!({\n meta,\n lastValue,\n seen,\n })\n ).subscribe(subscriber);\n } catch (err) {\n subscriber.error(err);\n }\n },\n delay\n );\n };\n\n originalSourceSubscription = source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value: T) => {\n // clear the timer so we can emit and start another one.\n timerSubscription?.unsubscribe();\n seen++;\n // Emit\n subscriber.next((lastValue = value));\n // null | undefined are both < 0. Thanks, JavaScript.\n each! > 0 && startTimer(each!);\n },\n undefined,\n undefined,\n () => {\n if (!timerSubscription?.closed) {\n timerSubscription?.unsubscribe();\n }\n // Be sure not to hold the last value in memory after unsubscription\n // it could be quite large.\n lastValue = null;\n }\n )\n );\n\n // Intentionally terse code.\n // If we've `seen` a value, that means the \"first\" clause was met already, if it existed.\n // it also means that a timer was already started for \"each\" (in the next handler above).\n // If `first` was provided, and it's a number, then use it.\n // If `first` was provided and it's not a number, it's a Date, and we get the difference between it and \"now\".\n // If `first` was not provided at all, then our first timer will be the value from `each`.\n !seen && startTimer(first != null ? (typeof first === 'number' ? first : +first - scheduler!.now()) : each!);\n });\n}\n\n/**\n * The default function to use to emit an error when timeout occurs and a `with` function\n * is not specified.\n * @param info The information about the timeout to pass along to the error\n */\nfunction timeoutErrorFactory(info: TimeoutInfo<any>): Observable<never> {\n throw new TimeoutError(info);\n}\n", "import { OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\nexport function map<T, R>(project: (value: T, index: number) => R): OperatorFunction<T, R>;\n/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */\nexport function map<T, R, A>(project: (this: A, value: T, index: number) => R, thisArg: A): OperatorFunction<T, R>;\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 * <span class=\"informal\">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.</span>\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 *\n * Map every click to the `clientX` position of that click\n *\n * ```ts\n * import { fromEvent, map } from 'rxjs';\n *\n * const clicks = fromEvent<PointerEvent>(document, 'click');\n * const positions = clicks.pipe(map(ev => ev.clientX));\n *\n * positions.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link mapTo}\n * @see {@link pluck}\n *\n * @param project The function to apply to each `value` emitted by the source\n * Observable. The `index` parameter is the number `i` for the i-th emission\n * that has happened since the subscription, starting from the number `0`.\n * @param thisArg An optional argument to define what `this` is in the\n * `project` function.\n * @return A function that returns an Observable that emits the values from the\n * source Observable transformed by the given `project` function.\n */\nexport function map<T, R>(project: (value: T, index: number) => R, thisArg?: any): OperatorFunction<T, R> {\n return operate((source, subscriber) => {\n // The index of the value from the source. Used with projection.\n let index = 0;\n // Subscribe to the source, all errors and completions are sent along\n // to the consumer.\n source.subscribe(\n createOperatorSubscriber(subscriber, (value: T) => {\n // Call the projection function with the appropriate this context,\n // and send the resulting value to the consumer.\n subscriber.next(project.call(thisArg, value, index++));\n })\n );\n });\n}\n", "import { OperatorFunction } from \"../types\";\nimport { map } from \"../operators/map\";\n\nconst { isArray } = Array;\n\nfunction callOrApply<T, R>(fn: ((...values: T[]) => R), args: T|T[]): R {\n return isArray(args) ? fn(...args) : fn(args);\n}\n\n/**\n * Used in several -- mostly deprecated -- situations where we need to \n * apply a list of arguments or a single argument to a result selector.\n */\nexport function mapOneOrManyArgs<T, R>(fn: ((...values: T[]) => R)): OperatorFunction<T|T[], R> {\n return map(args => callOrApply(fn, args))\n}", "import { SchedulerLike } from '../types';\nimport { isScheduler } from '../util/isScheduler';\nimport { Observable } from '../Observable';\nimport { subscribeOn } from '../operators/subscribeOn';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\nimport { observeOn } from '../operators/observeOn';\nimport { AsyncSubject } from '../AsyncSubject';\n\nexport function bindCallbackInternals(\n isNodeStyle: boolean,\n callbackFunc: any,\n resultSelector?: any,\n scheduler?: SchedulerLike\n): (...args: any[]) => Observable<unknown> {\n if (resultSelector) {\n if (isScheduler(resultSelector)) {\n scheduler = resultSelector;\n } else {\n // The user provided a result selector.\n return function (this: any, ...args: any[]) {\n return (bindCallbackInternals(isNodeStyle, callbackFunc, scheduler) as any)\n .apply(this, args)\n .pipe(mapOneOrManyArgs(resultSelector as any));\n };\n }\n }\n\n // If a scheduler was passed, use our `subscribeOn` and `observeOn` operators\n // to compose that behavior for the user.\n if (scheduler) {\n return function (this: any, ...args: any[]) {\n return (bindCallbackInternals(isNodeStyle, callbackFunc) as any)\n .apply(this, args)\n .pipe(subscribeOn(scheduler!), observeOn(scheduler!));\n };\n }\n\n return function (this: any, ...args: any[]): Observable<any> {\n // We're using AsyncSubject, because it emits when it completes,\n // and it will play the value to all late-arriving subscribers.\n const subject = new AsyncSubject<any>();\n\n // If this is true, then we haven't called our function yet.\n let uninitialized = true;\n return new Observable((subscriber) => {\n // Add our subscriber to the subject.\n const subs = subject.subscribe(subscriber);\n\n if (uninitialized) {\n uninitialized = false;\n // We're going to execute the bound function\n // This bit is to signal that we are hitting the callback asynchronously.\n // Because we don't have any anti-\"Zalgo\" guarantees with whatever\n // function we are handed, we use this bit to figure out whether or not\n // we are getting hit in a callback synchronously during our call.\n let isAsync = false;\n\n // This is used to signal that the callback completed synchronously.\n let isComplete = false;\n\n // Call our function that has a callback. If at any time during this\n // call, an error is thrown, it will be caught by the Observable\n // subscription process and sent to the consumer.\n callbackFunc.apply(\n // Pass the appropriate `this` context.\n this,\n [\n // Pass the arguments.\n ...args,\n // And our callback handler.\n (...results: any[]) => {\n if (isNodeStyle) {\n // If this is a node callback, shift the first value off of the\n // results and check it, as it is the error argument. By shifting,\n // we leave only the argument(s) we want to pass to the consumer.\n const err = results.shift();\n if (err != null) {\n subject.error(err);\n // If we've errored, we can stop processing this function\n // as there's nothing else to do. Just return to escape.\n return;\n }\n }\n // If we have one argument, notify the consumer\n // of it as a single value, otherwise, if there's more than one, pass\n // them as an array. Note that if there are no arguments, `undefined`\n // will be emitted.\n subject.next(1 < results.length ? results : results[0]);\n // Flip this flag, so we know we can complete it in the synchronous\n // case below.\n isComplete = true;\n // If we're not asynchronous, we need to defer the `complete` call\n // until after the call to the function is over. This is because an\n // error could be thrown in the function after it calls our callback,\n // and if that is the case, if we complete here, we are unable to notify\n // the consumer than an error occurred.\n if (isAsync) {\n subject.complete();\n }\n },\n ]\n );\n // If we flipped `isComplete` during the call, we resolved synchronously,\n // notify complete, because we skipped it in the callback to wait\n // to make sure there were no errors during the call.\n if (isComplete) {\n subject.complete();\n }\n\n // We're no longer synchronous. If the callback is called at this point\n // we can notify complete on the spot.\n isAsync = true;\n }\n\n // Return the subscription from adding our subscriber to the subject.\n return subs;\n });\n };\n}\n", "/* @prettier */\nimport { SchedulerLike } from '../types';\nimport { Observable } from '../Observable';\nimport { bindCallbackInternals } from './bindCallbackInternals';\n\nexport function bindCallback(\n callbackFunc: (...args: any[]) => void,\n resultSelector: (...args: any[]) => any,\n scheduler?: SchedulerLike\n): (...args: any[]) => Observable<any>;\n\n// args is the arguments array and we push the callback on the rest tuple since the rest parameter must be last (only item) in a parameter list\nexport function bindCallback<A extends readonly unknown[], R extends readonly unknown[]>(\n callbackFunc: (...args: [...A, (...res: R) => void]) => void,\n schedulerLike?: SchedulerLike\n): (...arg: A) => Observable<R extends [] ? void : R extends [any] ? R[0] : R>;\n\n/**\n * Converts a callback API to a function that returns an Observable.\n *\n * <span class=\"informal\">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.</span>\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 object 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 *\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 *\n * ```ts\n * import { bindCallback } from 'rxjs';\n *\n * const someFunction = (n, s, cb) => {\n * cb(n, s, { someProperty: 'someValue' });\n * };\n *\n * const boundSomeFunction = bindCallback(someFunction);\n * boundSomeFunction(5, 'some string').subscribe((values) => {\n * console.log(values); // [5, 'some string', {someProperty: 'someValue'}]\n * });\n * ```\n *\n * Compare behaviour with and without `asyncScheduler`\n *\n * ```ts\n * import { bindCallback, asyncScheduler } from 'rxjs';\n *\n * function iCallMyCallbackSynchronously(cb) {\n * cb();\n * }\n *\n * const boundSyncFn = bindCallback(iCallMyCallbackSynchronously);\n * const boundAsyncFn = bindCallback(iCallMyCallbackSynchronously, null, asyncScheduler);\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 *\n * ```ts\n * import { bindCallback } from 'rxjs';\n *\n * const boundMethod = bindCallback(someObject.methodWithCallback);\n * boundMethod\n * .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 callbackFunc A function with a callback as the last parameter.\n * @param resultSelector A mapping function used to transform callback events.\n * @param scheduler The scheduler on which to schedule the callbacks.\n * @return A function which returns the Observable that delivers the same\n * values the callback would deliver.\n */\nexport function bindCallback(\n callbackFunc: (...args: [...any[], (...res: any) => void]) => void,\n resultSelector?: ((...args: any[]) => any) | SchedulerLike,\n scheduler?: SchedulerLike\n): (...args: any[]) => Observable<unknown> {\n return bindCallbackInternals(false, callbackFunc, resultSelector, scheduler);\n}\n", "/* @prettier */\nimport { Observable } from '../Observable';\nimport { SchedulerLike } from '../types';\nimport { bindCallbackInternals } from './bindCallbackInternals';\n\nexport function bindNodeCallback(\n callbackFunc: (...args: any[]) => void,\n resultSelector: (...args: any[]) => any,\n scheduler?: SchedulerLike\n): (...args: any[]) => Observable<any>;\n\n// args is the arguments array and we push the callback on the rest tuple since the rest parameter must be last (only item) in a parameter list\nexport function bindNodeCallback<A extends readonly unknown[], R extends readonly unknown[]>(\n callbackFunc: (...args: [...A, (err: any, ...res: R) => void]) => void,\n schedulerLike?: SchedulerLike\n): (...arg: A) => Observable<R extends [] ? void : R extends [any] ? R[0] : R>;\n\n/**\n * Converts a Node.js-style callback API to a function that returns an\n * Observable.\n *\n * <span class=\"informal\">It's just like {@link bindCallback}, but the\n * callback is expected to be of type `callback(error, result)`.</span>\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 *\n * Read a file from the filesystem and get the data as an Observable\n *\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 *\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 *\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 callbackFunc Function with a Node.js-style callback as the last parameter.\n * @param resultSelector A mapping function used to transform callback events.\n * @param scheduler The scheduler on which to schedule the callbacks.\n * @return A function which returns the Observable that delivers the same values the\n * Node.js callback would deliver.\n */\nexport function bindNodeCallback(\n callbackFunc: (...args: [...any[], (err: any, ...res: any) => void]) => void,\n resultSelector?: ((...args: any[]) => any) | SchedulerLike,\n scheduler?: SchedulerLike\n): (...args: any[]) => Observable<any> {\n return bindCallbackInternals(true, callbackFunc, resultSelector, scheduler);\n}\n", "const { isArray } = Array;\nconst { getPrototypeOf, prototype: objectProto, keys: getKeys } = Object;\n\n/**\n * Used in functions where either a list of arguments, a single array of arguments, or a\n * dictionary of arguments can be returned. Returns an object with an `args` property with\n * the arguments in an array, if it is a dictionary, it will also return the `keys` in another\n * property.\n */\nexport function argsArgArrayOrObject<T, O extends Record<string, T>>(args: T[] | [O] | [T[]]): { args: T[]; keys: string[] | null } {\n if (args.length === 1) {\n const first = args[0];\n if (isArray(first)) {\n return { args: first, keys: null };\n }\n if (isPOJO(first)) {\n const keys = getKeys(first);\n return {\n args: keys.map((key) => first[key]),\n keys,\n };\n }\n }\n\n return { args: args as T[], keys: null };\n}\n\nfunction isPOJO(obj: any): obj is object {\n return obj && typeof obj === 'object' && getPrototypeOf(obj) === objectProto;\n}\n", "export function createObject(keys: string[], values: any[]) {\n return keys.reduce((result, key, i) => ((result[key] = values[i]), result), {} as any);\n}\n", "import { Observable } from '../Observable';\nimport { ObservableInput, SchedulerLike, ObservedValueOf, ObservableInputTuple } from '../types';\nimport { argsArgArrayOrObject } from '../util/argsArgArrayOrObject';\nimport { Subscriber } from '../Subscriber';\nimport { from } from './from';\nimport { identity } from '../util/identity';\nimport { Subscription } from '../Subscription';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\nimport { popResultSelector, popScheduler } from '../util/args';\nimport { createObject } from '../util/createObject';\nimport { createOperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { AnyCatcher } from '../AnyCatcher';\nimport { executeSchedule } from '../util/executeSchedule';\n\n// combineLatest(any)\n// We put this first because we need to catch cases where the user has supplied\n// _exactly `any`_ as the argument. Since `any` literally matches _anything_,\n// we don't want it to randomly hit one of the other type signatures below,\n// as we have no idea at build-time what type we should be returning when given an any.\n\n/**\n * You have passed `any` here, we can't figure out if it is\n * an array or an object, so you're getting `unknown`. Use better types.\n * @param arg Something typed as `any`\n */\nexport function combineLatest<T extends AnyCatcher>(arg: T): Observable<unknown>;\n\n// combineLatest([a, b, c])\nexport function combineLatest(sources: []): Observable<never>;\nexport function combineLatest<A extends readonly unknown[]>(sources: readonly [...ObservableInputTuple<A>]): Observable<A>;\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `combineLatestAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function combineLatest<A extends readonly unknown[], R>(\n sources: readonly [...ObservableInputTuple<A>],\n resultSelector: (...values: A) => R,\n scheduler: SchedulerLike\n): Observable<R>;\nexport function combineLatest<A extends readonly unknown[], R>(\n sources: readonly [...ObservableInputTuple<A>],\n resultSelector: (...values: A) => R\n): Observable<R>;\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `combineLatestAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function combineLatest<A extends readonly unknown[]>(\n sources: readonly [...ObservableInputTuple<A>],\n scheduler: SchedulerLike\n): Observable<A>;\n\n// combineLatest(a, b, c)\n/** @deprecated Pass an array of sources instead. The rest-parameters signature will be removed in v8. Details: https://rxjs.dev/deprecations/array-argument */\nexport function combineLatest<A extends readonly unknown[]>(...sources: [...ObservableInputTuple<A>]): Observable<A>;\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `combineLatestAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function combineLatest<A extends readonly unknown[], R>(\n ...sourcesAndResultSelectorAndScheduler: [...ObservableInputTuple<A>, (...values: A) => R, SchedulerLike]\n): Observable<R>;\n/** @deprecated Pass an array of sources instead. The rest-parameters signature will be removed in v8. Details: https://rxjs.dev/deprecations/array-argument */\nexport function combineLatest<A extends readonly unknown[], R>(\n ...sourcesAndResultSelector: [...ObservableInputTuple<A>, (...values: A) => R]\n): Observable<R>;\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `combineLatestAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function combineLatest<A extends readonly unknown[]>(\n ...sourcesAndScheduler: [...ObservableInputTuple<A>, SchedulerLike]\n): Observable<A>;\n\n// combineLatest({a, b, c})\nexport function combineLatest(sourcesObject: { [K in any]: never }): Observable<never>;\nexport function combineLatest<T extends Record<string, ObservableInput<any>>>(\n sourcesObject: T\n): Observable<{ [K in keyof T]: ObservedValueOf<T[K]> }>;\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 * <span class=\"informal\">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.</span>\n *\n * ![](combineLatest.png)\n *\n * `combineLatest` combines the values from all the Observables passed in the\n * observables array. 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 this operator,\n * the returned Observable will always emit an array of `n` values, in an order\n * corresponding to the order of the passed Observables (the value from the first Observable\n * will be at index 0 of the array and so on).\n *\n * Static version of `combineLatest` accepts an array of Observables. Note that an array of\n * Observables is a good choice, if you don't know beforehand how many Observables\n * you will combine. Passing an empty array will result in an Observable that\n * completes immediately.\n *\n * To ensure the output array always has 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 now be impossible to include a value from the\n * completed Observable in the 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, the resulting Observable will complete when all combined\n * streams complete. So even if some Observable completes, the result of\n * `combineLatest` will still emit values when other Observables do. In case\n * of a 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 * ## Examples\n *\n * Combine two timer Observables\n *\n * ```ts\n * import { timer, combineLatest } 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 a dictionary of Observables\n *\n * ```ts\n * import { of, delay, startWith, combineLatest } from 'rxjs';\n *\n * const observables = {\n * a: of(1).pipe(delay(1000), startWith(0)),\n * b: of(5).pipe(delay(5000), startWith(0)),\n * c: of(10).pipe(delay(10000), startWith(0))\n * };\n * const combined = combineLatest(observables);\n * combined.subscribe(value => console.log(value));\n * // Logs\n * // { a: 0, b: 0, c: 0 } immediately\n * // { a: 1, b: 0, c: 0 } after 1s\n * // { a: 1, b: 5, c: 0 } after 5s\n * // { a: 1, b: 5, c: 10 } after 10s\n * ```\n *\n * Combine an array of Observables\n *\n * ```ts\n * import { of, delay, startWith, combineLatest } from 'rxjs';\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 * Use map operator to dynamically calculate the Body-Mass Index\n *\n * ```ts\n * import { of, combineLatest, map } from 'rxjs';\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 combineLatestAll}\n * @see {@link merge}\n * @see {@link withLatestFrom}\n *\n * @param args Any number of `ObservableInput`s provided either as an array or as an object\n * to combine with each other. If the last parameter is the function, it will be used to project the\n * values from the combined latest values into a new value on the output Observable.\n * @return An Observable of projected values from the most recent values from each `ObservableInput`,\n * or an array of the most recent values from each `ObservableInput`.\n */\nexport function combineLatest<O extends ObservableInput<any>, R>(...args: any[]): Observable<R> | Observable<ObservedValueOf<O>[]> {\n const scheduler = popScheduler(args);\n const resultSelector = popResultSelector(args);\n\n const { args: observables, keys } = argsArgArrayOrObject(args);\n\n if (observables.length === 0) {\n // If no observables are passed, or someone has passed an empty array\n // of observables, or even an empty object POJO, we need to just\n // complete (EMPTY), but we have to honor the scheduler provided if any.\n return from([], scheduler as any);\n }\n\n const result = new Observable<ObservedValueOf<O>[]>(\n combineLatestInit(\n observables as ObservableInput<ObservedValueOf<O>>[],\n scheduler,\n keys\n ? // A handler for scrubbing the array of args into a dictionary.\n (values) => createObject(keys, values)\n : // A passthrough to just return the array\n identity\n )\n );\n\n return resultSelector ? (result.pipe(mapOneOrManyArgs(resultSelector)) as Observable<R>) : result;\n}\n\nexport function combineLatestInit(\n observables: ObservableInput<any>[],\n scheduler?: SchedulerLike,\n valueTransform: (values: any[]) => any = identity\n) {\n return (subscriber: Subscriber<any>) => {\n // The outer subscription. We're capturing this in a function\n // because we may have to schedule it.\n maybeSchedule(\n scheduler,\n () => {\n const { length } = observables;\n // A store for the values each observable has emitted so far. We match observable to value on index.\n const values = new Array(length);\n // The number of currently active subscriptions, as they complete, we decrement this number to see if\n // we are all done combining values, so we can complete the result.\n let active = length;\n // The number of inner sources that still haven't emitted the first value\n // We need to track this because all sources need to emit one value in order\n // to start emitting values.\n let remainingFirstValues = length;\n // The loop to kick off subscription. We're keying everything on index `i` to relate the observables passed\n // in to the slot in the output array or the key in the array of keys in the output dictionary.\n for (let i = 0; i < length; i++) {\n maybeSchedule(\n scheduler,\n () => {\n const source = from(observables[i], scheduler as any);\n let hasFirstValue = false;\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => {\n // When we get a value, record it in our set of values.\n values[i] = value;\n if (!hasFirstValue) {\n // If this is our first value, record that.\n hasFirstValue = true;\n remainingFirstValues--;\n }\n if (!remainingFirstValues) {\n // We're not waiting for any more\n // first values, so we can emit!\n subscriber.next(valueTransform(values.slice()));\n }\n },\n () => {\n if (!--active) {\n // We only complete the result if we have no more active\n // inner observables.\n subscriber.complete();\n }\n }\n )\n );\n },\n subscriber\n );\n }\n },\n subscriber\n );\n };\n}\n\n/**\n * A small utility to handle the couple of locations where we want to schedule if a scheduler was provided,\n * but we don't if there was no scheduler.\n */\nfunction maybeSchedule(scheduler: SchedulerLike | undefined, execute: () => void, subscription: Subscription) {\n if (scheduler) {\n executeSchedule(subscription, scheduler, execute);\n } else {\n execute();\n }\n}\n", "import { Observable } from '../Observable';\nimport { innerFrom } from '../observable/innerFrom';\nimport { Subscriber } from '../Subscriber';\nimport { ObservableInput, SchedulerLike } from '../types';\nimport { executeSchedule } from '../util/executeSchedule';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * A process embodying the general \"merge\" strategy. This is used in\n * `mergeMap` and `mergeScan` because the logic is otherwise nearly identical.\n * @param source The original source observable\n * @param subscriber The consumer subscriber\n * @param project The projection function to get our inner sources\n * @param concurrent The number of concurrent inner subscriptions\n * @param onBeforeNext Additional logic to apply before nexting to our consumer\n * @param expand If `true` this will perform an \"expand\" strategy, which differs only\n * in that it recurses, and the inner subscription must be schedule-able.\n * @param innerSubScheduler A scheduler to use to schedule inner subscriptions,\n * this is to support the expand strategy, mostly, and should be deprecated\n */\nexport function mergeInternals<T, R>(\n source: Observable<T>,\n subscriber: Subscriber<R>,\n project: (value: T, index: number) => ObservableInput<R>,\n concurrent: number,\n onBeforeNext?: (innerValue: R) => void,\n expand?: boolean,\n innerSubScheduler?: SchedulerLike,\n additionalFinalizer?: () => void\n) {\n // Buffered values, in the event of going over our concurrency limit\n const buffer: T[] = [];\n // The number of active inner subscriptions.\n let active = 0;\n // An index to pass to our accumulator function\n let index = 0;\n // Whether or not the outer source has completed.\n let isComplete = false;\n\n /**\n * Checks to see if we can complete our result or not.\n */\n const checkComplete = () => {\n // If the outer has completed, and nothing is left in the buffer,\n // and we don't have any active inner subscriptions, then we can\n // Emit the state and complete.\n if (isComplete && !buffer.length && !active) {\n subscriber.complete();\n }\n };\n\n // If we're under our concurrency limit, just start the inner subscription, otherwise buffer and wait.\n const outerNext = (value: T) => (active < concurrent ? doInnerSub(value) : buffer.push(value));\n\n const doInnerSub = (value: T) => {\n // If we're expanding, we need to emit the outer values and the inner values\n // as the inners will \"become outers\" in a way as they are recursively fed\n // back to the projection mechanism.\n expand && subscriber.next(value as any);\n\n // Increment the number of active subscriptions so we can track it\n // against our concurrency limit later.\n active++;\n\n // A flag used to show that the inner observable completed.\n // This is checked during finalization to see if we should\n // move to the next item in the buffer, if there is on.\n let innerComplete = false;\n\n // Start our inner subscription.\n innerFrom(project(value, index++)).subscribe(\n createOperatorSubscriber(\n subscriber,\n (innerValue) => {\n // `mergeScan` has additional handling here. For example\n // taking the inner value and updating state.\n onBeforeNext?.(innerValue);\n\n if (expand) {\n // If we're expanding, then just recurse back to our outer\n // handler. It will emit the value first thing.\n outerNext(innerValue as any);\n } else {\n // Otherwise, emit the inner value.\n subscriber.next(innerValue);\n }\n },\n () => {\n // Flag that we have completed, so we know to check the buffer\n // during finalization.\n innerComplete = true;\n },\n // Errors are passed to the destination.\n undefined,\n () => {\n // During finalization, if the inner completed (it wasn't errored or\n // cancelled), then we want to try the next item in the buffer if\n // there is one.\n if (innerComplete) {\n // We have to wrap this in a try/catch because it happens during\n // finalization, possibly asynchronously, and we want to pass\n // any errors that happen (like in a projection function) to\n // the outer Subscriber.\n try {\n // INNER SOURCE COMPLETE\n // Decrement the active count to ensure that the next time\n // we try to call `doInnerSub`, the number is accurate.\n active--;\n // If we have more values in the buffer, try to process those\n // Note that this call will increment `active` ahead of the\n // next conditional, if there were any more inner subscriptions\n // to start.\n while (buffer.length && active < concurrent) {\n const bufferedValue = buffer.shift()!;\n // Particularly for `expand`, we need to check to see if a scheduler was provided\n // for when we want to start our inner subscription. Otherwise, we just start\n // are next inner subscription.\n if (innerSubScheduler) {\n executeSchedule(subscriber, innerSubScheduler, () => doInnerSub(bufferedValue));\n } else {\n doInnerSub(bufferedValue);\n }\n }\n // Check to see if we can complete, and complete if so.\n checkComplete();\n } catch (err) {\n subscriber.error(err);\n }\n }\n }\n )\n );\n };\n\n // Subscribe to our source observable.\n source.subscribe(\n createOperatorSubscriber(subscriber, outerNext, () => {\n // Outer completed, make a note of it, and check to see if we can complete everything.\n isComplete = true;\n checkComplete();\n })\n );\n\n // Additional finalization (for when the destination is torn down).\n // Other finalization is added implicitly via subscription above.\n return () => {\n additionalFinalizer?.();\n };\n}\n", "import { ObservableInput, OperatorFunction, ObservedValueOf } from '../types';\nimport { map } from './map';\nimport { innerFrom } from '../observable/innerFrom';\nimport { operate } from '../util/lift';\nimport { mergeInternals } from './mergeInternals';\nimport { isFunction } from '../util/isFunction';\n\n/* tslint:disable:max-line-length */\nexport function mergeMap<T, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n concurrent?: number\n): OperatorFunction<T, ObservedValueOf<O>>;\n/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */\nexport function mergeMap<T, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector: undefined,\n concurrent?: number\n): OperatorFunction<T, ObservedValueOf<O>>;\n/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */\nexport function mergeMap<T, R, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R,\n concurrent?: number\n): OperatorFunction<T, R>;\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 * <span class=\"informal\">Maps each value to an Observable, then flattens all of\n * these inner Observables using {@link mergeAll}.</span>\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 *\n * Map and flatten each letter to an Observable ticking every 1 second\n *\n * ```ts\n * import { of, mergeMap, interval, map } from 'rxjs';\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 *\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 every second 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 project A function that, when applied to an item emitted by the source\n * Observable, returns an Observable.\n * @param concurrent Maximum number of `ObservableInput`s being subscribed to concurrently.\n * @return A function that returns an Observable that emits the result of\n * applying the projection function (and the optional deprecated\n * `resultSelector`) to each item emitted by the source Observable and merging\n * the results of the Observables obtained from this transformation.\n */\nexport function mergeMap<T, R, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector?: ((outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R) | number,\n concurrent: number = Infinity\n): OperatorFunction<T, ObservedValueOf<O> | R> {\n if (isFunction(resultSelector)) {\n // DEPRECATED PATH\n return mergeMap((a, i) => map((b: any, ii: number) => resultSelector(a, b, i, ii))(innerFrom(project(a, i))), concurrent);\n } else if (typeof resultSelector === 'number') {\n concurrent = resultSelector;\n }\n\n return operate((source, subscriber) => mergeInternals(source, subscriber, project, concurrent));\n}\n", "import { mergeMap } from './mergeMap';\nimport { identity } from '../util/identity';\nimport { OperatorFunction, ObservableInput, ObservedValueOf } 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 * <span class=\"informal\">Flattens an Observable-of-Observables.</span>\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 *\n * Spawn a new interval Observable for each click event, and blend their outputs as one Observable\n *\n * ```ts\n * import { fromEvent, map, interval, mergeAll } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const higherOrder = clicks.pipe(map(() => interval(1000)));\n * const firstOrder = higherOrder.pipe(mergeAll());\n *\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 *\n * ```ts\n * import { fromEvent, map, interval, take, mergeAll } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const higherOrder = clicks.pipe(\n * map(() => interval(1000).pipe(take(10)))\n * );\n * const firstOrder = higherOrder.pipe(mergeAll(2));\n *\n * firstOrder.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link combineLatestAll}\n * @see {@link concatAll}\n * @see {@link exhaustAll}\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 concurrent Maximum number of inner Observables being subscribed to\n * concurrently.\n * @return A function that returns an Observable that emits values coming from\n * all the inner Observables emitted by the source Observable.\n */\nexport function mergeAll<O extends ObservableInput<any>>(concurrent: number = Infinity): OperatorFunction<O, ObservedValueOf<O>> {\n return mergeMap(identity, concurrent);\n}\n", "import { mergeAll } from './mergeAll';\nimport { OperatorFunction, ObservableInput, ObservedValueOf } from '../types';\n\n/**\n * Converts a higher-order Observable into a first-order Observable by\n * concatenating the inner Observables in order.\n *\n * <span class=\"informal\">Flattens an Observable-of-Observables by putting one\n * inner Observable after the other.</span>\n *\n * ![](concatAll.svg)\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 *\n * ```ts\n * import { fromEvent, map, interval, take, concatAll } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const higherOrder = clicks.pipe(\n * map(() => 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 combineLatestAll}\n * @see {@link concat}\n * @see {@link concatMap}\n * @see {@link concatMapTo}\n * @see {@link exhaustAll}\n * @see {@link mergeAll}\n * @see {@link switchAll}\n * @see {@link switchMap}\n * @see {@link zipAll}\n *\n * @return A function that returns an Observable emitting values from all the\n * inner Observables concatenated.\n */\nexport function concatAll<O extends ObservableInput<any>>(): OperatorFunction<O, ObservedValueOf<O>> {\n return mergeAll(1);\n}\n", "import { Observable } from '../Observable';\nimport { ObservableInputTuple, SchedulerLike } from '../types';\nimport { concatAll } from '../operators/concatAll';\nimport { popScheduler } from '../util/args';\nimport { from } from './from';\n\nexport function concat<T extends readonly unknown[]>(...inputs: [...ObservableInputTuple<T>]): Observable<T[number]>;\nexport function concat<T extends readonly unknown[]>(\n ...inputsAndScheduler: [...ObservableInputTuple<T>, SchedulerLike]\n): Observable<T[number]>;\n\n/**\n * Creates an output Observable which sequentially emits all values from the first given\n * Observable and then moves on to the next.\n *\n * <span class=\"informal\">Concatenates multiple Observables together by\n * sequentially emitting their values, one Observable after the other.</span>\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 *\n * Concatenate a timer counting from 0 to 3 with a synchronous sequence from 1 to 10\n *\n * ```ts\n * import { interval, take, range, concat } from 'rxjs';\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 *\n * ```ts\n * import { interval, take, concat } from 'rxjs';\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 *\n * ```ts\n * import { interval, take, concat } from 'rxjs';\n *\n * const timer = interval(1000).pipe(take(2));\n *\n * concat(timer, timer) // concatenating the same Observable!\n * .subscribe({\n * next: value => console.log(value),\n * complete: () => 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 args `ObservableInput`s to concatenate.\n */\nexport function concat(...args: any[]): Observable<unknown> {\n return concatAll()(from(args, popScheduler(args)));\n}\n", "import { Observable } from '../Observable';\nimport { ObservedValueOf, ObservableInput } from '../types';\nimport { innerFrom } from './innerFrom';\n\n/**\n * Creates an Observable that, on subscribe, calls an Observable factory to\n * make an Observable for each new Observer.\n *\n * <span class=\"informal\">Creates the Observable lazily, that is, only when it\n * is subscribed.\n * </span>\n *\n * ![](defer.png)\n *\n * `defer` allows you to create an Observable only when the Observer\n * subscribes. It waits until an Observer subscribes to it, calls the given\n * factory function to get an Observable -- where a factory function typically\n * generates a new Observable -- and subscribes the Observer to this Observable.\n * In case the factory function returns a falsy value, then EMPTY is used as\n * Observable instead. Last but not least, an exception during the factory\n * function call is transferred to the Observer by calling `error`.\n *\n * ## Example\n *\n * Subscribe to either an Observable of clicks or an Observable of interval, at random\n *\n * ```ts\n * import { defer, fromEvent, interval } from 'rxjs';\n *\n * const clicksOrInterval = defer(() => {\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 observableFactory The Observable factory function to invoke for each\n * Observer that subscribes to the output Observable. May also return any\n * `ObservableInput`, which will be converted on the fly to an Observable.\n * @return An Observable whose Observers' subscriptions trigger an invocation of the\n * given Observable factory function.\n */\nexport function defer<R extends ObservableInput<any>>(observableFactory: () => R): Observable<ObservedValueOf<R>> {\n return new Observable<ObservedValueOf<R>>((subscriber) => {\n innerFrom(observableFactory()).subscribe(subscriber);\n });\n}\n", "import { Connectable, ObservableInput, SubjectLike } from '../types';\nimport { Subject } from '../Subject';\nimport { Subscription } from '../Subscription';\nimport { Observable } from '../Observable';\nimport { defer } from './defer';\n\nexport interface ConnectableConfig<T> {\n /**\n * A factory function used to create the Subject through which the source\n * is multicast. By default this creates a {@link Subject}.\n */\n connector: () => SubjectLike<T>;\n /**\n * If true, the resulting observable will reset internal state upon disconnection\n * and return to a \"cold\" state. This allows the resulting observable to be\n * reconnected.\n * If false, upon disconnection, the connecting subject will remain the\n * connecting subject, meaning the resulting observable will not go \"cold\" again,\n * and subsequent repeats or resubscriptions will resubscribe to that same subject.\n */\n resetOnDisconnect?: boolean;\n}\n\n/**\n * The default configuration for `connectable`.\n */\nconst DEFAULT_CONFIG: ConnectableConfig<unknown> = {\n connector: () => new Subject<unknown>(),\n resetOnDisconnect: true,\n};\n\n/**\n * Creates an observable that multicasts once `connect()` is called on it.\n *\n * @param source The observable source to make connectable.\n * @param config The configuration object for `connectable`.\n * @returns A \"connectable\" observable, that has a `connect()` method, that you must call to\n * connect the source to all consumers through the subject provided as the connector.\n */\nexport function connectable<T>(source: ObservableInput<T>, config: ConnectableConfig<T> = DEFAULT_CONFIG): Connectable<T> {\n // The subscription representing the connection.\n let connection: Subscription | null = null;\n const { connector, resetOnDisconnect = true } = config;\n let subject = connector();\n\n const result: any = new Observable<T>((subscriber) => {\n return subject.subscribe(subscriber);\n });\n\n // Define the `connect` function. This is what users must call\n // in order to \"connect\" the source to the subject that is\n // multicasting it.\n result.connect = () => {\n if (!connection || connection.closed) {\n connection = defer(() => source).subscribe(subject);\n if (resetOnDisconnect) {\n connection.add(() => (subject = connector()));\n }\n }\n return connection;\n };\n\n return result;\n}\n", "import { Observable } from '../Observable';\nimport { ObservedValueOf, ObservableInputTuple, ObservableInput } from '../types';\nimport { argsArgArrayOrObject } from '../util/argsArgArrayOrObject';\nimport { innerFrom } from './innerFrom';\nimport { popResultSelector } from '../util/args';\nimport { createOperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\nimport { createObject } from '../util/createObject';\nimport { AnyCatcher } from '../AnyCatcher';\n\n// forkJoin(any)\n// We put this first because we need to catch cases where the user has supplied\n// _exactly `any`_ as the argument. Since `any` literally matches _anything_,\n// we don't want it to randomly hit one of the other type signatures below,\n// as we have no idea at build-time what type we should be returning when given an any.\n\n/**\n * You have passed `any` here, we can't figure out if it is\n * an array or an object, so you're getting `unknown`. Use better types.\n * @param arg Something typed as `any`\n */\nexport function forkJoin<T extends AnyCatcher>(arg: T): Observable<unknown>;\n\n// forkJoin(null | undefined)\nexport function forkJoin(scheduler: null | undefined): Observable<never>;\n\n// forkJoin([a, b, c])\nexport function forkJoin(sources: readonly []): Observable<never>;\nexport function forkJoin<A extends readonly unknown[]>(sources: readonly [...ObservableInputTuple<A>]): Observable<A>;\nexport function forkJoin<A extends readonly unknown[], R>(\n sources: readonly [...ObservableInputTuple<A>],\n resultSelector: (...values: A) => R\n): Observable<R>;\n\n// forkJoin(a, b, c)\n/** @deprecated Pass an array of sources instead. The rest-parameters signature will be removed in v8. Details: https://rxjs.dev/deprecations/array-argument */\nexport function forkJoin<A extends readonly unknown[]>(...sources: [...ObservableInputTuple<A>]): Observable<A>;\n/** @deprecated Pass an array of sources instead. The rest-parameters signature will be removed in v8. Details: https://rxjs.dev/deprecations/array-argument */\nexport function forkJoin<A extends readonly unknown[], R>(\n ...sourcesAndResultSelector: [...ObservableInputTuple<A>, (...values: A) => R]\n): Observable<R>;\n\n// forkJoin({a, b, c})\nexport function forkJoin(sourcesObject: { [K in any]: never }): Observable<never>;\nexport function forkJoin<T extends Record<string, ObservableInput<any>>>(\n sourcesObject: T\n): Observable<{ [K in keyof T]: ObservedValueOf<T[K]> }>;\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 * <span class=\"informal\">Wait for Observables to complete and then combine last values they emitted;\n * complete immediately if an empty array is passed.</span>\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 (e.g. an empty array is passed),\n * then the resulting stream will complete immediately.\n *\n * `forkJoin` will wait for all passed observables to emit and 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, then the resulting\n * array will have `n` values, where the first value is the last one emitted by the first observable,\n * second value is the last one emitted by the second observable and so on.\n *\n * If you pass a dictionary of observables to the operator, then the resulting\n * objects will have the same keys as the dictionary passed, with their last values they have 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 the lifecycle of passed observables, but also throughout it, try out {@link combineLatest}\n * or {@link zip} instead.\n *\n * In order for the resulting array to have the same length as the number of input observables, whenever any of\n * the given 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 either,\n * unless at any point some other observable completes without emitting a value, which brings us back to\n * the previous case. Overall, in order for `forkJoin` to emit a value, all given observables\n * have to emit something at least once and complete.\n *\n * If any given observable errors at some point, `forkJoin` will error as well and immediately unsubscribe\n * from the other observables.\n *\n * Optionally `forkJoin` accepts a `resultSelector` function, that will be called with values which normally\n * would land in the emitted array. Whatever is returned by the `resultSelector`, will appear in the output\n * observable instead. This means that the default `resultSelector` can be thought of as a function that takes\n * all its arguments and puts them into an array. Note that the `resultSelector` will be called only\n * when `forkJoin` is supposed to emit a result.\n *\n * ## Examples\n *\n * Use `forkJoin` with a dictionary of observable inputs\n *\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 *\n * ```ts\n * import { forkJoin, of, timer } 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 args Any number of `ObservableInput`s provided either as an array, as an object\n * or as arguments passed directly to the operator.\n * @return Observable emitting either an array of last values emitted by passed Observables\n * or value from project function.\n */\nexport function forkJoin(...args: any[]): Observable<any> {\n const resultSelector = popResultSelector(args);\n const { args: sources, keys } = argsArgArrayOrObject(args);\n const result = new Observable((subscriber) => {\n const { length } = sources;\n if (!length) {\n subscriber.complete();\n return;\n }\n const values = new Array(length);\n let remainingCompletions = length;\n let remainingEmissions = length;\n for (let sourceIndex = 0; sourceIndex < length; sourceIndex++) {\n let hasValue = false;\n innerFrom(sources[sourceIndex]).subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => {\n if (!hasValue) {\n hasValue = true;\n remainingEmissions--;\n }\n values[sourceIndex] = value;\n },\n () => remainingCompletions--,\n undefined,\n () => {\n if (!remainingCompletions || !hasValue) {\n if (!remainingEmissions) {\n subscriber.next(keys ? createObject(keys, values) : values);\n }\n subscriber.complete();\n }\n }\n )\n );\n }\n });\n return resultSelector ? result.pipe(mapOneOrManyArgs(resultSelector)) : result;\n}\n", "import { innerFrom } from '../observable/innerFrom';\nimport { Observable } from '../Observable';\nimport { mergeMap } from '../operators/mergeMap';\nimport { isArrayLike } from '../util/isArrayLike';\nimport { isFunction } from '../util/isFunction';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\n\n// These constants are used to create handler registry functions using array mapping below.\nconst nodeEventEmitterMethods = ['addListener', 'removeListener'] as const;\nconst eventTargetMethods = ['addEventListener', 'removeEventListener'] as const;\nconst jqueryMethods = ['on', 'off'] as const;\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\n// Use handler types like those in @types/jquery. See:\n// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/847731ba1d7fa6db6b911c0e43aa0afe596e7723/types/jquery/misc.d.ts#L6395\nexport interface JQueryStyleEventEmitter<TContext, T> {\n on(eventName: string, handler: (this: TContext, t: T, ...args: any[]) => any): void;\n off(eventName: string, handler: (this: TContext, t: T, ...args: any[]) => any): void;\n}\n\nexport interface EventListenerObject<E> {\n handleEvent(evt: E): void;\n}\n\nexport interface HasEventTargetAddRemove<E> {\n addEventListener(\n type: string,\n listener: ((evt: E) => void) | EventListenerObject<E> | null,\n options?: boolean | AddEventListenerOptions\n ): void;\n removeEventListener(\n type: string,\n listener: ((evt: E) => void) | EventListenerObject<E> | null,\n options?: EventListenerOptions | boolean\n ): void;\n}\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\nexport function fromEvent<T>(target: HasEventTargetAddRemove<T> | ArrayLike<HasEventTargetAddRemove<T>>, eventName: string): Observable<T>;\nexport function fromEvent<T, R>(\n target: HasEventTargetAddRemove<T> | ArrayLike<HasEventTargetAddRemove<T>>,\n eventName: string,\n resultSelector: (event: T) => R\n): Observable<R>;\nexport function fromEvent<T>(\n target: HasEventTargetAddRemove<T> | ArrayLike<HasEventTargetAddRemove<T>>,\n eventName: string,\n options: EventListenerOptions\n): Observable<T>;\nexport function fromEvent<T, R>(\n target: HasEventTargetAddRemove<T> | ArrayLike<HasEventTargetAddRemove<T>>,\n eventName: string,\n options: EventListenerOptions,\n resultSelector: (event: T) => R\n): Observable<R>;\n\nexport function fromEvent(target: NodeStyleEventEmitter | ArrayLike<NodeStyleEventEmitter>, eventName: string): Observable<unknown>;\n/** @deprecated Do not specify explicit type parameters. Signatures with type parameters that cannot be inferred will be removed in v8. */\nexport function fromEvent<T>(target: NodeStyleEventEmitter | ArrayLike<NodeStyleEventEmitter>, eventName: string): Observable<T>;\nexport function fromEvent<R>(\n target: NodeStyleEventEmitter | ArrayLike<NodeStyleEventEmitter>,\n eventName: string,\n resultSelector: (...args: any[]) => R\n): Observable<R>;\n\nexport function fromEvent(\n target: NodeCompatibleEventEmitter | ArrayLike<NodeCompatibleEventEmitter>,\n eventName: string\n): Observable<unknown>;\n/** @deprecated Do not specify explicit type parameters. Signatures with type parameters that cannot be inferred will be removed in v8. */\nexport function fromEvent<T>(target: NodeCompatibleEventEmitter | ArrayLike<NodeCompatibleEventEmitter>, eventName: string): Observable<T>;\nexport function fromEvent<R>(\n target: NodeCompatibleEventEmitter | ArrayLike<NodeCompatibleEventEmitter>,\n eventName: string,\n resultSelector: (...args: any[]) => R\n): Observable<R>;\n\nexport function fromEvent<T>(\n target: JQueryStyleEventEmitter<any, T> | ArrayLike<JQueryStyleEventEmitter<any, T>>,\n eventName: string\n): Observable<T>;\nexport function fromEvent<T, R>(\n target: JQueryStyleEventEmitter<any, T> | ArrayLike<JQueryStyleEventEmitter<any, T>>,\n eventName: string,\n resultSelector: (value: T, ...args: any[]) => R\n): Observable<R>;\n\n/**\n * Creates an Observable that emits events of a specific type coming from the\n * given event target.\n *\n * <span class=\"informal\">Creates an Observable from DOM events, or Node.js\n * EventEmitter events or others.</span>\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 *\n * Emit clicks happening on the DOM document\n *\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 *\n * ```ts\n * import { fromEvent } from 'rxjs';\n *\n * const div = document.createElement('div');\n * div.style.cssText = 'width: 200px; height: 200px; background: #09c;';\n * document.body.appendChild(div);\n *\n * // note optional configuration parameter which will be passed to addEventListener\n * const clicksInDocument = fromEvent(document, 'click', { capture: true });\n * const clicksInDiv = fromEvent(div, '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 target The DOM EventTarget, Node.js EventEmitter, JQuery-like event target,\n * NodeList or HTMLCollection to attach the event handler to.\n * @param eventName The event name of interest, being emitted by the `target`.\n * @param options Options to pass through to the underlying `addListener`,\n * `addEventListener` or `on` functions.\n * @param resultSelector A mapping function used to transform events. It takes the\n * arguments from the event handler and should return a single value.\n * @return An Observable emitting events registered through `target`'s\n * listener handlers.\n */\nexport function fromEvent<T>(\n target: any,\n eventName: string,\n options?: EventListenerOptions | ((...args: any[]) => T),\n resultSelector?: (...args: any[]) => T\n): Observable<T> {\n if (isFunction(options)) {\n resultSelector = options;\n options = undefined;\n }\n if (resultSelector) {\n return fromEvent<T>(target, eventName, options as EventListenerOptions).pipe(mapOneOrManyArgs(resultSelector));\n }\n\n // Figure out our add and remove methods. In order to do this,\n // we are going to analyze the target in a preferred order, if\n // the target matches a given signature, we take the two \"add\" and \"remove\"\n // method names and apply them to a map to create opposite versions of the\n // same function. This is because they all operate in duplicate pairs,\n // `addListener(name, handler)`, `removeListener(name, handler)`, for example.\n // The call only differs by method name, as to whether or not you're adding or removing.\n const [add, remove] =\n // If it is an EventTarget, we need to use a slightly different method than the other two patterns.\n isEventTarget(target)\n ? eventTargetMethods.map((methodName) => (handler: any) => target[methodName](eventName, handler, options as EventListenerOptions))\n : // In all other cases, the call pattern is identical with the exception of the method names.\n isNodeStyleEventEmitter(target)\n ? nodeEventEmitterMethods.map(toCommonHandlerRegistry(target, eventName))\n : isJQueryStyleEventEmitter(target)\n ? jqueryMethods.map(toCommonHandlerRegistry(target, eventName))\n : [];\n\n // If add is falsy, it's because we didn't match a pattern above.\n // Check to see if it is an ArrayLike, because if it is, we want to\n // try to apply fromEvent to all of it's items. We do this check last,\n // because there are may be some types that are both ArrayLike *and* implement\n // event registry points, and we'd rather delegate to that when possible.\n if (!add) {\n if (isArrayLike(target)) {\n return mergeMap((subTarget: any) => fromEvent(subTarget, eventName, options as EventListenerOptions))(\n innerFrom(target)\n ) as Observable<T>;\n }\n }\n\n // If add is falsy and we made it here, it's because we didn't\n // match any valid target objects above.\n if (!add) {\n throw new TypeError('Invalid event target');\n }\n\n return new Observable<T>((subscriber) => {\n // The handler we are going to register. Forwards the event object, by itself, or\n // an array of arguments to the event handler, if there is more than one argument,\n // to the consumer.\n const handler = (...args: any[]) => subscriber.next(1 < args.length ? args : args[0]);\n // Do the work of adding the handler to the target.\n add(handler);\n // When we finalize, we want to remove the handler and free up memory.\n return () => remove!(handler);\n });\n}\n\n/**\n * Used to create `add` and `remove` functions to register and unregister event handlers\n * from a target in the most common handler pattern, where there are only two arguments.\n * (e.g. `on(name, fn)`, `off(name, fn)`, `addListener(name, fn)`, or `removeListener(name, fn)`)\n * @param target The target we're calling methods on\n * @param eventName The event name for the event we're creating register or unregister functions for\n */\nfunction toCommonHandlerRegistry(target: any, eventName: string) {\n return (methodName: string) => (handler: any) => target[methodName](eventName, handler);\n}\n\n/**\n * Checks to see if the target implements the required node-style EventEmitter methods\n * for adding and removing event handlers.\n * @param target the object to check\n */\nfunction isNodeStyleEventEmitter(target: any): target is NodeStyleEventEmitter {\n return isFunction(target.addListener) && isFunction(target.removeListener);\n}\n\n/**\n * Checks to see if the target implements the required jQuery-style EventEmitter methods\n * for adding and removing event handlers.\n * @param target the object to check\n */\nfunction isJQueryStyleEventEmitter(target: any): target is JQueryStyleEventEmitter<any, any> {\n return isFunction(target.on) && isFunction(target.off);\n}\n\n/**\n * Checks to see if the target implements the required EventTarget methods\n * for adding and removing event handlers.\n * @param target the object to check\n */\nfunction isEventTarget(target: any): target is HasEventTargetAddRemove<any> {\n return isFunction(target.addEventListener) && isFunction(target.removeEventListener);\n}\n", "import { Observable } from '../Observable';\nimport { isFunction } from '../util/isFunction';\nimport { NodeEventHandler } from './fromEvent';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\n\n/* tslint:disable:max-line-length */\nexport function fromEventPattern<T>(\n addHandler: (handler: NodeEventHandler) => any,\n removeHandler?: (handler: NodeEventHandler, signal?: any) => void\n): Observable<T>;\nexport function fromEventPattern<T>(\n addHandler: (handler: NodeEventHandler) => any,\n removeHandler?: (handler: NodeEventHandler, signal?: any) => void,\n resultSelector?: (...args: any[]) => T\n): Observable<T>;\n/* tslint:enable:max-line-length */\n\n/**\n * Creates an Observable from an arbitrary API for registering event handlers.\n *\n * <span class=\"informal\">When that method for adding event handler was something {@link fromEvent}\n * was not prepared for.</span>\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 * than 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 * ## Examples\n *\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 * 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 * 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 addHandler A function that takes a `handler` function as argument and attaches it\n * somehow to the actual source of events.\n * @param removeHandler A function that takes a `handler` function as an argument and removes\n * it from the event source. If `addHandler` returns some kind of token, `removeHandler` function\n * will have it as a second parameter.\n * @param resultSelector A function to transform results. It takes the arguments from the event\n * handler and should return a single value.\n * @return Observable which, when an event happens, emits first parameter passed to registered\n * event handler. Alternatively it emits whatever project function returns at that moment.\n */\nexport function fromEventPattern<T>(\n addHandler: (handler: NodeEventHandler) => any,\n removeHandler?: (handler: NodeEventHandler, signal?: any) => void,\n resultSelector?: (...args: any[]) => T\n): Observable<T | T[]> {\n if (resultSelector) {\n return fromEventPattern<T>(addHandler, removeHandler).pipe(mapOneOrManyArgs(resultSelector));\n }\n\n return new Observable<T | T[]>((subscriber) => {\n const handler = (...e: T[]) => subscriber.next(e.length === 1 ? e[0] : e);\n const retValue = addHandler(handler);\n return isFunction(removeHandler) ? () => removeHandler(handler, retValue) : undefined;\n });\n}\n", "import { Observable } from '../Observable';\nimport { identity } from '../util/identity';\nimport { ObservableInput, SchedulerLike } from '../types';\nimport { isScheduler } from '../util/isScheduler';\nimport { defer } from './defer';\nimport { scheduleIterable } from '../scheduled/scheduleIterable';\n\ntype ConditionFunc<S> = (state: S) => boolean;\ntype IterateFunc<S> = (state: S) => S;\ntype ResultFunc<S, T> = (state: S) => T;\n\nexport interface GenerateBaseOptions<S> {\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<S>;\n /**\n * Iterate function that accepts state and returns new state.\n */\n iterate: IterateFunc<S>;\n /**\n * SchedulerLike to use for generation process.\n * By default, a generator starts immediately.\n */\n scheduler?: SchedulerLike;\n}\n\nexport interface GenerateOptions<T, S> extends GenerateBaseOptions<S> {\n /**\n * Result selection function that accepts state and returns a value to emit.\n */\n resultSelector: ResultFunc<S, T>;\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 * ## Examples\n *\n * Produces sequence of numbers\n *\n * ```ts\n * import { generate } from 'rxjs';\n *\n * const result = generate(0, x => x < 3, x => x + 1, x => x);\n *\n * result.subscribe(x => console.log(x));\n *\n * // Logs:\n * // 0\n * // 1\n * // 2\n * ```\n *\n * Use `asapScheduler`\n *\n * ```ts\n * import { generate, asapScheduler } from 'rxjs';\n *\n * const result = generate(1, x => x < 5, x => x * 2, x => x + 1, asapScheduler);\n *\n * result.subscribe(x => console.log(x));\n *\n * // Logs:\n * // 2\n * // 3\n * // 5\n * ```\n *\n * @see {@link from}\n * @see {@link Observable}\n *\n * @param initialState Initial state.\n * @param condition Condition to terminate generation (upon returning false).\n * @param iterate Iteration step function.\n * @param resultSelector Selector function for results produced in the sequence.\n * @param scheduler A {@link SchedulerLike} on which to run the generator loop.\n * If not provided, defaults to emit immediately.\n * @returns The generated sequence.\n * @deprecated Instead of passing separate arguments, use the options argument.\n * Signatures taking separate arguments will be removed in v8.\n */\nexport function generate<T, S>(\n initialState: S,\n condition: ConditionFunc<S>,\n iterate: IterateFunc<S>,\n resultSelector: ResultFunc<S, T>,\n scheduler?: SchedulerLike\n): Observable<T>;\n\n/**\n * Generates an Observable by running a state-driven loop\n * that emits an element on each iteration.\n *\n * <span class=\"informal\">Use it instead of nexting values in a for loop.</span>\n *\n * ![](generate.png)\n *\n * `generate` allows you to create a stream of values generated with a loop very similar to\n * a traditional for loop. The first argument of `generate` is a beginning value. The second argument\n * is a function that accepts this value and tests if some condition still holds. If it does,\n * then the loop continues, if not, it stops. The third value is a function which takes the\n * previously defined value and modifies it in some way on each iteration. Note how these three parameters\n * are direct equivalents of three expressions in a traditional for loop: the first expression\n * initializes some state (for example, a numeric index), the second tests if the loop can perform the next\n * iteration (for example, if the index is lower than 10) and the third states how the defined value\n * will be modified on every step (for example, the 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 of all, the condition function is ran. If it returns true, then the Observable\n * emits the currently stored value (initial value at the first iteration) and finally updates\n * that value with iterate function. If at some point the condition returns false, then the Observable\n * completes at that moment.\n *\n * Optionally you can pass a fourth parameter to `generate` - a result selector function which allows you\n * to immediately map the 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 * a single object to the operator instead where the object has the 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, or in other words the resulting Observable will never complete.\n *\n * Both forms of `generate` can optionally accept a scheduler. In case of a multi-parameter call,\n * scheduler simply comes as a last argument (no matter if there is a `resultSelector`\n * function or not). In case of a single-parameter call, you can provide it as a\n * `scheduler` property on the object passed to the operator. In both cases, a scheduler decides when\n * the next iteration of the loop will happen and therefore when the next value will be emitted\n * by the Observable. For example, to ensure that each value is pushed to the Observer\n * on a separate task in the event loop, you could use the `async` scheduler. Note that\n * by default (when no scheduler is passed) values are simply emitted synchronously.\n *\n *\n * ## Examples\n *\n * Use with condition and iterate functions\n *\n * ```ts\n * import { generate } from 'rxjs';\n *\n * const result = generate(0, x => x < 3, x => x + 1);\n *\n * result.subscribe({\n * next: value => console.log(value),\n * complete: () => console.log('Complete!')\n * });\n *\n * // Logs:\n * // 0\n * // 1\n * // 2\n * // 'Complete!'\n * ```\n *\n * Use with condition, iterate and resultSelector functions\n *\n * ```ts\n * import { generate } from 'rxjs';\n *\n * const result = generate(0, x => x < 3, x => x + 1, x => x * 1000);\n *\n * result.subscribe({\n * next: value => console.log(value),\n * complete: () => console.log('Complete!')\n * });\n *\n * // Logs:\n * // 0\n * // 1000\n * // 2000\n * // 'Complete!'\n * ```\n *\n * Use with options object\n *\n * ```ts\n * import { generate } from 'rxjs';\n *\n * const result = 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 * result.subscribe({\n * next: value => console.log(value),\n * complete: () => console.log('Complete!')\n * });\n *\n * // Logs:\n * // 0\n * // 1000\n * // 2000\n * // 'Complete!'\n * ```\n *\n * Use options object without condition function\n *\n * ```ts\n * import { generate } from 'rxjs';\n *\n * const result = generate({\n * initialState: 0,\n * iterate(value) { return value + 1; },\n * resultSelector(value) { return value * 1000; }\n * });\n *\n * result.subscribe({\n * next: value => console.log(value),\n * complete: () => console.log('Complete!') // 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 *\n * @param initialState Initial state.\n * @param condition Condition to terminate generation (upon returning false).\n * @param iterate Iteration step function.\n * @param scheduler A {@link Scheduler} on which to run the generator loop. If not\n * provided, defaults to emitting immediately.\n * @return The generated sequence.\n * @deprecated Instead of passing separate arguments, use the options argument.\n * Signatures taking separate arguments will be removed in v8.\n */\nexport function generate<S>(\n initialState: S,\n condition: ConditionFunc<S>,\n iterate: IterateFunc<S>,\n scheduler?: SchedulerLike\n): Observable<S>;\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 * ## Examples\n *\n * Use options object with condition function\n *\n * ```ts\n * import { generate } from 'rxjs';\n *\n * const result = generate({\n * initialState: 0,\n * condition: x => x < 3,\n * iterate: x => x + 1\n * });\n *\n * result.subscribe({\n * next: value => console.log(value),\n * complete: () => console.log('Complete!')\n * });\n *\n * // Logs:\n * // 0\n * // 1\n * // 2\n * // 'Complete!'\n * ```\n *\n * @see {@link from}\n * @see {@link Observable}\n *\n * @param options Object that must contain initialState, iterate and might contain condition and scheduler.\n * @returns The generated sequence.\n */\nexport function generate<S>(options: GenerateBaseOptions<S>): Observable<S>;\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 * ## Examples\n *\n * Use options object with condition and iterate function\n *\n * ```ts\n * import { generate } from 'rxjs';\n *\n * const result = generate({\n * initialState: 0,\n * condition: x => x < 3,\n * iterate: x => x + 1,\n * resultSelector: x => x\n * });\n *\n * result.subscribe({\n * next: value => console.log(value),\n * complete: () => console.log('Complete!')\n * });\n *\n * // Logs:\n * // 0\n * // 1\n * // 2\n * // 'Complete!'\n * ```\n *\n * @see {@link from}\n * @see {@link Observable}\n *\n * @param options Object that must contain initialState, iterate, resultSelector and might contain condition and scheduler.\n * @returns The generated sequence.\n */\nexport function generate<T, S>(options: GenerateOptions<T, S>): Observable<T>;\n\nexport function generate<T, S>(\n initialStateOrOptions: S | GenerateOptions<T, S>,\n condition?: ConditionFunc<S>,\n iterate?: IterateFunc<S>,\n resultSelectorOrScheduler?: ResultFunc<S, T> | SchedulerLike,\n scheduler?: SchedulerLike\n): Observable<T> {\n let resultSelector: ResultFunc<S, T>;\n let initialState: S;\n\n // TODO: Remove this as we move away from deprecated signatures\n // and move towards a configuration object argument.\n if (arguments.length === 1) {\n // If we only have one argument, we can assume it is a configuration object.\n // Note that folks not using TypeScript may trip over this.\n ({\n initialState,\n condition,\n iterate,\n resultSelector = identity as ResultFunc<S, T>,\n scheduler,\n } = initialStateOrOptions as GenerateOptions<T, S>);\n } else {\n // Deprecated arguments path. Figure out what the user\n // passed and set it here.\n initialState = initialStateOrOptions as S;\n if (!resultSelectorOrScheduler || isScheduler(resultSelectorOrScheduler)) {\n resultSelector = identity as ResultFunc<S, T>;\n scheduler = resultSelectorOrScheduler as SchedulerLike;\n } else {\n resultSelector = resultSelectorOrScheduler as ResultFunc<S, T>;\n }\n }\n\n // The actual generator used to \"generate\" values.\n function* gen() {\n for (let state = initialState; !condition || condition(state); state = iterate!(state)) {\n yield resultSelector(state);\n }\n }\n\n // We use `defer` because we want to defer the creation of the iterator from the iterable.\n return defer(\n (scheduler\n ? // If a scheduler was provided, use `scheduleIterable` to ensure that iteration/generation\n // happens on the scheduler.\n () => scheduleIterable(gen(), scheduler!)\n : // Otherwise, if there's no scheduler, we can just use the generator function directly in\n // `defer` and executing it will return the generator (which is iterable).\n gen) as () => ObservableInput<T>\n );\n}\n", "import { Observable } from '../Observable';\nimport { defer } from './defer';\nimport { ObservableInput } from '../types';\n\n/**\n * Checks a boolean at subscription time, and chooses between one of two observable sources\n *\n * `iif` expects a function that returns a boolean (the `condition` function), and two sources,\n * the `trueResult` and the `falseResult`, and returns an Observable.\n *\n * At the moment of subscription, the `condition` function is called. If the result is `true`, the\n * subscription will be to the source passed as the `trueResult`, otherwise, the subscription will be\n * to the source passed as the `falseResult`.\n *\n * If you need to check more than two options to choose between more than one observable, have a look at the {@link defer} creation method.\n *\n * ## Examples\n *\n * Change at runtime which Observable will be subscribed\n *\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 * Control access to an Observable\n *\n * ```ts\n * import { iif, of, EMPTY } from 'rxjs';\n *\n * let accessGranted;\n * const observableIfYouHaveAccess = iif(\n * () => accessGranted,\n * of('It seems you have an access...'),\n * EMPTY\n * );\n *\n * accessGranted = true;\n * observableIfYouHaveAccess.subscribe({\n * next: value => console.log(value),\n * complete: () => 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 * next: value => console.log(value),\n * complete: () => console.log('The end')\n * });\n *\n * // Logs:\n * // 'The end'\n * ```\n *\n * @see {@link defer}\n *\n * @param condition Condition which Observable should be chosen.\n * @param trueResult An Observable that will be subscribed if condition is true.\n * @param falseResult An Observable that will be subscribed if condition is false.\n * @return An observable that proxies to `trueResult` or `falseResult`, depending on the result of the `condition` function.\n */\nexport function iif<T, F>(condition: () => boolean, trueResult: ObservableInput<T>, falseResult: ObservableInput<F>): Observable<T | F> {\n return defer(() => (condition() ? trueResult : falseResult));\n}\n", "import { Observable } from '../Observable';\nimport { SchedulerLike } from '../types';\nimport { async as asyncScheduler } from '../scheduler/async';\nimport { isScheduler } from '../util/isScheduler';\nimport { isValidDate } from '../util/isDate';\n\n/**\n * Creates an observable that will wait for a specified time period, or exact date, before\n * emitting the number 0.\n *\n * <span class=\"informal\">Used to emit a notification after a delay.</span>\n *\n * This observable is useful for creating delays in code, or racing against other values\n * for ad-hoc timeouts.\n *\n * The `delay` is specified by default in milliseconds, however providing a custom scheduler could\n * create a different behavior.\n *\n * ## Examples\n *\n * Wait 3 seconds and start another observable\n *\n * You might want to use `timer` to delay subscription to an\n * observable by a set amount of time. Here we use a timer with\n * {@link concatMapTo} or {@link concatMap} in order to wait\n * a few seconds and start a subscription to a source.\n *\n * ```ts\n * import { of, timer, concatMap } from 'rxjs';\n *\n * // This could be any observable\n * const source = of(1, 2, 3);\n *\n * timer(3000)\n * .pipe(concatMap(() => source))\n * .subscribe(console.log);\n * ```\n *\n * Take all values until the start of the next minute\n *\n * Using a `Date` as the trigger for the first emission, you can\n * do things like wait until midnight to fire an event, or in this case,\n * wait until a new minute starts (chosen so the example wouldn't take\n * too long to run) in order to stop watching a stream. Leveraging\n * {@link takeUntil}.\n *\n * ```ts\n * import { interval, takeUntil, timer } from 'rxjs';\n *\n * // Build a Date object that marks the\n * // next minute.\n * const currentDate = new Date();\n * const startOfNextMinute = new Date(\n * currentDate.getFullYear(),\n * currentDate.getMonth(),\n * currentDate.getDate(),\n * currentDate.getHours(),\n * currentDate.getMinutes() + 1\n * );\n *\n * // This could be any observable stream\n * const source = interval(1000);\n *\n * const result = source.pipe(\n * takeUntil(timer(startOfNextMinute))\n * );\n *\n * result.subscribe(console.log);\n * ```\n *\n * ### Known Limitations\n *\n * - The {@link asyncScheduler} uses `setTimeout` which has limitations for how far in the future it can be scheduled.\n *\n * - If a `scheduler` is provided that returns a timestamp other than an epoch from `now()`, and\n * a `Date` object is passed to the `dueTime` argument, the calculation for when the first emission\n * should occur will be incorrect. In this case, it would be best to do your own calculations\n * ahead of time, and pass a `number` in as the `dueTime`.\n *\n * @param due If a `number`, the amount of time in milliseconds to wait before emitting.\n * If a `Date`, the exact time at which to emit.\n * @param scheduler The scheduler to use to schedule the delay. Defaults to {@link asyncScheduler}.\n */\nexport function timer(due: number | Date, scheduler?: SchedulerLike): Observable<0>;\n\n/**\n * Creates an observable that starts an interval after a specified delay, emitting incrementing numbers -- starting at `0` --\n * on each interval after words.\n *\n * The `delay` and `intervalDuration` are specified by default in milliseconds, however providing a custom scheduler could\n * create a different behavior.\n *\n * ## Example\n *\n * ### Start an interval that starts right away\n *\n * Since {@link interval} waits for the passed delay before starting,\n * sometimes that's not ideal. You may want to start an interval immediately.\n * `timer` works well for this. Here we have both side-by-side so you can\n * see them in comparison.\n *\n * Note that this observable will never complete.\n *\n * ```ts\n * import { timer, interval } from 'rxjs';\n *\n * timer(0, 1000).subscribe(n => console.log('timer', n));\n * interval(1000).subscribe(n => console.log('interval', n));\n * ```\n *\n * ### Known Limitations\n *\n * - The {@link asyncScheduler} uses `setTimeout` which has limitations for how far in the future it can be scheduled.\n *\n * - If a `scheduler` is provided that returns a timestamp other than an epoch from `now()`, and\n * a `Date` object is passed to the `dueTime` argument, the calculation for when the first emission\n * should occur will be incorrect. In this case, it would be best to do your own calculations\n * ahead of time, and pass a `number` in as the `startDue`.\n * @param startDue If a `number`, is the time to wait before starting the interval.\n * If a `Date`, is the exact time at which to start the interval.\n * @param intervalDuration The delay between each value emitted in the interval. Passing a\n * negative number here will result in immediate completion after the first value is emitted, as though\n * no `intervalDuration` was passed at all.\n * @param scheduler The scheduler to use to schedule the delay. Defaults to {@link asyncScheduler}.\n */\nexport function timer(startDue: number | Date, intervalDuration: number, scheduler?: SchedulerLike): Observable<number>;\n\n/**\n * @deprecated The signature allowing `undefined` to be passed for `intervalDuration` will be removed in v8. Use the `timer(dueTime, scheduler?)` signature instead.\n */\nexport function timer(dueTime: number | Date, unused: undefined, scheduler?: SchedulerLike): Observable<0>;\n\nexport function timer(\n dueTime: number | Date = 0,\n intervalOrScheduler?: number | SchedulerLike,\n scheduler: SchedulerLike = asyncScheduler\n): Observable<number> {\n // Since negative intervalDuration is treated as though no\n // interval was specified at all, we start with a negative number.\n let intervalDuration = -1;\n\n if (intervalOrScheduler != null) {\n // If we have a second argument, and it's a scheduler,\n // override the scheduler we had defaulted. Otherwise,\n // it must be an interval.\n if (isScheduler(intervalOrScheduler)) {\n scheduler = intervalOrScheduler;\n } else {\n // Note that this *could* be negative, in which case\n // it's like not passing an intervalDuration at all.\n intervalDuration = intervalOrScheduler;\n }\n }\n\n return new Observable((subscriber) => {\n // If a valid date is passed, calculate how long to wait before\n // executing the first value... otherwise, if it's a number just schedule\n // that many milliseconds (or scheduler-specified unit size) in the future.\n let due = isValidDate(dueTime) ? +dueTime - scheduler!.now() : dueTime;\n\n if (due < 0) {\n // Ensure we don't schedule in the future.\n due = 0;\n }\n\n // The incrementing value we emit.\n let n = 0;\n\n // Start the timer.\n return scheduler.schedule(function () {\n if (!subscriber.closed) {\n // Emit the next value and increment.\n subscriber.next(n++);\n\n if (0 <= intervalDuration) {\n // If we have a interval after the initial timer,\n // reschedule with the period.\n this.schedule(undefined, intervalDuration);\n } else {\n // We didn't have an interval. So just complete.\n subscriber.complete();\n }\n }\n }, due);\n });\n}\n", "import { Observable } from '../Observable';\nimport { asyncScheduler } from '../scheduler/async';\nimport { SchedulerLike } from '../types';\nimport { timer } from './timer';\n\n/**\n * Creates an Observable that emits sequential numbers every specified\n * interval of time, on a specified {@link SchedulerLike}.\n *\n * <span class=\"informal\">Emits incremental numbers periodically in time.</span>\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 *\n * Emits ascending numbers, one every second (1000ms) up to the number 3\n *\n * ```ts\n * import { interval, take } from 'rxjs';\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 period The interval size in milliseconds (by default) or the time unit determined\n * by the scheduler's clock.\n * @param scheduler The {@link SchedulerLike} to use for scheduling the emission of values,\n * and providing a notion of \"time\".\n * @return An Observable that emits a sequential number each time interval.\n */\nexport function interval(period = 0, scheduler: SchedulerLike = asyncScheduler): Observable<number> {\n if (period < 0) {\n // We cannot schedule an interval in the past.\n period = 0;\n }\n\n return timer(period, period, scheduler);\n}\n", "import { Observable } from '../Observable';\nimport { ObservableInput, ObservableInputTuple, SchedulerLike } from '../types';\nimport { mergeAll } from '../operators/mergeAll';\nimport { innerFrom } from './innerFrom';\nimport { EMPTY } from './empty';\nimport { popNumber, popScheduler } from '../util/args';\nimport { from } from './from';\n\nexport function merge<A extends readonly unknown[]>(...sources: [...ObservableInputTuple<A>]): Observable<A[number]>;\nexport function merge<A extends readonly unknown[]>(...sourcesAndConcurrency: [...ObservableInputTuple<A>, number?]): Observable<A[number]>;\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `mergeAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function merge<A extends readonly unknown[]>(\n ...sourcesAndScheduler: [...ObservableInputTuple<A>, SchedulerLike?]\n): Observable<A[number]>;\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `mergeAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function merge<A extends readonly unknown[]>(\n ...sourcesAndConcurrencyAndScheduler: [...ObservableInputTuple<A>, number?, SchedulerLike?]\n): Observable<A[number]>;\n\n/**\n * Creates an output Observable which concurrently emits all values from every\n * given input Observable.\n *\n * <span class=\"informal\">Flattens multiple Observables together by blending\n * their values into one Observable.</span>\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 *\n * Merge together two Observables: 1s interval and clicks\n *\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 every time 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 run only 2 concurrently\n *\n * ```ts\n * import { interval, take, merge } from 'rxjs';\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 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 its max iteration, timer2 will\n * // continue, and timer3 will start to run concurrently with timer2\n * // - when timer2 hits its 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 args `ObservableInput`s to merge together. If the last parameter\n * is of type number, `merge` will use it to limit number of concurrently\n * subscribed `ObservableInput`s. If the last parameter is {@link SchedulerLike},\n * it will be used for scheduling the emission of values.\n * @return An Observable that emits items that are the result of every input Observable.\n */\nexport function merge(...args: (ObservableInput<unknown> | number | SchedulerLike)[]): Observable<unknown> {\n const scheduler = popScheduler(args);\n const concurrent = popNumber(args, Infinity);\n const sources = args as ObservableInput<unknown>[];\n return !sources.length\n ? // No source provided\n EMPTY\n : sources.length === 1\n ? // One source? Just return it.\n innerFrom(sources[0])\n : // Merge all sources\n mergeAll(concurrent)(from(sources, scheduler));\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 *\n * Emit the number 7, then never emit anything else (not even complete)\n *\n * ```ts\n * import { NEVER, startWith } from 'rxjs';\n *\n * const info = () => console.log('Will not be called');\n *\n * const result = NEVER.pipe(startWith(7));\n * result.subscribe({\n * next: x => console.log(x),\n * error: info,\n * complete: info\n * });\n * ```\n *\n * @see {@link Observable}\n * @see {@link EMPTY}\n * @see {@link of}\n * @see {@link throwError}\n */\nexport const NEVER = new Observable<never>(noop);\n\n/**\n * @deprecated Replaced with the {@link NEVER} constant. Will be removed in v8.\n */\nexport function never() {\n return NEVER;\n}\n", "const { isArray } = Array;\n\n/**\n * Used in operators and functions that accept either a list of arguments, or an array of arguments\n * as a single argument.\n */\nexport function argsOrArgArray<T>(args: (T | T[])[]): T[] {\n return args.length === 1 && isArray(args[0]) ? args[0] : (args as T[]);\n}\n", "import { Observable } from '../Observable';\nimport { ObservableInputTuple } from '../types';\nimport { argsOrArgArray } from '../util/argsOrArgArray';\nimport { OperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { noop } from '../util/noop';\nimport { innerFrom } from './innerFrom';\n\nexport function onErrorResumeNext<A extends readonly unknown[]>(sources: [...ObservableInputTuple<A>]): Observable<A[number]>;\nexport function onErrorResumeNext<A extends readonly unknown[]>(...sources: [...ObservableInputTuple<A>]): Observable<A[number]>;\n\n/**\n * When any of the provided Observable emits a complete or an error notification, it immediately subscribes to the next one\n * that was passed.\n *\n * <span class=\"informal\">Execute series of Observables no matter what, even if it means swallowing errors.</span>\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 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 *\n * Subscribe to the next Observable after map fails\n *\n * ```ts\n * import { onErrorResumeNext, of, map } from 'rxjs';\n *\n * onErrorResumeNext(\n * of(1, 2, 3, 0).pipe(\n * map(x => {\n * if (x === 0) {\n * throw Error();\n * }\n * return 10 / x;\n * })\n * ),\n * of(1, 2, 3)\n * )\n * .subscribe({\n * next: value => console.log(value),\n * error: err => console.log(err), // Will never be called.\n * complete: () => 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 sources `ObservableInput`s passed either directly or as an array.\n * @return 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<A extends readonly unknown[]>(\n ...sources: [[...ObservableInputTuple<A>]] | [...ObservableInputTuple<A>]\n): Observable<A[number]> {\n const nextSources: ObservableInputTuple<A> = argsOrArgArray(sources) as any;\n\n return new Observable((subscriber) => {\n let sourceIndex = 0;\n const subscribeNext = () => {\n if (sourceIndex < nextSources.length) {\n let nextSource: Observable<A[number]>;\n try {\n nextSource = innerFrom(nextSources[sourceIndex++]);\n } catch (err) {\n subscribeNext();\n return;\n }\n const innerSubscriber = new OperatorSubscriber(subscriber, undefined, noop, noop);\n nextSource.subscribe(innerSubscriber);\n innerSubscriber.add(subscribeNext);\n } else {\n subscriber.complete();\n }\n };\n subscribeNext();\n });\n}\n", "import { Observable } from '../Observable';\nimport { SchedulerLike } from '../types';\nimport { from } from './from';\n\n/**\n * @deprecated Use `from(Object.entries(obj))` instead. Will be removed in v8.\n */\nexport function pairs<T>(arr: readonly T[], scheduler?: SchedulerLike): Observable<[string, T]>;\n/**\n * @deprecated Use `from(Object.entries(obj))` instead. Will be removed in v8.\n */\nexport function pairs<O extends Record<string, unknown>>(obj: O, scheduler?: SchedulerLike): Observable<[keyof O, O[keyof O]]>;\n/**\n * @deprecated Use `from(Object.entries(obj))` instead. Will be removed in v8.\n */\nexport function pairs<T>(iterable: Iterable<T>, scheduler?: SchedulerLike): Observable<[string, T]>;\n/**\n * @deprecated Use `from(Object.entries(obj))` instead. Will be removed in v8.\n */\nexport function pairs(\n n: number | bigint | boolean | ((...args: any[]) => any) | symbol,\n scheduler?: SchedulerLike\n): Observable<[never, never]>;\n\n/**\n * Convert an object into an Observable of `[key, value]` pairs.\n *\n * <span class=\"informal\">Turn entries of an object into a stream.</span>\n *\n * ![](pairs.png)\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\n *\n * Converts an object to an Observable\n *\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).subscribe({\n * next: value => console.log(value),\n * complete: () => console.log('Complete!')\n * });\n *\n * // Logs:\n * // ['foo', 42]\n * // ['bar', 56]\n * // ['baz', 78]\n * // 'Complete!'\n * ```\n *\n * ### Object.entries required\n *\n * In IE, you will need to polyfill `Object.entries` in order to use this.\n * [MDN has a polyfill here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries)\n *\n * @param obj The object to inspect and turn into an Observable sequence.\n * @param scheduler An optional IScheduler to schedule when resulting\n * Observable will emit values.\n * @returns An observable sequence of [key, value] pairs from the object.\n * @deprecated Use `from(Object.entries(obj))` instead. Will be removed in v8.\n */\nexport function pairs(obj: any, scheduler?: SchedulerLike) {\n return from(Object.entries(obj), scheduler as any);\n}\n", "export function not<T>(pred: (value: T, index: number) => boolean, thisArg: any): (value: T, index: number) => boolean {\n return (value: T, index: number) => !pred.call(thisArg, value, index); \n}", "import { OperatorFunction, MonoTypeOperatorFunction, TruthyTypesOf } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */\nexport function filter<T, S extends T, A>(predicate: (this: A, value: T, index: number) => value is S, thisArg: A): OperatorFunction<T, S>;\nexport function filter<T, S extends T>(predicate: (value: T, index: number) => value is S): OperatorFunction<T, S>;\nexport function filter<T>(predicate: BooleanConstructor): OperatorFunction<T, TruthyTypesOf<T>>;\n/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */\nexport function filter<T, A>(predicate: (this: A, value: T, index: number) => boolean, thisArg: A): MonoTypeOperatorFunction<T>;\nexport function filter<T>(predicate: (value: T, index: number) => boolean): MonoTypeOperatorFunction<T>;\n\n/**\n * Filter items emitted by the source Observable by only emitting those that\n * satisfy a specified predicate.\n *\n * <span class=\"informal\">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.</span>\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 *\n * Emit only click events whose target was a DIV element\n *\n * ```ts\n * import { fromEvent, filter } from 'rxjs';\n *\n * const div = document.createElement('div');\n * div.style.cssText = 'width: 200px; height: 200px; background: #09c;';\n * document.body.appendChild(div);\n *\n * const clicks = fromEvent(document, 'click');\n * const clicksOnDivs = clicks.pipe(filter(ev => (<HTMLElement>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 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 thisArg An optional argument to determine the value of `this`\n * in the `predicate` function.\n * @return A function that returns an Observable that emits items from the\n * source Observable that satisfy the specified `predicate`.\n */\nexport function filter<T>(predicate: (value: T, index: number) => boolean, thisArg?: any): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n // An index passed to our predicate function on each call.\n let index = 0;\n\n // Subscribe to the source, all errors and completions are\n // forwarded to the consumer.\n source.subscribe(\n // Call the predicate with the appropriate `this` context,\n // if the predicate returns `true`, then send the value\n // to the consumer.\n createOperatorSubscriber(subscriber, (value) => predicate.call(thisArg, value, index++) && subscriber.next(value))\n );\n });\n}\n", "import { not } from '../util/not';\nimport { filter } from '../operators/filter';\nimport { ObservableInput } from '../types';\nimport { Observable } from '../Observable';\nimport { innerFrom } from './innerFrom';\n\n/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */\nexport function partition<T, U extends T, A>(\n source: ObservableInput<T>,\n predicate: (this: A, value: T, index: number) => value is U,\n thisArg: A\n): [Observable<U>, Observable<Exclude<T, U>>];\nexport function partition<T, U extends T>(\n source: ObservableInput<T>,\n predicate: (value: T, index: number) => value is U\n): [Observable<U>, Observable<Exclude<T, U>>];\n\n/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */\nexport function partition<T, A>(\n source: ObservableInput<T>,\n predicate: (this: A, value: T, index: number) => boolean,\n thisArg: A\n): [Observable<T>, Observable<T>];\nexport function partition<T>(source: ObservableInput<T>, predicate: (value: T, index: number) => boolean): [Observable<T>, Observable<T>];\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 * <span class=\"informal\">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.</span>\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 *\n * Partition a set of numbers into odds and evens observables\n *\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 => 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 source The source `ObservableInput` that will be split into a tuple of\n * two Observable elements.\n * @param predicate A function that evaluates each value emitted by the source\n * Observable. If it returns `true`, the value is emitted on the first Observable\n * in the returned array, if `false` the value is emitted on the second Observable\n * in the array. The `index` parameter is the number `i` for the i-th source\n * emission that has happened since the subscription, starting from the number `0`.\n * @param thisArg An optional argument to determine the value of `this` in the\n * `predicate` function.\n * @return An array with two Observables: one with values that passed the\n * predicate, and another with values that did not pass the predicate.\n */\nexport function partition<T>(\n source: ObservableInput<T>,\n predicate: (this: any, value: T, index: number) => boolean,\n thisArg?: any\n): [Observable<T>, Observable<T>] {\n return [filter(predicate, thisArg)(innerFrom(source)), filter(not(predicate, thisArg))(innerFrom(source))] as [\n Observable<T>,\n Observable<T>\n ];\n}\n", "import { Observable } from '../Observable';\nimport { innerFrom } from './innerFrom';\nimport { Subscription } from '../Subscription';\nimport { ObservableInput, ObservableInputTuple } from '../types';\nimport { argsOrArgArray } from '../util/argsOrArgArray';\nimport { createOperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { Subscriber } from '../Subscriber';\n\nexport function race<T extends readonly unknown[]>(inputs: [...ObservableInputTuple<T>]): Observable<T[number]>;\nexport function race<T extends readonly unknown[]>(...inputs: [...ObservableInputTuple<T>]): Observable<T[number]>;\n\n/**\n * Returns an observable that mirrors the first source observable to emit an item.\n *\n * ![](race.png)\n *\n * `race` returns an observable, that when subscribed to, subscribes to all source observables immediately.\n * As soon as one of the source observables emits a value, the result unsubscribes from the other sources.\n * The resulting observable will forward all notifications, including error and completion, from the \"winning\"\n * source observable.\n *\n * If one of the used source observable throws an errors before a first notification\n * the race operator will also throw an error, no matter if another source observable\n * could potentially win the race.\n *\n * `race` can be useful for selecting the response from the fastest network connection for\n * HTTP or WebSockets. `race` can also be useful for switching observable context based on user\n * input.\n *\n * ## Example\n *\n * Subscribes to the observable that was the first to start emitting.\n *\n * ```ts\n * import { interval, map, race } from 'rxjs';\n *\n * const obs1 = interval(7000).pipe(map(() => 'slow one'));\n * const obs2 = interval(3000).pipe(map(() => 'fast one'));\n * const obs3 = interval(5000).pipe(map(() => 'medium one'));\n *\n * race(obs1, obs2, obs3)\n * .subscribe(winner => console.log(winner));\n *\n * // Outputs\n * // a series of 'fast one'\n * ```\n *\n * @param sources Used to race for which `ObservableInput` emits first.\n * @return An Observable that mirrors the output of the first Observable to emit an item.\n */\nexport function race<T>(...sources: (ObservableInput<T> | ObservableInput<T>[])[]): Observable<any> {\n sources = argsOrArgArray(sources);\n // If only one source was passed, just return it. Otherwise return the race.\n return sources.length === 1 ? innerFrom(sources[0] as ObservableInput<T>) : new Observable<T>(raceInit(sources as ObservableInput<T>[]));\n}\n\n/**\n * An observable initializer function for both the static version and the\n * operator version of race.\n * @param sources The sources to race\n */\nexport function raceInit<T>(sources: ObservableInput<T>[]) {\n return (subscriber: Subscriber<T>) => {\n let subscriptions: Subscription[] = [];\n\n // Subscribe to all of the sources. Note that we are checking `subscriptions` here\n // Is is an array of all actively \"racing\" subscriptions, and it is `null` after the\n // race has been won. So, if we have racer that synchronously \"wins\", this loop will\n // stop before it subscribes to any more.\n for (let i = 0; subscriptions && !subscriber.closed && i < sources.length; i++) {\n subscriptions.push(\n innerFrom(sources[i] as ObservableInput<T>).subscribe(\n createOperatorSubscriber(subscriber, (value) => {\n if (subscriptions) {\n // We're still racing, but we won! So unsubscribe\n // all other subscriptions that we have, except this one.\n for (let s = 0; s < subscriptions.length; s++) {\n s !== i && subscriptions[s].unsubscribe();\n }\n subscriptions = null!;\n }\n subscriber.next(value);\n })\n )\n );\n }\n };\n}\n", "import { SchedulerLike } from '../types';\nimport { Observable } from '../Observable';\nimport { EMPTY } from './empty';\n\nexport function range(start: number, count?: number): Observable<number>;\n\n/**\n * @deprecated The `scheduler` parameter will be removed in v8. Use `range(start, count).pipe(observeOn(scheduler))` instead. Details: Details: https://rxjs.dev/deprecations/scheduler-argument\n */\nexport function range(start: number, count: number | undefined, scheduler: SchedulerLike): Observable<number>;\n\n/**\n * Creates an Observable that emits a sequence of numbers within a specified\n * range.\n *\n * <span class=\"informal\">Emits a sequence of numbers in a range.</span>\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 *\n * Produce a range of numbers\n *\n * ```ts\n * import { range } from 'rxjs';\n *\n * const numbers = range(1, 3);\n *\n * numbers.subscribe({\n * next: value => console.log(value),\n * complete: () => console.log('Complete!')\n * });\n *\n * // Logs:\n * // 1\n * // 2\n * // 3\n * // 'Complete!'\n * ```\n *\n * @see {@link timer}\n * @see {@link interval}\n *\n * @param start The value of the first integer in the sequence.\n * @param count The number of sequential integers to generate.\n * @param scheduler A {@link SchedulerLike} to use for scheduling the emissions\n * of the notifications.\n * @return An Observable of numbers that emits a finite range of sequential integers.\n */\nexport function range(start: number, count?: number, scheduler?: SchedulerLike): Observable<number> {\n if (count == null) {\n // If one argument was passed, it's the count, not the start.\n count = start;\n start = 0;\n }\n\n if (count <= 0) {\n // No count? We're going nowhere. Return EMPTY.\n return EMPTY;\n }\n\n // Where the range should stop.\n const end = count + start;\n\n return new Observable(\n scheduler\n ? // The deprecated scheduled path.\n (subscriber) => {\n let n = start;\n return scheduler.schedule(function () {\n if (n < end) {\n subscriber.next(n++);\n this.schedule();\n } else {\n subscriber.complete();\n }\n });\n }\n : // Standard synchronous range.\n (subscriber) => {\n let n = start;\n while (n < end && !subscriber.closed) {\n subscriber.next(n++);\n }\n subscriber.complete();\n }\n );\n}\n", "import { Observable } from '../Observable';\nimport { Unsubscribable, ObservableInput, ObservedValueOf } from '../types';\nimport { innerFrom } from './innerFrom';\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 * <span class=\"informal\">Use it when you catch yourself cleaning up after an Observable.</span>\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 resourceFactory A function which creates any resource object that implements `unsubscribe` method.\n * @param observableFactory A function which creates an Observable, that can use injected resource object.\n * @return 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<T extends ObservableInput<any>>(\n resourceFactory: () => Unsubscribable | void,\n observableFactory: (resource: Unsubscribable | void) => T | void\n): Observable<ObservedValueOf<T>> {\n return new Observable<ObservedValueOf<T>>((subscriber) => {\n const resource = resourceFactory();\n const result = observableFactory(resource);\n const source = result ? innerFrom(result) : EMPTY;\n source.subscribe(subscriber);\n return () => {\n // NOTE: Optional chaining did not work here.\n // Related TS Issue: https://github.com/microsoft/TypeScript/issues/40818\n if (resource) {\n resource.unsubscribe();\n }\n };\n });\n}\n", "import { Observable } from '../Observable';\nimport { ObservableInputTuple } from '../types';\nimport { innerFrom } from './innerFrom';\nimport { argsOrArgArray } from '../util/argsOrArgArray';\nimport { EMPTY } from './empty';\nimport { createOperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { popResultSelector } from '../util/args';\n\nexport function zip<A extends readonly unknown[]>(sources: [...ObservableInputTuple<A>]): Observable<A>;\nexport function zip<A extends readonly unknown[], R>(\n sources: [...ObservableInputTuple<A>],\n resultSelector: (...values: A) => R\n): Observable<R>;\nexport function zip<A extends readonly unknown[]>(...sources: [...ObservableInputTuple<A>]): Observable<A>;\nexport function zip<A extends readonly unknown[], R>(\n ...sourcesAndResultSelector: [...ObservableInputTuple<A>, (...values: A) => R]\n): Observable<R>;\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 *\n * Combine age and name from different sources\n *\n * ```ts\n * import { of, zip, map } from 'rxjs';\n *\n * const age$ = of(27, 25, 29);\n * const name$ = of('Foo', 'Bar', 'Beer');\n * const 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 *\n * @param args Any number of `ObservableInput`s provided either as an array or as an object\n * to combine with each other.\n * @return An Observable of array values of the values emitted at the same index from each\n * individual `ObservableInput`.\n */\nexport function zip(...args: unknown[]): Observable<unknown> {\n const resultSelector = popResultSelector(args);\n\n const sources = argsOrArgArray(args) as Observable<unknown>[];\n\n return sources.length\n ? new Observable<unknown[]>((subscriber) => {\n // A collection of buffers of values from each source.\n // Keyed by the same index with which the sources were passed in.\n let buffers: unknown[][] = sources.map(() => []);\n\n // An array of flags of whether or not the sources have completed.\n // This is used to check to see if we should complete the result.\n // Keyed by the same index with which the sources were passed in.\n let completed = sources.map(() => false);\n\n // When everything is done, release the arrays above.\n subscriber.add(() => {\n buffers = completed = null!;\n });\n\n // Loop over our sources and subscribe to each one. The index `i` is\n // especially important here, because we use it in closures below to\n // access the related buffers and completion properties\n for (let sourceIndex = 0; !subscriber.closed && sourceIndex < sources.length; sourceIndex++) {\n innerFrom(sources[sourceIndex]).subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => {\n buffers[sourceIndex].push(value);\n // if every buffer has at least one value in it, then we\n // can shift out the oldest value from each buffer and emit\n // them as an array.\n if (buffers.every((buffer) => buffer.length)) {\n const result: any = buffers.map((buffer) => buffer.shift()!);\n // Emit the array. If theres' a result selector, use that.\n subscriber.next(resultSelector ? resultSelector(...result) : result);\n // If any one of the sources is both complete and has an empty buffer\n // then we complete the result. This is because we cannot possibly have\n // any more values to zip together.\n if (buffers.some((buffer, i) => !buffer.length && completed[i])) {\n subscriber.complete();\n }\n }\n },\n () => {\n // This source completed. Mark it as complete so we can check it later\n // if we have to.\n completed[sourceIndex] = true;\n // But, if this complete source has nothing in its buffer, then we\n // can complete the result, because we can't possibly have any more\n // values from this to zip together with the other values.\n !buffers[sourceIndex].length && subscriber.complete();\n }\n )\n );\n }\n\n // When everything is done, release the arrays above.\n return () => {\n buffers = completed = null!;\n };\n })\n : EMPTY;\n}\n", "export {};\n//# sourceMappingURL=types.js.map", "import { Subscriber } from '../Subscriber';\nimport { MonoTypeOperatorFunction, ObservableInput } from '../types';\n\nimport { operate } from '../util/lift';\nimport { innerFrom } from '../observable/innerFrom';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Ignores source values for a duration determined by another Observable, then\n * emits the most recent value from the source Observable, then repeats this\n * process.\n *\n * <span class=\"informal\">It's like {@link auditTime}, but the silencing\n * duration is determined by a second Observable.</span>\n *\n * ![](audit.svg)\n *\n * `audit` is similar to `throttle`, but emits the last value from the silenced\n * time window, instead of the first value. `audit` emits the most recent value\n * from the source Observable on the output Observable as soon as its internal\n * timer becomes disabled, and ignores source values while the timer is enabled.\n * Initially, the timer is disabled. As soon as the first source value arrives,\n * the timer is enabled by calling the `durationSelector` function with the\n * source value, which returns the \"duration\" Observable. When the duration\n * Observable emits a value, the timer is disabled, then the most\n * recent source value is emitted on the output Observable, and this process\n * repeats for the next source value.\n *\n * ## Example\n *\n * Emit clicks at a rate of at most one click per second\n *\n * ```ts\n * import { fromEvent, audit, interval } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(audit(ev => interval(1000)));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link auditTime}\n * @see {@link debounce}\n * @see {@link delayWhen}\n * @see {@link sample}\n * @see {@link throttle}\n *\n * @param durationSelector A function\n * that receives a value from the source Observable, for computing the silencing\n * duration, returned as an Observable or a Promise.\n * @return A function that returns an Observable that performs rate-limiting of\n * emissions from the source Observable.\n */\nexport function audit<T>(durationSelector: (value: T) => ObservableInput<any>): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n let hasValue = false;\n let lastValue: T | null = null;\n let durationSubscriber: Subscriber<any> | null = null;\n let isComplete = false;\n\n const endDuration = () => {\n durationSubscriber?.unsubscribe();\n durationSubscriber = null;\n if (hasValue) {\n hasValue = false;\n const value = lastValue!;\n lastValue = null;\n subscriber.next(value);\n }\n isComplete && subscriber.complete();\n };\n\n const cleanupDuration = () => {\n durationSubscriber = null;\n isComplete && subscriber.complete();\n };\n\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => {\n hasValue = true;\n lastValue = value;\n if (!durationSubscriber) {\n innerFrom(durationSelector(value)).subscribe(\n (durationSubscriber = createOperatorSubscriber(subscriber, endDuration, cleanupDuration))\n );\n }\n },\n () => {\n isComplete = true;\n (!hasValue || !durationSubscriber || durationSubscriber.closed) && subscriber.complete();\n }\n )\n );\n });\n}\n", "import { asyncScheduler } from '../scheduler/async';\nimport { audit } from './audit';\nimport { timer } from '../observable/timer';\nimport { MonoTypeOperatorFunction, SchedulerLike } from '../types';\n\n/**\n * Ignores source values for `duration` milliseconds, then emits the most recent\n * value from the source Observable, then repeats this process.\n *\n * <span class=\"informal\">When it sees a source value, it ignores that plus\n * the next ones for `duration` milliseconds, and then it emits the most recent\n * value from the source.</span>\n *\n * ![](auditTime.png)\n *\n * `auditTime` is similar to `throttleTime`, but emits the last value from the\n * silenced time window, instead of the first value. `auditTime` emits the most\n * recent value from the source Observable on the output Observable as soon as\n * its internal timer becomes disabled, and ignores source values while the\n * timer is enabled. Initially, the timer is disabled. As soon as the first\n * source value arrives, the timer is enabled. After `duration` milliseconds (or\n * the time unit determined internally by the optional `scheduler`) has passed,\n * the timer is disabled, then the most recent source value is emitted on the\n * output Observable, and this process repeats for the next source value.\n * Optionally takes a {@link SchedulerLike} for managing timers.\n *\n * ## Example\n *\n * Emit clicks at a rate of at most one click per second\n *\n * ```ts\n * import { fromEvent, auditTime } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(auditTime(1000));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link audit}\n * @see {@link debounceTime}\n * @see {@link delay}\n * @see {@link sampleTime}\n * @see {@link throttleTime}\n *\n * @param duration Time to wait before emitting the most recent source value,\n * measured in milliseconds or the time unit determined internally by the\n * optional `scheduler`.\n * @param scheduler The {@link SchedulerLike} to use for managing the timers\n * that handle the rate-limiting behavior.\n * @return A function that returns an Observable that performs rate-limiting of\n * emissions from the source Observable.\n */\nexport function auditTime<T>(duration: number, scheduler: SchedulerLike = asyncScheduler): MonoTypeOperatorFunction<T> {\n return audit(() => timer(duration, scheduler));\n}\n", "import { OperatorFunction, ObservableInput } from '../types';\nimport { operate } from '../util/lift';\nimport { noop } from '../util/noop';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\n\n/**\n * Buffers the source Observable values until `closingNotifier` emits.\n *\n * <span class=\"informal\">Collects values from the past as an array, and emits\n * that array only when another Observable emits.</span>\n *\n * ![](buffer.png)\n *\n * Buffers the incoming Observable values until the given `closingNotifier`\n * `ObservableInput` (that internally gets converted to an Observable)\n * emits a value, at which point it emits the buffer on the output\n * Observable and starts a new buffer internally, awaiting the next time\n * `closingNotifier` emits.\n *\n * ## Example\n *\n * On every click, emit array of most recent interval events\n *\n * ```ts\n * import { fromEvent, interval, buffer } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const intervalEvents = interval(1000);\n * const buffered = intervalEvents.pipe(buffer(clicks));\n * buffered.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link bufferCount}\n * @see {@link bufferTime}\n * @see {@link bufferToggle}\n * @see {@link bufferWhen}\n * @see {@link window}\n *\n * @param closingNotifier An `ObservableInput` that signals the\n * buffer to be emitted on the output Observable.\n * @return A function that returns an Observable of buffers, which are arrays\n * of values.\n */\nexport function buffer<T>(closingNotifier: ObservableInput<any>): OperatorFunction<T, T[]> {\n return operate((source, subscriber) => {\n // The current buffered values.\n let currentBuffer: T[] = [];\n\n // Subscribe to our source.\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => currentBuffer.push(value),\n () => {\n subscriber.next(currentBuffer);\n subscriber.complete();\n }\n )\n );\n\n // Subscribe to the closing notifier.\n innerFrom(closingNotifier).subscribe(\n createOperatorSubscriber(\n subscriber,\n () => {\n // Start a new buffer and emit the previous one.\n const b = currentBuffer;\n currentBuffer = [];\n subscriber.next(b);\n },\n noop\n )\n );\n\n return () => {\n // Ensure buffered values are released on finalization.\n currentBuffer = null!;\n };\n });\n}\n", "import { OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { arrRemove } from '../util/arrRemove';\n\n/**\n * Buffers the source Observable values until the size hits the maximum\n * `bufferSize` given.\n *\n * <span class=\"informal\">Collects values from the past as an array, and emits\n * that array only when its size reaches `bufferSize`.</span>\n *\n * ![](bufferCount.png)\n *\n * Buffers a number of values from the source Observable by `bufferSize` then\n * emits the buffer and clears it, and starts a new buffer each\n * `startBufferEvery` values. If `startBufferEvery` is not provided or is\n * `null`, then new buffers are started immediately at the start of the source\n * and when each buffer closes and is emitted.\n *\n * ## Examples\n *\n * Emit the last two click events as an array\n *\n * ```ts\n * import { fromEvent, bufferCount } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const buffered = clicks.pipe(bufferCount(2));\n * buffered.subscribe(x => console.log(x));\n * ```\n *\n * On every click, emit the last two click events as an array\n *\n * ```ts\n * import { fromEvent, bufferCount } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const buffered = clicks.pipe(bufferCount(2, 1));\n * buffered.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link buffer}\n * @see {@link bufferTime}\n * @see {@link bufferToggle}\n * @see {@link bufferWhen}\n * @see {@link pairwise}\n * @see {@link windowCount}\n *\n * @param bufferSize The maximum size of the buffer emitted.\n * @param startBufferEvery Interval at which to start a new buffer.\n * For example if `startBufferEvery` is `2`, then a new buffer will be started\n * on every other value from the source. A new buffer is started at the\n * beginning of the source by default.\n * @return A function that returns an Observable of arrays of buffered values.\n */\nexport function bufferCount<T>(bufferSize: number, startBufferEvery: number | null = null): OperatorFunction<T, T[]> {\n // If no `startBufferEvery` value was supplied, then we're\n // opening and closing on the bufferSize itself.\n startBufferEvery = startBufferEvery ?? bufferSize;\n\n return operate((source, subscriber) => {\n let buffers: T[][] = [];\n let count = 0;\n\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => {\n let toEmit: T[][] | null = null;\n\n // Check to see if we need to start a buffer.\n // This will start one at the first value, and then\n // a new one every N after that.\n if (count++ % startBufferEvery! === 0) {\n buffers.push([]);\n }\n\n // Push our value into our active buffers.\n for (const buffer of buffers) {\n buffer.push(value);\n // Check to see if we're over the bufferSize\n // if we are, record it so we can emit it later.\n // If we emitted it now and removed it, it would\n // mutate the `buffers` array while we're looping\n // over it.\n if (bufferSize <= buffer.length) {\n toEmit = toEmit ?? [];\n toEmit.push(buffer);\n }\n }\n\n if (toEmit) {\n // We have found some buffers that are over the\n // `bufferSize`. Emit them, and remove them from our\n // buffers list.\n for (const buffer of toEmit) {\n arrRemove(buffers, buffer);\n subscriber.next(buffer);\n }\n }\n },\n () => {\n // When the source completes, emit all of our\n // active buffers.\n for (const buffer of buffers) {\n subscriber.next(buffer);\n }\n subscriber.complete();\n },\n // Pass all errors through to consumer.\n undefined,\n () => {\n // Clean up our memory when we finalize\n buffers = null!;\n }\n )\n );\n });\n}\n", "import { Subscription } from '../Subscription';\nimport { OperatorFunction, SchedulerLike } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { arrRemove } from '../util/arrRemove';\nimport { asyncScheduler } from '../scheduler/async';\nimport { popScheduler } from '../util/args';\nimport { executeSchedule } from '../util/executeSchedule';\n\nexport function bufferTime<T>(bufferTimeSpan: number, scheduler?: SchedulerLike): OperatorFunction<T, T[]>;\nexport function bufferTime<T>(\n bufferTimeSpan: number,\n bufferCreationInterval: number | null | undefined,\n scheduler?: SchedulerLike\n): OperatorFunction<T, T[]>;\nexport function bufferTime<T>(\n bufferTimeSpan: number,\n bufferCreationInterval: number | null | undefined,\n maxBufferSize: number,\n scheduler?: SchedulerLike\n): OperatorFunction<T, T[]>;\n\n/**\n * Buffers the source Observable values for a specific time period.\n *\n * <span class=\"informal\">Collects values from the past as an array, and emits\n * those arrays periodically in time.</span>\n *\n * ![](bufferTime.png)\n *\n * Buffers values from the source for a specific time duration `bufferTimeSpan`.\n * Unless the optional argument `bufferCreationInterval` is given, it emits and\n * resets the buffer every `bufferTimeSpan` milliseconds. If\n * `bufferCreationInterval` is given, this operator opens the buffer every\n * `bufferCreationInterval` milliseconds and closes (emits and resets) the\n * buffer every `bufferTimeSpan` milliseconds. When the optional argument\n * `maxBufferSize` is specified, the buffer will be closed either after\n * `bufferTimeSpan` milliseconds or when it contains `maxBufferSize` elements.\n *\n * ## Examples\n *\n * Every second, emit an array of the recent click events\n *\n * ```ts\n * import { fromEvent, bufferTime } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const buffered = clicks.pipe(bufferTime(1000));\n * buffered.subscribe(x => console.log(x));\n * ```\n *\n * Every 5 seconds, emit the click events from the next 2 seconds\n *\n * ```ts\n * import { fromEvent, bufferTime } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const buffered = clicks.pipe(bufferTime(2000, 5000));\n * buffered.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link buffer}\n * @see {@link bufferCount}\n * @see {@link bufferToggle}\n * @see {@link bufferWhen}\n * @see {@link windowTime}\n *\n * @param bufferTimeSpan The amount of time to fill each buffer array.\n * @param otherArgs Other configuration arguments such as:\n * - `bufferCreationInterval` - the interval at which to start new buffers;\n * - `maxBufferSize` - the maximum buffer size;\n * - `scheduler` - the scheduler on which to schedule the intervals that determine buffer boundaries.\n * @return A function that returns an Observable of arrays of buffered values.\n */\nexport function bufferTime<T>(bufferTimeSpan: number, ...otherArgs: any[]): OperatorFunction<T, T[]> {\n const scheduler = popScheduler(otherArgs) ?? asyncScheduler;\n const bufferCreationInterval = (otherArgs[0] as number) ?? null;\n const maxBufferSize = (otherArgs[1] as number) || Infinity;\n\n return operate((source, subscriber) => {\n // The active buffers, their related subscriptions, and removal functions.\n let bufferRecords: { buffer: T[]; subs: Subscription }[] | null = [];\n // If true, it means that every time we emit a buffer, we want to start a new buffer\n // this is only really used for when *just* the buffer time span is passed.\n let restartOnEmit = false;\n\n /**\n * Does the work of emitting the buffer from the record, ensuring that the\n * record is removed before the emission so reentrant code (from some custom scheduling, perhaps)\n * does not alter the buffer. Also checks to see if a new buffer needs to be started\n * after the emit.\n */\n const emit = (record: { buffer: T[]; subs: Subscription }) => {\n const { buffer, subs } = record;\n subs.unsubscribe();\n arrRemove(bufferRecords, record);\n subscriber.next(buffer);\n restartOnEmit && startBuffer();\n };\n\n /**\n * Called every time we start a new buffer. This does\n * the work of scheduling a job at the requested bufferTimeSpan\n * that will emit the buffer (if it's not unsubscribed before then).\n */\n const startBuffer = () => {\n if (bufferRecords) {\n const subs = new Subscription();\n subscriber.add(subs);\n const buffer: T[] = [];\n const record = {\n buffer,\n subs,\n };\n bufferRecords.push(record);\n executeSchedule(subs, scheduler, () => emit(record), bufferTimeSpan);\n }\n };\n\n if (bufferCreationInterval !== null && bufferCreationInterval >= 0) {\n // The user passed both a bufferTimeSpan (required), and a creation interval\n // That means we need to start new buffers on the interval, and those buffers need\n // to wait the required time span before emitting.\n executeSchedule(subscriber, scheduler, startBuffer, bufferCreationInterval, true);\n } else {\n restartOnEmit = true;\n }\n\n startBuffer();\n\n const bufferTimeSubscriber = createOperatorSubscriber(\n subscriber,\n (value: T) => {\n // Copy the records, so if we need to remove one we\n // don't mutate the array. It's hard, but not impossible to\n // set up a buffer time that could mutate the array and\n // cause issues here.\n const recordsCopy = bufferRecords!.slice();\n for (const record of recordsCopy) {\n // Loop over all buffers and\n const { buffer } = record;\n buffer.push(value);\n // If the buffer is over the max size, we need to emit it.\n maxBufferSize <= buffer.length && emit(record);\n }\n },\n () => {\n // The source completed, emit all of the active\n // buffers we have before we complete.\n while (bufferRecords?.length) {\n subscriber.next(bufferRecords.shift()!.buffer);\n }\n bufferTimeSubscriber?.unsubscribe();\n subscriber.complete();\n subscriber.unsubscribe();\n },\n // Pass all errors through to consumer.\n undefined,\n // Clean up\n () => (bufferRecords = null)\n );\n\n source.subscribe(bufferTimeSubscriber);\n });\n}\n", "import { Subscription } from '../Subscription';\nimport { OperatorFunction, ObservableInput } from '../types';\nimport { operate } from '../util/lift';\nimport { innerFrom } from '../observable/innerFrom';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { noop } from '../util/noop';\nimport { arrRemove } from '../util/arrRemove';\n\n/**\n * Buffers the source Observable values starting from an emission from\n * `openings` and ending when the output of `closingSelector` emits.\n *\n * <span class=\"informal\">Collects values from the past as an array. Starts\n * collecting only when `opening` emits, and calls the `closingSelector`\n * function to get an Observable that tells when to close the buffer.</span>\n *\n * ![](bufferToggle.png)\n *\n * Buffers values from the source by opening the buffer via signals from an\n * Observable provided to `openings`, and closing and sending the buffers when\n * a Subscribable or Promise returned by the `closingSelector` function emits.\n *\n * ## Example\n *\n * Every other second, emit the click events from the next 500ms\n *\n * ```ts\n * import { fromEvent, interval, bufferToggle, EMPTY } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const openings = interval(1000);\n * const buffered = clicks.pipe(bufferToggle(openings, i =>\n * i % 2 ? interval(500) : EMPTY\n * ));\n * buffered.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link buffer}\n * @see {@link bufferCount}\n * @see {@link bufferTime}\n * @see {@link bufferWhen}\n * @see {@link windowToggle}\n *\n * @param openings A Subscribable or Promise of notifications to start new\n * buffers.\n * @param closingSelector A function that takes\n * the value emitted by the `openings` observable and returns a Subscribable or Promise,\n * which, when it emits, signals that the associated buffer should be emitted\n * and cleared.\n * @return A function that returns an Observable of arrays of buffered values.\n */\nexport function bufferToggle<T, O>(\n openings: ObservableInput<O>,\n closingSelector: (value: O) => ObservableInput<any>\n): OperatorFunction<T, T[]> {\n return operate((source, subscriber) => {\n const buffers: T[][] = [];\n\n // Subscribe to the openings notifier first\n innerFrom(openings).subscribe(\n createOperatorSubscriber(\n subscriber,\n (openValue) => {\n const buffer: T[] = [];\n buffers.push(buffer);\n // We use this composite subscription, so that\n // when the closing notifier emits, we can tear it down.\n const closingSubscription = new Subscription();\n\n const emitBuffer = () => {\n arrRemove(buffers, buffer);\n subscriber.next(buffer);\n closingSubscription.unsubscribe();\n };\n\n // The line below will add the subscription to the parent subscriber *and* the closing subscription.\n closingSubscription.add(innerFrom(closingSelector(openValue)).subscribe(createOperatorSubscriber(subscriber, emitBuffer, noop)));\n },\n noop\n )\n );\n\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => {\n // Value from our source. Add it to all pending buffers.\n for (const buffer of buffers) {\n buffer.push(value);\n }\n },\n () => {\n // Source complete. Emit all pending buffers.\n while (buffers.length > 0) {\n subscriber.next(buffers.shift()!);\n }\n subscriber.complete();\n }\n )\n );\n });\n}\n", "import { Subscriber } from '../Subscriber';\nimport { ObservableInput, OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { noop } from '../util/noop';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\n\n/**\n * Buffers the source Observable values, using a factory function of closing\n * Observables to determine when to close, emit, and reset the buffer.\n *\n * <span class=\"informal\">Collects values from the past as an array. When it\n * starts collecting values, it calls a function that returns an Observable that\n * tells when to close the buffer and restart collecting.</span>\n *\n * ![](bufferWhen.svg)\n *\n * Opens a buffer immediately, then closes the buffer when the observable\n * returned by calling `closingSelector` function emits a value. When it closes\n * the buffer, it immediately opens a new buffer and repeats the process.\n *\n * ## Example\n *\n * Emit an array of the last clicks every [1-5] random seconds\n *\n * ```ts\n * import { fromEvent, bufferWhen, interval } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const buffered = clicks.pipe(\n * bufferWhen(() => interval(1000 + Math.random() * 4000))\n * );\n * buffered.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link buffer}\n * @see {@link bufferCount}\n * @see {@link bufferTime}\n * @see {@link bufferToggle}\n * @see {@link windowWhen}\n *\n * @param closingSelector A function that takes no arguments and returns an\n * Observable that signals buffer closure.\n * @return A function that returns an Observable of arrays of buffered values.\n */\nexport function bufferWhen<T>(closingSelector: () => ObservableInput<any>): OperatorFunction<T, T[]> {\n return operate((source, subscriber) => {\n // The buffer we keep and emit.\n let buffer: T[] | null = null;\n // A reference to the subscriber used to subscribe to\n // the closing notifier. We need to hold this so we can\n // end the subscription after the first notification.\n let closingSubscriber: Subscriber<T> | null = null;\n\n // Ends the previous closing notifier subscription, so it\n // terminates after the first emission, then emits\n // the current buffer if there is one, starts a new buffer, and starts a\n // new closing notifier.\n const openBuffer = () => {\n // Make sure to finalize the closing subscription, we only cared\n // about one notification.\n closingSubscriber?.unsubscribe();\n // emit the buffer if we have one, and start a new buffer.\n const b = buffer;\n buffer = [];\n b && subscriber.next(b);\n\n // Get a new closing notifier and subscribe to it.\n innerFrom(closingSelector()).subscribe((closingSubscriber = createOperatorSubscriber(subscriber, openBuffer, noop)));\n };\n\n // Start the first buffer.\n openBuffer();\n\n // Subscribe to our source.\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n // Add every new value to the current buffer.\n (value) => buffer?.push(value),\n // When we complete, emit the buffer if we have one,\n // then complete the result.\n () => {\n buffer && subscriber.next(buffer);\n subscriber.complete();\n },\n // Pass all errors through to consumer.\n undefined,\n // Release memory on finalization\n () => (buffer = closingSubscriber = null!)\n )\n );\n });\n}\n", "import { Observable } from '../Observable';\n\nimport { ObservableInput, OperatorFunction, ObservedValueOf } from '../types';\nimport { Subscription } from '../Subscription';\nimport { innerFrom } from '../observable/innerFrom';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { operate } from '../util/lift';\n\nexport function catchError<T, O extends ObservableInput<any>>(\n selector: (err: any, caught: Observable<T>) => O\n): OperatorFunction<T, T | ObservedValueOf<O>>;\n\n/**\n * Catches errors on the observable to be handled by returning a new observable or throwing an error.\n *\n * <span class=\"informal\">\n * It only listens to the error channel and ignores notifications.\n * Handles errors from the source observable, and maps them to a new observable.\n * The error may also be rethrown, or a new error can be thrown to emit an error from the result.\n * </span>\n *\n * ![](catch.png)\n *\n * This operator handles errors, but forwards along all other events to the resulting observable.\n * If the source observable terminates with an error, it will map that error to a new observable,\n * subscribe to it, and forward all of its events to the resulting observable.\n *\n * ## Examples\n *\n * Continue with a different Observable when there's an error\n *\n * ```ts\n * import { of, map, catchError } from 'rxjs';\n *\n * of(1, 2, 3, 4, 5)\n * .pipe(\n * map(n => {\n * if (n === 4) {\n * throw 'four!';\n * }\n * return n;\n * }),\n * catchError(err => of('I', 'II', 'III', 'IV', 'V'))\n * )\n * .subscribe(x => console.log(x));\n * // 1, 2, 3, I, II, III, IV, V\n * ```\n *\n * Retry the caught source Observable again in case of error, similar to `retry()` operator\n *\n * ```ts\n * import { of, map, catchError, take } from 'rxjs';\n *\n * of(1, 2, 3, 4, 5)\n * .pipe(\n * map(n => {\n * if (n === 4) {\n * throw 'four!';\n * }\n * return n;\n * }),\n * catchError((err, caught) => caught),\n * take(30)\n * )\n * .subscribe(x => console.log(x));\n * // 1, 2, 3, 1, 2, 3, ...\n * ```\n *\n * Throw a new error when the source Observable throws an error\n *\n * ```ts\n * import { of, map, catchError } from 'rxjs';\n *\n * of(1, 2, 3, 4, 5)\n * .pipe(\n * map(n => {\n * if (n === 4) {\n * throw 'four!';\n * }\n * return n;\n * }),\n * catchError(err => {\n * throw 'error in source. Details: ' + err;\n * })\n * )\n * .subscribe({\n * next: x => console.log(x),\n * error: err => console.log(err)\n * });\n * // 1, 2, 3, error in source. Details: four!\n * ```\n *\n * @see {@link onErrorResumeNext}\n * @see {@link repeat}\n * @see {@link repeatWhen}\n * @see {@link retry }\n * @see {@link retryWhen}\n *\n * @param selector A function that takes as arguments `err`, which is the error, and `caught`, which\n * is the source observable, in case you'd like to \"retry\" that observable by returning it again.\n * Whatever observable is returned by the `selector` will be used to continue the observable chain.\n * @return A function that returns an Observable that originates from either\n * the source or the Observable returned by the `selector` function.\n */\nexport function catchError<T, O extends ObservableInput<any>>(\n selector: (err: any, caught: Observable<T>) => O\n): OperatorFunction<T, T | ObservedValueOf<O>> {\n return operate((source, subscriber) => {\n let innerSub: Subscription | null = null;\n let syncUnsub = false;\n let handledResult: Observable<ObservedValueOf<O>>;\n\n innerSub = source.subscribe(\n createOperatorSubscriber(subscriber, undefined, undefined, (err) => {\n handledResult = innerFrom(selector(err, catchError(selector)(source)));\n if (innerSub) {\n innerSub.unsubscribe();\n innerSub = null;\n handledResult.subscribe(subscriber);\n } else {\n // We don't have an innerSub yet, that means the error was synchronous\n // because the subscribe call hasn't returned yet.\n syncUnsub = true;\n }\n })\n );\n\n if (syncUnsub) {\n // We have a synchronous error, we need to make sure to\n // finalize right away. This ensures that callbacks in the `finalize` operator are called\n // at the right time, and that finalization occurs at the expected\n // time between the source error and the subscription to the\n // next observable.\n innerSub.unsubscribe();\n innerSub = null;\n handledResult!.subscribe(subscriber);\n }\n });\n}\n", "import { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * A basic scan operation. This is used for `scan` and `reduce`.\n * @param accumulator The accumulator to use\n * @param seed The seed value for the state to accumulate\n * @param hasSeed Whether or not a seed was provided\n * @param emitOnNext Whether or not to emit the state on next\n * @param emitBeforeComplete Whether or not to emit the before completion\n */\n\nexport function scanInternals<V, A, S>(\n accumulator: (acc: V | A | S, value: V, index: number) => A,\n seed: S,\n hasSeed: boolean,\n emitOnNext: boolean,\n emitBeforeComplete?: undefined | true\n) {\n return (source: Observable<V>, subscriber: Subscriber<any>) => {\n // Whether or not we have state yet. This will only be\n // false before the first value arrives if we didn't get\n // a seed value.\n let hasState = hasSeed;\n // The state that we're tracking, starting with the seed,\n // if there is one, and then updated by the return value\n // from the accumulator on each emission.\n let state: any = seed;\n // An index to pass to the accumulator function.\n let index = 0;\n\n // Subscribe to our source. All errors and completions are passed through.\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => {\n // Always increment the index.\n const i = index++;\n // Set the state\n state = hasState\n ? // We already have state, so we can get the new state from the accumulator\n accumulator(state, value, i)\n : // We didn't have state yet, a seed value was not provided, so\n\n // we set the state to the first value, and mark that we have state now\n ((hasState = true), value);\n\n // Maybe send it to the consumer.\n emitOnNext && subscriber.next(state);\n },\n // If an onComplete was given, call it, otherwise\n // just pass through the complete notification to the consumer.\n emitBeforeComplete &&\n (() => {\n hasState && subscriber.next(state);\n subscriber.complete();\n })\n )\n );\n };\n}\n", "import { scanInternals } from './scanInternals';\nimport { OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\n\nexport function reduce<V, A = V>(accumulator: (acc: A | V, value: V, index: number) => A): OperatorFunction<V, V | A>;\nexport function reduce<V, A>(accumulator: (acc: A, value: V, index: number) => A, seed: A): OperatorFunction<V, A>;\nexport function reduce<V, A, S = A>(accumulator: (acc: A | S, value: V, index: number) => A, seed: S): OperatorFunction<V, A>;\n\n/**\n * Applies an accumulator function over the source Observable, and returns the\n * accumulated result when the source completes, given an optional seed value.\n *\n * <span class=\"informal\">Combines together all values emitted on the source,\n * using an accumulator function that knows how to join a new source value into\n * the accumulation from the past.</span>\n *\n * ![](reduce.png)\n *\n * Like\n * [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce),\n * `reduce` applies an `accumulator` function against an accumulation and each\n * value of the source Observable (from the past) to reduce it to a single\n * value, emitted on the output Observable. Note that `reduce` will only emit\n * one value, only when the source Observable completes. It is equivalent to\n * applying operator {@link scan} followed by operator {@link last}.\n *\n * Returns an Observable that applies a specified `accumulator` function to each\n * item emitted by the source Observable. If a `seed` value is specified, then\n * that value will be used as the initial value for the accumulator. If no seed\n * value is specified, the first item of the source is used as the seed.\n *\n * ## Example\n *\n * Count the number of click events that happened in 5 seconds\n *\n * ```ts\n * import { fromEvent, takeUntil, interval, map, reduce } from 'rxjs';\n *\n * const clicksInFiveSeconds = fromEvent(document, 'click')\n * .pipe(takeUntil(interval(5000)));\n *\n * const ones = clicksInFiveSeconds.pipe(map(() => 1));\n * const seed = 0;\n * const count = ones.pipe(reduce((acc, one) => acc + one, seed));\n *\n * count.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link count}\n * @see {@link expand}\n * @see {@link mergeScan}\n * @see {@link scan}\n *\n * @param accumulator The accumulator function called on each source value.\n * @param seed The initial accumulation value.\n * @return A function that returns an Observable that emits a single value that\n * is the result of accumulating the values emitted by the source Observable.\n */\nexport function reduce<V, A>(accumulator: (acc: V | A, value: V, index: number) => A, seed?: any): OperatorFunction<V, V | A> {\n return operate(scanInternals(accumulator, seed, arguments.length >= 2, false, true));\n}\n", "import { reduce } from './reduce';\nimport { OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\n\nconst arrReducer = (arr: any[], value: any) => (arr.push(value), arr);\n\n/**\n * Collects all source emissions and emits them as an array when the source completes.\n *\n * <span class=\"informal\">Get all values inside an array when the source completes</span>\n *\n * ![](toArray.png)\n *\n * `toArray` will wait until the source Observable completes before emitting\n * the array containing all emissions. When the source Observable errors no\n * array will be emitted.\n *\n * ## Example\n *\n * ```ts\n * import { interval, take, toArray } from 'rxjs';\n *\n * const source = interval(1000);\n * const example = source.pipe(\n * take(10),\n * toArray()\n * );\n *\n * example.subscribe(value => console.log(value));\n *\n * // output: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n * ```\n *\n * @return A function that returns an Observable that emits an array of items\n * emitted by the source Observable when source completes.\n */\nexport function toArray<T>(): OperatorFunction<T, T[]> {\n // Because arrays are mutable, and we're mutating the array in this\n // reducer process, we have to encapsulate the creation of the initial\n // array within this `operate` function.\n return operate((source, subscriber) => {\n reduce(arrReducer, [] as T[])(source).subscribe(subscriber);\n });\n}\n", "import { Observable } from '../Observable';\nimport { ObservableInput, OperatorFunction } from '../types';\nimport { identity } from '../util/identity';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\nimport { pipe } from '../util/pipe';\nimport { mergeMap } from './mergeMap';\nimport { toArray } from './toArray';\n\n/**\n * Collects all of the inner sources from source observable. Then, once the\n * source completes, joins the values using the given static.\n *\n * This is used for {@link combineLatestAll} and {@link zipAll} which both have the\n * same behavior of collecting all inner observables, then operating on them.\n *\n * @param joinFn The type of static join to apply to the sources collected\n * @param project The projection function to apply to the values, if any\n */\nexport function joinAllInternals<T, R>(joinFn: (sources: ObservableInput<T>[]) => Observable<T>, project?: (...args: any[]) => R) {\n return pipe(\n // Collect all inner sources into an array, and emit them when the\n // source completes.\n toArray() as OperatorFunction<ObservableInput<T>, ObservableInput<T>[]>,\n // Run the join function on the collected array of inner sources.\n mergeMap((sources) => joinFn(sources)),\n // If a projection function was supplied, apply it to each result.\n project ? mapOneOrManyArgs(project) : (identity as any)\n );\n}\n", "import { combineLatest } from '../observable/combineLatest';\nimport { OperatorFunction, ObservableInput } from '../types';\nimport { joinAllInternals } from './joinAllInternals';\n\nexport function combineLatestAll<T>(): OperatorFunction<ObservableInput<T>, T[]>;\nexport function combineLatestAll<T>(): OperatorFunction<any, T[]>;\nexport function combineLatestAll<T, R>(project: (...values: T[]) => R): OperatorFunction<ObservableInput<T>, R>;\nexport function combineLatestAll<R>(project: (...values: Array<any>) => R): OperatorFunction<any, R>;\n\n/**\n * Flattens an Observable-of-Observables by applying {@link combineLatest} when the Observable-of-Observables completes.\n *\n * `combineLatestAll` takes an Observable of Observables, and collects all Observables from it. Once the outer Observable completes,\n * it subscribes to all collected Observables and combines their values using the {@link combineLatest} strategy, such that:\n *\n * * Every time an inner Observable emits, the output Observable emits\n * * When the returned observable emits, it emits all of the latest values by:\n * * If a `project` function is provided, it is called with each recent value from each inner Observable in whatever order they\n * arrived, and the result of the `project` function is what is emitted by the output Observable.\n * * If there is no `project` function, an array of all the most recent values is emitted by the output Observable.\n *\n * ## Example\n *\n * Map two click events to a finite interval Observable, then apply `combineLatestAll`\n *\n * ```ts\n * import { fromEvent, map, interval, take, combineLatestAll } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const higherOrder = clicks.pipe(\n * map(() => interval(Math.random() * 2000).pipe(take(3))),\n * take(2)\n * );\n * const result = higherOrder.pipe(combineLatestAll());\n *\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link combineLatest}\n * @see {@link combineLatestWith}\n * @see {@link mergeAll}\n *\n * @param project optional function to map the most recent values from each inner Observable into a new result.\n * Takes each of the most recent values from each collected inner Observable as arguments, in order.\n * @return A function that returns an Observable that flattens Observables\n * emitted by the source Observable.\n */\nexport function combineLatestAll<R>(project?: (...values: Array<any>) => R) {\n return joinAllInternals(combineLatest, project);\n}\n", "import { combineLatestAll } from './combineLatestAll';\n\n/**\n * @deprecated Renamed to {@link combineLatestAll}. Will be removed in v8.\n */\nexport const combineAll = combineLatestAll;\n", "import { combineLatestInit } from '../observable/combineLatest';\nimport { ObservableInput, ObservableInputTuple, OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { argsOrArgArray } from '../util/argsOrArgArray';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\nimport { pipe } from '../util/pipe';\nimport { popResultSelector } from '../util/args';\n\n/** @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8. */\nexport function combineLatest<T, A extends readonly unknown[], R>(\n sources: [...ObservableInputTuple<A>],\n project: (...values: [T, ...A]) => R\n): OperatorFunction<T, R>;\n/** @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8. */\nexport function combineLatest<T, A extends readonly unknown[], R>(sources: [...ObservableInputTuple<A>]): OperatorFunction<T, [T, ...A]>;\n\n/** @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8. */\nexport function combineLatest<T, A extends readonly unknown[], R>(\n ...sourcesAndProject: [...ObservableInputTuple<A>, (...values: [T, ...A]) => R]\n): OperatorFunction<T, R>;\n/** @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8. */\nexport function combineLatest<T, A extends readonly unknown[], R>(...sources: [...ObservableInputTuple<A>]): OperatorFunction<T, [T, ...A]>;\n\n/**\n * @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8.\n */\nexport function combineLatest<T, R>(...args: (ObservableInput<any> | ((...values: any[]) => R))[]): OperatorFunction<T, unknown> {\n const resultSelector = popResultSelector(args);\n return resultSelector\n ? pipe(combineLatest(...(args as Array<ObservableInput<any>>)), mapOneOrManyArgs(resultSelector))\n : operate((source, subscriber) => {\n combineLatestInit([source, ...argsOrArgArray(args)])(subscriber);\n });\n}\n", "import { ObservableInputTuple, OperatorFunction, Cons } from '../types';\nimport { combineLatest } from './combineLatest';\n\n/**\n * Create an observable that combines the latest values from all passed observables and the source\n * into arrays and emits them.\n *\n * Returns an observable, that when subscribed to, will subscribe to the source observable and all\n * sources provided as arguments. Once all sources emit at least one value, all of the latest values\n * will be emitted as an array. After that, every time any source emits a value, all of the latest values\n * will be emitted as an array.\n *\n * This is a useful operator for eagerly calculating values based off of changed inputs.\n *\n * ## Example\n *\n * Simple concatenation of values from two inputs\n *\n * ```ts\n * import { fromEvent, combineLatestWith, map } from 'rxjs';\n *\n * // Setup: Add two inputs to the page\n * const input1 = document.createElement('input');\n * document.body.appendChild(input1);\n * const input2 = document.createElement('input');\n * document.body.appendChild(input2);\n *\n * // Get streams of changes\n * const input1Changes$ = fromEvent(input1, 'change');\n * const input2Changes$ = fromEvent(input2, 'change');\n *\n * // Combine the changes by adding them together\n * input1Changes$.pipe(\n * combineLatestWith(input2Changes$),\n * map(([e1, e2]) => (<HTMLInputElement>e1.target).value + ' - ' + (<HTMLInputElement>e2.target).value)\n * )\n * .subscribe(x => console.log(x));\n * ```\n *\n * @param otherSources the other sources to subscribe to.\n * @return A function that returns an Observable that emits the latest\n * emissions from both source and provided Observables.\n */\nexport function combineLatestWith<T, A extends readonly unknown[]>(\n ...otherSources: [...ObservableInputTuple<A>]\n): OperatorFunction<T, Cons<T, A>> {\n return combineLatest(...otherSources);\n}\n", "import { mergeMap } from './mergeMap';\nimport { ObservableInput, OperatorFunction, ObservedValueOf } from '../types';\nimport { isFunction } from '../util/isFunction';\n\n/* tslint:disable:max-line-length */\nexport function concatMap<T, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O\n): OperatorFunction<T, ObservedValueOf<O>>;\n/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */\nexport function concatMap<T, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector: undefined\n): OperatorFunction<T, ObservedValueOf<O>>;\n/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */\nexport function concatMap<T, R, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R\n): OperatorFunction<T, R>;\n/* tslint:enable:max-line-length */\n\n/**\n * Projects each source value to an Observable which is merged in the output\n * Observable, in a serialized fashion waiting for each one to complete before\n * merging the next.\n *\n * <span class=\"informal\">Maps each value to an Observable, then flattens all of\n * these inner Observables using {@link concatAll}.</span>\n *\n * ![](concatMap.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 (so-called \"inner\") Observable. Each new inner Observable is\n * concatenated with the previous inner Observable.\n *\n * __Warning:__ if source values arrive endlessly and faster than their\n * corresponding inner Observables can complete, it will result in memory issues\n * as inner Observables amass in an unbounded buffer waiting for their turn to\n * be subscribed to.\n *\n * Note: `concatMap` is equivalent to `mergeMap` 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 *\n * ```ts\n * import { fromEvent, concatMap, interval, take } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(\n * concatMap(ev => interval(1000).pipe(take(4)))\n * );\n * result.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 concat}\n * @see {@link concatAll}\n * @see {@link concatMapTo}\n * @see {@link exhaustMap}\n * @see {@link mergeMap}\n * @see {@link switchMap}\n *\n * @param project A function that, when applied to an item emitted by the source\n * Observable, returns an Observable.\n * @return A function that returns an Observable that emits the result of\n * applying the projection function (and the optional deprecated\n * `resultSelector`) to each item emitted by the source Observable and taking\n * values from each projected inner Observable sequentially.\n */\nexport function concatMap<T, R, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector?: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R\n): OperatorFunction<T, ObservedValueOf<O> | R> {\n return isFunction(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);\n}\n", "import { concatMap } from './concatMap';\nimport { ObservableInput, OperatorFunction, ObservedValueOf } from '../types';\nimport { isFunction } from '../util/isFunction';\n\n/** @deprecated Will be removed in v9. Use {@link concatMap} instead: `concatMap(() => result)` */\nexport function concatMapTo<O extends ObservableInput<unknown>>(observable: O): OperatorFunction<unknown, ObservedValueOf<O>>;\n/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */\nexport function concatMapTo<O extends ObservableInput<unknown>>(\n observable: O,\n resultSelector: undefined\n): OperatorFunction<unknown, ObservedValueOf<O>>;\n/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */\nexport function concatMapTo<T, R, O extends ObservableInput<unknown>>(\n observable: O,\n resultSelector: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R\n): OperatorFunction<T, R>;\n\n/**\n * Projects each source value to the same Observable which is merged multiple\n * times in a serialized fashion on the output Observable.\n *\n * <span class=\"informal\">It's like {@link concatMap}, but maps each value\n * always to the same inner Observable.</span>\n *\n * ![](concatMapTo.png)\n *\n * Maps each source value to the given Observable `innerObservable` regardless\n * of the source value, and then flattens those resulting Observables into one\n * single Observable, which is the output Observable. Each new `innerObservable`\n * instance emitted on the output Observable is concatenated with the previous\n * `innerObservable` instance.\n *\n * __Warning:__ if source values arrive endlessly and faster than their\n * corresponding inner Observables can complete, it will result in memory issues\n * as inner Observables amass in an unbounded buffer waiting for their turn to\n * be subscribed to.\n *\n * Note: `concatMapTo` is equivalent to `mergeMapTo` with concurrency parameter\n * set to `1`.\n *\n * ## Example\n *\n * For each click event, tick every second from 0 to 3, with no concurrency\n *\n * ```ts\n * import { fromEvent, concatMapTo, interval, take } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(\n * concatMapTo(interval(1000).pipe(take(4)))\n * );\n * result.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 concat}\n * @see {@link concatAll}\n * @see {@link concatMap}\n * @see {@link mergeMapTo}\n * @see {@link switchMapTo}\n *\n * @param innerObservable An `ObservableInput` to replace each value from the\n * source Observable.\n * @return A function that returns an Observable of values merged together by\n * joining the passed Observable with itself, one after the other, for each\n * value emitted from the source.\n * @deprecated Will be removed in v9. Use {@link concatMap} instead: `concatMap(() => result)`\n */\nexport function concatMapTo<T, R, O extends ObservableInput<unknown>>(\n innerObservable: O,\n resultSelector?: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R\n): OperatorFunction<T, ObservedValueOf<O> | R> {\n return isFunction(resultSelector) ? concatMap(() => innerObservable, resultSelector) : concatMap(() => innerObservable);\n}\n", "import { ObservableInputTuple, OperatorFunction, SchedulerLike } from '../types';\nimport { operate } from '../util/lift';\nimport { concatAll } from './concatAll';\nimport { popScheduler } from '../util/args';\nimport { from } from '../observable/from';\n\n/** @deprecated Replaced with {@link concatWith}. Will be removed in v8. */\nexport function concat<T, A extends readonly unknown[]>(...sources: [...ObservableInputTuple<A>]): OperatorFunction<T, T | A[number]>;\n/** @deprecated Replaced with {@link concatWith}. Will be removed in v8. */\nexport function concat<T, A extends readonly unknown[]>(\n ...sourcesAndScheduler: [...ObservableInputTuple<A>, SchedulerLike]\n): OperatorFunction<T, T | A[number]>;\n\n/**\n * @deprecated Replaced with {@link concatWith}. Will be removed in v8.\n */\nexport function concat<T, R>(...args: any[]): OperatorFunction<T, R> {\n const scheduler = popScheduler(args);\n return operate((source, subscriber) => {\n concatAll()(from([source, ...args], scheduler)).subscribe(subscriber);\n });\n}\n", "import { ObservableInputTuple, OperatorFunction } from '../types';\nimport { concat } from './concat';\n\n/**\n * Emits all of the values from the source observable, then, once it completes, subscribes\n * to each observable source provided, one at a time, emitting all of their values, and not subscribing\n * to the next one until it completes.\n *\n * `concat(a$, b$, c$)` is the same as `a$.pipe(concatWith(b$, c$))`.\n *\n * ## Example\n *\n * Listen for one mouse click, then listen for all mouse moves.\n *\n * ```ts\n * import { fromEvent, map, take, concatWith } from 'rxjs';\n *\n * const clicks$ = fromEvent(document, 'click');\n * const moves$ = fromEvent(document, 'mousemove');\n *\n * clicks$.pipe(\n * map(() => 'click'),\n * take(1),\n * concatWith(\n * moves$.pipe(\n * map(() => 'move')\n * )\n * )\n * )\n * .subscribe(x => console.log(x));\n *\n * // 'click'\n * // 'move'\n * // 'move'\n * // 'move'\n * // ...\n * ```\n *\n * @param otherSources Other observable sources to subscribe to, in sequence, after the original source is complete.\n * @return A function that returns an Observable that concatenates\n * subscriptions to the source and provided Observables subscribing to the next\n * only once the current subscription completes.\n */\nexport function concatWith<T, A extends readonly unknown[]>(\n ...otherSources: [...ObservableInputTuple<A>]\n): OperatorFunction<T, T | A[number]> {\n return concat(...otherSources);\n}\n", "import { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { Subscribable } from '../types';\n\n/**\n * Used to convert a subscribable to an observable.\n *\n * Currently, this is only used within internals.\n *\n * TODO: Discuss ObservableInput supporting \"Subscribable\".\n * https://github.com/ReactiveX/rxjs/issues/5909\n *\n * @param subscribable A subscribable\n */\nexport function fromSubscribable<T>(subscribable: Subscribable<T>) {\n return new Observable((subscriber: Subscriber<T>) => subscribable.subscribe(subscriber));\n}\n", "import { OperatorFunction, ObservableInput, ObservedValueOf, SubjectLike } from '../types';\nimport { Observable } from '../Observable';\nimport { Subject } from '../Subject';\nimport { innerFrom } from '../observable/innerFrom';\nimport { operate } from '../util/lift';\nimport { fromSubscribable } from '../observable/fromSubscribable';\n\n/**\n * An object used to configure {@link connect} operator.\n */\nexport interface ConnectConfig<T> {\n /**\n * A factory function used to create the Subject through which the source\n * is multicast. By default, this creates a {@link Subject}.\n */\n connector: () => SubjectLike<T>;\n}\n\n/**\n * The default configuration for `connect`.\n */\nconst DEFAULT_CONFIG: ConnectConfig<unknown> = {\n connector: () => new Subject<unknown>(),\n};\n\n/**\n * Creates an observable by multicasting the source within a function that\n * allows the developer to define the usage of the multicast prior to connection.\n *\n * This is particularly useful if the observable source you wish to multicast could\n * be synchronous or asynchronous. This sets it apart from {@link share}, which, in the\n * case of totally synchronous sources will fail to share a single subscription with\n * multiple consumers, as by the time the subscription to the result of {@link share}\n * has returned, if the source is synchronous its internal reference count will jump from\n * 0 to 1 back to 0 and reset.\n *\n * To use `connect`, you provide a `selector` function that will give you\n * a multicast observable that is not yet connected. You then use that multicast observable\n * to create a resulting observable that, when subscribed, will set up your multicast. This is\n * generally, but not always, accomplished with {@link merge}.\n *\n * Note that using a {@link takeUntil} inside of `connect`'s `selector` _might_ mean you were looking\n * to use the {@link takeWhile} operator instead.\n *\n * When you subscribe to the result of `connect`, the `selector` function will be called. After\n * the `selector` function returns, the observable it returns will be subscribed to, _then_ the\n * multicast will be connected to the source.\n *\n * ## Example\n *\n * Sharing a totally synchronous observable\n *\n * ```ts\n * import { of, tap, connect, merge, map, filter } from 'rxjs';\n *\n * const source$ = of(1, 2, 3, 4, 5).pipe(\n * tap({\n * subscribe: () => console.log('subscription started'),\n * next: n => console.log(`source emitted ${ n }`)\n * })\n * );\n *\n * source$.pipe(\n * // Notice in here we're merging 3 subscriptions to `shared$`.\n * connect(shared$ => merge(\n * shared$.pipe(map(n => `all ${ n }`)),\n * shared$.pipe(filter(n => n % 2 === 0), map(n => `even ${ n }`)),\n * shared$.pipe(filter(n => n % 2 === 1), map(n => `odd ${ n }`))\n * ))\n * )\n * .subscribe(console.log);\n *\n * // Expected output: (notice only one subscription)\n * 'subscription started'\n * 'source emitted 1'\n * 'all 1'\n * 'odd 1'\n * 'source emitted 2'\n * 'all 2'\n * 'even 2'\n * 'source emitted 3'\n * 'all 3'\n * 'odd 3'\n * 'source emitted 4'\n * 'all 4'\n * 'even 4'\n * 'source emitted 5'\n * 'all 5'\n * 'odd 5'\n * ```\n *\n * @param selector A function used to set up the multicast. Gives you a multicast observable\n * that is not yet connected. With that, you're expected to create and return\n * and Observable, that when subscribed to, will utilize the multicast observable.\n * After this function is executed -- and its return value subscribed to -- the\n * operator will subscribe to the source, and the connection will be made.\n * @param config The configuration object for `connect`.\n */\nexport function connect<T, O extends ObservableInput<unknown>>(\n selector: (shared: Observable<T>) => O,\n config: ConnectConfig<T> = DEFAULT_CONFIG\n): OperatorFunction<T, ObservedValueOf<O>> {\n const { connector } = config;\n return operate((source, subscriber) => {\n const subject = connector();\n innerFrom(selector(fromSubscribable(subject))).subscribe(subscriber);\n subscriber.add(source.subscribe(subject));\n });\n}\n", "import { OperatorFunction } from '../types';\nimport { reduce } from './reduce';\n\n/**\n * Counts the number of emissions on the source and emits that number when the\n * source completes.\n *\n * <span class=\"informal\">Tells how many values were emitted, when the source\n * completes.</span>\n *\n * ![](count.png)\n *\n * `count` transforms an Observable that emits values into an Observable that\n * emits a single value that represents the number of values emitted by the\n * source Observable. If the source Observable terminates with an error, `count`\n * will pass this error notification along without emitting a value first. If\n * the source Observable does not terminate at all, `count` will neither emit\n * a value nor terminate. This operator takes an optional `predicate` function\n * as argument, in which case the output emission will represent the number of\n * source values that matched `true` with the `predicate`.\n *\n * ## Examples\n *\n * Counts how many seconds have passed before the first click happened\n *\n * ```ts\n * import { interval, fromEvent, takeUntil, count } from 'rxjs';\n *\n * const seconds = interval(1000);\n * const clicks = fromEvent(document, 'click');\n * const secondsBeforeClick = seconds.pipe(takeUntil(clicks));\n * const result = secondsBeforeClick.pipe(count());\n * result.subscribe(x => console.log(x));\n * ```\n *\n * Counts how many odd numbers are there between 1 and 7\n *\n * ```ts\n * import { range, count } from 'rxjs';\n *\n * const numbers = range(1, 7);\n * const result = numbers.pipe(count(i => i % 2 === 1));\n * result.subscribe(x => console.log(x));\n * // Results in:\n * // 4\n * ```\n *\n * @see {@link max}\n * @see {@link min}\n * @see {@link reduce}\n *\n * @param predicate A function that is used to analyze the value and the index and\n * determine whether or not to increment the count. Return `true` to increment the count,\n * and return `false` to keep the count the same.\n * If the predicate is not provided, every value will be counted.\n * @return A function that returns an Observable that emits one number that\n * represents the count of emissions.\n */\nexport function count<T>(predicate?: (value: T, index: number) => boolean): OperatorFunction<T, number> {\n return reduce((total, value, i) => (!predicate || predicate(value, i) ? total + 1 : total), 0);\n}\n", "import { Subscriber } from '../Subscriber';\nimport { MonoTypeOperatorFunction, ObservableInput } from '../types';\nimport { operate } from '../util/lift';\nimport { noop } from '../util/noop';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\n\n/**\n * Emits a notification from the source Observable only after a particular time span\n * determined by another Observable has passed without another source emission.\n *\n * <span class=\"informal\">It's like {@link debounceTime}, but the time span of\n * emission silence is determined by a second Observable.</span>\n *\n * ![](debounce.svg)\n *\n * `debounce` delays notifications emitted by the source Observable, but drops previous\n * pending delayed emissions if a new notification arrives on the source Observable.\n * This operator keeps track of the most recent notification from the source\n * Observable, and spawns a duration Observable by calling the\n * `durationSelector` function. The notification is emitted only when the duration\n * Observable emits a next notification, and if no other notification was emitted on\n * the source Observable since the duration Observable was spawned. If a new\n * notification appears before the duration Observable emits, the previous notification will\n * not be emitted and a new duration is scheduled from `durationSelector` is scheduled.\n * If the completing event happens during the scheduled duration the last cached notification\n * is emitted before the completion event is forwarded to the output observable.\n * If the error event happens during the scheduled duration or after it only the error event is\n * forwarded to the output observable. The cache notification is not emitted in this case.\n *\n * Like {@link debounceTime}, this is a rate-limiting operator, and also a\n * delay-like operator since output emissions do not necessarily occur at the\n * same time as they did on the source Observable.\n *\n * ## Example\n *\n * Emit the most recent click after a burst of clicks\n *\n * ```ts\n * import { fromEvent, scan, debounce, interval } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(\n * scan(i => ++i, 1),\n * debounce(i => interval(200 * i))\n * );\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link audit}\n * @see {@link auditTime}\n * @see {@link debounceTime}\n * @see {@link delay}\n * @see {@link sample}\n * @see {@link sampleTime}\n * @see {@link throttle}\n * @see {@link throttleTime}\n *\n * @param durationSelector A function\n * that receives a value from the source Observable, for computing the timeout\n * duration for each source value, returned as an Observable or a Promise.\n * @return A function that returns an Observable that delays the emissions of\n * the source Observable by the specified duration Observable returned by\n * `durationSelector`, and may drop some values if they occur too frequently.\n */\nexport function debounce<T>(durationSelector: (value: T) => ObservableInput<any>): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n let hasValue = false;\n let lastValue: T | null = null;\n // The subscriber/subscription for the current debounce, if there is one.\n let durationSubscriber: Subscriber<any> | null = null;\n\n const emit = () => {\n // Unsubscribe any current debounce subscription we have,\n // we only cared about the first notification from it, and we\n // want to clean that subscription up as soon as possible.\n durationSubscriber?.unsubscribe();\n durationSubscriber = null;\n if (hasValue) {\n // We have a value! Free up memory first, then emit the value.\n hasValue = false;\n const value = lastValue!;\n lastValue = null;\n subscriber.next(value);\n }\n };\n\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value: T) => {\n // Cancel any pending debounce duration. We don't\n // need to null it out here yet tho, because we're just going\n // to create another one in a few lines.\n durationSubscriber?.unsubscribe();\n hasValue = true;\n lastValue = value;\n // Capture our duration subscriber, so we can unsubscribe it when we're notified\n // and we're going to emit the value.\n durationSubscriber = createOperatorSubscriber(subscriber, emit, noop);\n // Subscribe to the duration.\n innerFrom(durationSelector(value)).subscribe(durationSubscriber);\n },\n () => {\n // Source completed.\n // Emit any pending debounced values then complete\n emit();\n subscriber.complete();\n },\n // Pass all errors through to consumer\n undefined,\n () => {\n // Finalization.\n lastValue = durationSubscriber = null;\n }\n )\n );\n });\n}\n", "import { asyncScheduler } from '../scheduler/async';\nimport { Subscription } from '../Subscription';\nimport { MonoTypeOperatorFunction, SchedulerAction, SchedulerLike } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Emits a notification from the source Observable only after a particular time span\n * has passed without another source emission.\n *\n * <span class=\"informal\">It's like {@link delay}, but passes only the most\n * recent notification from each burst of emissions.</span>\n *\n * ![](debounceTime.png)\n *\n * `debounceTime` delays notifications emitted by the source Observable, but drops\n * previous pending delayed emissions if a new notification arrives on the source\n * Observable. This operator keeps track of the most recent notification from the\n * source Observable, and emits that only when `dueTime` has passed\n * without any other notification appearing on the source Observable. If a new value\n * appears before `dueTime` silence occurs, the previous notification will be dropped\n * and will not be emitted and a new `dueTime` is scheduled.\n * If the completing event happens during `dueTime` the last cached notification\n * is emitted before the completion event is forwarded to the output observable.\n * If the error event happens during `dueTime` or after it only the error event is\n * forwarded to the output observable. The cache notification is not emitted in this case.\n *\n * This is a rate-limiting operator, because it is impossible for more than one\n * notification to be emitted in any time window of duration `dueTime`, but it is also\n * a delay-like operator since output emissions do not occur at the same time as\n * they did on the source Observable. Optionally takes a {@link SchedulerLike} for\n * managing timers.\n *\n * ## Example\n *\n * Emit the most recent click after a burst of clicks\n *\n * ```ts\n * import { fromEvent, debounceTime } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(debounceTime(1000));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link audit}\n * @see {@link auditTime}\n * @see {@link debounce}\n * @see {@link sample}\n * @see {@link sampleTime}\n * @see {@link throttle}\n * @see {@link throttleTime}\n *\n * @param dueTime The timeout duration in milliseconds (or the time unit determined\n * internally by the optional `scheduler`) for the window of time required to wait\n * for emission silence before emitting the most recent source value.\n * @param scheduler The {@link SchedulerLike} to use for managing the timers that\n * handle the timeout for each value.\n * @return A function that returns an Observable that delays the emissions of\n * the source Observable by the specified `dueTime`, and may drop some values\n * if they occur too frequently.\n */\nexport function debounceTime<T>(dueTime: number, scheduler: SchedulerLike = asyncScheduler): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n let activeTask: Subscription | null = null;\n let lastValue: T | null = null;\n let lastTime: number | null = null;\n\n const emit = () => {\n if (activeTask) {\n // We have a value! Free up memory first, then emit the value.\n activeTask.unsubscribe();\n activeTask = null;\n const value = lastValue!;\n lastValue = null;\n subscriber.next(value);\n }\n };\n function emitWhenIdle(this: SchedulerAction<unknown>) {\n // This is called `dueTime` after the first value\n // but we might have received new values during this window!\n\n const targetTime = lastTime! + dueTime;\n const now = scheduler.now();\n if (now < targetTime) {\n // On that case, re-schedule to the new target\n activeTask = this.schedule(undefined, targetTime - now);\n subscriber.add(activeTask);\n return;\n }\n\n emit();\n }\n\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value: T) => {\n lastValue = value;\n lastTime = scheduler.now();\n\n // Only set up a task if it's not already up\n if (!activeTask) {\n activeTask = scheduler.schedule(emitWhenIdle, dueTime);\n subscriber.add(activeTask);\n }\n },\n () => {\n // Source completed.\n // Emit any pending debounced values then complete\n emit();\n subscriber.complete();\n },\n // Pass all errors through to consumer.\n undefined,\n () => {\n // Finalization.\n lastValue = activeTask = null;\n }\n )\n );\n });\n}\n", "import { OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Emits a given value if the source Observable completes without emitting any\n * `next` value, otherwise mirrors the source Observable.\n *\n * <span class=\"informal\">If the source Observable turns out to be empty, then\n * this operator will emit a default value.</span>\n *\n * ![](defaultIfEmpty.png)\n *\n * `defaultIfEmpty` emits the values emitted by the source Observable or a\n * specified default value if the source Observable is empty (completes without\n * having emitted any `next` value).\n *\n * ## Example\n *\n * If no clicks happen in 5 seconds, then emit 'no clicks'\n *\n * ```ts\n * import { fromEvent, takeUntil, interval, defaultIfEmpty } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const clicksBeforeFive = clicks.pipe(takeUntil(interval(5000)));\n * const result = clicksBeforeFive.pipe(defaultIfEmpty('no clicks'));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link empty}\n * @see {@link last}\n *\n * @param defaultValue The default value used if the source\n * Observable is empty.\n * @return A function that returns an Observable that emits either the\n * specified `defaultValue` if the source Observable emits no items, or the\n * values emitted by the source Observable.\n */\nexport function defaultIfEmpty<T, R>(defaultValue: R): OperatorFunction<T, T | R> {\n return operate((source, subscriber) => {\n let hasValue = false;\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => {\n hasValue = true;\n subscriber.next(value);\n },\n () => {\n if (!hasValue) {\n subscriber.next(defaultValue!);\n }\n subscriber.complete();\n }\n )\n );\n });\n}\n", "import { MonoTypeOperatorFunction } from '../types';\nimport { EMPTY } from '../observable/empty';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Emits only the first `count` values emitted by the source Observable.\n *\n * <span class=\"informal\">Takes the first `count` values from the source, then\n * completes.</span>\n *\n * ![](take.png)\n *\n * `take` returns an Observable that emits only the first `count` values emitted\n * by the source Observable. If the source emits fewer than `count` values then\n * all of its values are emitted. After that, it completes, regardless if the\n * source completes.\n *\n * ## Example\n *\n * Take the first 5 seconds of an infinite 1-second interval Observable\n *\n * ```ts\n * import { interval, take } from 'rxjs';\n *\n * const intervalCount = interval(1000);\n * const takeFive = intervalCount.pipe(take(5));\n * takeFive.subscribe(x => console.log(x));\n *\n * // Logs:\n * // 0\n * // 1\n * // 2\n * // 3\n * // 4\n * ```\n *\n * @see {@link takeLast}\n * @see {@link takeUntil}\n * @see {@link takeWhile}\n * @see {@link skip}\n *\n * @param count The maximum number of `next` values to emit.\n * @return A function that returns an Observable that emits only the first\n * `count` values emitted by the source Observable, or all of the values from\n * the source if the source emits fewer than `count` values.\n */\nexport function take<T>(count: number): MonoTypeOperatorFunction<T> {\n return count <= 0\n ? // If we are taking no values, that's empty.\n () => EMPTY\n : operate((source, subscriber) => {\n let seen = 0;\n source.subscribe(\n createOperatorSubscriber(subscriber, (value) => {\n // Increment the number of values we have seen,\n // then check it against the allowed count to see\n // if we are still letting values through.\n if (++seen <= count) {\n subscriber.next(value);\n // If we have met or passed our allowed count,\n // we need to complete. We have to do <= here,\n // because re-entrant code will increment `seen` twice.\n if (count <= seen) {\n subscriber.complete();\n }\n }\n })\n );\n });\n}\n", "import { OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { noop } from '../util/noop';\n\n/**\n * Ignores all items emitted by the source Observable and only passes calls of `complete` or `error`.\n *\n * ![](ignoreElements.png)\n *\n * The `ignoreElements` operator suppresses all items emitted by the source Observable,\n * but allows its termination notification (either `error` or `complete`) to pass through unchanged.\n *\n * If you do not care about the items being emitted by an Observable, but you do want to be notified\n * when it completes or when it terminates with an error, you can apply the `ignoreElements` operator\n * to the Observable, which will ensure that it will never call its observers\u2019 `next` handlers.\n *\n * ## Example\n *\n * Ignore all `next` emissions from the source\n *\n * ```ts\n * import { of, ignoreElements } from 'rxjs';\n *\n * of('you', 'talking', 'to', 'me')\n * .pipe(ignoreElements())\n * .subscribe({\n * next: word => console.log(word),\n * error: err => console.log('error:', err),\n * complete: () => console.log('the end'),\n * });\n *\n * // result:\n * // 'the end'\n * ```\n *\n * @return A function that returns an empty Observable that only calls\n * `complete` or `error`, based on which one is called by the source\n * Observable.\n */\nexport function ignoreElements(): OperatorFunction<unknown, never> {\n return operate((source, subscriber) => {\n source.subscribe(createOperatorSubscriber(subscriber, noop));\n });\n}\n", "import { OperatorFunction } from '../types';\nimport { map } from './map';\n\n/** @deprecated To be removed in v9. Use {@link map} instead: `map(() => value)`. */\nexport function mapTo<R>(value: R): OperatorFunction<unknown, R>;\n/**\n * @deprecated Do not specify explicit type parameters. Signatures with type parameters\n * that cannot be inferred will be removed in v8. `mapTo` itself will be removed in v9,\n * use {@link map} instead: `map(() => value)`.\n * */\nexport function mapTo<T, R>(value: R): OperatorFunction<T, R>;\n\n/**\n * Emits the given constant value on the output Observable every time the source\n * Observable emits a value.\n *\n * <span class=\"informal\">Like {@link map}, but it maps every source value to\n * the same output value every time.</span>\n *\n * ![](mapTo.png)\n *\n * Takes a constant `value` as argument, and emits that whenever the source\n * Observable emits a value. In other words, ignores the actual source value,\n * and simply uses the emission moment to know when to emit the given `value`.\n *\n * ## Example\n *\n * Map every click to the string `'Hi'`\n *\n * ```ts\n * import { fromEvent, mapTo } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const greetings = clicks.pipe(mapTo('Hi'));\n *\n * greetings.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link map}\n *\n * @param value The value to map each source value to.\n * @return A function that returns an Observable that emits the given `value`\n * every time the source Observable emits.\n * @deprecated To be removed in v9. Use {@link map} instead: `map(() => value)`.\n */\nexport function mapTo<R>(value: R): OperatorFunction<unknown, R> {\n return map(() => value);\n}\n", "import { Observable } from '../Observable';\nimport { MonoTypeOperatorFunction, ObservableInput } from '../types';\nimport { concat } from '../observable/concat';\nimport { take } from './take';\nimport { ignoreElements } from './ignoreElements';\nimport { mapTo } from './mapTo';\nimport { mergeMap } from './mergeMap';\nimport { innerFrom } from '../observable/innerFrom';\n\n/** @deprecated The `subscriptionDelay` parameter will be removed in v8. */\nexport function delayWhen<T>(\n delayDurationSelector: (value: T, index: number) => ObservableInput<any>,\n subscriptionDelay: Observable<any>\n): MonoTypeOperatorFunction<T>;\nexport function delayWhen<T>(delayDurationSelector: (value: T, index: number) => ObservableInput<any>): MonoTypeOperatorFunction<T>;\n\n/**\n * Delays the emission of items from the source Observable by a given time span\n * determined by the emissions of another Observable.\n *\n * <span class=\"informal\">It's like {@link delay}, but the time span of the\n * delay duration is determined by a second Observable.</span>\n *\n * ![](delayWhen.png)\n *\n * `delayWhen` operator shifts each emitted value from the source Observable by\n * a time span determined by another Observable. When the source emits a value,\n * the `delayDurationSelector` function is called with the value emitted from\n * the source Observable as the first argument to the `delayDurationSelector`.\n * The `delayDurationSelector` function should return an {@link ObservableInput},\n * that is internally converted to an Observable that is called the \"duration\"\n * Observable.\n *\n * The source value is emitted on the output Observable only when the \"duration\"\n * Observable emits ({@link guide/glossary-and-semantics#next next}s) any value.\n * Upon that, the \"duration\" Observable gets unsubscribed.\n *\n * Before RxJS V7, the {@link guide/glossary-and-semantics#complete completion}\n * of the \"duration\" Observable would have been triggering the emission of the\n * source value to the output Observable, but with RxJS V7, this is not the case\n * anymore.\n *\n * Only next notifications (from the \"duration\" Observable) trigger values from\n * the source Observable to be passed to the output Observable. If the \"duration\"\n * Observable only emits the complete notification (without next), the value\n * emitted by the source Observable will never get to the output Observable - it\n * will be swallowed. If the \"duration\" Observable errors, the error will be\n * propagated to the output Observable.\n *\n * Optionally, `delayWhen` takes a second argument, `subscriptionDelay`, which\n * is an Observable. When `subscriptionDelay` emits its first value or\n * completes, the source Observable is subscribed to and starts behaving like\n * described in the previous paragraph. If `subscriptionDelay` is not provided,\n * `delayWhen` will subscribe to the source Observable as soon as the output\n * Observable is subscribed.\n *\n * ## Example\n *\n * Delay each click by a random amount of time, between 0 and 5 seconds\n *\n * ```ts\n * import { fromEvent, delayWhen, interval } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const delayedClicks = clicks.pipe(\n * delayWhen(() => interval(Math.random() * 5000))\n * );\n * delayedClicks.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link delay}\n * @see {@link throttle}\n * @see {@link throttleTime}\n * @see {@link debounce}\n * @see {@link debounceTime}\n * @see {@link sample}\n * @see {@link sampleTime}\n * @see {@link audit}\n * @see {@link auditTime}\n *\n * @param delayDurationSelector A function that returns an `ObservableInput` for\n * each `value` emitted by the source Observable, which is then used to delay the\n * emission of that `value` on the output Observable until the `ObservableInput`\n * returned from this function emits a next value. When called, beside `value`,\n * this function receives a zero-based `index` of the emission order.\n * @param subscriptionDelay An Observable that triggers the subscription to the\n * source Observable once it emits any value.\n * @return A function that returns an Observable that delays the emissions of\n * the source Observable by an amount of time specified by the Observable\n * returned by `delayDurationSelector`.\n */\nexport function delayWhen<T>(\n delayDurationSelector: (value: T, index: number) => ObservableInput<any>,\n subscriptionDelay?: Observable<any>\n): MonoTypeOperatorFunction<T> {\n if (subscriptionDelay) {\n // DEPRECATED PATH\n return (source: Observable<T>) =>\n concat(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));\n }\n\n return mergeMap((value, index) => innerFrom(delayDurationSelector(value, index)).pipe(take(1), mapTo(value)));\n}\n", "import { asyncScheduler } from '../scheduler/async';\nimport { MonoTypeOperatorFunction, SchedulerLike } from '../types';\nimport { delayWhen } from './delayWhen';\nimport { timer } from '../observable/timer';\n\n/**\n * Delays the emission of items from the source Observable by a given timeout or\n * until a given Date.\n *\n * <span class=\"informal\">Time shifts each item by some specified amount of\n * milliseconds.</span>\n *\n * ![](delay.svg)\n *\n * If the delay argument is a Number, this operator time shifts the source\n * Observable by that amount of time expressed in milliseconds. The relative\n * time intervals between the values are preserved.\n *\n * If the delay argument is a Date, this operator time shifts the start of the\n * Observable execution until the given date occurs.\n *\n * ## Examples\n *\n * Delay each click by one second\n *\n * ```ts\n * import { fromEvent, delay } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const delayedClicks = clicks.pipe(delay(1000)); // each click emitted after 1 second\n * delayedClicks.subscribe(x => console.log(x));\n * ```\n *\n * Delay all clicks until a future date happens\n *\n * ```ts\n * import { fromEvent, delay } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const date = new Date('March 15, 2050 12:00:00'); // in the future\n * const delayedClicks = clicks.pipe(delay(date)); // click emitted only after that date\n * delayedClicks.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link delayWhen}\n * @see {@link throttle}\n * @see {@link throttleTime}\n * @see {@link debounce}\n * @see {@link debounceTime}\n * @see {@link sample}\n * @see {@link sampleTime}\n * @see {@link audit}\n * @see {@link auditTime}\n *\n * @param due The delay duration in milliseconds (a `number`) or a `Date` until\n * which the emission of the source items is delayed.\n * @param scheduler The {@link SchedulerLike} to use for managing the timers\n * that handle the time-shift for each item.\n * @return A function that returns an Observable that delays the emissions of\n * the source Observable by the specified timeout or Date.\n */\nexport function delay<T>(due: number | Date, scheduler: SchedulerLike = asyncScheduler): MonoTypeOperatorFunction<T> {\n const duration = timer(due, scheduler);\n return delayWhen(() => duration);\n}\n", "import { observeNotification } from '../Notification';\nimport { OperatorFunction, ObservableNotification, ValueFromNotification } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Converts an Observable of {@link ObservableNotification} objects into the emissions\n * that they represent.\n *\n * <span class=\"informal\">Unwraps {@link ObservableNotification} objects as actual `next`,\n * `error` and `complete` emissions. The opposite of {@link materialize}.</span>\n *\n * ![](dematerialize.png)\n *\n * `dematerialize` is assumed to operate an Observable that only emits\n * {@link ObservableNotification} objects as `next` emissions, and does not emit any\n * `error`. Such Observable is the output of a `materialize` operation. Those\n * notifications are then unwrapped using the metadata they contain, and emitted\n * as `next`, `error`, and `complete` on the output Observable.\n *\n * Use this operator in conjunction with {@link materialize}.\n *\n * ## Example\n *\n * Convert an Observable of Notifications to an actual Observable\n *\n * ```ts\n * import { NextNotification, ErrorNotification, of, dematerialize } from 'rxjs';\n *\n * const notifA: NextNotification<string> = { kind: 'N', value: 'A' };\n * const notifB: NextNotification<string> = { kind: 'N', value: 'B' };\n * const notifE: ErrorNotification = { kind: 'E', error: new TypeError('x.toUpperCase is not a function') };\n *\n * const materialized = of(notifA, notifB, notifE);\n *\n * const upperCase = materialized.pipe(dematerialize());\n * upperCase.subscribe({\n * next: x => console.log(x),\n * error: e => console.error(e)\n * });\n *\n * // Results in:\n * // A\n * // B\n * // TypeError: x.toUpperCase is not a function\n * ```\n *\n * @see {@link materialize}\n *\n * @return A function that returns an Observable that emits items and\n * notifications embedded in Notification objects emitted by the source\n * Observable.\n */\nexport function dematerialize<N extends ObservableNotification<any>>(): OperatorFunction<N, ValueFromNotification<N>> {\n return operate((source, subscriber) => {\n source.subscribe(createOperatorSubscriber(subscriber, (notification) => observeNotification(notification, subscriber)));\n });\n}\n", "import { MonoTypeOperatorFunction, ObservableInput } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { noop } from '../util/noop';\nimport { innerFrom } from '../observable/innerFrom';\n\n/**\n * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items.\n *\n * If a `keySelector` function is provided, then it will project each value from the source observable into a new value that it will\n * check for equality with previously projected values. If the `keySelector` function is not provided, it will use each value from the\n * source observable directly with an equality check against previous values.\n *\n * In JavaScript runtimes that support `Set`, this operator will use a `Set` to improve performance of the distinct value checking.\n *\n * In other runtimes, this operator will use a minimal implementation of `Set` that relies on an `Array` and `indexOf` under the\n * hood, so performance will degrade as more values are checked for distinction. Even in newer browsers, a long-running `distinct`\n * use might result in memory leaks. To help alleviate this in some scenarios, an optional `flushes` parameter is also provided so\n * that the internal `Set` can be \"flushed\", basically clearing it of values.\n *\n * ## Examples\n *\n * A simple example with numbers\n *\n * ```ts\n * import { of, distinct } from 'rxjs';\n *\n * of(1, 1, 2, 2, 2, 1, 2, 3, 4, 3, 2, 1)\n * .pipe(distinct())\n * .subscribe(x => console.log(x));\n *\n * // Outputs\n * // 1\n * // 2\n * // 3\n * // 4\n * ```\n *\n * An example using the `keySelector` function\n *\n * ```ts\n * import { of, distinct } from 'rxjs';\n *\n * of(\n * { age: 4, name: 'Foo'},\n * { age: 7, name: 'Bar'},\n * { age: 5, name: 'Foo'}\n * )\n * .pipe(distinct(({ name }) => name))\n * .subscribe(x => console.log(x));\n *\n * // Outputs\n * // { age: 4, name: 'Foo' }\n * // { age: 7, name: 'Bar' }\n * ```\n * @see {@link distinctUntilChanged}\n * @see {@link distinctUntilKeyChanged}\n *\n * @param keySelector Optional `function` to select which value you want to check as distinct.\n * @param flushes Optional `ObservableInput` for flushing the internal HashSet of the operator.\n * @return A function that returns an Observable that emits items from the\n * source Observable with distinct values.\n */\nexport function distinct<T, K>(keySelector?: (value: T) => K, flushes?: ObservableInput<any>): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n const distinctKeys = new Set();\n source.subscribe(\n createOperatorSubscriber(subscriber, (value) => {\n const key = keySelector ? keySelector(value) : value;\n if (!distinctKeys.has(key)) {\n distinctKeys.add(key);\n subscriber.next(value);\n }\n })\n );\n\n flushes && innerFrom(flushes).subscribe(createOperatorSubscriber(subscriber, () => distinctKeys.clear(), noop));\n });\n}\n", "import { MonoTypeOperatorFunction } from '../types';\nimport { identity } from '../util/identity';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\nexport function distinctUntilChanged<T>(comparator?: (previous: T, current: T) => boolean): MonoTypeOperatorFunction<T>;\nexport function distinctUntilChanged<T, K>(\n comparator: (previous: K, current: K) => boolean,\n keySelector: (value: T) => K\n): MonoTypeOperatorFunction<T>;\n\n/**\n * Returns a result {@link Observable} that emits all values pushed by the source observable if they\n * are distinct in comparison to the last value the result observable emitted.\n *\n * When provided without parameters or with the first parameter (`{@link distinctUntilChanged#comparator comparator}`),\n * it behaves like this:\n *\n * 1. It will always emit the first value from the source.\n * 2. For all subsequent values pushed by the source, they will be compared to the previously emitted values\n * using the provided `comparator` or an `===` equality check.\n * 3. If the value pushed by the source is determined to be unequal by this check, that value is emitted and\n * becomes the new \"previously emitted value\" internally.\n *\n * When the second parameter (`{@link distinctUntilChanged#keySelector keySelector}`) is provided, the behavior\n * changes:\n *\n * 1. It will always emit the first value from the source.\n * 2. The `keySelector` will be run against all values, including the first value.\n * 3. For all values after the first, the selected key will be compared against the key selected from\n * the previously emitted value using the `comparator`.\n * 4. If the keys are determined to be unequal by this check, the value (not the key), is emitted\n * and the selected key from that value is saved for future comparisons against other keys.\n *\n * ## Examples\n *\n * A very basic example with no `{@link distinctUntilChanged#comparator comparator}`. Note that `1` is emitted more than once,\n * because it's distinct in comparison to the _previously emitted_ value,\n * not in comparison to _all other emitted values_.\n *\n * ```ts\n * import { of, distinctUntilChanged } from 'rxjs';\n *\n * of(1, 1, 1, 2, 2, 2, 1, 1, 3, 3)\n * .pipe(distinctUntilChanged())\n * .subscribe(console.log);\n * // Logs: 1, 2, 1, 3\n * ```\n *\n * With a `{@link distinctUntilChanged#comparator comparator}`, you can do custom comparisons. Let's say\n * you only want to emit a value when all of its components have\n * changed:\n *\n * ```ts\n * import { of, distinctUntilChanged } from 'rxjs';\n *\n * const totallyDifferentBuilds$ = of(\n * { engineVersion: '1.1.0', transmissionVersion: '1.2.0' },\n * { engineVersion: '1.1.0', transmissionVersion: '1.4.0' },\n * { engineVersion: '1.3.0', transmissionVersion: '1.4.0' },\n * { engineVersion: '1.3.0', transmissionVersion: '1.5.0' },\n * { engineVersion: '2.0.0', transmissionVersion: '1.5.0' }\n * ).pipe(\n * distinctUntilChanged((prev, curr) => {\n * return (\n * prev.engineVersion === curr.engineVersion ||\n * prev.transmissionVersion === curr.transmissionVersion\n * );\n * })\n * );\n *\n * totallyDifferentBuilds$.subscribe(console.log);\n *\n * // Logs:\n * // { engineVersion: '1.1.0', transmissionVersion: '1.2.0' }\n * // { engineVersion: '1.3.0', transmissionVersion: '1.4.0' }\n * // { engineVersion: '2.0.0', transmissionVersion: '1.5.0' }\n * ```\n *\n * You can also provide a custom `{@link distinctUntilChanged#comparator comparator}` to check that emitted\n * changes are only in one direction. Let's say you only want to get\n * the next record temperature:\n *\n * ```ts\n * import { of, distinctUntilChanged } from 'rxjs';\n *\n * const temps$ = of(30, 31, 20, 34, 33, 29, 35, 20);\n *\n * const recordHighs$ = temps$.pipe(\n * distinctUntilChanged((prevHigh, temp) => {\n * // If the current temp is less than\n * // or the same as the previous record,\n * // the record hasn't changed.\n * return temp <= prevHigh;\n * })\n * );\n *\n * recordHighs$.subscribe(console.log);\n * // Logs: 30, 31, 34, 35\n * ```\n *\n * Selecting update events only when the `updatedBy` field shows\n * the account changed hands.\n *\n * ```ts\n * import { of, distinctUntilChanged } from 'rxjs';\n *\n * // A stream of updates to a given account\n * const accountUpdates$ = of(\n * { updatedBy: 'blesh', data: [] },\n * { updatedBy: 'blesh', data: [] },\n * { updatedBy: 'ncjamieson', data: [] },\n * { updatedBy: 'ncjamieson', data: [] },\n * { updatedBy: 'blesh', data: [] }\n * );\n *\n * // We only want the events where it changed hands\n * const changedHands$ = accountUpdates$.pipe(\n * distinctUntilChanged(undefined, update => update.updatedBy)\n * );\n *\n * changedHands$.subscribe(console.log);\n * // Logs:\n * // { updatedBy: 'blesh', data: Array[0] }\n * // { updatedBy: 'ncjamieson', data: Array[0] }\n * // { updatedBy: 'blesh', data: Array[0] }\n * ```\n *\n * @see {@link distinct}\n * @see {@link distinctUntilKeyChanged}\n *\n * @param comparator A function used to compare the previous and current keys for\n * equality. Defaults to a `===` check.\n * @param keySelector Used to select a key value to be passed to the `comparator`.\n *\n * @return A function that returns an Observable that emits items from the\n * source Observable with distinct values.\n */\nexport function distinctUntilChanged<T, K>(\n comparator?: (previous: K, current: K) => boolean,\n keySelector: (value: T) => K = identity as (value: T) => K\n): MonoTypeOperatorFunction<T> {\n // We've been allowing `null` do be passed as the `compare`, so we can't do\n // a default value for the parameter, because that will only work\n // for `undefined`.\n comparator = comparator ?? defaultCompare;\n\n return operate((source, subscriber) => {\n // The previous key, used to compare against keys selected\n // from new arrivals to determine \"distinctiveness\".\n let previousKey: K;\n // Whether or not this is the first value we've gotten.\n let first = true;\n\n source.subscribe(\n createOperatorSubscriber(subscriber, (value) => {\n // We always call the key selector.\n const currentKey = keySelector(value);\n\n // If it's the first value, we always emit it.\n // Otherwise, we compare this key to the previous key, and\n // if the comparer returns false, we emit.\n if (first || !comparator!(previousKey, currentKey)) {\n // Update our state *before* we emit the value\n // as emission can be the source of re-entrant code\n // in functional libraries like this. We only really\n // need to do this if it's the first value, or if the\n // key we're tracking in previous needs to change.\n first = false;\n previousKey = currentKey;\n\n // Emit the value!\n subscriber.next(value);\n }\n })\n );\n });\n}\n\nfunction defaultCompare(a: any, b: any) {\n return a === b;\n}\n", "import { distinctUntilChanged } from './distinctUntilChanged';\nimport { MonoTypeOperatorFunction } from '../types';\n\nexport function distinctUntilKeyChanged<T>(key: keyof T): MonoTypeOperatorFunction<T>;\nexport function distinctUntilKeyChanged<T, K extends keyof T>(key: K, compare: (x: T[K], y: T[K]) => boolean): MonoTypeOperatorFunction<T>;\n\n/**\n * Returns an Observable that emits all items emitted by the source Observable that\n * are distinct by comparison from the previous item, using a property accessed by\n * using the key provided to check if the two items are distinct.\n *\n * If a comparator function is provided, then it will be called for each item to\n * test for whether that value should be emitted or not.\n *\n * If a comparator function is not provided, an equality check is used by default.\n *\n * ## Examples\n *\n * An example comparing the name of persons\n *\n * ```ts\n * import { of, distinctUntilKeyChanged } from 'rxjs';\n *\n * of(\n * { age: 4, name: 'Foo' },\n * { age: 7, name: 'Bar' },\n * { age: 5, name: 'Foo' },\n * { age: 6, name: 'Foo' }\n * ).pipe(\n * distinctUntilKeyChanged('name')\n * )\n * .subscribe(x => console.log(x));\n *\n * // displays:\n * // { age: 4, name: 'Foo' }\n * // { age: 7, name: 'Bar' }\n * // { age: 5, name: 'Foo' }\n * ```\n *\n * An example comparing the first letters of the name\n *\n * ```ts\n * import { of, distinctUntilKeyChanged } from 'rxjs';\n *\n * of(\n * { age: 4, name: 'Foo1' },\n * { age: 7, name: 'Bar' },\n * { age: 5, name: 'Foo2' },\n * { age: 6, name: 'Foo3' }\n * ).pipe(\n * distinctUntilKeyChanged('name', (x, y) => x.substring(0, 3) === y.substring(0, 3))\n * )\n * .subscribe(x => console.log(x));\n *\n * // displays:\n * // { age: 4, name: 'Foo1' }\n * // { age: 7, name: 'Bar' }\n * // { age: 5, name: 'Foo2' }\n * ```\n *\n * @see {@link distinct}\n * @see {@link distinctUntilChanged}\n *\n * @param key String key for object property lookup on each item.\n * @param compare Optional comparison function called to test if an item is distinct\n * from the previous item in the source.\n * @return A function that returns an Observable that emits items from the source\n * Observable with distinct values based on the key specified.\n */\nexport function distinctUntilKeyChanged<T, K extends keyof T>(\n key: K,\n compare?: (x: T[K], y: T[K]) => boolean\n): MonoTypeOperatorFunction<T> {\n return distinctUntilChanged((x: T, y: T) => (compare ? compare(x[key], y[key]) : x[key] === y[key]));\n}\n", "import { EmptyError } from '../util/EmptyError';\nimport { MonoTypeOperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * If the source observable completes without emitting a value, it will emit\n * an error. The error will be created at that time by the optional\n * `errorFactory` argument, otherwise, the error will be {@link EmptyError}.\n *\n * ![](throwIfEmpty.png)\n *\n * ## Example\n *\n * Throw an error if the document wasn't clicked within 1 second\n *\n * ```ts\n * import { fromEvent, takeUntil, timer, throwIfEmpty } from 'rxjs';\n *\n * const click$ = fromEvent(document, 'click');\n *\n * click$.pipe(\n * takeUntil(timer(1000)),\n * throwIfEmpty(() => new Error('The document was not clicked within 1 second'))\n * )\n * .subscribe({\n * next() {\n * console.log('The document was clicked');\n * },\n * error(err) {\n * console.error(err.message);\n * }\n * });\n * ```\n *\n * @param errorFactory A factory function called to produce the\n * error to be thrown when the source observable completes without emitting a\n * value.\n * @return A function that returns an Observable that throws an error if the\n * source Observable completed without emitting.\n */\nexport function throwIfEmpty<T>(errorFactory: () => any = defaultErrorFactory): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n let hasValue = false;\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => {\n hasValue = true;\n subscriber.next(value);\n },\n () => (hasValue ? subscriber.complete() : subscriber.error(errorFactory()))\n )\n );\n });\n}\n\nfunction defaultErrorFactory() {\n return new EmptyError();\n}\n", "import { ArgumentOutOfRangeError } from '../util/ArgumentOutOfRangeError';\nimport { Observable } from '../Observable';\nimport { OperatorFunction } from '../types';\nimport { filter } from './filter';\nimport { throwIfEmpty } from './throwIfEmpty';\nimport { defaultIfEmpty } from './defaultIfEmpty';\nimport { take } from './take';\n\n/**\n * Emits the single value at the specified `index` in a sequence of emissions\n * from the source Observable.\n *\n * <span class=\"informal\">Emits only the i-th value, then completes.</span>\n *\n * ![](elementAt.png)\n *\n * `elementAt` returns an Observable that emits the item at the specified\n * `index` in the source Observable, or a default value if that `index` is out\n * of range and the `default` argument is provided. If the `default` argument is\n * not given and the `index` is out of range, the output Observable will emit an\n * `ArgumentOutOfRangeError` error.\n *\n * ## Example\n *\n * Emit only the third click event\n *\n * ```ts\n * import { fromEvent, elementAt } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(elementAt(2));\n * result.subscribe(x => console.log(x));\n *\n * // Results in:\n * // click 1 = nothing\n * // click 2 = nothing\n * // click 3 = MouseEvent object logged to console\n * ```\n *\n * @see {@link first}\n * @see {@link last}\n * @see {@link skip}\n * @see {@link single}\n * @see {@link take}\n *\n * @throws {ArgumentOutOfRangeError} When using `elementAt(i)`, it delivers an\n * `ArgumentOutOfRangeError` to the Observer's `error` callback if `i < 0` or the\n * Observable has completed before emitting the i-th `next` notification.\n *\n * @param index Is the number `i` for the i-th source emission that has happened\n * since the subscription, starting from the number `0`.\n * @param defaultValue The default value returned for missing indices.\n * @return A function that returns an Observable that emits a single item, if\n * it is found. Otherwise, it will emit the default value if given. If not, it\n * emits an error.\n */\nexport function elementAt<T, D = T>(index: number, defaultValue?: D): OperatorFunction<T, T | D> {\n if (index < 0) {\n throw new ArgumentOutOfRangeError();\n }\n const hasDefaultValue = arguments.length >= 2;\n return (source: Observable<T>) =>\n source.pipe(\n filter((v, i) => i === index),\n take(1),\n hasDefaultValue ? defaultIfEmpty(defaultValue!) : throwIfEmpty(() => new ArgumentOutOfRangeError())\n );\n}\n", "/** prettier */\nimport { Observable } from '../Observable';\nimport { concat } from '../observable/concat';\nimport { of } from '../observable/of';\nimport { MonoTypeOperatorFunction, SchedulerLike, OperatorFunction, ValueFromArray } from '../types';\n\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `concatAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function endWith<T>(scheduler: SchedulerLike): MonoTypeOperatorFunction<T>;\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `concatAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function endWith<T, A extends unknown[] = T[]>(\n ...valuesAndScheduler: [...A, SchedulerLike]\n): OperatorFunction<T, T | ValueFromArray<A>>;\n\nexport function endWith<T, A extends unknown[] = T[]>(...values: A): OperatorFunction<T, T | ValueFromArray<A>>;\n\n/**\n * Returns an observable that will emit all values from the source, then synchronously emit\n * the provided value(s) immediately after the source completes.\n *\n * NOTE: Passing a last argument of a Scheduler is _deprecated_, and may result in incorrect\n * types in TypeScript.\n *\n * This is useful for knowing when an observable ends. Particularly when paired with an\n * operator like {@link takeUntil}\n *\n * ![](endWith.png)\n *\n * ## Example\n *\n * Emit values to know when an interval starts and stops. The interval will\n * stop when a user clicks anywhere on the document.\n *\n * ```ts\n * import { interval, map, fromEvent, startWith, takeUntil, endWith } from 'rxjs';\n *\n * const ticker$ = interval(5000).pipe(\n * map(() => 'tick')\n * );\n *\n * const documentClicks$ = fromEvent(document, 'click');\n *\n * ticker$.pipe(\n * startWith('interval started'),\n * takeUntil(documentClicks$),\n * endWith('interval ended by click')\n * )\n * .subscribe(x => console.log(x));\n *\n * // Result (assuming a user clicks after 15 seconds)\n * // 'interval started'\n * // 'tick'\n * // 'tick'\n * // 'tick'\n * // 'interval ended by click'\n * ```\n *\n * @see {@link startWith}\n * @see {@link concat}\n * @see {@link takeUntil}\n *\n * @param values Items you want the modified Observable to emit last.\n * @return A function that returns an Observable that emits all values from the\n * source, then synchronously emits the provided value(s) immediately after the\n * source completes.\n */\nexport function endWith<T>(...values: Array<T | SchedulerLike>): MonoTypeOperatorFunction<T> {\n return (source: Observable<T>) => concat(source, of(...values)) as Observable<T>;\n}\n", "import { Observable } from '../Observable';\nimport { Falsy, OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\nexport function every<T>(predicate: BooleanConstructor): OperatorFunction<T, Exclude<T, Falsy> extends never ? false : boolean>;\n/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */\nexport function every<T>(\n predicate: BooleanConstructor,\n thisArg: any\n): OperatorFunction<T, Exclude<T, Falsy> extends never ? false : boolean>;\n/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */\nexport function every<T, A>(\n predicate: (this: A, value: T, index: number, source: Observable<T>) => boolean,\n thisArg: A\n): OperatorFunction<T, boolean>;\nexport function every<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean): OperatorFunction<T, boolean>;\n\n/**\n * Returns an Observable that emits whether or not every item of the source satisfies the condition specified.\n *\n * <span class=\"informal\">If all values pass predicate before the source completes, emits true before completion,\n * otherwise emit false, then complete.</span>\n *\n * ![](every.png)\n *\n * ## Example\n *\n * A simple example emitting true if all elements are less than 5, false otherwise\n *\n * ```ts\n * import { of, every } from 'rxjs';\n *\n * of(1, 2, 3, 4, 5, 6)\n * .pipe(every(x => x < 5))\n * .subscribe(x => console.log(x)); // -> false\n * ```\n *\n * @param predicate A function for determining if an item meets a specified condition.\n * @param thisArg Optional object to use for `this` in the callback.\n * @return A function that returns an Observable of booleans that determines if\n * all items of the source Observable meet the condition specified.\n */\nexport function every<T>(\n predicate: (value: T, index: number, source: Observable<T>) => boolean,\n thisArg?: any\n): OperatorFunction<T, boolean> {\n return operate((source, subscriber) => {\n let index = 0;\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => {\n if (!predicate.call(thisArg, value, index++, source)) {\n subscriber.next(false);\n subscriber.complete();\n }\n },\n () => {\n subscriber.next(true);\n subscriber.complete();\n }\n )\n );\n });\n}\n", "import { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { ObservableInput, OperatorFunction, ObservedValueOf } from '../types';\nimport { map } from './map';\nimport { innerFrom } from '../observable/innerFrom';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/* tslint:disable:max-line-length */\nexport function exhaustMap<T, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O\n): OperatorFunction<T, ObservedValueOf<O>>;\n/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */\nexport function exhaustMap<T, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector: undefined\n): OperatorFunction<T, ObservedValueOf<O>>;\n/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */\nexport function exhaustMap<T, I, R>(\n project: (value: T, index: number) => ObservableInput<I>,\n resultSelector: (outerValue: T, innerValue: I, outerIndex: number, innerIndex: number) => R\n): OperatorFunction<T, R>;\n/* tslint:enable:max-line-length */\n\n/**\n * Projects each source value to an Observable which is merged in the output\n * Observable only if the previous projected Observable has completed.\n *\n * <span class=\"informal\">Maps each value to an Observable, then flattens all of\n * these inner Observables using {@link exhaustAll}.</span>\n *\n * ![](exhaustMap.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 (so-called \"inner\") Observable. When it projects a source value to\n * an Observable, the output Observable begins emitting the items emitted by\n * that projected Observable. However, `exhaustMap` ignores every new projected\n * Observable if the previous projected Observable has not yet completed. Once\n * that one completes, it will accept and flatten the next projected Observable\n * and repeat this process.\n *\n * ## Example\n *\n * Run a finite timer for each click, only if there is no currently active timer\n *\n * ```ts\n * import { fromEvent, exhaustMap, interval, take } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(\n * exhaustMap(() => interval(1000).pipe(take(5)))\n * );\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link concatMap}\n * @see {@link exhaust}\n * @see {@link mergeMap}\n * @see {@link switchMap}\n *\n * @param project A function that, when applied to an item emitted by the source\n * Observable, returns an Observable.\n * @return A function that returns an Observable containing projected\n * Observables of each item of the source, ignoring projected Observables that\n * start before their preceding Observable has completed.\n */\nexport function exhaustMap<T, R, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector?: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R\n): OperatorFunction<T, ObservedValueOf<O> | R> {\n if (resultSelector) {\n // DEPRECATED PATH\n return (source: Observable<T>) =>\n source.pipe(exhaustMap((a, i) => innerFrom(project(a, i)).pipe(map((b: any, ii: any) => resultSelector(a, b, i, ii)))));\n }\n return operate((source, subscriber) => {\n let index = 0;\n let innerSub: Subscriber<T> | null = null;\n let isComplete = false;\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (outerValue) => {\n if (!innerSub) {\n innerSub = createOperatorSubscriber(subscriber, undefined, () => {\n innerSub = null;\n isComplete && subscriber.complete();\n });\n innerFrom(project(outerValue, index++)).subscribe(innerSub);\n }\n },\n () => {\n isComplete = true;\n !innerSub && subscriber.complete();\n }\n )\n );\n });\n}\n", "import { OperatorFunction, ObservableInput, ObservedValueOf } from '../types';\nimport { exhaustMap } from './exhaustMap';\nimport { identity } from '../util/identity';\n\n/**\n * Converts a higher-order Observable into a first-order Observable by dropping\n * inner Observables while the previous inner Observable has not yet completed.\n *\n * <span class=\"informal\">Flattens an Observable-of-Observables by dropping the\n * next inner Observables while the current inner is still executing.</span>\n *\n * ![](exhaustAll.svg)\n *\n * `exhaustAll` subscribes to an Observable that emits Observables, also known as a\n * higher-order Observable. Each time it observes one of these emitted inner\n * Observables, the output Observable begins emitting the items emitted by that\n * inner Observable. So far, it behaves like {@link mergeAll}. However,\n * `exhaustAll` ignores every new inner Observable if the previous Observable has\n * not yet completed. Once that one completes, it will accept and flatten the\n * next inner Observable and repeat this process.\n *\n * ## Example\n *\n * Run a finite timer for each click, only if there is no currently active timer\n *\n * ```ts\n * import { fromEvent, map, interval, take, exhaustAll } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const higherOrder = clicks.pipe(\n * map(() => interval(1000).pipe(take(5)))\n * );\n * const result = higherOrder.pipe(exhaustAll());\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link combineLatestAll}\n * @see {@link concatAll}\n * @see {@link switchAll}\n * @see {@link switchMap}\n * @see {@link mergeAll}\n * @see {@link exhaustMap}\n * @see {@link zipAll}\n *\n * @return A function that returns an Observable that takes a source of\n * Observables and propagates the first Observable exclusively until it\n * completes before subscribing to the next.\n */\nexport function exhaustAll<O extends ObservableInput<any>>(): OperatorFunction<O, ObservedValueOf<O>> {\n return exhaustMap(identity);\n}\n", "import { exhaustAll } from './exhaustAll';\n\n/**\n * @deprecated Renamed to {@link exhaustAll}. Will be removed in v8.\n */\nexport const exhaust = exhaustAll;\n", "import { OperatorFunction, ObservableInput, ObservedValueOf, SchedulerLike } from '../types';\nimport { operate } from '../util/lift';\nimport { mergeInternals } from './mergeInternals';\n\n/* tslint:disable:max-line-length */\nexport function expand<T, O extends ObservableInput<unknown>>(\n project: (value: T, index: number) => O,\n concurrent?: number,\n scheduler?: SchedulerLike\n): OperatorFunction<T, ObservedValueOf<O>>;\n/**\n * @deprecated The `scheduler` parameter will be removed in v8. If you need to schedule the inner subscription,\n * use `subscribeOn` within the projection function: `expand((value) => fn(value).pipe(subscribeOn(scheduler)))`.\n * Details: Details: https://rxjs.dev/deprecations/scheduler-argument\n */\nexport function expand<T, O extends ObservableInput<unknown>>(\n project: (value: T, index: number) => O,\n concurrent: number | undefined,\n scheduler: SchedulerLike\n): OperatorFunction<T, ObservedValueOf<O>>;\n/* tslint:enable:max-line-length */\n\n/**\n * Recursively projects each source value to an Observable which is merged in\n * the output Observable.\n *\n * <span class=\"informal\">It's similar to {@link mergeMap}, but applies the\n * projection function to every source value as well as every output value.\n * It's recursive.</span>\n *\n * ![](expand.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. *Expand* will re-emit on the output\n * Observable every source value. Then, each output value is given to the\n * `project` function which returns an inner Observable to be merged on the\n * output Observable. Those output values resulting from the projection are also\n * given to the `project` function to produce new output values. This is how\n * *expand* behaves recursively.\n *\n * ## Example\n *\n * Start emitting the powers of two on every click, at most 10 of them\n *\n * ```ts\n * import { fromEvent, map, expand, of, delay, take } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const powersOfTwo = clicks.pipe(\n * map(() => 1),\n * expand(x => of(2 * x).pipe(delay(1000))),\n * take(10)\n * );\n * powersOfTwo.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link mergeMap}\n * @see {@link mergeScan}\n *\n * @param project A function that, when applied to an item emitted by the source\n * or the output Observable, returns an Observable.\n * @param concurrent Maximum number of input Observables being subscribed to\n * concurrently.\n * @param scheduler The {@link SchedulerLike} to use for subscribing to\n * each projected inner Observable.\n * @return A function that returns an Observable that emits the source values\n * and also result of applying the projection function to each value emitted on\n * the output Observable and merging the results of the Observables obtained\n * from this transformation.\n */\nexport function expand<T, O extends ObservableInput<unknown>>(\n project: (value: T, index: number) => O,\n concurrent = Infinity,\n scheduler?: SchedulerLike\n): OperatorFunction<T, ObservedValueOf<O>> {\n concurrent = (concurrent || 0) < 1 ? Infinity : concurrent;\n return operate((source, subscriber) =>\n mergeInternals(\n // General merge params\n source,\n subscriber,\n project,\n concurrent,\n\n // onBeforeNext\n undefined,\n\n // Expand-specific\n true, // Use expand path\n scheduler // Inner subscription scheduler\n )\n );\n}\n", "import { MonoTypeOperatorFunction } from '../types';\nimport { operate } from '../util/lift';\n\n/**\n * Returns an Observable that mirrors the source Observable, but will call a specified function when\n * the source terminates on complete or error.\n * The specified function will also be called when the subscriber explicitly unsubscribes.\n *\n * ## Examples\n *\n * Execute callback function when the observable completes\n *\n * ```ts\n * import { interval, take, finalize } from 'rxjs';\n *\n * // emit value in sequence every 1 second\n * const source = interval(1000);\n * const example = source.pipe(\n * take(5), //take only the first 5 values\n * finalize(() => console.log('Sequence complete')) // Execute when the observable completes\n * );\n * const subscribe = example.subscribe(val => console.log(val));\n *\n * // results:\n * // 0\n * // 1\n * // 2\n * // 3\n * // 4\n * // 'Sequence complete'\n * ```\n *\n * Execute callback function when the subscriber explicitly unsubscribes\n *\n * ```ts\n * import { interval, finalize, tap, noop, timer } from 'rxjs';\n *\n * const source = interval(100).pipe(\n * finalize(() => console.log('[finalize] Called')),\n * tap({\n * next: () => console.log('[next] Called'),\n * error: () => console.log('[error] Not called'),\n * complete: () => console.log('[tap complete] Not called')\n * })\n * );\n *\n * const sub = source.subscribe({\n * next: x => console.log(x),\n * error: noop,\n * complete: () => console.log('[complete] Not called')\n * });\n *\n * timer(150).subscribe(() => sub.unsubscribe());\n *\n * // results:\n * // '[next] Called'\n * // 0\n * // '[finalize] Called'\n * ```\n *\n * @param callback Function to be called when source terminates.\n * @return A function that returns an Observable that mirrors the source, but\n * will call the specified function on termination.\n */\nexport function finalize<T>(callback: () => void): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n // TODO: This try/finally was only added for `useDeprecatedSynchronousErrorHandling`.\n // REMOVE THIS WHEN THAT HOT GARBAGE IS REMOVED IN V8.\n try {\n source.subscribe(subscriber);\n } finally {\n subscriber.add(callback);\n }\n });\n}\n", "import { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { OperatorFunction, TruthyTypesOf } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\nexport function find<T>(predicate: BooleanConstructor): OperatorFunction<T, TruthyTypesOf<T>>;\n/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */\nexport function find<T, S extends T, A>(\n predicate: (this: A, value: T, index: number, source: Observable<T>) => value is S,\n thisArg: A\n): OperatorFunction<T, S | undefined>;\nexport function find<T, S extends T>(\n predicate: (value: T, index: number, source: Observable<T>) => value is S\n): OperatorFunction<T, S | undefined>;\n/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */\nexport function find<T, A>(\n predicate: (this: A, value: T, index: number, source: Observable<T>) => boolean,\n thisArg: A\n): OperatorFunction<T, T | undefined>;\nexport function find<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean): OperatorFunction<T, T | undefined>;\n/**\n * Emits only the first value emitted by the source Observable that meets some\n * condition.\n *\n * <span class=\"informal\">Finds the first value that passes some test and emits\n * that.</span>\n *\n * ![](find.png)\n *\n * `find` searches for the first item in the source Observable that matches the\n * specified condition embodied by the `predicate`, and returns the first\n * occurrence in the source. Unlike {@link first}, the `predicate` is required\n * in `find`, and does not emit an error if a valid value is not found\n * (emits `undefined` instead).\n *\n * ## Example\n *\n * Find and emit the first click that happens on a DIV element\n *\n * ```ts\n * import { fromEvent, find } from 'rxjs';\n *\n * const div = document.createElement('div');\n * div.style.cssText = 'width: 200px; height: 200px; background: #09c;';\n * document.body.appendChild(div);\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(find(ev => (<HTMLElement>ev.target).tagName === 'DIV'));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link filter}\n * @see {@link first}\n * @see {@link findIndex}\n * @see {@link take}\n *\n * @param predicate A function called with each item to test for condition matching.\n * @param thisArg An optional argument to determine the value of `this` in the\n * `predicate` function.\n * @return A function that returns an Observable that emits the first item that\n * matches the condition.\n */\nexport function find<T>(\n predicate: (value: T, index: number, source: Observable<T>) => boolean,\n thisArg?: any\n): OperatorFunction<T, T | undefined> {\n return operate(createFind(predicate, thisArg, 'value'));\n}\n\nexport function createFind<T>(\n predicate: (value: T, index: number, source: Observable<T>) => boolean,\n thisArg: any,\n emit: 'value' | 'index'\n) {\n const findIndex = emit === 'index';\n return (source: Observable<T>, subscriber: Subscriber<any>) => {\n let index = 0;\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => {\n const i = index++;\n if (predicate.call(thisArg, value, i, source)) {\n subscriber.next(findIndex ? i : value);\n subscriber.complete();\n }\n },\n () => {\n subscriber.next(findIndex ? -1 : undefined);\n subscriber.complete();\n }\n )\n );\n };\n}\n", "import { Observable } from '../Observable';\nimport { Falsy, OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { createFind } from './find';\n\nexport function findIndex<T>(predicate: BooleanConstructor): OperatorFunction<T, T extends Falsy ? -1 : number>;\n/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */\nexport function findIndex<T>(predicate: BooleanConstructor, thisArg: any): OperatorFunction<T, T extends Falsy ? -1 : number>;\n/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */\nexport function findIndex<T, A>(\n predicate: (this: A, value: T, index: number, source: Observable<T>) => boolean,\n thisArg: A\n): OperatorFunction<T, number>;\nexport function findIndex<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean): OperatorFunction<T, number>;\n\n/**\n * Emits only the index of the first value emitted by the source Observable that\n * meets some condition.\n *\n * <span class=\"informal\">It's like {@link find}, but emits the index of the\n * found value, not the value itself.</span>\n *\n * ![](findIndex.png)\n *\n * `findIndex` searches for the first item in the source Observable that matches\n * the specified condition embodied by the `predicate`, and returns the\n * (zero-based) index of the first occurrence in the source. Unlike\n * {@link first}, the `predicate` is required in `findIndex`, and does not emit\n * an error if a valid value is not found.\n *\n * ## Example\n *\n * Emit the index of first click that happens on a DIV element\n *\n * ```ts\n * import { fromEvent, findIndex } from 'rxjs';\n *\n * const div = document.createElement('div');\n * div.style.cssText = 'width: 200px; height: 200px; background: #09c;';\n * document.body.appendChild(div);\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(findIndex(ev => (<HTMLElement>ev.target).tagName === 'DIV'));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link filter}\n * @see {@link find}\n * @see {@link first}\n * @see {@link take}\n *\n * @param predicate A function called with each item to test for condition matching.\n * @param thisArg An optional argument to determine the value of `this` in the\n * `predicate` function.\n * @return A function that returns an Observable that emits the index of the\n * first item that matches the condition.\n */\nexport function findIndex<T>(\n predicate: (value: T, index: number, source: Observable<T>) => boolean,\n thisArg?: any\n): OperatorFunction<T, number> {\n return operate(createFind(predicate, thisArg, 'index'));\n}\n", "import { Observable } from '../Observable';\nimport { EmptyError } from '../util/EmptyError';\nimport { OperatorFunction, TruthyTypesOf } from '../types';\nimport { filter } from './filter';\nimport { take } from './take';\nimport { defaultIfEmpty } from './defaultIfEmpty';\nimport { throwIfEmpty } from './throwIfEmpty';\nimport { identity } from '../util/identity';\n\nexport function first<T, D = T>(predicate?: null, defaultValue?: D): OperatorFunction<T, T | D>;\nexport function first<T>(predicate: BooleanConstructor): OperatorFunction<T, TruthyTypesOf<T>>;\nexport function first<T, D>(predicate: BooleanConstructor, defaultValue: D): OperatorFunction<T, TruthyTypesOf<T> | D>;\nexport function first<T, S extends T>(\n predicate: (value: T, index: number, source: Observable<T>) => value is S,\n defaultValue?: S\n): OperatorFunction<T, S>;\nexport function first<T, S extends T, D>(\n predicate: (value: T, index: number, source: Observable<T>) => value is S,\n defaultValue: D\n): OperatorFunction<T, S | D>;\nexport function first<T, D = T>(\n predicate: (value: T, index: number, source: Observable<T>) => boolean,\n defaultValue?: D\n): OperatorFunction<T, T | D>;\n\n/**\n * Emits only the first value (or the first value that meets some condition)\n * emitted by the source Observable.\n *\n * <span class=\"informal\">Emits only the first value. Or emits only the first\n * value that passes some test.</span>\n *\n * ![](first.png)\n *\n * If called with no arguments, `first` emits the first value of the source\n * Observable, then completes. If called with a `predicate` function, `first`\n * emits the first value of the source that matches the specified condition. Emits an error\n * notification if `defaultValue` was not provided and a matching element is not found.\n *\n * ## Examples\n *\n * Emit only the first click that happens on the DOM\n *\n * ```ts\n * import { fromEvent, first } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(first());\n * result.subscribe(x => console.log(x));\n * ```\n *\n * Emits the first click that happens on a DIV\n *\n * ```ts\n * import { fromEvent, first } from 'rxjs';\n *\n * const div = document.createElement('div');\n * div.style.cssText = 'width: 200px; height: 200px; background: #09c;';\n * document.body.appendChild(div);\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(first(ev => (<HTMLElement>ev.target).tagName === 'DIV'));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link filter}\n * @see {@link find}\n * @see {@link take}\n * @see {@link last}\n *\n * @throws {EmptyError} Delivers an `EmptyError` to the Observer's `error`\n * callback if the Observable completes before any `next` notification was sent.\n * This is how `first()` is different from `take(1)` which completes instead.\n *\n * @param predicate An optional function called with each item to test for condition\n * matching.\n * @param defaultValue The default value emitted in case no valid value was found on\n * the source.\n * @return A function that returns an Observable that emits the first item that\n * matches the condition.\n */\nexport function first<T, D>(\n predicate?: ((value: T, index: number, source: Observable<T>) => boolean) | null,\n defaultValue?: D\n): OperatorFunction<T, T | D> {\n const hasDefaultValue = arguments.length >= 2;\n return (source: Observable<T>) =>\n source.pipe(\n predicate ? filter((v, i) => predicate(v, i, source)) : identity,\n take(1),\n hasDefaultValue ? defaultIfEmpty(defaultValue!) : throwIfEmpty(() => new EmptyError())\n );\n}\n", "import { Observable } from '../Observable';\nimport { innerFrom } from '../observable/innerFrom';\nimport { Subject } from '../Subject';\nimport { ObservableInput, Observer, OperatorFunction, SubjectLike } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber, OperatorSubscriber } from './OperatorSubscriber';\n\nexport interface BasicGroupByOptions<K, T> {\n element?: undefined;\n duration?: (grouped: GroupedObservable<K, T>) => ObservableInput<any>;\n connector?: () => SubjectLike<T>;\n}\n\nexport interface GroupByOptionsWithElement<K, E, T> {\n element: (value: T) => E;\n duration?: (grouped: GroupedObservable<K, E>) => ObservableInput<any>;\n connector?: () => SubjectLike<E>;\n}\n\nexport function groupBy<T, K>(key: (value: T) => K, options: BasicGroupByOptions<K, T>): OperatorFunction<T, GroupedObservable<K, T>>;\n\nexport function groupBy<T, K, E>(\n key: (value: T) => K,\n options: GroupByOptionsWithElement<K, E, T>\n): OperatorFunction<T, GroupedObservable<K, E>>;\n\nexport function groupBy<T, K extends T>(\n key: (value: T) => value is K\n): OperatorFunction<T, GroupedObservable<true, K> | GroupedObservable<false, Exclude<T, K>>>;\n\nexport function groupBy<T, K>(key: (value: T) => K): OperatorFunction<T, GroupedObservable<K, T>>;\n\n/**\n * @deprecated use the options parameter instead.\n */\nexport function groupBy<T, K>(\n key: (value: T) => K,\n element: void,\n duration: (grouped: GroupedObservable<K, T>) => Observable<any>\n): OperatorFunction<T, GroupedObservable<K, T>>;\n\n/**\n * @deprecated use the options parameter instead.\n */\nexport function groupBy<T, K, R>(\n key: (value: T) => K,\n element?: (value: T) => R,\n duration?: (grouped: GroupedObservable<K, R>) => Observable<any>\n): OperatorFunction<T, GroupedObservable<K, R>>;\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 key function.\n *\n * If a {@link GroupedObservable} for this key exists, this {@link GroupedObservable} emits. Otherwise, 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 element function.\n *\n * ## Examples\n *\n * Group objects by `id` and return as array\n *\n * ```ts\n * import { of, groupBy, mergeMap, reduce } from 'rxjs';\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' }, { id: 1, name: 'TypeScript'}]\n * // [{ id: 2, name: 'Parcel' }, { id: 2, name: 'webpack'}]\n * // [{ id: 3, name: 'TSLint' }]\n * ```\n *\n * Pivot data on the `id` field\n *\n * ```ts\n * import { of, groupBy, mergeMap, reduce, map } from 'rxjs';\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, { element: p => p.name }),\n * mergeMap(group$ => group$.pipe(reduce((acc, cur) => [...acc, cur], [`${ group$.key }`]))),\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 key A function that extracts the key\n * for each item.\n * @param element A function that extracts the\n * return element for each item.\n * @param duration\n * A function that returns an Observable to determine how long each group should\n * exist.\n * @param connector Factory function to create an\n * intermediate Subject through which grouped elements are emitted.\n * @return A function that returns an Observable that emits GroupedObservables,\n * each of which corresponds to a unique key value and each of which emits\n * those items from the source Observable that share that key value.\n *\n * @deprecated Use the options parameter instead.\n */\nexport function groupBy<T, K, R>(\n key: (value: T) => K,\n element?: (value: T) => R,\n duration?: (grouped: GroupedObservable<K, R>) => Observable<any>,\n connector?: () => Subject<R>\n): OperatorFunction<T, GroupedObservable<K, R>>;\n\n// Impl\nexport function groupBy<T, K, R>(\n keySelector: (value: T) => K,\n elementOrOptions?: ((value: any) => any) | void | BasicGroupByOptions<K, T> | GroupByOptionsWithElement<K, R, T>,\n duration?: (grouped: GroupedObservable<any, any>) => ObservableInput<any>,\n connector?: () => SubjectLike<any>\n): OperatorFunction<T, GroupedObservable<K, R>> {\n return operate((source, subscriber) => {\n let element: ((value: any) => any) | void;\n if (!elementOrOptions || typeof elementOrOptions === 'function') {\n element = elementOrOptions as ((value: any) => any);\n } else {\n ({ duration, element, connector } = elementOrOptions);\n }\n\n // A lookup for the groups that we have so far.\n const groups = new Map<K, SubjectLike<any>>();\n\n // Used for notifying all groups and the subscriber in the same way.\n const notify = (cb: (group: Observer<any>) => void) => {\n groups.forEach(cb);\n cb(subscriber);\n };\n\n // Used to handle errors from the source, AND errors that occur during the\n // next call from the source.\n const handleError = (err: any) => notify((consumer) => consumer.error(err));\n\n // The number of actively subscribed groups\n let activeGroups = 0;\n\n // Whether or not teardown was attempted on this subscription.\n let teardownAttempted = false;\n\n // Capturing a reference to this, because we need a handle to it\n // in `createGroupedObservable` below. This is what we use to\n // subscribe to our source observable. This sometimes needs to be unsubscribed\n // out-of-band with our `subscriber` which is the downstream subscriber, or destination,\n // in cases where a user unsubscribes from the main resulting subscription, but\n // still has groups from this subscription subscribed and would expect values from it\n // Consider: `source.pipe(groupBy(fn), take(2))`.\n const groupBySourceSubscriber = new OperatorSubscriber(\n subscriber,\n (value: T) => {\n // Because we have to notify all groups of any errors that occur in here,\n // we have to add our own try/catch to ensure that those errors are propagated.\n // OperatorSubscriber will only send the error to the main subscriber.\n try {\n const key = keySelector(value);\n\n let group = groups.get(key);\n if (!group) {\n // Create our group subject\n groups.set(key, (group = connector ? connector() : new Subject<any>()));\n\n // Emit the grouped observable. Note that we can't do a simple `asObservable()` here,\n // because the grouped observable has special semantics around reference counting\n // to ensure we don't sever our connection to the source prematurely.\n const grouped = createGroupedObservable(key, group);\n subscriber.next(grouped);\n\n if (duration) {\n const durationSubscriber = createOperatorSubscriber(\n // Providing the group here ensures that it is disposed of -- via `unsubscribe` --\n // when the duration subscription is torn down. That is important, because then\n // if someone holds a handle to the grouped observable and tries to subscribe to it\n // after the connection to the source has been severed, they will get an\n // `ObjectUnsubscribedError` and know they can't possibly get any notifications.\n group as any,\n () => {\n // Our duration notified! We can complete the group.\n // The group will be removed from the map in the finalization phase.\n group!.complete();\n durationSubscriber?.unsubscribe();\n },\n // Completions are also sent to the group, but just the group.\n undefined,\n // Errors on the duration subscriber are sent to the group\n // but only the group. They are not sent to the main subscription.\n undefined,\n // Finalization: Remove this group from our map.\n () => groups.delete(key)\n );\n\n // Start our duration notifier.\n groupBySourceSubscriber.add(innerFrom(duration(grouped)).subscribe(durationSubscriber));\n }\n }\n\n // Send the value to our group.\n group.next(element ? element(value) : value);\n } catch (err) {\n handleError(err);\n }\n },\n // Source completes.\n () => notify((consumer) => consumer.complete()),\n // Error from the source.\n handleError,\n // Free up memory.\n // When the source subscription is _finally_ torn down, release the subjects and keys\n // in our groups Map, they may be quite large and we don't want to keep them around if we\n // don't have to.\n () => groups.clear(),\n () => {\n teardownAttempted = true;\n // We only kill our subscription to the source if we have\n // no active groups. As stated above, consider this scenario:\n // source$.pipe(groupBy(fn), take(2)).\n return activeGroups === 0;\n }\n );\n\n // Subscribe to the source\n source.subscribe(groupBySourceSubscriber);\n\n /**\n * Creates the actual grouped observable returned.\n * @param key The key of the group\n * @param groupSubject The subject that fuels the group\n */\n function createGroupedObservable(key: K, groupSubject: SubjectLike<any>) {\n const result: any = new Observable<T>((groupSubscriber) => {\n activeGroups++;\n const innerSub = groupSubject.subscribe(groupSubscriber);\n return () => {\n innerSub.unsubscribe();\n // We can kill the subscription to our source if we now have no more\n // active groups subscribed, and a finalization was already attempted on\n // the source.\n --activeGroups === 0 && teardownAttempted && groupBySourceSubscriber.unsubscribe();\n };\n });\n result.key = key;\n return result;\n }\n });\n}\n\n/**\n * An observable of values that is the emitted by the result of a {@link groupBy} operator,\n * contains a `key` property for the grouping.\n */\nexport interface GroupedObservable<K, T> extends Observable<T> {\n /**\n * The key value for the grouped notifications.\n */\n readonly key: K;\n}\n", "import { OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Emits `false` if the input Observable emits any values, or emits `true` if the\n * input Observable completes without emitting any values.\n *\n * <span class=\"informal\">Tells whether any values are emitted by an Observable.</span>\n *\n * ![](isEmpty.png)\n *\n * `isEmpty` transforms an Observable that emits values into an Observable that\n * emits a single boolean value representing whether or not any values were\n * emitted by the source Observable. As soon as the source Observable emits a\n * value, `isEmpty` will emit a `false` and complete. If the source Observable\n * completes having not emitted anything, `isEmpty` will emit a `true` and\n * complete.\n *\n * A similar effect could be achieved with {@link count}, but `isEmpty` can emit\n * a `false` value sooner.\n *\n * ## Examples\n *\n * Emit `false` for a non-empty Observable\n *\n * ```ts\n * import { Subject, isEmpty } from 'rxjs';\n *\n * const source = new Subject<string>();\n * const result = source.pipe(isEmpty());\n *\n * source.subscribe(x => console.log(x));\n * result.subscribe(x => console.log(x));\n *\n * source.next('a');\n * source.next('b');\n * source.next('c');\n * source.complete();\n *\n * // Outputs\n * // 'a'\n * // false\n * // 'b'\n * // 'c'\n * ```\n *\n * Emit `true` for an empty Observable\n *\n * ```ts\n * import { EMPTY, isEmpty } from 'rxjs';\n *\n * const result = EMPTY.pipe(isEmpty());\n * result.subscribe(x => console.log(x));\n *\n * // Outputs\n * // true\n * ```\n *\n * @see {@link count}\n * @see {@link EMPTY}\n *\n * @return A function that returns an Observable that emits boolean value\n * indicating whether the source Observable was empty or not.\n */\nexport function isEmpty<T>(): OperatorFunction<T, boolean> {\n return operate((source, subscriber) => {\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n () => {\n subscriber.next(false);\n subscriber.complete();\n },\n () => {\n subscriber.next(true);\n subscriber.complete();\n }\n )\n );\n });\n}\n", "import { EMPTY } from '../observable/empty';\nimport { MonoTypeOperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Waits for the source to complete, then emits the last N values from the source,\n * as specified by the `count` argument.\n *\n * ![](takeLast.png)\n *\n * `takeLast` results in an observable that will hold values up to `count` values in memory,\n * until the source completes. It then pushes all values in memory to the consumer, in the\n * order they were received from the source, then notifies the consumer that it is\n * complete.\n *\n * If for some reason the source completes before the `count` supplied to `takeLast` is reached,\n * all values received until that point are emitted, and then completion is notified.\n *\n * **Warning**: Using `takeLast` with an observable that never completes will result\n * in an observable that never emits a value.\n *\n * ## Example\n *\n * Take the last 3 values of an Observable with many values\n *\n * ```ts\n * import { range, takeLast } from 'rxjs';\n *\n * const many = range(1, 100);\n * const lastThree = many.pipe(takeLast(3));\n * lastThree.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link take}\n * @see {@link takeUntil}\n * @see {@link takeWhile}\n * @see {@link skip}\n *\n * @param count The maximum number of values to emit from the end of\n * the sequence of values emitted by the source Observable.\n * @return A function that returns an Observable that emits at most the last\n * `count` values emitted by the source Observable.\n */\nexport function takeLast<T>(count: number): MonoTypeOperatorFunction<T> {\n return count <= 0\n ? () => EMPTY\n : operate((source, subscriber) => {\n // This buffer will hold the values we are going to emit\n // when the source completes. Since we only want to take the\n // last N values, we can't emit until we're sure we're not getting\n // any more values.\n let buffer: T[] = [];\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => {\n // Add the most recent value onto the end of our buffer.\n buffer.push(value);\n // If our buffer is now larger than the number of values we\n // want to take, we remove the oldest value from the buffer.\n count < buffer.length && buffer.shift();\n },\n () => {\n // The source completed, we now know what are last values\n // are, emit them in the order they were received.\n for (const value of buffer) {\n subscriber.next(value);\n }\n subscriber.complete();\n },\n // Errors are passed through to the consumer\n undefined,\n () => {\n // During finalization release the values in our buffer.\n buffer = null!;\n }\n )\n );\n });\n}\n", "import { Observable } from '../Observable';\nimport { EmptyError } from '../util/EmptyError';\nimport { OperatorFunction, TruthyTypesOf } from '../types';\nimport { filter } from './filter';\nimport { takeLast } from './takeLast';\nimport { throwIfEmpty } from './throwIfEmpty';\nimport { defaultIfEmpty } from './defaultIfEmpty';\nimport { identity } from '../util/identity';\n\nexport function last<T>(predicate: BooleanConstructor): OperatorFunction<T, TruthyTypesOf<T>>;\nexport function last<T, D>(predicate: BooleanConstructor, defaultValue: D): OperatorFunction<T, TruthyTypesOf<T> | D>;\nexport function last<T, D = T>(predicate?: null, defaultValue?: D): OperatorFunction<T, T | D>;\nexport function last<T, S extends T>(\n predicate: (value: T, index: number, source: Observable<T>) => value is S,\n defaultValue?: S\n): OperatorFunction<T, S>;\nexport function last<T, D = T>(\n predicate: (value: T, index: number, source: Observable<T>) => boolean,\n defaultValue?: D\n): OperatorFunction<T, T | D>;\n\n/**\n * Returns an Observable that emits only the last item emitted by the source Observable.\n * It optionally takes a predicate function as a parameter, in which case, rather than emitting\n * the last item from the source Observable, the resulting Observable will emit the last item\n * from the source Observable that satisfies the predicate.\n *\n * ![](last.png)\n *\n * It will emit an error notification if the source completes without notification or one that matches\n * the predicate. It returns the last value or if a predicate is provided last value that matches the\n * predicate. It returns the given default value if no notification is emitted or matches the predicate.\n *\n * ## Examples\n *\n * Last alphabet from the sequence\n *\n * ```ts\n * import { from, last } from 'rxjs';\n *\n * const source = from(['x', 'y', 'z']);\n * const result = source.pipe(last());\n *\n * result.subscribe(value => console.log(`Last alphabet: ${ value }`));\n *\n * // Outputs\n * // Last alphabet: z\n * ```\n *\n * Default value when the value in the predicate is not matched\n *\n * ```ts\n * import { from, last } from 'rxjs';\n *\n * const source = from(['x', 'y', 'z']);\n * const result = source.pipe(last(char => char === 'a', 'not found'));\n *\n * result.subscribe(value => console.log(`'a' is ${ value }.`));\n *\n * // Outputs\n * // 'a' is not found.\n * ```\n *\n * @see {@link skip}\n * @see {@link skipUntil}\n * @see {@link skipLast}\n * @see {@link skipWhile}\n * @see {@link first}\n *\n * @throws {EmptyError} Delivers an `EmptyError` to the Observer's `error`\n * callback if the Observable completes before any `next` notification was sent.\n *\n * @param predicate The condition any source emitted item has to satisfy.\n * @param defaultValue An optional default value to provide if last `predicate`\n * isn't met or no values were emitted.\n * @return A function that returns an Observable that emits only the last item\n * satisfying the given condition from the source, or an error notification\n * with an `EmptyError` object if no such items are emitted.\n */\nexport function last<T, D>(\n predicate?: ((value: T, index: number, source: Observable<T>) => boolean) | null,\n defaultValue?: D\n): OperatorFunction<T, T | D> {\n const hasDefaultValue = arguments.length >= 2;\n return (source: Observable<T>) =>\n source.pipe(\n predicate ? filter((v, i) => predicate(v, i, source)) : identity,\n takeLast(1),\n hasDefaultValue ? defaultIfEmpty(defaultValue!) : throwIfEmpty(() => new EmptyError())\n );\n}\n", "import { Notification } from '../Notification';\nimport { OperatorFunction, ObservableNotification } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Represents all of the notifications from the source Observable as `next`\n * emissions marked with their original types within {@link Notification}\n * objects.\n *\n * <span class=\"informal\">Wraps `next`, `error` and `complete` emissions in\n * {@link Notification} objects, emitted as `next` on the output Observable.\n * </span>\n *\n * ![](materialize.png)\n *\n * `materialize` returns an Observable that emits a `next` notification for each\n * `next`, `error`, or `complete` emission of the source Observable. When the\n * source Observable emits `complete`, the output Observable will emit `next` as\n * a Notification of type \"complete\", and then it will emit `complete` as well.\n * When the source Observable emits `error`, the output will emit `next` as a\n * Notification of type \"error\", and then `complete`.\n *\n * This operator is useful for producing metadata of the source Observable, to\n * be consumed as `next` emissions. Use it in conjunction with\n * {@link dematerialize}.\n *\n * ## Example\n *\n * Convert a faulty Observable to an Observable of Notifications\n *\n * ```ts\n * import { of, materialize, map } from 'rxjs';\n *\n * const letters = of('a', 'b', 13, 'd');\n * const upperCase = letters.pipe(map((x: any) => x.toUpperCase()));\n * const materialized = upperCase.pipe(materialize());\n *\n * materialized.subscribe(x => console.log(x));\n *\n * // Results in the following:\n * // - Notification { kind: 'N', value: 'A', error: undefined, hasValue: true }\n * // - Notification { kind: 'N', value: 'B', error: undefined, hasValue: true }\n * // - Notification { kind: 'E', value: undefined, error: TypeError { message: x.toUpperCase is not a function }, hasValue: false }\n * ```\n *\n * @see {@link Notification}\n * @see {@link dematerialize}\n *\n * @return A function that returns an Observable that emits\n * {@link Notification} objects that wrap the original emissions from the\n * source Observable with metadata.\n */\nexport function materialize<T>(): OperatorFunction<T, Notification<T> & ObservableNotification<T>> {\n return operate((source, subscriber) => {\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => {\n subscriber.next(Notification.createNext(value));\n },\n () => {\n subscriber.next(Notification.createComplete());\n subscriber.complete();\n },\n (err) => {\n subscriber.next(Notification.createError(err));\n subscriber.complete();\n }\n )\n );\n });\n}\n", "import { reduce } from './reduce';\nimport { MonoTypeOperatorFunction } from '../types';\nimport { isFunction } from '../util/isFunction';\n\n/**\n * The `max` operator operates on an Observable that emits numbers (or items that\n * can be compared with a provided function), and when source Observable completes\n * it emits a single item: the item with the largest value.\n *\n * ![](max.png)\n *\n * ## Examples\n *\n * Get the maximal value of a series of numbers\n *\n * ```ts\n * import { of, max } from 'rxjs';\n *\n * of(5, 4, 7, 2, 8)\n * .pipe(max())\n * .subscribe(x => console.log(x));\n *\n * // Outputs\n * // 8\n * ```\n *\n * Use a comparer function to get the maximal item\n *\n * ```ts\n * import { of, max } from 'rxjs';\n *\n * of(\n * { age: 7, name: 'Foo' },\n * { age: 5, name: 'Bar' },\n * { age: 9, name: 'Beer' }\n * ).pipe(\n * max((a, b) => a.age < b.age ? -1 : 1)\n * )\n * .subscribe(x => console.log(x.name));\n *\n * // Outputs\n * // 'Beer'\n * ```\n *\n * @see {@link min}\n *\n * @param comparer Optional comparer function that it will use instead of its\n * default to compare the value of two items.\n * @return A function that returns an Observable that emits item with the\n * largest value.\n */\nexport function max<T>(comparer?: (x: T, y: T) => number): MonoTypeOperatorFunction<T> {\n return reduce(isFunction(comparer) ? (x, y) => (comparer(x, y) > 0 ? x : y) : (x, y) => (x > y ? x : y));\n}\n", "import { mergeMap } from './mergeMap';\n\n/**\n * @deprecated Renamed to {@link mergeMap}. Will be removed in v8.\n */\nexport const flatMap = mergeMap;\n", "import { OperatorFunction, ObservedValueOf, ObservableInput } from '../types';\nimport { mergeMap } from './mergeMap';\nimport { isFunction } from '../util/isFunction';\n\n/** @deprecated Will be removed in v9. Use {@link mergeMap} instead: `mergeMap(() => result)` */\nexport function mergeMapTo<O extends ObservableInput<unknown>>(\n innerObservable: O,\n concurrent?: number\n): OperatorFunction<unknown, ObservedValueOf<O>>;\n/**\n * @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead.\n * Details: https://rxjs.dev/deprecations/resultSelector\n */\nexport function mergeMapTo<T, R, O extends ObservableInput<unknown>>(\n innerObservable: O,\n resultSelector: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R,\n concurrent?: number\n): OperatorFunction<T, R>;\n/* tslint:enable:max-line-length */\n\n/**\n * Projects each source value to the same Observable which is merged multiple\n * times in the output Observable.\n *\n * <span class=\"informal\">It's like {@link mergeMap}, but maps each value always\n * to the same inner Observable.</span>\n *\n * ![](mergeMapTo.png)\n *\n * Maps each source value to the given Observable `innerObservable` regardless\n * of the source value, and then merges those resulting Observables into one\n * single Observable, which is the output Observable.\n *\n * ## Example\n *\n * For each click event, start an interval Observable ticking every 1 second\n *\n * ```ts\n * import { fromEvent, mergeMapTo, interval } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(mergeMapTo(interval(1000)));\n *\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link concatMapTo}\n * @see {@link merge}\n * @see {@link mergeAll}\n * @see {@link mergeMap}\n * @see {@link mergeScan}\n * @see {@link switchMapTo}\n *\n * @param innerObservable An `ObservableInput` to replace each value from the\n * source Observable.\n * @param concurrent Maximum number of input Observables being subscribed to\n * concurrently.\n * @return A function that returns an Observable that emits items from the\n * given `innerObservable`.\n * @deprecated Will be removed in v9. Use {@link mergeMap} instead: `mergeMap(() => result)`\n */\nexport function mergeMapTo<T, R, O extends ObservableInput<unknown>>(\n innerObservable: O,\n resultSelector?: ((outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R) | number,\n concurrent: number = Infinity\n): OperatorFunction<T, ObservedValueOf<O> | R> {\n if (isFunction(resultSelector)) {\n return mergeMap(() => innerObservable, resultSelector, concurrent);\n }\n if (typeof resultSelector === 'number') {\n concurrent = resultSelector;\n }\n return mergeMap(() => innerObservable, concurrent);\n}\n", "import { ObservableInput, OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { mergeInternals } from './mergeInternals';\n\n/**\n * Applies an accumulator function over the source Observable where the\n * accumulator function itself returns an Observable, then each intermediate\n * Observable returned is merged into the output Observable.\n *\n * <span class=\"informal\">It's like {@link scan}, but the Observables returned\n * by the accumulator are merged into the outer Observable.</span>\n *\n * The first parameter of the `mergeScan` is an `accumulator` function which is\n * being called every time the source Observable emits a value. `mergeScan` will\n * subscribe to the value returned by the `accumulator` function and will emit\n * values to the subscriber emitted by inner Observable.\n *\n * The `accumulator` function is being called with three parameters passed to it:\n * `acc`, `value` and `index`. The `acc` parameter is used as the state parameter\n * whose value is initially set to the `seed` parameter (the second parameter\n * passed to the `mergeScan` operator).\n *\n * `mergeScan` internally keeps the value of the `acc` parameter: as long as the\n * source Observable emits without inner Observable emitting, the `acc` will be\n * set to `seed`. The next time the inner Observable emits a value, `mergeScan`\n * will internally remember it and it will be passed to the `accumulator`\n * function as `acc` parameter the next time source emits.\n *\n * The `value` parameter of the `accumulator` function is the value emitted by the\n * source Observable, while the `index` is a number which represent the order of the\n * current emission by the source Observable. It starts with 0.\n *\n * The last parameter to the `mergeScan` is the `concurrent` value which defaults\n * to Infinity. It represents the maximum number of inner Observable subscriptions\n * at a time.\n *\n * ## Example\n *\n * Count the number of click events\n *\n * ```ts\n * import { fromEvent, map, mergeScan, of } from 'rxjs';\n *\n * const click$ = fromEvent(document, 'click');\n * const one$ = click$.pipe(map(() => 1));\n * const seed = 0;\n * const count$ = one$.pipe(\n * mergeScan((acc, one) => of(acc + one), seed)\n * );\n *\n * count$.subscribe(x => console.log(x));\n *\n * // Results:\n * // 1\n * // 2\n * // 3\n * // 4\n * // ...and so on for each click\n * ```\n *\n * @see {@link scan}\n * @see {@link switchScan}\n *\n * @param accumulator The accumulator function called on each source value.\n * @param seed The initial accumulation value.\n * @param concurrent Maximum number of input Observables being subscribed to\n * concurrently.\n * @return A function that returns an Observable of the accumulated values.\n */\nexport function mergeScan<T, R>(\n accumulator: (acc: R, value: T, index: number) => ObservableInput<R>,\n seed: R,\n concurrent = Infinity\n): OperatorFunction<T, R> {\n return operate((source, subscriber) => {\n // The accumulated state.\n let state = seed;\n\n return mergeInternals(\n source,\n subscriber,\n (value, index) => accumulator(state, value, index),\n concurrent,\n (value) => {\n state = value;\n },\n false,\n undefined,\n () => (state = null!)\n );\n });\n}\n", "import { ObservableInput, ObservableInputTuple, OperatorFunction, SchedulerLike } from '../types';\nimport { operate } from '../util/lift';\nimport { mergeAll } from './mergeAll';\nimport { popNumber, popScheduler } from '../util/args';\nimport { from } from '../observable/from';\n\n/** @deprecated Replaced with {@link mergeWith}. Will be removed in v8. */\nexport function merge<T, A extends readonly unknown[]>(...sources: [...ObservableInputTuple<A>]): OperatorFunction<T, T | A[number]>;\n/** @deprecated Replaced with {@link mergeWith}. Will be removed in v8. */\nexport function merge<T, A extends readonly unknown[]>(\n ...sourcesAndConcurrency: [...ObservableInputTuple<A>, number]\n): OperatorFunction<T, T | A[number]>;\n/** @deprecated Replaced with {@link mergeWith}. Will be removed in v8. */\nexport function merge<T, A extends readonly unknown[]>(\n ...sourcesAndScheduler: [...ObservableInputTuple<A>, SchedulerLike]\n): OperatorFunction<T, T | A[number]>;\n/** @deprecated Replaced with {@link mergeWith}. Will be removed in v8. */\nexport function merge<T, A extends readonly unknown[]>(\n ...sourcesAndConcurrencyAndScheduler: [...ObservableInputTuple<A>, number, SchedulerLike]\n): OperatorFunction<T, T | A[number]>;\n\nexport function merge<T>(...args: unknown[]): OperatorFunction<T, unknown> {\n const scheduler = popScheduler(args);\n const concurrent = popNumber(args, Infinity);\n\n return operate((source, subscriber) => {\n mergeAll(concurrent)(from([source, ...(args as ObservableInput<T>[])], scheduler)).subscribe(subscriber);\n });\n}\n", "import { ObservableInputTuple, OperatorFunction } from '../types';\nimport { merge } from './merge';\n\n/**\n * Merge the values from all observables to a single observable result.\n *\n * Creates an observable, that when subscribed to, subscribes to the source\n * observable, and all other sources provided as arguments. All values from\n * every source are emitted from the resulting subscription.\n *\n * When all sources complete, the resulting observable will complete.\n *\n * When any source errors, the resulting observable will error.\n *\n * ## Example\n *\n * Joining all outputs from multiple user input event streams\n *\n * ```ts\n * import { fromEvent, map, mergeWith } from 'rxjs';\n *\n * const clicks$ = fromEvent(document, 'click').pipe(map(() => 'click'));\n * const mousemoves$ = fromEvent(document, 'mousemove').pipe(map(() => 'mousemove'));\n * const dblclicks$ = fromEvent(document, 'dblclick').pipe(map(() => 'dblclick'));\n *\n * mousemoves$\n * .pipe(mergeWith(clicks$, dblclicks$))\n * .subscribe(x => console.log(x));\n *\n * // result (assuming user interactions)\n * // 'mousemove'\n * // 'mousemove'\n * // 'mousemove'\n * // 'click'\n * // 'click'\n * // 'dblclick'\n * ```\n *\n * @see {@link merge}\n *\n * @param otherSources the sources to combine the current source with.\n * @return A function that returns an Observable that merges the values from\n * all given Observables.\n */\nexport function mergeWith<T, A extends readonly unknown[]>(\n ...otherSources: [...ObservableInputTuple<A>]\n): OperatorFunction<T, T | A[number]> {\n return merge(...otherSources);\n}\n", "import { reduce } from './reduce';\nimport { MonoTypeOperatorFunction } from '../types';\nimport { isFunction } from '../util/isFunction';\n\n/**\n * The `min` operator operates on an Observable that emits numbers (or items that\n * can be compared with a provided function), and when source Observable completes\n * it emits a single item: the item with the smallest value.\n *\n * ![](min.png)\n *\n * ## Examples\n *\n * Get the minimal value of a series of numbers\n *\n * ```ts\n * import { of, min } from 'rxjs';\n *\n * of(5, 4, 7, 2, 8)\n * .pipe(min())\n * .subscribe(x => console.log(x));\n *\n * // Outputs\n * // 2\n * ```\n *\n * Use a comparer function to get the minimal item\n *\n * ```ts\n * import { of, min } from 'rxjs';\n *\n * of(\n * { age: 7, name: 'Foo' },\n * { age: 5, name: 'Bar' },\n * { age: 9, name: 'Beer' }\n * ).pipe(\n * min((a, b) => a.age < b.age ? -1 : 1)\n * )\n * .subscribe(x => console.log(x.name));\n *\n * // Outputs\n * // 'Bar'\n * ```\n *\n * @see {@link max}\n *\n * @param comparer Optional comparer function that it will use instead of its\n * default to compare the value of two items.\n * @return A function that returns an Observable that emits item with the\n * smallest value.\n */\nexport function min<T>(comparer?: (x: T, y: T) => number): MonoTypeOperatorFunction<T> {\n return reduce(isFunction(comparer) ? (x, y) => (comparer(x, y) < 0 ? x : y) : (x, y) => (x < y ? x : y));\n}\n", "import { Subject } from '../Subject';\nimport { Observable } from '../Observable';\nimport { ConnectableObservable } from '../observable/ConnectableObservable';\nimport { OperatorFunction, UnaryFunction, ObservedValueOf, ObservableInput } from '../types';\nimport { isFunction } from '../util/isFunction';\nimport { connect } from './connect';\n\n/**\n * An operator that creates a {@link ConnectableObservable}, that when connected,\n * with the `connect` method, will use the provided subject to multicast the values\n * from the source to all consumers.\n *\n * @param subject The subject to multicast through.\n * @return A function that returns a {@link ConnectableObservable}\n * @deprecated Will be removed in v8. To create a connectable observable, use {@link connectable}.\n * If you're using {@link refCount} after `multicast`, use the {@link share} operator instead.\n * `multicast(subject), refCount()` is equivalent to\n * `share({ connector: () => subject, resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false })`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function multicast<T>(subject: Subject<T>): UnaryFunction<Observable<T>, ConnectableObservable<T>>;\n\n/**\n * Because this is deprecated in favor of the {@link connect} operator, and was otherwise poorly documented,\n * rather than duplicate the effort of documenting the same behavior, please see documentation for the\n * {@link connect} operator.\n *\n * @param subject The subject used to multicast.\n * @param selector A setup function to setup the multicast\n * @return A function that returns an observable that mirrors the observable returned by the selector.\n * @deprecated Will be removed in v8. Use the {@link connect} operator instead.\n * `multicast(subject, selector)` is equivalent to\n * `connect(selector, { connector: () => subject })`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function multicast<T, O extends ObservableInput<any>>(\n subject: Subject<T>,\n selector: (shared: Observable<T>) => O\n): OperatorFunction<T, ObservedValueOf<O>>;\n\n/**\n * An operator that creates a {@link ConnectableObservable}, that when connected,\n * with the `connect` method, will use the provided subject to multicast the values\n * from the source to all consumers.\n *\n * @param subjectFactory A factory that will be called to create the subject. Passing a function here\n * will cause the underlying subject to be \"reset\" on error, completion, or refCounted unsubscription of\n * the source.\n * @return A function that returns a {@link ConnectableObservable}\n * @deprecated Will be removed in v8. To create a connectable observable, use {@link connectable}.\n * If you're using {@link refCount} after `multicast`, use the {@link share} operator instead.\n * `multicast(() => new BehaviorSubject('test')), refCount()` is equivalent to\n * `share({ connector: () => new BehaviorSubject('test') })`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function multicast<T>(subjectFactory: () => Subject<T>): UnaryFunction<Observable<T>, ConnectableObservable<T>>;\n\n/**\n * Because this is deprecated in favor of the {@link connect} operator, and was otherwise poorly documented,\n * rather than duplicate the effort of documenting the same behavior, please see documentation for the\n * {@link connect} operator.\n *\n * @param subjectFactory A factory that creates the subject used to multicast.\n * @param selector A function to setup the multicast and select the output.\n * @return A function that returns an observable that mirrors the observable returned by the selector.\n * @deprecated Will be removed in v8. Use the {@link connect} operator instead.\n * `multicast(subjectFactory, selector)` is equivalent to\n * `connect(selector, { connector: subjectFactory })`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function multicast<T, O extends ObservableInput<any>>(\n subjectFactory: () => Subject<T>,\n selector: (shared: Observable<T>) => O\n): OperatorFunction<T, ObservedValueOf<O>>;\n\n/**\n * @deprecated Will be removed in v8. Use the {@link connectable} observable, the {@link connect} operator or the\n * {@link share} operator instead. See the overloads below for equivalent replacement examples of this operator's\n * behaviors.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function multicast<T, R>(\n subjectOrSubjectFactory: Subject<T> | (() => Subject<T>),\n selector?: (source: Observable<T>) => Observable<R>\n): OperatorFunction<T, R> {\n const subjectFactory = isFunction(subjectOrSubjectFactory) ? subjectOrSubjectFactory : () => subjectOrSubjectFactory;\n\n if (isFunction(selector)) {\n // If a selector function is provided, then we're a \"normal\" operator that isn't\n // going to return a ConnectableObservable. We can use `connect` to do what we\n // need to do.\n return connect(selector, {\n connector: subjectFactory,\n });\n }\n\n return (source: Observable<T>) => new ConnectableObservable<any>(source, subjectFactory);\n}\n", "import { ObservableInputTuple, OperatorFunction } from '../types';\nimport { argsOrArgArray } from '../util/argsOrArgArray';\nimport { onErrorResumeNext as oERNCreate } from '../observable/onErrorResumeNext';\n\nexport function onErrorResumeNextWith<T, A extends readonly unknown[]>(\n sources: [...ObservableInputTuple<A>]\n): OperatorFunction<T, T | A[number]>;\nexport function onErrorResumeNextWith<T, A extends readonly unknown[]>(\n ...sources: [...ObservableInputTuple<A>]\n): OperatorFunction<T, T | A[number]>;\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 * <span class=\"informal\">Execute series of Observables, subscribes to next one on error or complete.</span>\n *\n * ![](onErrorResumeNext.png)\n *\n * `onErrorResumeNext` is an operator that accepts a series of Observables, provided either directly as\n * arguments or as an array. If no single Observable is provided, returned Observable will simply behave the same\n * as the source.\n *\n * `onErrorResumeNext` returns an Observable that starts by subscribing and re-emitting values from the source Observable.\n * When its stream of values ends - no matter if Observable completed or emitted an error - `onErrorResumeNext`\n * will subscribe to the first Observable that was passed as an argument to the method. It will start re-emitting\n * its values as well and - again - when that stream ends, `onErrorResumeNext` will proceed to subscribing yet another\n * Observable in provided series, no matter if previous Observable completed or ended with an error. This will\n * be happening until there is no more Observables left in the series, at which point returned Observable will\n * complete - even if the last subscribed stream ended with an error.\n *\n * `onErrorResumeNext` can be therefore thought of as version of {@link concat} operator, which is more permissive\n * when it comes to the errors emitted by its input Observables. While `concat` subscribes to the next Observable\n * in series only if previous one successfully completed, `onErrorResumeNext` subscribes even if it ended with\n * an error.\n *\n * Note that you do not get any access to errors emitted by the Observables. In particular do not\n * expect these errors to appear in error callback passed to {@link Observable#subscribe}. If you want to take\n * specific actions based on what error was emitted by an Observable, you should try out {@link catchError} instead.\n *\n *\n * ## Example\n *\n * Subscribe to the next Observable after map fails\n *\n * ```ts\n * import { of, onErrorResumeNext, map } from 'rxjs';\n *\n * of(1, 2, 3, 0)\n * .pipe(\n * map(x => {\n * if (x === 0) {\n * throw Error();\n * }\n *\n * return 10 / x;\n * }),\n * onErrorResumeNext(of(1, 2, 3))\n * )\n * .subscribe({\n * next: val => console.log(val),\n * error: err => console.log(err), // Will never be called.\n * complete: () => console.log('that\\'s it!')\n * });\n *\n * // Logs:\n * // 10\n * // 5\n * // 3.3333333333333335\n * // 1\n * // 2\n * // 3\n * // 'that's it!'\n * ```\n *\n * @see {@link concat}\n * @see {@link catchError}\n *\n * @param sources `ObservableInput`s passed either directly or as an array.\n * @return A function that returns an Observable that emits values from source\n * Observable, but - if it errors - subscribes to the next passed Observable\n * and so on, until it completes or runs out of Observables.\n */\nexport function onErrorResumeNextWith<T, A extends readonly unknown[]>(\n ...sources: [[...ObservableInputTuple<A>]] | [...ObservableInputTuple<A>]\n): OperatorFunction<T, T | A[number]> {\n // For some reason, TS 4.1 RC gets the inference wrong here and infers the\n // result to be `A[number][]` - completely dropping the ObservableInput part\n // of the type. This makes no sense whatsoever. As a workaround, the type is\n // asserted explicitly.\n const nextSources = argsOrArgArray(sources) as unknown as ObservableInputTuple<A>;\n\n return (source) => oERNCreate(source, ...nextSources);\n}\n\n/**\n * @deprecated Renamed. Use {@link onErrorResumeNextWith} instead. Will be removed in v8.\n */\nexport const onErrorResumeNext = onErrorResumeNextWith;\n", "import { OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Groups pairs of consecutive emissions together and emits them as an array of\n * two values.\n *\n * <span class=\"informal\">Puts the current value and previous value together as\n * an array, and emits that.</span>\n *\n * ![](pairwise.png)\n *\n * The Nth emission from the source Observable will cause the output Observable\n * to emit an array [(N-1)th, Nth] of the previous and the current value, as a\n * pair. For this reason, `pairwise` emits on the second and subsequent\n * emissions from the source Observable, but not on the first emission, because\n * there is no previous value in that case.\n *\n * ## Example\n *\n * On every click (starting from the second), emit the relative distance to the previous click\n *\n * ```ts\n * import { fromEvent, pairwise, map } from 'rxjs';\n *\n * const clicks = fromEvent<PointerEvent>(document, 'click');\n * const pairs = clicks.pipe(pairwise());\n * const distance = pairs.pipe(\n * map(([first, second]) => {\n * const x0 = first.clientX;\n * const y0 = first.clientY;\n * const x1 = second.clientX;\n * const y1 = second.clientY;\n * return Math.sqrt(Math.pow(x0 - x1, 2) + Math.pow(y0 - y1, 2));\n * })\n * );\n *\n * distance.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link buffer}\n * @see {@link bufferCount}\n *\n * @return A function that returns an Observable of pairs (as arrays) of\n * consecutive values from the source Observable.\n */\nexport function pairwise<T>(): OperatorFunction<T, [T, T]> {\n return operate((source, subscriber) => {\n let prev: T;\n let hasPrev = false;\n source.subscribe(\n createOperatorSubscriber(subscriber, (value) => {\n const p = prev;\n prev = value;\n hasPrev && subscriber.next([p, value]);\n hasPrev = true;\n })\n );\n });\n}\n", "import { map } from './map';\nimport { OperatorFunction } from '../types';\n\n/* tslint:disable:max-line-length */\n/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */\nexport function pluck<T, K1 extends keyof T>(k1: K1): OperatorFunction<T, T[K1]>;\n/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */\nexport function pluck<T, K1 extends keyof T, K2 extends keyof T[K1]>(k1: K1, k2: K2): OperatorFunction<T, T[K1][K2]>;\n/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */\nexport function pluck<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]>(\n k1: K1,\n k2: K2,\n k3: K3\n): OperatorFunction<T, T[K1][K2][K3]>;\n/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */\nexport function pluck<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3]>(\n k1: K1,\n k2: K2,\n k3: K3,\n k4: K4\n): OperatorFunction<T, T[K1][K2][K3][K4]>;\n/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */\nexport function pluck<\n T,\n K1 extends keyof T,\n K2 extends keyof T[K1],\n K3 extends keyof T[K1][K2],\n K4 extends keyof T[K1][K2][K3],\n K5 extends keyof T[K1][K2][K3][K4]\n>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5): OperatorFunction<T, T[K1][K2][K3][K4][K5]>;\n/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */\nexport function pluck<\n T,\n K1 extends keyof T,\n K2 extends keyof T[K1],\n K3 extends keyof T[K1][K2],\n K4 extends keyof T[K1][K2][K3],\n K5 extends keyof T[K1][K2][K3][K4],\n K6 extends keyof T[K1][K2][K3][K4][K5]\n>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6): OperatorFunction<T, T[K1][K2][K3][K4][K5][K6]>;\n/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */\nexport function pluck<\n T,\n K1 extends keyof T,\n K2 extends keyof T[K1],\n K3 extends keyof T[K1][K2],\n K4 extends keyof T[K1][K2][K3],\n K5 extends keyof T[K1][K2][K3][K4],\n K6 extends keyof T[K1][K2][K3][K4][K5]\n>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, ...rest: string[]): OperatorFunction<T, unknown>;\n/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */\nexport function pluck<T>(...properties: string[]): OperatorFunction<T, unknown>;\n/* tslint:enable:max-line-length */\n\n/**\n * Maps each source value to its specified nested property.\n *\n * <span class=\"informal\">Like {@link map}, but meant only for picking one of\n * the nested properties of every emitted value.</span>\n *\n * ![](pluck.png)\n *\n * Given a list of strings or numbers describing a path to a property, retrieves\n * the value of a specified nested property from all values in the source\n * Observable. If a property can't be resolved, it will return `undefined` for\n * that value.\n *\n * ## Example\n *\n * Map every click to the tagName of the clicked target element\n *\n * ```ts\n * import { fromEvent, pluck } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const tagNames = clicks.pipe(pluck('target', 'tagName'));\n *\n * tagNames.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link map}\n *\n * @param properties The nested properties to pluck from each source\n * value.\n * @return A function that returns an Observable of property values from the\n * source values.\n * @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8.\n */\nexport function pluck<T, R>(...properties: Array<string | number | symbol>): OperatorFunction<T, R> {\n const length = properties.length;\n if (length === 0) {\n throw new Error('list of properties cannot be empty.');\n }\n return map((x) => {\n let currentProp: any = x;\n for (let i = 0; i < length; i++) {\n const p = currentProp?.[properties[i]];\n if (typeof p !== 'undefined') {\n currentProp = p;\n } else {\n return undefined;\n }\n }\n return currentProp;\n });\n}\n", "import { Observable } from '../Observable';\nimport { Subject } from '../Subject';\nimport { multicast } from './multicast';\nimport { ConnectableObservable } from '../observable/ConnectableObservable';\nimport { MonoTypeOperatorFunction, OperatorFunction, UnaryFunction, ObservableInput, ObservedValueOf } from '../types';\nimport { connect } from './connect';\n\n/**\n * Returns a connectable observable that, when connected, will multicast\n * all values through a single underlying {@link Subject} instance.\n *\n * @deprecated Will be removed in v8. To create a connectable observable, use {@link connectable}.\n * `source.pipe(publish())` is equivalent to\n * `connectable(source, { connector: () => new Subject(), resetOnDisconnect: false })`.\n * If you're using {@link refCount} after `publish`, use {@link share} operator instead.\n * `source.pipe(publish(), refCount())` is equivalent to\n * `source.pipe(share({ resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }))`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function publish<T>(): UnaryFunction<Observable<T>, ConnectableObservable<T>>;\n\n/**\n * Returns an observable, that when subscribed to, creates an underlying {@link Subject},\n * provides an observable view of it to a `selector` function, takes the observable result of\n * that selector function and subscribes to it, sending its values to the consumer, _then_ connects\n * the subject to the original source.\n *\n * @param selector A function used to setup multicasting prior to automatic connection.\n *\n * @deprecated Will be removed in v8. Use the {@link connect} operator instead.\n * `publish(selector)` is equivalent to `connect(selector)`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function publish<T, O extends ObservableInput<any>>(selector: (shared: Observable<T>) => O): OperatorFunction<T, ObservedValueOf<O>>;\n\n/**\n * Returns a ConnectableObservable, which is a variety of Observable that waits until its connect method is called\n * before it begins emitting items to those Observers that have subscribed to it.\n *\n * <span class=\"informal\">Makes a cold Observable hot</span>\n *\n * ![](publish.png)\n *\n * ## Examples\n *\n * Make `source$` hot by applying `publish` operator, then merge each inner observable into a single one\n * and subscribe\n *\n * ```ts\n * import { zip, interval, of, map, publish, merge, tap } from 'rxjs';\n *\n * const source$ = zip(interval(2000), of(1, 2, 3, 4, 5, 6, 7, 8, 9))\n * .pipe(map(([, number]) => number));\n *\n * source$\n * .pipe(\n * publish(multicasted$ =>\n * merge(\n * multicasted$.pipe(tap(x => console.log('Stream 1:', x))),\n * multicasted$.pipe(tap(x => console.log('Stream 2:', x))),\n * multicasted$.pipe(tap(x => console.log('Stream 3:', x)))\n * )\n * )\n * )\n * .subscribe();\n *\n * // Results every two seconds\n * // Stream 1: 1\n * // Stream 2: 1\n * // Stream 3: 1\n * // ...\n * // Stream 1: 9\n * // Stream 2: 9\n * // Stream 3: 9\n * ```\n *\n * @see {@link publishLast}\n * @see {@link publishReplay}\n * @see {@link publishBehavior}\n *\n * @param selector Optional selector function which can use the multicasted source sequence as many times\n * as needed, without causing multiple subscriptions to the source sequence.\n * Subscribers to the given source will receive all notifications of the source from the time of the subscription on.\n * @return A function that returns a ConnectableObservable that upon connection\n * causes the source Observable to emit items to its Observers.\n * @deprecated Will be removed in v8. Use the {@link connectable} observable, the {@link connect} operator or the\n * {@link share} operator instead. See the overloads below for equivalent replacement examples of this operator's\n * behaviors.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function publish<T, R>(selector?: OperatorFunction<T, R>): MonoTypeOperatorFunction<T> | OperatorFunction<T, R> {\n return selector ? (source) => connect(selector)(source) : (source) => multicast(new Subject<T>())(source);\n}\n", "import { Observable } from '../Observable';\nimport { BehaviorSubject } from '../BehaviorSubject';\nimport { ConnectableObservable } from '../observable/ConnectableObservable';\nimport { UnaryFunction } from '../types';\n\n/**\n * Creates a {@link ConnectableObservable} that utilizes a {@link BehaviorSubject}.\n *\n * @param initialValue The initial value passed to the {@link BehaviorSubject}.\n * @return A function that returns a {@link ConnectableObservable}\n * @deprecated Will be removed in v8. To create a connectable observable that uses a\n * {@link BehaviorSubject} under the hood, use {@link connectable}.\n * `source.pipe(publishBehavior(initValue))` is equivalent to\n * `connectable(source, { connector: () => new BehaviorSubject(initValue), resetOnDisconnect: false })`.\n * If you're using {@link refCount} after `publishBehavior`, use the {@link share} operator instead.\n * `source.pipe(publishBehavior(initValue), refCount())` is equivalent to\n * `source.pipe(share({ connector: () => new BehaviorSubject(initValue), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }))`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function publishBehavior<T>(initialValue: T): UnaryFunction<Observable<T>, ConnectableObservable<T>> {\n // Note that this has *never* supported the selector function.\n return (source) => {\n const subject = new BehaviorSubject<T>(initialValue);\n return new ConnectableObservable(source, () => subject);\n };\n}\n", "import { Observable } from '../Observable';\nimport { AsyncSubject } from '../AsyncSubject';\nimport { ConnectableObservable } from '../observable/ConnectableObservable';\nimport { UnaryFunction } from '../types';\n\n/**\n * Returns a connectable observable sequence that shares a single subscription to the\n * underlying sequence containing only the last notification.\n *\n * ![](publishLast.png)\n *\n * Similar to {@link publish}, but it waits until the source observable completes and stores\n * the last emitted value.\n * Similarly to {@link publishReplay} and {@link publishBehavior}, this keeps storing the last\n * value even if it has no more subscribers. If subsequent subscriptions happen, they will\n * immediately get that last stored value and complete.\n *\n * ## Example\n *\n * ```ts\n * import { ConnectableObservable, interval, publishLast, tap, take } from 'rxjs';\n *\n * const connectable = <ConnectableObservable<number>>interval(1000)\n * .pipe(\n * tap(x => console.log('side effect', x)),\n * take(3),\n * publishLast()\n * );\n *\n * connectable.subscribe({\n * next: x => console.log('Sub. A', x),\n * error: err => console.log('Sub. A Error', err),\n * complete: () => console.log('Sub. A Complete')\n * });\n *\n * connectable.subscribe({\n * next: x => console.log('Sub. B', x),\n * error: err => console.log('Sub. B Error', err),\n * complete: () => console.log('Sub. B Complete')\n * });\n *\n * connectable.connect();\n *\n * // Results:\n * // 'side effect 0' - after one second\n * // 'side effect 1' - after two seconds\n * // 'side effect 2' - after three seconds\n * // 'Sub. A 2' - immediately after 'side effect 2'\n * // 'Sub. B 2'\n * // 'Sub. A Complete'\n * // 'Sub. B Complete'\n * ```\n *\n * @see {@link ConnectableObservable}\n * @see {@link publish}\n * @see {@link publishReplay}\n * @see {@link publishBehavior}\n *\n * @return A function that returns an Observable that emits elements of a\n * sequence produced by multicasting the source sequence.\n * @deprecated Will be removed in v8. To create a connectable observable with an\n * {@link AsyncSubject} under the hood, use {@link connectable}.\n * `source.pipe(publishLast())` is equivalent to\n * `connectable(source, { connector: () => new AsyncSubject(), resetOnDisconnect: false })`.\n * If you're using {@link refCount} after `publishLast`, use the {@link share} operator instead.\n * `source.pipe(publishLast(), refCount())` is equivalent to\n * `source.pipe(share({ connector: () => new AsyncSubject(), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }))`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function publishLast<T>(): UnaryFunction<Observable<T>, ConnectableObservable<T>> {\n // Note that this has *never* supported a selector function like `publish` and `publishReplay`.\n return (source) => {\n const subject = new AsyncSubject<T>();\n return new ConnectableObservable(source, () => subject);\n };\n}\n", "import { Observable } from '../Observable';\nimport { ReplaySubject } from '../ReplaySubject';\nimport { multicast } from './multicast';\nimport { MonoTypeOperatorFunction, OperatorFunction, TimestampProvider, ObservableInput, ObservedValueOf } from '../types';\nimport { isFunction } from '../util/isFunction';\n\n/**\n * Creates a {@link ConnectableObservable} that uses a {@link ReplaySubject}\n * internally.\n *\n * @param bufferSize The buffer size for the underlying {@link ReplaySubject}.\n * @param windowTime The window time for the underlying {@link ReplaySubject}.\n * @param timestampProvider The timestamp provider for the underlying {@link ReplaySubject}.\n * @deprecated Will be removed in v8. To create a connectable observable that uses a\n * {@link ReplaySubject} under the hood, use {@link connectable}.\n * `source.pipe(publishReplay(size, time, scheduler))` is equivalent to\n * `connectable(source, { connector: () => new ReplaySubject(size, time, scheduler), resetOnDisconnect: false })`.\n * If you're using {@link refCount} after `publishReplay`, use the {@link share} operator instead.\n * `publishReplay(size, time, scheduler), refCount()` is equivalent to\n * `share({ connector: () => new ReplaySubject(size, time, scheduler), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false })`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function publishReplay<T>(\n bufferSize?: number,\n windowTime?: number,\n timestampProvider?: TimestampProvider\n): MonoTypeOperatorFunction<T>;\n\n/**\n * Creates an observable, that when subscribed to, will create a {@link ReplaySubject},\n * and pass an observable from it (using [asObservable](api/index/class/Subject#asObservable)) to\n * the `selector` function, which then returns an observable that is subscribed to before\n * \"connecting\" the source to the internal `ReplaySubject`.\n *\n * Since this is deprecated, for additional details see the documentation for {@link connect}.\n *\n * @param bufferSize The buffer size for the underlying {@link ReplaySubject}.\n * @param windowTime The window time for the underlying {@link ReplaySubject}.\n * @param selector A function used to setup the multicast.\n * @param timestampProvider The timestamp provider for the underlying {@link ReplaySubject}.\n * @deprecated Will be removed in v8. Use the {@link connect} operator instead.\n * `source.pipe(publishReplay(size, window, selector, scheduler))` is equivalent to\n * `source.pipe(connect(selector, { connector: () => new ReplaySubject(size, window, scheduler) }))`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function publishReplay<T, O extends ObservableInput<any>>(\n bufferSize: number | undefined,\n windowTime: number | undefined,\n selector: (shared: Observable<T>) => O,\n timestampProvider?: TimestampProvider\n): OperatorFunction<T, ObservedValueOf<O>>;\n\n/**\n * Creates a {@link ConnectableObservable} that uses a {@link ReplaySubject}\n * internally.\n *\n * @param bufferSize The buffer size for the underlying {@link ReplaySubject}.\n * @param windowTime The window time for the underlying {@link ReplaySubject}.\n * @param selector Passing `undefined` here determines that this operator will return a {@link ConnectableObservable}.\n * @param timestampProvider The timestamp provider for the underlying {@link ReplaySubject}.\n * @deprecated Will be removed in v8. To create a connectable observable that uses a\n * {@link ReplaySubject} under the hood, use {@link connectable}.\n * `source.pipe(publishReplay(size, time, scheduler))` is equivalent to\n * `connectable(source, { connector: () => new ReplaySubject(size, time, scheduler), resetOnDisconnect: false })`.\n * If you're using {@link refCount} after `publishReplay`, use the {@link share} operator instead.\n * `publishReplay(size, time, scheduler), refCount()` is equivalent to\n * `share({ connector: () => new ReplaySubject(size, time, scheduler), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false })`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function publishReplay<T, O extends ObservableInput<any>>(\n bufferSize: number | undefined,\n windowTime: number | undefined,\n selector: undefined,\n timestampProvider: TimestampProvider\n): OperatorFunction<T, ObservedValueOf<O>>;\n\n/**\n * @deprecated Will be removed in v8. Use the {@link connectable} observable, the {@link connect} operator or the\n * {@link share} operator instead. See the overloads below for equivalent replacement examples of this operator's\n * behaviors.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function publishReplay<T, R>(\n bufferSize?: number,\n windowTime?: number,\n selectorOrScheduler?: TimestampProvider | OperatorFunction<T, R>,\n timestampProvider?: TimestampProvider\n) {\n if (selectorOrScheduler && !isFunction(selectorOrScheduler)) {\n timestampProvider = selectorOrScheduler;\n }\n const selector = isFunction(selectorOrScheduler) ? selectorOrScheduler : undefined;\n // Note, we're passing `selector!` here, because at runtime, `undefined` is an acceptable argument\n // but it makes our TypeScript signature for `multicast` unhappy (as it should, because it's gross).\n return (source: Observable<T>) => multicast(new ReplaySubject<T>(bufferSize, windowTime, timestampProvider), selector!)(source);\n}\n", "import { OperatorFunction, ObservableInputTuple } from '../types';\nimport { raceInit } from '../observable/race';\nimport { operate } from '../util/lift';\nimport { identity } from '../util/identity';\n\n/**\n * Creates an Observable that mirrors the first source Observable to emit a next,\n * error or complete notification from the combination of the Observable to which\n * the operator is applied and supplied Observables.\n *\n * ## Example\n *\n * ```ts\n * import { interval, map, raceWith } from 'rxjs';\n *\n * const obs1 = interval(7000).pipe(map(() => 'slow one'));\n * const obs2 = interval(3000).pipe(map(() => 'fast one'));\n * const obs3 = interval(5000).pipe(map(() => 'medium one'));\n *\n * obs1\n * .pipe(raceWith(obs2, obs3))\n * .subscribe(winner => console.log(winner));\n *\n * // Outputs\n * // a series of 'fast one'\n * ```\n *\n * @param otherSources Sources used to race for which Observable emits first.\n * @return A function that returns an Observable that mirrors the output of the\n * first Observable to emit an item.\n */\nexport function raceWith<T, A extends readonly unknown[]>(\n ...otherSources: [...ObservableInputTuple<A>]\n): OperatorFunction<T, T | A[number]> {\n return !otherSources.length\n ? identity\n : operate((source, subscriber) => {\n raceInit<T | A[number]>([source, ...otherSources])(subscriber);\n });\n}\n", "import { Subscription } from '../Subscription';\nimport { EMPTY } from '../observable/empty';\nimport { operate } from '../util/lift';\nimport { MonoTypeOperatorFunction, ObservableInput } from '../types';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\nimport { timer } from '../observable/timer';\n\nexport interface RepeatConfig {\n /**\n * The number of times to repeat the source. Defaults to `Infinity`.\n */\n count?: number;\n\n /**\n * If a `number`, will delay the repeat of the source by that number of milliseconds.\n * If a function, it will provide the number of times the source has been subscribed to,\n * and the return value should be a valid observable input that will notify when the source\n * should be repeated. If the notifier observable is empty, the result will complete.\n */\n delay?: number | ((count: number) => ObservableInput<any>);\n}\n\n/**\n * Returns an Observable that will resubscribe to the source stream when the source stream completes.\n *\n * <span class=\"informal\">Repeats all values emitted on the source. It's like {@link retry}, but for non error cases.</span>\n *\n * ![](repeat.png)\n *\n * Repeat will output values from a source until the source completes, then it will resubscribe to the\n * source a specified number of times, with a specified delay. Repeat can be particularly useful in\n * combination with closing operators like {@link take}, {@link takeUntil}, {@link first}, or {@link takeWhile},\n * as it can be used to restart a source again from scratch.\n *\n * Repeat is very similar to {@link retry}, where {@link retry} will resubscribe to the source in the error case, but\n * `repeat` will resubscribe if the source completes.\n *\n * Note that `repeat` will _not_ catch errors. Use {@link retry} for that.\n *\n * - `repeat(0)` returns an empty observable\n * - `repeat()` will repeat forever\n * - `repeat({ delay: 200 })` will repeat forever, with a delay of 200ms between repetitions.\n * - `repeat({ count: 2, delay: 400 })` will repeat twice, with a delay of 400ms between repetitions.\n * - `repeat({ delay: (count) => timer(count * 1000) })` will repeat forever, but will have a delay that grows by one second for each repetition.\n *\n * ## Example\n *\n * Repeat a message stream\n *\n * ```ts\n * import { of, repeat } from 'rxjs';\n *\n * const source = of('Repeat message');\n * const result = source.pipe(repeat(3));\n *\n * result.subscribe(x => console.log(x));\n *\n * // Results\n * // 'Repeat message'\n * // 'Repeat message'\n * // 'Repeat message'\n * ```\n *\n * Repeat 3 values, 2 times\n *\n * ```ts\n * import { interval, take, repeat } from 'rxjs';\n *\n * const source = interval(1000);\n * const result = source.pipe(take(3), repeat(2));\n *\n * result.subscribe(x => console.log(x));\n *\n * // Results every second\n * // 0\n * // 1\n * // 2\n * // 0\n * // 1\n * // 2\n * ```\n *\n * Defining two complex repeats with delays on the same source.\n * Note that the second repeat cannot be called until the first\n * repeat as exhausted it's count.\n *\n * ```ts\n * import { defer, of, repeat } from 'rxjs';\n *\n * const source = defer(() => {\n * return of(`Hello, it is ${new Date()}`)\n * });\n *\n * source.pipe(\n * // Repeat 3 times with a delay of 1 second between repetitions\n * repeat({\n * count: 3,\n * delay: 1000,\n * }),\n *\n * // *Then* repeat forever, but with an exponential step-back\n * // maxing out at 1 minute.\n * repeat({\n * delay: (count) => timer(Math.min(60000, 2 ^ count * 1000))\n * })\n * )\n * ```\n *\n * @see {@link repeatWhen}\n * @see {@link retry}\n *\n * @param countOrConfig Either the number of times the source Observable items are repeated\n * (a count of 0 will yield an empty Observable) or a {@link RepeatConfig} object.\n */\nexport function repeat<T>(countOrConfig?: number | RepeatConfig): MonoTypeOperatorFunction<T> {\n let count = Infinity;\n let delay: RepeatConfig['delay'];\n\n if (countOrConfig != null) {\n if (typeof countOrConfig === 'object') {\n ({ count = Infinity, delay } = countOrConfig);\n } else {\n count = countOrConfig;\n }\n }\n\n return count <= 0\n ? () => EMPTY\n : operate((source, subscriber) => {\n let soFar = 0;\n let sourceSub: Subscription | null;\n\n const resubscribe = () => {\n sourceSub?.unsubscribe();\n sourceSub = null;\n if (delay != null) {\n const notifier = typeof delay === 'number' ? timer(delay) : innerFrom(delay(soFar));\n const notifierSubscriber = createOperatorSubscriber(subscriber, () => {\n notifierSubscriber.unsubscribe();\n subscribeToSource();\n });\n notifier.subscribe(notifierSubscriber);\n } else {\n subscribeToSource();\n }\n };\n\n const subscribeToSource = () => {\n let syncUnsub = false;\n sourceSub = source.subscribe(\n createOperatorSubscriber(subscriber, undefined, () => {\n if (++soFar < count) {\n if (sourceSub) {\n resubscribe();\n } else {\n syncUnsub = true;\n }\n } else {\n subscriber.complete();\n }\n })\n );\n\n if (syncUnsub) {\n resubscribe();\n }\n };\n\n subscribeToSource();\n });\n}\n", "import { Observable } from '../Observable';\nimport { innerFrom } from '../observable/innerFrom';\nimport { Subject } from '../Subject';\nimport { Subscription } from '../Subscription';\n\nimport { MonoTypeOperatorFunction, ObservableInput } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Returns an Observable that mirrors the source Observable with the exception of a `complete`. If the source\n * Observable calls `complete`, this method will emit to the Observable returned from `notifier`. If that Observable\n * calls `complete` or `error`, then this method will call `complete` or `error` on the child subscription. Otherwise\n * this method will resubscribe to the source Observable.\n *\n * ![](repeatWhen.png)\n *\n * ## Example\n *\n * Repeat a message stream on click\n *\n * ```ts\n * import { of, fromEvent, repeatWhen } from 'rxjs';\n *\n * const source = of('Repeat message');\n * const documentClick$ = fromEvent(document, 'click');\n *\n * const result = source.pipe(repeatWhen(() => documentClick$));\n *\n * result.subscribe(data => console.log(data))\n * ```\n *\n * @see {@link repeat}\n * @see {@link retry}\n * @see {@link retryWhen}\n *\n * @param notifier Function that receives an Observable of notifications with\n * which a user can `complete` or `error`, aborting the repetition.\n * @return A function that returns an Observable that mirrors the source\n * Observable with the exception of a `complete`.\n * @deprecated Will be removed in v9 or v10. Use {@link repeat}'s {@link RepeatConfig#delay delay} option instead.\n * Instead of `repeatWhen(() => notify$)`, use: `repeat({ delay: () => notify$ })`.\n */\nexport function repeatWhen<T>(notifier: (notifications: Observable<void>) => ObservableInput<any>): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n let innerSub: Subscription | null;\n let syncResub = false;\n let completions$: Subject<void>;\n let isNotifierComplete = false;\n let isMainComplete = false;\n\n /**\n * Checks to see if we can complete the result, completes it, and returns `true` if it was completed.\n */\n const checkComplete = () => isMainComplete && isNotifierComplete && (subscriber.complete(), true);\n /**\n * Gets the subject to send errors through. If it doesn't exist,\n * we know we need to setup the notifier.\n */\n const getCompletionSubject = () => {\n if (!completions$) {\n completions$ = new Subject();\n\n // If the call to `notifier` throws, it will be caught by the OperatorSubscriber\n // In the main subscription -- in `subscribeForRepeatWhen`.\n innerFrom(notifier(completions$)).subscribe(\n createOperatorSubscriber(\n subscriber,\n () => {\n if (innerSub) {\n subscribeForRepeatWhen();\n } else {\n // If we don't have an innerSub yet, that's because the inner subscription\n // call hasn't even returned yet. We've arrived here synchronously.\n // So we flag that we want to resub, such that we can ensure finalization\n // happens before we resubscribe.\n syncResub = true;\n }\n },\n () => {\n isNotifierComplete = true;\n checkComplete();\n }\n )\n );\n }\n return completions$;\n };\n\n const subscribeForRepeatWhen = () => {\n isMainComplete = false;\n\n innerSub = source.subscribe(\n createOperatorSubscriber(subscriber, undefined, () => {\n isMainComplete = true;\n // Check to see if we are complete, and complete if so.\n // If we are not complete. Get the subject. This calls the `notifier` function.\n // If that function fails, it will throw and `.next()` will not be reached on this\n // line. The thrown error is caught by the _complete handler in this\n // `OperatorSubscriber` and handled appropriately.\n !checkComplete() && getCompletionSubject().next();\n })\n );\n\n if (syncResub) {\n // Ensure that the inner subscription is torn down before\n // moving on to the next subscription in the synchronous case.\n // If we don't do this here, all inner subscriptions will not be\n // torn down until the entire observable is done.\n innerSub.unsubscribe();\n // It is important to null this out. Not only to free up memory, but\n // to make sure code above knows we are in a subscribing state to\n // handle synchronous resubscription.\n innerSub = null;\n // We may need to do this multiple times, so reset the flags.\n syncResub = false;\n // Resubscribe\n subscribeForRepeatWhen();\n }\n };\n\n // Start the subscription\n subscribeForRepeatWhen();\n });\n}\n", "import { MonoTypeOperatorFunction, ObservableInput } from '../types';\nimport { operate } from '../util/lift';\nimport { Subscription } from '../Subscription';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { identity } from '../util/identity';\nimport { timer } from '../observable/timer';\nimport { innerFrom } from '../observable/innerFrom';\n\n/**\n * The {@link retry} operator configuration object. `retry` either accepts a `number`\n * or an object described by this interface.\n */\nexport interface RetryConfig {\n /**\n * The maximum number of times to retry. If `count` is omitted, `retry` will try to\n * resubscribe on errors infinite number of times.\n */\n count?: number;\n /**\n * The number of milliseconds to delay before retrying, OR a function to\n * return a notifier for delaying. If a function is given, that function should\n * return a notifier that, when it emits will retry the source. If the notifier\n * completes _without_ emitting, the resulting observable will complete without error,\n * if the notifier errors, the error will be pushed to the result.\n */\n delay?: number | ((error: any, retryCount: number) => ObservableInput<any>);\n /**\n * Whether or not to reset the retry counter when the retried subscription\n * emits its first value.\n */\n resetOnSuccess?: boolean;\n}\n\nexport function retry<T>(count?: number): MonoTypeOperatorFunction<T>;\nexport function retry<T>(config: RetryConfig): MonoTypeOperatorFunction<T>;\n\n/**\n * Returns an Observable that mirrors the source Observable with the exception of an `error`.\n *\n * If the source Observable calls `error`, this method will resubscribe to the source Observable for a maximum of\n * `count` resubscriptions rather than propagating the `error` call.\n *\n * ![](retry.png)\n *\n * The number of retries is determined by the `count` parameter. It can be set either by passing a number to\n * `retry` function or by setting `count` property when `retry` is configured using {@link RetryConfig}. If\n * `count` is omitted, `retry` will try to resubscribe on errors infinite number of times.\n *\n * Any and all items emitted by the source Observable will be emitted by the resulting Observable, even those\n * emitted during failed subscriptions. For example, if an Observable fails at first but emits `[1, 2]` then\n * succeeds the second time and emits: `[1, 2, 3, 4, 5, complete]` then the complete stream of emissions and\n * notifications would be: `[1, 2, 1, 2, 3, 4, 5, complete]`.\n *\n * ## Example\n *\n * ```ts\n * import { interval, mergeMap, throwError, of, retry } from 'rxjs';\n *\n * const source = interval(1000);\n * const result = source.pipe(\n * mergeMap(val => val > 5 ? throwError(() => 'Error!') : of(val)),\n * retry(2) // retry 2 times on error\n * );\n *\n * result.subscribe({\n * next: value => console.log(value),\n * error: err => console.log(`${ err }: Retried 2 times then quit!`)\n * });\n *\n * // Output:\n * // 0..1..2..3..4..5..\n * // 0..1..2..3..4..5..\n * // 0..1..2..3..4..5..\n * // 'Error!: Retried 2 times then quit!'\n * ```\n *\n * @see {@link retryWhen}\n *\n * @param configOrCount Either number of retry attempts before failing or a\n * {@link RetryConfig} object.\n * @return A function that returns an Observable that will resubscribe to the\n * source stream when the source stream errors, at most `count` times.\n */\nexport function retry<T>(configOrCount: number | RetryConfig = Infinity): MonoTypeOperatorFunction<T> {\n let config: RetryConfig;\n if (configOrCount && typeof configOrCount === 'object') {\n config = configOrCount;\n } else {\n config = {\n count: configOrCount as number,\n };\n }\n const { count = Infinity, delay, resetOnSuccess: resetOnSuccess = false } = config;\n\n return count <= 0\n ? identity\n : operate((source, subscriber) => {\n let soFar = 0;\n let innerSub: Subscription | null;\n const subscribeForRetry = () => {\n let syncUnsub = false;\n innerSub = source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => {\n // If we're resetting on success\n if (resetOnSuccess) {\n soFar = 0;\n }\n subscriber.next(value);\n },\n // Completions are passed through to consumer.\n undefined,\n (err) => {\n if (soFar++ < count) {\n // We are still under our retry count\n const resub = () => {\n if (innerSub) {\n innerSub.unsubscribe();\n innerSub = null;\n subscribeForRetry();\n } else {\n syncUnsub = true;\n }\n };\n\n if (delay != null) {\n // The user specified a retry delay.\n // They gave us a number, use a timer, otherwise, it's a function,\n // and we're going to call it to get a notifier.\n const notifier = typeof delay === 'number' ? timer(delay) : innerFrom(delay(err, soFar));\n const notifierSubscriber = createOperatorSubscriber(\n subscriber,\n () => {\n // After we get the first notification, we\n // unsubscribe from the notifier, because we don't want anymore\n // and we resubscribe to the source.\n notifierSubscriber.unsubscribe();\n resub();\n },\n () => {\n // The notifier completed without emitting.\n // The author is telling us they want to complete.\n subscriber.complete();\n }\n );\n notifier.subscribe(notifierSubscriber);\n } else {\n // There was no notifier given. Just resub immediately.\n resub();\n }\n } else {\n // We're past our maximum number of retries.\n // Just send along the error.\n subscriber.error(err);\n }\n }\n )\n );\n if (syncUnsub) {\n innerSub.unsubscribe();\n innerSub = null;\n subscribeForRetry();\n }\n };\n subscribeForRetry();\n });\n}\n", "import { Observable } from '../Observable';\nimport { innerFrom } from '../observable/innerFrom';\nimport { Subject } from '../Subject';\nimport { Subscription } from '../Subscription';\n\nimport { MonoTypeOperatorFunction, ObservableInput } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Returns an Observable that mirrors the source Observable with the exception of an `error`. If the source Observable\n * calls `error`, this method will emit the Throwable that caused the error to the `ObservableInput` returned from `notifier`.\n * If that Observable calls `complete` or `error` then this method will call `complete` or `error` on the child\n * subscription. Otherwise this method will resubscribe to the source Observable.\n *\n * ![](retryWhen.png)\n *\n * Retry an observable sequence on error based on custom criteria.\n *\n * ## Example\n *\n * ```ts\n * import { interval, map, retryWhen, tap, delayWhen, timer } from 'rxjs';\n *\n * const source = interval(1000);\n * const result = source.pipe(\n * map(value => {\n * if (value > 5) {\n * // error will be picked up by retryWhen\n * throw value;\n * }\n * return value;\n * }),\n * retryWhen(errors =>\n * errors.pipe(\n * // log error message\n * tap(value => console.log(`Value ${ value } was too high!`)),\n * // restart in 5 seconds\n * delayWhen(value => timer(value * 1000))\n * )\n * )\n * );\n *\n * result.subscribe(value => console.log(value));\n *\n * // results:\n * // 0\n * // 1\n * // 2\n * // 3\n * // 4\n * // 5\n * // 'Value 6 was too high!'\n * // - Wait 5 seconds then repeat\n * ```\n *\n * @see {@link retry}\n *\n * @param notifier Function that receives an Observable of notifications with which a\n * user can `complete` or `error`, aborting the retry.\n * @return A function that returns an Observable that mirrors the source\n * Observable with the exception of an `error`.\n * @deprecated Will be removed in v9 or v10, use {@link retry}'s `delay` option instead.\n * Will be removed in v9 or v10. Use {@link retry}'s {@link RetryConfig#delay delay} option instead.\n * Instead of `retryWhen(() => notify$)`, use: `retry({ delay: () => notify$ })`.\n */\nexport function retryWhen<T>(notifier: (errors: Observable<any>) => ObservableInput<any>): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n let innerSub: Subscription | null;\n let syncResub = false;\n let errors$: Subject<any>;\n\n const subscribeForRetryWhen = () => {\n innerSub = source.subscribe(\n createOperatorSubscriber(subscriber, undefined, undefined, (err) => {\n if (!errors$) {\n errors$ = new Subject();\n innerFrom(notifier(errors$)).subscribe(\n createOperatorSubscriber(subscriber, () =>\n // If we have an innerSub, this was an asynchronous call, kick off the retry.\n // Otherwise, if we don't have an innerSub yet, that's because the inner subscription\n // call hasn't even returned yet. We've arrived here synchronously.\n // So we flag that we want to resub, such that we can ensure finalization\n // happens before we resubscribe.\n innerSub ? subscribeForRetryWhen() : (syncResub = true)\n )\n );\n }\n if (errors$) {\n // We have set up the notifier without error.\n errors$.next(err);\n }\n })\n );\n\n if (syncResub) {\n // Ensure that the inner subscription is torn down before\n // moving on to the next subscription in the synchronous case.\n // If we don't do this here, all inner subscriptions will not be\n // torn down until the entire observable is done.\n innerSub.unsubscribe();\n innerSub = null;\n // We may need to do this multiple times, so reset the flag.\n syncResub = false;\n // Resubscribe\n subscribeForRetryWhen();\n }\n };\n\n // Start the subscription\n subscribeForRetryWhen();\n });\n}\n", "import { innerFrom } from '../observable/innerFrom';\nimport { MonoTypeOperatorFunction, ObservableInput } from '../types';\nimport { operate } from '../util/lift';\nimport { noop } from '../util/noop';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Emits the most recently emitted value from the source Observable whenever\n * another Observable, the `notifier`, emits.\n *\n * <span class=\"informal\">It's like {@link sampleTime}, but samples whenever\n * the `notifier` `ObservableInput` emits something.</span>\n *\n * ![](sample.png)\n *\n * Whenever the `notifier` `ObservableInput` emits a value, `sample`\n * looks at the source Observable and emits whichever value it has most recently\n * emitted since the previous sampling, unless the source has not emitted\n * anything since the previous sampling. The `notifier` is subscribed to as soon\n * as the output Observable is subscribed.\n *\n * ## Example\n *\n * On every click, sample the most recent `seconds` timer\n *\n * ```ts\n * import { fromEvent, interval, sample } from 'rxjs';\n *\n * const seconds = interval(1000);\n * const clicks = fromEvent(document, 'click');\n * const result = seconds.pipe(sample(clicks));\n *\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link audit}\n * @see {@link debounce}\n * @see {@link sampleTime}\n * @see {@link throttle}\n *\n * @param notifier The `ObservableInput` to use for sampling the\n * source Observable.\n * @return A function that returns an Observable that emits the results of\n * sampling the values emitted by the source Observable whenever the notifier\n * Observable emits value or completes.\n */\nexport function sample<T>(notifier: ObservableInput<any>): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n let hasValue = false;\n let lastValue: T | null = null;\n source.subscribe(\n createOperatorSubscriber(subscriber, (value) => {\n hasValue = true;\n lastValue = value;\n })\n );\n innerFrom(notifier).subscribe(\n createOperatorSubscriber(\n subscriber,\n () => {\n if (hasValue) {\n hasValue = false;\n const value = lastValue!;\n lastValue = null;\n subscriber.next(value);\n }\n },\n noop\n )\n );\n });\n}\n", "import { asyncScheduler } from '../scheduler/async';\nimport { MonoTypeOperatorFunction, SchedulerLike } from '../types';\nimport { sample } from './sample';\nimport { interval } from '../observable/interval';\n\n/**\n * Emits the most recently emitted value from the source Observable within\n * periodic time intervals.\n *\n * <span class=\"informal\">Samples the source Observable at periodic time\n * intervals, emitting what it samples.</span>\n *\n * ![](sampleTime.png)\n *\n * `sampleTime` periodically looks at the source Observable and emits whichever\n * value it has most recently emitted since the previous sampling, unless the\n * source has not emitted anything since the previous sampling. The sampling\n * happens periodically in time every `period` milliseconds (or the time unit\n * defined by the optional `scheduler` argument). The sampling starts as soon as\n * the output Observable is subscribed.\n *\n * ## Example\n *\n * Every second, emit the most recent click at most once\n *\n * ```ts\n * import { fromEvent, sampleTime } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(sampleTime(1000));\n *\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link auditTime}\n * @see {@link debounceTime}\n * @see {@link delay}\n * @see {@link sample}\n * @see {@link throttleTime}\n *\n * @param period The sampling period expressed in milliseconds or the time unit\n * determined internally by the optional `scheduler`.\n * @param scheduler The {@link SchedulerLike} to use for managing the timers\n * that handle the sampling.\n * @return A function that returns an Observable that emits the results of\n * sampling the values emitted by the source Observable at the specified time\n * interval.\n */\nexport function sampleTime<T>(period: number, scheduler: SchedulerLike = asyncScheduler): MonoTypeOperatorFunction<T> {\n return sample(interval(period, scheduler));\n}\n", "import { OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { scanInternals } from './scanInternals';\n\nexport function scan<V, A = V>(accumulator: (acc: A | V, value: V, index: number) => A): OperatorFunction<V, V | A>;\nexport function scan<V, A>(accumulator: (acc: A, value: V, index: number) => A, seed: A): OperatorFunction<V, A>;\nexport function scan<V, A, S>(accumulator: (acc: A | S, value: V, index: number) => A, seed: S): OperatorFunction<V, A>;\n\n// TODO: link to a \"redux pattern\" section in the guide (location TBD)\n\n/**\n * Useful for encapsulating and managing state. Applies an accumulator (or \"reducer function\")\n * to each value from the source after an initial state is established -- either via\n * a `seed` value (second argument), or from the first value from the source.\n *\n * <span class=\"informal\">It's like {@link reduce}, but emits the current\n * accumulation state after each update</span>\n *\n * ![](scan.png)\n *\n * This operator maintains an internal state and emits it after processing each value as follows:\n *\n * 1. First value arrives\n * - If a `seed` value was supplied (as the second argument to `scan`), let `state = seed` and `value = firstValue`.\n * - If NO `seed` value was supplied (no second argument), let `state = firstValue` and go to 3.\n * 2. Let `state = accumulator(state, value)`.\n * - If an error is thrown by `accumulator`, notify the consumer of an error. The process ends.\n * 3. Emit `state`.\n * 4. Next value arrives, let `value = nextValue`, go to 2.\n *\n * ## Examples\n *\n * An average of previous numbers. This example shows how\n * not providing a `seed` can prime the stream with the\n * first value from the source.\n *\n * ```ts\n * import { of, scan, map } from 'rxjs';\n *\n * const numbers$ = of(1, 2, 3);\n *\n * numbers$\n * .pipe(\n * // Get the sum of the numbers coming in.\n * scan((total, n) => total + n),\n * // Get the average by dividing the sum by the total number\n * // received so far (which is 1 more than the zero-based index).\n * map((sum, index) => sum / (index + 1))\n * )\n * .subscribe(console.log);\n * ```\n *\n * The Fibonacci sequence. This example shows how you can use\n * a seed to prime accumulation process. Also... you know... Fibonacci.\n * So important to like, computers and stuff that its whiteboarded\n * in job interviews. Now you can show them the Rx version! (Please don't, haha)\n *\n * ```ts\n * import { interval, scan, map, startWith } from 'rxjs';\n *\n * const firstTwoFibs = [0, 1];\n * // An endless stream of Fibonacci numbers.\n * const fibonacci$ = interval(1000).pipe(\n * // Scan to get the fibonacci numbers (after 0, 1)\n * scan(([a, b]) => [b, a + b], firstTwoFibs),\n * // Get the second number in the tuple, it's the one you calculated\n * map(([, n]) => n),\n * // Start with our first two digits :)\n * startWith(...firstTwoFibs)\n * );\n *\n * fibonacci$.subscribe(console.log);\n * ```\n *\n * @see {@link expand}\n * @see {@link mergeScan}\n * @see {@link reduce}\n * @see {@link switchScan}\n *\n * @param accumulator A \"reducer function\". This will be called for each value after an initial state is\n * acquired.\n * @param seed The initial state. If this is not provided, the first value from the source will\n * be used as the initial state, and emitted without going through the accumulator. All subsequent values\n * will be processed by the accumulator function. If this is provided, all values will go through\n * the accumulator function.\n * @return A function that returns an Observable of the accumulated values.\n */\nexport function scan<V, A, S>(accumulator: (acc: V | A | S, value: V, index: number) => A, seed?: S): OperatorFunction<V, V | A> {\n // providing a seed of `undefined` *should* be valid and trigger\n // hasSeed! so don't use `seed !== undefined` checks!\n // For this reason, we have to check it here at the original call site\n // otherwise inside Operator/Subscriber we won't know if `undefined`\n // means they didn't provide anything or if they literally provided `undefined`\n return operate(scanInternals(accumulator, seed as S, arguments.length >= 2, true));\n}\n", "import { OperatorFunction, ObservableInput } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\n\n/**\n * Compares all values of two observables in sequence using an optional comparator function\n * and returns an observable of a single boolean value representing whether or not the two sequences\n * are equal.\n *\n * <span class=\"informal\">Checks to see of all values emitted by both observables are equal, in order.</span>\n *\n * ![](sequenceEqual.png)\n *\n * `sequenceEqual` subscribes to source observable and `compareTo` `ObservableInput` (that internally\n * gets converted to an observable) and buffers incoming values from each observable. Whenever either\n * observable emits a value, the value is buffered and the buffers are shifted and compared from the bottom\n * up; If any value pair doesn't match, the returned observable will emit `false` and complete. If one of the\n * observables completes, the operator will wait for the other observable to complete; If the other\n * observable emits before completing, the returned observable will emit `false` and complete. If one observable never\n * completes or emits after the other completes, the returned observable will never complete.\n *\n * ## Example\n *\n * Figure out if the Konami code matches\n *\n * ```ts\n * import { from, fromEvent, map, bufferCount, mergeMap, sequenceEqual } from 'rxjs';\n *\n * const codes = from([\n * 'ArrowUp',\n * 'ArrowUp',\n * 'ArrowDown',\n * 'ArrowDown',\n * 'ArrowLeft',\n * 'ArrowRight',\n * 'ArrowLeft',\n * 'ArrowRight',\n * 'KeyB',\n * 'KeyA',\n * 'Enter', // no start key, clearly.\n * ]);\n *\n * const keys = fromEvent<KeyboardEvent>(document, 'keyup').pipe(map(e => e.code));\n * const matches = keys.pipe(\n * bufferCount(11, 1),\n * mergeMap(last11 => from(last11).pipe(sequenceEqual(codes)))\n * );\n * matches.subscribe(matched => console.log('Successful cheat at Contra? ', matched));\n * ```\n *\n * @see {@link combineLatest}\n * @see {@link zip}\n * @see {@link withLatestFrom}\n *\n * @param compareTo The `ObservableInput` sequence to compare the source sequence to.\n * @param comparator An optional function to compare each value pair.\n *\n * @return A function that returns an Observable that emits a single boolean\n * value representing whether or not the values emitted by the source\n * Observable and provided `ObservableInput` were equal in sequence.\n */\nexport function sequenceEqual<T>(\n compareTo: ObservableInput<T>,\n comparator: (a: T, b: T) => boolean = (a, b) => a === b\n): OperatorFunction<T, boolean> {\n return operate((source, subscriber) => {\n // The state for the source observable\n const aState = createState<T>();\n // The state for the compareTo observable;\n const bState = createState<T>();\n\n /** A utility to emit and complete */\n const emit = (isEqual: boolean) => {\n subscriber.next(isEqual);\n subscriber.complete();\n };\n\n /**\n * Creates a subscriber that subscribes to one of the sources, and compares its collected\n * state -- `selfState` -- to the other source's collected state -- `otherState`. This\n * is used for both streams.\n */\n const createSubscriber = (selfState: SequenceState<T>, otherState: SequenceState<T>) => {\n const sequenceEqualSubscriber = createOperatorSubscriber(\n subscriber,\n (a: T) => {\n const { buffer, complete } = otherState;\n if (buffer.length === 0) {\n // If there's no values in the other buffer\n // and the other stream is complete, we know\n // this isn't a match, because we got one more value.\n // Otherwise, we push onto our buffer, so when the other\n // stream emits, it can pull this value off our buffer and check it\n // at the appropriate time.\n complete ? emit(false) : selfState.buffer.push(a);\n } else {\n // If the other stream *does* have values in its buffer,\n // pull the oldest one off so we can compare it to what we\n // just got. If it wasn't a match, emit `false` and complete.\n !comparator(a, buffer.shift()!) && emit(false);\n }\n },\n () => {\n // Or observable completed\n selfState.complete = true;\n const { complete, buffer } = otherState;\n // If the other observable is also complete, and there's\n // still stuff left in their buffer, it doesn't match, if their\n // buffer is empty, then it does match. This is because we can't\n // possibly get more values here anymore.\n complete && emit(buffer.length === 0);\n // Be sure to clean up our stream as soon as possible if we can.\n sequenceEqualSubscriber?.unsubscribe();\n }\n );\n\n return sequenceEqualSubscriber;\n };\n\n // Subscribe to each source.\n source.subscribe(createSubscriber(aState, bState));\n innerFrom(compareTo).subscribe(createSubscriber(bState, aState));\n });\n}\n\n/**\n * A simple structure for the data used to test each sequence\n */\ninterface SequenceState<T> {\n /** A temporary store for arrived values before they are checked */\n buffer: T[];\n /** Whether or not the sequence source has completed. */\n complete: boolean;\n}\n\n/**\n * Creates a simple structure that is used to represent\n * data used to test each sequence.\n */\nfunction createState<T>(): SequenceState<T> {\n return {\n buffer: [],\n complete: false,\n };\n}\n", "import { innerFrom } from '../observable/innerFrom';\nimport { Subject } from '../Subject';\nimport { SafeSubscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\nimport { MonoTypeOperatorFunction, SubjectLike, ObservableInput } from '../types';\nimport { operate } from '../util/lift';\n\nexport interface ShareConfig<T> {\n /**\n * The factory used to create the subject that will connect the source observable to\n * multicast consumers.\n */\n connector?: () => SubjectLike<T>;\n /**\n * If `true`, the resulting observable will reset internal state on error from source and return to a \"cold\" state. This\n * allows the resulting observable to be \"retried\" in the event of an error.\n * If `false`, when an error comes from the source it will push the error into the connecting subject, and the subject\n * will remain the connecting subject, meaning the resulting observable will not go \"cold\" again, and subsequent retries\n * or resubscriptions will resubscribe to that same subject. In all cases, RxJS subjects will emit the same error again, however\n * {@link ReplaySubject} will also push its buffered values before pushing the error.\n * It is also possible to pass a notifier factory returning an `ObservableInput` instead which grants more fine-grained\n * control over how and when the reset should happen. This allows behaviors like conditional or delayed resets.\n */\n resetOnError?: boolean | ((error: any) => ObservableInput<any>);\n /**\n * If `true`, the resulting observable will reset internal state on completion from source and return to a \"cold\" state. This\n * allows the resulting observable to be \"repeated\" after it is done.\n * If `false`, when the source completes, it will push the completion through the connecting subject, and the subject\n * will remain the connecting subject, meaning the resulting observable will not go \"cold\" again, and subsequent repeats\n * or resubscriptions will resubscribe to that same subject.\n * It is also possible to pass a notifier factory returning an `ObservableInput` instead which grants more fine-grained\n * control over how and when the reset should happen. This allows behaviors like conditional or delayed resets.\n */\n resetOnComplete?: boolean | (() => ObservableInput<any>);\n /**\n * If `true`, when the number of subscribers to the resulting observable reaches zero due to those subscribers unsubscribing, the\n * internal state will be reset and the resulting observable will return to a \"cold\" state. This means that the next\n * time the resulting observable is subscribed to, a new subject will be created and the source will be subscribed to\n * again.\n * If `false`, when the number of subscribers to the resulting observable reaches zero due to unsubscription, the subject\n * will remain connected to the source, and new subscriptions to the result will be connected through that same subject.\n * It is also possible to pass a notifier factory returning an `ObservableInput` instead which grants more fine-grained\n * control over how and when the reset should happen. This allows behaviors like conditional or delayed resets.\n */\n resetOnRefCountZero?: boolean | (() => ObservableInput<any>);\n}\n\nexport function share<T>(): MonoTypeOperatorFunction<T>;\n\nexport function share<T>(options: ShareConfig<T>): MonoTypeOperatorFunction<T>;\n\n/**\n * Returns a new Observable that multicasts (shares) the original Observable. As long as there is at least one\n * Subscriber this Observable will be subscribed and emitting data. When all subscribers have unsubscribed it will\n * unsubscribe from the source Observable. Because the Observable is multicasting it makes the stream `hot`.\n * This is an alias for `multicast(() => new Subject()), refCount()`.\n *\n * The subscription to the underlying source Observable can be reset (unsubscribe and resubscribe for new subscribers),\n * if the subscriber count to the shared observable drops to 0, or if the source Observable errors or completes. It is\n * possible to use notifier factories for the resets to allow for behaviors like conditional or delayed resets. Please\n * note that resetting on error or complete of the source Observable does not behave like a transparent retry or restart\n * of the source because the error or complete will be forwarded to all subscribers and their subscription will be\n * closed. Only new subscribers after a reset on error or complete happened will cause a fresh subscription to the\n * source. To achieve transparent retries or restarts pipe the source through appropriate operators before sharing.\n *\n * ![](share.png)\n *\n * ## Example\n *\n * Generate new multicast Observable from the `source` Observable value\n *\n * ```ts\n * import { interval, tap, map, take, share } from 'rxjs';\n *\n * const source = interval(1000).pipe(\n * tap(x => console.log('Processing: ', x)),\n * map(x => x * x),\n * take(6),\n * share()\n * );\n *\n * source.subscribe(x => console.log('subscription 1: ', x));\n * source.subscribe(x => console.log('subscription 2: ', x));\n *\n * // Logs:\n * // Processing: 0\n * // subscription 1: 0\n * // subscription 2: 0\n * // Processing: 1\n * // subscription 1: 1\n * // subscription 2: 1\n * // Processing: 2\n * // subscription 1: 4\n * // subscription 2: 4\n * // Processing: 3\n * // subscription 1: 9\n * // subscription 2: 9\n * // Processing: 4\n * // subscription 1: 16\n * // subscription 2: 16\n * // Processing: 5\n * // subscription 1: 25\n * // subscription 2: 25\n * ```\n *\n * ## Example with notifier factory: Delayed reset\n *\n * ```ts\n * import { interval, take, share, timer } from 'rxjs';\n *\n * const source = interval(1000).pipe(\n * take(3),\n * share({\n * resetOnRefCountZero: () => timer(1000)\n * })\n * );\n *\n * const subscriptionOne = source.subscribe(x => console.log('subscription 1: ', x));\n * setTimeout(() => subscriptionOne.unsubscribe(), 1300);\n *\n * setTimeout(() => source.subscribe(x => console.log('subscription 2: ', x)), 1700);\n *\n * setTimeout(() => source.subscribe(x => console.log('subscription 3: ', x)), 5000);\n *\n * // Logs:\n * // subscription 1: 0\n * // (subscription 1 unsubscribes here)\n * // (subscription 2 subscribes here ~400ms later, source was not reset)\n * // subscription 2: 1\n * // subscription 2: 2\n * // (subscription 2 unsubscribes here)\n * // (subscription 3 subscribes here ~2000ms later, source did reset before)\n * // subscription 3: 0\n * // subscription 3: 1\n * // subscription 3: 2\n * ```\n *\n * @see {@link shareReplay}\n *\n * @return A function that returns an Observable that mirrors the source.\n */\nexport function share<T>(options: ShareConfig<T> = {}): MonoTypeOperatorFunction<T> {\n const { connector = () => new Subject<T>(), resetOnError = true, resetOnComplete = true, resetOnRefCountZero = true } = options;\n // It's necessary to use a wrapper here, as the _operator_ must be\n // referentially transparent. Otherwise, it cannot be used in calls to the\n // static `pipe` function - to create a partial pipeline.\n //\n // The _operator function_ - the function returned by the _operator_ - will\n // not be referentially transparent - as it shares its source - but the\n // _operator function_ is called when the complete pipeline is composed via a\n // call to a source observable's `pipe` method - not when the static `pipe`\n // function is called.\n return (wrapperSource) => {\n let connection: SafeSubscriber<T> | undefined;\n let resetConnection: Subscription | undefined;\n let subject: SubjectLike<T> | undefined;\n let refCount = 0;\n let hasCompleted = false;\n let hasErrored = false;\n\n const cancelReset = () => {\n resetConnection?.unsubscribe();\n resetConnection = undefined;\n };\n // Used to reset the internal state to a \"cold\"\n // state, as though it had never been subscribed to.\n const reset = () => {\n cancelReset();\n connection = subject = undefined;\n hasCompleted = hasErrored = false;\n };\n const resetAndUnsubscribe = () => {\n // We need to capture the connection before\n // we reset (if we need to reset).\n const conn = connection;\n reset();\n conn?.unsubscribe();\n };\n\n return operate<T, T>((source, subscriber) => {\n refCount++;\n if (!hasErrored && !hasCompleted) {\n cancelReset();\n }\n\n // Create the subject if we don't have one yet. Grab a local reference to\n // it as well, which avoids non-null assertions when using it and, if we\n // connect to it now, then error/complete need a reference after it was\n // reset.\n const dest = (subject = subject ?? connector());\n\n // Add the finalization directly to the subscriber - instead of returning it -\n // so that the handling of the subscriber's unsubscription will be wired\n // up _before_ the subscription to the source occurs. This is done so that\n // the assignment to the source connection's `closed` property will be seen\n // by synchronous firehose sources.\n subscriber.add(() => {\n refCount--;\n\n // If we're resetting on refCount === 0, and it's 0, we only want to do\n // that on \"unsubscribe\", really. Resetting on error or completion is a different\n // configuration.\n if (refCount === 0 && !hasErrored && !hasCompleted) {\n resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero);\n }\n });\n\n // The following line adds the subscription to the subscriber passed.\n // Basically, `subscriber === dest.subscribe(subscriber)` is `true`.\n dest.subscribe(subscriber);\n\n if (\n !connection &&\n // Check this shareReplay is still activate - it can be reset to 0\n // and be \"unsubscribed\" _before_ it actually subscribes.\n // If we were to subscribe then, it'd leak and get stuck.\n refCount > 0\n ) {\n // We need to create a subscriber here - rather than pass an observer and\n // assign the returned subscription to connection - because it's possible\n // for reentrant subscriptions to the shared observable to occur and in\n // those situations we want connection to be already-assigned so that we\n // don't create another connection to the source.\n connection = new SafeSubscriber({\n next: (value) => dest.next(value),\n error: (err) => {\n hasErrored = true;\n cancelReset();\n resetConnection = handleReset(reset, resetOnError, err);\n dest.error(err);\n },\n complete: () => {\n hasCompleted = true;\n cancelReset();\n resetConnection = handleReset(reset, resetOnComplete);\n dest.complete();\n },\n });\n innerFrom(source).subscribe(connection);\n }\n })(wrapperSource);\n };\n}\n\nfunction handleReset<T extends unknown[] = never[]>(\n reset: () => void,\n on: boolean | ((...args: T) => ObservableInput<any>),\n ...args: T\n): Subscription | undefined {\n if (on === true) {\n reset();\n return;\n }\n\n if (on === false) {\n return;\n }\n\n const onSubscriber = new SafeSubscriber({\n next: () => {\n onSubscriber.unsubscribe();\n reset();\n },\n });\n\n return innerFrom(on(...args)).subscribe(onSubscriber);\n}\n", "import { ReplaySubject } from '../ReplaySubject';\nimport { MonoTypeOperatorFunction, SchedulerLike } from '../types';\nimport { share } from './share';\n\nexport interface ShareReplayConfig {\n bufferSize?: number;\n windowTime?: number;\n refCount: boolean;\n scheduler?: SchedulerLike;\n}\n\nexport function shareReplay<T>(config: ShareReplayConfig): MonoTypeOperatorFunction<T>;\nexport function shareReplay<T>(bufferSize?: number, windowTime?: number, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;\n\n/**\n * Share source and replay specified number of emissions on subscription.\n *\n * This operator is a specialization of `replay` that connects to a source observable\n * and multicasts through a `ReplaySubject` constructed with the specified arguments.\n * A successfully completed source will stay cached in the `shareReplay`ed observable forever,\n * but an errored source can be retried.\n *\n * ## Why use `shareReplay`?\n *\n * You generally want to use `shareReplay` when you have side-effects or taxing computations\n * that you do not wish to be executed amongst multiple subscribers.\n * It may also be valuable in situations where you know you will have late subscribers to\n * a stream that need access to previously emitted values.\n * This ability to replay values on subscription is what differentiates {@link share} and `shareReplay`.\n *\n * ## Reference counting\n *\n * By default `shareReplay` will use `refCount` of false, meaning that it will _not_ unsubscribe the\n * source when the reference counter drops to zero, i.e. the inner `ReplaySubject` will _not_ be unsubscribed\n * (and potentially run for ever).\n * This is the default as it is expected that `shareReplay` is often used to keep around expensive to setup\n * observables which we want to keep running instead of having to do the expensive setup again.\n *\n * As of RXJS version 6.4.0 a new overload signature was added to allow for manual control over what\n * happens when the operators internal reference counter drops to zero.\n * If `refCount` is true, the source will be unsubscribed from once the reference count drops to zero, i.e.\n * the inner `ReplaySubject` will be unsubscribed. All new subscribers will receive value emissions from a\n * new `ReplaySubject` which in turn will cause a new subscription to the source observable.\n *\n * ## Examples\n *\n * Example with a third subscriber coming late to the party\n *\n * ```ts\n * import { interval, take, shareReplay } from 'rxjs';\n *\n * const shared$ = interval(2000).pipe(\n * take(6),\n * shareReplay(3)\n * );\n *\n * shared$.subscribe(x => console.log('sub A: ', x));\n * shared$.subscribe(y => console.log('sub B: ', y));\n *\n * setTimeout(() => {\n * shared$.subscribe(y => console.log('sub C: ', y));\n * }, 11000);\n *\n * // Logs:\n * // (after ~2000 ms)\n * // sub A: 0\n * // sub B: 0\n * // (after ~4000 ms)\n * // sub A: 1\n * // sub B: 1\n * // (after ~6000 ms)\n * // sub A: 2\n * // sub B: 2\n * // (after ~8000 ms)\n * // sub A: 3\n * // sub B: 3\n * // (after ~10000 ms)\n * // sub A: 4\n * // sub B: 4\n * // (after ~11000 ms, sub C gets the last 3 values)\n * // sub C: 2\n * // sub C: 3\n * // sub C: 4\n * // (after ~12000 ms)\n * // sub A: 5\n * // sub B: 5\n * // sub C: 5\n * ```\n *\n * Example for `refCount` usage\n *\n * ```ts\n * import { Observable, tap, interval, shareReplay, take } from 'rxjs';\n *\n * const log = <T>(name: string, source: Observable<T>) => source.pipe(\n * tap({\n * subscribe: () => console.log(`${ name }: subscribed`),\n * next: value => console.log(`${ name }: ${ value }`),\n * complete: () => console.log(`${ name }: completed`),\n * finalize: () => console.log(`${ name }: unsubscribed`)\n * })\n * );\n *\n * const obs$ = log('source', interval(1000));\n *\n * const shared$ = log('shared', obs$.pipe(\n * shareReplay({ bufferSize: 1, refCount: true }),\n * take(2)\n * ));\n *\n * shared$.subscribe(x => console.log('sub A: ', x));\n * shared$.subscribe(y => console.log('sub B: ', y));\n *\n * // PRINTS:\n * // shared: subscribed <-- reference count = 1\n * // source: subscribed\n * // shared: subscribed <-- reference count = 2\n * // source: 0\n * // shared: 0\n * // sub A: 0\n * // shared: 0\n * // sub B: 0\n * // source: 1\n * // shared: 1\n * // sub A: 1\n * // shared: completed <-- take(2) completes the subscription for sub A\n * // shared: unsubscribed <-- reference count = 1\n * // shared: 1\n * // sub B: 1\n * // shared: completed <-- take(2) completes the subscription for sub B\n * // shared: unsubscribed <-- reference count = 0\n * // source: unsubscribed <-- replaySubject unsubscribes from source observable because the reference count dropped to 0 and refCount is true\n *\n * // In case of refCount being false, the unsubscribe is never called on the source and the source would keep on emitting, even if no subscribers\n * // are listening.\n * // source: 2\n * // source: 3\n * // source: 4\n * // ...\n * ```\n *\n * @see {@link publish}\n * @see {@link share}\n * @see {@link publishReplay}\n *\n * @param configOrBufferSize Maximum element count of the replay buffer or {@link ShareReplayConfig configuration}\n * object.\n * @param windowTime Maximum time length of the replay buffer in milliseconds.\n * @param scheduler Scheduler where connected observers within the selector function\n * will be invoked on.\n * @return A function that returns an Observable sequence that contains the\n * elements of a sequence produced by multicasting the source sequence within a\n * selector function.\n */\nexport function shareReplay<T>(\n configOrBufferSize?: ShareReplayConfig | number,\n windowTime?: number,\n scheduler?: SchedulerLike\n): MonoTypeOperatorFunction<T> {\n let bufferSize: number;\n let refCount = false;\n if (configOrBufferSize && typeof configOrBufferSize === 'object') {\n ({ bufferSize = Infinity, windowTime = Infinity, refCount = false, scheduler } = configOrBufferSize);\n } else {\n bufferSize = (configOrBufferSize ?? Infinity) as number;\n }\n return share<T>({\n connector: () => new ReplaySubject(bufferSize, windowTime, scheduler),\n resetOnError: true,\n resetOnComplete: false,\n resetOnRefCountZero: refCount,\n });\n}\n", "import { Observable } from '../Observable';\nimport { EmptyError } from '../util/EmptyError';\n\nimport { MonoTypeOperatorFunction, OperatorFunction, TruthyTypesOf } from '../types';\nimport { SequenceError } from '../util/SequenceError';\nimport { NotFoundError } from '../util/NotFoundError';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\nexport function single<T>(predicate: BooleanConstructor): OperatorFunction<T, TruthyTypesOf<T>>;\nexport function single<T>(predicate?: (value: T, index: number, source: Observable<T>) => boolean): MonoTypeOperatorFunction<T>;\n\n/**\n * Returns an observable that asserts that only one value is\n * emitted from the observable that matches the predicate. If no\n * predicate is provided, then it will assert that the observable\n * only emits one value.\n *\n * If the source Observable did not emit `next` before completion, it\n * will emit an {@link EmptyError} to the Observer's `error` callback.\n *\n * In the event that two values are found that match the predicate,\n * or when there are two values emitted and no predicate, it will\n * emit a {@link SequenceError} to the Observer's `error` callback.\n *\n * In the event that no values match the predicate, if one is provided,\n * it will emit a {@link NotFoundError} to the Observer's `error` callback.\n *\n * ## Example\n *\n * Expect only `name` beginning with `'B'`\n *\n * ```ts\n * import { of, single } from 'rxjs';\n *\n * const source1 = of(\n * { name: 'Ben' },\n * { name: 'Tracy' },\n * { name: 'Laney' },\n * { name: 'Lily' }\n * );\n *\n * source1\n * .pipe(single(x => x.name.startsWith('B')))\n * .subscribe(x => console.log(x));\n * // Emits 'Ben'\n *\n *\n * const source2 = of(\n * { name: 'Ben' },\n * { name: 'Tracy' },\n * { name: 'Bradley' },\n * { name: 'Lincoln' }\n * );\n *\n * source2\n * .pipe(single(x => x.name.startsWith('B')))\n * .subscribe({ error: err => console.error(err) });\n * // Error emitted: SequenceError('Too many values match')\n *\n *\n * const source3 = of(\n * { name: 'Laney' },\n * { name: 'Tracy' },\n * { name: 'Lily' },\n * { name: 'Lincoln' }\n * );\n *\n * source3\n * .pipe(single(x => x.name.startsWith('B')))\n * .subscribe({ error: err => console.error(err) });\n * // Error emitted: NotFoundError('No values match')\n * ```\n *\n * @see {@link first}\n * @see {@link find}\n * @see {@link findIndex}\n * @see {@link elementAt}\n *\n * @throws {NotFoundError} Delivers a `NotFoundError` to the Observer's `error`\n * callback if the Observable completes before any `next` notification was sent.\n * @throws {SequenceError} Delivers a `SequenceError` if more than one value is\n * emitted that matches the provided predicate. If no predicate is provided, it\n * will deliver a `SequenceError` if more than one value comes from the source.\n * @throws {EmptyError} Delivers an `EmptyError` if no values were `next`ed prior\n * to completion.\n *\n * @param predicate A predicate function to evaluate items emitted by the source\n * Observable.\n * @return A function that returns an Observable that emits the single item\n * emitted by the source Observable that matches the predicate.\n */\nexport function single<T>(predicate?: (value: T, index: number, source: Observable<T>) => boolean): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n let hasValue = false;\n let singleValue: T;\n let seenValue = false;\n let index = 0;\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => {\n seenValue = true;\n if (!predicate || predicate(value, index++, source)) {\n hasValue && subscriber.error(new SequenceError('Too many matching values'));\n hasValue = true;\n singleValue = value;\n }\n },\n () => {\n if (hasValue) {\n subscriber.next(singleValue);\n subscriber.complete();\n } else {\n subscriber.error(seenValue ? new NotFoundError('No matching values') : new EmptyError());\n }\n }\n )\n );\n });\n}\n", "import { MonoTypeOperatorFunction } from '../types';\nimport { filter } from './filter';\n\n/**\n * Returns an Observable that skips the first `count` items emitted by the source Observable.\n *\n * ![](skip.png)\n *\n * Skips the values until the sent notifications are equal or less than provided skip count. It raises\n * an error if skip count is equal or more than the actual number of emits and source raises an error.\n *\n * ## Example\n *\n * Skip the values before the emission\n *\n * ```ts\n * import { interval, skip } from 'rxjs';\n *\n * // emit every half second\n * const source = interval(500);\n * // skip the first 10 emitted values\n * const result = source.pipe(skip(10));\n *\n * result.subscribe(value => console.log(value));\n * // output: 10...11...12...13...\n * ```\n *\n * @see {@link last}\n * @see {@link skipWhile}\n * @see {@link skipUntil}\n * @see {@link skipLast}\n *\n * @param count The number of times, items emitted by source Observable should be skipped.\n * @return A function that returns an Observable that skips the first `count`\n * values emitted by the source Observable.\n */\nexport function skip<T>(count: number): MonoTypeOperatorFunction<T> {\n return filter((_, index) => count <= index);\n}\n", "import { MonoTypeOperatorFunction } from '../types';\nimport { identity } from '../util/identity';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Skip a specified number of values before the completion of an observable.\n *\n * ![](skipLast.png)\n *\n * Returns an observable that will emit values as soon as it can, given a number of\n * skipped values. For example, if you `skipLast(3)` on a source, when the source\n * emits its fourth value, the first value the source emitted will finally be emitted\n * from the returned observable, as it is no longer part of what needs to be skipped.\n *\n * All values emitted by the result of `skipLast(N)` will be delayed by `N` emissions,\n * as each value is held in a buffer until enough values have been emitted that that\n * the buffered value may finally be sent to the consumer.\n *\n * After subscribing, unsubscribing will not result in the emission of the buffered\n * skipped values.\n *\n * ## Example\n *\n * Skip the last 2 values of an observable with many values\n *\n * ```ts\n * import { of, skipLast } from 'rxjs';\n *\n * const numbers = of(1, 2, 3, 4, 5);\n * const skipLastTwo = numbers.pipe(skipLast(2));\n * skipLastTwo.subscribe(x => console.log(x));\n *\n * // Results in:\n * // 1 2 3\n * // (4 and 5 are skipped)\n * ```\n *\n * @see {@link skip}\n * @see {@link skipUntil}\n * @see {@link skipWhile}\n * @see {@link take}\n *\n * @param skipCount Number of elements to skip from the end of the source Observable.\n * @return A function that returns an Observable that skips the last `count`\n * values emitted by the source Observable.\n */\nexport function skipLast<T>(skipCount: number): MonoTypeOperatorFunction<T> {\n return skipCount <= 0\n ? // For skipCounts less than or equal to zero, we are just mirroring the source.\n identity\n : operate((source, subscriber) => {\n // A ring buffer to hold the values while we wait to see\n // if we can emit it or it's part of the \"skipped\" last values.\n // Note that it is the _same size_ as the skip count.\n let ring: T[] = new Array(skipCount);\n // The number of values seen so far. This is used to get\n // the index of the current value when it arrives.\n let seen = 0;\n source.subscribe(\n createOperatorSubscriber(subscriber, (value) => {\n // Get the index of the value we have right now\n // relative to all other values we've seen, then\n // increment `seen`. This ensures we've moved to\n // the next slot in our ring buffer.\n const valueIndex = seen++;\n if (valueIndex < skipCount) {\n // If we haven't seen enough values to fill our buffer yet,\n // Then we aren't to a number of seen values where we can\n // emit anything, so let's just start by filling the ring buffer.\n ring[valueIndex] = value;\n } else {\n // We are traversing over the ring array in such\n // a way that when we get to the end, we loop back\n // and go to the start.\n const index = valueIndex % skipCount;\n // Pull the oldest value out so we can emit it,\n // and stuff the new value in it's place.\n const oldValue = ring[index];\n ring[index] = value;\n // Emit the old value. It is important that this happens\n // after we swap the value in the buffer, if it happens\n // before we swap the value in the buffer, then a synchronous\n // source can get the buffer out of whack.\n subscriber.next(oldValue);\n }\n })\n );\n\n return () => {\n // Release our values in memory\n ring = null!;\n };\n });\n}\n", "import { MonoTypeOperatorFunction, ObservableInput } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\nimport { noop } from '../util/noop';\n\n/**\n * Returns an Observable that skips items emitted by the source Observable until a second Observable emits an item.\n *\n * The `skipUntil` operator causes the observable stream to skip the emission of values until the passed in observable\n * emits the first value. This can be particularly useful in combination with user interactions, responses of HTTP\n * requests or waiting for specific times to pass by.\n *\n * ![](skipUntil.png)\n *\n * Internally, the `skipUntil` operator subscribes to the passed in `notifier` `ObservableInput` (which gets converted\n * to an Observable) in order to recognize the emission of its first value. When `notifier` emits next, the operator\n * unsubscribes from it and starts emitting the values of the *source* observable until it completes or errors. It\n * will never let the *source* observable emit any values if the `notifier` completes or throws an error without\n * emitting a value before.\n *\n * ## Example\n *\n * In the following example, all emitted values of the interval observable are skipped until the user clicks anywhere\n * within the page\n *\n * ```ts\n * import { interval, fromEvent, skipUntil } from 'rxjs';\n *\n * const intervalObservable = interval(1000);\n * const click = fromEvent(document, 'click');\n *\n * const emitAfterClick = intervalObservable.pipe(\n * skipUntil(click)\n * );\n * // clicked at 4.6s. output: 5...6...7...8........ or\n * // clicked at 7.3s. output: 8...9...10..11.......\n * emitAfterClick.subscribe(value => console.log(value));\n * ```\n *\n * @see {@link last}\n * @see {@link skip}\n * @see {@link skipWhile}\n * @see {@link skipLast}\n *\n * @param notifier An `ObservableInput` that has to emit an item before the source Observable elements begin to\n * be mirrored by the resulting Observable.\n * @return A function that returns an Observable that skips items from the\n * source Observable until the `notifier` Observable emits an item, then emits the\n * remaining items.\n */\nexport function skipUntil<T>(notifier: ObservableInput<any>): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n let taking = false;\n\n const skipSubscriber = createOperatorSubscriber(\n subscriber,\n () => {\n skipSubscriber?.unsubscribe();\n taking = true;\n },\n noop\n );\n\n innerFrom(notifier).subscribe(skipSubscriber);\n\n source.subscribe(createOperatorSubscriber(subscriber, (value) => taking && subscriber.next(value)));\n });\n}\n", "import { Falsy, MonoTypeOperatorFunction, OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\nexport function skipWhile<T>(predicate: BooleanConstructor): OperatorFunction<T, Extract<T, Falsy> extends never ? never : T>;\nexport function skipWhile<T>(predicate: (value: T, index: number) => true): OperatorFunction<T, never>;\nexport function skipWhile<T>(predicate: (value: T, index: number) => boolean): MonoTypeOperatorFunction<T>;\n\n/**\n * Returns an Observable that skips all items emitted by the source Observable as long as a specified condition holds\n * true, but emits all further source items as soon as the condition becomes false.\n *\n * ![](skipWhile.png)\n *\n * Skips all the notifications with a truthy predicate. It will not skip the notifications when the predicate is falsy.\n * It can also be skipped using index. Once the predicate is true, it will not be called again.\n *\n * ## Example\n *\n * Skip some super heroes\n *\n * ```ts\n * import { from, skipWhile } from 'rxjs';\n *\n * const source = from(['Green Arrow', 'SuperMan', 'Flash', 'SuperGirl', 'Black Canary'])\n * // Skip the heroes until SuperGirl\n * const example = source.pipe(skipWhile(hero => hero !== 'SuperGirl'));\n * // output: SuperGirl, Black Canary\n * example.subscribe(femaleHero => console.log(femaleHero));\n * ```\n *\n * Skip values from the array until index 5\n *\n * ```ts\n * import { from, skipWhile } from 'rxjs';\n *\n * const source = from([1, 2, 3, 4, 5, 6, 7, 9, 10]);\n * const example = source.pipe(skipWhile((_, i) => i !== 5));\n * // output: 6, 7, 9, 10\n * example.subscribe(value => console.log(value));\n * ```\n *\n * @see {@link last}\n * @see {@link skip}\n * @see {@link skipUntil}\n * @see {@link skipLast}\n *\n * @param predicate A function to test each item emitted from the source Observable.\n * @return A function that returns an Observable that begins emitting items\n * emitted by the source Observable when the specified predicate becomes false.\n */\nexport function skipWhile<T>(predicate: (value: T, index: number) => boolean): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n let taking = false;\n let index = 0;\n source.subscribe(\n createOperatorSubscriber(subscriber, (value) => (taking || (taking = !predicate(value, index++))) && subscriber.next(value))\n );\n });\n}\n", "import { concat } from '../observable/concat';\nimport { OperatorFunction, SchedulerLike, ValueFromArray } from '../types';\nimport { popScheduler } from '../util/args';\nimport { operate } from '../util/lift';\n\n// Devs are more likely to pass null or undefined than they are a scheduler\n// without accompanying values. To make things easier for (naughty) devs who\n// use the `strictNullChecks: false` TypeScript compiler option, these\n// overloads with explicit null and undefined values are included.\n\nexport function startWith<T>(value: null): OperatorFunction<T, T | null>;\nexport function startWith<T>(value: undefined): OperatorFunction<T, T | undefined>;\n\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `concatAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function startWith<T, A extends readonly unknown[] = T[]>(\n ...valuesAndScheduler: [...A, SchedulerLike]\n): OperatorFunction<T, T | ValueFromArray<A>>;\nexport function startWith<T, A extends readonly unknown[] = T[]>(...values: A): OperatorFunction<T, T | ValueFromArray<A>>;\n\n/**\n * Returns an observable that, at the moment of subscription, will synchronously emit all\n * values provided to this operator, then subscribe to the source and mirror all of its emissions\n * to subscribers.\n *\n * This is a useful way to know when subscription has occurred on an existing observable.\n *\n * <span class=\"informal\">First emits its arguments in order, and then any\n * emissions from the source.</span>\n *\n * ![](startWith.png)\n *\n * ## Examples\n *\n * Emit a value when a timer starts.\n *\n * ```ts\n * import { timer, map, startWith } from 'rxjs';\n *\n * timer(1000)\n * .pipe(\n * map(() => 'timer emit'),\n * startWith('timer start')\n * )\n * .subscribe(x => console.log(x));\n *\n * // results:\n * // 'timer start'\n * // 'timer emit'\n * ```\n *\n * @param values Items you want the modified Observable to emit first.\n * @return A function that returns an Observable that synchronously emits\n * provided values before subscribing to the source Observable.\n *\n * @see {@link endWith}\n * @see {@link finalize}\n * @see {@link concat}\n */\nexport function startWith<T, D>(...values: D[]): OperatorFunction<T, T | D> {\n const scheduler = popScheduler(values);\n return operate((source, subscriber) => {\n // Here we can't pass `undefined` as a scheduler, because if we did, the\n // code inside of `concat` would be confused by the `undefined`, and treat it\n // like an invalid observable. So we have to split it two different ways.\n (scheduler ? concat(values, source, scheduler) : concat(values, source)).subscribe(subscriber);\n });\n}\n", "import { Subscriber } from '../Subscriber';\nimport { ObservableInput, OperatorFunction, ObservedValueOf } from '../types';\nimport { innerFrom } from '../observable/innerFrom';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/* tslint:disable:max-line-length */\nexport function switchMap<T, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O\n): OperatorFunction<T, ObservedValueOf<O>>;\n/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */\nexport function switchMap<T, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector: undefined\n): OperatorFunction<T, ObservedValueOf<O>>;\n/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */\nexport function switchMap<T, R, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R\n): OperatorFunction<T, R>;\n/* tslint:enable:max-line-length */\n\n/**\n * Projects each source value to an Observable which is merged in the output\n * Observable, emitting values only from the most recently projected Observable.\n *\n * <span class=\"informal\">Maps each value to an Observable, then flattens all of\n * these inner Observables using {@link switchAll}.</span>\n *\n * ![](switchMap.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 (so-called \"inner\") Observable. Each time it observes one of these\n * inner Observables, the output Observable begins emitting the items emitted by\n * that inner Observable. When a new inner Observable is emitted, `switchMap`\n * stops emitting items from the earlier-emitted inner Observable and begins\n * emitting items from the new one. It continues to behave like this for\n * subsequent inner Observables.\n *\n * ## Example\n *\n * Generate new Observable according to source Observable values\n *\n * ```ts\n * import { of, switchMap } from 'rxjs';\n *\n * const switched = of(1, 2, 3).pipe(switchMap(x => of(x, x ** 2, x ** 3)));\n * switched.subscribe(x => console.log(x));\n * // outputs\n * // 1\n * // 1\n * // 1\n * // 2\n * // 4\n * // 8\n * // 3\n * // 9\n * // 27\n * ```\n *\n * Restart an interval Observable on every click event\n *\n * ```ts\n * import { fromEvent, switchMap, interval } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(switchMap(() => interval(1000)));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link concatMap}\n * @see {@link exhaustMap}\n * @see {@link mergeMap}\n * @see {@link switchAll}\n * @see {@link switchMapTo}\n *\n * @param project A function that, when applied to an item emitted by the source\n * Observable, returns an Observable.\n * @return A function that returns an Observable that emits the result of\n * applying the projection function (and the optional deprecated\n * `resultSelector`) to each item emitted by the source Observable and taking\n * only the values from the most recently projected inner Observable.\n */\nexport function switchMap<T, R, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector?: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R\n): OperatorFunction<T, ObservedValueOf<O> | R> {\n return operate((source, subscriber) => {\n let innerSubscriber: Subscriber<ObservedValueOf<O>> | null = null;\n let index = 0;\n // Whether or not the source subscription has completed\n let isComplete = false;\n\n // We only complete the result if the source is complete AND we don't have an active inner subscription.\n // This is called both when the source completes and when the inners complete.\n const checkComplete = () => isComplete && !innerSubscriber && subscriber.complete();\n\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => {\n // Cancel the previous inner subscription if there was one\n innerSubscriber?.unsubscribe();\n let innerIndex = 0;\n const outerIndex = index++;\n // Start the next inner subscription\n innerFrom(project(value, outerIndex)).subscribe(\n (innerSubscriber = createOperatorSubscriber(\n subscriber,\n // When we get a new inner value, next it through. Note that this is\n // handling the deprecate result selector here. This is because with this architecture\n // it ends up being smaller than using the map operator.\n (innerValue) => subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue),\n () => {\n // The inner has completed. Null out the inner subscriber to\n // free up memory and to signal that we have no inner subscription\n // currently.\n innerSubscriber = null!;\n checkComplete();\n }\n ))\n );\n },\n () => {\n isComplete = true;\n checkComplete();\n }\n )\n );\n });\n}\n", "import { OperatorFunction, ObservableInput, ObservedValueOf } from '../types';\nimport { switchMap } from './switchMap';\nimport { identity } from '../util/identity';\n\n/**\n * Converts a higher-order Observable into a first-order Observable\n * producing values only from the most recent observable sequence\n *\n * <span class=\"informal\">Flattens an Observable-of-Observables.</span>\n *\n * ![](switchAll.png)\n *\n * `switchAll` subscribes to a source that is an observable of observables, also known as a\n * \"higher-order observable\" (or `Observable<Observable<T>>`). It subscribes to the most recently\n * provided \"inner observable\" emitted by the source, unsubscribing from any previously subscribed\n * to inner observable, such that only the most recent inner observable may be subscribed to at\n * any point in time. The resulting observable returned by `switchAll` will only complete if the\n * source observable completes, *and* any currently subscribed to inner observable also has completed,\n * if there are any.\n *\n * ## Examples\n *\n * Spawn a new interval observable for each click event, but for every new\n * click, cancel the previous interval and subscribe to the new one\n *\n * ```ts\n * import { fromEvent, tap, map, interval, switchAll } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click').pipe(tap(() => console.log('click')));\n * const source = clicks.pipe(map(() => interval(1000)));\n *\n * source\n * .pipe(switchAll())\n * .subscribe(x => console.log(x));\n *\n * // Output\n * // click\n * // 0\n * // 1\n * // 2\n * // 3\n * // ...\n * // click\n * // 0\n * // 1\n * // 2\n * // ...\n * // click\n * // ...\n * ```\n *\n * @see {@link combineLatestAll}\n * @see {@link concatAll}\n * @see {@link exhaustAll}\n * @see {@link switchMap}\n * @see {@link switchMapTo}\n * @see {@link mergeAll}\n *\n * @return A function that returns an Observable that converts a higher-order\n * Observable into a first-order Observable producing values only from the most\n * recent Observable sequence.\n */\nexport function switchAll<O extends ObservableInput<any>>(): OperatorFunction<O, ObservedValueOf<O>> {\n return switchMap(identity);\n}\n", "import { switchMap } from './switchMap';\nimport { ObservableInput, OperatorFunction, ObservedValueOf } from '../types';\nimport { isFunction } from '../util/isFunction';\n\n/** @deprecated Will be removed in v9. Use {@link switchMap} instead: `switchMap(() => result)` */\nexport function switchMapTo<O extends ObservableInput<unknown>>(observable: O): OperatorFunction<unknown, ObservedValueOf<O>>;\n/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */\nexport function switchMapTo<O extends ObservableInput<unknown>>(\n observable: O,\n resultSelector: undefined\n): OperatorFunction<unknown, ObservedValueOf<O>>;\n/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */\nexport function switchMapTo<T, R, O extends ObservableInput<unknown>>(\n observable: O,\n resultSelector: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R\n): OperatorFunction<T, R>;\n\n/**\n * Projects each source value to the same Observable which is flattened multiple\n * times with {@link switchMap} in the output Observable.\n *\n * <span class=\"informal\">It's like {@link switchMap}, but maps each value\n * always to the same inner Observable.</span>\n *\n * ![](switchMapTo.png)\n *\n * Maps each source value to the given Observable `innerObservable` regardless\n * of the source value, and then flattens those resulting Observables into one\n * single Observable, which is the output Observable. The output Observables\n * emits values only from the most recently emitted instance of\n * `innerObservable`.\n *\n * ## Example\n *\n * Restart an interval Observable on every click event\n *\n * ```ts\n * import { fromEvent, switchMapTo, interval } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(switchMapTo(interval(1000)));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link concatMapTo}\n * @see {@link switchAll}\n * @see {@link switchMap}\n * @see {@link mergeMapTo}\n *\n * @param innerObservable An `ObservableInput` to replace each value from the\n * source Observable.\n * @return A function that returns an Observable that emits items from the\n * given `innerObservable` (and optionally transformed through the deprecated\n * `resultSelector`) every time a value is emitted on the source Observable,\n * and taking only the values from the most recently projected inner\n * Observable.\n * @deprecated Will be removed in v9. Use {@link switchMap} instead: `switchMap(() => result)`\n */\nexport function switchMapTo<T, R, O extends ObservableInput<unknown>>(\n innerObservable: O,\n resultSelector?: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R\n): OperatorFunction<T, ObservedValueOf<O> | R> {\n return isFunction(resultSelector) ? switchMap(() => innerObservable, resultSelector) : switchMap(() => innerObservable);\n}\n", "import { ObservableInput, ObservedValueOf, OperatorFunction } from '../types';\nimport { switchMap } from './switchMap';\nimport { operate } from '../util/lift';\n\n// TODO: Generate a marble diagram for these docs.\n\n/**\n * Applies an accumulator function over the source Observable where the\n * accumulator function itself returns an Observable, emitting values\n * only from the most recently returned Observable.\n *\n * <span class=\"informal\">It's like {@link mergeScan}, but only the most recent\n * Observable returned by the accumulator is merged into the outer Observable.</span>\n *\n * @see {@link scan}\n * @see {@link mergeScan}\n * @see {@link switchMap}\n *\n * @param accumulator\n * The accumulator function called on each source value.\n * @param seed The initial accumulation value.\n * @return A function that returns an observable of the accumulated values.\n */\nexport function switchScan<T, R, O extends ObservableInput<any>>(\n accumulator: (acc: R, value: T, index: number) => O,\n seed: R\n): OperatorFunction<T, ObservedValueOf<O>> {\n return operate((source, subscriber) => {\n // The state we will keep up to date to pass into our\n // accumulator function at each new value from the source.\n let state = seed;\n\n // Use `switchMap` on our `source` to do the work of creating\n // this operator. Note the backwards order here of `switchMap()(source)`\n // to avoid needing to use `pipe` unnecessarily\n switchMap(\n // On each value from the source, call the accumulator with\n // our previous state, the value and the index.\n (value: T, index) => accumulator(state, value, index),\n // Using the deprecated result selector here as a dirty trick\n // to update our state with the flattened value.\n (_, innerValue) => ((state = innerValue), innerValue)\n )(source).subscribe(subscriber);\n\n return () => {\n // Release state on finalization\n state = null!;\n };\n });\n}\n", "import { MonoTypeOperatorFunction, ObservableInput } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\nimport { noop } from '../util/noop';\n\n/**\n * Emits the values emitted by the source Observable until a `notifier`\n * Observable emits a value.\n *\n * <span class=\"informal\">Lets values pass until a second Observable,\n * `notifier`, emits a value. Then, it completes.</span>\n *\n * ![](takeUntil.png)\n *\n * `takeUntil` subscribes and begins mirroring the source Observable. It also\n * monitors a second Observable, `notifier` that you provide. If the `notifier`\n * emits a value, the output Observable stops mirroring the source Observable\n * and completes. If the `notifier` doesn't emit any value and completes\n * then `takeUntil` will pass all values.\n *\n * ## Example\n *\n * Tick every second until the first click happens\n *\n * ```ts\n * import { interval, fromEvent, takeUntil } from 'rxjs';\n *\n * const source = interval(1000);\n * const clicks = fromEvent(document, 'click');\n * const result = source.pipe(takeUntil(clicks));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link take}\n * @see {@link takeLast}\n * @see {@link takeWhile}\n * @see {@link skip}\n *\n * @param notifier The `ObservableInput` whose first emitted value will cause the output\n * Observable of `takeUntil` to stop emitting values from the source Observable.\n * @return A function that returns an Observable that emits the values from the\n * source Observable until `notifier` emits its first value.\n */\nexport function takeUntil<T>(notifier: ObservableInput<any>): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n innerFrom(notifier).subscribe(createOperatorSubscriber(subscriber, () => subscriber.complete(), noop));\n !subscriber.closed && source.subscribe(subscriber);\n });\n}\n", "import { OperatorFunction, MonoTypeOperatorFunction, TruthyTypesOf } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\nexport function takeWhile<T>(predicate: BooleanConstructor, inclusive: true): MonoTypeOperatorFunction<T>;\nexport function takeWhile<T>(predicate: BooleanConstructor, inclusive: false): OperatorFunction<T, TruthyTypesOf<T>>;\nexport function takeWhile<T>(predicate: BooleanConstructor): OperatorFunction<T, TruthyTypesOf<T>>;\nexport function takeWhile<T, S extends T>(predicate: (value: T, index: number) => value is S): OperatorFunction<T, S>;\nexport function takeWhile<T, S extends T>(predicate: (value: T, index: number) => value is S, inclusive: false): OperatorFunction<T, S>;\nexport function takeWhile<T>(predicate: (value: T, index: number) => boolean, inclusive?: boolean): MonoTypeOperatorFunction<T>;\n\n/**\n * Emits values emitted by the source Observable so long as each value satisfies\n * the given `predicate`, and then completes as soon as this `predicate` is not\n * satisfied.\n *\n * <span class=\"informal\">Takes values from the source only while they pass the\n * condition given. When the first value does not satisfy, it completes.</span>\n *\n * ![](takeWhile.png)\n *\n * `takeWhile` subscribes and begins mirroring the source Observable. Each value\n * emitted on the source is given to the `predicate` function which returns a\n * boolean, representing a condition to be satisfied by the source values. The\n * output Observable emits the source values until such time as the `predicate`\n * returns false, at which point `takeWhile` stops mirroring the source\n * Observable and completes the output Observable.\n *\n * ## Example\n *\n * Emit click events only while the clientX property is greater than 200\n *\n * ```ts\n * import { fromEvent, takeWhile } from 'rxjs';\n *\n * const clicks = fromEvent<PointerEvent>(document, 'click');\n * const result = clicks.pipe(takeWhile(ev => ev.clientX > 200));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link take}\n * @see {@link takeLast}\n * @see {@link takeUntil}\n * @see {@link skip}\n *\n * @param predicate A function that evaluates a value emitted by the source\n * Observable and returns a boolean. Also takes the (zero-based) index as the\n * second argument.\n * @param inclusive When set to `true` the value that caused `predicate` to\n * return `false` will also be emitted.\n * @return A function that returns an Observable that emits values from the\n * source Observable so long as each value satisfies the condition defined by\n * the `predicate`, then completes.\n */\nexport function takeWhile<T>(predicate: (value: T, index: number) => boolean, inclusive = false): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n let index = 0;\n source.subscribe(\n createOperatorSubscriber(subscriber, (value) => {\n const result = predicate(value, index++);\n (result || inclusive) && subscriber.next(value);\n !result && subscriber.complete();\n })\n );\n });\n}\n", "import { MonoTypeOperatorFunction, Observer } from '../types';\nimport { isFunction } from '../util/isFunction';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { identity } from '../util/identity';\n\n/**\n * An extension to the {@link Observer} interface used only by the {@link tap} operator.\n *\n * It provides a useful set of callbacks a user can register to do side-effects in\n * cases other than what the usual {@link Observer} callbacks are\n * ({@link guide/glossary-and-semantics#next next},\n * {@link guide/glossary-and-semantics#error error} and/or\n * {@link guide/glossary-and-semantics#complete complete}).\n *\n * ## Example\n *\n * ```ts\n * import { fromEvent, switchMap, tap, interval, take } from 'rxjs';\n *\n * const source$ = fromEvent(document, 'click');\n * const result$ = source$.pipe(\n * switchMap((_, i) => i % 2 === 0\n * ? fromEvent(document, 'mousemove').pipe(\n * tap({\n * subscribe: () => console.log('Subscribed to the mouse move events after click #' + i),\n * unsubscribe: () => console.log('Mouse move events #' + i + ' unsubscribed'),\n * finalize: () => console.log('Mouse move events #' + i + ' finalized')\n * })\n * )\n * : interval(1_000).pipe(\n * take(5),\n * tap({\n * subscribe: () => console.log('Subscribed to the 1-second interval events after click #' + i),\n * unsubscribe: () => console.log('1-second interval events #' + i + ' unsubscribed'),\n * finalize: () => console.log('1-second interval events #' + i + ' finalized')\n * })\n * )\n * )\n * );\n *\n * const subscription = result$.subscribe({\n * next: console.log\n * });\n *\n * setTimeout(() => {\n * console.log('Unsubscribe after 60 seconds');\n * subscription.unsubscribe();\n * }, 60_000);\n * ```\n */\nexport interface TapObserver<T> extends Observer<T> {\n /**\n * The callback that `tap` operator invokes at the moment when the source Observable\n * gets subscribed to.\n */\n subscribe: () => void;\n /**\n * The callback that `tap` operator invokes when an explicit\n * {@link guide/glossary-and-semantics#unsubscription unsubscribe} happens. It won't get invoked on\n * `error` or `complete` events.\n */\n unsubscribe: () => void;\n /**\n * The callback that `tap` operator invokes when any kind of\n * {@link guide/glossary-and-semantics#finalization finalization} happens - either when\n * the source Observable `error`s or `complete`s or when it gets explicitly unsubscribed\n * by the user. There is no difference in using this callback or the {@link finalize}\n * operator, but if you're already using `tap` operator, you can use this callback\n * instead. You'd get the same result in either case.\n */\n finalize: () => void;\n}\nexport function tap<T>(observerOrNext?: Partial<TapObserver<T>> | ((value: T) => void)): MonoTypeOperatorFunction<T>;\n/** @deprecated Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments */\nexport function tap<T>(\n next?: ((value: T) => void) | null,\n error?: ((error: any) => void) | null,\n complete?: (() => void) | null\n): MonoTypeOperatorFunction<T>;\n\n/**\n * Used to perform side-effects for notifications from the source observable\n *\n * <span class=\"informal\">Used when you want to affect outside state with a notification without altering the notification</span>\n *\n * ![](tap.png)\n *\n * Tap is designed to allow the developer a designated place to perform side effects. While you _could_ perform side-effects\n * inside of a `map` or a `mergeMap`, that would make their mapping functions impure, which isn't always a big deal, but will\n * make it so you can't do things like memoize those functions. The `tap` operator is designed solely for such side-effects to\n * help you remove side-effects from other operations.\n *\n * For any notification, next, error, or complete, `tap` will call the appropriate callback you have provided to it, via a function\n * reference, or a partial observer, then pass that notification down the stream.\n *\n * The observable returned by `tap` is an exact mirror of the source, with one exception: Any error that occurs -- synchronously -- in a handler\n * provided to `tap` will be emitted as an error from the returned observable.\n *\n * > Be careful! You can mutate objects as they pass through the `tap` operator's handlers.\n *\n * The most common use of `tap` is actually for debugging. You can place a `tap(console.log)` anywhere\n * in your observable `pipe`, log out the notifications as they are emitted by the source returned by the previous\n * operation.\n *\n * ## Examples\n *\n * Check a random number before it is handled. Below is an observable that will use a random number between 0 and 1,\n * and emit `'big'` or `'small'` depending on the size of that number. But we wanted to log what the original number\n * was, so we have added a `tap(console.log)`.\n *\n * ```ts\n * import { of, tap, map } from 'rxjs';\n *\n * of(Math.random()).pipe(\n * tap(console.log),\n * map(n => n > 0.5 ? 'big' : 'small')\n * ).subscribe(console.log);\n * ```\n *\n * Using `tap` to analyze a value and force an error. Below is an observable where in our system we only\n * want to emit numbers 3 or less we get from another source. We can force our observable to error\n * using `tap`.\n *\n * ```ts\n * import { of, tap } from 'rxjs';\n *\n * const source = of(1, 2, 3, 4, 5);\n *\n * source.pipe(\n * tap(n => {\n * if (n > 3) {\n * throw new TypeError(`Value ${ n } is greater than 3`);\n * }\n * })\n * )\n * .subscribe({ next: console.log, error: err => console.log(err.message) });\n * ```\n *\n * We want to know when an observable completes before moving on to the next observable. The system\n * below will emit a random series of `'X'` characters from 3 different observables in sequence. The\n * only way we know when one observable completes and moves to the next one, in this case, is because\n * we have added a `tap` with the side effect of logging to console.\n *\n * ```ts\n * import { of, concatMap, interval, take, map, tap } from 'rxjs';\n *\n * of(1, 2, 3).pipe(\n * concatMap(n => interval(1000).pipe(\n * take(Math.round(Math.random() * 10)),\n * map(() => 'X'),\n * tap({ complete: () => console.log(`Done with ${ n }`) })\n * ))\n * )\n * .subscribe(console.log);\n * ```\n *\n * @see {@link finalize}\n * @see {@link TapObserver}\n *\n * @param observerOrNext A next handler or partial observer\n * @param error An error handler\n * @param complete A completion handler\n * @return A function that returns an Observable identical to the source, but\n * runs the specified Observer or callback(s) for each item.\n */\nexport function tap<T>(\n observerOrNext?: Partial<TapObserver<T>> | ((value: T) => void) | null,\n error?: ((e: any) => void) | null,\n complete?: (() => void) | null\n): MonoTypeOperatorFunction<T> {\n // We have to check to see not only if next is a function,\n // but if error or complete were passed. This is because someone\n // could technically call tap like `tap(null, fn)` or `tap(null, null, fn)`.\n const tapObserver =\n isFunction(observerOrNext) || error || complete\n ? // tslint:disable-next-line: no-object-literal-type-assertion\n ({ next: observerOrNext as Exclude<typeof observerOrNext, Partial<TapObserver<T>>>, error, complete } as Partial<TapObserver<T>>)\n : observerOrNext;\n\n return tapObserver\n ? operate((source, subscriber) => {\n tapObserver.subscribe?.();\n let isUnsub = true;\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => {\n tapObserver.next?.(value);\n subscriber.next(value);\n },\n () => {\n isUnsub = false;\n tapObserver.complete?.();\n subscriber.complete();\n },\n (err) => {\n isUnsub = false;\n tapObserver.error?.(err);\n subscriber.error(err);\n },\n () => {\n if (isUnsub) {\n tapObserver.unsubscribe?.();\n }\n tapObserver.finalize?.();\n }\n )\n );\n })\n : // Tap was called with no valid tap observer or handler\n // (e.g. `tap(null, null, null)` or `tap(null)` or `tap()`)\n // so we're going to just mirror the source.\n identity;\n}\n", "import { Subscription } from '../Subscription';\n\nimport { MonoTypeOperatorFunction, ObservableInput } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\n\n/**\n * An object interface used by {@link throttle} or {@link throttleTime} that ensure\n * configuration options of these operators.\n *\n * @see {@link throttle}\n * @see {@link throttleTime}\n */\nexport interface ThrottleConfig {\n /**\n * If `true`, the resulting Observable will emit the first value from the source\n * Observable at the **start** of the \"throttling\" process (when starting an\n * internal timer that prevents other emissions from the source to pass through).\n * If `false`, it will not emit the first value from the source Observable at the\n * start of the \"throttling\" process.\n *\n * If not provided, defaults to: `true`.\n */\n leading?: boolean;\n /**\n * If `true`, the resulting Observable will emit the last value from the source\n * Observable at the **end** of the \"throttling\" process (when ending an internal\n * timer that prevents other emissions from the source to pass through).\n * If `false`, it will not emit the last value from the source Observable at the\n * end of the \"throttling\" process.\n *\n * If not provided, defaults to: `false`.\n */\n trailing?: boolean;\n}\n\n/**\n * Emits a value from the source Observable, then ignores subsequent source\n * values for a duration determined by another Observable, then repeats this\n * process.\n *\n * <span class=\"informal\">It's like {@link throttleTime}, but the silencing\n * duration is determined by a second Observable.</span>\n *\n * ![](throttle.svg)\n *\n * `throttle` emits the source Observable values on the output Observable\n * when its internal timer is disabled, and ignores source values when the timer\n * is enabled. Initially, the timer is disabled. As soon as the first source\n * value arrives, it is forwarded to the output Observable, and then the timer\n * is enabled by calling the `durationSelector` function with the source value,\n * which returns the \"duration\" Observable. When the duration Observable emits a\n * value, the timer is disabled, and this process repeats for the\n * next source value.\n *\n * ## Example\n *\n * Emit clicks at a rate of at most one click per second\n *\n * ```ts\n * import { fromEvent, throttle, interval } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(throttle(() => interval(1000)));\n *\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link audit}\n * @see {@link debounce}\n * @see {@link delayWhen}\n * @see {@link sample}\n * @see {@link throttleTime}\n *\n * @param durationSelector A function that receives a value from the source\n * Observable, for computing the silencing duration for each source value,\n * returned as an `ObservableInput`.\n * @param config A configuration object to define `leading` and `trailing`\n * behavior. Defaults to `{ leading: true, trailing: false }`.\n * @return A function that returns an Observable that performs the throttle\n * operation to limit the rate of emissions from the source.\n */\nexport function throttle<T>(durationSelector: (value: T) => ObservableInput<any>, config?: ThrottleConfig): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n const { leading = true, trailing = false } = config ?? {};\n let hasValue = false;\n let sendValue: T | null = null;\n let throttled: Subscription | null = null;\n let isComplete = false;\n\n const endThrottling = () => {\n throttled?.unsubscribe();\n throttled = null;\n if (trailing) {\n send();\n isComplete && subscriber.complete();\n }\n };\n\n const cleanupThrottling = () => {\n throttled = null;\n isComplete && subscriber.complete();\n };\n\n const startThrottle = (value: T) =>\n (throttled = innerFrom(durationSelector(value)).subscribe(createOperatorSubscriber(subscriber, endThrottling, cleanupThrottling)));\n\n const send = () => {\n if (hasValue) {\n // Ensure we clear out our value and hasValue flag\n // before we emit, otherwise reentrant code can cause\n // issues here.\n hasValue = false;\n const value = sendValue!;\n sendValue = null;\n // Emit the value.\n subscriber.next(value);\n !isComplete && startThrottle(value);\n }\n };\n\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n // Regarding the presence of throttled.closed in the following\n // conditions, if a synchronous duration selector is specified - weird,\n // but legal - an already-closed subscription will be assigned to\n // throttled, so the subscription's closed property needs to be checked,\n // too.\n (value) => {\n hasValue = true;\n sendValue = value;\n !(throttled && !throttled.closed) && (leading ? send() : startThrottle(value));\n },\n () => {\n isComplete = true;\n !(trailing && hasValue && throttled && !throttled.closed) && subscriber.complete();\n }\n )\n );\n });\n}\n", "import { asyncScheduler } from '../scheduler/async';\nimport { throttle, ThrottleConfig } from './throttle';\nimport { MonoTypeOperatorFunction, SchedulerLike } from '../types';\nimport { timer } from '../observable/timer';\n\n/**\n * Emits a value from the source Observable, then ignores subsequent source\n * values for `duration` milliseconds, then repeats this process.\n *\n * <span class=\"informal\">Lets a value pass, then ignores source values for the\n * next `duration` milliseconds.</span>\n *\n * ![](throttleTime.png)\n *\n * `throttleTime` emits the source Observable values on the output Observable\n * when its internal timer is disabled, and ignores source values when the timer\n * is enabled. Initially, the timer is disabled. As soon as the first source\n * value arrives, it is forwarded to the output Observable, and then the timer\n * is enabled. After `duration` milliseconds (or the time unit determined\n * internally by the optional `scheduler`) has passed, the timer is disabled,\n * and this process repeats for the next source value. Optionally takes a\n * {@link SchedulerLike} for managing timers.\n *\n * ## Examples\n *\n * ### Limit click rate\n *\n * Emit clicks at a rate of at most one click per second\n *\n * ```ts\n * import { fromEvent, throttleTime } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(throttleTime(1000));\n *\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link auditTime}\n * @see {@link debounceTime}\n * @see {@link delay}\n * @see {@link sampleTime}\n * @see {@link throttle}\n *\n * @param duration Time to wait before emitting another value after\n * emitting the last value, measured in milliseconds or the time unit determined\n * internally by the optional `scheduler`.\n * @param scheduler The {@link SchedulerLike} to use for\n * managing the timers that handle the throttling. Defaults to {@link asyncScheduler}.\n * @param config A configuration object to define `leading` and\n * `trailing` behavior. Defaults to `{ leading: true, trailing: false }`.\n * @return A function that returns an Observable that performs the throttle\n * operation to limit the rate of emissions from the source.\n */\nexport function throttleTime<T>(\n duration: number,\n scheduler: SchedulerLike = asyncScheduler,\n config?: ThrottleConfig\n): MonoTypeOperatorFunction<T> {\n const duration$ = timer(duration, scheduler);\n return throttle(() => duration$, config);\n}\n", "import { asyncScheduler } from '../scheduler/async';\nimport { SchedulerLike, OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Emits an object containing the current value, and the time that has\n * passed between emitting the current value and the previous value, which is\n * calculated by using the provided `scheduler`'s `now()` method to retrieve\n * the current time at each emission, then calculating the difference. The `scheduler`\n * defaults to {@link asyncScheduler}, so by default, the `interval` will be in\n * milliseconds.\n *\n * <span class=\"informal\">Convert an Observable that emits items into one that\n * emits indications of the amount of time elapsed between those emissions.</span>\n *\n * ![](timeInterval.png)\n *\n * ## Example\n *\n * Emit interval between current value with the last value\n *\n * ```ts\n * import { interval, timeInterval } from 'rxjs';\n *\n * const seconds = interval(1000);\n *\n * seconds\n * .pipe(timeInterval())\n * .subscribe(value => console.log(value));\n *\n * // NOTE: The values will never be this precise,\n * // intervals created with `interval` or `setInterval`\n * // are non-deterministic.\n *\n * // { value: 0, interval: 1000 }\n * // { value: 1, interval: 1000 }\n * // { value: 2, interval: 1000 }\n * ```\n *\n * @param scheduler Scheduler used to get the current time.\n * @return A function that returns an Observable that emits information about\n * value and interval.\n */\nexport function timeInterval<T>(scheduler: SchedulerLike = asyncScheduler): OperatorFunction<T, TimeInterval<T>> {\n return operate((source, subscriber) => {\n let last = scheduler.now();\n source.subscribe(\n createOperatorSubscriber(subscriber, (value) => {\n const now = scheduler.now();\n const interval = now - last;\n last = now;\n subscriber.next(new TimeInterval(value, interval));\n })\n );\n });\n}\n\n// TODO(benlesh): make this an interface, export the interface, but not the implemented class,\n// there's no reason users should be manually creating this type.\n\nexport class TimeInterval<T> {\n /**\n * @deprecated Internal implementation detail, do not construct directly. Will be made an interface in v8.\n */\n constructor(public value: T, public interval: number) {}\n}\n", "import { async } from '../scheduler/async';\nimport { isValidDate } from '../util/isDate';\nimport { ObservableInput, OperatorFunction, SchedulerLike } from '../types';\nimport { timeout } from './timeout';\n\n/** @deprecated Replaced with {@link timeout}. Instead of `timeoutWith(someDate, a$, scheduler)`, use the configuration object\n * `timeout({ first: someDate, with: () => a$, scheduler })`. Will be removed in v8. */\nexport function timeoutWith<T, R>(dueBy: Date, switchTo: ObservableInput<R>, scheduler?: SchedulerLike): OperatorFunction<T, T | R>;\n/** @deprecated Replaced with {@link timeout}. Instead of `timeoutWith(100, a$, scheduler)`, use the configuration object\n * `timeout({ each: 100, with: () => a$, scheduler })`. Will be removed in v8. */\nexport function timeoutWith<T, R>(waitFor: number, switchTo: ObservableInput<R>, scheduler?: SchedulerLike): OperatorFunction<T, T | R>;\n\n/**\n * When the passed timespan elapses before the source emits any given value, it will unsubscribe from the source,\n * and switch the subscription to another observable.\n *\n * <span class=\"informal\">Used to switch to a different observable if your source is being slow.</span>\n *\n * Useful in cases where:\n *\n * - You want to switch to a different source that may be faster.\n * - You want to notify a user that the data stream is slow.\n * - You want to emit a custom error rather than the {@link TimeoutError} emitted\n * by the default usage of {@link timeout}.\n *\n * If the first parameter is passed as Date and the time of the Date arrives before the first value arrives from the source,\n * it will unsubscribe from the source and switch the subscription to another observable.\n *\n * <span class=\"informal\">Use Date object to switch to a different observable if the first value doesn't arrive by a specific time.</span>\n *\n * Can be used to set a timeout only for the first value, however it's recommended to use the {@link timeout} operator with\n * the `first` configuration to get the same effect.\n *\n * ## Examples\n *\n * Fallback to a faster observable\n *\n * ```ts\n * import { interval, timeoutWith } from 'rxjs';\n *\n * const slow$ = interval(1000);\n * const faster$ = interval(500);\n *\n * slow$\n * .pipe(timeoutWith(900, faster$))\n * .subscribe(console.log);\n * ```\n *\n * Emit your own custom timeout error\n *\n * ```ts\n * import { interval, timeoutWith, throwError } from 'rxjs';\n *\n * class CustomTimeoutError extends Error {\n * constructor() {\n * super('It was too slow');\n * this.name = 'CustomTimeoutError';\n * }\n * }\n *\n * const slow$ = interval(1000);\n *\n * slow$\n * .pipe(timeoutWith(900, throwError(() => new CustomTimeoutError())))\n * .subscribe({\n * error: err => console.error(err.message)\n * });\n * ```\n *\n * @see {@link timeout}\n *\n * @param due When passed a number, used as the time (in milliseconds) allowed between each value from the source before timeout\n * is triggered. When passed a Date, used as the exact time at which the timeout will be triggered if the first value does not arrive.\n * @param withObservable The observable to switch to when timeout occurs.\n * @param scheduler The scheduler to use with time-related operations within this operator. Defaults to {@link asyncScheduler}\n * @return A function that returns an Observable that mirrors behaviour of the\n * source Observable, unless timeout happens when it starts emitting values\n * from the `ObservableInput` passed as a second parameter.\n * @deprecated Replaced with {@link timeout}. Instead of `timeoutWith(100, a$, scheduler)`, use {@link timeout} with the configuration\n * object: `timeout({ each: 100, with: () => a$, scheduler })`. Instead of `timeoutWith(someDate, a$, scheduler)`, use {@link timeout}\n * with the configuration object: `timeout({ first: someDate, with: () => a$, scheduler })`. Will be removed in v8.\n */\nexport function timeoutWith<T, R>(\n due: number | Date,\n withObservable: ObservableInput<R>,\n scheduler?: SchedulerLike\n): OperatorFunction<T, T | R> {\n let first: number | Date | undefined;\n let each: number | undefined;\n let _with: () => ObservableInput<R>;\n scheduler = scheduler ?? async;\n\n if (isValidDate(due)) {\n first = due;\n } else if (typeof due === 'number') {\n each = due;\n }\n\n if (withObservable) {\n _with = () => withObservable;\n } else {\n throw new TypeError('No observable provided to switch to');\n }\n\n if (first == null && each == null) {\n // Ensure timeout was provided at runtime.\n throw new TypeError('No timeout provided.');\n }\n\n return timeout<T, ObservableInput<R>>({\n first,\n each,\n scheduler,\n with: _with,\n });\n}\n", "import { OperatorFunction, TimestampProvider, Timestamp } from '../types';\nimport { dateTimestampProvider } from '../scheduler/dateTimestampProvider';\nimport { map } from './map';\n\n/**\n * Attaches a timestamp to each item emitted by an observable indicating when it was emitted\n *\n * The `timestamp` operator maps the *source* observable stream to an object of type\n * `{value: T, timestamp: R}`. The properties are generically typed. The `value` property contains the value\n * and type of the *source* observable. The `timestamp` is generated by the schedulers `now` function. By\n * default, it uses the `asyncScheduler` which simply returns `Date.now()` (milliseconds since 1970/01/01\n * 00:00:00:000) and therefore is of type `number`.\n *\n * ![](timestamp.png)\n *\n * ## Example\n *\n * In this example there is a timestamp attached to the document's click events\n *\n * ```ts\n * import { fromEvent, timestamp } from 'rxjs';\n *\n * const clickWithTimestamp = fromEvent(document, 'click').pipe(\n * timestamp()\n * );\n *\n * // Emits data of type { value: PointerEvent, timestamp: number }\n * clickWithTimestamp.subscribe(data => {\n * console.log(data);\n * });\n * ```\n *\n * @param timestampProvider An object with a `now()` method used to get the current timestamp.\n * @return A function that returns an Observable that attaches a timestamp to\n * each item emitted by the source Observable indicating when it was emitted.\n */\nexport function timestamp<T>(timestampProvider: TimestampProvider = dateTimestampProvider): OperatorFunction<T, Timestamp<T>> {\n return map((value: T) => ({ value, timestamp: timestampProvider.now() }));\n}\n", "import { Observable } from '../Observable';\nimport { OperatorFunction, ObservableInput } from '../types';\nimport { Subject } from '../Subject';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { noop } from '../util/noop';\nimport { innerFrom } from '../observable/innerFrom';\n\n/**\n * Branch out the source Observable values as a nested Observable whenever\n * `windowBoundaries` emits.\n *\n * <span class=\"informal\">It's like {@link buffer}, but emits a nested Observable\n * instead of an array.</span>\n *\n * ![](window.png)\n *\n * Returns an Observable that emits windows of items it collects from the source\n * Observable. The output Observable emits connected, non-overlapping\n * windows. It emits the current window and opens a new one whenever the\n * `windowBoundaries` emits an item. `windowBoundaries` can be any type that\n * `ObservableInput` accepts. It internally gets converted to an Observable.\n * Because each window is an Observable, the output is a higher-order Observable.\n *\n * ## Example\n *\n * In every window of 1 second each, emit at most 2 click events\n *\n * ```ts\n * import { fromEvent, interval, window, map, take, mergeAll } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const sec = interval(1000);\n * const result = clicks.pipe(\n * window(sec),\n * map(win => win.pipe(take(2))), // take at most 2 emissions from each window\n * mergeAll() // flatten the Observable-of-Observables\n * );\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link windowCount}\n * @see {@link windowTime}\n * @see {@link windowToggle}\n * @see {@link windowWhen}\n * @see {@link buffer}\n *\n * @param windowBoundaries An `ObservableInput` that completes the\n * previous window and starts a new window.\n * @return A function that returns an Observable of windows, which are\n * Observables emitting values of the source Observable.\n */\nexport function window<T>(windowBoundaries: ObservableInput<any>): OperatorFunction<T, Observable<T>> {\n return operate((source, subscriber) => {\n let windowSubject: Subject<T> = new Subject<T>();\n\n subscriber.next(windowSubject.asObservable());\n\n const errorHandler = (err: any) => {\n windowSubject.error(err);\n subscriber.error(err);\n };\n\n // Subscribe to our source\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => windowSubject?.next(value),\n () => {\n windowSubject.complete();\n subscriber.complete();\n },\n errorHandler\n )\n );\n\n // Subscribe to the window boundaries.\n innerFrom(windowBoundaries).subscribe(\n createOperatorSubscriber(\n subscriber,\n () => {\n windowSubject.complete();\n subscriber.next((windowSubject = new Subject()));\n },\n noop,\n errorHandler\n )\n );\n\n return () => {\n // Unsubscribing the subject ensures that anyone who has captured\n // a reference to this window that tries to use it after it can\n // no longer get values from the source will get an ObjectUnsubscribedError.\n windowSubject?.unsubscribe();\n windowSubject = null!;\n };\n });\n}\n", "import { Observable } from '../Observable';\nimport { Subject } from '../Subject';\nimport { OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Branch out the source Observable values as a nested Observable with each\n * nested Observable emitting at most `windowSize` values.\n *\n * <span class=\"informal\">It's like {@link bufferCount}, but emits a nested\n * Observable instead of an array.</span>\n *\n * ![](windowCount.png)\n *\n * Returns an Observable that emits windows of items it collects from the source\n * Observable. The output Observable emits windows every `startWindowEvery`\n * items, each containing no more than `windowSize` items. When the source\n * Observable completes or encounters an error, the output Observable emits\n * the current window and propagates the notification from the source\n * Observable. If `startWindowEvery` is not provided, then new windows are\n * started immediately at the start of the source and when each window completes\n * with size `windowSize`.\n *\n * ## Examples\n *\n * Ignore every 3rd click event, starting from the first one\n *\n * ```ts\n * import { fromEvent, windowCount, map, skip, mergeAll } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(\n * windowCount(3),\n * map(win => win.pipe(skip(1))), // skip first of every 3 clicks\n * mergeAll() // flatten the Observable-of-Observables\n * );\n * result.subscribe(x => console.log(x));\n * ```\n *\n * Ignore every 3rd click event, starting from the third one\n *\n * ```ts\n * import { fromEvent, windowCount, mergeAll } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(\n * windowCount(2, 3),\n * mergeAll() // flatten the Observable-of-Observables\n * );\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link window}\n * @see {@link windowTime}\n * @see {@link windowToggle}\n * @see {@link windowWhen}\n * @see {@link bufferCount}\n *\n * @param windowSize The maximum number of values emitted by each window.\n * @param startWindowEvery Interval at which to start a new window. For example\n * if `startWindowEvery` is `2`, then a new window will be started on every\n * other value from the source. A new window is started at the beginning of the\n * source by default.\n * @return A function that returns an Observable of windows, which in turn are\n * Observable of values.\n */\nexport function windowCount<T>(windowSize: number, startWindowEvery: number = 0): OperatorFunction<T, Observable<T>> {\n const startEvery = startWindowEvery > 0 ? startWindowEvery : windowSize;\n\n return operate((source, subscriber) => {\n let windows = [new Subject<T>()];\n let starts: number[] = [];\n let count = 0;\n\n // Open the first window.\n subscriber.next(windows[0].asObservable());\n\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value: T) => {\n // Emit the value through all current windows.\n // We don't need to create a new window yet, we\n // do that as soon as we close one.\n for (const window of windows) {\n window.next(value);\n }\n // Here we're using the size of the window array to figure\n // out if the oldest window has emitted enough values. We can do this\n // because the size of the window array is a function of the values\n // seen by the subscription. If it's time to close it, we complete\n // it and remove it.\n const c = count - windowSize + 1;\n if (c >= 0 && c % startEvery === 0) {\n windows.shift()!.complete();\n }\n\n // Look to see if the next count tells us it's time to open a new window.\n // TODO: We need to figure out if this really makes sense. We're technically\n // emitting windows *before* we have a value to emit them for. It's probably\n // more expected that we should be emitting the window when the start\n // count is reached -- not before.\n if (++count % startEvery === 0) {\n const window = new Subject<T>();\n windows.push(window);\n subscriber.next(window.asObservable());\n }\n },\n () => {\n while (windows.length > 0) {\n windows.shift()!.complete();\n }\n subscriber.complete();\n },\n (err) => {\n while (windows.length > 0) {\n windows.shift()!.error(err);\n }\n subscriber.error(err);\n },\n () => {\n starts = null!;\n windows = null!;\n }\n )\n );\n });\n}\n", "import { Subject } from '../Subject';\nimport { asyncScheduler } from '../scheduler/async';\nimport { Observable } from '../Observable';\nimport { Subscription } from '../Subscription';\nimport { Observer, OperatorFunction, SchedulerLike } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { arrRemove } from '../util/arrRemove';\nimport { popScheduler } from '../util/args';\nimport { executeSchedule } from '../util/executeSchedule';\n\nexport function windowTime<T>(windowTimeSpan: number, scheduler?: SchedulerLike): OperatorFunction<T, Observable<T>>;\nexport function windowTime<T>(\n windowTimeSpan: number,\n windowCreationInterval: number,\n scheduler?: SchedulerLike\n): OperatorFunction<T, Observable<T>>;\nexport function windowTime<T>(\n windowTimeSpan: number,\n windowCreationInterval: number | null | void,\n maxWindowSize: number,\n scheduler?: SchedulerLike\n): OperatorFunction<T, Observable<T>>;\n\n/**\n * Branch out the source Observable values as a nested Observable periodically\n * in time.\n *\n * <span class=\"informal\">It's like {@link bufferTime}, but emits a nested\n * Observable instead of an array.</span>\n *\n * ![](windowTime.png)\n *\n * Returns an Observable that emits windows of items it collects from the source\n * Observable. The output Observable starts a new window periodically, as\n * determined by the `windowCreationInterval` argument. It emits each window\n * after a fixed timespan, specified by the `windowTimeSpan` argument. When the\n * source Observable completes or encounters an error, the output Observable\n * emits the current window and propagates the notification from the source\n * Observable. If `windowCreationInterval` is not provided, the output\n * Observable starts a new window when the previous window of duration\n * `windowTimeSpan` completes. If `maxWindowCount` is provided, each window\n * will emit at most fixed number of values. Window will complete immediately\n * after emitting last value and next one still will open as specified by\n * `windowTimeSpan` and `windowCreationInterval` arguments.\n *\n * ## Examples\n *\n * In every window of 1 second each, emit at most 2 click events\n *\n * ```ts\n * import { fromEvent, windowTime, map, take, mergeAll } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(\n * windowTime(1000),\n * map(win => win.pipe(take(2))), // take at most 2 emissions from each window\n * mergeAll() // flatten the Observable-of-Observables\n * );\n * result.subscribe(x => console.log(x));\n * ```\n *\n * Every 5 seconds start a window 1 second long, and emit at most 2 click events per window\n *\n * ```ts\n * import { fromEvent, windowTime, map, take, mergeAll } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(\n * windowTime(1000, 5000),\n * map(win => win.pipe(take(2))), // take at most 2 emissions from each window\n * mergeAll() // flatten the Observable-of-Observables\n * );\n * result.subscribe(x => console.log(x));\n * ```\n *\n * Same as example above but with `maxWindowCount` instead of `take`\n *\n * ```ts\n * import { fromEvent, windowTime, mergeAll } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(\n * windowTime(1000, 5000, 2), // take at most 2 emissions from each window\n * mergeAll() // flatten the Observable-of-Observables\n * );\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link window}\n * @see {@link windowCount}\n * @see {@link windowToggle}\n * @see {@link windowWhen}\n * @see {@link bufferTime}\n *\n * @param windowTimeSpan The amount of time, in milliseconds, to fill each window.\n * @param windowCreationInterval The interval at which to start new\n * windows.\n * @param maxWindowSize Max number of\n * values each window can emit before completion.\n * @param scheduler The scheduler on which to schedule the\n * intervals that determine window boundaries.\n * @return A function that returns an Observable of windows, which in turn are\n * Observables.\n */\nexport function windowTime<T>(windowTimeSpan: number, ...otherArgs: any[]): OperatorFunction<T, Observable<T>> {\n const scheduler = popScheduler(otherArgs) ?? asyncScheduler;\n const windowCreationInterval = (otherArgs[0] as number) ?? null;\n const maxWindowSize = (otherArgs[1] as number) || Infinity;\n\n return operate((source, subscriber) => {\n // The active windows, their related subscriptions, and removal functions.\n let windowRecords: WindowRecord<T>[] | null = [];\n // If true, it means that every time we close a window, we want to start a new window.\n // This is only really used for when *just* the time span is passed.\n let restartOnClose = false;\n\n const closeWindow = (record: { window: Subject<T>; subs: Subscription }) => {\n const { window, subs } = record;\n window.complete();\n subs.unsubscribe();\n arrRemove(windowRecords, record);\n restartOnClose && startWindow();\n };\n\n /**\n * Called every time we start a new window. This also does\n * the work of scheduling the job to close the window.\n */\n const startWindow = () => {\n if (windowRecords) {\n const subs = new Subscription();\n subscriber.add(subs);\n const window = new Subject<T>();\n const record = {\n window,\n subs,\n seen: 0,\n };\n windowRecords.push(record);\n subscriber.next(window.asObservable());\n executeSchedule(subs, scheduler, () => closeWindow(record), windowTimeSpan);\n }\n };\n\n if (windowCreationInterval !== null && windowCreationInterval >= 0) {\n // The user passed both a windowTimeSpan (required), and a creation interval\n // That means we need to start new window on the interval, and those windows need\n // to wait the required time span before completing.\n executeSchedule(subscriber, scheduler, startWindow, windowCreationInterval, true);\n } else {\n restartOnClose = true;\n }\n\n startWindow();\n\n /**\n * We need to loop over a copy of the window records several times in this operator.\n * This is to save bytes over the wire more than anything.\n * The reason we copy the array is that reentrant code could mutate the array while\n * we are iterating over it.\n */\n const loop = (cb: (record: WindowRecord<T>) => void) => windowRecords!.slice().forEach(cb);\n\n /**\n * Used to notify all of the windows and the subscriber in the same way\n * in the error and complete handlers.\n */\n const terminate = (cb: (consumer: Observer<any>) => void) => {\n loop(({ window }) => cb(window));\n cb(subscriber);\n subscriber.unsubscribe();\n };\n\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value: T) => {\n // Notify all windows of the value.\n loop((record) => {\n record.window.next(value);\n // If the window is over the max size, we need to close it.\n maxWindowSize <= ++record.seen && closeWindow(record);\n });\n },\n // Complete the windows and the downstream subscriber and clean up.\n () => terminate((consumer) => consumer.complete()),\n // Notify the windows and the downstream subscriber of the error and clean up.\n (err) => terminate((consumer) => consumer.error(err))\n )\n );\n\n // Additional finalization. This will be called when the\n // destination tears down. Other finalizations are registered implicitly\n // above via subscription.\n return () => {\n // Ensure that the buffer is released.\n windowRecords = null!;\n };\n });\n}\n\ninterface WindowRecord<T> {\n seen: number;\n window: Subject<T>;\n subs: Subscription;\n}\n", "import { Observable } from '../Observable';\nimport { Subject } from '../Subject';\nimport { Subscription } from '../Subscription';\nimport { ObservableInput, OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { innerFrom } from '../observable/innerFrom';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { noop } from '../util/noop';\nimport { arrRemove } from '../util/arrRemove';\n\n/**\n * Branch out the source Observable values as a nested Observable starting from\n * an emission from `openings` and ending when the output of `closingSelector`\n * emits.\n *\n * <span class=\"informal\">It's like {@link bufferToggle}, but emits a nested\n * Observable instead of an array.</span>\n *\n * ![](windowToggle.png)\n *\n * Returns an Observable that emits windows of items it collects from the source\n * Observable. The output Observable emits windows that contain those items\n * emitted by the source Observable between the time when the `openings`\n * Observable emits an item and when the Observable returned by\n * `closingSelector` emits an item.\n *\n * ## Example\n *\n * Every other second, emit the click events from the next 500ms\n *\n * ```ts\n * import { fromEvent, interval, windowToggle, EMPTY, mergeAll } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const openings = interval(1000);\n * const result = clicks.pipe(\n * windowToggle(openings, i => i % 2 ? interval(500) : EMPTY),\n * mergeAll()\n * );\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link window}\n * @see {@link windowCount}\n * @see {@link windowTime}\n * @see {@link windowWhen}\n * @see {@link bufferToggle}\n *\n * @param openings An observable of notifications to start new windows.\n * @param closingSelector A function that takes the value emitted by the\n * `openings` observable and returns an Observable, which, when it emits a next\n * notification, signals that the associated window should complete.\n * @return A function that returns an Observable of windows, which in turn are\n * Observables.\n */\nexport function windowToggle<T, O>(\n openings: ObservableInput<O>,\n closingSelector: (openValue: O) => ObservableInput<any>\n): OperatorFunction<T, Observable<T>> {\n return operate((source, subscriber) => {\n const windows: Subject<T>[] = [];\n\n const handleError = (err: any) => {\n while (0 < windows.length) {\n windows.shift()!.error(err);\n }\n subscriber.error(err);\n };\n\n innerFrom(openings).subscribe(\n createOperatorSubscriber(\n subscriber,\n (openValue) => {\n const window = new Subject<T>();\n windows.push(window);\n const closingSubscription = new Subscription();\n const closeWindow = () => {\n arrRemove(windows, window);\n window.complete();\n closingSubscription.unsubscribe();\n };\n\n let closingNotifier: Observable<any>;\n try {\n closingNotifier = innerFrom(closingSelector(openValue));\n } catch (err) {\n handleError(err);\n return;\n }\n\n subscriber.next(window.asObservable());\n\n closingSubscription.add(closingNotifier.subscribe(createOperatorSubscriber(subscriber, closeWindow, noop, handleError)));\n },\n noop\n )\n );\n\n // Subscribe to the source to get things started.\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value: T) => {\n // Copy the windows array before we emit to\n // make sure we don't have issues with reentrant code.\n const windowsCopy = windows.slice();\n for (const window of windowsCopy) {\n window.next(value);\n }\n },\n () => {\n // Complete all of our windows before we complete.\n while (0 < windows.length) {\n windows.shift()!.complete();\n }\n subscriber.complete();\n },\n handleError,\n () => {\n // Add this finalization so that all window subjects are\n // disposed of. This way, if a user tries to subscribe\n // to a window *after* the outer subscription has been unsubscribed,\n // they will get an error, instead of waiting forever to\n // see if a value arrives.\n while (0 < windows.length) {\n windows.shift()!.unsubscribe();\n }\n }\n )\n );\n });\n}\n", "import { Subscriber } from '../Subscriber';\nimport { Observable } from '../Observable';\nimport { Subject } from '../Subject';\nimport { ObservableInput, OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\n\n/**\n * Branch out the source Observable values as a nested Observable using a\n * factory function of closing Observables to determine when to start a new\n * window.\n *\n * <span class=\"informal\">It's like {@link bufferWhen}, but emits a nested\n * Observable instead of an array.</span>\n *\n * ![](windowWhen.png)\n *\n * Returns an Observable that emits windows of items it collects from the source\n * Observable. The output Observable emits connected, non-overlapping windows.\n * It emits the current window and opens a new one whenever the Observable\n * produced by the specified `closingSelector` function emits an item. The first\n * window is opened immediately when subscribing to the output Observable.\n *\n * ## Example\n *\n * Emit only the first two clicks events in every window of [1-5] random seconds\n *\n * ```ts\n * import { fromEvent, windowWhen, interval, map, take, mergeAll } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(\n * windowWhen(() => interval(1000 + Math.random() * 4000)),\n * map(win => win.pipe(take(2))), // take at most 2 emissions from each window\n * mergeAll() // flatten the Observable-of-Observables\n * );\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link window}\n * @see {@link windowCount}\n * @see {@link windowTime}\n * @see {@link windowToggle}\n * @see {@link bufferWhen}\n *\n * @param closingSelector A function that takes no arguments and returns an\n * {@link ObservableInput} (that gets converted to Observable) that signals\n * (on either `next` or `complete`) when to close the previous window and\n * start a new one.\n * @return A function that returns an Observable of windows, which in turn are\n * Observables.\n */\nexport function windowWhen<T>(closingSelector: () => ObservableInput<any>): OperatorFunction<T, Observable<T>> {\n return operate((source, subscriber) => {\n let window: Subject<T> | null;\n let closingSubscriber: Subscriber<any> | undefined;\n\n /**\n * When we get an error, we have to notify both the\n * destination subscriber and the window.\n */\n const handleError = (err: any) => {\n window!.error(err);\n subscriber.error(err);\n };\n\n /**\n * Called every time we need to open a window.\n * Recursive, as it will start the closing notifier, which\n * inevitably *should* call openWindow -- but may not if\n * it is a \"never\" observable.\n */\n const openWindow = () => {\n // We need to clean up our closing subscription,\n // we only cared about the first next or complete notification.\n closingSubscriber?.unsubscribe();\n\n // Close our window before starting a new one.\n window?.complete();\n\n // Start the new window.\n window = new Subject<T>();\n subscriber.next(window.asObservable());\n\n // Get our closing notifier.\n let closingNotifier: Observable<any>;\n try {\n closingNotifier = innerFrom(closingSelector());\n } catch (err) {\n handleError(err);\n return;\n }\n\n // Subscribe to the closing notifier, be sure\n // to capture the subscriber (aka Subscription)\n // so we can clean it up when we close the window\n // and open a new one.\n closingNotifier.subscribe((closingSubscriber = createOperatorSubscriber(subscriber, openWindow, openWindow, handleError)));\n };\n\n // Start the first window.\n openWindow();\n\n // Subscribe to the source\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => window!.next(value),\n () => {\n // The source completed, close the window and complete.\n window!.complete();\n subscriber.complete();\n },\n handleError,\n () => {\n // Be sure to clean up our closing subscription\n // when this tears down.\n closingSubscriber?.unsubscribe();\n window = null!;\n }\n )\n );\n });\n}\n", "import { OperatorFunction, ObservableInputTuple } from '../types';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\nimport { identity } from '../util/identity';\nimport { noop } from '../util/noop';\nimport { popResultSelector } from '../util/args';\n\nexport function withLatestFrom<T, O extends unknown[]>(...inputs: [...ObservableInputTuple<O>]): OperatorFunction<T, [T, ...O]>;\n\nexport function withLatestFrom<T, O extends unknown[], R>(\n ...inputs: [...ObservableInputTuple<O>, (...value: [T, ...O]) => R]\n): OperatorFunction<T, R>;\n\n/**\n * Combines the source Observable with other Observables to create an Observable\n * whose values are calculated from the latest values of each, only when the\n * source emits.\n *\n * <span class=\"informal\">Whenever the source Observable emits a value, it\n * computes a formula using that value plus the latest values from other input\n * Observables, then emits the output of that formula.</span>\n *\n * ![](withLatestFrom.png)\n *\n * `withLatestFrom` combines each value from the source Observable (the\n * instance) with the latest values from the other input Observables only when\n * the source emits a value, optionally using a `project` function to determine\n * the value to be emitted on the output Observable. All input Observables must\n * emit at least one value before the output Observable will emit a value.\n *\n * ## Example\n *\n * On every click event, emit an array with the latest timer event plus the click event\n *\n * ```ts\n * import { fromEvent, interval, withLatestFrom } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const timer = interval(1000);\n * const result = clicks.pipe(withLatestFrom(timer));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link combineLatest}\n *\n * @param inputs An input Observable to combine with the source Observable. More\n * than one input Observables may be given as argument. If the last parameter is\n * a function, it will be used as a projection function for combining values\n * together. When the function is called, it receives all values in order of the\n * Observables passed, where the first parameter is a value from the source\n * Observable. (e.g.\n * `a.pipe(withLatestFrom(b, c), map(([a1, b1, c1]) => a1 + b1 + c1))`). If this\n * is not passed, arrays will be emitted on the output Observable.\n * @return A function that returns an Observable of projected values from the\n * most recent values from each input Observable, or an array of the most\n * recent values from each input Observable.\n */\nexport function withLatestFrom<T, R>(...inputs: any[]): OperatorFunction<T, R | any[]> {\n const project = popResultSelector(inputs) as ((...args: any[]) => R) | undefined;\n\n return operate((source, subscriber) => {\n const len = inputs.length;\n const otherValues = new Array(len);\n // An array of whether or not the other sources have emitted. Matched with them by index.\n // TODO: At somepoint, we should investigate the performance implications here, and look\n // into using a `Set()` and checking the `size` to see if we're ready.\n let hasValue = inputs.map(() => false);\n // Flipped true when we have at least one value from all other sources and\n // we are ready to start emitting values.\n let ready = false;\n\n // Other sources. Note that here we are not checking `subscriber.closed`,\n // this causes all inputs to be subscribed to, even if nothing can be emitted\n // from them. This is an important distinction because subscription constitutes\n // a side-effect.\n for (let i = 0; i < len; i++) {\n innerFrom(inputs[i]).subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => {\n otherValues[i] = value;\n if (!ready && !hasValue[i]) {\n // If we're not ready yet, flag to show this observable has emitted.\n hasValue[i] = true;\n // Intentionally terse code.\n // If all of our other observables have emitted, set `ready` to `true`,\n // so we know we can start emitting values, then clean up the `hasValue` array,\n // because we don't need it anymore.\n (ready = hasValue.every(identity)) && (hasValue = null!);\n }\n },\n // Completing one of the other sources has\n // no bearing on the completion of our result.\n noop\n )\n );\n }\n\n // Source subscription\n source.subscribe(\n createOperatorSubscriber(subscriber, (value) => {\n if (ready) {\n // We have at least one value from the other sources. Go ahead and emit.\n const values = [value, ...otherValues];\n subscriber.next(project ? project(...values) : values);\n }\n })\n );\n });\n}\n", "import { OperatorFunction, ObservableInput } from '../types';\nimport { zip } from '../observable/zip';\nimport { joinAllInternals } from './joinAllInternals';\n\n/**\n * Collects all observable inner sources from the source, once the source completes,\n * it will subscribe to all inner sources, combining their values by index and emitting\n * them.\n *\n * @see {@link zipWith}\n * @see {@link zip}\n */\nexport function zipAll<T>(): OperatorFunction<ObservableInput<T>, T[]>;\nexport function zipAll<T>(): OperatorFunction<any, T[]>;\nexport function zipAll<T, R>(project: (...values: T[]) => R): OperatorFunction<ObservableInput<T>, R>;\nexport function zipAll<R>(project: (...values: Array<any>) => R): OperatorFunction<any, R>;\n\nexport function zipAll<T, R>(project?: (...values: T[]) => R) {\n return joinAllInternals(zip, project);\n}\n", "import { zip as zipStatic } from '../observable/zip';\nimport { ObservableInput, ObservableInputTuple, OperatorFunction, Cons } from '../types';\nimport { operate } from '../util/lift';\n\n/** @deprecated Replaced with {@link zipWith}. Will be removed in v8. */\nexport function zip<T, A extends readonly unknown[]>(otherInputs: [...ObservableInputTuple<A>]): OperatorFunction<T, Cons<T, A>>;\n/** @deprecated Replaced with {@link zipWith}. Will be removed in v8. */\nexport function zip<T, A extends readonly unknown[], R>(\n otherInputsAndProject: [...ObservableInputTuple<A>],\n project: (...values: Cons<T, A>) => R\n): OperatorFunction<T, R>;\n/** @deprecated Replaced with {@link zipWith}. Will be removed in v8. */\nexport function zip<T, A extends readonly unknown[]>(...otherInputs: [...ObservableInputTuple<A>]): OperatorFunction<T, Cons<T, A>>;\n/** @deprecated Replaced with {@link zipWith}. Will be removed in v8. */\nexport function zip<T, A extends readonly unknown[], R>(\n ...otherInputsAndProject: [...ObservableInputTuple<A>, (...values: Cons<T, A>) => R]\n): OperatorFunction<T, R>;\n\n/**\n * @deprecated Replaced with {@link zipWith}. Will be removed in v8.\n */\nexport function zip<T, R>(...sources: Array<ObservableInput<any> | ((...values: Array<any>) => R)>): OperatorFunction<T, any> {\n return operate((source, subscriber) => {\n zipStatic(source as ObservableInput<any>, ...(sources as Array<ObservableInput<any>>)).subscribe(subscriber);\n });\n}\n", "import { ObservableInputTuple, OperatorFunction, Cons } from '../types';\nimport { zip } from './zip';\n\n/**\n * Subscribes to the source, and the observable inputs provided as arguments, and combines their values, by index, into arrays.\n *\n * What is meant by \"combine by index\": The first value from each will be made into a single array, then emitted,\n * then the second value from each will be combined into a single array and emitted, then the third value\n * from each will be combined into a single array and emitted, and so on.\n *\n * This will continue until it is no longer able to combine values of the same index into an array.\n *\n * After the last value from any one completed source is emitted in an array, the resulting observable will complete,\n * as there is no way to continue \"zipping\" values together by index.\n *\n * Use-cases for this operator are limited. There are memory concerns if one of the streams is emitting\n * values at a much faster rate than the others. Usage should likely be limited to streams that emit\n * at a similar pace, or finite streams of known length.\n *\n * In many cases, authors want `combineLatestWith` and not `zipWith`.\n *\n * @param otherInputs other observable inputs to collate values from.\n * @return A function that returns an Observable that emits items by index\n * combined from the source Observable and provided Observables, in form of an\n * array.\n */\nexport function zipWith<T, A extends readonly unknown[]>(...otherInputs: [...ObservableInputTuple<A>]): OperatorFunction<T, Cons<T, A>> {\n return zip(...otherInputs);\n}\n", "//////////////////////////////////////////////////////////\n// Here we need to reference our other deep imports\n// so VS code will figure out where they are\n// see conversation here:\n// https://github.com/microsoft/TypeScript/issues/43034\n//////////////////////////////////////////////////////////\n\n// tslint:disable: no-reference\n// It's tempting to add references to all of the deep-import locations, but\n// adding references to those that require DOM types breaks Node projects.\n/// <reference path=\"./operators/index.ts\" />\n/// <reference path=\"./testing/index.ts\" />\n// tslint:enable: no-reference\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';\nexport { animationFrames } from './internal/observable/dom/animationFrames';\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, asapScheduler } from './internal/scheduler/asap';\nexport { async, asyncScheduler } from './internal/scheduler/async';\nexport { queue, queueScheduler } from './internal/scheduler/queue';\nexport { animationFrame, 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/* Promise Conversion */\nexport { lastValueFrom } from './internal/lastValueFrom';\nexport { firstValueFrom } from './internal/firstValueFrom';\n\n/* Error types */\nexport { ArgumentOutOfRangeError } from './internal/util/ArgumentOutOfRangeError';\nexport { EmptyError } from './internal/util/EmptyError';\nexport { NotFoundError } from './internal/util/NotFoundError';\nexport { ObjectUnsubscribedError } from './internal/util/ObjectUnsubscribedError';\nexport { SequenceError } from './internal/util/SequenceError';\nexport { TimeoutError } from './internal/operators/timeout';\nexport { UnsubscriptionError } from './internal/util/UnsubscriptionError';\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 { connectable } from './internal/observable/connectable';\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, GlobalConfig } from './internal/config';\n\n/* Operators */\nexport { audit } from './internal/operators/audit';\nexport { auditTime } from './internal/operators/auditTime';\nexport { buffer } from './internal/operators/buffer';\nexport { bufferCount } from './internal/operators/bufferCount';\nexport { bufferTime } from './internal/operators/bufferTime';\nexport { bufferToggle } from './internal/operators/bufferToggle';\nexport { bufferWhen } from './internal/operators/bufferWhen';\nexport { catchError } from './internal/operators/catchError';\nexport { combineAll } from './internal/operators/combineAll';\nexport { combineLatestAll } from './internal/operators/combineLatestAll';\nexport { combineLatestWith } from './internal/operators/combineLatestWith';\nexport { concatAll } from './internal/operators/concatAll';\nexport { concatMap } from './internal/operators/concatMap';\nexport { concatMapTo } from './internal/operators/concatMapTo';\nexport { concatWith } from './internal/operators/concatWith';\nexport { connect, ConnectConfig } from './internal/operators/connect';\nexport { count } from './internal/operators/count';\nexport { debounce } from './internal/operators/debounce';\nexport { debounceTime } from './internal/operators/debounceTime';\nexport { defaultIfEmpty } from './internal/operators/defaultIfEmpty';\nexport { delay } from './internal/operators/delay';\nexport { delayWhen } from './internal/operators/delayWhen';\nexport { dematerialize } from './internal/operators/dematerialize';\nexport { distinct } from './internal/operators/distinct';\nexport { distinctUntilChanged } from './internal/operators/distinctUntilChanged';\nexport { distinctUntilKeyChanged } from './internal/operators/distinctUntilKeyChanged';\nexport { elementAt } from './internal/operators/elementAt';\nexport { endWith } from './internal/operators/endWith';\nexport { every } from './internal/operators/every';\nexport { exhaust } from './internal/operators/exhaust';\nexport { exhaustAll } from './internal/operators/exhaustAll';\nexport { exhaustMap } from './internal/operators/exhaustMap';\nexport { expand } from './internal/operators/expand';\nexport { filter } from './internal/operators/filter';\nexport { finalize } from './internal/operators/finalize';\nexport { find } from './internal/operators/find';\nexport { findIndex } from './internal/operators/findIndex';\nexport { first } from './internal/operators/first';\nexport { groupBy, BasicGroupByOptions, GroupByOptionsWithElement } from './internal/operators/groupBy';\nexport { ignoreElements } from './internal/operators/ignoreElements';\nexport { isEmpty } from './internal/operators/isEmpty';\nexport { last } from './internal/operators/last';\nexport { map } from './internal/operators/map';\nexport { mapTo } from './internal/operators/mapTo';\nexport { materialize } from './internal/operators/materialize';\nexport { max } from './internal/operators/max';\nexport { mergeAll } from './internal/operators/mergeAll';\nexport { flatMap } from './internal/operators/flatMap';\nexport { mergeMap } from './internal/operators/mergeMap';\nexport { mergeMapTo } from './internal/operators/mergeMapTo';\nexport { mergeScan } from './internal/operators/mergeScan';\nexport { mergeWith } from './internal/operators/mergeWith';\nexport { min } from './internal/operators/min';\nexport { multicast } from './internal/operators/multicast';\nexport { observeOn } from './internal/operators/observeOn';\nexport { onErrorResumeNextWith } from './internal/operators/onErrorResumeNextWith';\nexport { pairwise } from './internal/operators/pairwise';\nexport { pluck } from './internal/operators/pluck';\nexport { publish } from './internal/operators/publish';\nexport { publishBehavior } from './internal/operators/publishBehavior';\nexport { publishLast } from './internal/operators/publishLast';\nexport { publishReplay } from './internal/operators/publishReplay';\nexport { raceWith } from './internal/operators/raceWith';\nexport { reduce } from './internal/operators/reduce';\nexport { repeat, RepeatConfig } from './internal/operators/repeat';\nexport { repeatWhen } from './internal/operators/repeatWhen';\nexport { retry, RetryConfig } from './internal/operators/retry';\nexport { retryWhen } from './internal/operators/retryWhen';\nexport { refCount } from './internal/operators/refCount';\nexport { sample } from './internal/operators/sample';\nexport { sampleTime } from './internal/operators/sampleTime';\nexport { scan } from './internal/operators/scan';\nexport { sequenceEqual } from './internal/operators/sequenceEqual';\nexport { share, ShareConfig } from './internal/operators/share';\nexport { shareReplay, ShareReplayConfig } from './internal/operators/shareReplay';\nexport { single } from './internal/operators/single';\nexport { skip } from './internal/operators/skip';\nexport { skipLast } from './internal/operators/skipLast';\nexport { skipUntil } from './internal/operators/skipUntil';\nexport { skipWhile } from './internal/operators/skipWhile';\nexport { startWith } from './internal/operators/startWith';\nexport { subscribeOn } from './internal/operators/subscribeOn';\nexport { switchAll } from './internal/operators/switchAll';\nexport { switchMap } from './internal/operators/switchMap';\nexport { switchMapTo } from './internal/operators/switchMapTo';\nexport { switchScan } from './internal/operators/switchScan';\nexport { take } from './internal/operators/take';\nexport { takeLast } from './internal/operators/takeLast';\nexport { takeUntil } from './internal/operators/takeUntil';\nexport { takeWhile } from './internal/operators/takeWhile';\nexport { tap, TapObserver } from './internal/operators/tap';\nexport { throttle, ThrottleConfig } from './internal/operators/throttle';\nexport { throttleTime } from './internal/operators/throttleTime';\nexport { throwIfEmpty } from './internal/operators/throwIfEmpty';\nexport { timeInterval } from './internal/operators/timeInterval';\nexport { timeout, TimeoutConfig, TimeoutInfo } from './internal/operators/timeout';\nexport { timeoutWith } from './internal/operators/timeoutWith';\nexport { timestamp } from './internal/operators/timestamp';\nexport { toArray } from './internal/operators/toArray';\nexport { window } from './internal/operators/window';\nexport { windowCount } from './internal/operators/windowCount';\nexport { windowTime } from './internal/operators/windowTime';\nexport { windowToggle } from './internal/operators/windowToggle';\nexport { windowWhen } from './internal/operators/windowWhen';\nexport { withLatestFrom } from './internal/operators/withLatestFrom';\nexport { zipAll } from './internal/operators/zipAll';\nexport { zipWith } from './internal/operators/zipWith';\n", "import { not } from '../util/not';\nimport { filter } from './filter';\nimport { Observable } from '../Observable';\nimport { UnaryFunction } from '../types';\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 * <span class=\"informal\">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.</span>\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 *\n * Partition click events into those on DIV elements and those elsewhere\n *\n * ```ts\n * import { fromEvent } from 'rxjs';\n * import { partition } from 'rxjs/operators';\n *\n * const div = document.createElement('div');\n * div.style.cssText = 'width: 200px; height: 200px; background: #09c;';\n * document.body.appendChild(div);\n *\n * const clicks = fromEvent(document, 'click');\n * const [clicksOnDivs, clicksElsewhere] = clicks.pipe(partition(ev => (<HTMLElement>ev.target).tagName === 'DIV'));\n *\n * clicksOnDivs.subscribe(x => console.log('DIV clicked: ', x));\n * clicksElsewhere.subscribe(x => console.log('Other clicked: ', x));\n * ```\n *\n * @see {@link filter}\n *\n * @param predicate A function that evaluates each value emitted by the source\n * Observable. If it returns `true`, the value is emitted on the first Observable\n * in the returned array, if `false` the value is emitted on the second Observable\n * in the array. The `index` parameter is the number `i` for the i-th source\n * emission that has happened since the subscription, starting from the number `0`.\n * @param thisArg An optional argument to determine the value of `this` in the\n * `predicate` function.\n * @return A function that returns an array with two Observables: one with\n * values that passed the predicate, and another with values that did not pass\n * the predicate.\n * @deprecated Replaced with the {@link partition} static creation function. Will be removed in v8.\n */\nexport function partition<T>(\n predicate: (value: T, index: number) => boolean,\n thisArg?: any\n): UnaryFunction<Observable<T>, [Observable<T>, Observable<T>]> {\n return (source: Observable<T>) =>\n [filter(predicate, thisArg)(source), filter(not(predicate, thisArg))(source)] as [Observable<T>, Observable<T>];\n}\n", "import { ObservableInputTuple, OperatorFunction } from '../types';\nimport { argsOrArgArray } from '../util/argsOrArgArray';\nimport { raceWith } from './raceWith';\n\n/** @deprecated Replaced with {@link raceWith}. Will be removed in v8. */\nexport function race<T, A extends readonly unknown[]>(otherSources: [...ObservableInputTuple<A>]): OperatorFunction<T, T | A[number]>;\n/** @deprecated Replaced with {@link raceWith}. Will be removed in v8. */\nexport function race<T, A extends readonly unknown[]>(...otherSources: [...ObservableInputTuple<A>]): OperatorFunction<T, T | A[number]>;\n\n/**\n * Returns an Observable that mirrors the first source Observable to emit a next,\n * error or complete notification from the combination of this Observable and supplied Observables.\n * @param args Sources used to race for which Observable emits first.\n * @return A function that returns an Observable that mirrors the output of the\n * first Observable to emit an item.\n * @deprecated Replaced with {@link raceWith}. Will be removed in v8.\n */\nexport function race<T>(...args: any[]): OperatorFunction<T, unknown> {\n return raceWith(...argsOrArgArray(args));\n}\n", "/* Operator exports */\nexport { audit } from '../internal/operators/audit';\nexport { auditTime } from '../internal/operators/auditTime';\nexport { buffer } from '../internal/operators/buffer';\nexport { bufferCount } from '../internal/operators/bufferCount';\nexport { bufferTime } from '../internal/operators/bufferTime';\nexport { bufferToggle } from '../internal/operators/bufferToggle';\nexport { bufferWhen } from '../internal/operators/bufferWhen';\nexport { catchError } from '../internal/operators/catchError';\nexport { combineAll } from '../internal/operators/combineAll';\nexport { combineLatestAll } from '../internal/operators/combineLatestAll';\nexport { combineLatest } from '../internal/operators/combineLatest';\nexport { combineLatestWith } from '../internal/operators/combineLatestWith';\nexport { concat } from '../internal/operators/concat';\nexport { concatAll } from '../internal/operators/concatAll';\nexport { concatMap } from '../internal/operators/concatMap';\nexport { concatMapTo } from '../internal/operators/concatMapTo';\nexport { concatWith } from '../internal/operators/concatWith';\nexport { connect, ConnectConfig } from '../internal/operators/connect';\nexport { count } from '../internal/operators/count';\nexport { debounce } from '../internal/operators/debounce';\nexport { debounceTime } from '../internal/operators/debounceTime';\nexport { defaultIfEmpty } from '../internal/operators/defaultIfEmpty';\nexport { delay } from '../internal/operators/delay';\nexport { delayWhen } from '../internal/operators/delayWhen';\nexport { dematerialize } from '../internal/operators/dematerialize';\nexport { distinct } from '../internal/operators/distinct';\nexport { distinctUntilChanged } from '../internal/operators/distinctUntilChanged';\nexport { distinctUntilKeyChanged } from '../internal/operators/distinctUntilKeyChanged';\nexport { elementAt } from '../internal/operators/elementAt';\nexport { endWith } from '../internal/operators/endWith';\nexport { every } from '../internal/operators/every';\nexport { exhaust } from '../internal/operators/exhaust';\nexport { exhaustAll } from '../internal/operators/exhaustAll';\nexport { exhaustMap } from '../internal/operators/exhaustMap';\nexport { expand } from '../internal/operators/expand';\nexport { filter } from '../internal/operators/filter';\nexport { finalize } from '../internal/operators/finalize';\nexport { find } from '../internal/operators/find';\nexport { findIndex } from '../internal/operators/findIndex';\nexport { first } from '../internal/operators/first';\nexport { groupBy, BasicGroupByOptions, GroupByOptionsWithElement } from '../internal/operators/groupBy';\nexport { ignoreElements } from '../internal/operators/ignoreElements';\nexport { isEmpty } from '../internal/operators/isEmpty';\nexport { last } from '../internal/operators/last';\nexport { map } from '../internal/operators/map';\nexport { mapTo } from '../internal/operators/mapTo';\nexport { materialize } from '../internal/operators/materialize';\nexport { max } from '../internal/operators/max';\nexport { merge } from '../internal/operators/merge';\nexport { mergeAll } from '../internal/operators/mergeAll';\nexport { flatMap } from '../internal/operators/flatMap';\nexport { mergeMap } from '../internal/operators/mergeMap';\nexport { mergeMapTo } from '../internal/operators/mergeMapTo';\nexport { mergeScan } from '../internal/operators/mergeScan';\nexport { mergeWith } from '../internal/operators/mergeWith';\nexport { min } from '../internal/operators/min';\nexport { multicast } from '../internal/operators/multicast';\nexport { observeOn } from '../internal/operators/observeOn';\nexport { onErrorResumeNext } from '../internal/operators/onErrorResumeNextWith';\nexport { pairwise } from '../internal/operators/pairwise';\nexport { partition } from '../internal/operators/partition';\nexport { pluck } from '../internal/operators/pluck';\nexport { publish } from '../internal/operators/publish';\nexport { publishBehavior } from '../internal/operators/publishBehavior';\nexport { publishLast } from '../internal/operators/publishLast';\nexport { publishReplay } from '../internal/operators/publishReplay';\nexport { race } from '../internal/operators/race';\nexport { raceWith } from '../internal/operators/raceWith';\nexport { reduce } from '../internal/operators/reduce';\nexport { repeat, RepeatConfig } from '../internal/operators/repeat';\nexport { repeatWhen } from '../internal/operators/repeatWhen';\nexport { retry, RetryConfig } from '../internal/operators/retry';\nexport { retryWhen } from '../internal/operators/retryWhen';\nexport { refCount } from '../internal/operators/refCount';\nexport { sample } from '../internal/operators/sample';\nexport { sampleTime } from '../internal/operators/sampleTime';\nexport { scan } from '../internal/operators/scan';\nexport { sequenceEqual } from '../internal/operators/sequenceEqual';\nexport { share, ShareConfig } from '../internal/operators/share';\nexport { shareReplay, ShareReplayConfig } from '../internal/operators/shareReplay';\nexport { single } from '../internal/operators/single';\nexport { skip } from '../internal/operators/skip';\nexport { skipLast } from '../internal/operators/skipLast';\nexport { skipUntil } from '../internal/operators/skipUntil';\nexport { skipWhile } from '../internal/operators/skipWhile';\nexport { startWith } from '../internal/operators/startWith';\nexport { subscribeOn } from '../internal/operators/subscribeOn';\nexport { switchAll } from '../internal/operators/switchAll';\nexport { switchMap } from '../internal/operators/switchMap';\nexport { switchMapTo } from '../internal/operators/switchMapTo';\nexport { switchScan } from '../internal/operators/switchScan';\nexport { take } from '../internal/operators/take';\nexport { takeLast } from '../internal/operators/takeLast';\nexport { takeUntil } from '../internal/operators/takeUntil';\nexport { takeWhile } from '../internal/operators/takeWhile';\nexport { tap, TapObserver } from '../internal/operators/tap';\nexport { throttle, ThrottleConfig } from '../internal/operators/throttle';\nexport { throttleTime } from '../internal/operators/throttleTime';\nexport { throwIfEmpty } from '../internal/operators/throwIfEmpty';\nexport { timeInterval } from '../internal/operators/timeInterval';\nexport { timeout, TimeoutConfig, TimeoutInfo } from '../internal/operators/timeout';\nexport { timeoutWith } from '../internal/operators/timeoutWith';\nexport { timestamp } from '../internal/operators/timestamp';\nexport { toArray } from '../internal/operators/toArray';\nexport { window } from '../internal/operators/window';\nexport { windowCount } from '../internal/operators/windowCount';\nexport { windowTime } from '../internal/operators/windowTime';\nexport { windowToggle } from '../internal/operators/windowToggle';\nexport { windowWhen } from '../internal/operators/windowWhen';\nexport { withLatestFrom } from '../internal/operators/withLatestFrom';\nexport { zip } from '../internal/operators/zip';\nexport { zipAll } from '../internal/operators/zipAll';\nexport { zipWith } from '../internal/operators/zipWith';\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n// IMPORTANT: these imports must be type-only\nimport type {Directive, DirectiveResult, PartInfo} from './directive.js';\n\nconst DEV_MODE = true;\nconst ENABLE_EXTRA_SECURITY_HOOKS = true;\nconst ENABLE_SHADYDOM_NOPATCH = true;\nconst NODE_MODE = false;\n// Use window for browser builds because IE11 doesn't have globalThis.\nconst global = NODE_MODE ? globalThis : window;\n\n/**\n * Contains types that are part of the unstable debug API.\n *\n * Everything in this API is not stable and may change or be removed in the future,\n * even on patch releases.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace LitUnstable {\n /**\n * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true,\n * we will emit 'lit-debug' events to window, with live details about the update and render\n * lifecycle. These can be useful for writing debug tooling and visualizations.\n *\n * Please be aware that running with window.emitLitDebugLogEvents has performance overhead,\n * making certain operations that are normally very cheap (like a no-op render) much slower,\n * because we must copy data and dispatch events.\n */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace DebugLog {\n export type Entry =\n | TemplatePrep\n | TemplateInstantiated\n | TemplateInstantiatedAndUpdated\n | TemplateUpdating\n | BeginRender\n | EndRender\n | CommitPartEntry\n | SetPartValue;\n export interface TemplatePrep {\n kind: 'template prep';\n template: Template;\n strings: TemplateStringsArray;\n clonableTemplate: HTMLTemplateElement;\n parts: TemplatePart[];\n }\n export interface BeginRender {\n kind: 'begin render';\n id: number;\n value: unknown;\n container: HTMLElement | DocumentFragment;\n options: RenderOptions | undefined;\n part: ChildPart | undefined;\n }\n export interface EndRender {\n kind: 'end render';\n id: number;\n value: unknown;\n container: HTMLElement | DocumentFragment;\n options: RenderOptions | undefined;\n part: ChildPart;\n }\n export interface TemplateInstantiated {\n kind: 'template instantiated';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n fragment: Node;\n parts: Array<Part | undefined>;\n values: unknown[];\n }\n export interface TemplateInstantiatedAndUpdated {\n kind: 'template instantiated and updated';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n fragment: Node;\n parts: Array<Part | undefined>;\n values: unknown[];\n }\n export interface TemplateUpdating {\n kind: 'template updating';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n parts: Array<Part | undefined>;\n values: unknown[];\n }\n export interface SetPartValue {\n kind: 'set part';\n part: Part;\n value: unknown;\n valueIndex: number;\n values: unknown[];\n templateInstance: TemplateInstance;\n }\n\n export type CommitPartEntry =\n | CommitNothingToChildEntry\n | CommitText\n | CommitNode\n | CommitAttribute\n | CommitProperty\n | CommitBooleanAttribute\n | CommitEventListener\n | CommitToElementBinding;\n\n export interface CommitNothingToChildEntry {\n kind: 'commit nothing to child';\n start: ChildNode;\n end: ChildNode | null;\n parent: Disconnectable | undefined;\n options: RenderOptions | undefined;\n }\n\n export interface CommitText {\n kind: 'commit text';\n node: Text;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitNode {\n kind: 'commit node';\n start: Node;\n parent: Disconnectable | undefined;\n value: Node;\n options: RenderOptions | undefined;\n }\n\n export interface CommitAttribute {\n kind: 'commit attribute';\n element: Element;\n name: string;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitProperty {\n kind: 'commit property';\n element: Element;\n name: string;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitBooleanAttribute {\n kind: 'commit boolean attribute';\n element: Element;\n name: string;\n value: boolean;\n options: RenderOptions | undefined;\n }\n\n export interface CommitEventListener {\n kind: 'commit event listener';\n element: Element;\n name: string;\n value: unknown;\n oldListener: unknown;\n options: RenderOptions | undefined;\n // True if we're removing the old event listener (e.g. because settings changed, or value is nothing)\n removeListener: boolean;\n // True if we're adding a new event listener (e.g. because first render, or settings changed)\n addListener: boolean;\n }\n\n export interface CommitToElementBinding {\n kind: 'commit to element binding';\n element: Element;\n value: unknown;\n options: RenderOptions | undefined;\n }\n }\n}\n\ninterface DebugLoggingWindow {\n // Even in dev mode, we generally don't want to emit these events, as that's\n // another level of cost, so only emit them when DEV_MODE is true _and_ when\n // window.emitLitDebugEvents is true.\n emitLitDebugLogEvents?: boolean;\n}\n\n/**\n * Useful for visualizing and logging insights into what the Lit template system is doing.\n *\n * Compiled out of prod mode builds.\n */\nconst debugLogEvent = DEV_MODE\n ? (event: LitUnstable.DebugLog.Entry) => {\n const shouldEmit = (global as unknown as DebugLoggingWindow)\n .emitLitDebugLogEvents;\n if (!shouldEmit) {\n return;\n }\n global.dispatchEvent(\n new CustomEvent<LitUnstable.DebugLog.Entry>('lit-debug', {\n detail: event,\n })\n );\n }\n : undefined;\n// Used for connecting beginRender and endRender events when there are nested\n// renders when errors are thrown preventing an endRender event from being\n// called.\nlet debugLogRenderId = 0;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nif (DEV_MODE) {\n global.litIssuedWarnings ??= new Set();\n\n // Issue a warning, if we haven't already.\n issueWarning = (code: string, warning: string) => {\n warning += code\n ? ` See https://lit.dev/msg/${code} for more information.`\n : '';\n if (!global.litIssuedWarnings!.has(warning)) {\n console.warn(warning);\n global.litIssuedWarnings!.add(warning);\n }\n };\n\n issueWarning(\n 'dev-mode',\n `Lit is in dev mode. Not recommended for production!`\n );\n}\n\nconst wrap =\n ENABLE_SHADYDOM_NOPATCH &&\n global.ShadyDOM?.inUse &&\n global.ShadyDOM?.noPatch === true\n ? global.ShadyDOM!.wrap\n : (node: Node) => node;\n\nconst trustedTypes = (global as unknown as Partial<Window>).trustedTypes;\n\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = trustedTypes\n ? trustedTypes.createPolicy('lit-html', {\n createHTML: (s) => s,\n })\n : undefined;\n\n/**\n * Used to sanitize any value before it is written into the DOM. This can be\n * used to implement a security policy of allowed and disallowed values in\n * order to prevent XSS attacks.\n *\n * One way of using this callback would be to check attributes and properties\n * against a list of high risk fields, and require that values written to such\n * fields be instances of a class which is safe by construction. Closure's Safe\n * HTML Types is one implementation of this technique (\n * https://github.com/google/safe-html-types/blob/master/doc/safehtml-types.md).\n * The TrustedTypes polyfill in API-only mode could also be used as a basis\n * for this technique (https://github.com/WICG/trusted-types).\n *\n * @param node The HTML node (usually either a #text node or an Element) that\n * is being written to. Note that this is just an exemplar node, the write\n * may take place against another instance of the same class of node.\n * @param name The name of an attribute or property (for example, 'href').\n * @param type Indicates whether the write that's about to be performed will\n * be to a property or a node.\n * @return A function that will sanitize this class of writes.\n */\nexport type SanitizerFactory = (\n node: Node,\n name: string,\n type: 'property' | 'attribute'\n) => ValueSanitizer;\n\n/**\n * A function which can sanitize values that will be written to a specific kind\n * of DOM sink.\n *\n * See SanitizerFactory.\n *\n * @param value The value to sanitize. Will be the actual value passed into\n * the lit-html template literal, so this could be of any type.\n * @return The value to write to the DOM. Usually the same as the input value,\n * unless sanitization is needed.\n */\nexport type ValueSanitizer = (value: unknown) => unknown;\n\nconst identityFunction: ValueSanitizer = (value: unknown) => value;\nconst noopSanitizer: SanitizerFactory = (\n _node: Node,\n _name: string,\n _type: 'property' | 'attribute'\n) => identityFunction;\n\n/** Sets the global sanitizer factory. */\nconst setSanitizer = (newSanitizer: SanitizerFactory) => {\n if (!ENABLE_EXTRA_SECURITY_HOOKS) {\n return;\n }\n if (sanitizerFactoryInternal !== noopSanitizer) {\n throw new Error(\n `Attempted to overwrite existing lit-html security policy.` +\n ` setSanitizeDOMValueFactory should be called at most once.`\n );\n }\n sanitizerFactoryInternal = newSanitizer;\n};\n\n/**\n * Only used in internal tests, not a part of the public API.\n */\nconst _testOnlyClearSanitizerFactoryDoNotCallOrElse = () => {\n sanitizerFactoryInternal = noopSanitizer;\n};\n\nconst createSanitizer: SanitizerFactory = (node, name, type) => {\n return sanitizerFactoryInternal(node, name, type);\n};\n\n// Added to an attribute name to mark the attribute as bound so we can find\n// it easily.\nconst boundAttributeSuffix = '$lit$';\n\n// This marker is used in many syntactic positions in HTML, so it must be\n// a valid element name and attribute name. We don't support dynamic names (yet)\n// but this at least ensures that the parse tree is closer to the template\n// intention.\nconst marker = `lit$${String(Math.random()).slice(9)}$`;\n\n// String used to tell if a comment is a marker comment\nconst markerMatch = '?' + marker;\n\n// Text used to insert a comment marker node. We use processing instruction\n// syntax because it's slightly smaller, but parses as a comment node.\nconst nodeMarker = `<${markerMatch}>`;\n\nconst d =\n NODE_MODE && global.document === undefined\n ? ({\n createTreeWalker() {\n return {};\n },\n } as unknown as Document)\n : document;\n\n// Creates a dynamic marker. We never have to search for these in the DOM.\nconst createMarker = (v = '') => d.createComment(v);\n\n// https://tc39.github.io/ecma262/#sec-typeof-operator\ntype Primitive = null | undefined | boolean | number | string | symbol | bigint;\nconst isPrimitive = (value: unknown): value is Primitive =>\n value === null || (typeof value != 'object' && typeof value != 'function');\nconst isArray = Array.isArray;\nconst isIterable = (value: unknown): value is Iterable<unknown> =>\n isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n typeof (value as any)?.[Symbol.iterator] === 'function';\n\nconst SPACE_CHAR = `[ \\t\\n\\f\\r]`;\nconst ATTR_VALUE_CHAR = `[^ \\t\\n\\f\\r\"'\\`<>=]`;\nconst NAME_CHAR = `[^\\\\s\"'>=/]`;\n\n// These regexes represent the five parsing states that we care about in the\n// Template's HTML scanner. They match the *end* of the state they're named\n// after.\n// Depending on the match, we transition to a new state. If there's no match,\n// we stay in the same state.\n// Note that the regexes are stateful. We utilize lastIndex and sync it\n// across the multiple regexes used. In addition to the five regexes below\n// we also dynamically create a regex to find the matching end tags for raw\n// text elements.\n\n/**\n * End of text is: `<` followed by:\n * (comment start) or (tag) or (dynamic tag binding)\n */\nconst textEndRegex = /<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g;\nconst COMMENT_START = 1;\nconst TAG_NAME = 2;\nconst DYNAMIC_TAG_NAME = 3;\n\nconst commentEndRegex = /-->/g;\n/**\n * Comments not started with <!--, like </{, can be ended by a single `>`\n */\nconst comment2EndRegex = />/g;\n\n/**\n * The tagEnd regex matches the end of the \"inside an opening\" tag syntax\n * position. It either matches a `>`, an attribute-like sequence, or the end\n * of the string after a space (attribute-name position ending).\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\t\\n\\f\\r\" are HTML space characters:\n * https://infra.spec.whatwg.org/#ascii-whitespace\n *\n * So an attribute is:\n * * The name: any character except a whitespace character, (\"), ('), \">\",\n * \"=\", or \"/\". Note: this is different from the HTML spec which also excludes control characters.\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nconst tagEndRegex = new RegExp(\n `>|${SPACE_CHAR}(?:(${NAME_CHAR}+)(${SPACE_CHAR}*=${SPACE_CHAR}*(?:${ATTR_VALUE_CHAR}|(\"|')|))|$)`,\n 'g'\n);\nconst ENTIRE_MATCH = 0;\nconst ATTRIBUTE_NAME = 1;\nconst SPACES_AND_EQUALS = 2;\nconst QUOTE_CHAR = 3;\n\nconst singleQuoteAttrEndRegex = /'/g;\nconst doubleQuoteAttrEndRegex = /\"/g;\n/**\n * Matches the raw text elements.\n *\n * Comments are not parsed within raw text elements, so we need to search their\n * text content for marker strings.\n */\nconst rawTextElement = /^(?:script|style|textarea|title)$/i;\n\n/** TemplateResult types */\nconst HTML_RESULT = 1;\nconst SVG_RESULT = 2;\n\ntype ResultType = typeof HTML_RESULT | typeof SVG_RESULT;\n\n// TemplatePart types\n// IMPORTANT: these must match the values in PartType\nconst ATTRIBUTE_PART = 1;\nconst CHILD_PART = 2;\nconst PROPERTY_PART = 3;\nconst BOOLEAN_ATTRIBUTE_PART = 4;\nconst EVENT_PART = 5;\nconst ELEMENT_PART = 6;\nconst COMMENT_PART = 7;\n\n/**\n * The return type of the template tag functions, {@linkcode html} and\n * {@linkcode svg}.\n *\n * A `TemplateResult` object holds all the information about a template\n * expression required to render it: the template strings, expression values,\n * and type of template (html or svg).\n *\n * `TemplateResult` objects do not create any DOM on their own. To create or\n * update DOM you need to render the `TemplateResult`. See\n * [Rendering](https://lit.dev/docs/components/rendering) for more information.\n *\n */\nexport type TemplateResult<T extends ResultType = ResultType> = {\n // This property needs to remain unminified.\n ['_$litType$']: T;\n strings: TemplateStringsArray;\n values: unknown[];\n};\n\nexport type HTMLTemplateResult = TemplateResult<typeof HTML_RESULT>;\n\nexport type SVGTemplateResult = TemplateResult<typeof SVG_RESULT>;\n\nexport interface CompiledTemplateResult {\n // This is a factory in order to make template initialization lazy\n // and allow ShadyRenderOptions scope to be passed in.\n // This property needs to remain unminified.\n ['_$litType$']: CompiledTemplate;\n values: unknown[];\n}\n\nexport interface CompiledTemplate extends Omit<Template, 'el'> {\n // el is overridden to be optional. We initialize it on first render\n el?: HTMLTemplateElement;\n\n // The prepared HTML string to create a template element from.\n h: TrustedHTML;\n}\n\n/**\n * Generates a template literal tag function that returns a TemplateResult with\n * the given result type.\n */\nconst tag =\n <T extends ResultType>(type: T) =>\n (strings: TemplateStringsArray, ...values: unknown[]): TemplateResult<T> => {\n // Warn against templates octal escape sequences\n // We do this here rather than in render so that the warning is closer to the\n // template definition.\n if (DEV_MODE && strings.some((s) => s === undefined)) {\n console.warn(\n 'Some template strings are undefined.\\n' +\n 'This is probably caused by illegal octal escape sequences.'\n );\n }\n return {\n // This property needs to remain unminified.\n ['_$litType$']: type,\n strings,\n values,\n };\n };\n\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n *\n * ```ts\n * const header = (title: string) => html`<h1>${title}</h1>`;\n * ```\n *\n * The `html` tag returns a description of the DOM to render as a value. It is\n * lazy, meaning no work is done until the template is rendered. When rendering,\n * if a template comes from the same expression as a previously rendered result,\n * it's efficiently updated instead of replaced.\n */\nexport const html = tag(HTML_RESULT);\n\n/**\n * Interprets a template literal as an SVG fragment that can efficiently\n * render to and update a container.\n *\n * ```ts\n * const rect = svg`<rect width=\"10\" height=\"10\"></rect>`;\n *\n * const myImage = html`\n * <svg viewBox=\"0 0 10 10\" xmlns=\"http://www.w3.org/2000/svg\">\n * ${rect}\n * </svg>`;\n * ```\n *\n * The `svg` *tag function* should only be used for SVG fragments, or elements\n * that would be contained **inside** an `<svg>` HTML element. A common error is\n * placing an `<svg>` *element* in a template tagged with the `svg` tag\n * function. The `<svg>` element is an HTML element and should be used within a\n * template tagged with the {@linkcode html} tag function.\n *\n * In LitElement usage, it's invalid to return an SVG fragment from the\n * `render()` method, as the SVG fragment will be contained within the element's\n * shadow root and thus cannot be used within an `<svg>` HTML element.\n */\nexport const svg = tag(SVG_RESULT);\n\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = Symbol.for('lit-noChange');\n\n/**\n * A sentinel value that signals a ChildPart to fully clear its content.\n *\n * ```ts\n * const button = html`${\n * user.isAdmin\n * ? html`<button>DELETE</button>`\n * : nothing\n * }`;\n * ```\n *\n * Prefer using `nothing` over other falsy values as it provides a consistent\n * behavior between various expression binding contexts.\n *\n * In child expressions, `undefined`, `null`, `''`, and `nothing` all behave the\n * same and render no nodes. In attribute expressions, `nothing` _removes_ the\n * attribute, while `undefined` and `null` will render an empty string. In\n * property expressions `nothing` becomes `undefined`.\n */\nexport const nothing = Symbol.for('lit-nothing');\n\n/**\n * The cache of prepared templates, keyed by the tagged TemplateStringsArray\n * and _not_ accounting for the specific template tag used. This means that\n * template tags cannot be dynamic - the must statically be one of html, svg,\n * or attr. This restriction simplifies the cache lookup, which is on the hot\n * path for rendering.\n */\nconst templateCache = new WeakMap<TemplateStringsArray, Template>();\n\n/**\n * Object specifying options for controlling lit-html rendering. Note that\n * while `render` may be called multiple times on the same `container` (and\n * `renderBefore` reference node) to efficiently update the rendered content,\n * only the options passed in during the first render are respected during\n * the lifetime of renders to that unique `container` + `renderBefore`\n * combination.\n */\nexport interface RenderOptions {\n /**\n * An object to use as the `this` value for event listeners. It's often\n * useful to set this to the host component rendering a template.\n */\n host?: object;\n /**\n * A DOM node before which to render content in the container.\n */\n renderBefore?: ChildNode | null;\n /**\n * Node used for cloning the template (`importNode` will be called on this\n * node). This controls the `ownerDocument` of the rendered DOM, along with\n * any inherited context. Defaults to the global `document`.\n */\n creationScope?: {importNode(node: Node, deep?: boolean): Node};\n /**\n * The initial connected state for the top-level part being rendered. If no\n * `isConnected` option is set, `AsyncDirective`s will be connected by\n * default. Set to `false` if the initial render occurs in a disconnected tree\n * and `AsyncDirective`s should see `isConnected === false` for their initial\n * render. The `part.setConnected()` method must be used subsequent to initial\n * render to change the connected state of the part.\n */\n isConnected?: boolean;\n}\n\nconst walker = d.createTreeWalker(\n d,\n 129 /* NodeFilter.SHOW_{ELEMENT|COMMENT} */,\n null,\n false\n);\n\nlet sanitizerFactoryInternal: SanitizerFactory = noopSanitizer;\n\n//\n// Classes only below here, const variable declarations only above here...\n//\n// Keeping variable declarations and classes together improves minification.\n// Interfaces and type aliases can be interleaved freely.\n//\n\n// Type for classes that have a `_directive` or `_directives[]` field, used by\n// `resolveDirective`\nexport interface DirectiveParent {\n _$parent?: DirectiveParent;\n _$isConnected: boolean;\n __directive?: Directive;\n __directives?: Array<Directive | undefined>;\n}\n\n/**\n * Returns an HTML string for the given TemplateStringsArray and result type\n * (HTML or SVG), along with the case-sensitive bound attribute names in\n * template order. The HTML contains comment markers denoting the `ChildPart`s\n * and suffixes on bound attributes denoting the `AttributeParts`.\n *\n * @param strings template strings array\n * @param type HTML or SVG\n * @return Array containing `[html, attrNames]` (array returned for terseness,\n * to avoid object fields since this code is shared with non-minified SSR\n * code)\n */\nconst getTemplateHtml = (\n strings: TemplateStringsArray,\n type: ResultType\n): [TrustedHTML, Array<string | undefined>] => {\n // Insert makers into the template HTML to represent the position of\n // bindings. The following code scans the template strings to determine the\n // syntactic position of the bindings. They can be in text position, where\n // we insert an HTML comment, attribute value position, where we insert a\n // sentinel string and re-write the attribute name, or inside a tag where\n // we insert the sentinel string.\n const l = strings.length - 1;\n // Stores the case-sensitive bound attribute names in the order of their\n // parts. ElementParts are also reflected in this array as undefined\n // rather than a string, to disambiguate from attribute bindings.\n const attrNames: Array<string | undefined> = [];\n let html = type === SVG_RESULT ? '<svg>' : '';\n\n // When we're inside a raw text tag (not it's text content), the regex\n // will still be tagRegex so we can find attributes, but will switch to\n // this regex when the tag ends.\n let rawTextEndRegex: RegExp | undefined;\n\n // The current parsing state, represented as a reference to one of the\n // regexes\n let regex = textEndRegex;\n\n for (let i = 0; i < l; i++) {\n const s = strings[i];\n // The index of the end of the last attribute name. When this is\n // positive at end of a string, it means we're in an attribute value\n // position and need to rewrite the attribute name.\n // We also use a special value of -2 to indicate that we encountered\n // the end of a string in attribute name position.\n let attrNameEndIndex = -1;\n let attrName: string | undefined;\n let lastIndex = 0;\n let match!: RegExpExecArray | null;\n\n // The conditions in this loop handle the current parse state, and the\n // assignments to the `regex` variable are the state transitions.\n while (lastIndex < s.length) {\n // Make sure we start searching from where we previously left off\n regex.lastIndex = lastIndex;\n match = regex.exec(s);\n if (match === null) {\n break;\n }\n lastIndex = regex.lastIndex;\n if (regex === textEndRegex) {\n if (match[COMMENT_START] === '!--') {\n regex = commentEndRegex;\n } else if (match[COMMENT_START] !== undefined) {\n // We started a weird comment, like </{\n regex = comment2EndRegex;\n } else if (match[TAG_NAME] !== undefined) {\n if (rawTextElement.test(match[TAG_NAME])) {\n // Record if we encounter a raw-text element. We'll switch to\n // this regex at the end of the tag.\n rawTextEndRegex = new RegExp(`</${match[TAG_NAME]}`, 'g');\n }\n regex = tagEndRegex;\n } else if (match[DYNAMIC_TAG_NAME] !== undefined) {\n if (DEV_MODE) {\n throw new Error(\n 'Bindings in tag names are not supported. Please use static templates instead. ' +\n 'See https://lit.dev/docs/templates/expressions/#static-expressions'\n );\n }\n regex = tagEndRegex;\n }\n } else if (regex === tagEndRegex) {\n if (match[ENTIRE_MATCH] === '>') {\n // End of a tag. If we had started a raw-text element, use that\n // regex\n regex = rawTextEndRegex ?? textEndRegex;\n // We may be ending an unquoted attribute value, so make sure we\n // clear any pending attrNameEndIndex\n attrNameEndIndex = -1;\n } else if (match[ATTRIBUTE_NAME] === undefined) {\n // Attribute name position\n attrNameEndIndex = -2;\n } else {\n attrNameEndIndex = regex.lastIndex - match[SPACES_AND_EQUALS].length;\n attrName = match[ATTRIBUTE_NAME];\n regex =\n match[QUOTE_CHAR] === undefined\n ? tagEndRegex\n : match[QUOTE_CHAR] === '\"'\n ? doubleQuoteAttrEndRegex\n : singleQuoteAttrEndRegex;\n }\n } else if (\n regex === doubleQuoteAttrEndRegex ||\n regex === singleQuoteAttrEndRegex\n ) {\n regex = tagEndRegex;\n } else if (regex === commentEndRegex || regex === comment2EndRegex) {\n regex = textEndRegex;\n } else {\n // Not one of the five state regexes, so it must be the dynamically\n // created raw text regex and we're at the close of that element.\n regex = tagEndRegex;\n rawTextEndRegex = undefined;\n }\n }\n\n if (DEV_MODE) {\n // If we have a attrNameEndIndex, which indicates that we should\n // rewrite the attribute name, assert that we're in a valid attribute\n // position - either in a tag, or a quoted attribute value.\n console.assert(\n attrNameEndIndex === -1 ||\n regex === tagEndRegex ||\n regex === singleQuoteAttrEndRegex ||\n regex === doubleQuoteAttrEndRegex,\n 'unexpected parse state B'\n );\n }\n\n // We have four cases:\n // 1. We're in text position, and not in a raw text element\n // (regex === textEndRegex): insert a comment marker.\n // 2. We have a non-negative attrNameEndIndex which means we need to\n // rewrite the attribute name to add a bound attribute suffix.\n // 3. We're at the non-first binding in a multi-binding attribute, use a\n // plain marker.\n // 4. We're somewhere else inside the tag. If we're in attribute name\n // position (attrNameEndIndex === -2), add a sequential suffix to\n // generate a unique attribute name.\n\n // Detect a binding next to self-closing tag end and insert a space to\n // separate the marker from the tag end:\n const end =\n regex === tagEndRegex && strings[i + 1].startsWith('/>') ? ' ' : '';\n html +=\n regex === textEndRegex\n ? s + nodeMarker\n : attrNameEndIndex >= 0\n ? (attrNames.push(attrName!),\n s.slice(0, attrNameEndIndex) +\n boundAttributeSuffix +\n s.slice(attrNameEndIndex)) +\n marker +\n end\n : s +\n marker +\n (attrNameEndIndex === -2 ? (attrNames.push(undefined), i) : end);\n }\n\n const htmlResult: string | TrustedHTML =\n html + (strings[l] || '<?>') + (type === SVG_RESULT ? '</svg>' : '');\n\n // A security check to prevent spoofing of Lit template results.\n // In the future, we may be able to replace this with Array.isTemplateObject,\n // though we might need to make that check inside of the html and svg\n // functions, because precompiled templates don't come in as\n // TemplateStringArray objects.\n if (!Array.isArray(strings) || !strings.hasOwnProperty('raw')) {\n let message = 'invalid template strings array';\n if (DEV_MODE) {\n message = `\n Internal Error: expected template strings to be an array\n with a 'raw' field. Faking a template strings array by\n calling html or svg like an ordinary function is effectively\n the same as calling unsafeHtml and can lead to major security\n issues, e.g. opening your code up to XSS attacks.\n\n If you're using the html or svg tagged template functions normally\n and and still seeing this error, please file a bug at\n https://github.com/lit/lit/issues/new?template=bug_report.md\n and include information about your build tooling, if any.\n `\n .trim()\n .replace(/\\n */g, '\\n');\n }\n throw new Error(message);\n }\n // Returned as an array for terseness\n return [\n policy !== undefined\n ? policy.createHTML(htmlResult)\n : (htmlResult as unknown as TrustedHTML),\n attrNames,\n ];\n};\n\n/** @internal */\nexport type {Template};\nclass Template {\n /** @internal */\n el!: HTMLTemplateElement;\n /** @internal */\n parts: Array<TemplatePart> = [];\n\n constructor(\n // This property needs to remain unminified.\n {strings, ['_$litType$']: type}: TemplateResult,\n options?: RenderOptions\n ) {\n let node: Node | null;\n let nodeIndex = 0;\n let attrNameIndex = 0;\n const partCount = strings.length - 1;\n const parts = this.parts;\n\n // Create template element\n const [html, attrNames] = getTemplateHtml(strings, type);\n this.el = Template.createElement(html, options);\n walker.currentNode = this.el.content;\n\n // Reparent SVG nodes into template root\n if (type === SVG_RESULT) {\n const content = this.el.content;\n const svgElement = content.firstChild!;\n svgElement.remove();\n content.append(...svgElement.childNodes);\n }\n\n // Walk the template to find binding markers and create TemplateParts\n while ((node = walker.nextNode()) !== null && parts.length < partCount) {\n if (node.nodeType === 1) {\n if (DEV_MODE) {\n const tag = (node as Element).localName;\n // Warn if `textarea` includes an expression and throw if `template`\n // does since these are not supported. We do this by checking\n // innerHTML for anything that looks like a marker. This catches\n // cases like bindings in textarea there markers turn into text nodes.\n if (\n /^(?:textarea|template)$/i!.test(tag) &&\n (node as Element).innerHTML.includes(marker)\n ) {\n const m =\n `Expressions are not supported inside \\`${tag}\\` ` +\n `elements. See https://lit.dev/msg/expression-in-${tag} for more ` +\n `information.`;\n if (tag === 'template') {\n throw new Error(m);\n } else issueWarning('', m);\n }\n }\n // TODO (justinfagnani): for attempted dynamic tag names, we don't\n // increment the bindingIndex, and it'll be off by 1 in the element\n // and off by two after it.\n if ((node as Element).hasAttributes()) {\n // We defer removing bound attributes because on IE we might not be\n // iterating attributes in their template order, and would sometimes\n // remove an attribute that we still need to create a part for.\n const attrsToRemove = [];\n for (const name of (node as Element).getAttributeNames()) {\n // `name` is the name of the attribute we're iterating over, but not\n // _neccessarily_ the name of the attribute we will create a part\n // for. They can be different in browsers that don't iterate on\n // attributes in source order. In that case the attrNames array\n // contains the attribute name we'll process next. We only need the\n // attribute name here to know if we should process a bound attribute\n // on this element.\n if (\n name.endsWith(boundAttributeSuffix) ||\n name.startsWith(marker)\n ) {\n const realName = attrNames[attrNameIndex++];\n attrsToRemove.push(name);\n if (realName !== undefined) {\n // Lowercase for case-sensitive SVG attributes like viewBox\n const value = (node as Element).getAttribute(\n realName.toLowerCase() + boundAttributeSuffix\n )!;\n const statics = value.split(marker);\n const m = /([.?@])?(.*)/.exec(realName)!;\n parts.push({\n type: ATTRIBUTE_PART,\n index: nodeIndex,\n name: m[2],\n strings: statics,\n ctor:\n m[1] === '.'\n ? PropertyPart\n : m[1] === '?'\n ? BooleanAttributePart\n : m[1] === '@'\n ? EventPart\n : AttributePart,\n });\n } else {\n parts.push({\n type: ELEMENT_PART,\n index: nodeIndex,\n });\n }\n }\n }\n for (const name of attrsToRemove) {\n (node as Element).removeAttribute(name);\n }\n }\n // TODO (justinfagnani): benchmark the regex against testing for each\n // of the 3 raw text element names.\n if (rawTextElement.test((node as Element).tagName)) {\n // For raw text elements we need to split the text content on\n // markers, create a Text node for each segment, and create\n // a TemplatePart for each marker.\n const strings = (node as Element).textContent!.split(marker);\n const lastIndex = strings.length - 1;\n if (lastIndex > 0) {\n (node as Element).textContent = trustedTypes\n ? (trustedTypes.emptyScript as unknown as '')\n : '';\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for node parts\n // We can't use empty text nodes as markers because they're\n // normalized when cloning in IE (could simplify when\n // IE is no longer supported)\n for (let i = 0; i < lastIndex; i++) {\n (node as Element).append(strings[i], createMarker());\n // Walk past the marker node we just added\n walker.nextNode();\n parts.push({type: CHILD_PART, index: ++nodeIndex});\n }\n // Note because this marker is added after the walker's current\n // node, it will be walked to in the outer loop (and ignored), so\n // we don't need to adjust nodeIndex here\n (node as Element).append(strings[lastIndex], createMarker());\n }\n }\n } else if (node.nodeType === 8) {\n const data = (node as Comment).data;\n if (data === markerMatch) {\n parts.push({type: CHILD_PART, index: nodeIndex});\n } else {\n let i = -1;\n while ((i = (node as Comment).data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n parts.push({type: COMMENT_PART, index: nodeIndex});\n // Move to the end of the match\n i += marker.length - 1;\n }\n }\n }\n nodeIndex++;\n }\n debugLogEvent?.({\n kind: 'template prep',\n template: this,\n clonableTemplate: this.el,\n parts: this.parts,\n strings,\n });\n }\n\n // Overridden via `litHtmlPolyfillSupport` to provide platform support.\n /** @nocollapse */\n static createElement(html: TrustedHTML, _options?: RenderOptions) {\n const el = d.createElement('template');\n el.innerHTML = html as unknown as string;\n return el;\n }\n}\n\nexport interface Disconnectable {\n _$parent?: Disconnectable;\n _$disconnectableChildren?: Set<Disconnectable>;\n // Rather than hold connection state on instances, Disconnectables recursively\n // fetch the connection state from the RootPart they are connected in via\n // getters up the Disconnectable tree via _$parent references. This pushes the\n // cost of tracking the isConnected state to `AsyncDirectives`, and avoids\n // needing to pass all Disconnectables (parts, template instances, and\n // directives) their connection state each time it changes, which would be\n // costly for trees that have no AsyncDirectives.\n _$isConnected: boolean;\n}\n\nfunction resolveDirective(\n part: ChildPart | AttributePart | ElementPart,\n value: unknown,\n parent: DirectiveParent = part,\n attributeIndex?: number\n): unknown {\n // Bail early if the value is explicitly noChange. Note, this means any\n // nested directive is still attached and is not run.\n if (value === noChange) {\n return value;\n }\n let currentDirective =\n attributeIndex !== undefined\n ? (parent as AttributePart).__directives?.[attributeIndex]\n : (parent as ChildPart | ElementPart | Directive).__directive;\n const nextDirectiveConstructor = isPrimitive(value)\n ? undefined\n : // This property needs to remain unminified.\n (value as DirectiveResult)['_$litDirective$'];\n if (currentDirective?.constructor !== nextDirectiveConstructor) {\n // This property needs to remain unminified.\n currentDirective?.['_$notifyDirectiveConnectionChanged']?.(false);\n if (nextDirectiveConstructor === undefined) {\n currentDirective = undefined;\n } else {\n currentDirective = new nextDirectiveConstructor(part as PartInfo);\n currentDirective._$initialize(part, parent, attributeIndex);\n }\n if (attributeIndex !== undefined) {\n ((parent as AttributePart).__directives ??= [])[attributeIndex] =\n currentDirective;\n } else {\n (parent as ChildPart | Directive).__directive = currentDirective;\n }\n }\n if (currentDirective !== undefined) {\n value = resolveDirective(\n part,\n currentDirective._$resolve(part, (value as DirectiveResult).values),\n currentDirective,\n attributeIndex\n );\n }\n return value;\n}\n\n/**\n * An updateable instance of a Template. Holds references to the Parts used to\n * update the template instance.\n */\nclass TemplateInstance implements Disconnectable {\n /** @internal */\n _$template: Template;\n /** @internal */\n _parts: Array<Part | undefined> = [];\n\n /** @internal */\n _$parent: ChildPart;\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n\n constructor(template: Template, parent: ChildPart) {\n this._$template = template;\n this._$parent = parent;\n }\n\n // Called by ChildPart parentNode getter\n get parentNode() {\n return this._$parent.parentNode;\n }\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n // This method is separate from the constructor because we need to return a\n // DocumentFragment and we don't want to hold onto it with an instance field.\n _clone(options: RenderOptions | undefined) {\n const {\n el: {content},\n parts: parts,\n } = this._$template;\n const fragment = (options?.creationScope ?? d).importNode(content, true);\n walker.currentNode = fragment;\n\n let node = walker.nextNode()!;\n let nodeIndex = 0;\n let partIndex = 0;\n let templatePart = parts[0];\n\n while (templatePart !== undefined) {\n if (nodeIndex === templatePart.index) {\n let part: Part | undefined;\n if (templatePart.type === CHILD_PART) {\n part = new ChildPart(\n node as HTMLElement,\n node.nextSibling,\n this,\n options\n );\n } else if (templatePart.type === ATTRIBUTE_PART) {\n part = new templatePart.ctor(\n node as HTMLElement,\n templatePart.name,\n templatePart.strings,\n this,\n options\n );\n } else if (templatePart.type === ELEMENT_PART) {\n part = new ElementPart(node as HTMLElement, this, options);\n }\n this._parts.push(part);\n templatePart = parts[++partIndex];\n }\n if (nodeIndex !== templatePart?.index) {\n node = walker.nextNode()!;\n nodeIndex++;\n }\n }\n return fragment;\n }\n\n _update(values: Array<unknown>) {\n let i = 0;\n for (const part of this._parts) {\n if (part !== undefined) {\n debugLogEvent?.({\n kind: 'set part',\n part,\n value: values[i],\n valueIndex: i,\n values,\n templateInstance: this,\n });\n if ((part as AttributePart).strings !== undefined) {\n (part as AttributePart)._$setValue(values, part as AttributePart, i);\n // The number of values the part consumes is part.strings.length - 1\n // since values are in between template spans. We increment i by 1\n // later in the loop, so increment it by part.strings.length - 2 here\n i += (part as AttributePart).strings!.length - 2;\n } else {\n part._$setValue(values[i]);\n }\n }\n i++;\n }\n }\n}\n\n/*\n * Parts\n */\ntype AttributeTemplatePart = {\n readonly type: typeof ATTRIBUTE_PART;\n readonly index: number;\n readonly name: string;\n /** @internal */\n readonly ctor: typeof AttributePart;\n /** @internal */\n readonly strings: ReadonlyArray<string>;\n};\ntype NodeTemplatePart = {\n readonly type: typeof CHILD_PART;\n readonly index: number;\n};\ntype ElementTemplatePart = {\n readonly type: typeof ELEMENT_PART;\n readonly index: number;\n};\ntype CommentTemplatePart = {\n readonly type: typeof COMMENT_PART;\n readonly index: number;\n};\n\n/**\n * A TemplatePart represents a dynamic part in a template, before the template\n * is instantiated. When a template is instantiated Parts are created from\n * TemplateParts.\n */\ntype TemplatePart =\n | NodeTemplatePart\n | AttributeTemplatePart\n | ElementTemplatePart\n | CommentTemplatePart;\n\nexport type Part =\n | ChildPart\n | AttributePart\n | PropertyPart\n | BooleanAttributePart\n | ElementPart\n | EventPart;\n\nexport type {ChildPart};\nclass ChildPart implements Disconnectable {\n readonly type = CHILD_PART;\n readonly options: RenderOptions | undefined;\n _$committedValue: unknown = nothing;\n /** @internal */\n __directive?: Directive;\n /** @internal */\n _$startNode: ChildNode;\n /** @internal */\n _$endNode: ChildNode | null;\n private _textSanitizer: ValueSanitizer | undefined;\n /** @internal */\n _$parent: Disconnectable | undefined;\n /**\n * Connection state for RootParts only (i.e. ChildPart without _$parent\n * returned from top-level `render`). This field is unsed otherwise. The\n * intention would clearer if we made `RootPart` a subclass of `ChildPart`\n * with this field (and a different _$isConnected getter), but the subclass\n * caused a perf regression, possibly due to making call sites polymorphic.\n * @internal\n */\n __isConnected: boolean;\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n // ChildParts that are not at the root should always be created with a\n // parent; only RootChildNode's won't, so they return the local isConnected\n // state\n return this._$parent?._$isConnected ?? this.__isConnected;\n }\n\n // The following fields will be patched onto ChildParts when required by\n // AsyncDirective\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n /** @internal */\n _$notifyConnectionChanged?(\n isConnected: boolean,\n removeFromParent?: boolean,\n from?: number\n ): void;\n /** @internal */\n _$reparentDisconnectables?(parent: Disconnectable): void;\n\n constructor(\n startNode: ChildNode,\n endNode: ChildNode | null,\n parent: TemplateInstance | ChildPart | undefined,\n options: RenderOptions | undefined\n ) {\n this._$startNode = startNode;\n this._$endNode = endNode;\n this._$parent = parent;\n this.options = options;\n // Note __isConnected is only ever accessed on RootParts (i.e. when there is\n // no _$parent); the value on a non-root-part is \"don't care\", but checking\n // for parent would be more code\n this.__isConnected = options?.isConnected ?? true;\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n // Explicitly initialize for consistent class shape.\n this._textSanitizer = undefined;\n }\n }\n\n /**\n * The parent node into which the part renders its content.\n *\n * A ChildPart's content consists of a range of adjacent child nodes of\n * `.parentNode`, possibly bordered by 'marker nodes' (`.startNode` and\n * `.endNode`).\n *\n * - If both `.startNode` and `.endNode` are non-null, then the part's content\n * consists of all siblings between `.startNode` and `.endNode`, exclusively.\n *\n * - If `.startNode` is non-null but `.endNode` is null, then the part's\n * content consists of all siblings following `.startNode`, up to and\n * including the last child of `.parentNode`. If `.endNode` is non-null, then\n * `.startNode` will always be non-null.\n *\n * - If both `.endNode` and `.startNode` are null, then the part's content\n * consists of all child nodes of `.parentNode`.\n */\n get parentNode(): Node {\n let parentNode: Node = wrap(this._$startNode).parentNode!;\n const parent = this._$parent;\n if (\n parent !== undefined &&\n parentNode.nodeType === 11 /* Node.DOCUMENT_FRAGMENT */\n ) {\n // If the parentNode is a DocumentFragment, it may be because the DOM is\n // still in the cloned fragment during initial render; if so, get the real\n // parentNode the part will be committed into by asking the parent.\n parentNode = (parent as ChildPart | TemplateInstance).parentNode;\n }\n return parentNode;\n }\n\n /**\n * The part's leading marker node, if any. See `.parentNode` for more\n * information.\n */\n get startNode(): Node | null {\n return this._$startNode;\n }\n\n /**\n * The part's trailing marker node, if any. See `.parentNode` for more\n * information.\n */\n get endNode(): Node | null {\n return this._$endNode;\n }\n\n _$setValue(value: unknown, directiveParent: DirectiveParent = this): void {\n if (DEV_MODE && this.parentNode === null) {\n throw new Error(\n `This \\`ChildPart\\` has no \\`parentNode\\` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's \\`innerHTML\\` or \\`textContent\\` can do this.`\n );\n }\n value = resolveDirective(this, value, directiveParent);\n if (isPrimitive(value)) {\n // Non-rendering child values. It's important that these do not render\n // empty text nodes to avoid issues with preventing default <slot>\n // fallback content.\n if (value === nothing || value == null || value === '') {\n if (this._$committedValue !== nothing) {\n debugLogEvent?.({\n kind: 'commit nothing to child',\n start: this._$startNode,\n end: this._$endNode,\n parent: this._$parent,\n options: this.options,\n });\n this._$clear();\n }\n this._$committedValue = nothing;\n } else if (value !== this._$committedValue && value !== noChange) {\n this._commitText(value);\n }\n // This property needs to remain unminified.\n } else if ((value as TemplateResult)['_$litType$'] !== undefined) {\n this._commitTemplateResult(value as TemplateResult);\n } else if ((value as Node).nodeType !== undefined) {\n if (DEV_MODE && this.options?.host === value) {\n this._commitText(\n `[probable mistake: rendered a template's host in itself ` +\n `(commonly caused by writing \\${this} in a template]`\n );\n console.warn(\n `Attempted to render the template host`,\n value,\n `inside itself. This is almost always a mistake, and in dev mode `,\n `we render some warning text. In production however, we'll `,\n `render it, which will usually result in an error, and sometimes `,\n `in the element disappearing from the DOM.`\n );\n return;\n }\n this._commitNode(value as Node);\n } else if (isIterable(value)) {\n this._commitIterable(value);\n } else {\n // Fallback, will render the string representation\n this._commitText(value);\n }\n }\n\n private _insert<T extends Node>(node: T, ref = this._$endNode) {\n return wrap(wrap(this._$startNode).parentNode!).insertBefore(node, ref);\n }\n\n private _commitNode(value: Node): void {\n if (this._$committedValue !== value) {\n this._$clear();\n if (\n ENABLE_EXTRA_SECURITY_HOOKS &&\n sanitizerFactoryInternal !== noopSanitizer\n ) {\n const parentNodeName = this._$startNode.parentNode?.nodeName;\n if (parentNodeName === 'STYLE' || parentNodeName === 'SCRIPT') {\n let message = 'Forbidden';\n if (DEV_MODE) {\n if (parentNodeName === 'STYLE') {\n message =\n `Lit does not support binding inside style nodes. ` +\n `This is a security risk, as style injection attacks can ` +\n `exfiltrate data and spoof UIs. ` +\n `Consider instead using css\\`...\\` literals ` +\n `to compose styles, and make do dynamic styling with ` +\n `css custom properties, ::parts, <slot>s, ` +\n `and by mutating the DOM rather than stylesheets.`;\n } else {\n message =\n `Lit does not support binding inside script nodes. ` +\n `This is a security risk, as it could allow arbitrary ` +\n `code execution.`;\n }\n }\n throw new Error(message);\n }\n }\n debugLogEvent?.({\n kind: 'commit node',\n start: this._$startNode,\n parent: this._$parent,\n value: value,\n options: this.options,\n });\n this._$committedValue = this._insert(value);\n }\n }\n\n private _commitText(value: unknown): void {\n // If the committed value is a primitive it means we called _commitText on\n // the previous render, and we know that this._$startNode.nextSibling is a\n // Text node. We can now just replace the text content (.data) of the node.\n if (\n this._$committedValue !== nothing &&\n isPrimitive(this._$committedValue)\n ) {\n const node = wrap(this._$startNode).nextSibling as Text;\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._textSanitizer === undefined) {\n this._textSanitizer = createSanitizer(node, 'data', 'property');\n }\n value = this._textSanitizer(value);\n }\n debugLogEvent?.({\n kind: 'commit text',\n node,\n value,\n options: this.options,\n });\n (node as Text).data = value as string;\n } else {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n const textNode = document.createTextNode('');\n this._commitNode(textNode);\n // When setting text content, for security purposes it matters a lot\n // what the parent is. For example, <style> and <script> need to be\n // handled with care, while <span> does not. So first we need to put a\n // text node into the document, then we can sanitize its content.\n if (this._textSanitizer === undefined) {\n this._textSanitizer = createSanitizer(textNode, 'data', 'property');\n }\n value = this._textSanitizer(value);\n debugLogEvent?.({\n kind: 'commit text',\n node: textNode,\n value,\n options: this.options,\n });\n textNode.data = value as string;\n } else {\n this._commitNode(d.createTextNode(value as string));\n debugLogEvent?.({\n kind: 'commit text',\n node: wrap(this._$startNode).nextSibling as Text,\n value,\n options: this.options,\n });\n }\n }\n this._$committedValue = value;\n }\n\n private _commitTemplateResult(\n result: TemplateResult | CompiledTemplateResult\n ): void {\n // This property needs to remain unminified.\n const {values, ['_$litType$']: type} = result;\n // If $litType$ is a number, result is a plain TemplateResult and we get\n // the template from the template cache. If not, result is a\n // CompiledTemplateResult and _$litType$ is a CompiledTemplate and we need\n // to create the <template> element the first time we see it.\n const template: Template | CompiledTemplate =\n typeof type === 'number'\n ? this._$getTemplate(result as TemplateResult)\n : (type.el === undefined &&\n (type.el = Template.createElement(type.h, this.options)),\n type);\n\n if ((this._$committedValue as TemplateInstance)?._$template === template) {\n debugLogEvent?.({\n kind: 'template updating',\n template,\n instance: this._$committedValue as TemplateInstance,\n parts: (this._$committedValue as TemplateInstance)._parts,\n options: this.options,\n values,\n });\n (this._$committedValue as TemplateInstance)._update(values);\n } else {\n const instance = new TemplateInstance(template as Template, this);\n const fragment = instance._clone(this.options);\n debugLogEvent?.({\n kind: 'template instantiated',\n template,\n instance,\n parts: instance._parts,\n options: this.options,\n fragment,\n values,\n });\n instance._update(values);\n debugLogEvent?.({\n kind: 'template instantiated and updated',\n template,\n instance,\n parts: instance._parts,\n options: this.options,\n fragment,\n values,\n });\n this._commitNode(fragment);\n this._$committedValue = instance;\n }\n }\n\n // Overridden via `litHtmlPolyfillSupport` to provide platform support.\n /** @internal */\n _$getTemplate(result: TemplateResult) {\n let template = templateCache.get(result.strings);\n if (template === undefined) {\n templateCache.set(result.strings, (template = new Template(result)));\n }\n return template;\n }\n\n private _commitIterable(value: Iterable<unknown>): void {\n // For an Iterable, we create a new InstancePart per item, then set its\n // value to the item. This is a little bit of overhead for every item in\n // an Iterable, but it lets us recurse easily and efficiently update Arrays\n // of TemplateResults that will be commonly returned from expressions like:\n // array.map((i) => html`${i}`), by reusing existing TemplateInstances.\n\n // If value is an array, then the previous render was of an\n // iterable and value will contain the ChildParts from the previous\n // render. If value is not an array, clear this part and make a new\n // array for ChildParts.\n if (!isArray(this._$committedValue)) {\n this._$committedValue = [];\n this._$clear();\n }\n\n // Lets us keep track of how many items we stamped so we can clear leftover\n // items from a previous render\n const itemParts = this._$committedValue as ChildPart[];\n let partIndex = 0;\n let itemPart: ChildPart | undefined;\n\n for (const item of value) {\n if (partIndex === itemParts.length) {\n // If no existing part, create a new one\n // TODO (justinfagnani): test perf impact of always creating two parts\n // instead of sharing parts between nodes\n // https://github.com/lit/lit/issues/1266\n itemParts.push(\n (itemPart = new ChildPart(\n this._insert(createMarker()),\n this._insert(createMarker()),\n this,\n this.options\n ))\n );\n } else {\n // Reuse an existing part\n itemPart = itemParts[partIndex];\n }\n itemPart._$setValue(item);\n partIndex++;\n }\n\n if (partIndex < itemParts.length) {\n // itemParts always have end nodes\n this._$clear(\n itemPart && wrap(itemPart._$endNode!).nextSibling,\n partIndex\n );\n // Truncate the parts array so _value reflects the current state\n itemParts.length = partIndex;\n }\n }\n\n /**\n * Removes the nodes contained within this Part from the DOM.\n *\n * @param start Start node to clear from, for clearing a subset of the part's\n * DOM (used when truncating iterables)\n * @param from When `start` is specified, the index within the iterable from\n * which ChildParts are being removed, used for disconnecting directives in\n * those Parts.\n *\n * @internal\n */\n _$clear(\n start: ChildNode | null = wrap(this._$startNode).nextSibling,\n from?: number\n ) {\n this._$notifyConnectionChanged?.(false, true, from);\n while (start && start !== this._$endNode) {\n const n = wrap(start!).nextSibling;\n (wrap(start!) as Element).remove();\n start = n;\n }\n }\n /**\n * Implementation of RootPart's `isConnected`. Note that this metod\n * should only be called on `RootPart`s (the `ChildPart` returned from a\n * top-level `render()` call). It has no effect on non-root ChildParts.\n * @param isConnected Whether to set\n * @internal\n */\n setConnected(isConnected: boolean) {\n if (this._$parent === undefined) {\n this.__isConnected = isConnected;\n this._$notifyConnectionChanged?.(isConnected);\n } else if (DEV_MODE) {\n throw new Error(\n 'part.setConnected() may only be called on a ' +\n 'RootPart returned from render().'\n );\n }\n }\n}\n\n/**\n * A top-level `ChildPart` returned from `render` that manages the connected\n * state of `AsyncDirective`s created throughout the tree below it.\n */\nexport interface RootPart extends ChildPart {\n /**\n * Sets the connection state for `AsyncDirective`s contained within this root\n * ChildPart.\n *\n * lit-html does not automatically monitor the connectedness of DOM rendered;\n * as such, it is the responsibility of the caller to `render` to ensure that\n * `part.setConnected(false)` is called before the part object is potentially\n * discarded, to ensure that `AsyncDirective`s have a chance to dispose of\n * any resources being held. If a `RootPart` that was prevously\n * disconnected is subsequently re-connected (and its `AsyncDirective`s should\n * re-connect), `setConnected(true)` should be called.\n *\n * @param isConnected Whether directives within this tree should be connected\n * or not\n */\n setConnected(isConnected: boolean): void;\n}\n\nexport type {AttributePart};\nclass AttributePart implements Disconnectable {\n readonly type = ATTRIBUTE_PART as\n | typeof ATTRIBUTE_PART\n | typeof PROPERTY_PART\n | typeof BOOLEAN_ATTRIBUTE_PART\n | typeof EVENT_PART;\n readonly element: HTMLElement;\n readonly name: string;\n readonly options: RenderOptions | undefined;\n\n /**\n * If this attribute part represents an interpolation, this contains the\n * static strings of the interpolation. For single-value, complete bindings,\n * this is undefined.\n */\n readonly strings?: ReadonlyArray<string>;\n /** @internal */\n _$committedValue: unknown | Array<unknown> = nothing;\n /** @internal */\n __directives?: Array<Directive | undefined>;\n /** @internal */\n _$parent: Disconnectable;\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n\n protected _sanitizer: ValueSanitizer | undefined;\n\n get tagName() {\n return this.element.tagName;\n }\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n constructor(\n element: HTMLElement,\n name: string,\n strings: ReadonlyArray<string>,\n parent: Disconnectable,\n options: RenderOptions | undefined\n ) {\n this.element = element;\n this.name = name;\n this._$parent = parent;\n this.options = options;\n if (strings.length > 2 || strings[0] !== '' || strings[1] !== '') {\n this._$committedValue = new Array(strings.length - 1).fill(new String());\n this.strings = strings;\n } else {\n this._$committedValue = nothing;\n }\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n this._sanitizer = undefined;\n }\n }\n\n /**\n * Sets the value of this part by resolving the value from possibly multiple\n * values and static strings and committing it to the DOM.\n * If this part is single-valued, `this._strings` will be undefined, and the\n * method will be called with a single value argument. If this part is\n * multi-value, `this._strings` will be defined, and the method is called\n * with the value array of the part's owning TemplateInstance, and an offset\n * into the value array from which the values should be read.\n * This method is overloaded this way to eliminate short-lived array slices\n * of the template instance values, and allow a fast-path for single-valued\n * parts.\n *\n * @param value The part value, or an array of values for multi-valued parts\n * @param valueIndex the index to start reading values from. `undefined` for\n * single-valued parts\n * @param noCommit causes the part to not commit its value to the DOM. Used\n * in hydration to prime attribute parts with their first-rendered value,\n * but not set the attribute, and in SSR to no-op the DOM operation and\n * capture the value for serialization.\n *\n * @internal\n */\n _$setValue(\n value: unknown | Array<unknown>,\n directiveParent: DirectiveParent = this,\n valueIndex?: number,\n noCommit?: boolean\n ) {\n const strings = this.strings;\n\n // Whether any of the values has changed, for dirty-checking\n let change = false;\n\n if (strings === undefined) {\n // Single-value binding case\n value = resolveDirective(this, value, directiveParent, 0);\n change =\n !isPrimitive(value) ||\n (value !== this._$committedValue && value !== noChange);\n if (change) {\n this._$committedValue = value;\n }\n } else {\n // Interpolation case\n const values = value as Array<unknown>;\n value = strings[0];\n\n let i, v;\n for (i = 0; i < strings.length - 1; i++) {\n v = resolveDirective(this, values[valueIndex! + i], directiveParent, i);\n\n if (v === noChange) {\n // If the user-provided value is `noChange`, use the previous value\n v = (this._$committedValue as Array<unknown>)[i];\n }\n change ||=\n !isPrimitive(v) || v !== (this._$committedValue as Array<unknown>)[i];\n if (v === nothing) {\n value = nothing;\n } else if (value !== nothing) {\n value += (v ?? '') + strings[i + 1];\n }\n // We always record each value, even if one is `nothing`, for future\n // change detection.\n (this._$committedValue as Array<unknown>)[i] = v;\n }\n }\n if (change && !noCommit) {\n this._commitValue(value);\n }\n }\n\n /** @internal */\n _commitValue(value: unknown) {\n if (value === nothing) {\n (wrap(this.element) as Element).removeAttribute(this.name);\n } else {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._sanitizer === undefined) {\n this._sanitizer = sanitizerFactoryInternal(\n this.element,\n this.name,\n 'attribute'\n );\n }\n value = this._sanitizer(value ?? '');\n }\n debugLogEvent?.({\n kind: 'commit attribute',\n element: this.element,\n name: this.name,\n value,\n options: this.options,\n });\n (wrap(this.element) as Element).setAttribute(\n this.name,\n (value ?? '') as string\n );\n }\n }\n}\n\nexport type {PropertyPart};\nclass PropertyPart extends AttributePart {\n override readonly type = PROPERTY_PART;\n\n /** @internal */\n override _commitValue(value: unknown) {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._sanitizer === undefined) {\n this._sanitizer = sanitizerFactoryInternal(\n this.element,\n this.name,\n 'property'\n );\n }\n value = this._sanitizer(value);\n }\n debugLogEvent?.({\n kind: 'commit property',\n element: this.element,\n name: this.name,\n value,\n options: this.options,\n });\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this.element as any)[this.name] = value === nothing ? undefined : value;\n }\n}\n\n// Temporary workaround for https://crbug.com/993268\n// Currently, any attribute starting with \"on\" is considered to be a\n// TrustedScript source. Such boolean attributes must be set to the equivalent\n// trusted emptyScript value.\nconst emptyStringForBooleanAttribute = trustedTypes\n ? (trustedTypes.emptyScript as unknown as '')\n : '';\n\nexport type {BooleanAttributePart};\nclass BooleanAttributePart extends AttributePart {\n override readonly type = BOOLEAN_ATTRIBUTE_PART;\n\n /** @internal */\n override _commitValue(value: unknown) {\n debugLogEvent?.({\n kind: 'commit boolean attribute',\n element: this.element,\n name: this.name,\n value: !!(value && value !== nothing),\n options: this.options,\n });\n if (value && value !== nothing) {\n (wrap(this.element) as Element).setAttribute(\n this.name,\n emptyStringForBooleanAttribute\n );\n } else {\n (wrap(this.element) as Element).removeAttribute(this.name);\n }\n }\n}\n\ntype EventListenerWithOptions = EventListenerOrEventListenerObject &\n Partial<AddEventListenerOptions>;\n\n/**\n * An AttributePart that manages an event listener via add/removeEventListener.\n *\n * This part works by adding itself as the event listener on an element, then\n * delegating to the value passed to it. This reduces the number of calls to\n * add/removeEventListener if the listener changes frequently, such as when an\n * inline function is used as a listener.\n *\n * Because event options are passed when adding listeners, we must take case\n * to add and remove the part as a listener when the event options change.\n */\nexport type {EventPart};\nclass EventPart extends AttributePart {\n override readonly type = EVENT_PART;\n\n constructor(\n element: HTMLElement,\n name: string,\n strings: ReadonlyArray<string>,\n parent: Disconnectable,\n options: RenderOptions | undefined\n ) {\n super(element, name, strings, parent, options);\n\n if (DEV_MODE && this.strings !== undefined) {\n throw new Error(\n `A \\`<${element.localName}>\\` has a \\`@${name}=...\\` listener with ` +\n 'invalid content. Event listeners in templates must have exactly ' +\n 'one expression and no surrounding text.'\n );\n }\n }\n\n // EventPart does not use the base _$setValue/_resolveValue implementation\n // since the dirty checking is more complex\n /** @internal */\n override _$setValue(\n newListener: unknown,\n directiveParent: DirectiveParent = this\n ) {\n newListener =\n resolveDirective(this, newListener, directiveParent, 0) ?? nothing;\n if (newListener === noChange) {\n return;\n }\n const oldListener = this._$committedValue;\n\n // If the new value is nothing or any options change we have to remove the\n // part as a listener.\n const shouldRemoveListener =\n (newListener === nothing && oldListener !== nothing) ||\n (newListener as EventListenerWithOptions).capture !==\n (oldListener as EventListenerWithOptions).capture ||\n (newListener as EventListenerWithOptions).once !==\n (oldListener as EventListenerWithOptions).once ||\n (newListener as EventListenerWithOptions).passive !==\n (oldListener as EventListenerWithOptions).passive;\n\n // If the new value is not nothing and we removed the listener, we have\n // to add the part as a listener.\n const shouldAddListener =\n newListener !== nothing &&\n (oldListener === nothing || shouldRemoveListener);\n\n debugLogEvent?.({\n kind: 'commit event listener',\n element: this.element,\n name: this.name,\n value: newListener,\n options: this.options,\n removeListener: shouldRemoveListener,\n addListener: shouldAddListener,\n oldListener,\n });\n if (shouldRemoveListener) {\n this.element.removeEventListener(\n this.name,\n this,\n oldListener as EventListenerWithOptions\n );\n }\n if (shouldAddListener) {\n // Beware: IE11 and Chrome 41 don't like using the listener as the\n // options object. Figure out how to deal w/ this in IE11 - maybe\n // patch addEventListener?\n this.element.addEventListener(\n this.name,\n this,\n newListener as EventListenerWithOptions\n );\n }\n this._$committedValue = newListener;\n }\n\n handleEvent(event: Event) {\n if (typeof this._$committedValue === 'function') {\n this._$committedValue.call(this.options?.host ?? this.element, event);\n } else {\n (this._$committedValue as EventListenerObject).handleEvent(event);\n }\n }\n}\n\nexport type {ElementPart};\nclass ElementPart implements Disconnectable {\n readonly type = ELEMENT_PART;\n\n /** @internal */\n __directive?: Directive;\n\n // This is to ensure that every Part has a _$committedValue\n _$committedValue: undefined;\n\n /** @internal */\n _$parent!: Disconnectable;\n\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n\n options: RenderOptions | undefined;\n\n constructor(\n public element: Element,\n parent: Disconnectable,\n options: RenderOptions | undefined\n ) {\n this._$parent = parent;\n this.options = options;\n }\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n _$setValue(value: unknown): void {\n debugLogEvent?.({\n kind: 'commit to element binding',\n element: this.element,\n value,\n options: this.options,\n });\n resolveDirective(this, value);\n }\n}\n\n/**\n * END USERS SHOULD NOT RELY ON THIS OBJECT.\n *\n * Private exports for use by other Lit packages, not intended for use by\n * external users.\n *\n * We currently do not make a mangled rollup build of the lit-ssr code. In order\n * to keep a number of (otherwise private) top-level exports mangled in the\n * client side code, we export a _$LH object containing those members (or\n * helper methods for accessing private fields of those members), and then\n * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the\n * client-side code is being used in `dev` mode or `prod` mode.\n *\n * This has a unique name, to disambiguate it from private exports in\n * lit-element, which re-exports all of lit-html.\n *\n * @private\n */\nexport const _$LH = {\n // Used in lit-ssr\n _boundAttributeSuffix: boundAttributeSuffix,\n _marker: marker,\n _markerMatch: markerMatch,\n _HTML_RESULT: HTML_RESULT,\n _getTemplateHtml: getTemplateHtml,\n // Used in hydrate\n _TemplateInstance: TemplateInstance,\n _isIterable: isIterable,\n _resolveDirective: resolveDirective,\n // Used in tests and private-ssr-support\n _ChildPart: ChildPart,\n _AttributePart: AttributePart,\n _BooleanAttributePart: BooleanAttributePart,\n _EventPart: EventPart,\n _PropertyPart: PropertyPart,\n _ElementPart: ElementPart,\n};\n\n// Apply polyfills if available\nconst polyfillSupport = DEV_MODE\n ? global.litHtmlPolyfillSupportDevMode\n : global.litHtmlPolyfillSupport;\npolyfillSupport?.(Template, ChildPart);\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for lit-html usage.\n(global.litHtmlVersions ??= []).push('2.5.0');\nif (DEV_MODE && global.litHtmlVersions.length > 1) {\n issueWarning!(\n 'multiple-versions',\n `Multiple versions of Lit loaded. ` +\n `Loading multiple versions is not recommended.`\n );\n}\n\n/**\n * Renders a value, usually a lit-html TemplateResult, to the container.\n *\n * This example renders the text \"Hello, Zoe!\" inside a paragraph tag, appending\n * it to the container `document.body`.\n *\n * ```js\n * import {html, render} from 'lit';\n *\n * const name = \"Zoe\";\n * render(html`<p>Hello, ${name}!</p>`, document.body);\n * ```\n *\n * @param value Any [renderable\n * value](https://lit.dev/docs/templates/expressions/#child-expressions),\n * typically a {@linkcode TemplateResult} created by evaluating a template tag\n * like {@linkcode html} or {@linkcode svg}.\n * @param container A DOM container to render to. The first render will append\n * the rendered value to the container, and subsequent renders will\n * efficiently update the rendered value if the same result type was\n * previously rendered there.\n * @param options See {@linkcode RenderOptions} for options documentation.\n * @see\n * {@link https://lit.dev/docs/libraries/standalone-templates/#rendering-lit-html-templates| Rendering Lit HTML Templates}\n */\nexport const render = (\n value: unknown,\n container: HTMLElement | DocumentFragment,\n options?: RenderOptions\n): RootPart => {\n if (DEV_MODE && container == null) {\n // Give a clearer error message than\n // Uncaught TypeError: Cannot read properties of null (reading\n // '_$litPart$')\n // which reads like an internal Lit error.\n throw new TypeError(`The container to render into may not be ${container}`);\n }\n const renderId = DEV_MODE ? debugLogRenderId++ : 0;\n const partOwnerNode = options?.renderBefore ?? container;\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let part: ChildPart = (partOwnerNode as any)['_$litPart$'];\n debugLogEvent?.({\n kind: 'begin render',\n id: renderId,\n value,\n container,\n options,\n part,\n });\n if (part === undefined) {\n const endNode = options?.renderBefore ?? null;\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (partOwnerNode as any)['_$litPart$'] = part = new ChildPart(\n container.insertBefore(createMarker(), endNode),\n endNode,\n undefined,\n options ?? {}\n );\n }\n part._$setValue(value);\n debugLogEvent?.({\n kind: 'end render',\n id: renderId,\n value,\n container,\n options,\n part,\n });\n return part as RootPart;\n};\n\nif (ENABLE_EXTRA_SECURITY_HOOKS) {\n render.setSanitizer = setSanitizer;\n render.createSanitizer = createSanitizer;\n if (DEV_MODE) {\n render._testOnlyClearSanitizerFactoryDoNotCallOrElse =\n _testOnlyClearSanitizerFactoryDoNotCallOrElse;\n }\n}\n", "\"use strict\";\nvar __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Component = void 0;\nconst lit_html_1 = require(\"lit-html\");\nconst legacyCustomElement = (tagName, clazz, options) => {\n window.customElements.define(tagName, clazz, options);\n return clazz;\n};\nconst standardCustomElement = (tagName, descriptor, options) => {\n const { kind, elements } = descriptor;\n return {\n kind,\n elements,\n // This callback is called once the class is otherwise fully defined\n finisher(clazz) {\n window.customElements.define(tagName, clazz, options);\n }\n };\n};\nconst isFunction = (v) => typeof v === 'function';\nconst customElement = (tag, config = {}) => (Base) => {\n var _a;\n var _b;\n /* Feature flag implementation where we don't define at all components when they are excluded */\n if ((_a = window._excluded_components) === null || _a === void 0 ? void 0 : _a.includes(config.selector)) {\n return Base;\n }\n if (!tag || (tag && tag.indexOf('-') <= 0)) {\n throw new Error(`You need at least 1 dash in the custom element name! ${Base}`);\n }\n config.styles = config.styles || [];\n config.components = config.components || [];\n const OnInit = Base.prototype.OnInit || function () { };\n const OnDestroy = Base.prototype.OnDestroy || function () { };\n const OnUpdate = Base.prototype.OnUpdate || function () { };\n const OnUpdateFirst = Base.prototype.OnUpdateFirst || function () { };\n const connectedCallback = Base.prototype.connectedCallback || function () { };\n const disconnectedCallback = Base.prototype.disconnectedCallback || function () { };\n const update = Base.prototype.update || function () { };\n const firstUpdated = Base.prototype.firstUpdated || function () { };\n if (!config.template) {\n config.template = Base.prototype.render || (() => (0, lit_html_1.html) ``);\n }\n if (config.style) {\n config.styles.push(config.style);\n }\n const ModifiedClass = (_b = class extends Base {\n static is() {\n return tag;\n }\n getTemplateResult() {\n return this;\n }\n OnInit() {\n if (config.container) {\n (0, lit_html_1.render)(config.template.call(this), config.container);\n if (config.style) {\n const style = document.createElement('style');\n style.type = 'text/css';\n if (style['styleSheet']) {\n // This is required for IE8 and below.\n style['styleSheet'].cssText = config.style.toString();\n }\n else {\n style.appendChild(document.createTextNode(config.style.toString()));\n }\n config.container.prepend(style);\n }\n }\n return OnInit.call(this);\n }\n disconnectedCallback() {\n var _a;\n OnDestroy.call(this);\n disconnectedCallback.call(this);\n (_a = this._registry) === null || _a === void 0 ? void 0 : _a.unsubscribe();\n this._registry = null;\n }\n connectedCallback() {\n var _a, _c;\n connectedCallback.call(this);\n OnInit.call(this);\n if (isFunction(config.registry)) {\n this._registry = config.registry.call(this);\n }\n if ((_a = config.modifiers) === null || _a === void 0 ? void 0 : _a.length) {\n for (const modifier of config.modifiers) {\n if (!modifier) {\n throw new Error(`Provided null value inside modifiers for component \"${config.selector}\"`);\n }\n if (!modifier.options) {\n throw new Error(`Missing options for attribute inside ${config.selector}`);\n }\n if (!((_c = modifier.options) === null || _c === void 0 ? void 0 : _c.selector)) {\n throw new Error(`Missing attribute selector inside component \"${config.selector}\"`);\n }\n if (!this._registry && typeof modifier.options.registry === 'function') {\n this._registry = modifier.options.registry.call(this);\n }\n if (!this._registry) {\n throw new Error(`Missing attribute registry for attribute \"${modifier.options.selector}\" and no default registry specified inside component \"${config.selector}\"`);\n }\n this._registry.define(modifier.options.selector, modifier);\n }\n }\n }\n render() {\n return config.template.call(this);\n }\n update() {\n update.call(this);\n OnUpdate.call(this);\n }\n firstUpdated() {\n firstUpdated.call(this);\n OnUpdateFirst.call(this);\n }\n },\n __setFunctionName(_b, \"ModifiedClass\"),\n _b.styles = config.styles,\n _b);\n const registeredElement = window.customElements.get(tag);\n if (registeredElement) {\n console.error(`** IMPORTANT!!! **\n ------------------------------------------\n< ${tag} > </${tag}> Component re-defined multiple times and it is already registered inside customElements registry\nPossible Solutions:\n* Bundle problem where multiple versions of the component are used\n * @Component decorator is used twice for the same component\n * Defined \"selector\" with the same name in multiple components\n\n ** If this is Server Side Rendering you can ignore this message **\n ------------------------------------------\n `);\n return registeredElement;\n }\n if (typeof ModifiedClass === 'function') {\n legacyCustomElement(tag, ModifiedClass, {\n extends: config.extends\n });\n }\n else {\n standardCustomElement(tag, ModifiedClass, { extends: config.extends });\n }\n return ModifiedClass;\n};\nconst Component = (config) => customElement(config.selector, config);\nexports.Component = Component;\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n", "\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__exportStar(require(\"./component.decorator\"), exports);\n__exportStar(require(\"./hooks/index\"), exports);\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {Disconnectable, Part} from './lit-html.js';\n\nexport {\n AttributePart,\n BooleanAttributePart,\n ChildPart,\n ElementPart,\n EventPart,\n Part,\n PropertyPart,\n} from './lit-html.js';\n\nexport interface DirectiveClass {\n new (part: PartInfo): Directive;\n}\n\n/**\n * This utility type extracts the signature of a directive class's render()\n * method so we can use it for the type of the generated directive function.\n */\nexport type DirectiveParameters<C extends Directive> = Parameters<C['render']>;\n\n/**\n * A generated directive function doesn't evaluate the directive, but just\n * returns a DirectiveResult object that captures the arguments.\n */\nexport interface DirectiveResult<C extends DirectiveClass = DirectiveClass> {\n /**\n * This property needs to remain unminified.\n * @internal */\n ['_$litDirective$']: C;\n /** @internal */\n values: DirectiveParameters<InstanceType<C>>;\n}\n\nexport const PartType = {\n ATTRIBUTE: 1,\n CHILD: 2,\n PROPERTY: 3,\n BOOLEAN_ATTRIBUTE: 4,\n EVENT: 5,\n ELEMENT: 6,\n} as const;\n\nexport type PartType = typeof PartType[keyof typeof PartType];\n\nexport interface ChildPartInfo {\n readonly type: typeof PartType.CHILD;\n}\n\nexport interface AttributePartInfo {\n readonly type:\n | typeof PartType.ATTRIBUTE\n | typeof PartType.PROPERTY\n | typeof PartType.BOOLEAN_ATTRIBUTE\n | typeof PartType.EVENT;\n readonly strings?: ReadonlyArray<string>;\n readonly name: string;\n readonly tagName: string;\n}\n\nexport interface ElementPartInfo {\n readonly type: typeof PartType.ELEMENT;\n}\n\n/**\n * Information about the part a directive is bound to.\n *\n * This is useful for checking that a directive is attached to a valid part,\n * such as with directive that can only be used on attribute bindings.\n */\nexport type PartInfo = ChildPartInfo | AttributePartInfo | ElementPartInfo;\n\n/**\n * Creates a user-facing directive function from a Directive class. This\n * function has the same parameters as the directive's render() method.\n */\nexport const directive =\n <C extends DirectiveClass>(c: C) =>\n (...values: DirectiveParameters<InstanceType<C>>): DirectiveResult<C> => ({\n // This property needs to remain unminified.\n ['_$litDirective$']: c,\n values,\n });\n\n/**\n * Base class for creating custom directives. Users should extend this class,\n * implement `render` and/or `update`, and then pass their subclass to\n * `directive`.\n */\nexport abstract class Directive implements Disconnectable {\n //@internal\n __part!: Part;\n //@internal\n __attributeIndex: number | undefined;\n //@internal\n __directive?: Directive;\n\n //@internal\n _$parent!: Disconnectable;\n\n // These will only exist on the AsyncDirective subclass\n //@internal\n _$disconnectableChildren?: Set<Disconnectable>;\n // This property needs to remain unminified.\n //@internal\n ['_$notifyDirectiveConnectionChanged']?(isConnected: boolean): void;\n\n constructor(_partInfo: PartInfo) {}\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n /** @internal */\n _$initialize(\n part: Part,\n parent: Disconnectable,\n attributeIndex: number | undefined\n ) {\n this.__part = part;\n this._$parent = parent;\n this.__attributeIndex = attributeIndex;\n }\n /** @internal */\n _$resolve(part: Part, props: Array<unknown>): unknown {\n return this.update(part, props);\n }\n\n abstract render(...props: Array<unknown>): unknown;\n\n update(_part: Part, props: Array<unknown>): unknown {\n return this.render(...props);\n }\n}\n", "/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {_$LH, Part, DirectiveParent, TemplateResult} from './lit-html.js';\nimport {\n DirectiveResult,\n DirectiveClass,\n PartInfo,\n AttributePartInfo,\n} from './directive.js';\ntype Primitive = null | undefined | boolean | number | string | symbol | bigint;\n\nconst {_ChildPart: ChildPart} = _$LH;\n\ntype ChildPart = InstanceType<typeof ChildPart>;\n\nconst ENABLE_SHADYDOM_NOPATCH = true;\n\nconst wrap =\n ENABLE_SHADYDOM_NOPATCH &&\n window.ShadyDOM?.inUse &&\n window.ShadyDOM?.noPatch === true\n ? window.ShadyDOM!.wrap\n : (node: Node) => node;\n\n/**\n * Tests if a value is a primitive value.\n *\n * See https://tc39.github.io/ecma262/#sec-typeof-operator\n */\nexport const isPrimitive = (value: unknown): value is Primitive =>\n value === null || (typeof value != 'object' && typeof value != 'function');\n\nexport const TemplateResultType = {\n HTML: 1,\n SVG: 2,\n} as const;\n\nexport type TemplateResultType =\n typeof TemplateResultType[keyof typeof TemplateResultType];\n\n/**\n * Tests if a value is a TemplateResult.\n */\nexport const isTemplateResult = (\n value: unknown,\n type?: TemplateResultType\n): value is TemplateResult =>\n type === undefined\n ? // This property needs to remain unminified.\n (value as TemplateResult)?.['_$litType$'] !== undefined\n : (value as TemplateResult)?.['_$litType$'] === type;\n\n/**\n * Tests if a value is a DirectiveResult.\n */\nexport const isDirectiveResult = (value: unknown): value is DirectiveResult =>\n // This property needs to remain unminified.\n (value as DirectiveResult)?.['_$litDirective$'] !== undefined;\n\n/**\n * Retrieves the Directive class for a DirectiveResult\n */\nexport const getDirectiveClass = (value: unknown): DirectiveClass | undefined =>\n // This property needs to remain unminified.\n (value as DirectiveResult)?.['_$litDirective$'];\n\n/**\n * Tests whether a part has only a single-expression with no strings to\n * interpolate between.\n *\n * Only AttributePart and PropertyPart can have multiple expressions.\n * Multi-expression parts have a `strings` property and single-expression\n * parts do not.\n */\nexport const isSingleExpression = (part: PartInfo) =>\n (part as AttributePartInfo).strings === undefined;\n\nconst createMarker = () => document.createComment('');\n\n/**\n * Inserts a ChildPart into the given container ChildPart's DOM, either at the\n * end of the container ChildPart, or before the optional `refPart`.\n *\n * This does not add the part to the containerPart's committed value. That must\n * be done by callers.\n *\n * @param containerPart Part within which to add the new ChildPart\n * @param refPart Part before which to add the new ChildPart; when omitted the\n * part added to the end of the `containerPart`\n * @param part Part to insert, or undefined to create a new part\n */\nexport const insertPart = (\n containerPart: ChildPart,\n refPart?: ChildPart,\n part?: ChildPart\n): ChildPart => {\n const container = wrap(containerPart._$startNode).parentNode!;\n\n const refNode =\n refPart === undefined ? containerPart._$endNode : refPart._$startNode;\n\n if (part === undefined) {\n const startNode = wrap(container).insertBefore(createMarker(), refNode);\n const endNode = wrap(container).insertBefore(createMarker(), refNode);\n part = new ChildPart(\n startNode,\n endNode,\n containerPart,\n containerPart.options\n );\n } else {\n const endNode = wrap(part._$endNode!).nextSibling;\n const oldParent = part._$parent;\n const parentChanged = oldParent !== containerPart;\n if (parentChanged) {\n part._$reparentDisconnectables?.(containerPart);\n // Note that although `_$reparentDisconnectables` updates the part's\n // `_$parent` reference after unlinking from its current parent, that\n // method only exists if Disconnectables are present, so we need to\n // unconditionally set it here\n part._$parent = containerPart;\n // Since the _$isConnected getter is somewhat costly, only\n // read it once we know the subtree has directives that need\n // to be notified\n let newConnectionState;\n if (\n part._$notifyConnectionChanged !== undefined &&\n (newConnectionState = containerPart._$isConnected) !==\n oldParent!._$isConnected\n ) {\n part._$notifyConnectionChanged(newConnectionState);\n }\n }\n if (endNode !== refNode || parentChanged) {\n let start: Node | null = part._$startNode;\n while (start !== endNode) {\n const n: Node | null = wrap(start!).nextSibling;\n wrap(container).insertBefore(start!, refNode);\n start = n;\n }\n }\n }\n\n return part;\n};\n\n/**\n * Sets the value of a Part.\n *\n * Note that this should only be used to set/update the value of user-created\n * parts (i.e. those created using `insertPart`); it should not be used\n * by directives to set the value of the directive's container part. Directives\n * should return a value from `update`/`render` to update their part state.\n *\n * For directives that require setting their part value asynchronously, they\n * should extend `AsyncDirective` and call `this.setValue()`.\n *\n * @param part Part to set\n * @param value Value to set\n * @param index For `AttributePart`s, the index to set\n * @param directiveParent Used internally; should not be set by user\n */\nexport const setChildPartValue = <T extends ChildPart>(\n part: T,\n value: unknown,\n directiveParent: DirectiveParent = part\n): T => {\n part._$setValue(value, directiveParent);\n return part;\n};\n\n// A sentinal value that can never appear as a part value except when set by\n// live(). Used to force a dirty-check to fail and cause a re-render.\nconst RESET_VALUE = {};\n\n/**\n * Sets the committed value of a ChildPart directly without triggering the\n * commit stage of the part.\n *\n * This is useful in cases where a directive needs to update the part such\n * that the next update detects a value change or not. When value is omitted,\n * the next update will be guaranteed to be detected as a change.\n *\n * @param part\n * @param value\n */\nexport const setCommittedValue = (part: Part, value: unknown = RESET_VALUE) =>\n (part._$committedValue = value);\n\n/**\n * Returns the committed value of a ChildPart.\n *\n * The committed value is used for change detection and efficient updates of\n * the part. It can differ from the value set by the template or directive in\n * cases where the template value is transformed before being commited.\n *\n * - `TemplateResult`s are committed as a `TemplateInstance`\n * - Iterables are committed as `Array<ChildPart>`\n * - All other types are committed as the template value or value returned or\n * set by a directive.\n *\n * @param part\n */\nexport const getCommittedValue = (part: ChildPart) => part._$committedValue;\n\n/**\n * Removes a ChildPart from the DOM, including any of its content.\n *\n * @param part The Part to remove\n */\nexport const removePart = (part: ChildPart) => {\n part._$notifyConnectionChanged?.(false, true);\n let start: ChildNode | null = part._$startNode;\n const end: ChildNode | null = wrap(part._$endNode!).nextSibling;\n while (start !== end) {\n const n: ChildNode | null = wrap(start!).nextSibling;\n (wrap(start!) as ChildNode).remove();\n start = n;\n }\n};\n\nexport const clearPart = (part: ChildPart) => {\n part._$clear();\n};\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Overview:\n *\n * This module is designed to add support for an async `setValue` API and\n * `disconnected` callback to directives with the least impact on the core\n * runtime or payload when that feature is not used.\n *\n * The strategy is to introduce a `AsyncDirective` subclass of\n * `Directive` that climbs the \"parent\" tree in its constructor to note which\n * branches of lit-html's \"logical tree\" of data structures contain such\n * directives and thus need to be crawled when a subtree is being cleared (or\n * manually disconnected) in order to run the `disconnected` callback.\n *\n * The \"nodes\" of the logical tree include Parts, TemplateInstances (for when a\n * TemplateResult is committed to a value of a ChildPart), and Directives; these\n * all implement a common interface called `DisconnectableChild`. Each has a\n * `_$parent` reference which is set during construction in the core code, and a\n * `_$disconnectableChildren` field which is initially undefined.\n *\n * The sparse tree created by means of the `AsyncDirective` constructor\n * crawling up the `_$parent` tree and placing a `_$disconnectableChildren` Set\n * on each parent that includes each child that contains a\n * `AsyncDirective` directly or transitively via its children. In order to\n * notify connection state changes and disconnect (or reconnect) a tree, the\n * `_$notifyConnectionChanged` API is patched onto ChildParts as a directive\n * climbs the parent tree, which is called by the core when clearing a part if\n * it exists. When called, that method iterates over the sparse tree of\n * Set<DisconnectableChildren> built up by AsyncDirectives, and calls\n * `_$notifyDirectiveConnectionChanged` on any directives that are encountered\n * in that tree, running the required callbacks.\n *\n * A given \"logical tree\" of lit-html data-structures might look like this:\n *\n * ChildPart(N1) _$dC=[D2,T3]\n * ._directive\n * AsyncDirective(D2)\n * ._value // user value was TemplateResult\n * TemplateInstance(T3) _$dC=[A4,A6,N10,N12]\n * ._parts[]\n * AttributePart(A4) _$dC=[D5]\n * ._directives[]\n * AsyncDirective(D5)\n * AttributePart(A6) _$dC=[D7,D8]\n * ._directives[]\n * AsyncDirective(D7)\n * Directive(D8) _$dC=[D9]\n * ._directive\n * AsyncDirective(D9)\n * ChildPart(N10) _$dC=[D11]\n * ._directive\n * AsyncDirective(D11)\n * ._value\n * string\n * ChildPart(N12) _$dC=[D13,N14,N16]\n * ._directive\n * AsyncDirective(D13)\n * ._value // user value was iterable\n * Array<ChildPart>\n * ChildPart(N14) _$dC=[D15]\n * ._value\n * string\n * ChildPart(N16) _$dC=[D17,T18]\n * ._directive\n * AsyncDirective(D17)\n * ._value // user value was TemplateResult\n * TemplateInstance(T18) _$dC=[A19,A21,N25]\n * ._parts[]\n * AttributePart(A19) _$dC=[D20]\n * ._directives[]\n * AsyncDirective(D20)\n * AttributePart(A21) _$dC=[22,23]\n * ._directives[]\n * AsyncDirective(D22)\n * Directive(D23) _$dC=[D24]\n * ._directive\n * AsyncDirective(D24)\n * ChildPart(N25) _$dC=[D26]\n * ._directive\n * AsyncDirective(D26)\n * ._value\n * string\n *\n * Example 1: The directive in ChildPart(N12) updates and returns `nothing`. The\n * ChildPart will _clear() itself, and so we need to disconnect the \"value\" of\n * the ChildPart (but not its directive). In this case, when `_clear()` calls\n * `_$notifyConnectionChanged()`, we don't iterate all of the\n * _$disconnectableChildren, rather we do a value-specific disconnection: i.e.\n * since the _value was an Array<ChildPart> (because an iterable had been\n * committed), we iterate the array of ChildParts (N14, N16) and run\n * `setConnected` on them (which does recurse down the full tree of\n * `_$disconnectableChildren` below it, and also removes N14 and N16 from N12's\n * `_$disconnectableChildren`). Once the values have been disconnected, we then\n * check whether the ChildPart(N12)'s list of `_$disconnectableChildren` is empty\n * (and would remove it from its parent TemplateInstance(T3) if so), but since\n * it would still contain its directive D13, it stays in the disconnectable\n * tree.\n *\n * Example 2: In the course of Example 1, `setConnected` will reach\n * ChildPart(N16); in this case the entire part is being disconnected, so we\n * simply iterate all of N16's `_$disconnectableChildren` (D17,T18) and\n * recursively run `setConnected` on them. Note that we only remove children\n * from `_$disconnectableChildren` for the top-level values being disconnected\n * on a clear; doing this bookkeeping lower in the tree is wasteful since it's\n * all being thrown away.\n *\n * Example 3: If the LitElement containing the entire tree above becomes\n * disconnected, it will run `childPart.setConnected()` (which calls\n * `childPart._$notifyConnectionChanged()` if it exists); in this case, we\n * recursively run `setConnected()` over the entire tree, without removing any\n * children from `_$disconnectableChildren`, since this tree is required to\n * re-connect the tree, which does the same operation, simply passing\n * `isConnected: true` down the tree, signaling which callback to run.\n */\n\nimport {AttributePart, ChildPart, Disconnectable, Part} from './lit-html.js';\nimport {isSingleExpression} from './directive-helpers.js';\nimport {Directive, PartInfo, PartType} from './directive.js';\nexport * from './directive.js';\n\nconst DEV_MODE = true;\n\n/**\n * Recursively walks down the tree of Parts/TemplateInstances/Directives to set\n * the connected state of directives and run `disconnected`/ `reconnected`\n * callbacks.\n *\n * @return True if there were children to disconnect; false otherwise\n */\nconst notifyChildrenConnectedChanged = (\n parent: Disconnectable,\n isConnected: boolean\n): boolean => {\n const children = parent._$disconnectableChildren;\n if (children === undefined) {\n return false;\n }\n for (const obj of children) {\n // The existence of `_$notifyDirectiveConnectionChanged` is used as a \"brand\" to\n // disambiguate AsyncDirectives from other DisconnectableChildren\n // (as opposed to using an instanceof check to know when to call it); the\n // redundancy of \"Directive\" in the API name is to avoid conflicting with\n // `_$notifyConnectionChanged`, which exists `ChildParts` which are also in\n // this list\n // Disconnect Directive (and any nested directives contained within)\n // This property needs to remain unminified.\n (obj as AsyncDirective)['_$notifyDirectiveConnectionChanged']?.(\n isConnected,\n false\n );\n // Disconnect Part/TemplateInstance\n notifyChildrenConnectedChanged(obj, isConnected);\n }\n return true;\n};\n\n/**\n * Removes the given child from its parent list of disconnectable children, and\n * if the parent list becomes empty as a result, removes the parent from its\n * parent, and so forth up the tree when that causes subsequent parent lists to\n * become empty.\n */\nconst removeDisconnectableFromParent = (obj: Disconnectable) => {\n let parent, children;\n do {\n if ((parent = obj._$parent) === undefined) {\n break;\n }\n children = parent._$disconnectableChildren!;\n children.delete(obj);\n obj = parent;\n } while (children?.size === 0);\n};\n\nconst addDisconnectableToParent = (obj: Disconnectable) => {\n // Climb the parent tree, creating a sparse tree of children needing\n // disconnection\n for (let parent; (parent = obj._$parent); obj = parent) {\n let children = parent._$disconnectableChildren;\n if (children === undefined) {\n parent._$disconnectableChildren = children = new Set();\n } else if (children.has(obj)) {\n // Once we've reached a parent that already contains this child, we\n // can short-circuit\n break;\n }\n children.add(obj);\n installDisconnectAPI(parent);\n }\n};\n\n/**\n * Changes the parent reference of the ChildPart, and updates the sparse tree of\n * Disconnectable children accordingly.\n *\n * Note, this method will be patched onto ChildPart instances and called from\n * the core code when parts are moved between different parents.\n */\nfunction reparentDisconnectables(this: ChildPart, newParent: Disconnectable) {\n if (this._$disconnectableChildren !== undefined) {\n removeDisconnectableFromParent(this);\n this._$parent = newParent;\n addDisconnectableToParent(this);\n } else {\n this._$parent = newParent;\n }\n}\n\n/**\n * Sets the connected state on any directives contained within the committed\n * value of this part (i.e. within a TemplateInstance or iterable of\n * ChildParts) and runs their `disconnected`/`reconnected`s, as well as within\n * any directives stored on the ChildPart (when `valueOnly` is false).\n *\n * `isClearingValue` should be passed as `true` on a top-level part that is\n * clearing itself, and not as a result of recursively disconnecting directives\n * as part of a `clear` operation higher up the tree. This both ensures that any\n * directive on this ChildPart that produced a value that caused the clear\n * operation is not disconnected, and also serves as a performance optimization\n * to avoid needless bookkeeping when a subtree is going away; when clearing a\n * subtree, only the top-most part need to remove itself from the parent.\n *\n * `fromPartIndex` is passed only in the case of a partial `_clear` running as a\n * result of truncating an iterable.\n *\n * Note, this method will be patched onto ChildPart instances and called from the\n * core code when parts are cleared or the connection state is changed by the\n * user.\n */\nfunction notifyChildPartConnectedChanged(\n this: ChildPart,\n isConnected: boolean,\n isClearingValue = false,\n fromPartIndex = 0\n) {\n const value = this._$committedValue;\n const children = this._$disconnectableChildren;\n if (children === undefined || children.size === 0) {\n return;\n }\n if (isClearingValue) {\n if (Array.isArray(value)) {\n // Iterable case: Any ChildParts created by the iterable should be\n // disconnected and removed from this ChildPart's disconnectable\n // children (starting at `fromPartIndex` in the case of truncation)\n for (let i = fromPartIndex; i < value.length; i++) {\n notifyChildrenConnectedChanged(value[i], false);\n removeDisconnectableFromParent(value[i]);\n }\n } else if (value != null) {\n // TemplateInstance case: If the value has disconnectable children (will\n // only be in the case that it is a TemplateInstance), we disconnect it\n // and remove it from this ChildPart's disconnectable children\n notifyChildrenConnectedChanged(value as Disconnectable, false);\n removeDisconnectableFromParent(value as Disconnectable);\n }\n } else {\n notifyChildrenConnectedChanged(this, isConnected);\n }\n}\n\n/**\n * Patches disconnection API onto ChildParts.\n */\nconst installDisconnectAPI = (obj: Disconnectable) => {\n if ((obj as ChildPart).type == PartType.CHILD) {\n (obj as ChildPart)._$notifyConnectionChanged ??=\n notifyChildPartConnectedChanged;\n (obj as ChildPart)._$reparentDisconnectables ??= reparentDisconnectables;\n }\n};\n\n/**\n * An abstract `Directive` base class whose `disconnected` method will be\n * called when the part containing the directive is cleared as a result of\n * re-rendering, or when the user calls `part.setConnected(false)` on\n * a part that was previously rendered containing the directive (as happens\n * when e.g. a LitElement disconnects from the DOM).\n *\n * If `part.setConnected(true)` is subsequently called on a\n * containing part, the directive's `reconnected` method will be called prior\n * to its next `update`/`render` callbacks. When implementing `disconnected`,\n * `reconnected` should also be implemented to be compatible with reconnection.\n *\n * Note that updates may occur while the directive is disconnected. As such,\n * directives should generally check the `this.isConnected` flag during\n * render/update to determine whether it is safe to subscribe to resources\n * that may prevent garbage collection.\n */\nexport abstract class AsyncDirective extends Directive {\n // As opposed to other Disconnectables, AsyncDirectives always get notified\n // when the RootPart connection changes, so the public `isConnected`\n // is a locally stored variable initialized via its part's getter and synced\n // via `_$notifyDirectiveConnectionChanged`. This is cheaper than using\n // the _$isConnected getter, which has to look back up the tree each time.\n /**\n * The connection state for this Directive.\n */\n isConnected!: boolean;\n\n // @internal\n override _$disconnectableChildren?: Set<Disconnectable> = undefined;\n /**\n * Initialize the part with internal fields\n * @param part\n * @param parent\n * @param attributeIndex\n */\n override _$initialize(\n part: Part,\n parent: Disconnectable,\n attributeIndex: number | undefined\n ) {\n super._$initialize(part, parent, attributeIndex);\n addDisconnectableToParent(this);\n this.isConnected = part._$isConnected;\n }\n // This property needs to remain unminified.\n /**\n * Called from the core code when a directive is going away from a part (in\n * which case `shouldRemoveFromParent` should be true), and from the\n * `setChildrenConnected` helper function when recursively changing the\n * connection state of a tree (in which case `shouldRemoveFromParent` should\n * be false).\n *\n * @param isConnected\n * @param isClearingDirective - True when the directive itself is being\n * removed; false when the tree is being disconnected\n * @internal\n */\n override ['_$notifyDirectiveConnectionChanged'](\n isConnected: boolean,\n isClearingDirective = true\n ) {\n if (isConnected !== this.isConnected) {\n this.isConnected = isConnected;\n if (isConnected) {\n this.reconnected?.();\n } else {\n this.disconnected?.();\n }\n }\n if (isClearingDirective) {\n notifyChildrenConnectedChanged(this, isConnected);\n removeDisconnectableFromParent(this);\n }\n }\n\n /**\n * Sets the value of the directive's Part outside the normal `update`/`render`\n * lifecycle of a directive.\n *\n * This method should not be called synchronously from a directive's `update`\n * or `render`.\n *\n * @param directive The directive to update\n * @param value The value to set\n */\n setValue(value: unknown) {\n if (isSingleExpression(this.__part as unknown as PartInfo)) {\n this.__part._$setValue(value, this);\n } else {\n // this.__attributeIndex will be defined in this case, but\n // assert it in dev mode\n if (DEV_MODE && this.__attributeIndex === undefined) {\n throw new Error(`Expected this.__attributeIndex to be a number`);\n }\n const newValues = [...(this.__part._$committedValue as Array<unknown>)];\n newValues[this.__attributeIndex!] = value;\n (this.__part as AttributePart)._$setValue(newValues, this, 0);\n }\n }\n\n /**\n * User callbacks for implementing logic to release any resources/subscriptions\n * that may have been retained by this directive. Since directives may also be\n * re-connected, `reconnected` should also be implemented to restore the\n * working state of the directive prior to the next render.\n */\n protected disconnected() {}\n protected reconnected() {}\n}\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.async = void 0;\nconst directive_1 = require(\"lit-html/directive\");\nconst async_directive_1 = require(\"lit-html/async-directive\");\nconst lit_html_1 = require(\"lit-html\");\nclass ObserveDirective extends async_directive_1.AsyncDirective {\n // When the observable changes, unsubscribe to the old one and\n // subscribe to the new one\n render(asyncResult) {\n if ('then' in asyncResult) {\n Promise.resolve(asyncResult).then((v) => this.setValue(v));\n return '';\n }\n if (this.observable !== asyncResult) {\n this.unsubscribe();\n this.observable = asyncResult;\n if (this.isConnected) {\n this.subscribe(asyncResult);\n }\n }\n return lit_html_1.noChange;\n }\n // Subscribes to the observable, calling the directive's asynchronous\n // setValue API each time the value changes\n subscribe(observable) {\n this.subscription = observable.subscribe((v) => {\n this.setValue(v);\n });\n }\n // When the directive is disconnected from the DOM, unsubscribe to ensure\n // the directive instance can be garbage collected\n disconnected() {\n this.unsubscribe();\n }\n unsubscribe() {\n if (this.subscription) {\n this.subscription.unsubscribe();\n }\n }\n // If the subtree the directive is in was disconneted and subsequently\n // re-connected, re-subscribe to make the directive operable again\n reconnected() {\n this.subscribe(this.observable);\n }\n}\nexports.async = (0, directive_1.directive)(ObserveDirective);\n", "/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport type {TemplateResult} from './lit-html.js';\n\nimport {noChange, RenderOptions, _$LH} from './lit-html.js';\nimport {AttributePartInfo, PartType} from './directive.js';\nimport {\n isPrimitive,\n isSingleExpression,\n isTemplateResult,\n} from './directive-helpers.js';\n\nconst {\n _TemplateInstance: TemplateInstance,\n _isIterable: isIterable,\n _resolveDirective: resolveDirective,\n _ChildPart: ChildPart,\n _ElementPart: ElementPart,\n} = _$LH;\n\ntype ChildPart = InstanceType<typeof ChildPart>;\ntype TemplateInstance = InstanceType<typeof TemplateInstance>;\n\n/**\n * Information needed to rehydrate a single TemplateResult.\n */\ntype ChildPartState =\n | {\n type: 'leaf';\n /** The ChildPart that the result is rendered to */\n part: ChildPart;\n }\n | {\n type: 'iterable';\n /** The ChildPart that the result is rendered to */\n part: ChildPart;\n value: Iterable<unknown>;\n iterator: Iterator<unknown>;\n done: boolean;\n }\n | {\n type: 'template-instance';\n /** The ChildPart that the result is rendered to */\n part: ChildPart;\n\n result: TemplateResult;\n\n /** The TemplateInstance created from the TemplateResult */\n instance: TemplateInstance;\n\n /**\n * The index of the next Template part to be hydrated. This is mutable and\n * updated as the tree walk discovers new part markers at the right level in\n * the template instance tree. Note there is only one Template part per\n * attribute with (one or more) bindings.\n */\n templatePartIndex: number;\n\n /**\n * The index of the next TemplateInstance part to be hydrated. This is used\n * to retrieve the value from the TemplateResult and initialize the\n * TemplateInstance parts' values for dirty-checking on first render.\n */\n instancePartIndex: number;\n };\n\n/**\n * hydrate() operates on a container with server-side rendered content and\n * restores the client side data structures needed for lit-html updates such as\n * TemplateInstances and Parts. After calling `hydrate`, lit-html will behave as\n * if it initially rendered the DOM, and any subsequent updates will update\n * efficiently, the same as if lit-html had rendered the DOM on the client.\n *\n * hydrate() must be called on DOM that adheres the to lit-ssr structure for\n * parts. ChildParts must be represented with both a start and end comment\n * marker, and ChildParts that contain a TemplateInstance must have the template\n * digest written into the comment data.\n *\n * Since render() encloses its output in a ChildPart, there must always be a root\n * ChildPart.\n *\n * Example (using for # ... for annotations in HTML)\n *\n * Given this input:\n *\n * html`<div class=${x}>${y}</div>`\n *\n * The SSR DOM is:\n *\n * <!--lit-part AEmR7W+R0Ak=--> # Start marker for the root ChildPart created\n * # by render(). Includes the digest of the\n * # template\n * <div class=\"TEST_X\">\n * <!--lit-node 0--> # Indicates there are attribute bindings here\n * # The number is the depth-first index of the parent\n * # node in the template.\n * <!--lit-part--> # Start marker for the ${x} expression\n * TEST_Y\n * <!--/lit-part--> # End marker for the ${x} expression\n * </div>\n *\n * <!--/lit-part--> # End marker for the root ChildPart\n *\n * @param rootValue\n * @param container\n * @param userOptions\n */\nexport const hydrate = (\n rootValue: unknown,\n container: Element | DocumentFragment,\n options: Partial<RenderOptions> = {}\n) => {\n // TODO(kschaaf): Do we need a helper for _$litPart$ (\"part for node\")?\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((container as any)['_$litPart$'] !== undefined) {\n throw new Error('container already contains a live render');\n }\n\n // Since render() creates a ChildPart to render into, we'll always have\n // exactly one root part. We need to hold a reference to it so we can set\n // it in the parts cache.\n let rootPart: ChildPart | undefined = undefined;\n\n // When we are in-between ChildPart markers, this is the current ChildPart.\n // It's needed to be able to set the ChildPart's endNode when we see a\n // close marker\n let currentChildPart: ChildPart | undefined = undefined;\n\n // Used to remember parent template state as we recurse into nested\n // templates\n const stack: Array<ChildPartState> = [];\n\n const walker = document.createTreeWalker(\n container,\n NodeFilter.SHOW_COMMENT,\n null,\n false\n );\n let marker: Comment | null;\n\n // Walk the DOM looking for part marker comments\n while ((marker = walker.nextNode() as Comment | null) !== null) {\n const markerText = marker.data;\n if (markerText.startsWith('lit-part')) {\n if (stack.length === 0 && rootPart !== undefined) {\n throw new Error('there must be only one root part per container');\n }\n // Create a new ChildPart and push it onto the stack\n currentChildPart = openChildPart(rootValue, marker, stack, options);\n rootPart ??= currentChildPart;\n } else if (markerText.startsWith('lit-node')) {\n // Create and hydrate attribute parts into the current ChildPart on the\n // stack\n createAttributeParts(marker, stack, options);\n } else if (markerText.startsWith('/lit-part')) {\n // Close the current ChildPart, and pop the previous one off the stack\n if (stack.length === 1 && currentChildPart !== rootPart) {\n throw new Error('internal error');\n }\n currentChildPart = closeChildPart(marker, currentChildPart, stack);\n }\n }\n console.assert(\n rootPart !== undefined,\n 'there should be exactly one root part in a render container'\n );\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (container as any)['_$litPart$'] = rootPart;\n};\n\nconst openChildPart = (\n rootValue: unknown,\n marker: Comment,\n stack: Array<ChildPartState>,\n options: RenderOptions\n) => {\n let value: unknown;\n // We know the startNode now. We'll know the endNode when we get to\n // the matching marker and set it in closeChildPart()\n // TODO(kschaaf): Current constructor takes both nodes\n let part;\n if (stack.length === 0) {\n part = new ChildPart(marker, null, undefined, options);\n value = rootValue;\n } else {\n const state = stack[stack.length - 1];\n if (state.type === 'template-instance') {\n part = new ChildPart(marker, null, state.instance, options);\n state.instance._parts.push(part);\n value = state.result.values[state.instancePartIndex++];\n state.templatePartIndex++;\n } else if (state.type === 'iterable') {\n part = new ChildPart(marker, null, state.part, options);\n const result = state.iterator.next();\n if (result.done) {\n value = undefined;\n state.done = true;\n throw new Error('Unhandled shorter than expected iterable');\n } else {\n value = result.value;\n }\n (state.part._$committedValue as Array<ChildPart>).push(part);\n } else {\n // state.type === 'leaf'\n // TODO(kschaaf): This is unexpected, and likely a result of a primitive\n // been rendered on the client when a TemplateResult was rendered on the\n // server; this part will be hydrated but not used. We can detect it, but\n // we need to decide what to do in this case. Note that this part won't be\n // retained by any parent TemplateInstance, since a primitive had been\n // rendered in its place.\n // https://github.com/lit/lit/issues/1434\n // throw new Error('Hydration value mismatch: Found a TemplateInstance' +\n // 'where a leaf value was expected');\n part = new ChildPart(marker, null, state.part, options);\n }\n }\n\n // Initialize the ChildPart state depending on the type of value and push\n // it onto the stack. This logic closely follows the ChildPart commit()\n // cascade order:\n // 1. directive\n // 2. noChange\n // 3. primitive (note strings must be handled before iterables, since they\n // are iterable)\n // 4. TemplateResult\n // 5. Node (not yet implemented, but fallback handling is fine)\n // 6. Iterable\n // 7. nothing (handled in fallback)\n // 8. Fallback for everything else\n value = resolveDirective(part, value);\n if (value === noChange) {\n stack.push({part, type: 'leaf'});\n } else if (isPrimitive(value)) {\n stack.push({part, type: 'leaf'});\n part._$committedValue = value;\n // TODO(kschaaf): We can detect when a primitive is being hydrated on the\n // client where a TemplateResult was rendered on the server, but we need to\n // decide on a strategy for what to do next.\n // https://github.com/lit/lit/issues/1434\n // if (marker.data !== 'lit-part') {\n // throw new Error('Hydration value mismatch: Primitive found where TemplateResult expected');\n // }\n } else if (isTemplateResult(value)) {\n // Check for a template result digest\n const markerWithDigest = `lit-part ${digestForTemplateResult(value)}`;\n if (marker.data === markerWithDigest) {\n const template = ChildPart.prototype._$getTemplate(value);\n const instance = new TemplateInstance(template, part);\n stack.push({\n type: 'template-instance',\n instance,\n part,\n templatePartIndex: 0,\n instancePartIndex: 0,\n result: value,\n });\n // For TemplateResult values, we set the part value to the\n // generated TemplateInstance\n part._$committedValue = instance;\n } else {\n // TODO: if this isn't the server-rendered template, do we\n // need to stop hydrating this subtree? Clear it? Add tests.\n throw new Error(\n 'Hydration value mismatch: Unexpected TemplateResult rendered to part'\n );\n }\n } else if (isIterable(value)) {\n // currentChildPart.value will contain an array of ChildParts\n stack.push({\n part: part,\n type: 'iterable',\n value,\n iterator: value[Symbol.iterator](),\n done: false,\n });\n part._$committedValue = [];\n } else {\n // Fallback for everything else (nothing, Objects, Functions,\n // etc.): we just initialize the part's value\n // Note that `Node` value types are not currently supported during\n // SSR, so that part of the cascade is missing.\n stack.push({part: part, type: 'leaf'});\n part._$committedValue = value == null ? '' : value;\n }\n return part;\n};\n\nconst closeChildPart = (\n marker: Comment,\n part: ChildPart | undefined,\n stack: Array<ChildPartState>\n): ChildPart | undefined => {\n if (part === undefined) {\n throw new Error('unbalanced part marker');\n }\n\n part._$endNode = marker;\n\n const currentState = stack.pop()!;\n\n if (currentState.type === 'iterable') {\n if (!currentState.iterator.next().done) {\n throw new Error('unexpected longer than expected iterable');\n }\n }\n\n if (stack.length > 0) {\n const state = stack[stack.length - 1];\n return state.part;\n } else {\n return undefined;\n }\n};\n\nconst createAttributeParts = (\n comment: Comment,\n stack: Array<ChildPartState>,\n options: RenderOptions\n) => {\n // Get the nodeIndex from DOM. We're only using this for an integrity\n // check right now, we might not need it.\n const match = /lit-node (\\d+)/.exec(comment.data)!;\n const nodeIndex = parseInt(match[1]);\n\n // For void elements, the node the comment was referring to will be\n // the previousSibling; for non-void elements, the comment is guaranteed\n // to be the first child of the element (i.e. it won't have a previousSibling\n // meaning it should use the parentElement)\n const node = comment.previousElementSibling ?? comment.parentElement;\n if (node === null) {\n throw new Error('could not find node for attribute parts');\n }\n // Remove `defer-hydration` attribute, if any\n node.removeAttribute('defer-hydration');\n\n const state = stack[stack.length - 1];\n if (state.type === 'template-instance') {\n const instance = state.instance;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n // If the next template part is in attribute-position on the current node,\n // create the instance part for it and prime its state\n const templatePart = instance._$template.parts[state.templatePartIndex];\n if (\n templatePart === undefined ||\n (templatePart.type !== PartType.ATTRIBUTE &&\n templatePart.type !== PartType.ELEMENT) ||\n templatePart.index !== nodeIndex\n ) {\n break;\n }\n\n if (templatePart.type === PartType.ATTRIBUTE) {\n // The instance part is created based on the constructor saved in the\n // template part\n const instancePart = new templatePart.ctor(\n node as HTMLElement,\n templatePart.name,\n templatePart.strings,\n state.instance,\n options\n );\n\n const value = isSingleExpression(\n instancePart as unknown as AttributePartInfo\n )\n ? state.result.values[state.instancePartIndex]\n : state.result.values;\n\n // Setting the attribute value primes committed value with the resolved\n // directive value; we only then commit that value for event/property\n // parts since those were not serialized, and pass `noCommit` for the\n // others to avoid perf impact of touching the DOM unnecessarily\n const noCommit = !(\n instancePart.type === PartType.EVENT ||\n instancePart.type === PartType.PROPERTY\n );\n instancePart._$setValue(\n value,\n instancePart,\n state.instancePartIndex,\n noCommit\n );\n state.instancePartIndex += templatePart.strings.length - 1;\n instance._parts.push(instancePart);\n } else {\n // templatePart.type === PartType.ELEMENT\n const instancePart = new ElementPart(node, state.instance, options);\n resolveDirective(\n instancePart,\n state.result.values[state.instancePartIndex++]\n );\n instance._parts.push(instancePart);\n }\n state.templatePartIndex++;\n }\n } else {\n throw new Error('internal error');\n }\n};\n\n// Number of 32 bit elements to use to create template digests\nconst digestSize = 2;\n// We need to specify a digest to use across rendering environments. This is a\n// simple digest build from a DJB2-ish hash modified from:\n// https://github.com/darkskyapp/string-hash/blob/master/index.js\n// It has been changed to an array of hashes to add additional bits.\n// Goals:\n// - Extremely low collision rate. We may not be able to detect collisions.\n// - Extremely fast.\n// - Extremely small code size.\n// - Safe to include in HTML comment text or attribute value.\n// - Easily specifiable and implementable in multiple languages.\n// We don't care about cryptographic suitability.\nexport const digestForTemplateResult = (templateResult: TemplateResult) => {\n const hashes = new Uint32Array(digestSize).fill(5381);\n\n for (const s of templateResult.strings) {\n for (let i = 0; i < s.length; i++) {\n hashes[i % digestSize] = (hashes[i % digestSize] * 33) ^ s.charCodeAt(i);\n }\n }\n return btoa(String.fromCharCode(...new Uint8Array(hashes.buffer)));\n};\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * LitElement support for hydration of content rendered using lit-ssr.\n *\n * @packageDocumentation\n */\n\nimport type {PropertyValues} from '@lit/reactive-element';\nimport {render, RenderOptions} from 'lit-html';\nimport {hydrate} from 'lit-html/experimental-hydrate.js';\n\ninterface PatchableLitElement extends HTMLElement {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-misused-new\n new (...args: any[]): PatchableLitElement;\n enableUpdating(requestedUpdate?: boolean): void;\n createRenderRoot(): Element | ShadowRoot;\n renderRoot: HTMLElement | DocumentFragment;\n render(): unknown;\n renderOptions: RenderOptions;\n _$needsHydration: boolean;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nglobalThis.litElementHydrateSupport = ({\n LitElement,\n}: {\n LitElement: PatchableLitElement;\n}) => {\n const observedAttributes = Object.getOwnPropertyDescriptor(\n Object.getPrototypeOf(LitElement),\n 'observedAttributes'\n )!.get!;\n\n // Add `defer-hydration` to observedAttributes\n Object.defineProperty(LitElement, 'observedAttributes', {\n get() {\n return [...observedAttributes.call(this), 'defer-hydration'];\n },\n });\n\n // Enable element when 'defer-hydration' attribute is removed by calling the\n // super.connectedCallback()\n const attributeChangedCallback =\n LitElement.prototype.attributeChangedCallback;\n LitElement.prototype.attributeChangedCallback = function (\n name: string,\n old: string | null,\n value: string | null\n ) {\n if (name === 'defer-hydration' && value === null) {\n connectedCallback.call(this);\n }\n attributeChangedCallback.call(this, name, old, value);\n };\n\n // Override `connectedCallback` to capture whether we need hydration, and\n // defer `super.connectedCallback()` if the 'defer-hydration' attribute is set\n const connectedCallback = LitElement.prototype.connectedCallback;\n LitElement.prototype.connectedCallback = function (\n this: PatchableLitElement\n ) {\n // If the outer scope of this element has not yet been hydrated, wait until\n // 'defer-hydration' attribute has been removed to enable\n if (!this.hasAttribute('defer-hydration')) {\n connectedCallback.call(this);\n }\n };\n\n // If we've been server-side rendered, just return `this.shadowRoot`, don't\n // call the base implementation, which would also adopt styles (for now)\n const createRenderRoot = LitElement.prototype.createRenderRoot;\n LitElement.prototype.createRenderRoot = function (this: PatchableLitElement) {\n if (this.shadowRoot) {\n this._$needsHydration = true;\n return this.shadowRoot;\n } else {\n return createRenderRoot.call(this);\n }\n };\n\n // Hydrate on first update when needed\n const update = Object.getPrototypeOf(LitElement.prototype).update;\n LitElement.prototype.update = function (\n this: PatchableLitElement,\n changedProperties: PropertyValues\n ) {\n const value = this.render();\n // Since this is a patch, we can't call super.update(), so we capture\n // it off the proto chain and call it instead\n update.call(this, changedProperties);\n if (this._$needsHydration) {\n this._$needsHydration = false;\n hydrate(value, this.renderRoot, this.renderOptions);\n } else {\n render(value, this.renderRoot, this.renderOptions);\n }\n };\n};\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * lit-html patch to support browsers without native web components.\n *\n * This module should be used in addition to loading the web components\n * polyfills via @webcomponents/webcomponentjs. When using those polyfills\n * support for polyfilled Shadow DOM is automatic via the ShadyDOM polyfill.\n * Scoping classes are added to DOM nodes to facilitate CSS scoping that\n * simulates the style scoping Shadow DOM provides. ShadyDOM does this scoping\n * to all elements added to the DOM. This module provides an important\n * optimization for this process by pre-scoping lit-html template\n * DOM. This means ShadyDOM does not have to scope each instance of the\n * template DOM. Instead, each template is scoped only once.\n *\n * Creating scoped CSS is not covered by this module. It is, however, integrated\n * into the lit-element and @lit/reactive-element packages. See the ShadyCSS docs\n * for how to apply scoping to CSS:\n * https://github.com/webcomponents/polyfills/tree/master/packages/shadycss#usage.\n *\n * @packageDocumentation\n */\n\nexport {};\n\ninterface RenderOptions {\n readonly renderBefore?: ChildNode | null;\n scope?: string;\n}\n\ninterface ShadyTemplateResult {\n strings: TemplateStringsArray;\n // This property needs to remain unminified.\n ['_$litType$']?: string;\n}\n\n// Note, this is a dummy type as the full type here is big.\ninterface Directive {\n __directive?: Directive;\n}\n\ninterface DirectiveParent {\n _$parent?: DirectiveParent;\n __directive?: Directive;\n __directives?: Array<Directive | undefined>;\n}\n\ninterface PatchableChildPartConstructor {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-misused-new\n new (...args: any[]): PatchableChildPart;\n}\n\ninterface PatchableChildPart {\n __directive?: Directive;\n _$committedValue: unknown;\n _$startNode: ChildNode;\n _$endNode: ChildNode | null;\n options: RenderOptions;\n _$setValue(value: unknown, directiveParent: DirectiveParent): void;\n _$getTemplate(result: ShadyTemplateResult): HTMLTemplateElement;\n}\n\ninterface PatchableTemplate {\n el: HTMLTemplateElement;\n}\n\ninterface PatchableTemplateConstructor {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-misused-new\n new (...args: any[]): PatchableTemplate;\n createElement(html: string, options?: RenderOptions): HTMLTemplateElement;\n}\n\ninterface PatchableTemplateInstance {\n _$template: PatchableTemplate;\n}\n\n// Scopes that have had styling prepared. Note, must only be done once per\n// scope.\nconst styledScopes: Set<string> = new Set();\n// Map of css per scope. This is collected during first scope render, used when\n// styling is prepared, and then discarded.\nconst scopeCssStore: Map<string, string[]> = new Map();\n\nconst ENABLE_SHADYDOM_NOPATCH = true;\n\n// Note, explicitly use `var` here so that this can be re-defined when\n// bundled.\n// eslint-disable-next-line no-var\nvar DEV_MODE = true;\n\n/**\n * lit-html patches. These properties cannot be renamed.\n * * ChildPart.prototype._$getTemplate\n * * ChildPart.prototype._$setValue\n */\nconst polyfillSupport: NonNullable<typeof litHtmlPolyfillSupport> = (\n Template: PatchableTemplateConstructor,\n ChildPart: PatchableChildPartConstructor\n) => {\n // polyfill-support is only needed if ShadyCSS or the ApplyShim is in use\n // We test at the point of patching, which makes it safe to load\n // webcomponentsjs and polyfill-support in either order\n if (\n window.ShadyCSS === undefined ||\n (window.ShadyCSS.nativeShadow && !window.ShadyCSS.ApplyShim)\n ) {\n return;\n }\n\n // console.log(\n // '%c Making lit-html compatible with ShadyDOM/CSS.',\n // 'color: lightgreen; font-style: italic'\n // );\n\n const wrap =\n ENABLE_SHADYDOM_NOPATCH &&\n window.ShadyDOM?.inUse &&\n window.ShadyDOM?.noPatch === true\n ? window.ShadyDOM!.wrap\n : (node: Node) => node;\n\n const needsPrepareStyles = (name: string | undefined) =>\n name !== undefined && !styledScopes.has(name);\n\n const cssForScope = (name: string) => {\n let scopeCss = scopeCssStore.get(name);\n if (scopeCss === undefined) {\n scopeCssStore.set(name, (scopeCss = []));\n }\n return scopeCss;\n };\n\n const prepareStyles = (name: string, template: HTMLTemplateElement) => {\n // Get styles\n const scopeCss = cssForScope(name);\n const hasScopeCss = scopeCss.length !== 0;\n if (hasScopeCss) {\n const style = document.createElement('style');\n style.textContent = scopeCss.join('\\n');\n // Note, it's important to add the style to the *end* of the template so\n // it doesn't mess up part indices.\n template.content.appendChild(style);\n }\n // Mark this scope as styled.\n styledScopes.add(name);\n // Remove stored data since it's no longer needed.\n scopeCssStore.delete(name);\n // ShadyCSS removes scopes and removes the style under ShadyDOM and leaves\n // it under native Shadow DOM\n window.ShadyCSS!.prepareTemplateStyles(template, name);\n // Note, under native Shadow DOM, the style is added to the beginning of the\n // template. It must be moved to the *end* of the template so it doesn't\n // mess up part indices.\n if (hasScopeCss && window.ShadyCSS!.nativeShadow) {\n // If there were styles but the CSS text was empty, ShadyCSS will\n // eliminate the style altogether, so the style here could be null\n const style = template.content.querySelector('style');\n if (style !== null) {\n template.content.appendChild(style);\n }\n }\n };\n\n const scopedTemplateCache = new Map<\n string | undefined,\n Map<TemplateStringsArray, PatchableTemplate>\n >();\n\n /**\n * Override to extract style elements from the template\n * and store all style.textContent in the shady scope data.\n * Note, it's ok to patch Template since it's only used via ChildPart.\n */\n const originalCreateElement = Template.createElement;\n Template.createElement = function (html: string, options?: RenderOptions) {\n const element = originalCreateElement.call(Template, html, options);\n const scope = options?.scope;\n if (scope !== undefined) {\n if (!window.ShadyCSS!.nativeShadow) {\n window.ShadyCSS!.prepareTemplateDom(element, scope);\n }\n // Process styles only if this scope is being prepared. Otherwise,\n // leave styles as is for back compat with Lit1.\n if (needsPrepareStyles(scope)) {\n const scopeCss = cssForScope(scope);\n // Remove styles and store textContent.\n const styles = element.content.querySelectorAll(\n 'style'\n ) as NodeListOf<HTMLStyleElement>;\n // Store the css in this template in the scope css and remove the <style>\n // from the template _before_ the node-walk captures part indices\n scopeCss.push(\n ...Array.from(styles).map((style) => {\n style.parentNode?.removeChild(style);\n return style.textContent!;\n })\n );\n }\n }\n return element;\n };\n\n const renderContainer = document.createDocumentFragment();\n const renderContainerMarker = document.createComment('');\n\n const childPartProto = ChildPart.prototype;\n /**\n * Patch to apply gathered css via ShadyCSS. This is done only once per scope.\n */\n const setValue = childPartProto._$setValue;\n childPartProto._$setValue = function (\n this: PatchableChildPart,\n value: unknown,\n directiveParent: DirectiveParent = this\n ) {\n const container = wrap(this._$startNode).parentNode!;\n const scope = this.options?.scope;\n if (container instanceof ShadowRoot && needsPrepareStyles(scope)) {\n // Note, @apply requires outer => inner scope rendering on initial\n // scope renders to apply property values correctly. Style preparation\n // is tied to rendering into `shadowRoot`'s and this is typically done by\n // custom elements. If this is done in `connectedCallback`, as is typical,\n // the code below ensures the right order since content is rendered\n // into a fragment first so the hosting element can prepare styles first.\n // If rendering is done in the constructor, this won't work, but that's\n // not supported in ShadyDOM anyway.\n const startNode = this._$startNode;\n const endNode = this._$endNode;\n\n // Temporarily move this part into the renderContainer.\n renderContainer.appendChild(renderContainerMarker);\n this._$startNode = renderContainerMarker;\n this._$endNode = null;\n\n // Note, any nested template results render here and their styles will\n // be extracted and collected.\n setValue.call(this, value, directiveParent);\n\n // Get the template for this result or create a dummy one if a result\n // is not being rendered.\n // This property needs to remain unminified.\n const template = (value as ShadyTemplateResult)?.['_$litType$']\n ? (this._$committedValue as PatchableTemplateInstance)._$template.el\n : document.createElement('template');\n prepareStyles(scope!, template);\n\n // Note, this is the temporary startNode.\n renderContainer.removeChild(renderContainerMarker);\n // When using native Shadow DOM, include prepared style in shadowRoot.\n if (window.ShadyCSS?.nativeShadow) {\n const style = template.content.querySelector('style');\n if (style !== null) {\n renderContainer.appendChild(style.cloneNode(true));\n }\n }\n container.insertBefore(renderContainer, endNode);\n // Move part back to original container.\n this._$startNode = startNode;\n this._$endNode = endNode;\n } else {\n setValue.call(this, value, directiveParent);\n }\n };\n\n /**\n * Patch ChildPart._$getTemplate to look up templates in a cache bucketed\n * by element name.\n */\n childPartProto._$getTemplate = function (\n this: PatchableChildPart,\n result: ShadyTemplateResult\n ) {\n const scope = this.options?.scope;\n let templateCache = scopedTemplateCache.get(scope);\n if (templateCache === undefined) {\n scopedTemplateCache.set(scope, (templateCache = new Map()));\n }\n let template = templateCache.get(result.strings);\n if (template === undefined) {\n templateCache.set(\n result.strings,\n (template = new Template(result, this.options))\n );\n }\n return template;\n };\n};\n\nif (ENABLE_SHADYDOM_NOPATCH) {\n polyfillSupport.noPatchSupported = ENABLE_SHADYDOM_NOPATCH;\n}\n\nif (DEV_MODE) {\n globalThis.litHtmlPolyfillSupportDevMode ??= polyfillSupport;\n} else {\n globalThis.litHtmlPolyfillSupport ??= polyfillSupport;\n}\n", "/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nconst NODE_MODE = false;\nconst global = NODE_MODE ? globalThis : window;\n\n/**\n * Whether the current browser supports `adoptedStyleSheets`.\n */\nexport const supportsAdoptingStyleSheets =\n global.ShadowRoot &&\n (global.ShadyCSS === undefined || global.ShadyCSS.nativeShadow) &&\n 'adoptedStyleSheets' in Document.prototype &&\n 'replace' in CSSStyleSheet.prototype;\n\n/**\n * A CSSResult or native CSSStyleSheet.\n *\n * In browsers that support constructible CSS style sheets, CSSStyleSheet\n * object can be used for styling along side CSSResult from the `css`\n * template tag.\n */\nexport type CSSResultOrNative = CSSResult | CSSStyleSheet;\n\nexport type CSSResultArray = Array<CSSResultOrNative | CSSResultArray>;\n\n/**\n * A single CSSResult, CSSStyleSheet, or an array or nested arrays of those.\n */\nexport type CSSResultGroup = CSSResultOrNative | CSSResultArray;\n\nconst constructionToken = Symbol();\n\nconst cssTagCache = new WeakMap<TemplateStringsArray, CSSStyleSheet>();\n\n/**\n * A container for a string of CSS text, that may be used to create a CSSStyleSheet.\n *\n * CSSResult is the return value of `css`-tagged template literals and\n * `unsafeCSS()`. In order to ensure that CSSResults are only created via the\n * `css` tag and `unsafeCSS()`, CSSResult cannot be constructed directly.\n */\nexport class CSSResult {\n // This property needs to remain unminified.\n ['_$cssResult$'] = true;\n readonly cssText: string;\n private _styleSheet?: CSSStyleSheet;\n private _strings: TemplateStringsArray | undefined;\n\n private constructor(\n cssText: string,\n strings: TemplateStringsArray | undefined,\n safeToken: symbol\n ) {\n if (safeToken !== constructionToken) {\n throw new Error(\n 'CSSResult is not constructable. Use `unsafeCSS` or `css` instead.'\n );\n }\n this.cssText = cssText;\n this._strings = strings;\n }\n\n // This is a getter so that it's lazy. In practice, this means stylesheets\n // are not created until the first element instance is made.\n get styleSheet(): CSSStyleSheet | undefined {\n // If `supportsAdoptingStyleSheets` is true then we assume CSSStyleSheet is\n // constructable.\n let styleSheet = this._styleSheet;\n const strings = this._strings;\n if (supportsAdoptingStyleSheets && styleSheet === undefined) {\n const cacheable = strings !== undefined && strings.length === 1;\n if (cacheable) {\n styleSheet = cssTagCache.get(strings);\n }\n if (styleSheet === undefined) {\n (this._styleSheet = styleSheet = new CSSStyleSheet()).replaceSync(\n this.cssText\n );\n if (cacheable) {\n cssTagCache.set(strings, styleSheet);\n }\n }\n }\n return styleSheet;\n }\n\n toString(): string {\n return this.cssText;\n }\n}\n\ntype ConstructableCSSResult = CSSResult & {\n new (\n cssText: string,\n strings: TemplateStringsArray | undefined,\n safeToken: symbol\n ): CSSResult;\n};\n\nconst textFromCSSResult = (value: CSSResultGroup | number) => {\n // This property needs to remain unminified.\n if ((value as CSSResult)['_$cssResult$'] === true) {\n return (value as CSSResult).cssText;\n } else if (typeof value === 'number') {\n return value;\n } else {\n throw new Error(\n `Value passed to 'css' function must be a 'css' function result: ` +\n `${value}. Use 'unsafeCSS' to pass non-literal values, but take care ` +\n `to ensure page security.`\n );\n }\n};\n\n/**\n * Wrap a value for interpolation in a {@linkcode css} tagged template literal.\n *\n * This is unsafe because untrusted CSS text can be used to phone home\n * or exfiltrate data to an attacker controlled site. Take care to only use\n * this with trusted input.\n */\nexport const unsafeCSS = (value: unknown) =>\n new (CSSResult as ConstructableCSSResult)(\n typeof value === 'string' ? value : String(value),\n undefined,\n constructionToken\n );\n\n/**\n * A template literal tag which can be used with LitElement's\n * {@linkcode LitElement.styles} property to set element styles.\n *\n * For security reasons, only literal string values and number may be used in\n * embedded expressions. To incorporate non-literal values {@linkcode unsafeCSS}\n * may be used inside an expression.\n */\nexport const css = (\n strings: TemplateStringsArray,\n ...values: (CSSResultGroup | number)[]\n): CSSResult => {\n const cssText =\n strings.length === 1\n ? strings[0]\n : values.reduce(\n (acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1],\n strings[0]\n );\n return new (CSSResult as ConstructableCSSResult)(\n cssText,\n strings,\n constructionToken\n );\n};\n\n/**\n * Applies the given styles to a `shadowRoot`. When Shadow DOM is\n * available but `adoptedStyleSheets` is not, styles are appended to the\n * `shadowRoot` to [mimic spec behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).\n * Note, when shimming is used, any styles that are subsequently placed into\n * the shadowRoot should be placed *before* any shimmed adopted styles. This\n * will match spec behavior that gives adopted sheets precedence over styles in\n * shadowRoot.\n */\nexport const adoptStyles = (\n renderRoot: ShadowRoot,\n styles: Array<CSSResultOrNative>\n) => {\n if (supportsAdoptingStyleSheets) {\n (renderRoot as ShadowRoot).adoptedStyleSheets = styles.map((s) =>\n s instanceof CSSStyleSheet ? s : s.styleSheet!\n );\n } else {\n styles.forEach((s) => {\n const style = document.createElement('style');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const nonce = (global as any)['litNonce'];\n if (nonce !== undefined) {\n style.setAttribute('nonce', nonce);\n }\n style.textContent = (s as CSSResult).cssText;\n renderRoot.appendChild(style);\n });\n }\n};\n\nconst cssResultFromStyleSheet = (sheet: CSSStyleSheet) => {\n let cssText = '';\n for (const rule of sheet.cssRules) {\n cssText += rule.cssText;\n }\n return unsafeCSS(cssText);\n};\n\nexport const getCompatibleStyle =\n supportsAdoptingStyleSheets ||\n (NODE_MODE && global.CSSStyleSheet === undefined)\n ? (s: CSSResultOrNative) => s\n : (s: CSSResultOrNative) =>\n s instanceof CSSStyleSheet ? cssResultFromStyleSheet(s) : s;\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Use this module if you want to create your own base class extending\n * {@link ReactiveElement}.\n * @packageDocumentation\n */\n\nimport {\n getCompatibleStyle,\n adoptStyles,\n CSSResultGroup,\n CSSResultOrNative,\n} from './css-tag.js';\nimport type {\n ReactiveController,\n ReactiveControllerHost,\n} from './reactive-controller.js';\n\nexport * from './css-tag.js';\nexport type {\n ReactiveController,\n ReactiveControllerHost,\n} from './reactive-controller.js';\n\nconst NODE_MODE = false;\nconst global = NODE_MODE ? globalThis : window;\n\nif (NODE_MODE) {\n global.customElements ??= {\n define() {},\n } as unknown as CustomElementRegistry;\n}\n\nconst DEV_MODE = true;\n\nlet requestUpdateThenable: (name: string) => {\n then: (\n onfulfilled?: (value: boolean) => void,\n _onrejected?: () => void\n ) => void;\n};\n\nlet issueWarning: (code: string, warning: string) => void;\n\nconst trustedTypes = (global as unknown as {trustedTypes?: {emptyScript: ''}})\n .trustedTypes;\n\n// Temporary workaround for https://crbug.com/993268\n// Currently, any attribute starting with \"on\" is considered to be a\n// TrustedScript source. Such boolean attributes must be set to the equivalent\n// trusted emptyScript value.\nconst emptyStringForBooleanAttribute = trustedTypes\n ? (trustedTypes.emptyScript as unknown as '')\n : '';\n\nconst polyfillSupport = DEV_MODE\n ? global.reactiveElementPolyfillSupportDevMode\n : global.reactiveElementPolyfillSupport;\n\nif (DEV_MODE) {\n // Ensure warnings are issued only 1x, even if multiple versions of Lit\n // are loaded.\n const issuedWarnings: Set<string | undefined> = (global.litIssuedWarnings ??=\n new Set());\n\n // Issue a warning, if we haven't already.\n issueWarning = (code: string, warning: string) => {\n warning += ` See https://lit.dev/msg/${code} for more information.`;\n if (!issuedWarnings.has(warning)) {\n console.warn(warning);\n issuedWarnings.add(warning);\n }\n };\n\n issueWarning(\n 'dev-mode',\n `Lit is in dev mode. Not recommended for production!`\n );\n\n // Issue polyfill support warning.\n if (global.ShadyDOM?.inUse && polyfillSupport === undefined) {\n issueWarning(\n 'polyfill-support-missing',\n `Shadow DOM is being polyfilled via \\`ShadyDOM\\` but ` +\n `the \\`polyfill-support\\` module has not been loaded.`\n );\n }\n\n requestUpdateThenable = (name) => ({\n then: (\n onfulfilled?: (value: boolean) => void,\n _onrejected?: () => void\n ) => {\n issueWarning(\n 'request-update-promise',\n `The \\`requestUpdate\\` method should no longer return a Promise but ` +\n `does so on \\`${name}\\`. Use \\`updateComplete\\` instead.`\n );\n if (onfulfilled !== undefined) {\n onfulfilled(false);\n }\n },\n });\n}\n\n/**\n * Contains types that are part of the unstable debug API.\n *\n * Everything in this API is not stable and may change or be removed in the future,\n * even on patch releases.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace ReactiveUnstable {\n /**\n * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true,\n * we will emit 'lit-debug' events to window, with live details about the update and render\n * lifecycle. These can be useful for writing debug tooling and visualizations.\n *\n * Please be aware that running with window.emitLitDebugLogEvents has performance overhead,\n * making certain operations that are normally very cheap (like a no-op render) much slower,\n * because we must copy data and dispatch events.\n */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace DebugLog {\n export type Entry = Update;\n export interface Update {\n kind: 'update';\n }\n }\n}\n\ninterface DebugLoggingWindow {\n // Even in dev mode, we generally don't want to emit these events, as that's\n // another level of cost, so only emit them when DEV_MODE is true _and_ when\n // window.emitLitDebugEvents is true.\n emitLitDebugLogEvents?: boolean;\n}\n\n/**\n * Useful for visualizing and logging insights into what the Lit template system is doing.\n *\n * Compiled out of prod mode builds.\n */\nconst debugLogEvent = DEV_MODE\n ? (event: ReactiveUnstable.DebugLog.Entry) => {\n const shouldEmit = (global as unknown as DebugLoggingWindow)\n .emitLitDebugLogEvents;\n if (!shouldEmit) {\n return;\n }\n global.dispatchEvent(\n new CustomEvent<ReactiveUnstable.DebugLog.Entry>('lit-debug', {\n detail: event,\n })\n );\n }\n : undefined;\n\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\n/*@__INLINE__*/\nconst JSCompiler_renameProperty = <P extends PropertyKey>(\n prop: P,\n _obj: unknown\n): P => prop;\n\n/**\n * Converts property values to and from attribute values.\n */\nexport interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> {\n /**\n * Called to convert an attribute value to a property\n * value.\n */\n fromAttribute?(value: string | null, type?: TypeHint): Type;\n\n /**\n * Called to convert a property value to an attribute\n * value.\n *\n * It returns unknown instead of string, to be compatible with\n * https://github.com/WICG/trusted-types (and similar efforts).\n */\n toAttribute?(value: Type, type?: TypeHint): unknown;\n}\n\ntype AttributeConverter<Type = unknown, TypeHint = unknown> =\n | ComplexAttributeConverter<Type>\n | ((value: string | null, type?: TypeHint) => Type);\n\n/**\n * Defines options for a property accessor.\n */\nexport interface PropertyDeclaration<Type = unknown, TypeHint = unknown> {\n /**\n * When set to `true`, indicates the property is internal private state. The\n * property should not be set by users. When using TypeScript, this property\n * should be marked as `private` or `protected`, and it is also a common\n * practice to use a leading `_` in the name. The property is not added to\n * `observedAttributes`.\n */\n readonly state?: boolean;\n\n /**\n * Indicates how and whether the property becomes an observed attribute.\n * If the value is `false`, the property is not added to `observedAttributes`.\n * If true or absent, the lowercased property name is observed (e.g. `fooBar`\n * becomes `foobar`). If a string, the string value is observed (e.g\n * `attribute: 'foo-bar'`).\n */\n readonly attribute?: boolean | string;\n\n /**\n * Indicates the type of the property. This is used only as a hint for the\n * `converter` to determine how to convert the attribute\n * to/from a property.\n */\n readonly type?: TypeHint;\n\n /**\n * Indicates how to convert the attribute to/from a property. If this value\n * is a function, it is used to convert the attribute value a the property\n * value. If it's an object, it can have keys for `fromAttribute` and\n * `toAttribute`. If no `toAttribute` function is provided and\n * `reflect` is set to `true`, the property value is set directly to the\n * attribute. A default `converter` is used if none is provided; it supports\n * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,\n * when a property changes and the converter is used to update the attribute,\n * the property is never updated again as a result of the attribute changing,\n * and vice versa.\n */\n readonly converter?: AttributeConverter<Type, TypeHint>;\n\n /**\n * Indicates if the property should reflect to an attribute.\n * If `true`, when the property is set, the attribute is set using the\n * attribute name determined according to the rules for the `attribute`\n * property option and the value of the property converted using the rules\n * from the `converter` property option.\n */\n readonly reflect?: boolean;\n\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n\n /**\n * Indicates whether an accessor will be created for this property. By\n * default, an accessor will be generated for this property that requests an\n * update when set. If this flag is `true`, no accessor will be created, and\n * it will be the user's responsibility to call\n * `this.requestUpdate(propertyName, oldValue)` to request an update when\n * the property changes.\n */\n readonly noAccessor?: boolean;\n}\n\n/**\n * Map of properties to PropertyDeclaration options. For each property an\n * accessor is made, and the property is processed according to the\n * PropertyDeclaration options.\n */\nexport interface PropertyDeclarations {\n readonly [key: string]: PropertyDeclaration;\n}\n\ntype PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>;\n\ntype AttributeMap = Map<string, PropertyKey>;\n\n/**\n * A Map of property keys to values.\n *\n * Takes an optional type parameter T, which when specified as a non-any,\n * non-unknown type, will make the Map more strongly-typed, associating the map\n * keys with their corresponding value type on T.\n *\n * Use `PropertyValues<this>` when overriding ReactiveElement.update() and\n * other lifecycle methods in order to get stronger type-checking on keys\n * and values.\n */\n// This type is conditional so that if the parameter T is not specified, or\n// is `any`, the type will include `Map<PropertyKey, unknown>`. Since T is not\n// given in the uses of PropertyValues in this file, all uses here fallback to\n// meaning `Map<PropertyKey, unknown>`, but if a developer uses\n// `PropertyValues<this>` (or any other value for T) they will get a\n// strongly-typed Map type.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type PropertyValues<T = any> = T extends object\n ? PropertyValueMap<T>\n : Map<PropertyKey, unknown>;\n\n/**\n * Do not use, instead prefer {@linkcode PropertyValues}.\n */\n// This type must be exported such that JavaScript generated by the Google\n// Closure Compiler can import a type reference.\nexport interface PropertyValueMap<T> extends Map<PropertyKey, unknown> {\n get<K extends keyof T>(k: K): T[K];\n set<K extends keyof T>(key: K, value: T[K]): this;\n has<K extends keyof T>(k: K): boolean;\n delete<K extends keyof T>(k: K): boolean;\n}\n\nexport const defaultConverter: ComplexAttributeConverter = {\n toAttribute(value: unknown, type?: unknown): unknown {\n switch (type) {\n case Boolean:\n value = value ? emptyStringForBooleanAttribute : null;\n break;\n case Object:\n case Array:\n // if the value is `null` or `undefined` pass this through\n // to allow removing/no change behavior.\n value = value == null ? value : JSON.stringify(value);\n break;\n }\n return value;\n },\n\n fromAttribute(value: string | null, type?: unknown) {\n let fromValue: unknown = value;\n switch (type) {\n case Boolean:\n fromValue = value !== null;\n break;\n case Number:\n fromValue = value === null ? null : Number(value);\n break;\n case Object:\n case Array:\n // Do *not* generate exception when invalid JSON is set as elements\n // don't normally complain on being mis-configured.\n // TODO(sorvell): Do generate exception in *dev mode*.\n try {\n // Assert to adhere to Bazel's \"must type assert JSON parse\" rule.\n fromValue = JSON.parse(value!) as unknown;\n } catch (e) {\n fromValue = null;\n }\n break;\n }\n return fromValue;\n },\n};\n\nexport interface HasChanged {\n (value: unknown, old: unknown): boolean;\n}\n\n/**\n * Change function that returns true if `value` is different from `oldValue`.\n * This method is used as the default for a property's `hasChanged` function.\n */\nexport const notEqual: HasChanged = (value: unknown, old: unknown): boolean => {\n // This ensures (old==NaN, value==NaN) always returns false\n return old !== value && (old === old || value === value);\n};\n\nconst defaultPropertyDeclaration: PropertyDeclaration = {\n attribute: true,\n type: String,\n converter: defaultConverter,\n reflect: false,\n hasChanged: notEqual,\n};\n\n/**\n * The Closure JS Compiler doesn't currently have good support for static\n * property semantics where \"this\" is dynamic (e.g.\n * https://github.com/google/closure-compiler/issues/3177 and others) so we use\n * this hack to bypass any rewriting by the compiler.\n */\nconst finalized = 'finalized';\n\n/**\n * A string representing one of the supported dev mode warning categories.\n */\nexport type WarningKind = 'change-in-update' | 'migration';\n\nexport type Initializer = (element: ReactiveElement) => void;\n\nconst htmlElementShimNeeded = NODE_MODE && global.HTMLElement === undefined;\nif (htmlElementShimNeeded) {\n global.HTMLElement = class HTMLElement {} as unknown as typeof HTMLElement;\n}\n\n/**\n * Base element class which manages element properties and attributes. When\n * properties change, the `update` method is asynchronously called. This method\n * should be supplied by subclassers to render updates as desired.\n * @noInheritDoc\n */\nexport abstract class ReactiveElement\n extends HTMLElement\n implements ReactiveControllerHost\n{\n // Note: these are patched in only in DEV_MODE.\n /**\n * Read or set all the enabled warning categories for this class.\n *\n * This property is only used in development builds.\n *\n * @nocollapse\n * @category dev-mode\n */\n static enabledWarnings?: WarningKind[];\n\n /**\n * Enable the given warning category for this class.\n *\n * This method only exists in development builds, so it should be accessed\n * with a guard like:\n *\n * ```ts\n * // Enable for all ReactiveElement subclasses\n * ReactiveElement.enableWarning?.('migration');\n *\n * // Enable for only MyElement and subclasses\n * MyElement.enableWarning?.('migration');\n * ```\n *\n * @nocollapse\n * @category dev-mode\n */\n static enableWarning?: (warningKind: WarningKind) => void;\n\n /**\n * Disable the given warning category for this class.\n *\n * This method only exists in development builds, so it should be accessed\n * with a guard like:\n *\n * ```ts\n * // Disable for all ReactiveElement subclasses\n * ReactiveElement.disableWarning?.('migration');\n *\n * // Disable for only MyElement and subclasses\n * MyElement.disableWarning?.('migration');\n * ```\n *\n * @nocollapse\n * @category dev-mode\n */\n static disableWarning?: (warningKind: WarningKind) => void;\n\n /**\n * Adds an initializer function to the class that is called during instance\n * construction.\n *\n * This is useful for code that runs against a `ReactiveElement`\n * subclass, such as a decorator, that needs to do work for each\n * instance, such as setting up a `ReactiveController`.\n *\n * ```ts\n * const myDecorator = (target: typeof ReactiveElement, key: string) => {\n * target.addInitializer((instance: ReactiveElement) => {\n * // This is run during construction of the element\n * new MyController(instance);\n * });\n * }\n * ```\n *\n * Decorating a field will then cause each instance to run an initializer\n * that adds a controller:\n *\n * ```ts\n * class MyElement extends LitElement {\n * @myDecorator foo;\n * }\n * ```\n *\n * Initializers are stored per-constructor. Adding an initializer to a\n * subclass does not add it to a superclass. Since initializers are run in\n * constructors, initializers will run in order of the class hierarchy,\n * starting with superclasses and progressing to the instance's class.\n *\n * @nocollapse\n */\n static addInitializer(initializer: Initializer) {\n this.finalize();\n (this._initializers ??= []).push(initializer);\n }\n\n static _initializers?: Initializer[];\n\n /*\n * Due to closure compiler ES6 compilation bugs, @nocollapse is required on\n * all static methods and properties with initializers. Reference:\n * - https://github.com/google/closure-compiler/issues/1776\n */\n\n /**\n * Maps attribute names to properties; for example `foobar` attribute to\n * `fooBar` property. Created lazily on user subclasses when finalizing the\n * class.\n * @nocollapse\n */\n private static __attributeToPropertyMap: AttributeMap;\n\n /**\n * Marks class as having finished creating properties.\n */\n protected static [finalized] = true;\n\n /**\n * Memoized list of all element properties, including any superclass properties.\n * Created lazily on user subclasses when finalizing the class.\n * @nocollapse\n * @category properties\n */\n static elementProperties: PropertyDeclarationMap = new Map();\n\n /**\n * User-supplied object that maps property names to `PropertyDeclaration`\n * objects containing options for configuring reactive properties. When\n * a reactive property is set the element will update and render.\n *\n * By default properties are public fields, and as such, they should be\n * considered as primarily settable by element users, either via attribute or\n * the property itself.\n *\n * Generally, properties that are changed by the element should be private or\n * protected fields and should use the `state: true` option. Properties\n * marked as `state` do not reflect from the corresponding attribute\n *\n * However, sometimes element code does need to set a public property. This\n * should typically only be done in response to user interaction, and an event\n * should be fired informing the user; for example, a checkbox sets its\n * `checked` property when clicked and fires a `changed` event. Mutating\n * public properties should typically not be done for non-primitive (object or\n * array) properties. In other cases when an element needs to manage state, a\n * private property set with the `state: true` option should be used. When\n * needed, state properties can be initialized via public properties to\n * facilitate complex interactions.\n * @nocollapse\n * @category properties\n */\n static properties: PropertyDeclarations;\n\n /**\n * Memoized list of all element styles.\n * Created lazily on user subclasses when finalizing the class.\n * @nocollapse\n * @category styles\n */\n static elementStyles: Array<CSSResultOrNative> = [];\n\n /**\n * Array of styles to apply to the element. The styles should be defined\n * using the {@linkcode css} tag function, via constructible stylesheets, or\n * imported from native CSS module scripts.\n *\n * Note on Content Security Policy:\n *\n * Element styles are implemented with `<style>` tags when the browser doesn't\n * support adopted StyleSheets. To use such `<style>` tags with the style-src\n * CSP directive, the style-src value must either include 'unsafe-inline' or\n * `nonce-<base64-value>` with `<base64-value>` replaced be a server-generated\n * nonce.\n *\n * To provide a nonce to use on generated `<style>` elements, set\n * `window.litNonce` to a server-generated nonce in your page's HTML, before\n * loading application code:\n *\n * ```html\n * <script>\n * // Generated and unique per request:\n * window.litNonce = 'a1b2c3d4';\n * </script>\n * ```\n * @nocollapse\n * @category styles\n */\n static styles?: CSSResultGroup;\n\n /**\n * The set of properties defined by this class that caused an accessor to be\n * added during `createProperty`.\n * @nocollapse\n */\n private static __reactivePropertyKeys?: Set<PropertyKey>;\n\n /**\n * Returns a list of attributes corresponding to the registered properties.\n * @nocollapse\n * @category attributes\n */\n static get observedAttributes() {\n // note: piggy backing on this to ensure we're finalized.\n this.finalize();\n const attributes: string[] = [];\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n this.elementProperties.forEach((v, p) => {\n const attr = this.__attributeNameForProperty(p, v);\n if (attr !== undefined) {\n this.__attributeToPropertyMap.set(attr, p);\n attributes.push(attr);\n }\n });\n return attributes;\n }\n\n /**\n * Creates a property accessor on the element prototype if one does not exist\n * and stores a {@linkcode PropertyDeclaration} for the property with the\n * given options. The property setter calls the property's `hasChanged`\n * property option or uses a strict identity check to determine whether or not\n * to request an update.\n *\n * This method may be overridden to customize properties; however,\n * when doing so, it's important to call `super.createProperty` to ensure\n * the property is setup correctly. This method calls\n * `getPropertyDescriptor` internally to get a descriptor to install.\n * To customize what properties do when they are get or set, override\n * `getPropertyDescriptor`. To customize the options for a property,\n * implement `createProperty` like this:\n *\n * ```ts\n * static createProperty(name, options) {\n * options = Object.assign(options, {myOption: true});\n * super.createProperty(name, options);\n * }\n * ```\n *\n * @nocollapse\n * @category properties\n */\n static createProperty(\n name: PropertyKey,\n options: PropertyDeclaration = defaultPropertyDeclaration\n ) {\n // if this is a state property, force the attribute to false.\n if (options.state) {\n // Cast as any since this is readonly.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (options as any).attribute = false;\n }\n // Note, since this can be called by the `@property` decorator which\n // is called before `finalize`, we ensure finalization has been kicked off.\n this.finalize();\n this.elementProperties.set(name, options);\n // Do not generate an accessor if the prototype already has one, since\n // it would be lost otherwise and that would never be the user's intention;\n // Instead, we expect users to call `requestUpdate` themselves from\n // user-defined accessors. Note that if the super has an accessor we will\n // still overwrite it\n if (!options.noAccessor && !this.prototype.hasOwnProperty(name)) {\n const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n const descriptor = this.getPropertyDescriptor(name, key, options);\n if (descriptor !== undefined) {\n Object.defineProperty(this.prototype, name, descriptor);\n if (DEV_MODE) {\n // If this class doesn't have its own set, create one and initialize\n // with the values in the set from the nearest ancestor class, if any.\n if (!this.hasOwnProperty('__reactivePropertyKeys')) {\n this.__reactivePropertyKeys = new Set(\n this.__reactivePropertyKeys ?? []\n );\n }\n this.__reactivePropertyKeys!.add(name);\n }\n }\n }\n }\n\n /**\n * Returns a property descriptor to be defined on the given named property.\n * If no descriptor is returned, the property will not become an accessor.\n * For example,\n *\n * ```ts\n * class MyElement extends LitElement {\n * static getPropertyDescriptor(name, key, options) {\n * const defaultDescriptor =\n * super.getPropertyDescriptor(name, key, options);\n * const setter = defaultDescriptor.set;\n * return {\n * get: defaultDescriptor.get,\n * set(value) {\n * setter.call(this, value);\n * // custom action.\n * },\n * configurable: true,\n * enumerable: true\n * }\n * }\n * }\n * ```\n *\n * @nocollapse\n * @category properties\n */\n protected static getPropertyDescriptor(\n name: PropertyKey,\n key: string | symbol,\n options: PropertyDeclaration\n ): PropertyDescriptor | undefined {\n return {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get(): any {\n return (this as {[key: string]: unknown})[key as string];\n },\n set(this: ReactiveElement, value: unknown) {\n const oldValue = (this as {} as {[key: string]: unknown})[\n name as string\n ];\n (this as {} as {[key: string]: unknown})[key as string] = value;\n (this as unknown as ReactiveElement).requestUpdate(\n name,\n oldValue,\n options\n );\n },\n configurable: true,\n enumerable: true,\n };\n }\n\n /**\n * Returns the property options associated with the given property.\n * These options are defined with a `PropertyDeclaration` via the `properties`\n * object or the `@property` decorator and are registered in\n * `createProperty(...)`.\n *\n * Note, this method should be considered \"final\" and not overridden. To\n * customize the options for a given property, override\n * {@linkcode createProperty}.\n *\n * @nocollapse\n * @final\n * @category properties\n */\n static getPropertyOptions(name: PropertyKey) {\n return this.elementProperties.get(name) || defaultPropertyDeclaration;\n }\n\n /**\n * Creates property accessors for registered properties, sets up element\n * styling, and ensures any superclasses are also finalized. Returns true if\n * the element was finalized.\n * @nocollapse\n */\n protected static finalize() {\n if (this.hasOwnProperty(finalized)) {\n return false;\n }\n this[finalized] = true;\n // finalize any superclasses\n const superCtor = Object.getPrototypeOf(this) as typeof ReactiveElement;\n superCtor.finalize();\n // Create own set of initializers for this class if any exist on the\n // superclass and copy them down. Note, for a small perf boost, avoid\n // creating initializers unless needed.\n if (superCtor._initializers !== undefined) {\n this._initializers = [...superCtor._initializers];\n }\n this.elementProperties = new Map(superCtor.elementProperties);\n // initialize Map populated in observedAttributes\n this.__attributeToPropertyMap = new Map();\n // make any properties\n // Note, only process \"own\" properties since this element will inherit\n // any properties defined on the superClass, and finalization ensures\n // the entire prototype chain is finalized.\n if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {\n const props = this.properties;\n // support symbols in properties (IE11 does not support this)\n const propKeys = [\n ...Object.getOwnPropertyNames(props),\n ...Object.getOwnPropertySymbols(props),\n ];\n // This for/of is ok because propKeys is an array\n for (const p of propKeys) {\n // note, use of `any` is due to TypeScript lack of support for symbol in\n // index types\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.createProperty(p, (props as any)[p]);\n }\n }\n this.elementStyles = this.finalizeStyles(this.styles);\n // DEV mode warnings\n if (DEV_MODE) {\n const warnRemovedOrRenamed = (name: string, renamed = false) => {\n if (this.prototype.hasOwnProperty(name)) {\n issueWarning(\n renamed ? 'renamed-api' : 'removed-api',\n `\\`${name}\\` is implemented on class ${this.name}. It ` +\n `has been ${renamed ? 'renamed' : 'removed'} ` +\n `in this version of LitElement.`\n );\n }\n };\n warnRemovedOrRenamed('initialize');\n warnRemovedOrRenamed('requestUpdateInternal');\n warnRemovedOrRenamed('_getUpdateComplete', true);\n }\n return true;\n }\n\n /**\n * Options used when calling `attachShadow`. Set this property to customize\n * the options for the shadowRoot; for example, to create a closed\n * shadowRoot: `{mode: 'closed'}`.\n *\n * Note, these options are used in `createRenderRoot`. If this method\n * is customized, options should be respected if possible.\n * @nocollapse\n * @category rendering\n */\n static shadowRootOptions: ShadowRootInit = {mode: 'open'};\n\n /**\n * Takes the styles the user supplied via the `static styles` property and\n * returns the array of styles to apply to the element.\n * Override this method to integrate into a style management system.\n *\n * Styles are deduplicated preserving the _last_ instance in the list. This\n * is a performance optimization to avoid duplicated styles that can occur\n * especially when composing via subclassing. The last item is kept to try\n * to preserve the cascade order with the assumption that it's most important\n * that last added styles override previous styles.\n *\n * @nocollapse\n * @category styles\n */\n protected static finalizeStyles(\n styles?: CSSResultGroup\n ): Array<CSSResultOrNative> {\n const elementStyles = [];\n if (Array.isArray(styles)) {\n // Dedupe the flattened array in reverse order to preserve the last items.\n // Casting to Array<unknown> works around TS error that\n // appears to come from trying to flatten a type CSSResultArray.\n const set = new Set((styles as Array<unknown>).flat(Infinity).reverse());\n // Then preserve original order by adding the set items in reverse order.\n for (const s of set) {\n elementStyles.unshift(getCompatibleStyle(s as CSSResultOrNative));\n }\n } else if (styles !== undefined) {\n elementStyles.push(getCompatibleStyle(styles));\n }\n return elementStyles;\n }\n\n /**\n * Node or ShadowRoot into which element DOM should be rendered. Defaults\n * to an open shadowRoot.\n * @category rendering\n */\n readonly renderRoot!: HTMLElement | ShadowRoot;\n\n /**\n * Returns the property name for the given attribute `name`.\n * @nocollapse\n */\n private static __attributeNameForProperty(\n name: PropertyKey,\n options: PropertyDeclaration\n ) {\n const attribute = options.attribute;\n return attribute === false\n ? undefined\n : typeof attribute === 'string'\n ? attribute\n : typeof name === 'string'\n ? name.toLowerCase()\n : undefined;\n }\n\n private __instanceProperties?: PropertyValues = new Map();\n // Initialize to an unresolved Promise so we can make sure the element has\n // connected before first update.\n private __updatePromise!: Promise<boolean>;\n\n /**\n * True if there is a pending update as a result of calling `requestUpdate()`.\n * Should only be read.\n * @category updates\n */\n isUpdatePending = false;\n\n /**\n * Is set to `true` after the first update. The element code cannot assume\n * that `renderRoot` exists before the element `hasUpdated`.\n * @category updates\n */\n hasUpdated = false;\n\n /**\n * Map with keys for any properties that have changed since the last\n * update cycle with previous values.\n *\n * @internal\n */\n _$changedProperties!: PropertyValues;\n\n /**\n * Map with keys of properties that should be reflected when updated.\n */\n private __reflectingProperties?: Map<PropertyKey, PropertyDeclaration>;\n\n /**\n * Name of currently reflecting property\n */\n private __reflectingProperty: PropertyKey | null = null;\n\n /**\n * Set of controllers.\n */\n private __controllers?: ReactiveController[];\n\n constructor() {\n super();\n this._initialize();\n }\n\n /**\n * Internal only override point for customizing work done when elements\n * are constructed.\n *\n * @internal\n */\n _initialize() {\n this.__updatePromise = new Promise<boolean>(\n (res) => (this.enableUpdating = res)\n );\n this._$changedProperties = new Map();\n this.__saveInstanceProperties();\n // ensures first update will be caught by an early access of\n // `updateComplete`\n this.requestUpdate();\n (this.constructor as typeof ReactiveElement)._initializers?.forEach((i) =>\n i(this)\n );\n }\n\n /**\n * Registers a `ReactiveController` to participate in the element's reactive\n * update cycle. The element automatically calls into any registered\n * controllers during its lifecycle callbacks.\n *\n * If the element is connected when `addController()` is called, the\n * controller's `hostConnected()` callback will be immediately called.\n * @category controllers\n */\n addController(controller: ReactiveController) {\n (this.__controllers ??= []).push(controller);\n // If a controller is added after the element has been connected,\n // call hostConnected. Note, re-using existence of `renderRoot` here\n // (which is set in connectedCallback) to avoid the need to track a\n // first connected state.\n if (this.renderRoot !== undefined && this.isConnected) {\n controller.hostConnected?.();\n }\n }\n\n /**\n * Removes a `ReactiveController` from the element.\n * @category controllers\n */\n removeController(controller: ReactiveController) {\n // Note, if the indexOf is -1, the >>> will flip the sign which makes the\n // splice do nothing.\n this.__controllers?.splice(this.__controllers.indexOf(controller) >>> 0, 1);\n }\n\n /**\n * Fixes any properties set on the instance before upgrade time.\n * Otherwise these would shadow the accessor and break these properties.\n * The properties are stored in a Map which is played back after the\n * constructor runs. Note, on very old versions of Safari (<=9) or Chrome\n * (<=41), properties created for native platform properties like (`id` or\n * `name`) may not have default values set in the element constructor. On\n * these browsers native properties appear on instances and therefore their\n * default value will overwrite any element default (e.g. if the element sets\n * this.id = 'id' in the constructor, the 'id' will become '' since this is\n * the native platform default).\n */\n private __saveInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n (this.constructor as typeof ReactiveElement).elementProperties.forEach(\n (_v, p) => {\n if (this.hasOwnProperty(p)) {\n this.__instanceProperties!.set(p, this[p as keyof this]);\n delete this[p as keyof this];\n }\n }\n );\n }\n\n /**\n * Returns the node into which the element should render and by default\n * creates and returns an open shadowRoot. Implement to customize where the\n * element's DOM is rendered. For example, to render into the element's\n * childNodes, return `this`.\n *\n * @return Returns a node into which to render.\n * @category rendering\n */\n protected createRenderRoot(): Element | ShadowRoot {\n const renderRoot =\n this.shadowRoot ??\n this.attachShadow(\n (this.constructor as typeof ReactiveElement).shadowRootOptions\n );\n adoptStyles(\n renderRoot,\n (this.constructor as typeof ReactiveElement).elementStyles\n );\n return renderRoot;\n }\n\n /**\n * On first connection, creates the element's renderRoot, sets up\n * element styling, and enables updating.\n * @category lifecycle\n */\n connectedCallback() {\n // create renderRoot before first update.\n if (this.renderRoot === undefined) {\n (\n this as {\n renderRoot: Element | DocumentFragment;\n }\n ).renderRoot = this.createRenderRoot();\n }\n this.enableUpdating(true);\n this.__controllers?.forEach((c) => c.hostConnected?.());\n }\n\n /**\n * Note, this method should be considered final and not overridden. It is\n * overridden on the element instance with a function that triggers the first\n * update.\n * @category updates\n */\n protected enableUpdating(_requestedUpdate: boolean) {}\n\n /**\n * Allows for `super.disconnectedCallback()` in extensions while\n * reserving the possibility of making non-breaking feature additions\n * when disconnecting at some point in the future.\n * @category lifecycle\n */\n disconnectedCallback() {\n this.__controllers?.forEach((c) => c.hostDisconnected?.());\n }\n\n /**\n * Synchronizes property values when attributes change.\n *\n * Specifically, when an attribute is set, the corresponding property is set.\n * You should rarely need to implement this callback. If this method is\n * overridden, `super.attributeChangedCallback(name, _old, value)` must be\n * called.\n *\n * See [using the lifecycle callbacks](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks)\n * on MDN for more information about the `attributeChangedCallback`.\n * @category attributes\n */\n attributeChangedCallback(\n name: string,\n _old: string | null,\n value: string | null\n ) {\n this._$attributeToProperty(name, value);\n }\n\n private __propertyToAttribute(\n name: PropertyKey,\n value: unknown,\n options: PropertyDeclaration = defaultPropertyDeclaration\n ) {\n const attr = (\n this.constructor as typeof ReactiveElement\n ).__attributeNameForProperty(name, options);\n if (attr !== undefined && options.reflect === true) {\n const converter =\n (options.converter as ComplexAttributeConverter)?.toAttribute !==\n undefined\n ? (options.converter as ComplexAttributeConverter)\n : defaultConverter;\n const attrValue = converter.toAttribute!(value, options.type);\n if (\n DEV_MODE &&\n (this.constructor as typeof ReactiveElement).enabledWarnings!.indexOf(\n 'migration'\n ) >= 0 &&\n attrValue === undefined\n ) {\n issueWarning(\n 'undefined-attribute-value',\n `The attribute value for the ${name as string} property is ` +\n `undefined on element ${this.localName}. The attribute will be ` +\n `removed, but in the previous version of \\`ReactiveElement\\`, ` +\n `the attribute would not have changed.`\n );\n }\n // Track if the property is being reflected to avoid\n // setting the property again via `attributeChangedCallback`. Note:\n // 1. this takes advantage of the fact that the callback is synchronous.\n // 2. will behave incorrectly if multiple attributes are in the reaction\n // stack at time of calling. However, since we process attributes\n // in `update` this should not be possible (or an extreme corner case\n // that we'd like to discover).\n // mark state reflecting\n this.__reflectingProperty = name;\n if (attrValue == null) {\n this.removeAttribute(attr);\n } else {\n this.setAttribute(attr, attrValue as string);\n }\n // mark state not reflecting\n this.__reflectingProperty = null;\n }\n }\n\n /** @internal */\n _$attributeToProperty(name: string, value: string | null) {\n const ctor = this.constructor as typeof ReactiveElement;\n // Note, hint this as an `AttributeMap` so closure clearly understands\n // the type; it has issues with tracking types through statics\n const propName = (ctor.__attributeToPropertyMap as AttributeMap).get(name);\n // Use tracking info to avoid reflecting a property value to an attribute\n // if it was just set because the attribute changed.\n if (propName !== undefined && this.__reflectingProperty !== propName) {\n const options = ctor.getPropertyOptions(propName);\n const converter =\n typeof options.converter === 'function'\n ? {fromAttribute: options.converter}\n : options.converter?.fromAttribute !== undefined\n ? options.converter\n : defaultConverter;\n // mark state reflecting\n this.__reflectingProperty = propName;\n this[propName as keyof this] = converter.fromAttribute!(\n value,\n options.type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ) as any;\n // mark state not reflecting\n this.__reflectingProperty = null;\n }\n }\n\n /**\n * Requests an update which is processed asynchronously. This should be called\n * when an element should update based on some state not triggered by setting\n * a reactive property. In this case, pass no arguments. It should also be\n * called when manually implementing a property setter. In this case, pass the\n * property `name` and `oldValue` to ensure that any configured property\n * options are honored.\n *\n * @param name name of requesting property\n * @param oldValue old value of requesting property\n * @param options property options to use instead of the previously\n * configured options\n * @category updates\n */\n requestUpdate(\n name?: PropertyKey,\n oldValue?: unknown,\n options?: PropertyDeclaration\n ): void {\n let shouldRequestUpdate = true;\n // If we have a property key, perform property update steps.\n if (name !== undefined) {\n options =\n options ||\n (this.constructor as typeof ReactiveElement).getPropertyOptions(name);\n const hasChanged = options.hasChanged || notEqual;\n if (hasChanged(this[name as keyof this], oldValue)) {\n if (!this._$changedProperties.has(name)) {\n this._$changedProperties.set(name, oldValue);\n }\n // Add to reflecting properties set.\n // Note, it's important that every change has a chance to add the\n // property to `_reflectingProperties`. This ensures setting\n // attribute + property reflects correctly.\n if (options.reflect === true && this.__reflectingProperty !== name) {\n if (this.__reflectingProperties === undefined) {\n this.__reflectingProperties = new Map();\n }\n this.__reflectingProperties.set(name, options);\n }\n } else {\n // Abort the request if the property should not be considered changed.\n shouldRequestUpdate = false;\n }\n }\n if (!this.isUpdatePending && shouldRequestUpdate) {\n this.__updatePromise = this.__enqueueUpdate();\n }\n // Note, since this no longer returns a promise, in dev mode we return a\n // thenable which warns if it's called.\n return DEV_MODE\n ? (requestUpdateThenable(this.localName) as unknown as void)\n : undefined;\n }\n\n /**\n * Sets up the element to asynchronously update.\n */\n private async __enqueueUpdate() {\n this.isUpdatePending = true;\n try {\n // Ensure any previous update has resolved before updating.\n // This `await` also ensures that property changes are batched.\n await this.__updatePromise;\n } catch (e) {\n // Refire any previous errors async so they do not disrupt the update\n // cycle. Errors are refired so developers have a chance to observe\n // them, and this can be done by implementing\n // `window.onunhandledrejection`.\n Promise.reject(e);\n }\n const result = this.scheduleUpdate();\n // If `scheduleUpdate` returns a Promise, we await it. This is done to\n // enable coordinating updates with a scheduler. Note, the result is\n // checked to avoid delaying an additional microtask unless we need to.\n if (result != null) {\n await result;\n }\n return !this.isUpdatePending;\n }\n\n /**\n * Schedules an element update. You can override this method to change the\n * timing of updates by returning a Promise. The update will await the\n * returned Promise, and you should resolve the Promise to allow the update\n * to proceed. If this method is overridden, `super.scheduleUpdate()`\n * must be called.\n *\n * For instance, to schedule updates to occur just before the next frame:\n *\n * ```ts\n * override protected async scheduleUpdate(): Promise<unknown> {\n * await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n * super.scheduleUpdate();\n * }\n * ```\n * @category updates\n */\n protected scheduleUpdate(): void | Promise<unknown> {\n return this.performUpdate();\n }\n\n /**\n * Performs an element update. Note, if an exception is thrown during the\n * update, `firstUpdated` and `updated` will not be called.\n *\n * Call `performUpdate()` to immediately process a pending update. This should\n * generally not be needed, but it can be done in rare cases when you need to\n * update synchronously.\n *\n * Note: To ensure `performUpdate()` synchronously completes a pending update,\n * it should not be overridden. In LitElement 2.x it was suggested to override\n * `performUpdate()` to also customizing update scheduling. Instead, you should now\n * override `scheduleUpdate()`. For backwards compatibility with LitElement 2.x,\n * scheduling updates via `performUpdate()` continues to work, but will make\n * also calling `performUpdate()` to synchronously process updates difficult.\n *\n * @category updates\n */\n protected performUpdate(): void | Promise<unknown> {\n // Abort any update if one is not pending when this is called.\n // This can happen if `performUpdate` is called early to \"flush\"\n // the update.\n if (!this.isUpdatePending) {\n return;\n }\n debugLogEvent?.({kind: 'update'});\n // create renderRoot before first update.\n if (!this.hasUpdated) {\n // Produce warning if any class properties are shadowed by class fields\n if (DEV_MODE) {\n const shadowedProperties: string[] = [];\n (\n this.constructor as typeof ReactiveElement\n ).__reactivePropertyKeys?.forEach((p) => {\n if (this.hasOwnProperty(p) && !this.__instanceProperties?.has(p)) {\n shadowedProperties.push(p as string);\n }\n });\n if (shadowedProperties.length) {\n throw new Error(\n `The following properties on element ${this.localName} will not ` +\n `trigger updates as expected because they are set using class ` +\n `fields: ${shadowedProperties.join(', ')}. ` +\n `Native class fields and some compiled output will overwrite ` +\n `accessors used for detecting changes. See ` +\n `https://lit.dev/msg/class-field-shadowing ` +\n `for more information.`\n );\n }\n }\n }\n // Mixin instance properties once, if they exist.\n if (this.__instanceProperties) {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.__instanceProperties!.forEach((v, p) => ((this as any)[p] = v));\n this.__instanceProperties = undefined;\n }\n let shouldUpdate = false;\n const changedProperties = this._$changedProperties;\n try {\n shouldUpdate = this.shouldUpdate(changedProperties);\n if (shouldUpdate) {\n this.willUpdate(changedProperties);\n this.__controllers?.forEach((c) => c.hostUpdate?.());\n this.update(changedProperties);\n } else {\n this.__markUpdated();\n }\n } catch (e) {\n // Prevent `firstUpdated` and `updated` from running when there's an\n // update exception.\n shouldUpdate = false;\n // Ensure element can accept additional updates after an exception.\n this.__markUpdated();\n throw e;\n }\n // The update is no longer considered pending and further updates are now allowed.\n if (shouldUpdate) {\n this._$didUpdate(changedProperties);\n }\n }\n\n /**\n * Invoked before `update()` to compute values needed during the update.\n *\n * Implement `willUpdate` to compute property values that depend on other\n * properties and are used in the rest of the update process.\n *\n * ```ts\n * willUpdate(changedProperties) {\n * // only need to check changed properties for an expensive computation.\n * if (changedProperties.has('firstName') || changedProperties.has('lastName')) {\n * this.sha = computeSHA(`${this.firstName} ${this.lastName}`);\n * }\n * }\n *\n * render() {\n * return html`SHA: ${this.sha}`;\n * }\n * ```\n *\n * @category updates\n */\n protected willUpdate(_changedProperties: PropertyValues): void {}\n\n // Note, this is an override point for polyfill-support.\n // @internal\n _$didUpdate(changedProperties: PropertyValues) {\n this.__controllers?.forEach((c) => c.hostUpdated?.());\n if (!this.hasUpdated) {\n this.hasUpdated = true;\n this.firstUpdated(changedProperties);\n }\n this.updated(changedProperties);\n if (\n DEV_MODE &&\n this.isUpdatePending &&\n (this.constructor as typeof ReactiveElement).enabledWarnings!.indexOf(\n 'change-in-update'\n ) >= 0\n ) {\n issueWarning(\n 'change-in-update',\n `Element ${this.localName} scheduled an update ` +\n `(generally because a property was set) ` +\n `after an update completed, causing a new update to be scheduled. ` +\n `This is inefficient and should be avoided unless the next update ` +\n `can only be scheduled as a side effect of the previous update.`\n );\n }\n }\n\n private __markUpdated() {\n this._$changedProperties = new Map();\n this.isUpdatePending = false;\n }\n\n /**\n * Returns a Promise that resolves when the element has completed updating.\n * The Promise value is a boolean that is `true` if the element completed the\n * update without triggering another update. The Promise result is `false` if\n * a property was set inside `updated()`. If the Promise is rejected, an\n * exception was thrown during the update.\n *\n * To await additional asynchronous work, override the `getUpdateComplete`\n * method. For example, it is sometimes useful to await a rendered element\n * before fulfilling this Promise. To do this, first await\n * `super.getUpdateComplete()`, then any subsequent state.\n *\n * @return A promise of a boolean that resolves to true if the update completed\n * without triggering another update.\n * @category updates\n */\n get updateComplete(): Promise<boolean> {\n return this.getUpdateComplete();\n }\n\n /**\n * Override point for the `updateComplete` promise.\n *\n * It is not safe to override the `updateComplete` getter directly due to a\n * limitation in TypeScript which means it is not possible to call a\n * superclass getter (e.g. `super.updateComplete.then(...)`) when the target\n * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).\n * This method should be overridden instead. For example:\n *\n * ```ts\n * class MyElement extends LitElement {\n * override async getUpdateComplete() {\n * const result = await super.getUpdateComplete();\n * await this._myChild.updateComplete;\n * return result;\n * }\n * }\n * ```\n *\n * @return A promise of a boolean that resolves to true if the update completed\n * without triggering another update.\n * @category updates\n */\n protected getUpdateComplete(): Promise<boolean> {\n return this.__updatePromise;\n }\n\n /**\n * Controls whether or not `update()` should be called when the element requests\n * an update. By default, this method always returns `true`, but this can be\n * customized to control when to update.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected shouldUpdate(_changedProperties: PropertyValues): boolean {\n return true;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes.\n * It can be overridden to render and keep updated element DOM.\n * Setting properties inside this method will *not* trigger\n * another update.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected update(_changedProperties: PropertyValues) {\n if (this.__reflectingProperties !== undefined) {\n // Use forEach so this works even if for/of loops are compiled to for\n // loops expecting arrays\n this.__reflectingProperties.forEach((v, k) =>\n this.__propertyToAttribute(k, this[k as keyof this], v)\n );\n this.__reflectingProperties = undefined;\n }\n this.__markUpdated();\n }\n\n /**\n * Invoked whenever the element is updated. Implement to perform\n * post-updating tasks via DOM APIs, for example, focusing an element.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected updated(_changedProperties: PropertyValues) {}\n\n /**\n * Invoked when the element is first updated. Implement to perform one time\n * work on the element after update.\n *\n * ```ts\n * firstUpdated() {\n * this.renderRoot.getElementById('my-text-area').focus();\n * }\n * ```\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected firstUpdated(_changedProperties: PropertyValues) {}\n}\n\nif (htmlElementShimNeeded) {\n delete (global as Partial<typeof global>).HTMLElement;\n}\n\n// Apply polyfills if available\npolyfillSupport?.({ReactiveElement});\n\n// Dev mode warnings...\nif (DEV_MODE) {\n // Default warning set.\n ReactiveElement.enabledWarnings = ['change-in-update'];\n const ensureOwnWarnings = function (ctor: typeof ReactiveElement) {\n if (\n !ctor.hasOwnProperty(JSCompiler_renameProperty('enabledWarnings', ctor))\n ) {\n ctor.enabledWarnings = ctor.enabledWarnings!.slice();\n }\n };\n ReactiveElement.enableWarning = function (\n this: typeof ReactiveElement,\n warning: WarningKind\n ) {\n ensureOwnWarnings(this);\n if (this.enabledWarnings!.indexOf(warning) < 0) {\n this.enabledWarnings!.push(warning);\n }\n };\n ReactiveElement.disableWarning = function (\n this: typeof ReactiveElement,\n warning: WarningKind\n ) {\n ensureOwnWarnings(this);\n const i = this.enabledWarnings!.indexOf(warning);\n if (i >= 0) {\n this.enabledWarnings!.splice(i, 1);\n }\n };\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for ReactiveElement usage.\n(global.reactiveElementVersions ??= []).push('1.5.0');\nif (DEV_MODE && global.reactiveElementVersions.length > 1) {\n issueWarning!(\n 'multiple-versions',\n `Multiple versions of Lit loaded. Loading multiple versions ` +\n `is not recommended.`\n );\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * The main LitElement module, which defines the {@linkcode LitElement} base\n * class and related APIs.\n *\n * LitElement components can define a template and a set of observed\n * properties. Changing an observed property triggers a re-render of the\n * element.\n *\n * Import {@linkcode LitElement} and {@linkcode html} from this module to\n * create a component:\n *\n * ```js\n * import {LitElement, html} from 'lit-element';\n *\n * class MyElement extends LitElement {\n *\n * // Declare observed properties\n * static get properties() {\n * return {\n * adjective: {}\n * }\n * }\n *\n * constructor() {\n * this.adjective = 'awesome';\n * }\n *\n * // Define the element's template\n * render() {\n * return html`<p>your ${adjective} template here</p>`;\n * }\n * }\n *\n * customElements.define('my-element', MyElement);\n * ```\n *\n * `LitElement` extends {@linkcode ReactiveElement} and adds lit-html\n * templating. The `ReactiveElement` class is provided for users that want to\n * build their own custom element base classes that don't use lit-html.\n *\n * @packageDocumentation\n */\nimport {PropertyValues, ReactiveElement} from '@lit/reactive-element';\nimport {render, RenderOptions, noChange, RootPart} from 'lit-html';\nexport * from '@lit/reactive-element';\nexport * from 'lit-html';\n\nimport {LitUnstable} from 'lit-html';\nimport {ReactiveUnstable} from '@lit/reactive-element';\n\n/**\n * Contains types that are part of the unstable debug API.\n *\n * Everything in this API is not stable and may change or be removed in the future,\n * even on patch releases.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Unstable {\n /**\n * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true,\n * we will emit 'lit-debug' events to window, with live details about the update and render\n * lifecycle. These can be useful for writing debug tooling and visualizations.\n *\n * Please be aware that running with window.emitLitDebugLogEvents has performance overhead,\n * making certain operations that are normally very cheap (like a no-op render) much slower,\n * because we must copy data and dispatch events.\n */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace DebugLog {\n export type Entry =\n | LitUnstable.DebugLog.Entry\n | ReactiveUnstable.DebugLog.Entry;\n }\n}\n\n// For backwards compatibility export ReactiveElement as UpdatingElement. Note,\n// IE transpilation requires exporting like this.\nexport const UpdatingElement = ReactiveElement;\n\nconst DEV_MODE = true;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nif (DEV_MODE) {\n // Ensure warnings are issued only 1x, even if multiple versions of Lit\n // are loaded.\n const issuedWarnings: Set<string | undefined> =\n (globalThis.litIssuedWarnings ??= new Set());\n\n // Issue a warning, if we haven't already.\n issueWarning = (code: string, warning: string) => {\n warning += ` See https://lit.dev/msg/${code} for more information.`;\n if (!issuedWarnings.has(warning)) {\n console.warn(warning);\n issuedWarnings.add(warning);\n }\n };\n}\n\n/**\n * Base element class that manages element properties and attributes, and\n * renders a lit-html template.\n *\n * To define a component, subclass `LitElement` and implement a\n * `render` method to provide the component's template. Define properties\n * using the {@linkcode LitElement.properties properties} property or the\n * {@linkcode property} decorator.\n */\nexport class LitElement extends ReactiveElement {\n /**\n * Ensure this class is marked as `finalized` as an optimization ensuring\n * it will not needlessly try to `finalize`.\n *\n * Note this property name is a string to prevent breaking Closure JS Compiler\n * optimizations. See @lit/reactive-element for more information.\n */\n protected static override ['finalized'] = true;\n\n // This property needs to remain unminified.\n static ['_$litElement$'] = true;\n\n /**\n * @category rendering\n */\n readonly renderOptions: RenderOptions = {host: this};\n\n private __childPart: RootPart | undefined = undefined;\n\n /**\n * @category rendering\n */\n protected override createRenderRoot() {\n const renderRoot = super.createRenderRoot();\n // When adoptedStyleSheets are shimmed, they are inserted into the\n // shadowRoot by createRenderRoot. Adjust the renderBefore node so that\n // any styles in Lit content render before adoptedStyleSheets. This is\n // important so that adoptedStyleSheets have precedence over styles in\n // the shadowRoot.\n this.renderOptions.renderBefore ??= renderRoot!.firstChild as ChildNode;\n return renderRoot;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes\n * and calls `render` to render DOM via lit-html. Setting properties inside\n * this method will *not* trigger another update.\n * @param changedProperties Map of changed properties with old values\n * @category updates\n */\n protected override update(changedProperties: PropertyValues) {\n // Setting properties in `render` should not trigger an update. Since\n // updates are allowed after super.update, it's important to call `render`\n // before that.\n const value = this.render();\n if (!this.hasUpdated) {\n this.renderOptions.isConnected = this.isConnected;\n }\n super.update(changedProperties);\n this.__childPart = render(value, this.renderRoot, this.renderOptions);\n }\n\n /**\n * Invoked when the component is added to the document's DOM.\n *\n * In `connectedCallback()` you should setup tasks that should only occur when\n * the element is connected to the document. The most common of these is\n * adding event listeners to nodes external to the element, like a keydown\n * event handler added to the window.\n *\n * ```ts\n * connectedCallback() {\n * super.connectedCallback();\n * addEventListener('keydown', this._handleKeydown);\n * }\n * ```\n *\n * Typically, anything done in `connectedCallback()` should be undone when the\n * element is disconnected, in `disconnectedCallback()`.\n *\n * @category lifecycle\n */\n override connectedCallback() {\n super.connectedCallback();\n this.__childPart?.setConnected(true);\n }\n\n /**\n * Invoked when the component is removed from the document's DOM.\n *\n * This callback is the main signal to the element that it may no longer be\n * used. `disconnectedCallback()` should ensure that nothing is holding a\n * reference to the element (such as event listeners added to nodes external\n * to the element), so that it is free to be garbage collected.\n *\n * ```ts\n * disconnectedCallback() {\n * super.disconnectedCallback();\n * window.removeEventListener('keydown', this._handleKeydown);\n * }\n * ```\n *\n * An element may be re-connected after being disconnected.\n *\n * @category lifecycle\n */\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.__childPart?.setConnected(false);\n }\n\n /**\n * Invoked on each update to perform rendering tasks. This method may return\n * any value renderable by lit-html's `ChildPart` - typically a\n * `TemplateResult`. Setting properties inside this method will *not* trigger\n * the element to update.\n * @category rendering\n */\n protected render(): unknown {\n return noChange;\n }\n}\n\n// Install hydration if available\nglobalThis.litElementHydrateSupport?.({LitElement});\n\n// Apply polyfills if available\nconst polyfillSupport = DEV_MODE\n ? globalThis.litElementPolyfillSupportDevMode\n : globalThis.litElementPolyfillSupport;\npolyfillSupport?.({LitElement});\n\n// DEV mode warnings\nif (DEV_MODE) {\n /* eslint-disable @typescript-eslint/no-explicit-any */\n // Note, for compatibility with closure compilation, this access\n // needs to be as a string property index.\n (LitElement as any)['finalize'] = function (this: typeof LitElement) {\n const finalized = (ReactiveElement as any).finalize.call(this);\n if (!finalized) {\n return false;\n }\n const warnRemovedOrRenamed = (obj: any, name: string, renamed = false) => {\n if (obj.hasOwnProperty(name)) {\n const ctorName = (typeof obj === 'function' ? obj : obj.constructor)\n .name;\n issueWarning(\n renamed ? 'renamed-api' : 'removed-api',\n `\\`${name}\\` is implemented on class ${ctorName}. It ` +\n `has been ${renamed ? 'renamed' : 'removed'} ` +\n `in this version of LitElement.`\n );\n }\n };\n warnRemovedOrRenamed(this, 'render');\n warnRemovedOrRenamed(this, 'getStyles', true);\n warnRemovedOrRenamed((this as typeof LitElement).prototype, 'adoptStyles');\n return true;\n };\n /* eslint-enable @typescript-eslint/no-explicit-any */\n}\n\n/**\n * END USERS SHOULD NOT RELY ON THIS OBJECT.\n *\n * Private exports for use by other Lit packages, not intended for use by\n * external users.\n *\n * We currently do not make a mangled rollup build of the lit-ssr code. In order\n * to keep a number of (otherwise private) top-level exports mangled in the\n * client side code, we export a _$LE object containing those members (or\n * helper methods for accessing private fields of those members), and then\n * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the\n * client-side code is being used in `dev` mode or `prod` mode.\n *\n * This has a unique name, to disambiguate it from private exports in\n * lit-html, since this module re-exports all of lit-html.\n *\n * @private\n */\nexport const _$LE = {\n _$attributeToProperty: (\n el: LitElement,\n name: string,\n value: string | null\n ) => {\n // eslint-disable-next-line\n (el as any)._$attributeToProperty(name, value);\n },\n // eslint-disable-next-line\n _$changedProperties: (el: LitElement) => (el as any)._$changedProperties,\n};\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for LitElement usage.\n(globalThis.litElementVersions ??= []).push('3.2.2');\nif (DEV_MODE && globalThis.litElementVersions.length > 1) {\n issueWarning!(\n 'multiple-versions',\n `Multiple versions of Lit loaded. Loading multiple versions ` +\n `is not recommended.`\n );\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {ReactiveElement} from '../reactive-element.js';\n\nexport type Constructor<T> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n};\n\n// From the TC39 Decorators proposal\nexport interface ClassDescriptor {\n kind: 'class';\n elements: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => void | Constructor<T>;\n}\n\n// From the TC39 Decorators proposal\nexport interface ClassElement {\n kind: 'field' | 'method';\n key: PropertyKey;\n placement: 'static' | 'prototype' | 'own';\n initializer?: Function;\n extras?: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => void | Constructor<T>;\n descriptor?: PropertyDescriptor;\n}\n\nexport const legacyPrototypeMethod = (\n descriptor: PropertyDescriptor,\n proto: Object,\n name: PropertyKey\n) => {\n Object.defineProperty(proto, name, descriptor);\n};\n\nexport const standardPrototypeMethod = (\n descriptor: PropertyDescriptor,\n element: ClassElement\n) => ({\n kind: 'method',\n placement: 'prototype',\n key: element.key,\n descriptor,\n});\n\n/**\n * Helper for decorating a property that is compatible with both TypeScript\n * and Babel decorators. The optional `finisher` can be used to perform work on\n * the class. The optional `descriptor` should return a PropertyDescriptor\n * to install for the given property.\n *\n * @param finisher {function} Optional finisher method; receives the element\n * constructor and property key as arguments and has no return value.\n * @param descriptor {function} Optional descriptor method; receives the\n * property key as an argument and returns a property descriptor to define for\n * the given property.\n * @returns {ClassElement|void}\n */\nexport const decorateProperty =\n ({\n finisher,\n descriptor,\n }: {\n finisher?:\n | ((ctor: typeof ReactiveElement, property: PropertyKey) => void)\n | null;\n descriptor?: (property: PropertyKey) => PropertyDescriptor;\n }) =>\n (\n protoOrDescriptor: ReactiveElement | ClassElement,\n name?: PropertyKey\n // Note TypeScript requires the return type to be `void|any`\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): void | any => {\n // TypeScript / Babel legacy mode\n if (name !== undefined) {\n const ctor = (protoOrDescriptor as ReactiveElement)\n .constructor as typeof ReactiveElement;\n if (descriptor !== undefined) {\n Object.defineProperty(protoOrDescriptor, name, descriptor(name));\n }\n finisher?.(ctor, name!);\n // Babel standard mode\n } else {\n // Note, the @property decorator saves `key` as `originalKey`\n // so try to use it here.\n const key =\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (protoOrDescriptor as any).originalKey ??\n (protoOrDescriptor as ClassElement).key;\n const info: ClassElement =\n descriptor != undefined\n ? {\n kind: 'method',\n placement: 'prototype',\n key,\n descriptor: descriptor((protoOrDescriptor as ClassElement).key),\n }\n : {...(protoOrDescriptor as ClassElement), key};\n if (finisher != undefined) {\n info.finisher = function <ReactiveElement>(\n ctor: Constructor<ReactiveElement>\n ) {\n finisher(ctor as unknown as typeof ReactiveElement, key);\n };\n }\n return info;\n }\n };\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\nimport {Constructor, ClassDescriptor} from './base.js';\n\n/**\n * Allow for custom element classes with private constructors\n */\ntype CustomElementClass = Omit<typeof HTMLElement, 'new'>;\n\nconst legacyCustomElement = (tagName: string, clazz: CustomElementClass) => {\n customElements.define(tagName, clazz as CustomElementConstructor);\n // Cast as any because TS doesn't recognize the return type as being a\n // subtype of the decorated class when clazz is typed as\n // `Constructor<HTMLElement>` for some reason.\n // `Constructor<HTMLElement>` is helpful to make sure the decorator is\n // applied to elements however.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return clazz as any;\n};\n\nconst standardCustomElement = (\n tagName: string,\n descriptor: ClassDescriptor\n) => {\n const {kind, elements} = descriptor;\n return {\n kind,\n elements,\n // This callback is called once the class is otherwise fully defined\n finisher(clazz: Constructor<HTMLElement>) {\n customElements.define(tagName, clazz);\n },\n };\n};\n\n/**\n * Class decorator factory that defines the decorated class as a custom element.\n *\n * ```js\n * @customElement('my-element')\n * class MyElement extends LitElement {\n * render() {\n * return html``;\n * }\n * }\n * ```\n * @category Decorator\n * @param tagName The tag name of the custom element to define.\n */\nexport const customElement =\n (tagName: string) =>\n (classOrDescriptor: CustomElementClass | ClassDescriptor) =>\n typeof classOrDescriptor === 'function'\n ? legacyCustomElement(tagName, classOrDescriptor)\n : standardCustomElement(tagName, classOrDescriptor as ClassDescriptor);\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\nimport {PropertyDeclaration, ReactiveElement} from '../reactive-element.js';\nimport {ClassElement} from './base.js';\n\nconst standardProperty = (\n options: PropertyDeclaration,\n element: ClassElement\n) => {\n // When decorating an accessor, pass it through and add property metadata.\n // Note, the `hasOwnProperty` check in `createProperty` ensures we don't\n // stomp over the user's accessor.\n if (\n element.kind === 'method' &&\n element.descriptor &&\n !('value' in element.descriptor)\n ) {\n return {\n ...element,\n finisher(clazz: typeof ReactiveElement) {\n clazz.createProperty(element.key, options);\n },\n };\n } else {\n // createProperty() takes care of defining the property, but we still\n // must return some kind of descriptor, so return a descriptor for an\n // unused prototype field. The finisher calls createProperty().\n return {\n kind: 'field',\n key: Symbol(),\n placement: 'own',\n descriptor: {},\n // store the original key so subsequent decorators have access to it.\n originalKey: element.key,\n // When @babel/plugin-proposal-decorators implements initializers,\n // do this instead of the initializer below. See:\n // https://github.com/babel/babel/issues/9260 extras: [\n // {\n // kind: 'initializer',\n // placement: 'own',\n // initializer: descriptor.initializer,\n // }\n // ],\n initializer(this: {[key: string]: unknown}) {\n if (typeof element.initializer === 'function') {\n this[element.key as string] = element.initializer.call(this);\n }\n },\n finisher(clazz: typeof ReactiveElement) {\n clazz.createProperty(element.key, options);\n },\n };\n }\n};\n\nconst legacyProperty = (\n options: PropertyDeclaration,\n proto: Object,\n name: PropertyKey\n) => {\n (proto.constructor as typeof ReactiveElement).createProperty(name, options);\n};\n\n/**\n * A property decorator which creates a reactive property that reflects a\n * corresponding attribute value. When a decorated property is set\n * the element will update and render. A {@linkcode PropertyDeclaration} may\n * optionally be supplied to configure property features.\n *\n * This decorator should only be used for public fields. As public fields,\n * properties should be considered as primarily settable by element users,\n * either via attribute or the property itself.\n *\n * Generally, properties that are changed by the element should be private or\n * protected fields and should use the {@linkcode state} decorator.\n *\n * However, sometimes element code does need to set a public property. This\n * should typically only be done in response to user interaction, and an event\n * should be fired informing the user; for example, a checkbox sets its\n * `checked` property when clicked and fires a `changed` event. Mutating public\n * properties should typically not be done for non-primitive (object or array)\n * properties. In other cases when an element needs to manage state, a private\n * property decorated via the {@linkcode state} decorator should be used. When\n * needed, state properties can be initialized via public properties to\n * facilitate complex interactions.\n *\n * ```ts\n * class MyElement {\n * @property({ type: Boolean })\n * clicked = false;\n * }\n * ```\n * @category Decorator\n * @ExportDecoratedItems\n */\nexport function property(options?: PropertyDeclaration) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (protoOrDescriptor: Object | ClassElement, name?: PropertyKey): any =>\n name !== undefined\n ? legacyProperty(options!, protoOrDescriptor as Object, name)\n : standardProperty(options!, protoOrDescriptor as ClassElement);\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {property} from './property.js';\n\nexport interface InternalPropertyDeclaration<Type = unknown> {\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n}\n\n/**\n * Declares a private or protected reactive property that still triggers\n * updates to the element when it changes. It does not reflect from the\n * corresponding attribute.\n *\n * Properties declared this way must not be used from HTML or HTML templating\n * systems, they're solely for properties internal to the element. These\n * properties may be renamed by optimization tools like closure compiler.\n * @category Decorator\n */\nexport function state(options?: InternalPropertyDeclaration) {\n return property({\n ...options,\n state: true,\n });\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {ReactiveElement} from '../reactive-element.js';\nimport {decorateProperty} from './base.js';\n\n/**\n * Adds event listener options to a method used as an event listener in a\n * lit-html template.\n *\n * @param options An object that specifies event listener options as accepted by\n * `EventTarget#addEventListener` and `EventTarget#removeEventListener`.\n *\n * Current browsers support the `capture`, `passive`, and `once` options. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters\n *\n * ```ts\n * class MyElement {\n * clicked = false;\n *\n * render() {\n * return html`\n * <div @click=${this._onClick}>\n * <button></button>\n * </div>\n * `;\n * }\n *\n * @eventOptions({capture: true})\n * _onClick(e) {\n * this.clicked = true;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function eventOptions(options: AddEventListenerOptions) {\n return decorateProperty({\n finisher: (ctor: typeof ReactiveElement, name: PropertyKey) => {\n Object.assign(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ctor.prototype[name as keyof ReactiveElement] as any,\n options\n );\n },\n });\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {ReactiveElement} from '../reactive-element.js';\nimport {decorateProperty} from './base.js';\n\n/**\n * A property decorator that converts a class property into a getter that\n * executes a querySelector on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n * @param cache An optional boolean which when true performs the DOM query only\n * once and caches the result.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * ```ts\n * class MyElement {\n * @query('#first')\n * first: HTMLDivElement;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function query(selector: string, cache?: boolean) {\n return decorateProperty({\n descriptor: (name: PropertyKey) => {\n const descriptor = {\n get(this: ReactiveElement) {\n return this.renderRoot?.querySelector(selector) ?? null;\n },\n enumerable: true,\n configurable: true,\n };\n if (cache) {\n const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n descriptor.get = function (this: ReactiveElement) {\n if (\n (this as unknown as {[key: string]: Element | null})[\n key as string\n ] === undefined\n ) {\n (this as unknown as {[key: string]: Element | null})[\n key as string\n ] = this.renderRoot?.querySelector(selector) ?? null;\n }\n return (this as unknown as {[key: string]: Element | null})[\n key as string\n ];\n };\n }\n return descriptor;\n },\n });\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {ReactiveElement} from '../reactive-element.js';\nimport {decorateProperty} from './base.js';\n\n/**\n * A property decorator that converts a class property into a getter\n * that executes a querySelectorAll on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See:\n * https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll\n *\n * ```ts\n * class MyElement {\n * @queryAll('div')\n * divs: NodeListOf<HTMLDivElement>;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function queryAll(selector: string) {\n return decorateProperty({\n descriptor: (_name: PropertyKey) => ({\n get(this: ReactiveElement) {\n return this.renderRoot?.querySelectorAll(selector) ?? [];\n },\n enumerable: true,\n configurable: true,\n }),\n });\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {ReactiveElement} from '../reactive-element.js';\nimport {decorateProperty} from './base.js';\n\n// Note, in the future, we may extend this decorator to support the use case\n// where the queried element may need to do work to become ready to interact\n// with (e.g. load some implementation code). If so, we might elect to\n// add a second argument defining a function that can be run to make the\n// queried element loaded/updated/ready.\n/**\n * A property decorator that converts a class property into a getter that\n * returns a promise that resolves to the result of a querySelector on the\n * element's renderRoot done after the element's `updateComplete` promise\n * resolves. When the queried property may change with element state, this\n * decorator can be used instead of requiring users to await the\n * `updateComplete` before accessing the property.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * ```ts\n * class MyElement {\n * @queryAsync('#first')\n * first: Promise<HTMLDivElement>;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n *\n * // external usage\n * async doSomethingWithFirst() {\n * (await aMyElement.first).doSomething();\n * }\n * ```\n * @category Decorator\n */\nexport function queryAsync(selector: string) {\n return decorateProperty({\n descriptor: (_name: PropertyKey) => ({\n async get(this: ReactiveElement) {\n await this.updateComplete;\n return this.renderRoot?.querySelector(selector);\n },\n enumerable: true,\n configurable: true,\n }),\n });\n}\n", "/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {decorateProperty} from './base.js';\n\nimport type {ReactiveElement} from '../reactive-element.js';\nimport type {QueryAssignedNodesOptions} from './query-assigned-nodes.js';\n\nconst NODE_MODE = false;\nconst global = NODE_MODE ? globalThis : window;\n\n/**\n * A tiny module scoped polyfill for HTMLSlotElement.assignedElements.\n */\nconst slotAssignedElements =\n global.HTMLSlotElement?.prototype.assignedElements != null\n ? (slot: HTMLSlotElement, opts?: AssignedNodesOptions) =>\n slot.assignedElements(opts)\n : (slot: HTMLSlotElement, opts?: AssignedNodesOptions) =>\n slot\n .assignedNodes(opts)\n .filter(\n (node): node is Element => node.nodeType === Node.ELEMENT_NODE\n );\n\n/**\n * Options for the {@linkcode queryAssignedElements} decorator. Extends the\n * options that can be passed into\n * [HTMLSlotElement.assignedElements](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedElements).\n */\nexport interface QueryAssignedElementsOptions\n extends QueryAssignedNodesOptions {\n /**\n * CSS selector used to filter the elements returned. For example, a selector\n * of `\".item\"` will only include elements with the `item` class.\n */\n selector?: string;\n}\n\n/**\n * A property decorator that converts a class property into a getter that\n * returns the `assignedElements` of the given `slot`. Provides a declarative\n * way to use\n * [`HTMLSlotElement.assignedElements`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedElements).\n *\n * Can be passed an optional {@linkcode QueryAssignedElementsOptions} object.\n *\n * Example usage:\n * ```ts\n * class MyElement {\n * @queryAssignedElements({ slot: 'list' })\n * listItems!: Array<HTMLElement>;\n * @queryAssignedElements()\n * unnamedSlotEls!: Array<HTMLElement>;\n *\n * render() {\n * return html`\n * <slot name=\"list\"></slot>\n * <slot></slot>\n * `;\n * }\n * }\n * ```\n *\n * Note, the type of this property should be annotated as `Array<HTMLElement>`.\n *\n * @category Decorator\n */\nexport function queryAssignedElements(options?: QueryAssignedElementsOptions) {\n const {slot, selector} = options ?? {};\n return decorateProperty({\n descriptor: (_name: PropertyKey) => ({\n get(this: ReactiveElement) {\n const slotSelector = `slot${slot ? `[name=${slot}]` : ':not([name])'}`;\n const slotEl =\n this.renderRoot?.querySelector<HTMLSlotElement>(slotSelector);\n const elements =\n slotEl != null ? slotAssignedElements(slotEl, options) : [];\n if (selector) {\n return elements.filter((node) => node.matches(selector));\n }\n return elements;\n },\n enumerable: true,\n configurable: true,\n }),\n });\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {decorateProperty} from './base.js';\nimport {queryAssignedElements} from './query-assigned-elements.js';\n\nimport type {ReactiveElement} from '../reactive-element.js';\n\n/**\n * Options for the {@linkcode queryAssignedNodes} decorator. Extends the options\n * that can be passed into [HTMLSlotElement.assignedNodes](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedNodes).\n */\nexport interface QueryAssignedNodesOptions extends AssignedNodesOptions {\n /**\n * Name of the slot to query. Leave empty for the default slot.\n */\n slot?: string;\n}\n\n// TypeScript requires the decorator return type to be `void|any`.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype TSDecoratorReturnType = void | any;\n\n/**\n * A property decorator that converts a class property into a getter that\n * returns the `assignedNodes` of the given `slot`.\n *\n * Can be passed an optional {@linkcode QueryAssignedNodesOptions} object.\n *\n * Example usage:\n * ```ts\n * class MyElement {\n * @queryAssignedNodes({slot: 'list', flatten: true})\n * listItems!: Array<Node>;\n *\n * render() {\n * return html`\n * <slot name=\"list\"></slot>\n * `;\n * }\n * }\n * ```\n *\n * Note the type of this property should be annotated as `Array<Node>`.\n *\n * @category Decorator\n */\nexport function queryAssignedNodes(\n options?: QueryAssignedNodesOptions\n): TSDecoratorReturnType;\n\n/**\n * A property decorator that converts a class property into a getter that\n * returns the `assignedNodes` of the given named `slot`.\n *\n * Example usage:\n * ```ts\n * class MyElement {\n * @queryAssignedNodes('list', true, '.item')\n * listItems!: Array<HTMLElement>;\n *\n * render() {\n * return html`\n * <slot name=\"list\"></slot>\n * `;\n * }\n * }\n * ```\n *\n * Note the type of this property should be annotated as `Array<Node>` if used\n * without a `selector` or `Array<HTMLElement>` if a selector is provided.\n * Use {@linkcode queryAssignedElements @queryAssignedElements} to list only\n * elements, and optionally filter the element list using a CSS selector.\n *\n * @param slotName A string name of the slot.\n * @param flatten A boolean which when true flattens the assigned nodes,\n * meaning any assigned nodes that are slot elements are replaced with their\n * assigned nodes.\n * @param selector A CSS selector used to filter the elements returned.\n *\n * @category Decorator\n * @deprecated Prefer passing in a single options object, i.e. `{slot: 'list'}`.\n * If using `selector` please use `@queryAssignedElements`.\n * `@queryAssignedNodes('', false, '.item')` is functionally identical to\n * `@queryAssignedElements({slot: '', flatten: false, selector: '.item'})` or\n * `@queryAssignedElements({selector: '.item'})`.\n */\nexport function queryAssignedNodes(\n slotName?: string,\n flatten?: boolean,\n selector?: string\n): TSDecoratorReturnType;\n\nexport function queryAssignedNodes(\n slotOrOptions?: string | QueryAssignedNodesOptions,\n flatten?: boolean,\n selector?: string\n) {\n // Normalize the overloaded arguments.\n let slot = slotOrOptions;\n let assignedNodesOptions: AssignedNodesOptions;\n if (typeof slotOrOptions === 'object') {\n slot = slotOrOptions.slot;\n assignedNodesOptions = slotOrOptions;\n } else {\n assignedNodesOptions = {flatten};\n }\n\n // For backwards compatibility, queryAssignedNodes with a selector behaves\n // exactly like queryAssignedElements with a selector.\n if (selector) {\n return queryAssignedElements({\n slot: slot as string,\n flatten,\n selector,\n });\n }\n\n return decorateProperty({\n descriptor: (_name: PropertyKey) => ({\n get(this: ReactiveElement) {\n const slotSelector = `slot${slot ? `[name=${slot}]` : ':not([name])'}`;\n const slotEl =\n this.renderRoot?.querySelector<HTMLSlotElement>(slotSelector);\n return slotEl?.assignedNodes(assignedNodesOptions) ?? [];\n },\n enumerable: true,\n configurable: true,\n }),\n });\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nexport * from '@lit/reactive-element';\nexport * from 'lit-html';\nexport * from './lit-element.js';\nexport * from './decorators.js';\n\nconsole.warn(\n \"The main 'lit-element' module entrypoint is deprecated. Please update \" +\n \"your imports to use the 'lit' package: 'lit' and 'lit/decorators.ts' \" +\n \"or import from 'lit-element/lit-element.ts'. See \" +\n 'https://lit.dev/msg/deprecated-import-path for more information.'\n);\n", "/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {AttributePart, noChange} from '../lit-html.js';\nimport {\n directive,\n Directive,\n DirectiveParameters,\n PartInfo,\n PartType,\n} from '../directive.js';\n\n/**\n * A key-value set of class names to truthy values.\n */\nexport interface ClassInfo {\n readonly [name: string]: string | boolean | number;\n}\n\nclass ClassMapDirective extends Directive {\n /**\n * Stores the ClassInfo object applied to a given AttributePart.\n * Used to unset existing values when a new ClassInfo object is applied.\n */\n private _previousClasses?: Set<string>;\n private _staticClasses?: Set<string>;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (\n partInfo.type !== PartType.ATTRIBUTE ||\n partInfo.name !== 'class' ||\n (partInfo.strings?.length as number) > 2\n ) {\n throw new Error(\n '`classMap()` can only be used in the `class` attribute ' +\n 'and must be the only part in the attribute.'\n );\n }\n }\n\n render(classInfo: ClassInfo) {\n // Add spaces to ensure separation from static classes\n return (\n ' ' +\n Object.keys(classInfo)\n .filter((key) => classInfo[key])\n .join(' ') +\n ' '\n );\n }\n\n override update(part: AttributePart, [classInfo]: DirectiveParameters<this>) {\n // Remember dynamic classes on the first render\n if (this._previousClasses === undefined) {\n this._previousClasses = new Set();\n if (part.strings !== undefined) {\n this._staticClasses = new Set(\n part.strings\n .join(' ')\n .split(/\\s/)\n .filter((s) => s !== '')\n );\n }\n for (const name in classInfo) {\n if (classInfo[name] && !this._staticClasses?.has(name)) {\n this._previousClasses.add(name);\n }\n }\n return this.render(classInfo);\n }\n\n const classList = part.element.classList;\n\n // Remove old classes that no longer apply\n // We use forEach() instead of for-of so that we don't require down-level\n // iteration.\n this._previousClasses.forEach((name) => {\n if (!(name in classInfo)) {\n classList.remove(name);\n this._previousClasses!.delete(name);\n }\n });\n\n // Add or remove classes based on their classMap value\n for (const name in classInfo) {\n // We explicitly want a loose truthy check of `value` because it seems\n // more convenient that '' and 0 are skipped.\n const value = !!classInfo[name];\n if (\n value !== this._previousClasses.has(name) &&\n !this._staticClasses?.has(name)\n ) {\n if (value) {\n classList.add(name);\n this._previousClasses.add(name);\n } else {\n classList.remove(name);\n this._previousClasses.delete(name);\n }\n }\n }\n return noChange;\n }\n}\n\n/**\n * A directive that applies dynamic CSS classes.\n *\n * This must be used in the `class` attribute and must be the only part used in\n * the attribute. It takes each property in the `classInfo` argument and adds\n * the property name to the element's `classList` if the property value is\n * truthy; if the property value is falsey, the property name is removed from\n * the element's `class`.\n *\n * For example `{foo: bar}` applies the class `foo` if the value of `bar` is\n * truthy.\n *\n * @param classInfo\n */\nexport const classMap = directive(ClassMapDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {ClassMapDirective};\n", "/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n// Note, this module is not included in package exports so that it's private to\n// our first-party directives. If it ends up being useful, we can open it up and\n// export it.\n\n/**\n * Helper to iterate an AsyncIterable in its own closure.\n * @param iterable The iterable to iterate\n * @param callback The callback to call for each value. If the callback returns\n * `false`, the loop will be broken.\n */\nexport const forAwaitOf = async <T>(\n iterable: AsyncIterable<T>,\n callback: (value: T) => Promise<boolean>\n) => {\n for await (const v of iterable) {\n if ((await callback(v)) === false) {\n return;\n }\n }\n};\n\n/**\n * Holds a reference to an instance that can be disconnected and reconnected,\n * so that a closure over the ref (e.g. in a then function to a promise) does\n * not strongly hold a ref to the instance. Approximates a WeakRef but must\n * be manually connected & disconnected to the backing instance.\n */\nexport class PseudoWeakRef<T> {\n private _ref?: T;\n constructor(ref: T) {\n this._ref = ref;\n }\n /**\n * Disassociates the ref with the backing instance.\n */\n disconnect() {\n this._ref = undefined;\n }\n /**\n * Reassociates the ref with the backing instance.\n */\n reconnect(ref: T) {\n this._ref = ref;\n }\n /**\n * Retrieves the backing instance (will be undefined when disconnected)\n */\n deref() {\n return this._ref;\n }\n}\n\n/**\n * A helper to pause and resume waiting on a condition in an async function\n */\nexport class Pauser {\n private _promise?: Promise<void> = undefined;\n private _resolve?: () => void = undefined;\n /**\n * When paused, returns a promise to be awaited; when unpaused, returns\n * undefined. Note that in the microtask between the pauser being resumed\n * an an await of this promise resolving, the pauser could be paused again,\n * hence callers should check the promise in a loop when awaiting.\n * @returns A promise to be awaited when paused or undefined\n */\n get() {\n return this._promise;\n }\n /**\n * Creates a promise to be awaited\n */\n pause() {\n this._promise ??= new Promise((resolve) => (this._resolve = resolve));\n }\n /**\n * Resolves the promise which may be awaited\n */\n resume() {\n this._resolve?.();\n this._promise = this._resolve = undefined;\n }\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {ChildPart, noChange} from '../lit-html.js';\nimport {\n AsyncDirective,\n directive,\n DirectiveParameters,\n} from '../async-directive.js';\nimport {Pauser, PseudoWeakRef, forAwaitOf} from './private-async-helpers.js';\n\ntype Mapper<T> = (v: T, index?: number) => unknown;\n\nexport class AsyncReplaceDirective extends AsyncDirective {\n private __value?: AsyncIterable<unknown>;\n private __weakThis = new PseudoWeakRef(this);\n private __pauser = new Pauser();\n\n // @ts-expect-error value not used, but we want a nice parameter for docs\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n render<T>(value: AsyncIterable<T>, _mapper?: Mapper<T>) {\n return noChange;\n }\n\n override update(\n _part: ChildPart,\n [value, mapper]: DirectiveParameters<this>\n ) {\n // If our initial render occurs while disconnected, ensure that the pauser\n // and weakThis are in the disconnected state\n if (!this.isConnected) {\n this.disconnected();\n }\n // If we've already set up this particular iterable, we don't need\n // to do anything.\n if (value === this.__value) {\n return;\n }\n this.__value = value;\n let i = 0;\n const {__weakThis: weakThis, __pauser: pauser} = this;\n // Note, the callback avoids closing over `this` so that the directive\n // can be gc'ed before the promise resolves; instead `this` is retrieved\n // from `weakThis`, which can break the hard reference in the closure when\n // the directive disconnects\n forAwaitOf(value, async (v: unknown) => {\n // The while loop here handles the case that the connection state\n // thrashes, causing the pauser to resume and then get re-paused\n while (pauser.get()) {\n await pauser.get();\n }\n // If the callback gets here and there is no `this`, it means that the\n // directive has been disconnected and garbage collected and we don't\n // need to do anything else\n const _this = weakThis.deref();\n if (_this !== undefined) {\n // Check to make sure that value is the still the current value of\n // the part, and if not bail because a new value owns this part\n if (_this.__value !== value) {\n return false;\n }\n\n // As a convenience, because functional-programming-style\n // transforms of iterables and async iterables requires a library,\n // we accept a mapper function. This is especially convenient for\n // rendering a template for each item.\n if (mapper !== undefined) {\n v = mapper(v, i);\n }\n\n _this.commitValue(v, i);\n i++;\n }\n return true;\n });\n return noChange;\n }\n\n // Override point for AsyncAppend to append rather than replace\n protected commitValue(value: unknown, _index: number) {\n this.setValue(value);\n }\n\n override disconnected() {\n this.__weakThis.disconnect();\n this.__pauser.pause();\n }\n\n override reconnected() {\n this.__weakThis.reconnect(this);\n this.__pauser.resume();\n }\n}\n\n/**\n * A directive that renders the items of an async iterable[1], replacing\n * previous values with new values, so that only one value is ever rendered\n * at a time. This directive may be used in any expression type.\n *\n * Async iterables are objects with a `[Symbol.asyncIterator]` method, which\n * returns an iterator who's `next()` method returns a Promise. When a new\n * value is available, the Promise resolves and the value is rendered to the\n * Part controlled by the directive. If another value other than this\n * directive has been set on the Part, the iterable will no longer be listened\n * to and new values won't be written to the Part.\n *\n * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of\n *\n * @param value An async iterable\n * @param mapper An optional function that maps from (value, index) to another\n * value. Useful for generating templates for each item in the iterable.\n */\nexport const asyncReplace = directive(AsyncReplaceDirective);\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {ChildPart} from '../lit-html.js';\nimport {\n directive,\n DirectiveParameters,\n PartInfo,\n PartType,\n} from '../directive.js';\nimport {AsyncReplaceDirective} from './async-replace.js';\nimport {\n clearPart,\n insertPart,\n setChildPartValue,\n} from '../directive-helpers.js';\n\nclass AsyncAppendDirective extends AsyncReplaceDirective {\n private __childPart!: ChildPart;\n\n // Override AsyncReplace to narrow the allowed part type to ChildPart only\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.CHILD) {\n throw new Error('asyncAppend can only be used in child expressions');\n }\n }\n\n // Override AsyncReplace to save the part since we need to append into it\n override update(part: ChildPart, params: DirectiveParameters<this>) {\n this.__childPart = part;\n return super.update(part, params);\n }\n\n // Override AsyncReplace to append rather than replace\n protected override commitValue(value: unknown, index: number) {\n // When we get the first value, clear the part. This lets the\n // previous value display until we can replace it.\n if (index === 0) {\n clearPart(this.__childPart);\n }\n // Create and insert a new part and set its value to the next value\n const newPart = insertPart(this.__childPart);\n setChildPartValue(newPart, value);\n }\n}\n\n/**\n * A directive that renders the items of an async iterable[1], appending new\n * values after previous values, similar to the built-in support for iterables.\n * This directive is usable only in child expressions.\n *\n * Async iterables are objects with a [Symbol.asyncIterator] method, which\n * returns an iterator who's `next()` method returns a Promise. When a new\n * value is available, the Promise resolves and the value is appended to the\n * Part controlled by the directive. If another value other than this\n * directive has been set on the Part, the iterable will no longer be listened\n * to and new values won't be written to the Part.\n *\n * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of\n *\n * @param value An async iterable\n * @param mapper An optional function that maps from (value, index) to another\n * value. Useful for generating templates for each item in the iterable.\n */\nexport const asyncAppend = directive(AsyncAppendDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {AsyncAppendDirective};\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {\n TemplateResult,\n ChildPart,\n RootPart,\n render,\n nothing,\n} from '../lit-html.js';\nimport {\n directive,\n Directive,\n DirectiveParameters,\n PartInfo,\n} from '../directive.js';\nimport {\n clearPart,\n getCommittedValue,\n insertPart,\n isTemplateResult,\n setCommittedValue,\n} from '../directive-helpers.js';\n\nclass CacheDirective extends Directive {\n private _templateCache = new WeakMap<TemplateStringsArray, RootPart>();\n private _value?: TemplateResult;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n }\n\n render(v: unknown) {\n // Return an array of the value to induce lit-html to create a ChildPart\n // for the value that we can move into the cache.\n return [v];\n }\n\n override update(containerPart: ChildPart, [v]: DirectiveParameters<this>) {\n // If the previous value is a TemplateResult and the new value is not,\n // or is a different Template as the previous value, move the child part\n // into the cache.\n if (\n isTemplateResult(this._value) &&\n (!isTemplateResult(v) || this._value.strings !== v.strings)\n ) {\n // This is always an array because we return [v] in render()\n const partValue = getCommittedValue(containerPart) as Array<ChildPart>;\n const childPart = partValue.pop()!;\n let cachedContainerPart = this._templateCache.get(this._value.strings);\n if (cachedContainerPart === undefined) {\n const fragment = document.createDocumentFragment();\n cachedContainerPart = render(nothing, fragment);\n cachedContainerPart.setConnected(false);\n this._templateCache.set(this._value.strings, cachedContainerPart);\n }\n // Move into cache\n setCommittedValue(cachedContainerPart, [childPart]);\n insertPart(cachedContainerPart, undefined, childPart);\n }\n // If the new value is a TemplateResult and the previous value is not,\n // or is a different Template as the previous value, restore the child\n // part from the cache.\n if (isTemplateResult(v)) {\n if (!isTemplateResult(this._value) || this._value.strings !== v.strings) {\n const cachedContainerPart = this._templateCache.get(v.strings);\n if (cachedContainerPart !== undefined) {\n // Move the cached part back into the container part value\n const partValue = getCommittedValue(\n cachedContainerPart\n ) as Array<ChildPart>;\n const cachedPart = partValue.pop()!;\n // Move cached part back into DOM\n clearPart(containerPart);\n insertPart(containerPart, undefined, cachedPart);\n setCommittedValue(containerPart, [cachedPart]);\n }\n }\n this._value = v;\n } else {\n this._value = undefined;\n }\n return this.render(v);\n }\n}\n\n/**\n * Enables fast switching between multiple templates by caching the DOM nodes\n * and TemplateInstances produced by the templates.\n *\n * Example:\n *\n * ```js\n * let checked = false;\n *\n * html`\n * ${cache(checked ? html`input is checked` : html`input is not checked`)}\n * `\n * ```\n */\nexport const cache = directive(CacheDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {CacheDirective};\n", "/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {noChange, Part} from '../lit-html.js';\nimport {directive, Directive, DirectiveParameters} from '../directive.js';\n\n// A sentinal that indicates guard() hasn't rendered anything yet\nconst initialValue = {};\n\nclass GuardDirective extends Directive {\n private _previousValue: unknown = initialValue;\n\n render(_value: unknown, f: () => unknown) {\n return f();\n }\n\n override update(_part: Part, [value, f]: DirectiveParameters<this>) {\n if (Array.isArray(value)) {\n // Dirty-check arrays by item\n if (\n Array.isArray(this._previousValue) &&\n this._previousValue.length === value.length &&\n value.every((v, i) => v === (this._previousValue as Array<unknown>)[i])\n ) {\n return noChange;\n }\n } else if (this._previousValue === value) {\n // Dirty-check non-arrays by identity\n return noChange;\n }\n\n // Copy the value if it's an array so that if it's mutated we don't forget\n // what the previous values were.\n this._previousValue = Array.isArray(value) ? Array.from(value) : value;\n const r = this.render(value, f);\n return r;\n }\n}\n\n/**\n * Prevents re-render of a template function until a single value or an array of\n * values changes.\n *\n * Values are checked against previous values with strict equality (`===`), and\n * so the check won't detect nested property changes inside objects or arrays.\n * Arrays values have each item checked against the previous value at the same\n * index with strict equality. Nested arrays are also checked only by strict\n * equality.\n *\n * Example:\n *\n * ```js\n * html`\n * <div>\n * ${guard([user.id, company.id], () => html`...`)}\n * </div>\n * `\n * ```\n *\n * In this case, the template only rerenders if either `user.id` or `company.id`\n * changes.\n *\n * guard() is useful with immutable data patterns, by preventing expensive work\n * until data updates.\n *\n * Example:\n *\n * ```js\n * html`\n * <div>\n * ${guard([immutableItems], () => immutableItems.map(i => html`${i}`))}\n * </div>\n * `\n * ```\n *\n * In this case, items are mapped over only when the array reference changes.\n *\n * @param value the value to check before re-rendering\n * @param f the template function\n */\nexport const guard = directive(GuardDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {GuardDirective};\n", "/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {nothing} from '../lit-html.js';\n\n/**\n * For AttributeParts, sets the attribute if the value is defined and removes\n * the attribute if the value is undefined.\n *\n * For other part types, this directive is a no-op.\n */\nexport const ifDefined = <T>(value: T) => value ?? nothing;\n", "/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {AttributePart, noChange, nothing} from '../lit-html.js';\nimport {\n directive,\n Directive,\n DirectiveParameters,\n PartInfo,\n PartType,\n} from '../directive.js';\nimport {isSingleExpression, setCommittedValue} from '../directive-helpers.js';\n\nclass LiveDirective extends Directive {\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (\n !(\n partInfo.type === PartType.PROPERTY ||\n partInfo.type === PartType.ATTRIBUTE ||\n partInfo.type === PartType.BOOLEAN_ATTRIBUTE\n )\n ) {\n throw new Error(\n 'The `live` directive is not allowed on child or event bindings'\n );\n }\n if (!isSingleExpression(partInfo)) {\n throw new Error('`live` bindings can only contain a single expression');\n }\n }\n\n render(value: unknown) {\n return value;\n }\n\n override update(part: AttributePart, [value]: DirectiveParameters<this>) {\n if (value === noChange || value === nothing) {\n return value;\n }\n const element = part.element;\n const name = part.name;\n\n if (part.type === PartType.PROPERTY) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (value === (element as any)[name]) {\n return noChange;\n }\n } else if (part.type === PartType.BOOLEAN_ATTRIBUTE) {\n if (!!value === element.hasAttribute(name)) {\n return noChange;\n }\n } else if (part.type === PartType.ATTRIBUTE) {\n if (element.getAttribute(name) === String(value)) {\n return noChange;\n }\n }\n // Resets the part's value, causing its dirty-check to fail so that it\n // always sets the value.\n setCommittedValue(part);\n return value;\n }\n}\n\n/**\n * Checks binding values against live DOM values, instead of previously bound\n * values, when determining whether to update the value.\n *\n * This is useful for cases where the DOM value may change from outside of\n * lit-html, such as with a binding to an `<input>` element's `value` property,\n * a content editable elements text, or to a custom element that changes it's\n * own properties or attributes.\n *\n * In these cases if the DOM value changes, but the value set through lit-html\n * bindings hasn't, lit-html won't know to update the DOM value and will leave\n * it alone. If this is not what you want--if you want to overwrite the DOM\n * value with the bound value no matter what--use the `live()` directive:\n *\n * ```js\n * html`<input .value=${live(x)}>`\n * ```\n *\n * `live()` performs a strict equality check against the live DOM value, and if\n * the new value is equal to the live value, does nothing. This means that\n * `live()` should not be used when the binding will cause a type conversion. If\n * you use `live()` with an attribute binding, make sure that only strings are\n * passed in, or the binding will update every render.\n */\nexport const live = directive(LiveDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {LiveDirective};\n", "/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport {nothing, ElementPart} from '../lit-html.js';\nimport {directive, AsyncDirective} from '../async-directive.js';\n\n/**\n * Creates a new Ref object, which is container for a reference to an element.\n */\nexport const createRef = <T = Element>() => new Ref<T>();\n\n/**\n * An object that holds a ref value.\n */\nclass Ref<T = Element> {\n /**\n * The current Element value of the ref, or else `undefined` if the ref is no\n * longer rendered.\n */\n readonly value?: T;\n}\n\nexport type {Ref};\n\ninterface RefInternal {\n value: Element | undefined;\n}\n\n// When callbacks are used for refs, this map tracks the last value the callback\n// was called with, for ensuring a directive doesn't clear the ref if the ref\n// has already been rendered to a new spot. It is double-keyed on both the\n// context (`options.host`) and the callback, since we auto-bind class methods\n// to `options.host`.\nconst lastElementForContextAndCallback: WeakMap<\n object,\n WeakMap<Function, Element | undefined>\n> = new WeakMap();\n\nexport type RefOrCallback = Ref | ((el: Element | undefined) => void);\n\nclass RefDirective extends AsyncDirective {\n private _element?: Element;\n private _ref?: RefOrCallback;\n private _context?: object;\n\n render(_ref: RefOrCallback) {\n return nothing;\n }\n\n override update(part: ElementPart, [ref]: Parameters<this['render']>) {\n const refChanged = ref !== this._ref;\n if (refChanged && this._ref !== undefined) {\n // The ref passed to the directive has changed;\n // unset the previous ref's value\n this._updateRefValue(undefined);\n }\n if (refChanged || this._lastElementForRef !== this._element) {\n // We either got a new ref or this is the first render;\n // store the ref/element & update the ref value\n this._ref = ref;\n this._context = part.options?.host;\n this._updateRefValue((this._element = part.element));\n }\n return nothing;\n }\n\n private _updateRefValue(element: Element | undefined) {\n if (typeof this._ref === 'function') {\n // If the current ref was called with a previous value, call with\n // `undefined`; We do this to ensure callbacks are called in a consistent\n // way regardless of whether a ref might be moving up in the tree (in\n // which case it would otherwise be called with the new value before the\n // previous one unsets it) and down in the tree (where it would be unset\n // before being set). Note that element lookup is keyed by\n // both the context and the callback, since we allow passing unbound\n // functions that are called on options.host, and we want to treat\n // these as unique \"instances\" of a function.\n const context = this._context ?? globalThis;\n let lastElementForCallback =\n lastElementForContextAndCallback.get(context);\n if (lastElementForCallback === undefined) {\n lastElementForCallback = new WeakMap();\n lastElementForContextAndCallback.set(context, lastElementForCallback);\n }\n if (lastElementForCallback.get(this._ref) !== undefined) {\n this._ref.call(this._context, undefined);\n }\n lastElementForCallback.set(this._ref, element);\n // Call the ref with the new element value\n if (element !== undefined) {\n this._ref.call(this._context, element);\n }\n } else {\n (this._ref as RefInternal)!.value = element;\n }\n }\n\n private get _lastElementForRef() {\n return typeof this._ref === 'function'\n ? lastElementForContextAndCallback\n .get(this._context ?? globalThis)\n ?.get(this._ref)\n : this._ref?.value;\n }\n\n override disconnected() {\n // Only clear the box if our element is still the one in it (i.e. another\n // directive instance hasn't rendered its element to it before us); that\n // only happens in the event of the directive being cleared (not via manual\n // disconnection)\n if (this._lastElementForRef === this._element) {\n this._updateRefValue(undefined);\n }\n }\n\n override reconnected() {\n // If we were manually disconnected, we can safely put our element back in\n // the box, since no rendering could have occurred to change its state\n this._updateRefValue(this._element);\n }\n}\n\n/**\n * Sets the value of a Ref object or calls a ref callback with the element it's\n * bound to.\n *\n * A Ref object acts as a container for a reference to an element. A ref\n * callback is a function that takes an element as its only argument.\n *\n * The ref directive sets the value of the Ref object or calls the ref callback\n * during rendering, if the referenced element changed.\n *\n * Note: If a ref callback is rendered to a different element position or is\n * removed in a subsequent render, it will first be called with `undefined`,\n * followed by another call with the new element it was rendered to (if any).\n *\n * ```js\n * // Using Ref object\n * const inputRef = createRef();\n * render(html`<input ${ref(inputRef)}>`, container);\n * inputRef.value.focus();\n *\n * // Using callback\n * const callback = (inputElement) => inputElement.focus();\n * render(html`<input ${ref(callback)}>`, container);\n * ```\n */\nexport const ref = directive(RefDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {RefDirective};\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {ChildPart, noChange} from '../lit-html.js';\nimport {directive, Directive, PartInfo, PartType} from '../directive.js';\nimport {\n insertPart,\n getCommittedValue,\n removePart,\n setCommittedValue,\n setChildPartValue,\n} from '../directive-helpers.js';\n\nexport type KeyFn<T> = (item: T, index: number) => unknown;\nexport type ItemTemplate<T> = (item: T, index: number) => unknown;\n\n// Helper for generating a map of array item to its index over a subset\n// of an array (used to lazily generate `newKeyToIndexMap` and\n// `oldKeyToIndexMap`)\nconst generateMap = (list: unknown[], start: number, end: number) => {\n const map = new Map<unknown, number>();\n for (let i = start; i <= end; i++) {\n map.set(list[i], i);\n }\n return map;\n};\n\nclass RepeatDirective extends Directive {\n private _itemKeys?: unknown[];\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.CHILD) {\n throw new Error('repeat() can only be used in text expressions');\n }\n }\n\n private _getValuesAndKeys<T>(\n items: Iterable<T>,\n keyFnOrTemplate: KeyFn<T> | ItemTemplate<T>,\n template?: ItemTemplate<T>\n ) {\n let keyFn: KeyFn<T> | undefined;\n if (template === undefined) {\n template = keyFnOrTemplate;\n } else if (keyFnOrTemplate !== undefined) {\n keyFn = keyFnOrTemplate as KeyFn<T>;\n }\n const keys = [];\n const values = [];\n let index = 0;\n for (const item of items) {\n keys[index] = keyFn ? keyFn(item, index) : index;\n values[index] = template!(item, index);\n index++;\n }\n return {\n values,\n keys,\n };\n }\n\n render<T>(items: Iterable<T>, template: ItemTemplate<T>): Array<unknown>;\n render<T>(\n items: Iterable<T>,\n keyFn: KeyFn<T> | ItemTemplate<T>,\n template: ItemTemplate<T>\n ): Array<unknown>;\n render<T>(\n items: Iterable<T>,\n keyFnOrTemplate: KeyFn<T> | ItemTemplate<T>,\n template?: ItemTemplate<T>\n ) {\n return this._getValuesAndKeys(items, keyFnOrTemplate, template).values;\n }\n\n override update<T>(\n containerPart: ChildPart,\n [items, keyFnOrTemplate, template]: [\n Iterable<T>,\n KeyFn<T> | ItemTemplate<T>,\n ItemTemplate<T>\n ]\n ) {\n // Old part & key lists are retrieved from the last update (which may\n // be primed by hydration)\n const oldParts = getCommittedValue(\n containerPart\n ) as Array<ChildPart | null>;\n const {values: newValues, keys: newKeys} = this._getValuesAndKeys(\n items,\n keyFnOrTemplate,\n template\n );\n\n // We check that oldParts, the committed value, is an Array as an\n // indicator that the previous value came from a repeat() call. If\n // oldParts is not an Array then this is the first render and we return\n // an array for lit-html's array handling to render, and remember the\n // keys.\n if (!Array.isArray(oldParts)) {\n this._itemKeys = newKeys;\n return newValues;\n }\n\n // In SSR hydration it's possible for oldParts to be an arrray but for us\n // to not have item keys because the update() hasn't run yet. We set the\n // keys to an empty array. This will cause all oldKey/newKey comparisons\n // to fail and execution to fall to the last nested brach below which\n // reuses the oldPart.\n const oldKeys = (this._itemKeys ??= []);\n\n // New part list will be built up as we go (either reused from\n // old parts or created for new keys in this update). This is\n // saved in the above cache at the end of the update.\n const newParts: ChildPart[] = [];\n\n // Maps from key to index for current and previous update; these\n // are generated lazily only when needed as a performance\n // optimization, since they are only required for multiple\n // non-contiguous changes in the list, which are less common.\n let newKeyToIndexMap!: Map<unknown, number>;\n let oldKeyToIndexMap!: Map<unknown, number>;\n\n // Head and tail pointers to old parts and new values\n let oldHead = 0;\n let oldTail = oldParts.length - 1;\n let newHead = 0;\n let newTail = newValues.length - 1;\n\n // Overview of O(n) reconciliation algorithm (general approach\n // based on ideas found in ivi, vue, snabbdom, etc.):\n //\n // * We start with the list of old parts and new values (and\n // arrays of their respective keys), head/tail pointers into\n // each, and we build up the new list of parts by updating\n // (and when needed, moving) old parts or creating new ones.\n // The initial scenario might look like this (for brevity of\n // the diagrams, the numbers in the array reflect keys\n // associated with the old parts or new values, although keys\n // and parts/values are actually stored in parallel arrays\n // indexed using the same head/tail pointers):\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [ , , , , , , ]\n // newKeys: [0, 2, 1, 4, 3, 7, 6] <- reflects the user's new\n // item order\n // newHead ^ ^ newTail\n //\n // * Iterate old & new lists from both sides, updating,\n // swapping, or removing parts at the head/tail locations\n // until neither head nor tail can move.\n //\n // * Example below: keys at head pointers match, so update old\n // part 0 in-place (no need to move it) and record part 0 in\n // the `newParts` list. The last thing we do is advance the\n // `oldHead` and `newHead` pointers (will be reflected in the\n // next diagram).\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , ] <- heads matched: update 0\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldHead\n // & newHead\n // newHead ^ ^ newTail\n //\n // * Example below: head pointers don't match, but tail\n // pointers do, so update part 6 in place (no need to move\n // it), and record part 6 in the `newParts` list. Last,\n // advance the `oldTail` and `oldHead` pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , 6] <- tails matched: update 6\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldTail\n // & newTail\n // newHead ^ ^ newTail\n //\n // * If neither head nor tail match; next check if one of the\n // old head/tail items was removed. We first need to generate\n // the reverse map of new keys to index (`newKeyToIndexMap`),\n // which is done once lazily as a performance optimization,\n // since we only hit this case if multiple non-contiguous\n // changes were made. Note that for contiguous removal\n // anywhere in the list, the head and tails would advance\n // from either end and pass each other before we get to this\n // case and removals would be handled in the final while loop\n // without needing to generate the map.\n //\n // * Example below: The key at `oldTail` was removed (no longer\n // in the `newKeyToIndexMap`), so remove that part from the\n // DOM and advance just the `oldTail` pointer.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , 6] <- 5 not in new map: remove\n // newKeys: [0, 2, 1, 4, 3, 7, 6] 5 and advance oldTail\n // newHead ^ ^ newTail\n //\n // * Once head and tail cannot move, any mismatches are due to\n // either new or moved items; if a new key is in the previous\n // \"old key to old index\" map, move the old part to the new\n // location, otherwise create and insert a new part. Note\n // that when moving an old part we null its position in the\n // oldParts array if it lies between the head and tail so we\n // know to skip it when the pointers get there.\n //\n // * Example below: neither head nor tail match, and neither\n // were removed; so find the `newHead` key in the\n // `oldKeyToIndexMap`, and move that old part's DOM into the\n // next head position (before `oldParts[oldHead]`). Last,\n // null the part in the `oldPart` array since it was\n // somewhere in the remaining oldParts still to be scanned\n // (between the head and tail pointers) so that we know to\n // skip that old part on future iterations.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, , , , , 6] <- stuck: update & move 2\n // newKeys: [0, 2, 1, 4, 3, 7, 6] into place and advance\n // newHead\n // newHead ^ ^ newTail\n //\n // * Note that for moves/insertions like the one above, a part\n // inserted at the head pointer is inserted before the\n // current `oldParts[oldHead]`, and a part inserted at the\n // tail pointer is inserted before `newParts[newTail+1]`. The\n // seeming asymmetry lies in the fact that new parts are\n // moved into place outside in, so to the right of the head\n // pointer are old parts, and to the right of the tail\n // pointer are new parts.\n //\n // * We always restart back from the top of the algorithm,\n // allowing matching and simple updates in place to\n // continue...\n //\n // * Example below: the head pointers once again match, so\n // simply update part 1 and record it in the `newParts`\n // array. Last, advance both head pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, , , , 6] <- heads matched: update 1\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldHead\n // & newHead\n // newHead ^ ^ newTail\n //\n // * As mentioned above, items that were moved as a result of\n // being stuck (the final else clause in the code below) are\n // marked with null, so we always advance old pointers over\n // these so we're comparing the next actual old value on\n // either end.\n //\n // * Example below: `oldHead` is null (already placed in\n // newParts), so advance `oldHead`.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6] <- old head already used:\n // newParts: [0, 2, 1, , , , 6] advance oldHead\n // newKeys: [0, 2, 1, 4, 3, 7, 6]\n // newHead ^ ^ newTail\n //\n // * Note it's not critical to mark old parts as null when they\n // are moved from head to tail or tail to head, since they\n // will be outside the pointer range and never visited again.\n //\n // * Example below: Here the old tail key matches the new head\n // key, so the part at the `oldTail` position and move its\n // DOM to the new head position (before `oldParts[oldHead]`).\n // Last, advance `oldTail` and `newHead` pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, , , 6] <- old tail matches new\n // newKeys: [0, 2, 1, 4, 3, 7, 6] head: update & move 4,\n // advance oldTail & newHead\n // newHead ^ ^ newTail\n //\n // * Example below: Old and new head keys match, so update the\n // old head part in place, and advance the `oldHead` and\n // `newHead` pointers.\n //\n // oldHead v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, 3, ,6] <- heads match: update 3\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance oldHead &\n // newHead\n // newHead ^ ^ newTail\n //\n // * Once the new or old pointers move past each other then all\n // we have left is additions (if old list exhausted) or\n // removals (if new list exhausted). Those are handled in the\n // final while loops at the end.\n //\n // * Example below: `oldHead` exceeded `oldTail`, so we're done\n // with the main loop. Create the remaining part and insert\n // it at the new head position, and the update is complete.\n //\n // (oldHead > oldTail)\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, 3, 7 ,6] <- create and insert 7\n // newKeys: [0, 2, 1, 4, 3, 7, 6]\n // newHead ^ newTail\n //\n // * Note that the order of the if/else clauses is not\n // important to the algorithm, as long as the null checks\n // come first (to ensure we're always working on valid old\n // parts) and that the final else clause comes last (since\n // that's where the expensive moves occur). The order of\n // remaining clauses is is just a simple guess at which cases\n // will be most common.\n //\n // * Note, we could calculate the longest\n // increasing subsequence (LIS) of old items in new position,\n // and only move those not in the LIS set. However that costs\n // O(nlogn) time and adds a bit more code, and only helps\n // make rare types of mutations require fewer moves. The\n // above handles removes, adds, reversal, swaps, and single\n // moves of contiguous items in linear time, in the minimum\n // number of moves. As the number of multiple moves where LIS\n // might help approaches a random shuffle, the LIS\n // optimization becomes less helpful, so it seems not worth\n // the code at this point. Could reconsider if a compelling\n // case arises.\n\n while (oldHead <= oldTail && newHead <= newTail) {\n if (oldParts[oldHead] === null) {\n // `null` means old part at head has already been used\n // below; skip\n oldHead++;\n } else if (oldParts[oldTail] === null) {\n // `null` means old part at tail has already been used\n // below; skip\n oldTail--;\n } else if (oldKeys[oldHead] === newKeys[newHead]) {\n // Old head matches new head; update in place\n newParts[newHead] = setChildPartValue(\n oldParts[oldHead]!,\n newValues[newHead]\n );\n oldHead++;\n newHead++;\n } else if (oldKeys[oldTail] === newKeys[newTail]) {\n // Old tail matches new tail; update in place\n newParts[newTail] = setChildPartValue(\n oldParts[oldTail]!,\n newValues[newTail]\n );\n oldTail--;\n newTail--;\n } else if (oldKeys[oldHead] === newKeys[newTail]) {\n // Old head matches new tail; update and move to new tail\n newParts[newTail] = setChildPartValue(\n oldParts[oldHead]!,\n newValues[newTail]\n );\n insertPart(containerPart, newParts[newTail + 1], oldParts[oldHead]!);\n oldHead++;\n newTail--;\n } else if (oldKeys[oldTail] === newKeys[newHead]) {\n // Old tail matches new head; update and move to new head\n newParts[newHead] = setChildPartValue(\n oldParts[oldTail]!,\n newValues[newHead]\n );\n insertPart(containerPart, oldParts[oldHead]!, oldParts[oldTail]!);\n oldTail--;\n newHead++;\n } else {\n if (newKeyToIndexMap === undefined) {\n // Lazily generate key-to-index maps, used for removals &\n // moves below\n newKeyToIndexMap = generateMap(newKeys, newHead, newTail);\n oldKeyToIndexMap = generateMap(oldKeys, oldHead, oldTail);\n }\n if (!newKeyToIndexMap.has(oldKeys[oldHead])) {\n // Old head is no longer in new list; remove\n removePart(oldParts[oldHead]!);\n oldHead++;\n } else if (!newKeyToIndexMap.has(oldKeys[oldTail])) {\n // Old tail is no longer in new list; remove\n removePart(oldParts[oldTail]!);\n oldTail--;\n } else {\n // Any mismatches at this point are due to additions or\n // moves; see if we have an old part we can reuse and move\n // into place\n const oldIndex = oldKeyToIndexMap.get(newKeys[newHead]);\n const oldPart = oldIndex !== undefined ? oldParts[oldIndex] : null;\n if (oldPart === null) {\n // No old part for this value; create a new one and\n // insert it\n const newPart = insertPart(containerPart, oldParts[oldHead]!);\n setChildPartValue(newPart, newValues[newHead]);\n newParts[newHead] = newPart;\n } else {\n // Reuse old part\n newParts[newHead] = setChildPartValue(oldPart, newValues[newHead]);\n insertPart(containerPart, oldParts[oldHead]!, oldPart);\n // This marks the old part as having been used, so that\n // it will be skipped in the first two checks above\n oldParts[oldIndex as number] = null;\n }\n newHead++;\n }\n }\n }\n // Add parts for any remaining new values\n while (newHead <= newTail) {\n // For all remaining additions, we insert before last new\n // tail, since old pointers are no longer valid\n const newPart = insertPart(containerPart, newParts[newTail + 1]);\n setChildPartValue(newPart, newValues[newHead]);\n newParts[newHead++] = newPart;\n }\n // Remove any remaining unused old parts\n while (oldHead <= oldTail) {\n const oldPart = oldParts[oldHead++];\n if (oldPart !== null) {\n removePart(oldPart);\n }\n }\n\n // Save order of new parts for next round\n this._itemKeys = newKeys;\n // Directly set part value, bypassing it's dirty-checking\n setCommittedValue(containerPart, newParts);\n return noChange;\n }\n}\n\nexport interface RepeatDirectiveFn {\n <T>(\n items: Iterable<T>,\n keyFnOrTemplate: KeyFn<T> | ItemTemplate<T>,\n template?: ItemTemplate<T>\n ): unknown;\n <T>(items: Iterable<T>, template: ItemTemplate<T>): unknown;\n <T>(\n items: Iterable<T>,\n keyFn: KeyFn<T> | ItemTemplate<T>,\n template: ItemTemplate<T>\n ): unknown;\n}\n\n/**\n * A directive that repeats a series of values (usually `TemplateResults`)\n * generated from an iterable, and updates those items efficiently when the\n * iterable changes based on user-provided `keys` associated with each item.\n *\n * Note that if a `keyFn` is provided, strict key-to-DOM mapping is maintained,\n * meaning previous DOM for a given key is moved into the new position if\n * needed, and DOM will never be reused with values for different keys (new DOM\n * will always be created for new keys). This is generally the most efficient\n * way to use `repeat` since it performs minimum unnecessary work for insertions\n * and removals.\n *\n * The `keyFn` takes two parameters, the item and its index, and returns a unique key value.\n *\n * ```js\n * html`\n * <ol>\n * ${repeat(this.items, (item) => item.id, (item, index) => {\n * return html`<li>${index}: ${item.name}</li>`;\n * })}\n * </ol>\n * `\n * ```\n *\n * **Important**: If providing a `keyFn`, keys *must* be unique for all items in a\n * given call to `repeat`. The behavior when two or more items have the same key\n * is undefined.\n *\n * If no `keyFn` is provided, this directive will perform similar to mapping\n * items to values, and DOM will be reused against potentially different items.\n */\nexport const repeat = directive(RepeatDirective) as RepeatDirectiveFn;\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {RepeatDirective};\n", "/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {AttributePart, noChange} from '../lit-html.js';\nimport {\n directive,\n Directive,\n DirectiveParameters,\n PartInfo,\n PartType,\n} from '../directive.js';\n\n/**\n * A key-value set of CSS properties and values.\n *\n * The key should be either a valid CSS property name string, like\n * `'background-color'`, or a valid JavaScript camel case property name\n * for CSSStyleDeclaration like `backgroundColor`.\n */\nexport interface StyleInfo {\n [name: string]: string | undefined | null;\n}\n\nclass StyleMapDirective extends Directive {\n _previousStyleProperties?: Set<string>;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (\n partInfo.type !== PartType.ATTRIBUTE ||\n partInfo.name !== 'style' ||\n (partInfo.strings?.length as number) > 2\n ) {\n throw new Error(\n 'The `styleMap` directive must be used in the `style` attribute ' +\n 'and must be the only part in the attribute.'\n );\n }\n }\n\n render(styleInfo: Readonly<StyleInfo>) {\n return Object.keys(styleInfo).reduce((style, prop) => {\n const value = styleInfo[prop];\n if (value == null) {\n return style;\n }\n // Convert property names from camel-case to dash-case, i.e.:\n // `backgroundColor` -> `background-color`\n // Vendor-prefixed names need an extra `-` appended to front:\n // `webkitAppearance` -> `-webkit-appearance`\n // Exception is any property name containing a dash, including\n // custom properties; we assume these are already dash-cased i.e.:\n // `--my-button-color` --> `--my-button-color`\n prop = prop\n .replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, '-$&')\n .toLowerCase();\n return style + `${prop}:${value};`;\n }, '');\n }\n\n override update(part: AttributePart, [styleInfo]: DirectiveParameters<this>) {\n const {style} = part.element as HTMLElement;\n\n if (this._previousStyleProperties === undefined) {\n this._previousStyleProperties = new Set();\n for (const name in styleInfo) {\n this._previousStyleProperties.add(name);\n }\n return this.render(styleInfo);\n }\n\n // Remove old properties that no longer exist in styleInfo\n // We use forEach() instead of for-of so that re don't require down-level\n // iteration.\n this._previousStyleProperties!.forEach((name) => {\n // If the name isn't in styleInfo or it's null/undefined\n if (styleInfo[name] == null) {\n this._previousStyleProperties!.delete(name);\n if (name.includes('-')) {\n style.removeProperty(name);\n } else {\n // Note reset using empty string (vs null) as IE11 does not always\n // reset via null (https://developer.mozilla.org/en-US/docs/Web/API/ElementCSSInlineStyle/style#setting_styles)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (style as any)[name] = '';\n }\n }\n });\n\n // Add or update properties\n for (const name in styleInfo) {\n const value = styleInfo[name];\n if (value != null) {\n this._previousStyleProperties.add(name);\n if (name.includes('-')) {\n style.setProperty(name, value);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (style as any)[name] = value;\n }\n }\n }\n return noChange;\n }\n}\n\n/**\n * A directive that applies CSS properties to an element.\n *\n * `styleMap` can only be used in the `style` attribute and must be the only\n * expression in the attribute. It takes the property names in the\n * {@link StyleInfo styleInfo} object and adds the property values as CSS\n * properties. Property names with dashes (`-`) are assumed to be valid CSS\n * property names and set on the element's style object using `setProperty()`.\n * Names without dashes are assumed to be camelCased JavaScript property names\n * and set on the element's style object using property assignment, allowing the\n * style object to translate JavaScript-style names to CSS property names.\n *\n * For example `styleMap({backgroundColor: 'red', 'border-top': '5px', '--size':\n * '0'})` sets the `background-color`, `border-top` and `--size` properties.\n *\n * @param styleInfo\n * @see {@link https://lit.dev/docs/templates/directives/#stylemap styleMap code samples on Lit.dev}\n */\nexport const styleMap = directive(StyleMapDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {StyleMapDirective};\n", "/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {noChange} from '../lit-html.js';\nimport {directive, Directive, PartInfo, PartType} from '../directive.js';\n\nclass TemplateContentDirective extends Directive {\n private _previousTemplate?: HTMLTemplateElement;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.CHILD) {\n throw new Error('templateContent can only be used in child bindings');\n }\n }\n\n render(template: HTMLTemplateElement) {\n if (this._previousTemplate === template) {\n return noChange;\n }\n this._previousTemplate = template;\n return document.importNode(template.content, true);\n }\n}\n\n/**\n * Renders the content of a template element as HTML.\n *\n * Note, the template should be developer controlled and not user controlled.\n * Rendering a user-controlled template with this directive\n * could lead to cross-site-scripting vulnerabilities.\n */\nexport const templateContent = directive(TemplateContentDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {TemplateContentDirective};\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {nothing, TemplateResult, noChange} from '../lit-html.js';\nimport {directive, Directive, PartInfo, PartType} from '../directive.js';\n\nconst HTML_RESULT = 1;\n\nexport class UnsafeHTMLDirective extends Directive {\n static directiveName = 'unsafeHTML';\n static resultType = HTML_RESULT;\n\n private _value: unknown = nothing;\n private _templateResult?: TemplateResult;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.CHILD) {\n throw new Error(\n `${\n (this.constructor as typeof UnsafeHTMLDirective).directiveName\n }() can only be used in child bindings`\n );\n }\n }\n\n render(value: string | typeof nothing | typeof noChange | undefined | null) {\n if (value === nothing || value == null) {\n this._templateResult = undefined;\n return (this._value = value);\n }\n if (value === noChange) {\n return value;\n }\n if (typeof value != 'string') {\n throw new Error(\n `${\n (this.constructor as typeof UnsafeHTMLDirective).directiveName\n }() called with a non-string value`\n );\n }\n if (value === this._value) {\n return this._templateResult;\n }\n this._value = value;\n const strings = [value] as unknown as TemplateStringsArray;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (strings as any).raw = strings;\n // WARNING: impersonating a TemplateResult like this is extremely\n // dangerous. Third-party directives should not do this.\n return (this._templateResult = {\n // Cast to a known set of integers that satisfy ResultType so that we\n // don't have to export ResultType and possibly encourage this pattern.\n // This property needs to remain unminified.\n ['_$litType$']: (this.constructor as typeof UnsafeHTMLDirective)\n .resultType as 1 | 2,\n strings,\n values: [],\n });\n }\n}\n\n/**\n * Renders the result as HTML, rather than text.\n *\n * The values `undefined`, `null`, and `nothing`, will all result in no content\n * (empty string) being rendered.\n *\n * Note, this is unsafe to use with any user-provided input that hasn't been\n * sanitized or escaped, as it may lead to cross-site-scripting\n * vulnerabilities.\n */\nexport const unsafeHTML = directive(UnsafeHTMLDirective);\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {directive} from '../directive.js';\nimport {UnsafeHTMLDirective} from './unsafe-html.js';\n\nconst SVG_RESULT = 2;\n\nclass UnsafeSVGDirective extends UnsafeHTMLDirective {\n static override directiveName = 'unsafeSVG';\n static override resultType = SVG_RESULT;\n}\n\n/**\n * Renders the result as SVG, rather than text.\n *\n * The values `undefined`, `null`, and `nothing`, will all result in no content\n * (empty string) being rendered.\n *\n * Note, this is unsafe to use with any user-provided input that hasn't been\n * sanitized or escaped, as it may lead to cross-site-scripting\n * vulnerabilities.\n */\nexport const unsafeSVG = directive(UnsafeSVGDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {UnsafeSVGDirective};\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {Part, noChange} from '../lit-html.js';\nimport {isPrimitive} from '../directive-helpers.js';\nimport {directive, AsyncDirective} from '../async-directive.js';\nimport {Pauser, PseudoWeakRef} from './private-async-helpers.js';\n\nconst isPromise = (x: unknown) => {\n return !isPrimitive(x) && typeof (x as {then?: unknown}).then === 'function';\n};\n// Effectively infinity, but a SMI.\nconst _infinity = 0x3fffffff;\n\nexport class UntilDirective extends AsyncDirective {\n private __lastRenderedIndex: number = _infinity;\n private __values: unknown[] = [];\n private __weakThis = new PseudoWeakRef(this);\n private __pauser = new Pauser();\n\n render(...args: Array<unknown>) {\n return args.find((x) => !isPromise(x)) ?? noChange;\n }\n\n override update(_part: Part, args: Array<unknown>) {\n const previousValues = this.__values;\n let previousLength = previousValues.length;\n this.__values = args;\n\n const weakThis = this.__weakThis;\n const pauser = this.__pauser;\n\n // If our initial render occurs while disconnected, ensure that the pauser\n // and weakThis are in the disconnected state\n if (!this.isConnected) {\n this.disconnected();\n }\n\n for (let i = 0; i < args.length; i++) {\n // If we've rendered a higher-priority value already, stop.\n if (i > this.__lastRenderedIndex) {\n break;\n }\n\n const value = args[i];\n\n // Render non-Promise values immediately\n if (!isPromise(value)) {\n this.__lastRenderedIndex = i;\n // Since a lower-priority value will never overwrite a higher-priority\n // synchronous value, we can stop processing now.\n return value;\n }\n\n // If this is a Promise we've already handled, skip it.\n if (i < previousLength && value === previousValues[i]) {\n continue;\n }\n\n // We have a Promise that we haven't seen before, so priorities may have\n // changed. Forget what we rendered before.\n this.__lastRenderedIndex = _infinity;\n previousLength = 0;\n\n // Note, the callback avoids closing over `this` so that the directive\n // can be gc'ed before the promise resolves; instead `this` is retrieved\n // from `weakThis`, which can break the hard reference in the closure when\n // the directive disconnects\n Promise.resolve(value).then(async (result: unknown) => {\n // If we're disconnected, wait until we're (maybe) reconnected\n // The while loop here handles the case that the connection state\n // thrashes, causing the pauser to resume and then get re-paused\n while (pauser.get()) {\n await pauser.get();\n }\n // If the callback gets here and there is no `this`, it means that the\n // directive has been disconnected and garbage collected and we don't\n // need to do anything else\n const _this = weakThis.deref();\n if (_this !== undefined) {\n const index = _this.__values.indexOf(value);\n // If state.values doesn't contain the value, we've re-rendered without\n // the value, so don't render it. Then, only render if the value is\n // higher-priority than what's already been rendered.\n if (index > -1 && index < _this.__lastRenderedIndex) {\n _this.__lastRenderedIndex = index;\n _this.setValue(result);\n }\n }\n });\n }\n\n return noChange;\n }\n\n override disconnected() {\n this.__weakThis.disconnect();\n this.__pauser.pause();\n }\n\n override reconnected() {\n this.__weakThis.reconnect(this);\n this.__pauser.resume();\n }\n}\n\n/**\n * Renders one of a series of values, including Promises, to a Part.\n *\n * Values are rendered in priority order, with the first argument having the\n * highest priority and the last argument having the lowest priority. If a\n * value is a Promise, low-priority values will be rendered until it resolves.\n *\n * The priority of values can be used to create placeholder content for async\n * data. For example, a Promise with pending content can be the first,\n * highest-priority, argument, and a non_promise loading indicator template can\n * be used as the second, lower-priority, argument. The loading indicator will\n * render immediately, and the primary content will render when the Promise\n * resolves.\n *\n * Example:\n *\n * ```js\n * const content = fetch('./content.txt').then(r => r.text());\n * html`${until(content, html`<span>Loading...</span>`)}`\n * ```\n */\nexport const until = directive(UntilDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\n// export type {UntilDirective};\n", "/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Chooses and evaluates a template function from a list based on matching\n * the given `value` to a case.\n *\n * Cases are structured as `[caseValue, func]`. `value` is matched to\n * `caseValue` by strict equality. The first match is selected. Case values\n * can be of any type including primitives, objects, and symbols.\n *\n * This is similar to a switch statement, but as an expression and without\n * fallthrough.\n *\n * @example\n *\n * ```ts\n * render() {\n * return html`\n * ${choose(this.section, [\n * ['home', () => html`<h1>Home</h1>`],\n * ['about', () => html`<h1>About</h1>`]\n * ],\n * () => html`<h1>Error</h1>`)}\n * `;\n * }\n * ```\n */\nexport const choose = <T, V>(\n value: T,\n cases: Array<[T, () => V]>,\n defaultCase?: () => V\n) => {\n for (const c of cases) {\n const caseValue = c[0];\n if (caseValue === value) {\n const fn = c[1];\n return fn();\n }\n }\n return defaultCase?.();\n};\n", "/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Returns an iterable containing the values in `items` interleaved with the\n * `joiner` value.\n *\n * @example\n *\n * ```ts\n * render() {\n * return html`\n * ${join(items, html`<span class=\"separator\">|</span>`)}\n * `;\n * }\n */\nexport function join<I, J>(\n items: Iterable<I> | undefined,\n joiner: (index: number) => J\n): Iterable<I | J>;\nexport function join<I, J>(\n items: Iterable<I> | undefined,\n joiner: J\n): Iterable<I | J>;\nexport function* join<I, J>(items: Iterable<I> | undefined, joiner: J) {\n const isFunction = typeof joiner === 'function';\n if (items !== undefined) {\n let i = -1;\n for (const value of items) {\n if (i > -1) {\n yield isFunction ? joiner(i) : joiner;\n }\n i++;\n yield value;\n }\n }\n}\n", "/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {nothing} from '../lit-html.js';\nimport {\n directive,\n Directive,\n ChildPart,\n DirectiveParameters,\n} from '../directive.js';\nimport {setCommittedValue} from '../directive-helpers.js';\n\nclass Keyed extends Directive {\n key: unknown = nothing;\n\n render(k: unknown, v: unknown) {\n this.key = k;\n return v;\n }\n\n override update(part: ChildPart, [k, v]: DirectiveParameters<this>) {\n if (k !== this.key) {\n // Clear the part before returning a value. The one-arg form of\n // setCommittedValue sets the value to a sentinel which forces a\n // commit the next render.\n setCommittedValue(part);\n this.key = k;\n }\n return v;\n }\n}\n\n/**\n * Associates a renderable value with a unique key. When the key changes, the\n * previous DOM is removed and disposed before rendering the next value, even\n * if the value - such as a template - is the same.\n *\n * This is useful for forcing re-renders of stateful components, or working\n * with code that expects new data to generate new HTML elements, such as some\n * animation techniques.\n */\nexport const keyed = directive(Keyed);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {Keyed};\n", "/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Returns an iterable containing the result of calling `f(value)` on each\n * value in `items`.\n *\n * @example\n *\n * ```ts\n * render() {\n * return html`\n * <ul>\n * ${map(items, (i) => html`<li>${i}</li>`)}\n * </ul>\n * `;\n * }\n * ```\n */\nexport function* map<T>(\n items: Iterable<T> | undefined,\n f: (value: T, index: number) => unknown\n) {\n if (items !== undefined) {\n let i = 0;\n for (const value of items) {\n yield f(value, i++);\n }\n }\n}\n", "/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Returns an iterable of integers from `start` to `end` (exclusive)\n * incrementing by `step`.\n *\n * If `start` is omitted, the range starts at `0`. `step` defaults to `1`.\n *\n * @example\n *\n * ```ts\n * render() {\n * return html`\n * ${map(range(8), () => html`<div class=\"cell\"></div>`)}\n * `;\n * }\n * ```\n */\nexport function range(end: number): Iterable<number>;\nexport function range(\n start: number,\n end: number,\n step?: number\n): Iterable<number>;\nexport function* range(startOrEnd: number, end?: number, step = 1) {\n const start = end === undefined ? 0 : startOrEnd;\n end ??= startOrEnd;\n for (let i = start; step > 0 ? i < end : end < i; i += step) {\n yield i;\n }\n}\n", "/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * When `condition` is true, returns the result of calling `trueCase()`, else\n * returns the result of calling `falseCase()` if `falseCase` is defined.\n *\n * This is a convenience wrapper around a ternary expression that makes it a\n * little nicer to write an inline conditional without an else.\n *\n * @example\n *\n * ```ts\n * render() {\n * return html`\n * ${when(this.user, () => html`User: ${this.user.username}`, () => html`Sign In...`)}\n * `;\n * }\n * ```\n */\nexport function when<T, F>(\n condition: true,\n trueCase: () => T,\n falseCase?: () => F\n): T;\nexport function when<T, F = undefined>(\n condition: false,\n trueCase: () => T,\n falseCase?: () => F\n): F;\nexport function when<T, F = undefined>(\n condition: unknown,\n trueCase: () => T,\n falseCase?: () => F\n): T | F;\nexport function when(\n condition: unknown,\n trueCase: () => unknown,\n falseCase?: () => unknown\n): unknown {\n return condition ? trueCase() : falseCase?.();\n}\n", "\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__exportStar(require(\"./decorators/index\"), exports);\n__exportStar(require(\"./async\"), exports);\n__exportStar(require(\"lit-html\"), exports);\n__exportStar(require(\"lit-html/directive\"), exports);\n__exportStar(require(\"lit-html/experimental-hydrate\"), exports);\n__exportStar(require(\"lit-element/experimental-hydrate-support\"), exports);\n__exportStar(require(\"lit-html/polyfill-support\"), exports);\n__exportStar(require(\"lit-html/directive-helpers\"), exports);\n__exportStar(require(\"lit-html/async-directive\"), exports);\n__exportStar(require(\"lit-element\"), exports);\n__exportStar(require(\"lit-html/directives/class-map\"), exports);\n__exportStar(require(\"lit-html/directives/async-append\"), exports);\n__exportStar(require(\"lit-html/directives/async-replace\"), exports);\n__exportStar(require(\"lit-html/directives/cache\"), exports);\n__exportStar(require(\"lit-html/directives/guard\"), exports);\n__exportStar(require(\"lit-html/directives/if-defined\"), exports);\n__exportStar(require(\"lit-html/directives/live\"), exports);\n__exportStar(require(\"lit-html/directives/ref\"), exports);\n__exportStar(require(\"lit-html/directives/repeat\"), exports);\n__exportStar(require(\"lit-html/directives/style-map\"), exports);\n__exportStar(require(\"lit-html/directives/template-content\"), exports);\n__exportStar(require(\"lit-html/directives/unsafe-html\"), exports);\n__exportStar(require(\"lit-html/directives/unsafe-svg\"), exports);\n__exportStar(require(\"lit-html/directives/until\"), exports);\n__exportStar(require(\"lit-html/directives/choose\"), exports);\n__exportStar(require(\"lit-html/directives/join\"), exports);\n__exportStar(require(\"lit-html/directives/keyed\"), exports);\n__exportStar(require(\"lit-html/directives/map\"), exports);\n__exportStar(require(\"lit-html/directives/range\"), exports);\n__exportStar(require(\"lit-html/directives/when\"), exports);\n", null, null, "import '@rhtml/renderer';\n\nimport {\n Component as OriginalComponent,\n CustomElementConfig,\n html,\n LitElement,\n TemplateResult,\n} from '@rxdi/lit-html';\nimport { Observable } from 'rxjs';\n\nexport type Without<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;\n\nexport type Injection = {\n has: <T>(d: T) => boolean;\n get: <T>(d: T) => T;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type Constructor<T = any> = new (...args: any[]) => T;\n\nexport type InstanceTypes<T> = {\n [P in keyof T]: T[P] extends Constructor<infer U> ? U : never;\n};\n\nexport const DefineDependencies =\n <T extends Constructor[]>(...deps: T) =>\n (injection: Injection): InstanceTypes<T> => {\n for (const [index, dep] of deps.entries()) {\n Object.defineProperty(deps, index, {\n get: () => (injection?.has(dep) ? injection.get(dep) : dep),\n });\n }\n return deps as never;\n };\n\nexport type StateToRender<S, D, K extends LitElement> = (\n this: K,\n deps: D\n) => Observable<S> | S | Promise<S>;\n\nexport type PossibleRender = TemplateResult | string | number | unknown;\n\nexport type RenderResult<S, D, K extends LitElement> = (\n deps: D\n) => (\n this: K,\n state: S,\n setState: (s: S) => void\n) => TemplateResult | string | number | unknown;\n\nexport interface Options\n extends Without<CustomElementConfig<never>, 'template'> {\n deepCloneState?: boolean;\n}\n\nexport interface OnRendererLoaded {\n OnRendererLoaded(): void;\n}\n\n/**\n * This method waits for the parent component to finish loading and then triggers event\n * OnRendererLoaded is a specially designed hook to wait for the last dom rerender\n * before calling the callback\n */\nasync function waitBeforeTrigger(this: LitElement & OnRendererLoaded) {\n await this.updateComplete;\n await new Promise(requestAnimationFrame);\n this.OnRendererLoaded?.call(this);\n}\n\nexport const Partial =\n <S, D, K extends LitElement = LitElement>(options: Options) =>\n (deps: D = [] as never) =>\n (state: StateToRender<S, D, K> = () => ({} as never)) =>\n (loading: (this: K) => PossibleRender = () => null) =>\n (error: (this: K, e: Error) => PossibleRender = () => null) =>\n (render: RenderResult<S, D, K> = () => state as never) =>\n OriginalComponent<K>({\n ...options,\n template(this: K) {\n return html`\n <r-renderer\n style=\"display: contents;\"\n @loaded=${waitBeforeTrigger.bind(this)}\n .options=${{\n state: state.bind(this).call(this, deps),\n loading: loading.bind(this),\n style: options.style,\n styles: options.styles,\n error: error.bind(this),\n deepCloneState: options.deepCloneState,\n render: (\n state: S,\n setState: (s: S) => void,\n shadowRoot: ShadowRoot\n ) => {\n this.shadowRoot.append(shadowRoot);\n return render(deps)\n .bind(this)\n .call(this, state, setState, shadowRoot);\n },\n }}\n ></r-renderer>\n `;\n },\n });\n\nexport function Component<S, D, K extends LitElement = LitElement>({\n Settings,\n Providers,\n State,\n Render,\n Loading,\n Error,\n}: {\n Settings: Options;\n Providers?: D;\n State?: StateToRender<S, D, K>;\n Render?: RenderResult<S, D, K>;\n Loading?: () => PossibleRender;\n Error?: (e: Error | unknown) => PossibleRender;\n}) {\n return Partial(Settings)(Providers)(State)(Loading)(Error)(Render);\n}\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FlattenOperator = void 0;\nvar FlattenOperator;\n(function (FlattenOperator) {\n FlattenOperator[\"switchMap\"] = \"switchMap\";\n FlattenOperator[\"mergeMap\"] = \"mergeMap\";\n FlattenOperator[\"concatMap\"] = \"concatMap\";\n FlattenOperator[\"exhaustMap\"] = \"exhaustMap\";\n})(FlattenOperator || (exports.FlattenOperator = FlattenOperator = {}));\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.mapToObservable = exports.flatCatch = exports.catchErr = exports.compose = exports.hasType = exports.isObject = void 0;\nexports.combineReducers = combineReducers;\nconst rxjs_1 = require(\"rxjs\");\nconst operators_1 = require(\"rxjs/operators\");\nconst isObject = (value) => value !== null && typeof value === 'object';\nexports.isObject = isObject;\nconst hasType = (action) => typeof action.type === 'string';\nexports.hasType = hasType;\nconst compose = (fns) => fns.reduce((f, g) => (...args) => f(g(...args)));\nexports.compose = compose;\nexports.catchErr = (0, rxjs_1.pipe)((0, operators_1.catchError)((e) => (0, rxjs_1.of)(e)));\nconst flatCatch = (o) => o.pipe(exports.catchErr);\nexports.flatCatch = flatCatch;\nconst mapToObservable = (value) => {\n if ((0, rxjs_1.isObservable)(value))\n return value;\n if (value instanceof Promise)\n return (0, rxjs_1.from)(value);\n return (0, rxjs_1.of)(value);\n};\nexports.mapToObservable = mapToObservable;\nfunction combineReducers(reducers) {\n return (state = {}, action) => {\n const { hasChanged, nextState } = Object.entries(reducers).reduce(({ hasChanged, nextState }, [key, reducer]) => {\n const prev = state[key];\n const next = reducer(prev, action);\n return {\n hasChanged: hasChanged || next !== prev,\n nextState: Object.assign(Object.assign({}, nextState), { [key]: next }),\n };\n }, { hasChanged: false, nextState: {} });\n return hasChanged ? nextState : state;\n };\n}\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.reducerFactory$ = reducerFactory$;\nconst operators_1 = require(\"rxjs/operators\");\nconst utils_1 = require(\"./utils\");\nfunction reducerFactory$([initialState, reducer, middleware,]) {\n function _reducer(state, action) {\n return middleware.length > 0\n ? (0, utils_1.compose)(middleware)(reducer)(state, action)\n : reducer(state, action);\n }\n return (0, operators_1.scan)(_reducer, initialState);\n}\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getDefaults = getDefaults;\nconst rxjs_1 = require(\"rxjs\");\nconst interfaces_1 = require(\"./interfaces\");\nconst utils_1 = require(\"./utils\");\nconst operators_1 = require(\"rxjs/operators\");\nconst fop = {\n switchMap: operators_1.switchMap,\n mergeMap: operators_1.mergeMap,\n concatMap: operators_1.concatMap,\n exhaustMap: operators_1.exhaustMap,\n};\nfunction getDefaults(config = {}, options = {}, dispatchSubject) {\n var _a;\n const reducer$ = (config && config.reducer$ && config.reducer$.pipe(utils_1.catchErr)) ||\n (0, rxjs_1.of)((state, action) => state);\n const actions$ = new rxjs_1.Subject();\n const actionStream$ = reducer$ => (0, rxjs_1.merge)((config && config.actionStream$ && config.actionStream$.pipe(utils_1.catchErr)) || rxjs_1.EMPTY, dispatchSubject).pipe((0, operators_1.filter)(utils_1.isObject), (0, operators_1.map)(utils_1.mapToObservable), actionFlatten(utils_1.flatCatch), (0, operators_1.tap)(actions$), reducer$, (0, operators_1.map)(utils_1.mapToObservable));\n const initialState$ = ((config && config.initialState$ && config.initialState$.pipe(utils_1.catchErr)) ||\n (0, rxjs_1.of)({})).pipe((0, operators_1.share)());\n const middleware$ = (config && config.middleware$ && config.middleware$.pipe(utils_1.catchErr)) ||\n (0, rxjs_1.of)([]);\n const destroy$ = ((_a = config === null || config === void 0 ? void 0 : config.destroy$) === null || _a === void 0 ? void 0 : _a.pipe(utils_1.catchErr)) || rxjs_1.NEVER;\n const actionFlatten = fop[(options && options.actionFlatOp) || interfaces_1.FlattenOperator.concatMap];\n const stateFlatten = fop[(options && options.stateFlatOp) || interfaces_1.FlattenOperator.switchMap];\n const flattenState$ = (source) => source.pipe(stateFlatten(utils_1.flatCatch), (0, operators_1.map)(utils_1.mapToObservable), stateFlatten(utils_1.flatCatch));\n const bufferSize = (options && options.bufferSize) || 1;\n const windowTime = options && options.windowTime;\n const shareReplayConfig = {\n refCount: false,\n bufferSize,\n windowTime,\n };\n return {\n reducer$,\n actions$,\n actionStream$,\n initialState$,\n middleware$,\n destroy$,\n flattenState$,\n shareReplayConfig,\n };\n}\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DEVTOOLS_JUMP_TO_STATE = void 0;\nexports.normalizeDevToolsConfig = normalizeDevToolsConfig;\nexports.withDevToolsTimeTravel = withDevToolsTimeTravel;\nexports.connectReduxDevTools = connectReduxDevTools;\nconst rxjs_1 = require(\"rxjs\");\nconst operators_1 = require(\"rxjs/operators\");\n/**\n * Bridge between a Store and the Redux DevTools browser extension.\n *\n * The extension's `connect()` API is store-agnostic: any state container can\n * push `(action, resulting state)` pairs to it. We derive those pairs from\n * the store's public streams \u2014 `actions$` emits the action right before the\n * reducer runs, and `state$` emits the state produced by it, so\n * `state$.pipe(withLatestFrom(actions$))` yields each action next to the\n * state it created.\n *\n * Time travel (jumping to a previous action/state in the DevTools UI) works\n * by dispatching an internal action carrying the target state, honored by a\n * reducer wrapped with {@link withDevToolsTimeTravel}. The `devTools` option\n * on `createStore` applies the wrapper automatically.\n */\n/** Internal action type used to apply a state chosen in the DevTools UI. */\nexports.DEVTOOLS_JUMP_TO_STATE = '@@redux-devtools/JUMP_TO_STATE';\n/** Resolve the toggle union to options-or-off. */\nfunction normalizeDevToolsConfig(config) {\n if (!config) {\n return undefined;\n }\n const options = config === true ? {} : config;\n return options.enabled === false ? undefined : options;\n}\n/**\n * Wraps a reducer so the bridge can force the state to a snapshot chosen in\n * the DevTools UI (time travel). Applied automatically when the store is\n * created with the `devTools` config option.\n */\nfunction withDevToolsTimeTravel(reducerFn) {\n return (state, action) => (action === null || action === void 0 ? void 0 : action.type) === exports.DEVTOOLS_JUMP_TO_STATE\n ? action.state\n : reducerFn(state, action);\n}\n/**\n * Streams every dispatched action and the state it produced to the Redux\n * DevTools extension. No-op when disabled or when the extension is absent\n * (including non-browser environments).\n *\n * Standalone variant \u2014 prefer the `devTools` option on `createStore`, which\n * also wraps the reducer for time travel and tears down on `destroy$`.\n * When using this directly, connect before dispatching any action and wrap\n * your reducer with {@link withDevToolsTimeTravel} if you want time travel.\n *\n * @returns teardown function that disconnects from the extension.\n */\nfunction connectReduxDevTools(store, options = {}) {\n var _a, _b;\n const extension = globalThis.__REDUX_DEVTOOLS_EXTENSION__;\n if (options.enabled === false || !extension) {\n return () => undefined;\n }\n const devTools = extension.connect(Object.assign({ name: (_a = options.name) !== null && _a !== void 0 ? _a : 'RxDI Store', maxAge: (_b = options.maxAge) !== null && _b !== void 0 ? _b : 50 }, options.extensionOptions));\n const subscription = new rxjs_1.Subscription();\n // state$ replays its latest value synchronously on subscribe, so\n // currentState is populated before init() below.\n let currentState;\n subscription.add(store.state$.subscribe(state => {\n currentState = state;\n }));\n devTools.init(currentState);\n subscription.add(store.state$\n .pipe((0, operators_1.withLatestFrom)(store.actions$), \n // Jumps come from the DevTools UI \u2014 echoing them back would\n // pollute the action log.\n (0, operators_1.filter)(([, action]) => action.type !== exports.DEVTOOLS_JUMP_TO_STATE))\n .subscribe(([state, action]) => devTools.send(action, state)));\n const unsubscribeMessages = devTools.subscribe(message => {\n var _a;\n if (message.type !== 'DISPATCH') {\n return;\n }\n const kind = (_a = message.payload) === null || _a === void 0 ? void 0 : _a.type;\n if ((kind === 'JUMP_TO_ACTION' || kind === 'JUMP_TO_STATE') &&\n message.state) {\n store.dispatch({\n type: exports.DEVTOOLS_JUMP_TO_STATE,\n state: JSON.parse(message.state),\n });\n }\n else if (kind === 'COMMIT') {\n devTools.init(currentState);\n }\n });\n return () => {\n var _a;\n subscription.unsubscribe();\n if (typeof unsubscribeMessages === 'function') {\n unsubscribeMessages();\n }\n (_a = devTools.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(devTools);\n };\n}\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Store = void 0;\nexports.createStore = createStore;\nconst rxjs_1 = require(\"rxjs\");\nconst operators_1 = require(\"rxjs/operators\");\nconst reducer_factory_1 = require(\"./reducer.factory\");\nconst defaults_1 = require(\"./defaults\");\nconst devtools_1 = require(\"./devtools\");\n/**\n * Reactive state container based on RxJS (https://rxjs.dev/)\n *\n * @class AsyncStore<State, ActionsUnion>\n *\n * @type State - application state interface\n * @type ActionsUnion - type union of all the actions\n */\nclass Store {\n /**\n * Default configuration\n *\n * @param {Object} config\n * {\n * reducer$: of(reducer({})),\n * actionStream$: EMPTY, // if not defined, no actions will be dispatched in the store\n * initialState$: of({}),\n * middleware$: of([]),\n * destroy$: NEVER // if not defined, the state subscription will live forever\n * }\n *\n * @param {Object} options\n * {\n * actionFop: FlattenOps.concatMap, // Flatten operator for actions's stream.\n * stateFop: FlattenOps.switchMap // Flatten operator for state's stream.\n * windowTime: undefined //Maximum time length of the replay buffer in milliseconds.\n * bufferSize: 1 //Maximum element count of the replay buffer.\n * }\n */\n constructor(config, options) {\n var _a, _b, _c, _d;\n this.config = config;\n this.options = options;\n this._dispatch$ = new rxjs_1.Subject();\n this.dispatch = (action) => {\n this._dispatch$.next(action);\n };\n // Wrap the reducer before getDefaults consumes it, so DevTools\n // time-travel jumps are honored even with the default identity reducer.\n const devToolsOptions = (0, devtools_1.normalizeDevToolsConfig)((_a = this.config) === null || _a === void 0 ? void 0 : _a.devTools);\n if (devToolsOptions) {\n this.config = Object.assign(Object.assign({}, this.config), { reducer$: ((_c = (_b = this.config) === null || _b === void 0 ? void 0 : _b.reducer$) !== null && _c !== void 0 ? _c : (0, rxjs_1.of)(state => state)).pipe((0, operators_1.map)(reducerFn => (0, devtools_1.withDevToolsTimeTravel)(reducerFn))) });\n }\n const { reducer$, actions$, actionStream$, middleware$, initialState$, destroy$, flattenState$, shareReplayConfig } = (0, defaults_1.getDefaults)(this.config, this.options, this._dispatch$);\n this.state$ = (0, rxjs_1.combineLatest)([initialState$, reducer$, middleware$]).pipe((0, operators_1.map)(reducer_factory_1.reducerFactory$), (0, operators_1.concatMap)(actionStream$), (0, operators_1.startWith)(initialState$), flattenState$, (0, operators_1.takeUntil)(destroy$), (0, operators_1.shareReplay)(shareReplayConfig));\n this.state$.subscribe();\n this.actions$ = actions$.pipe((0, operators_1.shareReplay)(shareReplayConfig));\n // Wire up epic$ if provided\n if ((_d = this.config) === null || _d === void 0 ? void 0 : _d.epic$) {\n this.config\n .epic$(this.actions$, this.state$)\n .pipe((0, operators_1.takeUntil)(destroy$))\n .subscribe({\n next: (action) => this.dispatch(action),\n error: (err) => console.error('[Epic] Error:', err),\n });\n }\n if (devToolsOptions) {\n const disconnect = (0, devtools_1.connectReduxDevTools)(this, devToolsOptions);\n // Mirror takeUntil(destroy$): the first emission tears the store down.\n destroy$.subscribe(() => disconnect());\n }\n }\n}\nexports.Store = Store;\nfunction createStore(config = {}, opts = {}) {\n return new Store(config, opts);\n}\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.reduceA = exports.reduceNS = exports.reducePS = exports.filterA = exports.filterNS = exports.filterPS = exports.mapA = exports.mapNS = exports.mapPS = void 0;\n/**\n *\n * @param mapFn - a function to map a state with\n * @returns {MiddlewareFn} MiddlewareFn<State>\n *\n * PS - previous state\n * NS - next state\n */\nconst mapPS = (mapFn) => (reducer) => (state, Action) => reducer(mapFn(state), Action);\nexports.mapPS = mapPS;\nconst mapNS = (mapFn) => (reducer) => (state, Action) => mapFn(reducer(state, Action));\nexports.mapNS = mapNS;\n/**\n *\n * @param mapFn - a function to map an Action with\n * @returns {MiddlewareFn} MiddlewareFn<State, IActionsUnion>\n */\nconst mapA = (mapFn) => (reducer) => (state, Action) => reducer(state, mapFn(Action));\nexports.mapA = mapA;\n/**\n *\n * @param filterFn - a function to filter a state with\n * @returns {MiddlewareFn} MiddlewareFn<State>\n *\n * PS - previous state\n * NS - next state\n */\nconst filterPS = (filterFn) => (reducer) => (state, Action) => {\n return filterFn(state) ? reducer(state, Action) : state;\n};\nexports.filterPS = filterPS;\nconst filterNS = (filterFn) => (reducer) => (state, Action) => {\n const nextState = reducer(state, Action);\n return filterFn(nextState) ? nextState : state;\n};\nexports.filterNS = filterNS;\n/**\n *\n * @param filterFn - a function to filter an Action with\n * @returns {MiddlewareFn} MiddlewareFn<State, IActionsUnion>\n */\nconst filterA = (filterFn) => (reducer) => (state, Action) => {\n return filterFn(Action) ? reducer(state, Action) : state;\n};\nexports.filterA = filterA;\n/**\n * Reduce into state\n * @param reduceFn - a function to reduce the state and Action together\n * @returns {MiddlewareFn} MiddlewareFn<State, IActionsUnion>\n *\n * PS - previous state\n * NS - next state\n */\nconst reducePS = (reducerFn) => (reducer) => (state, Action) => {\n return reducer(reducerFn(state, Action), Action);\n};\nexports.reducePS = reducePS;\nconst reduceNS = (reducerFn) => (reducer) => (state, Action) => {\n return reducerFn(reducer(state, Action), Action);\n};\nexports.reduceNS = reduceNS;\n/**\n *\n * Reduce into Action\n * @param reduceFn - a function to reduce the state and Action together\n * @returns {MiddlewareFn} MiddlewareFn<State, IActionsUnion>\n */\nconst reduceA = (reducerFn) => (reducer) => (state, Action) => {\n return reducer(state, reducerFn(state, Action));\n};\nexports.reduceA = reduceA;\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ofType = ofType;\nexports.createEffect = createEffect;\nexports.createSubscriptionEffect = createSubscriptionEffect;\nexports.createEpicRegistry = createEpicRegistry;\nexports.createEffectRegistry = createEpicRegistry;\nconst rxjs_1 = require(\"rxjs\");\nconst operators_1 = require(\"rxjs/operators\");\n/**\n * ofType filter - accepts action creators, extracts their `.type` for filtering\n * Usage: action$.pipe(ofType(actionCreator1, actionCreator2))\n */\nfunction ofType(...actionCreators) {\n return (action$) => {\n return action$.pipe((0, operators_1.filter)((action) => actionCreators.some((creator) => creator.type === action.type)));\n };\n}\n/**\n * createEffect - factory pattern for creating effects\n * Usage: createEffect()(action$ => action$.pipe(ofType(...), switchMap(...)))\n * Usage with state: createEffect()((action$, state$) => action$.pipe(ofType(...), withLatestFrom(state$), ...))\n */\nfunction createEffect(options = { dispatch: true }) {\n return (effectFactory) => {\n return (action$, state$) => {\n const mappedEffect$ = effectFactory(action$, state$);\n if (!options.dispatch) {\n return mappedEffect$.pipe((0, operators_1.ignoreElements)(), (0, operators_1.catchError)((error) => {\n console.error('[Effect] Error:', error);\n return (0, rxjs_1.of)();\n }));\n }\n return mappedEffect$.pipe((0, operators_1.catchError)((error) => {\n console.error('[Effect] Error:', error);\n return (0, rxjs_1.of)();\n }));\n };\n };\n}\n/**\n * createSubscriptionEffect - for subscription-style effects with auto-takeUntil\n * Usage: createSubscriptionEffect(destroy$)(action$ => action$.pipe(...))\n * Usage with state: createSubscriptionEffect(destroy$)((action$, state$) => ...)\n */\nfunction createSubscriptionEffect(destroy$) {\n return (effectFactory) => {\n return (action$, state$) => {\n return effectFactory(action$, state$).pipe((0, operators_1.takeUntil)(destroy$), (0, operators_1.catchError)((error) => {\n console.error('[Effect] Error:', error);\n return (0, rxjs_1.of)();\n }));\n };\n };\n}\n/**\n * createEpicRegistry - combines multiple effects into a single epic\n * Usage: epic$ = createEpicRegistry(effect1, effect2, effect3)\n * Each effect may optionally receive state$ as a second argument.\n */\nfunction createEpicRegistry(...effects) {\n return (action$, state$) => {\n return (0, rxjs_1.merge)(...effects.map((effect) => effect(action$, state$)));\n };\n}\n", "\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.combineReducers = exports.flatCatch = exports.catchErr = exports.mapToObservable = exports.DEVTOOLS_JUMP_TO_STATE = exports.normalizeDevToolsConfig = exports.withDevToolsTimeTravel = exports.connectReduxDevTools = exports.createStore = exports.Store = exports.FlattenOperator = void 0;\nvar interfaces_1 = require(\"./interfaces\");\nObject.defineProperty(exports, \"FlattenOperator\", { enumerable: true, get: function () { return interfaces_1.FlattenOperator; } });\nvar store_1 = require(\"./store\");\nObject.defineProperty(exports, \"Store\", { enumerable: true, get: function () { return store_1.Store; } });\nObject.defineProperty(exports, \"createStore\", { enumerable: true, get: function () { return store_1.createStore; } });\nvar devtools_1 = require(\"./devtools\");\nObject.defineProperty(exports, \"connectReduxDevTools\", { enumerable: true, get: function () { return devtools_1.connectReduxDevTools; } });\nObject.defineProperty(exports, \"withDevToolsTimeTravel\", { enumerable: true, get: function () { return devtools_1.withDevToolsTimeTravel; } });\nObject.defineProperty(exports, \"normalizeDevToolsConfig\", { enumerable: true, get: function () { return devtools_1.normalizeDevToolsConfig; } });\nObject.defineProperty(exports, \"DEVTOOLS_JUMP_TO_STATE\", { enumerable: true, get: function () { return devtools_1.DEVTOOLS_JUMP_TO_STATE; } });\nvar utils_1 = require(\"./utils\");\nObject.defineProperty(exports, \"mapToObservable\", { enumerable: true, get: function () { return utils_1.mapToObservable; } });\nObject.defineProperty(exports, \"catchErr\", { enumerable: true, get: function () { return utils_1.catchErr; } });\nObject.defineProperty(exports, \"flatCatch\", { enumerable: true, get: function () { return utils_1.flatCatch; } });\nObject.defineProperty(exports, \"combineReducers\", { enumerable: true, get: function () { return utils_1.combineReducers; } });\n__exportStar(require(\"./middleware\"), exports);\n__exportStar(require(\"./effects\"), exports);\n", "import {\n defer,\n from,\n isObservable,\n Observable,\n of,\n Subscription,\n throwError,\n timer,\n} from 'rxjs';\nimport {\n catchError,\n finalize,\n map,\n shareReplay,\n switchMap,\n take,\n takeWhile,\n tap,\n} from 'rxjs/operators';\n\nimport { DOCS } from './documents';\nimport { LambforgeError } from './errors';\nimport {\n DEFAULT_URL,\n Endpoint,\n FetchLike,\n request$,\n subscriptionsUrl,\n} from './http';\nimport {\n AgentEvent,\n ConversationDetail,\n ConversationSummary,\n EmbedAgent,\n SentMessage,\n SessionToken,\n} from './types';\nimport { subscription$, WebSocketConstructor } from './ws';\n\n/** A value now, later (Promise) or as an Observable. */\nexport type Lazy<T> = () => T | Promise<T> | Observable<T>;\n\nconst lazy$ = <T>(source: Lazy<T>): Observable<T> =>\n defer(() => {\n const value = source();\n return isObservable(value) ? value.pipe(take(1)) : from(Promise.resolve(value));\n });\n\nexport interface AgentClientOptions {\n /** default https://api.lambforge.com */\n url?: string;\n /** Your backend mints the session (`Lambforge.sessions.create`) and returns it. */\n getToken?: Lazy<SessionToken | string>;\n /** The visitor's own sign-in token -> a session (an identity provider of the project). */\n exchange?: {\n projectId: string;\n idToken: Lazy<string>;\n agents?: string[];\n };\n /** Anonymous visitors: a publishable key (`lfp_`) + a Turnstile token. */\n anonymous?: {\n publishableKey: string;\n turnstileToken: Lazy<string>;\n /** 16-128 of A-Z a-z 0-9 _ - ; default: one per browser (localStorage) */\n deviceId?: string;\n agents?: string[];\n };\n fetch?: FetchLike;\n /** WebSocket implementation (Node < 22: `require('ws')`); `false` = poll */\n WebSocket?: WebSocketConstructor | false;\n /** polling interval without a WebSocket, default 1500 ms */\n pollIntervalMs?: number;\n}\n\n/** Renew this long before the session expires. */\nconst RENEW_BEFORE_MS = 60_000;\nconst DEVICE_KEY = 'lambforge.agents.device';\nconst RECONNECT_MAX_MS = 15_000;\n\n/**\n * The visitor side, browser or Node: the agents of a session, their\n * conversations and live events. Holds the session token and renews it\n * shortly before it expires (or once when the server says it expired).\n * Never give it a secret key - mint sessions on your server.\n */\nexport class AgentClient {\n readonly endpoint: Endpoint;\n private current: { token: string; renewAt: number } | null = null;\n private pending$: Observable<string> | null = null;\n\n constructor(private readonly options: AgentClientOptions) {\n const sources = [options.getToken, options.exchange, options.anonymous].filter(\n Boolean,\n ).length;\n if (sources !== 1) {\n throw new LambforgeError(\n 'AgentClient: give exactly one of getToken, exchange or anonymous',\n 'bad-request',\n );\n }\n if (options.anonymous && !options.anonymous.publishableKey.startsWith('lfp_')) {\n throw new LambforgeError(\n 'AgentClient: anonymous visitors need a publishable key (lfp_...)',\n 'bad-request',\n );\n }\n this.endpoint = { url: options.url ?? DEFAULT_URL, fetch: options.fetch };\n }\n\n // ------------------------------------------------------------- session\n\n /** The current session token (renewed when needed). */\n token$(): Observable<string> {\n if (this.current && Date.now() < this.current.renewAt) {\n return of(this.current.token);\n }\n if (!this.pending$) {\n this.pending$ = this.session$().pipe(\n tap((s) => {\n const expires = s.expiresAt ? Date.parse(s.expiresAt) : NaN;\n this.current = {\n token: s.token,\n renewAt: Number.isFinite(expires)\n ? Math.max(Date.now() + 30_000, expires - RENEW_BEFORE_MS)\n : Date.now() + 50 * 60_000,\n };\n }),\n map((s) => s.token),\n finalize(() => (this.pending$ = null)),\n shareReplay(1),\n );\n }\n return this.pending$;\n }\n\n /** Forget the session (the next call gets a new one). */\n invalidate(): void {\n this.current = null;\n }\n\n private session$(): Observable<SessionToken> {\n const o = this.options;\n if (o.getToken) {\n return lazy$(o.getToken).pipe(\n map((t) => (typeof t === 'string' ? { token: t } : t)),\n );\n }\n if (o.exchange) {\n const { projectId, idToken, agents } = o.exchange;\n return lazy$(idToken).pipe(\n switchMap((token) =>\n request$<SessionToken>(\n this.endpoint,\n null,\n DOCS.exchangeSession,\n { projectId, token, agents },\n 'exchangeAgentSession',\n ),\n ),\n );\n }\n const a = o.anonymous!;\n return lazy$(a.turnstileToken).pipe(\n switchMap((turnstileToken) =>\n request$<SessionToken>(\n this.endpoint,\n a.publishableKey,\n DOCS.anonymousSession,\n {\n deviceId: a.deviceId ?? deviceId(),\n turnstileToken,\n agents: a.agents,\n },\n 'createAnonymousAgentSession',\n ),\n ),\n );\n }\n\n /** One operation with the session; a refused session is renewed once. */\n call$<T>(query: string, variables: Record<string, unknown>, field: string) {\n const once = () =>\n this.token$().pipe(\n switchMap((token) =>\n request$<T>(this.endpoint, token, query, variables, field),\n ),\n );\n return once().pipe(\n catchError((e: LambforgeError) => {\n if (e?.code !== 'session-expired' && e?.code !== 'unauthorized') {\n return throwError(() => e);\n }\n this.invalidate();\n return once();\n }),\n );\n }\n\n // -------------------------------------------------------------- reading\n\n /** The agents this session may use. */\n agents(): Observable<EmbedAgent[]> {\n return this.call$<EmbedAgent[]>(DOCS.sessionAgents, {}, 'sessionAgents');\n }\n\n /** The visitor's conversations (newest first), optionally of one agent. */\n conversations(agent?: string): Observable<ConversationSummary[]> {\n return this.call$<ConversationSummary[]>(\n DOCS.conversations,\n { agent },\n 'agentConversations',\n );\n }\n\n /** A chat with one agent (id or name); `conversationId` continues one. */\n agent(agent: string) {\n return {\n conversation: (conversationId?: string) =>\n new AgentConversation(this, agent, conversationId ?? null),\n conversations: () => this.conversations(agent),\n };\n }\n\n // --------------------------------------------------------------- events\n\n /**\n * Every event of a conversation after `afterSeq`, in order, without\n * duplicates and without gaps: live over the WebSocket (reconnecting with\n * backoff, catching up after each start) or polled without one. Never\n * completes by itself.\n */\n events(conversationId: string, afterSeq = 0): Observable<AgentEvent> {\n return new Observable<AgentEvent>((subscriber) => {\n let last = afterSeq;\n const held = new Map<number, AgentEvent>();\n const subs = new Subscription();\n let catching = false;\n let again = false;\n\n const flush = () => {\n while (held.has(last + 1)) {\n const e = held.get(last + 1)!;\n held.delete(last + 1);\n last = e.seq;\n subscriber.next(e);\n }\n };\n const accept = (e: AgentEvent) => {\n if (!e || e.seq <= last) return;\n held.set(e.seq, e);\n flush();\n if (held.size) catchUp(); // a gap: ask the server what is missing\n };\n const catchUp = () => {\n if (catching) {\n again = true;\n return;\n }\n catching = true;\n subs.add(\n this.call$<AgentEvent[]>(\n DOCS.events,\n { conversationId, afterSeq: last },\n 'agentConversationEvents',\n ).subscribe({\n next: (list) => {\n list.forEach((e) => held.set(e.seq, e));\n flush();\n // the server has nothing in between: deliver what is held\n if (held.size && !list.length) {\n last = Math.min(...held.keys()) - 1;\n flush();\n }\n },\n error: (e) => {\n catching = false;\n subscriber.error(e);\n },\n complete: () => {\n catching = false;\n if (again) {\n again = false;\n catchUp();\n }\n },\n }),\n );\n };\n\n const WS = this.webSocket();\n if (!WS) {\n catchUp();\n subs.add(\n timer(this.options.pollIntervalMs ?? 1500, this.options.pollIntervalMs ?? 1500).subscribe(\n () => catchUp(),\n ),\n );\n return subs;\n }\n\n let attempt = 0;\n let renewed = false;\n const connect = () => {\n subs.add(\n this.token$()\n .pipe(\n switchMap((token) =>\n subscription$<AgentEvent>({\n url: subscriptionsUrl(this.endpoint.url),\n WebSocket: WS,\n connectionParams: { agentSession: token },\n query: DOCS.liveEvents,\n variables: { conversationId },\n field: 'agentEvents',\n onStarted: () => {\n attempt = 0;\n renewed = false;\n catchUp();\n },\n }),\n ),\n )\n .subscribe({\n next: accept,\n error: (e: LambforgeError) => {\n if (e?.code === 'unauthorized' && !renewed) {\n renewed = true;\n this.invalidate();\n connect();\n return;\n }\n if (e?.code !== 'network') {\n subscriber.error(e);\n return;\n }\n const wait = Math.min(RECONNECT_MAX_MS, 1000 * 2 ** attempt++);\n subs.add(timer(wait * (0.75 + Math.random() / 2)).subscribe(connect));\n },\n complete: () => subscriber.complete(),\n }),\n );\n };\n connect();\n return subs;\n });\n }\n\n private webSocket(): WebSocketConstructor | null {\n if (this.options.WebSocket === false) return null;\n return (\n this.options.WebSocket ??\n ((globalThis as { WebSocket?: WebSocketConstructor }).WebSocket || null)\n );\n }\n}\n\n/** One conversation with one agent. */\nexport class AgentConversation {\n constructor(\n private readonly client: AgentClient,\n readonly agent: string,\n /** null until the first message creates it */\n public id: string | null,\n ) {}\n\n /**\n * Send a message; emits the events of THAT run - the stored visitor\n * message, `run-started`, the answer, then `done` or `error` - and\n * completes. A failed send (limits, caps, an unavailable agent) errors\n * instead. Nothing is resent automatically.\n */\n send(text: string, options: { credential?: string } = {}): Observable<AgentEvent> {\n return this.client\n .call$<SentMessage>(\n DOCS.send,\n {\n agent: this.agent,\n conversationId: this.id,\n text,\n credential: options.credential,\n },\n 'sendAgentMessage',\n )\n .pipe(\n tap((sent) => (this.id = sent.conversationId)),\n switchMap((sent) =>\n // seq = run-started; seq - 1 = the visitor's message\n this.client.events(sent.conversationId, Math.max(0, sent.seq - 2)).pipe(\n takeWhile(\n (e) =>\n !(\n (e.type === 'done' || e.type === 'error') &&\n e.runId === sent.runId\n ),\n true,\n ),\n ),\n ),\n );\n }\n\n /** Live events from now on (or after `afterSeq`). */\n events(afterSeq?: number): Observable<AgentEvent> {\n if (!this.id) {\n return throwError(\n () => new LambforgeError('No conversation yet - send a message first', 'bad-request'),\n );\n }\n return afterSeq === undefined\n ? this.history().pipe(\n switchMap((c) => this.client.events(this.id!, c.lastSeq ?? 0)),\n )\n : this.client.events(this.id, afterSeq);\n }\n\n /** The stored messages (and `lastSeq` / `answering` to resume). */\n history(): Observable<ConversationDetail> {\n if (!this.id) {\n return throwError(\n () => new LambforgeError('No conversation yet - send a message first', 'bad-request'),\n );\n }\n return this.client.call$<ConversationDetail>(\n DOCS.conversation,\n { id: this.id },\n 'agentConversation',\n );\n }\n\n /** Stop the answer in progress. */\n abort(): Observable<boolean> {\n if (!this.id) return of(false);\n return this.client.call$<boolean>(\n DOCS.abort,\n { conversationId: this.id },\n 'abortAgentRun',\n );\n }\n}\n\n/** One id per browser (localStorage), else a fresh one per client. */\nexport function deviceId(): string {\n const storage = (globalThis as { localStorage?: StorageLike }).localStorage;\n try {\n const stored = storage?.getItem(DEVICE_KEY);\n if (stored && /^[A-Za-z0-9_-]{16,128}$/.test(stored)) return stored;\n } catch {\n /* storage blocked */\n }\n const id = globalThis.crypto.randomUUID().replace(/-/g, '');\n try {\n storage?.setItem(DEVICE_KEY, id);\n } catch {\n /* storage blocked */\n }\n return id;\n}\n\ninterface StorageLike {\n getItem(key: string): string | null;\n setItem(key: string, value: string): void;\n}\n", "/** The GraphQL operations this package sends (one place to keep in sync). */\n\nconst AGENT = `id name type description instructions tools isActive modelName mcpLambdaId mcpLambdaName createdAt updatedAt\n embed { published identity allowedOrigins welcome suggestions showToolDetails maxMessagesPerConversation retentionDays publishedAt }`;\nconst EMBED_AGENT = 'id name description welcome suggestions';\nconst SESSION = `token expiresAt agents { ${EMBED_AGENT} }`;\nconst SUMMARY =\n 'id agentId title messageCount lastSeq answering lastMessageAt createdAt';\nconst MESSAGE = 'id role text toolCalls { name status } createdAt';\nconst EVENT = 'conversationId seq type runId data createdAt';\n\nexport const DOCS = {\n listAgents: `query ($projectId: String!) { listProjectAgents(projectId: $projectId) { ${AGENT} } }`,\n getAgent: `query ($id: String!) { getProjectAgent(id: $id) { ${AGENT} } }`,\n createAgent: `mutation ($projectId: String!, $payload: CreateProjectAgentInput!) { createProjectAgent(projectId: $projectId, payload: $payload) { ${AGENT} } }`,\n updateAgent: `mutation ($id: String!, $payload: UpdateProjectAgentInput!) { updateProjectAgent(id: $id, payload: $payload) { ${AGENT} } }`,\n deleteAgent: `mutation ($id: String!) { deleteProjectAgent(id: $id) }`,\n updateEmbed: `mutation ($agentId: String!, $embed: AgentEmbedInput!) { updateAgentEmbed(agentId: $agentId, embed: $embed) { ${AGENT} } }`,\n createSession: `mutation ($subject: String!, $agents: [String], $claims: JSON, $ttlSeconds: Int, $origin: String) { createAgentSession(subject: $subject, agents: $agents, claims: $claims, ttlSeconds: $ttlSeconds, origin: $origin) { ${SESSION} } }`,\n exchangeSession: `mutation ($projectId: String!, $token: String!, $agents: [String]) { exchangeAgentSession(projectId: $projectId, token: $token, agents: $agents) { ${SESSION} } }`,\n anonymousSession: `mutation ($deviceId: String!, $turnstileToken: String!, $agents: [String]) { createAnonymousAgentSession(deviceId: $deviceId, turnstileToken: $turnstileToken, agents: $agents) { ${SESSION} } }`,\n sessionAgents: `query { sessionAgents { ${EMBED_AGENT} } }`,\n conversations: `query ($agent: String) { agentConversations(agent: $agent) { ${SUMMARY} } }`,\n conversation: `query ($id: String!) { agentConversation(id: $id) { ${SUMMARY} messages { ${MESSAGE} } } }`,\n events: `query ($conversationId: String!, $afterSeq: Int) { agentConversationEvents(conversationId: $conversationId, afterSeq: $afterSeq) { ${EVENT} } }`,\n send: `mutation ($agent: String!, $conversationId: String, $text: String!, $credential: String) { sendAgentMessage(agent: $agent, conversationId: $conversationId, text: $text, credential: $credential) { conversationId runId seq } }`,\n abort: `mutation ($conversationId: String!) { abortAgentRun(conversationId: $conversationId) }`,\n liveEvents: `subscription ($conversationId: String!) { agentEvents(conversationId: $conversationId) { ${EVENT} } }`,\n};\n", "/** Why a call or a run was refused - stable codes a UI can switch on. */\nexport type AgentErrorCode =\n | 'limit-reached'\n | 'cap-reached'\n | 'agent-unavailable'\n | 'session-expired'\n | 'credential-expired'\n | 'aborted'\n | 'internal'\n | 'unauthorized'\n | 'bad-request'\n | 'network';\n\nconst SERVER_CODES: AgentErrorCode[] = [\n 'limit-reached',\n 'cap-reached',\n 'agent-unavailable',\n 'session-expired',\n 'credential-expired',\n 'aborted',\n 'internal',\n];\n\nexport class LambforgeError extends Error {\n constructor(\n message: string,\n readonly code: AgentErrorCode,\n readonly status?: number,\n ) {\n super(message);\n this.name = 'LambforgeError';\n }\n}\n\ninterface GraphQLErrorLike {\n message?: string;\n extensions?: { code?: string };\n}\n\n/** The first GraphQL error as a LambforgeError with a usable code. */\nexport function errorFromGraphQL(\n errors: GraphQLErrorLike[],\n status?: number,\n): LambforgeError {\n const first = errors?.[0] ?? {};\n const message = String(first.message ?? 'Request failed');\n const prefix = message.match(/^([a-z-]+):/)?.[1] as AgentErrorCode | undefined;\n if (prefix && SERVER_CODES.includes(prefix)) {\n return new LambforgeError(message, prefix, status);\n }\n if (message === 'session-expired') {\n return new LambforgeError(message, 'session-expired', status);\n }\n if (\n first.extensions?.code === 'UNAUTHENTICATED' ||\n /not authorized|unauthorized|invalid sign-in token/i.test(message)\n ) {\n return new LambforgeError(message, 'unauthorized', status);\n }\n return new LambforgeError(message, 'bad-request', status);\n}\n", "import { Observable } from 'rxjs';\n\nimport { errorFromGraphQL, LambforgeError } from './errors';\n\nexport type FetchLike = (\n input: string,\n init: {\n method: string;\n headers: Record<string, string>;\n body: string;\n signal: AbortSignal;\n },\n) => Promise<{ status: number; json(): Promise<unknown> }>;\n\nexport interface Endpoint {\n /** `https://api.lambforge.com` (GraphQL at /graphql, WebSocket at /subscriptions) */\n url: string;\n fetch?: FetchLike;\n}\n\nexport const DEFAULT_URL = 'https://api.lambforge.com';\n\nexport const graphqlUrl = (url: string) =>\n `${url.replace(/\\/+$/, '')}/graphql`;\n\nexport const subscriptionsUrl = (url: string) =>\n `${url.replace(/\\/+$/, '').replace(/^http/, 'ws')}/subscriptions`;\n\n/**\n * One GraphQL operation over HTTP. `token` goes RAW in `authorization`\n * (an `lfk_` / `lfp_` key or a session token - never `Bearer `). Emits the\n * value of `field`; cancelling aborts the request.\n */\nexport function request$<T>(\n endpoint: Endpoint,\n token: string | null,\n query: string,\n variables: Record<string, unknown>,\n field: string,\n): Observable<T> {\n return new Observable<T>((subscriber) => {\n const controller = new AbortController();\n const fetchImpl = (endpoint.fetch ?? (globalThis.fetch as never)) as FetchLike;\n if (!fetchImpl) {\n subscriber.error(new LambforgeError('No fetch available', 'network'));\n return undefined;\n }\n fetchImpl(graphqlUrl(endpoint.url), {\n method: 'POST',\n headers: {\n 'content-type': 'application/json',\n ...(token ? { authorization: token } : {}),\n },\n body: JSON.stringify({ query, variables }),\n signal: controller.signal,\n })\n .then(async (res) => {\n let body: { data?: Record<string, unknown>; errors?: never[] };\n try {\n body = (await res.json()) as typeof body;\n } catch {\n throw new LambforgeError(\n `Lambforge answered ${res.status}`,\n res.status === 401 ? 'unauthorized' : 'network',\n res.status,\n );\n }\n if (body.errors?.length) throw errorFromGraphQL(body.errors, res.status);\n if (!body.data || !(field in body.data)) {\n throw new LambforgeError(\n `Lambforge answered ${res.status} without ${field}`,\n 'network',\n res.status,\n );\n }\n subscriber.next(body.data[field] as T);\n subscriber.complete();\n })\n .catch((e) => {\n if (controller.signal.aborted) return;\n subscriber.error(\n e instanceof LambforgeError\n ? e\n : new LambforgeError(String(e?.message ?? e), 'network'),\n );\n });\n return () => controller.abort();\n });\n}\n", "import { Observable } from 'rxjs';\n\nimport { errorFromGraphQL, LambforgeError } from './errors';\n\n/** The part of a WebSocket this package uses (browser `WebSocket`, Node 22+, or `ws`). */\nexport interface WebSocketLike {\n readonly protocol: string;\n readonly readyState: number;\n send(data: string): void;\n close(code?: number, reason?: string): void;\n onopen: ((ev: unknown) => void) | null;\n onmessage: ((ev: { data: unknown }) => void) | null;\n onclose: ((ev: { code?: number; reason?: string }) => void) | null;\n onerror: ((ev: unknown) => void) | null;\n}\n\nexport type WebSocketConstructor = new (\n url: string,\n protocols: string[],\n) => WebSocketLike;\n\n/**\n * Both protocols are offered and the client follows the server's choice\n * (Lambforge plan 53 moves the platform from the legacy `graphql-ws`\n * protocol of subscriptions-transport-ws to `graphql-transport-ws` of the\n * graphql-ws package). The legacy one goes FIRST: a legacy server takes\n * the first offered protocol and closes with 1002 when it is not\n * `graphql-ws` (seen on api.lambforge.com 2026-12-03); a graphql-ws server\n * picks `graphql-transport-ws` wherever it is in the list.\n */\nexport const WS_PROTOCOLS = ['graphql-ws', 'graphql-transport-ws'];\n\nexport interface SubscribeOptions {\n url: string;\n WebSocket: WebSocketConstructor;\n connectionParams: Record<string, unknown>;\n query: string;\n variables: Record<string, unknown>;\n field: string;\n /** called once the subscription is registered (catch up after this) */\n onStarted?: () => void;\n}\n\n/**\n * One subscription on its own socket. Emits `data[field]` per event;\n * errors with a LambforgeError (code `network` when the socket drops);\n * completes when the server completes. Unsubscribe stops and closes.\n */\nexport function subscription$<T>(o: SubscribeOptions): Observable<T> {\n return new Observable<T>((subscriber) => {\n const id = '1';\n let done = false;\n const ws = new o.WebSocket(o.url, WS_PROTOCOLS);\n const modern = () => ws.protocol === 'graphql-transport-ws';\n const send = (msg: Record<string, unknown>) => {\n if (ws.readyState === 1) ws.send(JSON.stringify(msg));\n };\n const fail = (e: LambforgeError) => {\n if (done) return;\n done = true;\n subscriber.error(e);\n try {\n ws.close(1000);\n } catch {\n /* already closed */\n }\n };\n\n ws.onopen = () =>\n send({ type: 'connection_init', payload: o.connectionParams });\n ws.onmessage = (ev) => {\n let msg: { type?: string; id?: string; payload?: unknown };\n try {\n msg = JSON.parse(String(ev.data));\n } catch {\n return;\n }\n switch (msg.type) {\n case 'connection_ack':\n send({\n id,\n type: modern() ? 'subscribe' : 'start',\n payload: { query: o.query, variables: o.variables },\n });\n o.onStarted?.();\n return;\n case 'ping':\n send({ type: 'pong' });\n return;\n case 'next':\n case 'data': {\n const payload = msg.payload as {\n data?: Record<string, unknown>;\n errors?: never[];\n };\n if (payload?.errors?.length) {\n fail(errorFromGraphQL(payload.errors));\n return;\n }\n if (payload?.data) subscriber.next(payload.data[o.field] as T);\n return;\n }\n case 'error':\n fail(\n errorFromGraphQL(\n (Array.isArray(msg.payload)\n ? msg.payload\n : [msg.payload]) as never[],\n ),\n );\n return;\n case 'connection_error':\n fail(\n new LambforgeError(\n String(\n (msg.payload as { message?: string })?.message ??\n 'connection refused',\n ),\n 'unauthorized',\n ),\n );\n return;\n case 'complete':\n if (done) return;\n done = true;\n subscriber.complete();\n ws.close(1000);\n return;\n default:\n return; // ka, pong\n }\n };\n ws.onclose = (ev) => {\n if (done) return;\n const unauthorized = ev?.code === 4401 || ev?.code === 4403;\n fail(\n new LambforgeError(\n `connection closed${ev?.code ? ` (${ev.code}${ev.reason ? ` ${ev.reason}` : ''})` : ''}`,\n unauthorized ? 'unauthorized' : 'network',\n ),\n );\n };\n ws.onerror = () => undefined; // onclose follows with the reason\n\n return () => {\n if (!done) {\n done = true;\n send({ id, type: modern() ? 'complete' : 'stop' });\n }\n ws.onmessage = ws.onclose = ws.onerror = ws.onopen = null;\n try {\n ws.close(1000);\n } catch {\n /* never opened */\n }\n };\n });\n}\n", "import { AgentClient, SessionToken } from '@lambforge/agents';\nimport { Component } from '@rhtml/component';\nimport { html, LitElement, property, svg, unsafeCSS } from '@rxdi/lit-html';\nimport { defer, Observable } from 'rxjs';\nimport { finalize } from 'rxjs/operators';\n\nimport { renderMarkdown } from './markdown';\nimport {\n ChatAction,\n ChatMessage,\n ChatState,\n ChatStore,\n newConversation,\n Notice,\n pickAgent,\n sendMessage,\n shown,\n stop,\n verifying,\n} from './store';\nimport { ChatStrings, stringsFor } from './strings';\nimport { STYLES } from './styles';\nimport { turnstileToken } from './turnstile';\n\nexport const TAG = 'lambforge-agent-chat';\n\n/** An action that needs things from the render (`Reader` of @rhtml/di). */\nexport type Reader<T extends unknown[], R> = (deps: T) => R;\n\nconst ICON_CHAT = svg`<path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z\"/>`;\nconst ICON_CLOSE = svg`<path d=\"M18 6 6 18M6 6l12 12\"/>`;\nconst ICON_NEW = svg`<path d=\"M12 5v14M5 12h14\"/>`;\nconst icon = (paths: unknown) =>\n html`<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${paths}</svg>`;\n\n/**\n * A visitor chat with a Lambforge agent (plan 51): a launcher + panel\n * (drawer), a block in the page (inline) or the whole screen.\n *\n * Style A (`@rhtml/component`) over its own `@rxdi/redux-store` store\n * (store/): `State` is the store's state, the view only renders it and\n * dispatches; requests live in ChatEffects. The store is created when\n * `State` starts and destroyed with the element.\n *\n * Give it ONE session source: `publishable-key` (anonymous visitors),\n * `token-url`, `.getToken` or `.client`.\n *\n * @customElement lambforge-agent-chat\n *\n * @attr {string} publishable-key - `lfp_...` key: anonymous visitors (Turnstile bot check)\n * @attr {string} token-url - your endpoint answering `{ token, expiresAt }` (signed-in visitors)\n * @attr {string} agent - the agent to start with (id or name)\n * @attr {string} agents - only these agents, comma list of ids or names (a picker when more than one)\n * @attr {'drawer'|'inline'|'fullscreen'} mode - default `drawer`\n * @attr {'bottom-right'|'bottom-left'} position - where the drawer's launcher sits\n * @attr {boolean} open - the drawer is open\n * @attr {'light'|'dark'} theme\n * @attr {string} locale - `en`, `bg` (default: the page's `lang`)\n * @attr {string} title - the header (default: the agent's name)\n * @attr {string} url - the API (default `https://api.lambforge.com`)\n * @attr {string} turnstile-sitekey - your own Turnstile widget instead of the hosted one\n * @attr {string} turnstile-url - the hosted bot check page\n *\n * @prop {AgentClient} client - an AgentClient you built yourself (wins over the attributes)\n * @prop {() => Promise<SessionToken | string>} getToken - your token source\n * @prop {Partial<ChatStrings>} strings - override any text\n *\n * @fires open-change - `{ open }` the drawer opened or closed\n * @fires answer - `{ text, agent, conversationId }` an answer arrived\n * @fires error - `{ code }` something failed (`cap-reached`, `limit-reached`, ...)\n *\n * @slot launcher - the drawer button's content (default: a chat icon)\n *\n * @csspart launcher\n * @csspart panel\n * @csspart header\n * @csspart picker\n * @csspart new\n * @csspart close\n * @csspart messages\n * @csspart message - every bubble (also `user` / `assistant`)\n * @csspart suggestion\n * @csspart status\n * @csspart composer\n * @csspart input\n * @csspart send\n *\n * @cssprop --lf-chat-accent - buttons, the visitor's bubbles (#4f46e5)\n * @cssprop --lf-chat-accent-fg\n * @cssprop --lf-chat-bg\n * @cssprop --lf-chat-fg\n * @cssprop --lf-chat-muted\n * @cssprop --lf-chat-border\n * @cssprop --lf-chat-bot-bg\n * @cssprop --lf-chat-bot-fg\n * @cssprop --lf-chat-user-bg\n * @cssprop --lf-chat-user-fg\n * @cssprop --lf-chat-error\n * @cssprop --lf-chat-radius\n * @cssprop --lf-chat-font\n * @cssprop --lf-chat-width - drawer width (380px)\n * @cssprop --lf-chat-height\n * @cssprop --lf-chat-offset - distance from the corner (20px)\n * @cssprop --lf-chat-z-index\n * @cssprop --lf-chat-launcher-size\n * @cssprop --lf-chat-shadow\n */\n@Component<ChatState, [], LambforgeAgentChat>({\n Settings: { selector: TAG, styles: [unsafeCSS(STYLES)] },\n Loading: () => html``,\n Error: () => html``,\n State(this: LambforgeAgentChat) {\n return this.connect();\n },\n Render: () =>\n function (this: LambforgeAgentChat, state: ChatState) {\n return this.view(state);\n },\n})\nexport class LambforgeAgentChat extends LitElement {\n /** drawer only: the panel is open */\n @property({ type: Boolean, reflect: true }) open = false;\n /** drawer (launcher + panel) | inline | fullscreen */\n @property({ reflect: true }) mode: 'drawer' | 'inline' | 'fullscreen' = 'drawer';\n @property({ reflect: true }) position: 'bottom-right' | 'bottom-left' = 'bottom-right';\n @property({ reflect: true }) theme: 'light' | 'dark' = 'light';\n /** preferred agent (id or name) */\n @property() agent = '';\n /** only these agents (comma list of ids or names); a picker when > 1 */\n @property() agents = '';\n @property() locale = '';\n /** the header text (default: the agent's name) */\n @property({ attribute: 'title' }) heading = '';\n @property() url = '';\n @property({ attribute: 'publishable-key' }) publishableKey = '';\n @property({ attribute: 'token-url' }) tokenUrl = '';\n @property({ attribute: 'turnstile-sitekey' }) turnstileSitekey = '';\n @property({ attribute: 'turnstile-url' }) turnstileUrl = '';\n\n /** An AgentClient you built yourself (wins over the attributes). */\n @property({ attribute: false }) client?: AgentClient;\n /** Your token source, when not using `token-url`. */\n @property({ attribute: false }) getToken?: () =>\n | Promise<SessionToken | string>\n | SessionToken\n | string;\n /** Override any text (see ChatStrings). */\n @property({ attribute: false }) strings: Partial<ChatStrings> = {};\n\n private store?: ChatStore;\n private lastCount = 0;\n\n private get shown(): boolean {\n return this.mode !== 'drawer' || this.open;\n }\n\n get t(): ChatStrings {\n return stringsFor(\n this.locale || this.ownerDocument.documentElement.lang || 'en',\n this.strings,\n );\n }\n\n /** Cold: <r-renderer> subscribes once; the store lives as long as that. */\n connect(): Observable<ChatState> {\n return defer(() => {\n const store = new ChatStore(\n {\n client: this.resolveClient(),\n agent: this.agent,\n agents: this.agents.split(',').map((s) => s.trim()).filter(Boolean),\n emit: (type, detail) => this.emit(type, detail),\n },\n { shown: this.shown },\n );\n this.store = store;\n return store.state$.pipe(\n finalize(() => {\n store.destroy();\n if (this.store === store) this.store = undefined;\n }),\n );\n });\n }\n\n dispatch(action: ChatAction) {\n this.store?.dispatch(action);\n }\n\n OnUpdate() {\n if (this.shown) this.dispatch(shown(true));\n }\n\n private resolveClient(): AgentClient | null {\n if (this.client) return this.client;\n const url = this.url || undefined;\n if (this.getToken) {\n const source = this.getToken;\n this.client = new AgentClient({ url, getToken: () => source() });\n } else if (this.tokenUrl) {\n const tokenUrl = this.tokenUrl;\n this.client = new AgentClient({\n url,\n getToken: () =>\n fetch(tokenUrl, {\n credentials: 'include',\n headers: { accept: 'application/json' },\n }).then((r) => {\n if (!r.ok) throw new Error(`token-url answered ${r.status}`);\n return r.json() as Promise<SessionToken>;\n }),\n });\n } else if (this.publishableKey) {\n this.client = new AgentClient({\n url,\n anonymous: {\n publishableKey: this.publishableKey,\n turnstileToken: () => this.verifyHuman(),\n },\n });\n } else {\n console.error(`[${TAG}] give it a session: token-url, publishable-key, .getToken or .client`);\n return null;\n }\n return this.client;\n }\n\n private verifyHuman(): Promise<string> {\n this.dispatch(verifying(true));\n return this.turnstileBox()\n .then((host) =>\n turnstileToken({\n host,\n sitekey: this.turnstileSitekey || null,\n hostedUrl: this.turnstileUrl || null,\n }),\n )\n .finally(() => this.dispatch(verifying(false)));\n }\n\n /** The (rendered) box the challenge goes into. */\n private async turnstileBox(): Promise<HTMLElement> {\n for (let i = 0; i < 100; i++) {\n const box = this.shadowRoot?.querySelector<HTMLElement>('.turnstile');\n if (box) return box;\n await new Promise((r) => setTimeout(r, 20));\n }\n throw new Error('turnstile: the chat is not rendered');\n }\n\n // ------------------------------------------------------------ actions\n\n /** Send a message to the selected agent. */\n send(text: string): Reader<[ChatState], void> {\n return ([state]) => {\n const clean = String(text ?? '').trim();\n if (!clean || state.answering || !state.agentId) return;\n this.dispatch(\n sendMessage({ agentId: state.agentId, conversationId: state.conversationId, text: clean }),\n );\n };\n }\n\n /** Stop the answer in progress. */\n stopAnswer(): Reader<[ChatState], void> {\n return ([state]) => {\n if (!state.agentId) return;\n this.dispatch(stop({ agentId: state.agentId, conversationId: state.conversationId }));\n };\n }\n\n pick(agentId: string) {\n this.dispatch(pickAgent(agentId));\n }\n\n startOver() {\n this.dispatch(newConversation());\n this.focusInput();\n }\n\n setOpen(open: boolean) {\n if (open === this.open) return;\n this.open = open;\n this.emit('open-change', { open });\n if (open) this.focusInput();\n else this.shadowRoot?.querySelector<HTMLElement>('.launcher')?.focus();\n }\n\n private focusInput() {\n this.updateComplete.then(() =>\n requestAnimationFrame(() =>\n this.shadowRoot?.querySelector<HTMLTextAreaElement>('textarea')?.focus(),\n ),\n );\n }\n\n private submit(ev: Event, state: ChatState) {\n ev.preventDefault();\n if (state.answering) return this.stopAnswer()([state]);\n const input = this.shadowRoot?.querySelector<HTMLTextAreaElement>('textarea');\n if (!input) return;\n this.send(input.value)([state]);\n input.value = '';\n this.autosize(input);\n }\n\n private onInputKey(ev: KeyboardEvent, state: ChatState) {\n if (ev.key === 'Enter' && !ev.shiftKey && !ev.isComposing) {\n ev.preventDefault();\n if (!state.answering) this.submit(ev, state);\n }\n }\n\n private autosize(input: HTMLTextAreaElement) {\n input.style.height = 'auto';\n input.style.height = `${Math.min(input.scrollHeight, 140)}px`;\n }\n\n /** Escape closes the drawer; Tab stays inside the open dialog. */\n private onPanelKey(ev: KeyboardEvent) {\n if (ev.key === 'Escape' && this.mode === 'drawer') {\n ev.stopPropagation();\n this.setOpen(false);\n return;\n }\n if (ev.key !== 'Tab' || this.mode === 'inline') return;\n const panel = this.shadowRoot?.querySelector('.panel');\n const focusable = Array.from(\n panel?.querySelectorAll<HTMLElement>('button:not([disabled]), select, textarea, a[href]') ?? [],\n ).filter((el) => !el.closest('[hidden]'));\n if (!focusable.length) return;\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n const active = this.shadowRoot?.activeElement;\n if (ev.shiftKey && active === first) {\n ev.preventDefault();\n last.focus();\n } else if (!ev.shiftKey && active === last) {\n ev.preventDefault();\n first.focus();\n }\n }\n\n private emit(type: string, detail: Record<string, unknown>) {\n this.dispatchEvent(new CustomEvent(type, { detail, bubbles: true, composed: true }));\n }\n\n // --------------------------------------------------------------- view\n\n noticeText(notice: Notice | null): string {\n if (!notice) return '';\n const t = this.t;\n if (notice.kind === 'busy') return t[notice.what];\n if (notice.kind === 'info') return t.errors.aborted;\n return (t.errors as Record<string, string>)[notice.code] ?? t.errors.default;\n }\n\n view(state: ChatState) {\n const t = this.t;\n const drawer = this.mode === 'drawer';\n const agent = state.agents.find((a) => a.id === state.agentId) ?? null;\n const title = this.heading || agent?.name || t.title;\n const notice = state.notice;\n if (state.messages.length !== this.lastCount) {\n this.lastCount = state.messages.length;\n this.updateComplete.then(() => requestAnimationFrame(() => this.scrollDown()));\n }\n return html`\n <button\n class=\"launcher\"\n part=\"launcher\"\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded=${String(this.open)}\n aria-label=${t.open}\n ?hidden=${!drawer}\n @click=${() => this.setOpen(!this.open)}\n >\n <slot name=\"launcher\">${icon(ICON_CHAT)}</slot>\n </button>\n <section\n class=\"panel\"\n part=\"panel\"\n role=\"dialog\"\n aria-label=${title}\n aria-modal=${String(drawer)}\n ?hidden=${!this.shown}\n @keydown=${(ev: KeyboardEvent) => this.onPanelKey(ev)}\n >\n <header part=\"header\">\n <span class=\"title\">${title}</span>\n <select\n class=\"picker\"\n part=\"picker\"\n aria-label=${t.pickAgent}\n ?hidden=${state.agents.length < 2}\n @change=${(ev: Event) => this.pick((ev.target as HTMLSelectElement).value)}\n >\n ${state.agents.map(\n (a) => html`<option value=${a.id} ?selected=${a.id === state.agentId}>${a.name}</option>`,\n )}\n </select>\n <button class=\"icon new\" part=\"new\" type=\"button\" title=${t.newChat} aria-label=${t.newChat} @click=${() => this.startOver()}>\n ${icon(ICON_NEW)}\n </button>\n <button class=\"icon close\" part=\"close\" type=\"button\" title=${t.close} aria-label=${t.close} @click=${() => this.setOpen(false)}>\n ${icon(ICON_CLOSE)}\n </button>\n </header>\n <div class=\"messages\" part=\"messages\" role=\"log\" aria-live=\"polite\" aria-relevant=\"additions\">\n ${state.messages.length ? state.messages.map((m) => this.bubble(m)) : this.intro(state)}\n </div>\n <div class=\"turnstile\" ?hidden=${notice?.kind !== 'busy' || notice.what !== 'verifying'}></div>\n <div\n class=\"status ${notice?.kind === 'error' ? 'error' : ''} ${notice?.kind === 'busy' ? 'dots' : ''}\"\n part=\"status\"\n role=\"status\"\n >${this.noticeText(notice)}</div>\n <form part=\"composer\" @submit=${(ev: Event) => this.submit(ev, state)}>\n <label class=\"sr-only\" for=\"lf-input\">${t.placeholder}</label>\n <textarea\n id=\"lf-input\"\n part=\"input\"\n rows=\"1\"\n placeholder=${t.placeholder}\n @keydown=${(ev: KeyboardEvent) => this.onInputKey(ev, state)}\n @input=${(ev: Event) => this.autosize(ev.target as HTMLTextAreaElement)}\n ></textarea>\n <button class=\"send\" part=\"send\" type=\"submit\" aria-label=${state.answering ? t.stop : t.send}>\n ${state.answering ? t.stop : t.send}\n </button>\n </form>\n </section>\n `;\n }\n\n private bubble(m: ChatMessage) {\n if (m.role === 'user') {\n return html`<div class=\"msg user\" part=\"message user\">${m.text}</div>`;\n }\n return html`<div class=\"msg assistant\" part=\"message assistant\">\n ${renderMarkdown(m.text)}\n ${m.tools.length ? html`<div class=\"tools\">${this.t.usedTools}: ${m.tools.join(', ')}</div>` : ''}\n </div>`;\n }\n\n private intro(state: ChatState) {\n const agent = state.agents.find((a) => a.id === state.agentId);\n if (!agent?.welcome && !agent?.suggestions?.length) return '';\n return html`\n ${agent.welcome\n ? html`<div class=\"msg assistant welcome\">${renderMarkdown(agent.welcome)}</div>`\n : ''}\n ${agent.suggestions?.length\n ? html`<div class=\"suggestions\">\n ${agent.suggestions.map(\n (s) => html`<button type=\"button\" part=\"suggestion\" @click=${() => this.send(s)([state])}>${s}</button>`,\n )}\n </div>`\n : ''}\n `;\n }\n\n private scrollDown() {\n const m = this.shadowRoot?.querySelector('.messages');\n if (m) m.scrollTop = m.scrollHeight;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'lambforge-agent-chat': LambforgeAgentChat;\n }\n}\n", "import { html, TemplateResult } from '@rxdi/lit-html';\n\n/**\n * The agent's answer (markdown) as lit templates. Never HTML: every piece\n * of text is a lit text binding (escaped), links only for http(s) /\n * mailto, so an answer cannot inject markup or script.\n */\n\nconst SAFE_LINK = /^(https?:|mailto:)/i;\nconst BULLET = /^\\s*[-*+]\\s+/;\nconst NUMBERED = /^\\s*\\d+[.)]\\s+/;\nconst FENCE = /^```\\s*([\\w+-]*)\\s*$/;\nconst HEADING = /^(#{1,6})\\s+(.*)$/;\n\nexport function renderMarkdown(text: string): TemplateResult[] {\n const out: TemplateResult[] = [];\n const lines = String(text ?? '').replace(/\\r\\n?/g, '\\n').split('\\n');\n let i = 0;\n while (i < lines.length) {\n const line = lines[i];\n const fence = line.match(FENCE);\n if (fence) {\n const code: string[] = [];\n i++;\n while (i < lines.length && !/^```\\s*$/.test(lines[i])) code.push(lines[i++]);\n i++; // the closing fence (or the end)\n out.push(html`<pre><code data-lang=${fence[1] || ''}>${code.join('\\n')}</code></pre>`);\n continue;\n }\n const heading = line.match(HEADING);\n if (heading) {\n out.push(html`<p><strong class=\"h\">${inline(heading[2])}</strong></p>`);\n i++;\n continue;\n }\n if (BULLET.test(line) || NUMBERED.test(line)) {\n const ordered = NUMBERED.test(line);\n const marker = ordered ? NUMBERED : BULLET;\n const items: TemplateResult[] = [];\n while (i < lines.length && marker.test(lines[i])) {\n items.push(html`<li>${inline(lines[i++].replace(marker, ''))}</li>`);\n }\n out.push(ordered ? html`<ol>${items}</ol>` : html`<ul>${items}</ul>`);\n continue;\n }\n if (!line.trim()) {\n i++;\n continue;\n }\n const para: string[] = [];\n while (\n i < lines.length &&\n lines[i].trim() &&\n !/^```/.test(lines[i]) &&\n !HEADING.test(lines[i]) &&\n !BULLET.test(lines[i]) &&\n !NUMBERED.test(lines[i])\n ) {\n para.push(lines[i++]);\n }\n out.push(html`<p>${para.map((l, k) => (k ? html`<br />${inline(l)}` : inline(l)))}</p>`);\n }\n return out;\n}\n\nconst TOKEN =\n /(`[^`]+`)|(\\*\\*[^*]+\\*\\*)|(__[^_]+__)|(\\*[^*\\s][^*]*\\*)|(\\[[^\\]]+\\]\\([^)\\s]+\\))|(https?:\\/\\/[^\\s<>()]+[^\\s<>().,;:!?'\"])/;\n\nexport function inline(text: string): (TemplateResult | string)[] {\n const out: (TemplateResult | string)[] = [];\n let rest = text;\n while (rest) {\n const m = rest.match(TOKEN);\n if (!m || m.index === undefined) {\n out.push(rest);\n break;\n }\n if (m.index) out.push(rest.slice(0, m.index));\n const t = m[0];\n if (m[1]) out.push(html`<code>${t.slice(1, -1)}</code>`);\n else if (m[2] || m[3]) out.push(html`<strong>${inline(t.slice(2, -2))}</strong>`);\n else if (m[4]) out.push(html`<em>${inline(t.slice(1, -1))}</em>`);\n else if (m[5]) {\n const [, label, href] = t.match(/^\\[([^\\]]+)\\]\\(([^)\\s]+)\\)$/) ?? [];\n out.push(link(label, href));\n } else out.push(link(t, t));\n rest = rest.slice(m.index + t.length);\n }\n return out;\n}\n\nfunction link(label: string, href: string): TemplateResult | string {\n if (!SAFE_LINK.test(href)) return label;\n return html`<a href=${href} target=\"_blank\" rel=\"noopener noreferrer nofollow\">${label}</a>`;\n}\n", "var __assign = (this && this.__assign) || function () {\r\n __assign = Object.assign || function(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))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\nexport function action(type, config) {\r\n if (typeof config === \"function\") {\r\n return defineType(type, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n return (__assign(__assign({}, config.apply(void 0, args)), { type: type }));\r\n });\r\n }\r\n var as = config ? config._as : \"empty\";\r\n switch (as) {\r\n case \"empty\":\r\n return defineType(type, function () { return ({ type: type }); });\r\n case \"fsa\":\r\n return defineType(type, function (payload, meta) {\r\n return payload instanceof Error\r\n ? { error: true, meta: meta, payload: payload, type: type }\r\n : { error: false, meta: meta, payload: payload, type: type };\r\n });\r\n case \"payload\":\r\n return defineType(type, function (payload) { return ({ payload: payload, type: type }); });\r\n case \"props\":\r\n return defineType(type, function (props) { return (__assign(__assign({}, props), { type: type })); });\r\n default:\r\n throw new Error(\"Unexpected config.\");\r\n }\r\n}\r\nexport function empty() {\r\n return { _as: \"empty\" };\r\n}\r\nexport function fsa() {\r\n return { _as: \"fsa\", _m: undefined, _p: undefined };\r\n}\r\nexport function payload() {\r\n return { _as: \"payload\", _p: undefined };\r\n}\r\nexport function props() {\r\n return { _as: \"props\", _p: undefined };\r\n}\r\nexport function type(type, rest) {\r\n return __assign(__assign({}, rest), { type: type });\r\n}\r\nexport function union() {\r\n var creators = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n creators[_i] = arguments[_i];\r\n }\r\n var descriptor = {\r\n get: function () {\r\n throw new Error(\"Pseudo property not readable.\");\r\n },\r\n set: function () {\r\n throw new Error(\"Pseudo property not writable.\");\r\n }\r\n };\r\n var result = creators.map(function (_a) {\r\n var type = _a.type;\r\n return Object.defineProperty({ type: type }, \"action\", descriptor);\r\n });\r\n Object.defineProperties(result, {\r\n actions: descriptor,\r\n types: descriptor\r\n });\r\n return result;\r\n}\r\nfunction defineType(type, creator) {\r\n return Object.defineProperty(creator, \"type\", {\r\n value: type,\r\n writable: false\r\n });\r\n}\r\n", "var __spreadArrays = (this && this.__spreadArrays) || function () {\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\nexport function on() {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n var reducer = args.pop();\r\n var types = args.reduce(function (result, creator) { return __spreadArrays(result, [creator.type]); }, []);\r\n return { reducer: reducer, types: types };\r\n}\r\nexport function reducer(initialState) {\r\n var ons = [];\r\n for (var _i = 1; _i < arguments.length; _i++) {\r\n ons[_i - 1] = arguments[_i];\r\n }\r\n var map = new Map();\r\n for (var _a = 0, ons_1 = ons; _a < ons_1.length; _a++) {\r\n var on_1 = ons_1[_a];\r\n for (var _b = 0, _c = on_1.types; _b < _c.length; _b++) {\r\n var type = _c[_b];\r\n if (!map.has(type)) {\r\n map.set(type, on_1.reducer);\r\n }\r\n else {\r\n console.warn(type + \" already specified in an 'on' call.\");\r\n }\r\n }\r\n }\r\n return function (state, action) {\r\n if (state === void 0) { state = initialState; }\r\n var reducer = map.get(action.type);\r\n return reducer ? reducer(state, action) : state;\r\n };\r\n}\r\n", "import type {\n AgentErrorCode,\n AgentEvent,\n ConversationDetail,\n EmbedAgent,\n} from '@lambforge/agents';\nimport { action, payload } from 'ts-action';\n\n// --- shell ---\n/** The panel is on screen (nothing loads before the first time). */\nexport const shown = action('[chat] shown', payload<boolean>());\nexport const connecting = action('[chat] connecting');\nexport const failed = action('[chat] failed', payload<AgentErrorCode | string>());\nexport const verifying = action('[chat] verifying', payload<boolean>());\n\n// --- agents and conversations ---\nexport const agentsLoaded = action(\n '[chat] agents loaded',\n payload<{ agents: EmbedAgent[]; agentId: string | null }>(),\n);\nexport const pickAgent = action('[chat] pick agent', payload<string>());\nexport const historyLoaded = action(\n '[chat] history loaded',\n payload<{ agentId: string; detail: ConversationDetail }>(),\n);\nexport const newConversation = action('[chat] new conversation');\n\n// --- runs ---\n/** Where a message goes / what to stop (from the state the view shows). */\nexport interface RunTarget {\n agentId: string;\n /** null = a new conversation */\n conversationId: string | null;\n}\n/** The visitor sends a message (shown at once; the run effect sends it). */\nexport const sendMessage = action('[chat] send', payload<RunTarget & { text: string }>());\n/** Follow an answer that was already running (a page reload). */\nexport const resume = action(\n '[chat] resume',\n payload<{ agentId: string; conversationId: string; afterSeq: number }>(),\n);\nexport const agentEvent = action('[chat] event', payload<AgentEvent>());\nexport const runEnded = action('[chat] run ended');\n/** Stop the answer in progress (the abort effect tells the server). */\nexport const stop = action('[chat] stop', payload<RunTarget>());\n\nexport type ChatAction = ReturnType<\n | typeof shown\n | typeof connecting\n | typeof failed\n | typeof verifying\n | typeof agentsLoaded\n | typeof pickAgent\n | typeof historyLoaded\n | typeof newConversation\n | typeof sendMessage\n | typeof resume\n | typeof agentEvent\n | typeof runEnded\n | typeof stop\n>;\n", "import type { AgentClient, AgentConversation, AgentEvent, EmbedAgent } from '@lambforge/agents';\nimport { createEffect, ofType } from '@rxdi/redux-store';\nimport { concat, EMPTY, from, merge, Observable, of } from 'rxjs';\nimport {\n catchError,\n endWith,\n filter,\n ignoreElements,\n map,\n mergeMap,\n switchMap,\n take,\n takeUntil,\n takeWhile,\n tap,\n} from 'rxjs/operators';\n\nimport {\n agentEvent,\n agentsLoaded,\n ChatAction,\n connecting,\n failed,\n historyLoaded,\n newConversation,\n pickAgent,\n resume,\n runEnded,\n sendMessage,\n stop,\n} from './chat-actions';\nimport type { ChatState } from './chat-state';\n\ntype State$ = Observable<ChatState>;\n/** untyped like legends' effects: `ofType(creator)` types each payload */\ntype Action$ = Observable<any>;\n\n/** What the effects need from the element (no DI: one store per chat). */\nexport interface ChatContext {\n /** null = no session source configured */\n client: AgentClient | null;\n /** preferred agent (id or name) */\n agent: string;\n /** only these agents (ids or names); empty = all the session allows */\n agents: string[];\n /** DOM events on the element */\n emit(type: 'answer' | 'error', detail: Record<string, unknown>): void;\n}\n\nexport const errorCode = (e: unknown): string => (e as { code?: string })?.code || 'internal';\nconst fail = (e: unknown) => of(failed(errorCode(e)));\n\nexport function pickAgents(all: EmbedAgent[], ctx: Pick<ChatContext, 'agent' | 'agents'>) {\n const agents = ctx.agents.length\n ? all.filter((a) => ctx.agents.includes(a.id) || ctx.agents.includes(a.name))\n : all;\n const preferred = agents.find((a) => a.id === ctx.agent || a.name === ctx.agent) ?? agents[0];\n return { agents, agentId: preferred?.id ?? null };\n}\n\n/**\n * The chat's side effects: every request goes through here (the element\n * only dispatches). Registered in ChatStore's `createEpicRegistry(...)` -\n * an effect not listed there never runs.\n */\nexport class ChatEffects {\n constructor(private readonly ctx: ChatContext) {}\n\n /** The first time the panel is on screen: the agents this session may use. */\n connect$ = createEffect<ChatAction, ChatState>()((_action$: Action$, state$: State$) =>\n state$.pipe(\n filter((s) => s.shown),\n take(1),\n switchMap(() => {\n const client = this.ctx.client;\n if (!client) return of(failed('unauthorized'));\n return concat(\n of(connecting()),\n client.agents().pipe(\n take(1),\n map((all) => agentsLoaded(pickAgents(all, this.ctx))),\n catchError(fail),\n ),\n );\n }),\n ),\n );\n\n /** The selected agent's latest conversation (resuming a running answer). */\n select$ = createEffect<ChatAction, ChatState>()((action$: Action$) =>\n merge(\n action$.pipe(\n ofType(agentsLoaded),\n map(({ payload }) => payload.agentId),\n ),\n action$.pipe(\n ofType(pickAgent),\n map(({ payload }) => payload),\n ),\n ).pipe(\n filter((id): id is string => !!id),\n switchMap((agentId) => {\n const client = this.ctx.client!;\n return client.conversations(agentId).pipe(\n take(1),\n switchMap((list) => {\n const latest = list?.[0];\n if (!latest) return EMPTY;\n return client\n .agent(agentId)\n .conversation(latest.id)\n .history()\n .pipe(\n mergeMap((detail) =>\n from<ChatAction[]>([\n historyLoaded({ agentId, detail }),\n ...(detail.answering\n ? [resume({ agentId, conversationId: detail.id, afterSeq: detail.lastSeq ?? 0 })]\n : []),\n ]),\n ),\n );\n }),\n catchError(fail),\n );\n }),\n ),\n );\n\n /**\n * One run at a time: a sent message or a resumed answer, its events as\n * actions until done / error, cancelled by stop, another agent or a new\n * conversation.\n */\n run$ = createEffect<ChatAction, ChatState>()((action$: Action$) =>\n merge(\n action$.pipe(\n ofType(sendMessage),\n map(({ payload }) => {\n const { agentId, conversationId, text } = payload;\n const c = this.conversation(agentId, conversationId);\n return { c, events: c.send(text) };\n }),\n ),\n action$.pipe(\n ofType(resume),\n map(({ payload }) => {\n const { agentId, conversationId, afterSeq } = payload;\n const c = this.conversation(agentId, conversationId);\n return { c, events: c.events(afterSeq) };\n }),\n ),\n ).pipe(\n switchMap(({ c, events }) =>\n this.follow$(c, events).pipe(\n takeUntil(\n merge(\n action$.pipe(ofType(stop)),\n action$.pipe(ofType(pickAgent)),\n action$.pipe(ofType(newConversation)),\n ),\n ),\n endWith(runEnded()),\n ),\n ),\n ),\n );\n\n /** Tell the server to stop the answer. */\n abort$ = createEffect<ChatAction, ChatState>()((action$: Action$) =>\n action$.pipe(\n ofType(stop),\n mergeMap(({ payload }) => {\n const { agentId, conversationId } = payload;\n if (!conversationId || !this.ctx.client) return EMPTY;\n return this.conversation(agentId, conversationId).abort().pipe(\n ignoreElements(),\n catchError(() => EMPTY),\n );\n }),\n ),\n );\n\n /** Failures also reach the page as an `error` event. */\n failures$ = createEffect<ChatAction, ChatState>()((action$: Action$) =>\n action$.pipe(\n ofType(failed),\n tap(({ payload }) => this.ctx.emit('error', { code: payload })),\n ignoreElements(),\n ),\n );\n\n private conversation(agentId: string, conversationId: string | null) {\n return this.ctx.client!.agent(agentId).conversation(conversationId ?? undefined);\n }\n\n private follow$(c: AgentConversation, events: Observable<AgentEvent>): Action$ {\n const announced = new Set<string>();\n return events.pipe(\n takeWhile((e) => e.type !== 'done' && e.type !== 'error', true),\n tap((e) => {\n if (e.type === 'message' && e.data?.role === 'assistant' && !announced.has(e.data.id)) {\n announced.add(e.data.id);\n this.ctx.emit('answer', { text: e.data.text, agent: c.agent, conversationId: e.conversationId });\n }\n if (e.type === 'error') this.ctx.emit('error', { code: e.data?.code ?? 'internal' });\n }),\n map((e) => agentEvent(e) as ChatAction),\n catchError(fail),\n );\n }\n}\n", "import type { AgentErrorCode, AgentMessage, EmbedAgent } from '@lambforge/agents';\n\nexport interface ChatMessage {\n id: string;\n role: 'user' | 'assistant';\n text: string;\n /** distinct tool names the answer used */\n tools: string[];\n}\n\nexport type Notice =\n | { kind: 'busy'; what: 'connecting' | 'thinking' | 'verifying' }\n | { kind: 'error'; code: AgentErrorCode | string }\n | { kind: 'info'; what: 'stopped' };\n\nexport interface ChatState {\n /** the panel has been / is on screen */\n shown: boolean;\n agents: EmbedAgent[];\n agentId: string | null;\n /** null = a new conversation (created by the first message) */\n conversationId: string | null;\n messages: ChatMessage[];\n answering: boolean;\n notice: Notice | null;\n}\n\nexport const initialChatState: ChatState = {\n shown: false,\n agents: [],\n agentId: null,\n conversationId: null,\n messages: [],\n answering: false,\n notice: null,\n};\n\nexport function toMessage(m: AgentMessage): ChatMessage {\n const tools = (m.toolCalls ?? [])\n .map((c) => c?.name)\n .filter((n): n is string => !!n);\n return { id: m.id, role: m.role, text: m.text ?? '', tools: Array.from(new Set(tools)) };\n}\n", "import type { AgentEvent } from '@lambforge/agents';\nimport { on, reducer } from 'ts-action';\n\nimport {\n agentEvent,\n agentsLoaded,\n connecting,\n failed,\n historyLoaded,\n newConversation,\n pickAgent,\n runEnded,\n sendMessage,\n shown,\n stop,\n verifying,\n} from './chat-actions';\nimport { ChatState, initialChatState, toMessage } from './chat-state';\n\nconst LOCAL_ID = /^local:/;\nconst empty = { conversationId: null, messages: [], answering: false, notice: null };\n\nexport const chatReducer = reducer<ChatState>(\n initialChatState,\n\n on(shown, (s, { payload }) => (s.shown || !payload ? s : { ...s, shown: true })),\n on(connecting, (s) => ({ ...s, notice: { kind: 'busy', what: 'connecting' } })),\n on(failed, (s, { payload }) => ({\n ...s,\n answering: false,\n notice: { kind: 'error', code: payload },\n })),\n on(verifying, (s, { payload }) => ({\n ...s,\n notice: payload\n ? { kind: 'busy', what: 'verifying' }\n : s.notice?.kind === 'busy' && s.notice.what === 'verifying'\n ? null\n : s.notice,\n })),\n\n on(agentsLoaded, (s, { payload }) => ({\n ...s,\n agents: payload.agents,\n agentId: payload.agentId,\n notice: payload.agentId ? null : { kind: 'error', code: 'agent-unavailable' },\n })),\n on(pickAgent, (s, { payload }) => ({ ...s, ...empty, agentId: payload })),\n on(historyLoaded, (s, { payload }) =>\n payload.agentId !== s.agentId\n ? s\n : {\n ...s,\n conversationId: payload.detail.id,\n messages: (payload.detail.messages ?? []).map(toMessage),\n answering: !!payload.detail.answering,\n notice: payload.detail.answering ? { kind: 'busy', what: 'thinking' } : null,\n },\n ),\n on(newConversation, (s) => ({ ...s, ...empty })),\n\n on(sendMessage, (s, { payload }) => ({\n ...s,\n // shown at once; replaced by the stored copy when it arrives\n messages: [\n ...s.messages,\n { id: `local:${s.messages.length}`, role: 'user', text: payload.text, tools: [] },\n ],\n answering: true,\n notice: { kind: 'busy', what: 'thinking' },\n })),\n on(agentEvent, (s, { payload }) => withEvent(s, payload)),\n on(runEnded, (s) => ({\n ...s,\n answering: false,\n notice: s.notice?.kind === 'busy' ? null : s.notice,\n })),\n on(stop, (s) => ({ ...s, answering: false, notice: { kind: 'info', what: 'stopped' } })),\n);\n\nfunction withEvent(s: ChatState, event: AgentEvent): ChatState {\n const conversationId = s.conversationId ?? event.conversationId;\n if (event.conversationId !== conversationId) return s;\n if (event.type === 'error') {\n return { ...s, conversationId, notice: { kind: 'error', code: event.data?.code ?? 'internal' } };\n }\n if (event.type !== 'message' || !event.data?.id) return { ...s, conversationId };\n const message = toMessage(event.data);\n if (s.messages.some((m) => m.id === message.id)) return { ...s, conversationId };\n const messages = [...s.messages];\n const local =\n message.role === 'user'\n ? messages.findIndex((m) => LOCAL_ID.test(m.id) && m.text === message.text)\n : -1;\n if (local >= 0) messages[local] = message;\n else messages.push(message);\n return { ...s, conversationId, messages };\n}\n", "import { createEpicRegistry, createStore, Store } from '@rxdi/redux-store';\nimport { Observable, of, Subject } from 'rxjs';\nimport { distinctUntilChanged } from 'rxjs/operators';\n\nimport { ChatAction } from './chat-actions';\nimport { ChatContext, ChatEffects } from './chat-effects';\nimport { chatReducer } from './chat-reducer';\nimport { ChatState, initialChatState } from './chat-state';\n\n/**\n * One chat's store (`@rxdi/redux-store`, like legends' AdminStore): one\n * reducer, the effects in ChatEffects. One per element - a page may show\n * several chats - created when the element's State stream starts and\n * destroyed when it ends.\n */\nexport class ChatStore {\n private readonly destroy$ = new Subject<void>();\n private readonly store: Store<ChatState, ChatAction>;\n readonly state$: Observable<ChatState>;\n\n constructor(ctx: ChatContext, initial: Partial<ChatState> = {}) {\n const effects = new ChatEffects(ctx);\n this.store = createStore<ChatState, ChatAction>({\n reducer$: of(chatReducer),\n initialState$: of({ ...initialChatState, ...initial }),\n // RULE: every effect must be listed here or it never runs.\n // connect$ LAST: it can start at once (an inline chat is shown from\n // the first state) and the others must already listen to its actions.\n epic$: createEpicRegistry<ChatState, ChatAction>(\n effects.select$,\n effects.run$,\n effects.abort$,\n effects.failures$,\n effects.connect$,\n ),\n destroy$: this.destroy$,\n });\n this.state$ = this.store.state$.pipe(distinctUntilChanged());\n }\n\n dispatch(action: ChatAction): void {\n this.store.dispatch(action);\n }\n\n destroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n}\n", "import type { AgentErrorCode } from '@lambforge/agents';\n\n/** Every text the chat shows - override any with `.strings`. */\nexport interface ChatStrings {\n title: string;\n open: string;\n close: string;\n newChat: string;\n placeholder: string;\n send: string;\n stop: string;\n thinking: string;\n connecting: string;\n pickAgent: string;\n usedTools: string;\n verifying: string;\n errors: Record<AgentErrorCode | 'default', string>;\n}\n\nconst en: ChatStrings = {\n title: 'Chat',\n open: 'Open chat',\n close: 'Close chat',\n newChat: 'New conversation',\n placeholder: 'Type a message',\n send: 'Send',\n stop: 'Stop',\n thinking: 'Thinking',\n connecting: 'Connecting',\n pickAgent: 'Assistant',\n usedTools: 'Used',\n verifying: 'Checking that you are human',\n errors: {\n 'limit-reached': 'This conversation is full - start a new one.',\n 'cap-reached': 'The assistant is not available right now - try again later.',\n 'agent-unavailable': 'This assistant is not available.',\n 'session-expired': 'Your session ended - reload the page.',\n 'credential-expired': 'Please sign in again.',\n aborted: 'Stopped.',\n internal: 'Something went wrong - try again.',\n unauthorized: 'This chat is not allowed here.',\n 'bad-request': 'That did not work - try again.',\n network: 'No connection - try again.',\n default: 'Something went wrong - try again.',\n },\n};\n\nconst bg: ChatStrings = {\n title: '\u0427\u0430\u0442',\n open: '\u041E\u0442\u0432\u043E\u0440\u0438 \u0447\u0430\u0442\u0430',\n close: '\u0417\u0430\u0442\u0432\u043E\u0440\u0438 \u0447\u0430\u0442\u0430',\n newChat: '\u041D\u043E\u0432 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440',\n placeholder: '\u041D\u0430\u043F\u0438\u0448\u0435\u0442\u0435 \u0441\u044A\u043E\u0431\u0449\u0435\u043D\u0438\u0435',\n send: '\u0418\u0437\u043F\u0440\u0430\u0442\u0438',\n stop: '\u0421\u043F\u0440\u0438',\n thinking: '\u041C\u0438\u0441\u043B\u044F',\n connecting: '\u0421\u0432\u044A\u0440\u0437\u0432\u0430\u043D\u0435',\n pickAgent: '\u0410\u0441\u0438\u0441\u0442\u0435\u043D\u0442',\n usedTools: '\u0418\u0437\u043F\u043E\u043B\u0437\u0432\u0430\u043D\u043E',\n verifying: '\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430, \u0447\u0435 \u0441\u0442\u0435 \u0447\u043E\u0432\u0435\u043A',\n errors: {\n 'limit-reached': '\u0420\u0430\u0437\u0433\u043E\u0432\u043E\u0440\u044A\u0442 \u0435 \u043F\u044A\u043B\u0435\u043D - \u0437\u0430\u043F\u043E\u0447\u043D\u0435\u0442\u0435 \u043D\u043E\u0432.',\n 'cap-reached': '\u0410\u0441\u0438\u0441\u0442\u0435\u043D\u0442\u044A\u0442 \u043D\u0435 \u0435 \u0434\u043E\u0441\u0442\u044A\u043F\u0435\u043D \u0432 \u043C\u043E\u043C\u0435\u043D\u0442\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043F\u043E-\u043A\u044A\u0441\u043D\u043E.',\n 'agent-unavailable': '\u0422\u043E\u0437\u0438 \u0430\u0441\u0438\u0441\u0442\u0435\u043D\u0442 \u043D\u0435 \u0435 \u0434\u043E\u0441\u0442\u044A\u043F\u0435\u043D.',\n 'session-expired': '\u0421\u0435\u0441\u0438\u044F\u0442\u0430 \u0438\u0437\u0442\u0435\u0447\u0435 - \u043F\u0440\u0435\u0437\u0430\u0440\u0435\u0434\u0435\u0442\u0435 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430\u0442\u0430.',\n 'credential-expired': '\u041C\u043E\u043B\u044F, \u0432\u043B\u0435\u0437\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.',\n aborted: '\u0421\u043F\u0440\u044F\u043D\u043E.',\n internal: '\u041D\u0435\u0449\u043E \u0441\u0435 \u043E\u0431\u044A\u0440\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.',\n unauthorized: '\u0422\u043E\u0437\u0438 \u0447\u0430\u0442 \u043D\u0435 \u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D \u0442\u0443\u043A.',\n 'bad-request': '\u041D\u0435 \u0441\u0435 \u043F\u043E\u043B\u0443\u0447\u0438 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.',\n network: '\u041D\u044F\u043C\u0430 \u0432\u0440\u044A\u0437\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.',\n default: '\u041D\u0435\u0449\u043E \u0441\u0435 \u043E\u0431\u044A\u0440\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.',\n },\n};\n\nexport const LOCALES: Record<string, ChatStrings> = { en, bg };\n\n/** The locale's strings (by language, `bg-BG` -> `bg`) with overrides. */\nexport function stringsFor(\n locale: string | null | undefined,\n overrides: Partial<ChatStrings> = {},\n): ChatStrings {\n const lang = String(locale || 'en').toLowerCase().split('-')[0];\n const base = LOCALES[lang] ?? en;\n return {\n ...base,\n ...overrides,\n errors: { ...base.errors, ...(overrides.errors ?? {}) },\n };\n}\n", "/** Shadow-DOM styles. Theme with `--lf-chat-*` variables or `::part()`. */\nexport const STYLES = `\n:host {\n --_accent: var(--lf-chat-accent, #4f46e5);\n --_accent-fg: var(--lf-chat-accent-fg, #ffffff);\n --_bg: var(--lf-chat-bg, #ffffff);\n --_fg: var(--lf-chat-fg, #111827);\n --_muted: var(--lf-chat-muted, #6b7280);\n --_border: var(--lf-chat-border, #e5e7eb);\n --_bot-bg: var(--lf-chat-bot-bg, #f3f4f6);\n --_bot-fg: var(--lf-chat-bot-fg, var(--_fg));\n --_user-bg: var(--lf-chat-user-bg, var(--_accent));\n --_user-fg: var(--lf-chat-user-fg, var(--_accent-fg));\n --_error: var(--lf-chat-error, #b91c1c);\n --_radius: var(--lf-chat-radius, 12px);\n --_font: var(--lf-chat-font, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);\n --_width: var(--lf-chat-width, 380px);\n --_height: var(--lf-chat-height, min(640px, calc(100vh - 120px)));\n --_offset: var(--lf-chat-offset, 20px);\n --_z: var(--lf-chat-z-index, 2147483000);\n --_launcher: var(--lf-chat-launcher-size, 56px);\n --_shadow: var(--lf-chat-shadow, 0 12px 40px rgba(0, 0, 0, 0.18));\n font-family: var(--_font);\n color: var(--_fg);\n font-size: 15px;\n line-height: 1.45;\n}\n:host([theme='dark']) {\n --_bg: var(--lf-chat-bg, #111827);\n --_fg: var(--lf-chat-fg, #f9fafb);\n --_muted: var(--lf-chat-muted, #9ca3af);\n --_border: var(--lf-chat-border, #374151);\n --_bot-bg: var(--lf-chat-bot-bg, #1f2937);\n --_error: var(--lf-chat-error, #f87171);\n}\n* { box-sizing: border-box; }\n[hidden] { display: none !important; }\nbutton { font: inherit; cursor: pointer; }\n\n.launcher {\n position: fixed;\n bottom: var(--_offset);\n right: var(--_offset);\n width: var(--_launcher);\n height: var(--_launcher);\n border-radius: 50%;\n border: 0;\n background: var(--_accent);\n color: var(--_accent-fg);\n box-shadow: var(--_shadow);\n z-index: var(--_z);\n display: grid;\n place-items: center;\n}\n:host([position='bottom-left']) .launcher { right: auto; left: var(--_offset); }\n.launcher svg { width: 26px; height: 26px; }\n\n.panel {\n display: flex;\n flex-direction: column;\n background: var(--_bg);\n color: var(--_fg);\n border: 1px solid var(--_border);\n border-radius: var(--_radius);\n overflow: hidden;\n}\n:host(:not([mode])) .panel,\n:host([mode='drawer']) .panel {\n position: fixed;\n bottom: calc(var(--_offset) + var(--_launcher) + 12px);\n right: var(--_offset);\n width: var(--_width);\n height: var(--_height);\n box-shadow: var(--_shadow);\n z-index: var(--_z);\n}\n:host([position='bottom-left']) .panel { right: auto; left: var(--_offset); }\n:host([mode='inline']) .panel { width: 100%; height: var(--lf-chat-height, 560px); }\n:host([mode='fullscreen']) .panel {\n position: fixed; inset: 0; border-radius: 0; border: 0; z-index: var(--_z);\n}\n@media (max-width: 640px) {\n :host(:not([mode])) .panel,\n :host([mode='drawer']) .panel {\n inset: 0; width: auto; height: auto; border-radius: 0; border: 0;\n height: 100dvh;\n }\n}\n\nheader {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 10px 12px;\n border-bottom: 1px solid var(--_border);\n}\nheader .title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\nheader select {\n font: inherit; color: inherit; background: transparent;\n border: 1px solid var(--_border); border-radius: 8px; padding: 4px 6px; max-width: 45%;\n}\n.icon {\n border: 0; background: transparent; color: var(--_muted);\n width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;\n}\n.icon:hover, .icon:focus-visible { background: var(--_bot-bg); color: var(--_fg); }\n.icon svg { width: 18px; height: 18px; }\n:host([mode='inline']) .close { display: none; }\n\n.messages {\n flex: 1;\n overflow-y: auto;\n padding: 14px 12px;\n display: flex;\n flex-direction: column;\n gap: 10px;\n scrollbar-width: thin;\n}\n.msg { max-width: 85%; padding: 8px 12px; border-radius: var(--_radius); overflow-wrap: anywhere; }\n.msg.user { align-self: flex-end; background: var(--_user-bg); color: var(--_user-fg); white-space: pre-wrap; }\n.msg.assistant { align-self: flex-start; background: var(--_bot-bg); color: var(--_bot-fg); }\n.msg p { margin: 0 0 6px; }\n.msg p:last-child { margin-bottom: 0; }\n.msg ul, .msg ol { margin: 4px 0 6px; padding-left: 20px; }\n.msg pre { margin: 6px 0; padding: 8px; overflow-x: auto; border-radius: 8px; background: rgba(0,0,0,0.06); font-size: 13px; }\n.msg code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }\n.msg a { color: inherit; }\n.tools { font-size: 12px; color: var(--_muted); margin-top: 4px; }\n\n.welcome { color: var(--_muted); }\n.suggestions { display: flex; flex-wrap: wrap; gap: 6px; }\n.suggestions button {\n border: 1px solid var(--_border); background: transparent; color: var(--_fg);\n border-radius: 999px; padding: 6px 10px; font-size: 13px; text-align: left;\n}\n.suggestions button:hover, .suggestions button:focus-visible { border-color: var(--_accent); }\n\n.status { font-size: 13px; color: var(--_muted); padding: 0 12px 6px; min-height: 0; }\n.status.error { color: var(--_error); }\n.dots::after { content: '...'; animation: dots 1.2s steps(4, end) infinite; display: inline-block; width: 1.2em; overflow: hidden; vertical-align: bottom; }\n@keyframes dots { from { width: 0; } to { width: 1.2em; } }\n@media (prefers-reduced-motion: reduce) { .dots::after { animation: none; } }\n\n.turnstile { padding: 0 12px 6px; }\n.turnstile iframe { border: 0; width: 100%; height: 70px; }\n\nform {\n display: flex;\n gap: 8px;\n padding: 10px 12px;\n border-top: 1px solid var(--_border);\n align-items: flex-end;\n}\ntextarea {\n flex: 1;\n resize: none;\n font: inherit;\n color: inherit;\n background: transparent;\n border: 1px solid var(--_border);\n border-radius: 10px;\n padding: 8px 10px;\n max-height: 140px;\n min-height: 40px;\n}\ntextarea:focus-visible { outline: 2px solid var(--_accent); outline-offset: 0; border-color: transparent; }\n.send {\n border: 0; border-radius: 10px; background: var(--_accent); color: var(--_accent-fg);\n padding: 0 14px; height: 40px; font-weight: 600;\n}\n.send:disabled { opacity: 0.5; cursor: default; }\n.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n`;\n", "/**\n * A Cloudflare Turnstile token for an anonymous session. Either the site's\n * own widget (`sitekey`; its hostname must be one of the publishable key's\n * sites) or Lambforge's hosted challenge page in an iframe, which posts\n * the token back to this page only (`postMessage` to our origin).\n */\n\nexport const HOSTED_TURNSTILE_URL = 'https://lambforge.com/agent-turnstile.html';\nconst SCRIPT = 'https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit';\nconst TIMEOUT_MS = 120_000;\n\ninterface TurnstileApi {\n render(\n el: HTMLElement,\n opts: Record<string, unknown>,\n ): string | undefined;\n remove(id: string): void;\n}\n\nlet loading: Promise<TurnstileApi> | null = null;\n\nfunction loadTurnstile(doc: Document): Promise<TurnstileApi> {\n const win = doc.defaultView as unknown as { turnstile?: TurnstileApi };\n if (win?.turnstile) return Promise.resolve(win.turnstile);\n if (!loading) {\n loading = new Promise<TurnstileApi>((resolve, reject) => {\n const s = doc.createElement('script');\n s.src = SCRIPT;\n s.async = true;\n s.onload = () =>\n win.turnstile ? resolve(win.turnstile) : reject(new Error('turnstile did not load'));\n s.onerror = () => {\n loading = null;\n reject(new Error('turnstile did not load'));\n };\n doc.head.append(s);\n });\n }\n return loading;\n}\n\nexport function turnstileToken(opts: {\n host: HTMLElement;\n sitekey?: string | null;\n hostedUrl?: string | null;\n}): Promise<string> {\n const doc = opts.host.ownerDocument;\n if (opts.sitekey) {\n return loadTurnstile(doc).then(\n (api) =>\n new Promise<string>((resolve, reject) => {\n const box = doc.createElement('div');\n opts.host.append(box);\n let id: string | undefined;\n const end = () => {\n try {\n if (id) api.remove(id);\n } catch {\n /* gone */\n }\n box.remove();\n };\n id = api.render(box, {\n sitekey: opts.sitekey,\n appearance: 'interaction-only',\n callback: (token: string) => {\n end();\n resolve(token);\n },\n 'error-callback': () => {\n end();\n reject(new Error('turnstile failed'));\n },\n });\n }),\n );\n }\n const url = new URL(opts.hostedUrl || HOSTED_TURNSTILE_URL);\n const win = doc.defaultView!;\n url.searchParams.set('origin', win.location.origin);\n return new Promise<string>((resolve, reject) => {\n const frame = doc.createElement('iframe');\n frame.title = 'Bot check';\n frame.src = url.href;\n const timer = setTimeout(() => done(new Error('turnstile timed out')), TIMEOUT_MS);\n const onMessage = (ev: MessageEvent) => {\n if (ev.origin !== url.origin || ev.source !== frame.contentWindow) return;\n const data = ev.data as { type?: string; token?: string; error?: string };\n if (data?.type !== 'lambforge-turnstile') return;\n if (data.token) done(null, data.token);\n else done(new Error(data.error || 'turnstile failed'));\n };\n const done = (err: Error | null, token?: string) => {\n clearTimeout(timer);\n win.removeEventListener('message', onMessage);\n frame.remove();\n if (err) reject(err);\n else resolve(token!);\n };\n win.addEventListener('message', onMessage);\n opts.host.append(frame);\n });\n}\n", "import { TAG } from './index';\n\n/**\n * The script-tag build (agent-chat.js): the element (registered by its\n * decorator) and, when the\n * script tag carries data-* settings, adds the chat to the page:\n *\n * <script src=\".../agent-chat.js\" data-key=\"lfp_...\" data-agent=\"Support\"></script>\n */\nconst script = document.currentScript as HTMLScriptElement | null;\nconst ATTRS: Record<string, string> = {\n key: 'publishable-key',\n tokenUrl: 'token-url',\n agent: 'agent',\n agents: 'agents',\n url: 'url',\n mode: 'mode',\n position: 'position',\n locale: 'locale',\n title: 'title',\n theme: 'theme',\n open: 'open',\n turnstileSitekey: 'turnstile-sitekey',\n turnstileUrl: 'turnstile-url',\n};\n\nif (script && (script.dataset.key || script.dataset.tokenUrl)) {\n const mount = () => {\n const el = document.createElement(TAG);\n for (const [data, attr] of Object.entries(ATTRS)) {\n const value = script.dataset[data];\n if (value !== undefined) el.setAttribute(attr, value);\n }\n document.body.append(el);\n };\n if (document.body) mount();\n else document.addEventListener('DOMContentLoaded', mount, { once: true });\n}\n"],
5
+ "mappings": "+3BAuBO,SAASA,EAAUC,EAAGC,EAAG,CAC9B,GAAI,OAAOA,GAAM,YAAcA,IAAM,KACjC,MAAM,IAAI,UAAU,uBAAyB,OAAOA,CAAC,EAAI,+BAA+B,EAC5FC,GAAcF,EAAGC,CAAC,EAClB,SAASE,GAAK,CAAE,KAAK,YAAcH,CAAG,CACtCA,EAAE,UAAYC,IAAM,KAAO,OAAO,OAAOA,CAAC,GAAKE,EAAG,UAAYF,EAAE,UAAW,IAAIE,EACjF,CAqFO,SAASC,GAAUC,EAASC,EAAYC,EAAGC,EAAW,CAC3D,SAASC,EAAMC,EAAO,CAAE,OAAOA,aAAiBH,EAAIG,EAAQ,IAAIH,EAAE,SAAUI,EAAS,CAAEA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AAAC,GAAA,YAAAC,GAAA,gBAAAC,GAAA,UAAAC,GAAA,cAAAC,GAAA,YAAAC,GAAA,UAAAC,GAAA,WAAAC,GAAA,gBAAAC,GAAA,eAAAC,GAAA,iBAAAC,GAAA,eAAAC,GAAA,mBAAAC,GAAA,QAAAC,GAAA,WAAAC,GAAA,YAAAC,KAAA,IAAAC,GAAAC,EAAA,KAAAC,IACAC,KAGAC,KACAC,KAGAC,KACAC,KACAC,KACAC,KAGAC,KACAC,KACAC,KACAC,KACAC,KACAC,KAGAC,KACAC,KAGAC,KAGAC,KACAC,KACAC,KACAC,KAGAC,KACAC,KAGAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KAGAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KAGApB,KACAS,KAGAY,KAGAC,KAGAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACA7H,KACA8H,KACAC,KACAC,KACAC,KACAC,KAC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opt", "value", "resolve", "reject", "fulfilled", "step", "e", "rejected", "result", "__generator", "body", "_", "t", "f", "y", "g", "verb", "n", "v", "op", "__values", "o", "s", "m", "i", "__read", "r", "ar", "error", "__spreadArray", "to", "from", "pack", "l", "__await", "__asyncGenerator", "q", "awaitReturn", "a", "resume", "settle", "fulfill", "__asyncValues", "init_tslib_es6", "__esmMin", "p", "isFunction", "value", "init_isFunction", "__esmMin", "createErrorClass", "createImpl", "_super", "instance", "ctorFunc", "init_createErrorClass", "__esmMin", "UnsubscriptionError", "init_UnsubscriptionError", "__esmMin", "init_createErrorClass", "createErrorClass", "_super", "errors", "err", "i", "arrRemove", "arr", "item", "index", "init_arrRemove", "__esmMin", "isSubscription", "value", "Subscription", "isFunction", "execFinalizer", "finalizer", "EMPTY_SUBSCRIPTION", "init_isFunction", "init_UnsubscriptionError", "init_arrRemove", "initialTeardown", "errors", "_parentage", "_parentage_1", "__values", "_parentage_1_1", "parent_1", "initialFinalizer", "e", "UnsubscriptionError", "_finalizers", "_finalizers_1", "_finalizers_1_1", "err", "__spreadArray", "__read", "teardown", "_a", "parent", "arrRemove", "empty", "config", "init_config", "__esmMin", "timeoutProvider", "handler", "timeout", "args", "_i", "delegate", "__spreadArray", "__read", "handle", "reportUnhandledError", "err", "timeoutProvider", "onUnhandledError", "config", "init_reportUnhandledError", "__esmMin", "init_config", "init_timeoutProvider", "noop", "init_noop", "__esmMin", "errorNotification", "error", "createNotification", "nextNotification", "value", "kind", "COMPLETE_NOTIFICATION", "init_NotificationFactories", "__esmMin", "errorContext", "cb", "config", "isRoot", "context", "_a", "errorThrown", "error", "captureError", "err", "init_errorContext", "__esmMin", "init_config", "bind", "fn", "thisArg", "_bind", "handleUnhandledError", "error", "config", "captureError", "reportUnhandledError", "defaultErrorHandler", "err", "handleStoppedNotification", "notification", "subscriber", "onStoppedNotification", "timeoutProvider", "Subscriber", "ConsumerObserver", "SafeSubscriber", "EMPTY_OBSERVER", "init_isFunction", "init_Subscription", "init_config", "init_reportUnhandledError", "init_noop", "init_NotificationFactories", "init_timeoutProvider", "init_errorContext", "_super", "__extends", "destination", "_this", "isSubscription", "next", "complete", "value", "nextNotification", "errorNotification", "COMPLETE_NOTIFICATION", "Subscription", "partialObserver", "observerOrNext", "isFunction", "context_1", "noop", "observable", "init_observable", "__esmMin", "identity", "x", "init_identity", "__esmMin", "pipe", "fns", "_i", "pipeFromArray", "identity", "input", "prev", "fn", "init_pipe", "__esmMin", "init_identity", "getPromiseCtor", "promiseCtor", "_a", "config", "isObserver", "value", "isFunction", "isSubscriber", "Subscriber", "isSubscription", "Observable", "init_Observable", "__esmMin", "init_Subscriber", "init_Subscription", "init_observable", "init_pipe", "init_config", "init_isFunction", "init_errorContext", "subscribe", "operator", "observable", "observerOrNext", "error", "complete", "_this", "subscriber", "SafeSubscriber", "errorContext", "source", "sink", "err", "next", "resolve", "reject", "operations", "_i", "pipeFromArray", "x", "hasLift", "source", "isFunction", "operate", "init", "liftedSource", "err", "init_lift", "__esmMin", "init_isFunction", "createOperatorSubscriber", "destination", "onNext", "onComplete", "onError", "onFinalize", "OperatorSubscriber", "init_Subscriber", "_super", "__extends", "shouldUnsubscribe", "_this", "value", "err", "closed_1", "_a", "Subscriber", "refCount", "operate", "source", "subscriber", "connection", "refCounter", "createOperatorSubscriber", "sharedConnection", "conn", "init_refCount", "__esmMin", "init_lift", "init_OperatorSubscriber", "ConnectableObservable", "init_Observable", "init_Subscription", "init_refCount", "init_OperatorSubscriber", "init_lift", "_super", "__extends", "source", "subjectFactory", "_this", "hasLift", "subscriber", "subject", "_connection", "connection", "Subscription", "subject_1", "createOperatorSubscriber", "err", "refCount", "Observable", "performanceTimestampProvider", "init_performanceTimestampProvider", "__esmMin", "animationFrameProvider", "init_Subscription", "callback", "request", "cancel", "delegate", "handle", "timestamp", "Subscription", "args", "_i", "__spreadArray", "__read", "animationFrames", "timestampProvider", "animationFramesFactory", "DEFAULT_ANIMATION_FRAMES", "Observable", "subscriber", "provider", "performanceTimestampProvider", "start", "id", "run", "animationFrameProvider", "timestamp", "now", "init_animationFrames", "__esmMin", "init_Observable", "init_performanceTimestampProvider", "init_animationFrameProvider", "ObjectUnsubscribedError", "init_ObjectUnsubscribedError", "__esmMin", "init_createErrorClass", "createErrorClass", "_super", "Subject", "AnonymousSubject", "init_Observable", "init_Subscription", "init_ObjectUnsubscribedError", "init_arrRemove", "init_errorContext", "_super", "__extends", "_this", "operator", "subject", "ObjectUnsubscribedError", "value", "errorContext", "_b", "__values", "_c", "observer", "err", "observers", "_a", "subscriber", "hasError", "isStopped", "EMPTY_SUBSCRIPTION", "Subscription", "arrRemove", "thrownError", "observable", "Observable", "destination", "source", "BehaviorSubject", "init_Subject", "_super", "__extends", "_value", "_this", "subscriber", "subscription", "_a", "hasError", "thrownError", "value", "Subject", "dateTimestampProvider", "init_dateTimestampProvider", "__esmMin", "ReplaySubject", "init_Subject", "init_dateTimestampProvider", "_super", "__extends", "_bufferSize", "_windowTime", "_timestampProvider", "dateTimestampProvider", "_this", "value", "_a", "isStopped", "_buffer", "_infiniteTimeWindow", "subscriber", "subscription", "copy", "i", "adjustedBufferSize", "now", "last", "Subject", "AsyncSubject", "init_Subject", "_super", "__extends", "_this", "subscriber", "_a", "hasError", "_hasValue", "_value", "thrownError", "isStopped", "_isComplete", "value", "Subject", "Action", "init_Subscription", "_super", "__extends", "scheduler", "work", "state", "delay", "Subscription", "intervalProvider", "handler", "timeout", "args", "_i", "delegate", "__spreadArray", "__read", "handle", "AsyncAction", "init_Action", "init_intervalProvider", "init_arrRemove", "_super", "__extends", "scheduler", "work", "_this", "state", "delay", "id", "_a", "_id", "intervalProvider", "_scheduler", "error", "_delay", "errored", "errorValue", "e", "actions", "arrRemove", "Action", "findAndClearHandle", "handle", "activeHandles", "nextHandle", "resolved", "Immediate", "init_Immediate", "__esmMin", "cb", "setImmediate", "clearImmediate", "immediateProvider", "init_Immediate", "Immediate", "args", "_i", "delegate", "__spreadArray", "__read", "handle", "AsapAction", "init_AsyncAction", "init_immediateProvider", "_super", "__extends", "scheduler", "work", "_this", "id", "delay", "immediateProvider", "actions", "_a", "AsyncAction", "Scheduler", "init_Scheduler", "__esmMin", "init_dateTimestampProvider", "schedulerActionCtor", "now", "work", "delay", "state", "dateTimestampProvider", "AsyncScheduler", "init_Scheduler", "_super", "__extends", "SchedulerAction", "now", "Scheduler", "_this", "action", "actions", "error", "AsapScheduler", "init_AsyncScheduler", "_super", "__extends", "action", "flushId", "actions", "error", "AsyncScheduler", "asapScheduler", "asap", "init_asap", "__esmMin", "init_AsapAction", "init_AsapScheduler", "AsapScheduler", "AsapAction", "asyncScheduler", "async", "init_async", "__esmMin", "init_AsyncAction", "init_AsyncScheduler", "AsyncScheduler", "AsyncAction", "QueueAction", "init_AsyncAction", "_super", "__extends", "scheduler", "work", "_this", "state", "delay", "id", "AsyncAction", "QueueScheduler", "init_AsyncScheduler", "_super", "__extends", "AsyncScheduler", "queueScheduler", "queue", "init_queue", "__esmMin", "init_QueueAction", "init_QueueScheduler", "QueueScheduler", "QueueAction", "AnimationFrameAction", "init_AsyncAction", "init_animationFrameProvider", "_super", "__extends", "scheduler", "work", "_this", "id", "delay", "animationFrameProvider", "actions", "_a", "AsyncAction", "AnimationFrameScheduler", "init_AsyncScheduler", "_super", "__extends", "action", "flushId", "actions", "error", "AsyncScheduler", "animationFrameScheduler", "animationFrame", "init_animationFrame", "__esmMin", "init_AnimationFrameAction", "init_AnimationFrameScheduler", "AnimationFrameScheduler", "AnimationFrameAction", "VirtualTimeScheduler", "VirtualAction", "init_AsyncAction", "init_Subscription", "init_AsyncScheduler", "_super", "__extends", "schedulerActionCtor", "maxFrames", "_this", "_a", "actions", "error", "action", "AsyncScheduler", "scheduler", "work", "index", "state", "delay", "Subscription", "id", "a", "b", "AsyncAction", "empty", "scheduler", "emptyScheduled", "EMPTY", "Observable", "subscriber", "init_empty", "__esmMin", "init_Observable", "isScheduler", "value", "isFunction", "init_isScheduler", "__esmMin", "init_isFunction", "last", "arr", "popResultSelector", "args", "isFunction", "popScheduler", "isScheduler", "popNumber", "defaultValue", "init_args", "__esmMin", "init_isFunction", "init_isScheduler", "isArrayLike", "init_isArrayLike", "__esmMin", "x", "isPromise", "value", "isFunction", "init_isPromise", "__esmMin", "init_isFunction", "isInteropObservable", "input", "isFunction", "observable", "init_isInteropObservable", "__esmMin", "init_observable", "init_isFunction", "isAsyncIterable", "obj", "isFunction", "init_isAsyncIterable", "__esmMin", "init_isFunction", "createInvalidObservableTypeError", "input", "init_throwUnobservableError", "__esmMin", "getSymbolIterator", "iterator", "init_iterator", "__esmMin", "isIterable", "input", "isFunction", "iterator", "init_isIterable", "__esmMin", "init_iterator", "init_isFunction", "readableStreamLikeToAsyncGenerator", "readableStream", "reader", "__await", "_a", "_b", "value", "done", "isReadableStreamLike", "obj", "isFunction", "init_isFunction", "innerFrom", "input", "Observable", "isInteropObservable", "fromInteropObservable", "isArrayLike", "fromArrayLike", "isPromise", "fromPromise", "isAsyncIterable", "fromAsyncIterable", "isIterable", "fromIterable", "isReadableStreamLike", "fromReadableStreamLike", "createInvalidObservableTypeError", "obj", "subscriber", "obs", "observable", "isFunction", "array", "i", "promise", "value", "err", "reportUnhandledError", "iterable", "iterable_1", "__values", "iterable_1_1", "asyncIterable", "process", "readableStream", "readableStreamLikeToAsyncGenerator", "asyncIterable_1", "__asyncValues", "asyncIterable_1_1", "init_isArrayLike", "init_isPromise", "init_Observable", "init_isInteropObservable", "init_isAsyncIterable", "init_throwUnobservableError", "init_isIterable", "init_isReadableStreamLike", "init_isFunction", "init_reportUnhandledError", "init_observable", "executeSchedule", "parentSubscription", "scheduler", "work", "delay", "repeat", "scheduleSubscription", "init_executeSchedule", "__esmMin", "observeOn", "scheduler", "delay", "operate", "source", "subscriber", "createOperatorSubscriber", "value", "executeSchedule", "err", "init_observeOn", "__esmMin", "init_executeSchedule", "init_lift", "init_OperatorSubscriber", "subscribeOn", "scheduler", "delay", "operate", "source", "subscriber", "init_subscribeOn", "__esmMin", "init_lift", "scheduleObservable", "input", "scheduler", "innerFrom", "subscribeOn", "observeOn", "init_scheduleObservable", "__esmMin", "init_innerFrom", "init_observeOn", "init_subscribeOn", "schedulePromise", "input", "scheduler", "innerFrom", "subscribeOn", "observeOn", "init_schedulePromise", "__esmMin", "init_innerFrom", "init_observeOn", "init_subscribeOn", "scheduleArray", "input", "scheduler", "Observable", "subscriber", "i", "init_scheduleArray", "__esmMin", "init_Observable", "scheduleIterable", "input", "scheduler", "Observable", "subscriber", "iterator", "executeSchedule", "value", "done", "_a", "err", "isFunction", "init_scheduleIterable", "__esmMin", "init_Observable", "init_iterator", "init_isFunction", "init_executeSchedule", "scheduleAsyncIterable", "input", "scheduler", "Observable", "subscriber", "executeSchedule", "iterator", "result", "init_scheduleAsyncIterable", "__esmMin", "init_Observable", "init_executeSchedule", "scheduleReadableStreamLike", "input", "scheduler", "scheduleAsyncIterable", "readableStreamLikeToAsyncGenerator", "init_scheduleReadableStreamLike", "__esmMin", "init_scheduleAsyncIterable", "init_isReadableStreamLike", "scheduled", "input", "scheduler", "isInteropObservable", "scheduleObservable", "isArrayLike", "scheduleArray", "isPromise", "schedulePromise", "isAsyncIterable", "scheduleAsyncIterable", "isIterable", "scheduleIterable", "isReadableStreamLike", "scheduleReadableStreamLike", "createInvalidObservableTypeError", "init_scheduled", "__esmMin", "init_scheduleObservable", "init_schedulePromise", "init_scheduleArray", "init_scheduleIterable", "init_scheduleAsyncIterable", "init_isInteropObservable", "init_isPromise", "init_isArrayLike", "init_isIterable", "init_isAsyncIterable", "init_throwUnobservableError", "init_isReadableStreamLike", "init_scheduleReadableStreamLike", "from", "input", "scheduler", "scheduled", "innerFrom", "init_from", "__esmMin", "init_scheduled", "init_innerFrom", "of", "args", "_i", "scheduler", "popScheduler", "from", "init_of", "__esmMin", "init_args", "init_from", "throwError", "errorOrErrorFactory", "scheduler", "errorFactory", "isFunction", "init", "subscriber", "Observable", "init_throwError", "__esmMin", "init_Observable", "init_isFunction", "observeNotification", "notification", "observer", "_d", "kind", "value", "error", "_a", "_b", "_c", "NotificationKind", "Notification", "init_Notification", "__esmMin", "init_empty", "init_of", "init_throwError", "init_isFunction", "nextHandler", "errorHandler", "completeHandler", "nextOrObserver", "complete", "isFunction", "result", "of", "throwError", "EMPTY", "err", "isObservable", "obj", "Observable", "isFunction", "init_isObservable", "__esmMin", "init_Observable", "init_isFunction", "EmptyError", "init_EmptyError", "__esmMin", "init_createErrorClass", "createErrorClass", "_super", "lastValueFrom", "source", "config", "hasConfig", "resolve", "reject", "_hasValue", "_value", "value", "EmptyError", "init_lastValueFrom", "__esmMin", "init_EmptyError", "firstValueFrom", "source", "config", "hasConfig", "resolve", "reject", "subscriber", "SafeSubscriber", "value", "EmptyError", "init_firstValueFrom", "__esmMin", "init_EmptyError", "init_Subscriber", "ArgumentOutOfRangeError", "init_ArgumentOutOfRangeError", "__esmMin", "init_createErrorClass", "createErrorClass", "_super", "NotFoundError", "init_NotFoundError", "__esmMin", "init_createErrorClass", "createErrorClass", "_super", "message", "SequenceError", "init_SequenceError", "__esmMin", "init_createErrorClass", "createErrorClass", "_super", "message", "isValidDate", "value", "init_isDate", "__esmMin", "timeout", "config", "schedulerArg", "_a", "isValidDate", "first", "each", "_b", "_with", "timeoutErrorFactory", "_c", "scheduler", "asyncScheduler", "_d", "meta", "operate", "source", "subscriber", "originalSourceSubscription", "timerSubscription", "lastValue", "seen", "startTimer", "delay", "executeSchedule", "innerFrom", "err", "createOperatorSubscriber", "value", "info", "TimeoutError", "init_timeout", "__esmMin", "init_async", "init_isDate", "init_lift", "init_innerFrom", "init_createErrorClass", "init_OperatorSubscriber", "init_executeSchedule", "createErrorClass", "_super", "map", "project", "thisArg", "operate", "source", "subscriber", "index", "createOperatorSubscriber", "value", "init_map", "__esmMin", "init_lift", "init_OperatorSubscriber", "callOrApply", "fn", "args", "isArray", "__spreadArray", "__read", "mapOneOrManyArgs", "map", "init_map", "bindCallbackInternals", "isNodeStyle", "callbackFunc", "resultSelector", "scheduler", "isScheduler", "args", "_i", "mapOneOrManyArgs", "subscribeOn", "observeOn", "_this", "subject", "AsyncSubject", "uninitialized", "Observable", "subscriber", "subs", "isAsync_1", "isComplete_1", "__spreadArray", "__read", "results", "err", "init_isScheduler", "init_Observable", "init_subscribeOn", "init_mapOneOrManyArgs", "init_observeOn", "init_AsyncSubject", "bindCallback", "callbackFunc", "resultSelector", "scheduler", "bindCallbackInternals", "init_bindCallback", "__esmMin", "init_bindCallbackInternals", "bindNodeCallback", "callbackFunc", "resultSelector", "scheduler", "bindCallbackInternals", "init_bindNodeCallback", "__esmMin", "init_bindCallbackInternals", "argsArgArrayOrObject", "args", "first_1", "isArray", "isPOJO", "keys", "getKeys", "key", "obj", "getPrototypeOf", "objectProto", "init_argsArgArrayOrObject", "__esmMin", "createObject", "keys", "values", "result", "key", "i", "init_createObject", "__esmMin", "combineLatest", "args", "_i", "scheduler", "popScheduler", "resultSelector", "popResultSelector", "_a", "argsArgArrayOrObject", "observables", "keys", "from", "result", "Observable", "combineLatestInit", "values", "createObject", "identity", "mapOneOrManyArgs", "valueTransform", "subscriber", "maybeSchedule", "length", "active", "remainingFirstValues", "i", "source", "hasFirstValue", "createOperatorSubscriber", "value", "execute", "subscription", "executeSchedule", "init_combineLatest", "__esmMin", "init_Observable", "init_argsArgArrayOrObject", "init_from", "init_identity", "init_mapOneOrManyArgs", "init_args", "init_createObject", "init_OperatorSubscriber", "init_executeSchedule", "mergeInternals", "source", "subscriber", "project", "concurrent", "onBeforeNext", "expand", "innerSubScheduler", "additionalFinalizer", "buffer", "active", "index", "isComplete", "checkComplete", "outerNext", "value", "doInnerSub", "innerComplete", "innerFrom", "createOperatorSubscriber", "innerValue", "bufferedValue", "executeSchedule", "err", "init_mergeInternals", "__esmMin", "init_innerFrom", "init_executeSchedule", "init_OperatorSubscriber", "mergeMap", "project", "resultSelector", "concurrent", "isFunction", "a", "i", "map", "b", "ii", "innerFrom", "operate", "source", "subscriber", "mergeInternals", "init_mergeMap", "__esmMin", "init_map", "init_innerFrom", "init_lift", "init_mergeInternals", "init_isFunction", "mergeAll", "concurrent", "mergeMap", "identity", "init_mergeAll", "__esmMin", "init_mergeMap", "init_identity", "concatAll", "mergeAll", "init_concatAll", "__esmMin", "init_mergeAll", "concat", "args", "_i", "concatAll", "from", "popScheduler", "init_concat", "__esmMin", "init_concatAll", "init_args", "init_from", "defer", "observableFactory", "Observable", "subscriber", "innerFrom", "init_defer", "__esmMin", "init_Observable", "init_innerFrom", "connectable", "source", "config", "DEFAULT_CONFIG", "connection", "connector", "_a", "resetOnDisconnect", "subject", "result", "Observable", "subscriber", "defer", "init_connectable", "__esmMin", "init_Subject", "init_Observable", "init_defer", "Subject", "forkJoin", "args", "_i", "resultSelector", "popResultSelector", "_a", "argsArgArrayOrObject", "sources", "keys", "result", "Observable", "subscriber", "length", "values", "remainingCompletions", "remainingEmissions", "sourceIndex", "hasValue", "innerFrom", "createOperatorSubscriber", "value", "createObject", "mapOneOrManyArgs", "init_forkJoin", "__esmMin", "init_Observable", "init_argsArgArrayOrObject", "init_innerFrom", "init_args", "init_OperatorSubscriber", "init_mapOneOrManyArgs", "init_createObject", "fromEvent", "target", "eventName", "options", "resultSelector", "isFunction", "mapOneOrManyArgs", "_a", "__read", "isEventTarget", "eventTargetMethods", "methodName", "handler", "isNodeStyleEventEmitter", "nodeEventEmitterMethods", "toCommonHandlerRegistry", "isJQueryStyleEventEmitter", "jqueryMethods", "add", "remove", "isArrayLike", "mergeMap", "subTarget", "innerFrom", "Observable", "subscriber", "args", "_i", "init_innerFrom", "init_Observable", "init_mergeMap", "init_isArrayLike", "init_isFunction", "init_mapOneOrManyArgs", "fromEventPattern", "addHandler", "removeHandler", "resultSelector", "mapOneOrManyArgs", "Observable", "subscriber", "handler", "e", "_i", "retValue", "isFunction", "init_fromEventPattern", "__esmMin", "init_Observable", "init_isFunction", "init_mapOneOrManyArgs", "generate", "initialStateOrOptions", "condition", "iterate", "resultSelectorOrScheduler", "scheduler", "resultSelector", "initialState", "_a", "_b", "identity", "isScheduler", "gen", "state", "defer", "scheduleIterable", "init_identity", "init_isScheduler", "init_defer", "init_scheduleIterable", "iif", "condition", "trueResult", "falseResult", "defer", "init_iif", "__esmMin", "init_defer", "timer", "dueTime", "intervalOrScheduler", "scheduler", "async", "intervalDuration", "isScheduler", "Observable", "subscriber", "due", "isValidDate", "n", "init_timer", "__esmMin", "init_Observable", "init_async", "init_isScheduler", "init_isDate", "interval", "period", "scheduler", "asyncScheduler", "timer", "init_interval", "__esmMin", "init_async", "init_timer", "merge", "args", "_i", "scheduler", "popScheduler", "concurrent", "popNumber", "sources", "innerFrom", "mergeAll", "from", "EMPTY", "init_merge", "__esmMin", "init_mergeAll", "init_innerFrom", "init_empty", "init_args", "init_from", "never", "NEVER", "init_never", "__esmMin", "init_Observable", "init_noop", "Observable", "noop", "argsOrArgArray", "args", "isArray", "init_argsOrArgArray", "__esmMin", "onErrorResumeNext", "sources", "_i", "nextSources", "argsOrArgArray", "Observable", "subscriber", "sourceIndex", "subscribeNext", "nextSource", "innerFrom", "innerSubscriber", "OperatorSubscriber", "noop", "init_onErrorResumeNext", "__esmMin", "init_Observable", "init_argsOrArgArray", "init_OperatorSubscriber", "init_noop", "init_innerFrom", "pairs", "obj", "scheduler", "from", "init_pairs", "__esmMin", "init_from", "not", "pred", "thisArg", "value", "index", "init_not", "__esmMin", "filter", "predicate", "thisArg", "operate", "source", "subscriber", "index", "createOperatorSubscriber", "value", "init_filter", "__esmMin", "init_lift", "init_OperatorSubscriber", "partition", "source", "predicate", "thisArg", "filter", "innerFrom", "not", "init_partition", "__esmMin", "init_not", "init_filter", "init_innerFrom", "race", "sources", "_i", "argsOrArgArray", "innerFrom", "Observable", "raceInit", "subscriber", "subscriptions", "createOperatorSubscriber", "value", "s", "i", "init_race", "__esmMin", "init_Observable", "init_innerFrom", "init_argsOrArgArray", "init_OperatorSubscriber", "range", "start", "count", "scheduler", "EMPTY", "end", "Observable", "subscriber", "n", "init_range", "__esmMin", "init_Observable", "init_empty", "using", "resourceFactory", "observableFactory", "Observable", "subscriber", "resource", "result", "source", "innerFrom", "EMPTY", "init_using", "__esmMin", "init_Observable", "init_innerFrom", "init_empty", "zip", "args", "_i", "resultSelector", "popResultSelector", "sources", "argsOrArgArray", "Observable", "subscriber", "buffers", "completed", "sourceIndex", "innerFrom", "createOperatorSubscriber", "value", "buffer", "result", "__spreadArray", "__read", "i", "EMPTY", "init_Observable", "init_innerFrom", "init_argsOrArgArray", "init_empty", "init_OperatorSubscriber", "init_args", "init_types", "__esmMin", "audit", "durationSelector", "operate", "source", "subscriber", "hasValue", "lastValue", "durationSubscriber", "isComplete", "endDuration", "value", "cleanupDuration", "createOperatorSubscriber", "innerFrom", "init_audit", "__esmMin", "init_lift", "init_innerFrom", "init_OperatorSubscriber", "auditTime", "duration", "scheduler", "asyncScheduler", "audit", "timer", "init_auditTime", "__esmMin", "init_async", "init_audit", "init_timer", "buffer", "closingNotifier", "operate", "source", "subscriber", "currentBuffer", "createOperatorSubscriber", "value", "innerFrom", "b", "noop", "init_buffer", "__esmMin", "init_lift", "init_noop", "init_OperatorSubscriber", "init_innerFrom", "bufferCount", "bufferSize", "startBufferEvery", "operate", "source", "subscriber", "buffers", "count", "createOperatorSubscriber", "value", "toEmit", "buffers_1", "__values", "buffers_1_1", "buffer", "toEmit_1", "toEmit_1_1", "arrRemove", "buffers_2", "buffers_2_1", "init_lift", "init_OperatorSubscriber", "init_arrRemove", "bufferTime", "bufferTimeSpan", "otherArgs", "_i", "scheduler", "_a", "popScheduler", "asyncScheduler", "bufferCreationInterval", "_b", "maxBufferSize", "operate", "source", "subscriber", "bufferRecords", "restartOnEmit", "emit", "record", "buffer", "subs", "arrRemove", "startBuffer", "Subscription", "record_1", "executeSchedule", "bufferTimeSubscriber", "createOperatorSubscriber", "value", "recordsCopy", "recordsCopy_1", "__values", "recordsCopy_1_1", "init_Subscription", "init_lift", "init_OperatorSubscriber", "init_arrRemove", "init_async", "init_args", "init_executeSchedule", "bufferToggle", "openings", "closingSelector", "operate", "source", "subscriber", "buffers", "innerFrom", "createOperatorSubscriber", "openValue", "buffer", "closingSubscription", "Subscription", "emitBuffer", "arrRemove", "noop", "value", "buffers_1", "__values", "buffers_1_1", "init_Subscription", "init_lift", "init_innerFrom", "init_OperatorSubscriber", "init_noop", "init_arrRemove", "bufferWhen", "closingSelector", "operate", "source", "subscriber", "buffer", "closingSubscriber", "openBuffer", "b", "innerFrom", "createOperatorSubscriber", "noop", "value", "init_bufferWhen", "__esmMin", "init_lift", "init_noop", "init_OperatorSubscriber", "init_innerFrom", "catchError", "selector", "operate", "source", "subscriber", "innerSub", "syncUnsub", "handledResult", "createOperatorSubscriber", "err", "innerFrom", "init_catchError", "__esmMin", "init_innerFrom", "init_OperatorSubscriber", "init_lift", "scanInternals", "accumulator", "seed", "hasSeed", "emitOnNext", "emitBeforeComplete", "source", "subscriber", "hasState", "state", "index", "createOperatorSubscriber", "value", "i", "init_scanInternals", "__esmMin", "init_OperatorSubscriber", "reduce", "accumulator", "seed", "operate", "scanInternals", "init_reduce", "__esmMin", "init_scanInternals", "init_lift", "toArray", "operate", "source", "subscriber", "reduce", "arrReducer", "init_toArray", "__esmMin", "init_reduce", "init_lift", "arr", "value", "joinAllInternals", "joinFn", "project", "pipe", "toArray", "mergeMap", "sources", "mapOneOrManyArgs", "identity", "init_joinAllInternals", "__esmMin", "init_identity", "init_mapOneOrManyArgs", "init_pipe", "init_mergeMap", "init_toArray", "combineLatestAll", "project", "joinAllInternals", "combineLatest", "init_combineLatestAll", "__esmMin", "init_combineLatest", "init_joinAllInternals", "combineAll", "init_combineAll", "__esmMin", "init_combineLatestAll", "combineLatestAll", "combineLatest", "args", "_i", "resultSelector", "popResultSelector", "pipe", "__spreadArray", "__read", "mapOneOrManyArgs", "operate", "source", "subscriber", "combineLatestInit", "argsOrArgArray", "init_combineLatest", "init_lift", "init_argsOrArgArray", "init_mapOneOrManyArgs", "init_pipe", "init_args", "combineLatestWith", "otherSources", "_i", "combineLatest", "__spreadArray", "__read", "init_combineLatest", "concatMap", "project", "resultSelector", "isFunction", "mergeMap", "init_concatMap", "__esmMin", "init_mergeMap", "init_isFunction", "concatMapTo", "innerObservable", "resultSelector", "isFunction", "concatMap", "init_concatMapTo", "__esmMin", "init_concatMap", "init_isFunction", "concat", "args", "_i", "scheduler", "popScheduler", "operate", "source", "subscriber", "concatAll", "from", "__spreadArray", "__read", "init_lift", "init_concatAll", "init_args", "init_from", "concatWith", "otherSources", "_i", "concat", "__spreadArray", "__read", "init_concat", "fromSubscribable", "subscribable", "Observable", "subscriber", "init_fromSubscribable", "__esmMin", "init_Observable", "connect", "selector", "config", "DEFAULT_CONFIG", "connector", "operate", "source", "subscriber", "subject", "innerFrom", "fromSubscribable", "init_connect", "__esmMin", "init_Subject", "init_innerFrom", "init_lift", "init_fromSubscribable", "Subject", "count", "predicate", "reduce", "total", "value", "i", "init_count", "__esmMin", "init_reduce", "debounce", "durationSelector", "operate", "source", "subscriber", "hasValue", "lastValue", "durationSubscriber", "emit", "value", "createOperatorSubscriber", "noop", "innerFrom", "init_debounce", "__esmMin", "init_lift", "init_noop", "init_OperatorSubscriber", "init_innerFrom", "debounceTime", "dueTime", "scheduler", "asyncScheduler", "operate", "source", "subscriber", "activeTask", "lastValue", "lastTime", "emit", "value", "emitWhenIdle", "targetTime", "now", "createOperatorSubscriber", "init_debounceTime", "__esmMin", "init_async", "init_lift", "init_OperatorSubscriber", "defaultIfEmpty", "defaultValue", "operate", "source", "subscriber", "hasValue", "createOperatorSubscriber", "value", "init_defaultIfEmpty", "__esmMin", "init_lift", "init_OperatorSubscriber", "take", "count", "EMPTY", "operate", "source", "subscriber", "seen", "createOperatorSubscriber", "value", "init_take", "__esmMin", "init_empty", "init_lift", "init_OperatorSubscriber", "ignoreElements", "operate", "source", "subscriber", "createOperatorSubscriber", "noop", "init_ignoreElements", "__esmMin", "init_lift", "init_OperatorSubscriber", "init_noop", "mapTo", "value", "map", "init_mapTo", "__esmMin", "init_map", "delayWhen", "delayDurationSelector", "subscriptionDelay", "source", "concat", "take", "ignoreElements", "mergeMap", "value", "index", "innerFrom", "mapTo", "init_delayWhen", "__esmMin", "init_concat", "init_take", "init_ignoreElements", "init_mapTo", "init_mergeMap", "init_innerFrom", "delay", "due", "scheduler", "asyncScheduler", "duration", "timer", "delayWhen", "init_delay", "__esmMin", "init_async", "init_delayWhen", "init_timer", "dematerialize", "operate", "source", "subscriber", "createOperatorSubscriber", "notification", "observeNotification", "init_dematerialize", "__esmMin", "init_Notification", "init_lift", "init_OperatorSubscriber", "distinct", "keySelector", "flushes", "operate", "source", "subscriber", "distinctKeys", "createOperatorSubscriber", "value", "key", "innerFrom", "noop", "init_distinct", "__esmMin", "init_lift", "init_OperatorSubscriber", "init_noop", "init_innerFrom", "distinctUntilChanged", "comparator", "keySelector", "identity", "defaultCompare", "operate", "source", "subscriber", "previousKey", "first", "createOperatorSubscriber", "value", "currentKey", "a", "b", "init_distinctUntilChanged", "__esmMin", "init_identity", "init_lift", "init_OperatorSubscriber", "distinctUntilKeyChanged", "key", "compare", "distinctUntilChanged", "x", "y", "init_distinctUntilKeyChanged", "__esmMin", "init_distinctUntilChanged", "throwIfEmpty", "errorFactory", "defaultErrorFactory", "operate", "source", "subscriber", "hasValue", "createOperatorSubscriber", "value", "EmptyError", "init_throwIfEmpty", "__esmMin", "init_EmptyError", "init_lift", "init_OperatorSubscriber", "elementAt", "index", "defaultValue", "ArgumentOutOfRangeError", "hasDefaultValue", "source", "filter", "v", "take", "defaultIfEmpty", "throwIfEmpty", "init_elementAt", "__esmMin", "init_ArgumentOutOfRangeError", "init_filter", "init_throwIfEmpty", "init_defaultIfEmpty", "init_take", "endWith", "values", "_i", "source", "concat", "of", "__spreadArray", "__read", "init_concat", "init_of", "every", "predicate", "thisArg", "operate", "source", "subscriber", "index", "createOperatorSubscriber", "value", "init_every", "__esmMin", "init_lift", "init_OperatorSubscriber", "exhaustMap", "project", "resultSelector", "source", "a", "i", "innerFrom", "map", "b", "ii", "operate", "subscriber", "index", "innerSub", "isComplete", "createOperatorSubscriber", "outerValue", "init_exhaustMap", "__esmMin", "init_map", "init_innerFrom", "init_lift", "init_OperatorSubscriber", "exhaustAll", "exhaustMap", "identity", "init_exhaustAll", "__esmMin", "init_exhaustMap", "init_identity", "exhaust", "init_exhaust", "__esmMin", "init_exhaustAll", "exhaustAll", "expand", "project", "concurrent", "scheduler", "operate", "source", "subscriber", "mergeInternals", "init_expand", "__esmMin", "init_lift", "init_mergeInternals", "finalize", "callback", "operate", "source", "subscriber", "init_finalize", "__esmMin", "init_lift", "find", "predicate", "thisArg", "operate", "createFind", "emit", "findIndex", "source", "subscriber", "index", "createOperatorSubscriber", "value", "i", "init_find", "__esmMin", "init_lift", "init_OperatorSubscriber", "findIndex", "predicate", "thisArg", "operate", "createFind", "init_findIndex", "__esmMin", "init_lift", "init_find", "first", "predicate", "defaultValue", "hasDefaultValue", "source", "filter", "v", "identity", "take", "defaultIfEmpty", "throwIfEmpty", "EmptyError", "init_first", "__esmMin", "init_EmptyError", "init_filter", "init_take", "init_defaultIfEmpty", "init_throwIfEmpty", "init_identity", "groupBy", "keySelector", "elementOrOptions", "duration", "connector", "operate", "source", "subscriber", "element", "groups", "notify", "cb", "handleError", "err", "consumer", "activeGroups", "teardownAttempted", "groupBySourceSubscriber", "OperatorSubscriber", "value", "key_1", "group_1", "Subject", "grouped", "createGroupedObservable", "durationSubscriber_1", "createOperatorSubscriber", "innerFrom", "key", "groupSubject", "result", "Observable", "groupSubscriber", "innerSub", "init_groupBy", "__esmMin", "init_Observable", "init_innerFrom", "init_Subject", "init_lift", "init_OperatorSubscriber", "isEmpty", "operate", "source", "subscriber", "createOperatorSubscriber", "init_isEmpty", "__esmMin", "init_lift", "init_OperatorSubscriber", "takeLast", "count", "EMPTY", "operate", "source", "subscriber", "buffer", "createOperatorSubscriber", "value", "buffer_1", "__values", "buffer_1_1", "init_empty", "init_lift", "init_OperatorSubscriber", "last", "predicate", "defaultValue", "hasDefaultValue", "source", "filter", "v", "identity", "takeLast", "defaultIfEmpty", "throwIfEmpty", "EmptyError", "init_last", "__esmMin", "init_EmptyError", "init_filter", "init_takeLast", "init_throwIfEmpty", "init_defaultIfEmpty", "init_identity", "materialize", "operate", "source", "subscriber", "createOperatorSubscriber", "value", "Notification", "err", "init_materialize", "__esmMin", "init_Notification", "init_lift", "init_OperatorSubscriber", "max", "comparer", "reduce", "isFunction", "x", "y", "init_max", "__esmMin", "init_reduce", "init_isFunction", "flatMap", "init_flatMap", "__esmMin", "init_mergeMap", "mergeMap", "mergeMapTo", "innerObservable", "resultSelector", "concurrent", "isFunction", "mergeMap", "init_mergeMapTo", "__esmMin", "init_mergeMap", "init_isFunction", "mergeScan", "accumulator", "seed", "concurrent", "operate", "source", "subscriber", "state", "mergeInternals", "value", "index", "init_mergeScan", "__esmMin", "init_lift", "init_mergeInternals", "merge", "args", "_i", "scheduler", "popScheduler", "concurrent", "popNumber", "operate", "source", "subscriber", "mergeAll", "from", "__spreadArray", "__read", "init_lift", "init_mergeAll", "init_args", "init_from", "mergeWith", "otherSources", "_i", "merge", "__spreadArray", "__read", "init_merge", "min", "comparer", "reduce", "isFunction", "x", "y", "init_min", "__esmMin", "init_reduce", "init_isFunction", "multicast", "subjectOrSubjectFactory", "selector", "subjectFactory", "isFunction", "connect", "source", "ConnectableObservable", "init_multicast", "__esmMin", "init_ConnectableObservable", "init_isFunction", "init_connect", "onErrorResumeNextWith", "sources", "_i", "nextSources", "argsOrArgArray", "source", "onErrorResumeNext", "__spreadArray", "__read", "init_argsOrArgArray", "init_onErrorResumeNext", "pairwise", "operate", "source", "subscriber", "prev", "hasPrev", "createOperatorSubscriber", "value", "p", "init_pairwise", "__esmMin", "init_lift", "init_OperatorSubscriber", "pluck", "properties", "_i", "length", "map", "x", "currentProp", "p", "init_pluck", "__esmMin", "init_map", "publish", "selector", "source", "connect", "multicast", "Subject", "init_publish", "__esmMin", "init_Subject", "init_multicast", "init_connect", "publishBehavior", "initialValue", "source", "subject", "BehaviorSubject", "ConnectableObservable", "init_publishBehavior", "__esmMin", "init_BehaviorSubject", "init_ConnectableObservable", "publishLast", "source", "subject", "AsyncSubject", "ConnectableObservable", "init_publishLast", "__esmMin", "init_AsyncSubject", "init_ConnectableObservable", "publishReplay", "bufferSize", "windowTime", "selectorOrScheduler", "timestampProvider", "isFunction", "selector", "source", "multicast", "ReplaySubject", "init_publishReplay", "__esmMin", "init_ReplaySubject", "init_multicast", "init_isFunction", "raceWith", "otherSources", "_i", "operate", "source", "subscriber", "raceInit", "__spreadArray", "__read", "identity", "init_race", "init_lift", "init_identity", "repeat", "countOrConfig", "count", "delay", "_a", "EMPTY", "operate", "source", "subscriber", "soFar", "sourceSub", "resubscribe", "notifier", "timer", "innerFrom", "notifierSubscriber_1", "createOperatorSubscriber", "subscribeToSource", "syncUnsub", "init_repeat", "__esmMin", "init_empty", "init_lift", "init_OperatorSubscriber", "init_innerFrom", "init_timer", "repeatWhen", "notifier", "operate", "source", "subscriber", "innerSub", "syncResub", "completions$", "isNotifierComplete", "isMainComplete", "checkComplete", "getCompletionSubject", "Subject", "innerFrom", "createOperatorSubscriber", "subscribeForRepeatWhen", "init_repeatWhen", "__esmMin", "init_innerFrom", "init_Subject", "init_lift", "init_OperatorSubscriber", "retry", "configOrCount", "config", "_a", "count", "delay", "_b", "resetOnSuccess", "identity", "operate", "source", "subscriber", "soFar", "innerSub", "subscribeForRetry", "syncUnsub", "createOperatorSubscriber", "value", "err", "resub_1", "notifier", "timer", "innerFrom", "notifierSubscriber_1", "init_retry", "__esmMin", "init_lift", "init_OperatorSubscriber", "init_identity", "init_timer", "init_innerFrom", "retryWhen", "notifier", "operate", "source", "subscriber", "innerSub", "syncResub", "errors$", "subscribeForRetryWhen", "createOperatorSubscriber", "err", "Subject", "innerFrom", "init_retryWhen", "__esmMin", "init_innerFrom", "init_Subject", "init_lift", "init_OperatorSubscriber", "sample", "notifier", "operate", "source", "subscriber", "hasValue", "lastValue", "createOperatorSubscriber", "value", "innerFrom", "noop", "init_sample", "__esmMin", "init_innerFrom", "init_lift", "init_noop", "init_OperatorSubscriber", "sampleTime", "period", "scheduler", "asyncScheduler", "sample", "interval", "init_sampleTime", "__esmMin", "init_async", "init_sample", "init_interval", "scan", "accumulator", "seed", "operate", "scanInternals", "init_scan", "__esmMin", "init_lift", "init_scanInternals", "sequenceEqual", "compareTo", "comparator", "a", "b", "operate", "source", "subscriber", "aState", "createState", "bState", "emit", "isEqual", "createSubscriber", "selfState", "otherState", "sequenceEqualSubscriber", "createOperatorSubscriber", "buffer", "complete", "innerFrom", "init_sequenceEqual", "__esmMin", "init_lift", "init_OperatorSubscriber", "init_innerFrom", "share", "options", "_a", "connector", "Subject", "_b", "resetOnError", "_c", "resetOnComplete", "_d", "resetOnRefCountZero", "wrapperSource", "connection", "resetConnection", "subject", "refCount", "hasCompleted", "hasErrored", "cancelReset", "reset", "resetAndUnsubscribe", "conn", "operate", "source", "subscriber", "dest", "handleReset", "SafeSubscriber", "value", "err", "innerFrom", "on", "args", "_i", "onSubscriber", "__spreadArray", "__read", "init_innerFrom", "init_Subject", "init_Subscriber", "init_lift", "shareReplay", "configOrBufferSize", "windowTime", "scheduler", "bufferSize", "refCount", "_a", "_b", "_c", "share", "ReplaySubject", "init_shareReplay", "__esmMin", "init_ReplaySubject", "init_share", "single", "predicate", "operate", "source", "subscriber", "hasValue", "singleValue", "seenValue", "index", "createOperatorSubscriber", "value", "SequenceError", "NotFoundError", "EmptyError", "init_single", "__esmMin", "init_EmptyError", "init_SequenceError", "init_NotFoundError", "init_lift", "init_OperatorSubscriber", "skip", "count", "filter", "_", "index", "init_skip", "__esmMin", "init_filter", "skipLast", "skipCount", "identity", "operate", "source", "subscriber", "ring", "seen", "createOperatorSubscriber", "value", "valueIndex", "index", "oldValue", "init_skipLast", "__esmMin", "init_identity", "init_lift", "init_OperatorSubscriber", "skipUntil", "notifier", "operate", "source", "subscriber", "taking", "skipSubscriber", "createOperatorSubscriber", "noop", "innerFrom", "value", "init_skipUntil", "__esmMin", "init_lift", "init_OperatorSubscriber", "init_innerFrom", "init_noop", "skipWhile", "predicate", "operate", "source", "subscriber", "taking", "index", "createOperatorSubscriber", "value", "init_skipWhile", "__esmMin", "init_lift", "init_OperatorSubscriber", "startWith", "values", "_i", "scheduler", "popScheduler", "operate", "source", "subscriber", "concat", "init_startWith", "__esmMin", "init_concat", "init_args", "init_lift", "switchMap", "project", "resultSelector", "operate", "source", "subscriber", "innerSubscriber", "index", "isComplete", "checkComplete", "createOperatorSubscriber", "value", "innerIndex", "outerIndex", "innerFrom", "innerValue", "init_switchMap", "__esmMin", "init_innerFrom", "init_lift", "init_OperatorSubscriber", "switchAll", "switchMap", "identity", "init_switchAll", "__esmMin", "init_switchMap", "init_identity", "switchMapTo", "innerObservable", "resultSelector", "isFunction", "switchMap", "init_switchMapTo", "__esmMin", "init_switchMap", "init_isFunction", "switchScan", "accumulator", "seed", "operate", "source", "subscriber", "state", "switchMap", "value", "index", "_", "innerValue", "init_switchScan", "__esmMin", "init_switchMap", "init_lift", "takeUntil", "notifier", "operate", "source", "subscriber", "innerFrom", "createOperatorSubscriber", "noop", "init_takeUntil", "__esmMin", "init_lift", "init_OperatorSubscriber", "init_innerFrom", "init_noop", "takeWhile", "predicate", "inclusive", "operate", "source", "subscriber", "index", "createOperatorSubscriber", "value", "result", "init_takeWhile", "__esmMin", "init_lift", "init_OperatorSubscriber", "tap", "observerOrNext", "error", "complete", "tapObserver", "isFunction", "operate", "source", "subscriber", "_a", "isUnsub", "createOperatorSubscriber", "value", "err", "_b", "identity", "init_tap", "__esmMin", "init_isFunction", "init_lift", "init_OperatorSubscriber", "init_identity", "throttle", "durationSelector", "config", "operate", "source", "subscriber", "_a", "_b", "leading", "_c", "trailing", "hasValue", "sendValue", "throttled", "isComplete", "endThrottling", "send", "cleanupThrottling", "startThrottle", "value", "innerFrom", "createOperatorSubscriber", "init_throttle", "__esmMin", "init_lift", "init_OperatorSubscriber", "init_innerFrom", "throttleTime", "duration", "scheduler", "config", "asyncScheduler", "duration$", "timer", "throttle", "init_throttleTime", "__esmMin", "init_async", "init_throttle", "init_timer", "timeInterval", "scheduler", "asyncScheduler", "operate", "source", "subscriber", "last", "createOperatorSubscriber", "value", "now", "interval", "TimeInterval", "init_timeInterval", "__esmMin", "init_async", "init_lift", "init_OperatorSubscriber", "timeoutWith", "due", "withObservable", "scheduler", "first", "each", "_with", "async", "isValidDate", "timeout", "init_timeoutWith", "__esmMin", "init_async", "init_isDate", "init_timeout", "timestamp", "timestampProvider", "dateTimestampProvider", "map", "value", "init_timestamp", "__esmMin", "init_dateTimestampProvider", "init_map", "window", "windowBoundaries", "operate", "source", "subscriber", "windowSubject", "Subject", "errorHandler", "err", "createOperatorSubscriber", "value", "innerFrom", "noop", "init_window", "__esmMin", "init_Subject", "init_lift", "init_OperatorSubscriber", "init_noop", "init_innerFrom", "windowCount", "windowSize", "startWindowEvery", "startEvery", "operate", "source", "subscriber", "windows", "Subject", "starts", "count", "createOperatorSubscriber", "value", "windows_1", "__values", "windows_1_1", "window_1", "c", "window_2", "err", "init_Subject", "init_lift", "init_OperatorSubscriber", "windowTime", "windowTimeSpan", "otherArgs", "_i", "scheduler", "_a", "popScheduler", "asyncScheduler", "windowCreationInterval", "_b", "maxWindowSize", "operate", "source", "subscriber", "windowRecords", "restartOnClose", "closeWindow", "record", "window", "subs", "arrRemove", "startWindow", "Subscription", "window_1", "Subject", "record_1", "executeSchedule", "loop", "cb", "terminate", "createOperatorSubscriber", "value", "consumer", "err", "init_windowTime", "__esmMin", "init_Subject", "init_async", "init_Subscription", "init_lift", "init_OperatorSubscriber", "init_arrRemove", "init_args", "init_executeSchedule", "windowToggle", "openings", "closingSelector", "operate", "source", "subscriber", "windows", "handleError", "err", "innerFrom", "createOperatorSubscriber", "openValue", "window", "Subject", "closingSubscription", "Subscription", "closeWindow", "arrRemove", "closingNotifier", "noop", "value", "windowsCopy", "windowsCopy_1", "__values", "windowsCopy_1_1", "window_1", "init_Subject", "init_Subscription", "init_lift", "init_innerFrom", "init_OperatorSubscriber", "init_noop", "init_arrRemove", "windowWhen", "closingSelector", "operate", "source", "subscriber", "window", "closingSubscriber", "handleError", "err", "openWindow", "Subject", "closingNotifier", "innerFrom", "createOperatorSubscriber", "value", "init_windowWhen", "__esmMin", "init_Subject", "init_lift", "init_OperatorSubscriber", "init_innerFrom", "withLatestFrom", "inputs", "_i", "project", "popResultSelector", "operate", "source", "subscriber", "len", "otherValues", "hasValue", "ready", "i", "innerFrom", "createOperatorSubscriber", "value", "identity", "noop", "values", "__spreadArray", "__read", "init_lift", "init_OperatorSubscriber", "init_innerFrom", "init_identity", "init_noop", "init_args", "zipAll", "project", "joinAllInternals", "zip", "init_zipAll", "__esmMin", "init_zip", "init_joinAllInternals", "zip", "sources", "_i", "operate", "source", "subscriber", "__spreadArray", "__read", "init_zip", "init_lift", "zipWith", "otherInputs", "_i", "zip", "__spreadArray", "__read", "init_zip", "esm5_exports", "__export", "ArgumentOutOfRangeError", "AsyncSubject", "BehaviorSubject", "ConnectableObservable", "EMPTY", "EmptyError", "NEVER", "NotFoundError", "Notification", "NotificationKind", "ObjectUnsubscribedError", "Observable", "ReplaySubject", "Scheduler", "SequenceError", "Subject", "Subscriber", "Subscription", "TimeoutError", "UnsubscriptionError", "VirtualAction", "VirtualTimeScheduler", "animationFrame", "animationFrameScheduler", "animationFrames", "asap", "asapScheduler", "async", "asyncScheduler", "audit", "auditTime", "bindCallback", "bindNodeCallback", "buffer", "bufferCount", "bufferTime", "bufferToggle", "bufferWhen", "catchError", "combineAll", "combineLatest", "combineLatestAll", "combineLatestWith", "concat", "concatAll", "concatMap", "concatMapTo", "concatWith", "config", "connect", "connectable", "count", "debounce", "debounceTime", "defaultIfEmpty", "defer", "delay", "delayWhen", "dematerialize", "distinct", "distinctUntilChanged", "distinctUntilKeyChanged", "elementAt", "empty", "endWith", "every", "exhaust", "exhaustAll", "exhaustMap", "expand", "filter", "finalize", "find", "findIndex", "first", "firstValueFrom", "flatMap", "forkJoin", "from", "fromEvent", "fromEventPattern", "generate", "groupBy", "identity", "ignoreElements", "iif", "interval", "isEmpty", "isObservable", "last", "lastValueFrom", "map", "mapTo", "materialize", "max", "merge", "mergeAll", "mergeMap", "mergeMapTo", "mergeScan", "mergeWith", "min", "multicast", "never", "noop", "observable", "observeOn", "of", "onErrorResumeNext", "onErrorResumeNextWith", "pairs", "pairwise", "partition", "pipe", "pluck", "publish", "publishBehavior", "publishLast", "publishReplay", "queue", "queueScheduler", "race", "raceWith", "range", "reduce", "refCount", "repeat", "repeatWhen", "retry", "retryWhen", "sample", "sampleTime", "scan", "scheduled", "sequenceEqual", "share", "shareReplay", "single", "skip", "skipLast", "skipUntil", "skipWhile", "startWith", "subscribeOn", "switchAll", "switchMap", "switchMapTo", "switchScan", "take", "takeLast", "takeUntil", "takeWhile", "tap", "throttle", "throttleTime", "throwError", "throwIfEmpty", "timeInterval", "timeout", "timeoutWith", "timer", "timestamp", "toArray", "using", "window", "windowCount", "windowTime", "windowToggle", "windowWhen", "withLatestFrom", "zip", "zipAll", "zipWith", "init_esm5", "__esmMin", "init_Observable", "init_ConnectableObservable", "init_observable", "init_animationFrames", "init_Subject", "init_BehaviorSubject", "init_ReplaySubject", "init_AsyncSubject", "init_asap", "init_async", "init_queue", "init_animationFrame", "init_VirtualTimeScheduler", "init_Scheduler", "init_Subscription", "init_Subscriber", "init_Notification", "init_pipe", "init_noop", "init_identity", "init_isObservable", "init_lastValueFrom", "init_firstValueFrom", "init_ArgumentOutOfRangeError", "init_EmptyError", "init_NotFoundError", "init_ObjectUnsubscribedError", "init_SequenceError", "init_timeout", "init_UnsubscriptionError", "init_bindCallback", "init_bindNodeCallback", "init_combineLatest", "init_concat", "init_connectable", "init_defer", "init_empty", "init_forkJoin", "init_from", "init_fromEvent", "init_fromEventPattern", "init_generate", "init_iif", "init_interval", "init_merge", "init_never", "init_of", "init_onErrorResumeNext", "init_pairs", "init_partition", "init_race", "init_range", "init_throwError", "init_timer", "init_using", "init_zip", "init_scheduled", "init_types", "init_config", "init_audit", "init_auditTime", "init_buffer", "init_bufferCount", "init_bufferTime", "init_bufferToggle", "init_bufferWhen", "init_catchError", "init_combineAll", "init_combineLatestAll", "init_combineLatestWith", "init_concatAll", "init_concatMap", "init_concatMapTo", "init_concatWith", "init_connect", "init_count", "init_debounce", "init_debounceTime", "init_defaultIfEmpty", "init_delay", "init_delayWhen", "init_dematerialize", "init_distinct", "init_distinctUntilChanged", "init_distinctUntilKeyChanged", "init_elementAt", "init_endWith", "init_every", "init_exhaust", "init_exhaustAll", "init_exhaustMap", "init_expand", "init_filter", "init_finalize", "init_find", "init_findIndex", "init_first", "init_groupBy", "init_ignoreElements", "init_isEmpty", "init_last", "init_map", "init_mapTo", "init_materialize", "init_max", "init_mergeAll", "init_flatMap", "init_mergeMap", "init_mergeMapTo", "init_mergeScan", "init_mergeWith", "init_min", "init_multicast", "init_observeOn", "init_onErrorResumeNextWith", "init_pairwise", "init_pluck", "init_publish", "init_publishBehavior", "init_publishLast", "init_publishReplay", "init_raceWith", "init_reduce", "init_repeat", "init_repeatWhen", "init_retry", "init_retryWhen", "init_refCount", "init_sample", "init_sampleTime", "init_scan", "init_sequenceEqual", "init_share", "init_shareReplay", "init_single", "init_skip", "init_skipLast", "init_skipUntil", "init_skipWhile", "init_startWith", "init_subscribeOn", "init_switchAll", "init_switchMap", "init_switchMapTo", "init_switchScan", "init_take", "init_takeLast", "init_takeUntil", "init_takeWhile", "init_tap", "init_throttle", "init_throttleTime", "init_throwIfEmpty", "init_timeInterval", "init_timeoutWith", "init_timestamp", "init_toArray", "init_window", "init_windowCount", "init_windowTime", "init_windowToggle", "init_windowWhen", "init_withLatestFrom", "init_zipAll", "init_zipWith", "partition", "predicate", "thisArg", "source", "filter", "not", "init_partition", "__esmMin", "init_not", "init_filter", "race", "args", "_i", "raceWith", "__spreadArray", "__read", "argsOrArgArray", "init_argsOrArgArray", "init_raceWith", "operators_exports", "__export", "audit", "auditTime", "buffer", "bufferCount", "bufferTime", "bufferToggle", "bufferWhen", "catchError", "combineAll", "combineLatest", "combineLatestAll", "combineLatestWith", "concat", "concatAll", "concatMap", "concatMapTo", "concatWith", "connect", "count", "debounce", "debounceTime", "defaultIfEmpty", "delay", "delayWhen", "dematerialize", "distinct", "distinctUntilChanged", "distinctUntilKeyChanged", "elementAt", "endWith", "every", "exhaust", "exhaustAll", "exhaustMap", "expand", "filter", "finalize", "find", "findIndex", "first", "flatMap", "groupBy", "ignoreElements", "isEmpty", "last", "map", "mapTo", "materialize", "max", "merge", "mergeAll", "mergeMap", "mergeMapTo", "mergeScan", "mergeWith", "min", "multicast", "observeOn", "onErrorResumeNext", "pairwise", "partition", "pluck", "publish", "publishBehavior", "publishLast", "publishReplay", "race", "raceWith", "reduce", "refCount", "repeat", "repeatWhen", "retry", "retryWhen", "sample", "sampleTime", "scan", "sequenceEqual", "share", "shareReplay", "single", "skip", "skipLast", "skipUntil", "skipWhile", "startWith", "subscribeOn", "switchAll", "switchMap", "switchMapTo", "switchScan", "take", "takeLast", "takeUntil", "takeWhile", "tap", "throttle", "throttleTime", "throwIfEmpty", "timeInterval", "timeout", "timeoutWith", "timestamp", "toArray", "window", "windowCount", "windowTime", "windowToggle", "windowWhen", "withLatestFrom", "zip", "zipAll", "zipWith", "init_operators", "__esmMin", "init_audit", "init_auditTime", "init_buffer", "init_bufferCount", "init_bufferTime", "init_bufferToggle", "init_bufferWhen", "init_catchError", "init_combineAll", "init_combineLatestAll", "init_combineLatest", "init_combineLatestWith", "init_concat", "init_concatAll", "init_concatMap", "init_concatMapTo", "init_concatWith", "init_connect", "init_count", "init_debounce", "init_debounceTime", "init_defaultIfEmpty", "init_delay", "init_delayWhen", "init_dematerialize", "init_distinct", "init_distinctUntilChanged", "init_distinctUntilKeyChanged", "init_elementAt", "init_endWith", "init_every", "init_exhaust", "init_exhaustAll", "init_exhaustMap", "init_expand", "init_filter", "init_finalize", "init_find", "init_findIndex", "init_first", "init_groupBy", "init_ignoreElements", "init_isEmpty", "init_last", "init_map", "init_mapTo", "init_materialize", "init_max", "init_merge", "init_mergeAll", "init_flatMap", "init_mergeMap", "init_mergeMapTo", "init_mergeScan", "init_mergeWith", "init_min", "init_multicast", "init_observeOn", "init_onErrorResumeNextWith", "init_pairwise", "init_partition", "init_pluck", "init_publish", "init_publishBehavior", "init_publishLast", "init_publishReplay", "init_race", "init_raceWith", "init_reduce", "init_repeat", "init_repeatWhen", "init_retry", "init_retryWhen", "init_refCount", "init_sample", "init_sampleTime", "init_scan", "init_sequenceEqual", "init_share", "init_shareReplay", "init_single", "init_skip", "init_skipLast", "init_skipUntil", "init_skipWhile", "init_startWith", "init_subscribeOn", "init_switchAll", "init_switchMap", "init_switchMapTo", "init_switchScan", "init_take", "init_takeLast", "init_takeUntil", "init_takeWhile", "init_tap", "init_throttle", "init_throttleTime", "init_throwIfEmpty", "init_timeInterval", "init_timeout", "init_timeoutWith", "init_timestamp", "init_toArray", "init_window", "init_windowCount", "init_windowTime", "init_windowToggle", "init_windowWhen", "init_withLatestFrom", "init_zip", "init_zipAll", "init_zipWith", "resolveDirective", "part", "value", "parent", "attributeIndex", "noChange", "currentDirective", "_a", "__directives", "__directive", "nextDirectiveConstructor", "isPrimitive", "constructor", "_b", "call", "_$initialize", "_c", "_d", "_$resolve", "values", "global", "trustedTypes", "policy", "marker", "markerMatch", "nodeMarker", "d", "createMarker", "isArray", "isIterable", "textEndRegex", "commentEndRegex", "comment2EndRegex", "tagEndRegex", "singleQuoteAttrEndRegex", "doubleQuoteAttrEndRegex", "rawTextElement", "tag", "html", "svg", "nothing", "templateCache", "walker", "getTemplateHtml", "Template", "TemplateInstance", "ChildPart", "AttributePart", "PropertyPart", "emptyStringForBooleanAttribute", "BooleanAttributePart", "EventPart", "ElementPart", "_$LH", "polyfillSupport", "render", "window", "createPolicy", "createHTML", "s", "Math", "random", "String", "slice", "document", "v", "createComment", "Array", "Symbol", "iterator", "RegExp", "type", "strings", "_$litType$", "for", "WeakMap", "createTreeWalker", "l", "length", "attrNames", "rawTextEndRegex", "regex", "i", "attrName", "match", "attrNameEndIndex", "lastIndex", "exec", "test", "end", "startsWith", "push", "undefined", "htmlResult", "hasOwnProperty", "Error", "options", "node", "this", "parts", "nodeIndex", "attrNameIndex", "partCount", "el", "createElement", "currentNode", "content", "svgElement", "firstChild", "remove", "append", "childNodes", "nextNode", "nodeType", "hasAttributes", "attrsToRemove", "name", "getAttributeNames", "endsWith", "realName", "statics", "getAttribute", "toLowerCase", "split", "m", "index", "ctor", "removeAttribute", "tagName", "textContent", "emptyScript", "data", "indexOf", "static", "_options", "innerHTML", "template", "_parts", "_$disconnectableChildren", "_$template", "_$parent", "parentNode", "_$isConnected", "_clone", "fragment", "creationScope", "importNode", "partIndex", "templatePart", "nextSibling", "_update", "_$setValue", "startNode", "endNode", "_$committedValue", "_$startNode", "_$endNode", "__isConnected", "isConnected", "directiveParent", "_$clear", "_commitText", "_commitTemplateResult", "_commitNode", "_commitIterable", "_insert", "ref", "insertBefore", "createTextNode", "result", "_$getTemplate", "h", "instance", "get", "set", "itemParts", "itemPart", "item", "start", "from", "_$notifyConnectionChanged", "n", "setConnected", "element", "fill", "valueIndex", "noCommit", "change", "_commitValue", "setAttribute", "super", "newListener", "oldListener", "shouldRemoveListener", "capture", "once", "passive", "shouldAddListener", "removeEventListener", "addEventListener", "handleEvent", "event", "host", "_boundAttributeSuffix", "_marker", "_markerMatch", "_HTML_RESULT", "_getTemplateHtml", "_TemplateInstance", "_isIterable", "_resolveDirective", "_ChildPart", "_AttributePart", "_BooleanAttributePart", "_EventPart", "_PropertyPart", "_ElementPart", "litHtmlPolyfillSupport", "litHtmlVersions", "container", "partOwnerNode", "renderBefore", "require_component_decorator", "__commonJSMin", "exports", "__setFunctionName", "f", "name", "prefix", "lit_html_1", "legacyCustomElement", "tagName", "clazz", "options", "standardCustomElement", "descriptor", "kind", "elements", "isFunction", "v", "customElement", "tag", "config", "Base", "_a", "_b", "OnInit", "OnDestroy", "OnUpdate", "OnUpdateFirst", "connectedCallback", "disconnectedCallback", "update", "firstUpdated", "ModifiedClass", "style", "_c", "modifier", "registeredElement", "Component", "require_hooks", "__commonJSMin", "exports", "require_decorators", "__commonJSMin", "exports", "__createBinding", "o", "m", "k", "k2", "desc", "__exportStar", "p", "PartType", "directive", "Directive", "ATTRIBUTE", "CHILD", "PROPERTY", "BOOLEAN_ATTRIBUTE", "EVENT", "ELEMENT", "c", "values", "_$litDirective$", "constructor", "_partInfo", "_$isConnected", "this", "_$parent", "_$initialize", "part", "parent", "attributeIndex", "__part", "__attributeIndex", "_$resolve", "props", "update", "_part", "render", "ChildPart", "isPrimitive", "TemplateResultType", "isTemplateResult", "isDirectiveResult", "getDirectiveClass", "isSingleExpression", "createMarker", "insertPart", "setChildPartValue", "RESET_VALUE", "setCommittedValue", "getCommittedValue", "removePart", "clearPart", "_ChildPart", "_$LH", "value", "HTML", "SVG", "type", "part", "strings", "document", "createComment", "containerPart", "refPart", "container", "_$startNode", "parentNode", "refNode", "_$endNode", "startNode", "insertBefore", "endNode", "options", "nextSibling", "oldParent", "_$parent", "parentChanged", "newConnectionState", "_a", "_$reparentDisconnectables", "call", "_$notifyConnectionChanged", "_$isConnected", "start", "n", "directiveParent", "_$setValue", "_$committedValue", "end", "remove", "_$clear", "reparentDisconnectables", "newParent", "this", "_$disconnectableChildren", "removeDisconnectableFromParent", "_$parent", "addDisconnectableToParent", "notifyChildPartConnectedChanged", "isConnected", "isClearingValue", "fromPartIndex", "value", "_$committedValue", "children", "size", "Array", "isArray", "i", "length", "notifyChildrenConnectedChanged", "installDisconnectAPI", "AsyncDirective", "parent", "obj", "_b", "_a", "o", "e", "delete", "Set", "has", "add", "type", "PartType", "CHILD", "_c", "_$notifyConnectionChanged", "_d", "_$reparentDisconnectables", "Directive", "constructor", "_$initialize", "part", "attributeIndex", "super", "_$isConnected", "_$AO", "isClearingDirective", "r", "reconnected", "call", "disconnected", "setValue", "isSingleExpression", "__part", "_$setValue", "newValues", "__attributeIndex", "require_async", "__commonJSMin", "exports", "directive_1", "async_directive_1", "lit_html_1", "ObserveDirective", "asyncResult", "v", "observable", "TemplateInstance", "isIterable", "resolveDirective", "ChildPart", "ElementPart", "hydrate", "openChildPart", "closeChildPart", "createAttributeParts", "digestForTemplateResult", "_TemplateInstance", "_isIterable", "_resolveDirective", "_ChildPart", "_ElementPart", "_$LH", "rootValue", "container", "options", "Error", "rootPart", "currentChildPart", "stack", "walker", "document", "createTreeWalker", "NodeFilter", "SHOW_COMMENT", "marker", "nextNode", "markerText", "data", "startsWith", "length", "console", "assert", "value", "part", "state", "type", "instance", "_parts", "push", "result", "values", "instancePartIndex", "templatePartIndex", "iterator", "next", "done", "_$committedValue", "noChange", "isPrimitive", "isTemplateResult", "markerWithDigest", "template", "prototype", "_$getTemplate", "Symbol", "_$endNode", "currentState", "pop", "comment", "match", "exec", "nodeIndex", "parseInt", "node", "_a", "previousElementSibling", "parentElement", "removeAttribute", "templatePart", "_$template", "parts", "PartType", "ATTRIBUTE", "ELEMENT", "index", "instancePart", "ctor", "name", "strings", "isSingleExpression", "noCommit", "EVENT", "PROPERTY", "_$setValue", "templateResult", "hashes", "Uint32Array", "fill", "s", "i", "charCodeAt", "btoa", "String", "fromCharCode", "Uint8Array", "buffer", "globalThis", "litElementHydrateSupport", "LitElement", "observedAttributes", "Object", "getOwnPropertyDescriptor", "getPrototypeOf", "get", "defineProperty", "call", "this", "attributeChangedCallback", "prototype", "name", "old", "value", "connectedCallback", "hasAttribute", "createRenderRoot", "shadowRoot", "_$needsHydration", "update", "changedProperties", "render", "hydrate", "renderRoot", "renderOptions", "styledScopes", "Set", "scopeCssStore", "Map", "_b", "globalThis", "litHtmlPolyfillSupport", "Template", "ChildPart", "window", "ShadyCSS", "nativeShadow", "ApplyShim", "needsPrepareStyles", "name", "has", "cssForScope", "scopeCss", "get", "set", "scopedTemplateCache", "originalCreateElement", "createElement", "html", "options", "element", "call", "scope", "prepareTemplateDom", "styles", "content", "querySelectorAll", "push", "apply", "Array", "from", "map", "style", "_a", "parentNode", "removeChild", "textContent", "renderContainer", "document", "createDocumentFragment", "renderContainerMarker", "createComment", "childPartProto", "prototype", "setValue", "_$setValue", "value", "directiveParent", "this", "container", "_$startNode", "ShadowRoot", "startNode", "endNode", "_$endNode", "appendChild", "template", "_$committedValue", "_$template", "el", "hasScopeCss", "length", "join", "add", "delete", "prepareTemplateStyles", "querySelector", "u", "cloneNode", "insertBefore", "_$getTemplate", "result", "templateCache", "strings", "global", "supportsAdoptingStyleSheets", "constructionToken", "cssTagCache", "CSSResult", "unsafeCSS", "css", "adoptStyles", "getCompatibleStyle", "window", "ShadowRoot", "ShadyCSS", "nativeShadow", "Document", "prototype", "CSSStyleSheet", "Symbol", "WeakMap", "constructor", "cssText", "strings", "safeToken", "this", "Error", "_strings", "styleSheet", "_styleSheet", "cacheable", "length", "get", "replaceSync", "set", "toString", "value", "String", "values", "reduce", "acc", "v", "idx", "renderRoot", "styles", "adoptedStyleSheets", "map", "s", "forEach", "style", "document", "createElement", "nonce", "setAttribute", "textContent", "appendChild", "sheet", "rule", "cssRules", "global", "trustedTypes", "emptyStringForBooleanAttribute", "polyfillSupport", "defaultConverter", "notEqual", "defaultPropertyDeclaration", "ReactiveElement", "window", "emptyScript", "reactiveElementPolyfillSupport", "toAttribute", "value", "type", "Boolean", "Object", "Array", "JSON", "stringify", "fromAttribute", "fromValue", "Number", "parse", "e", "old", "attribute", "String", "converter", "reflect", "hasChanged", "HTMLElement", "constructor", "super", "this", "__instanceProperties", "Map", "isUpdatePending", "hasUpdated", "__reflectingProperty", "_initialize", "static", "initializer", "finalize", "_a", "_initializers", "push", "observedAttributes", "attributes", "elementProperties", "forEach", "v", "p", "attr", "__attributeNameForProperty", "__attributeToPropertyMap", "set", "name", "options", "state", "noAccessor", "prototype", "hasOwnProperty", "key", "Symbol", "descriptor", "getPropertyDescriptor", "defineProperty", "get", "oldValue", "requestUpdate", "configurable", "enumerable", "superCtor", "getPrototypeOf", "props", "properties", "propKeys", "getOwnPropertyNames", "getOwnPropertySymbols", "createProperty", "elementStyles", "finalizeStyles", "styles", "isArray", "Set", "flat", "Infinity", "reverse", "s", "unshift", "getCompatibleStyle", "toLowerCase", "__updatePromise", "Promise", "res", "enableUpdating", "_$changedProperties", "__saveInstanceProperties", "i", "addController", "controller", "__controllers", "renderRoot", "isConnected", "_b", "hostConnected", "call", "removeController", "splice", "indexOf", "_v", "createRenderRoot", "shadowRoot", "attachShadow", "shadowRootOptions", "adoptStyles", "connectedCallback", "c", "_requestedUpdate", "disconnectedCallback", "hostDisconnected", "attributeChangedCallback", "_old", "_$attributeToProperty", "__propertyToAttribute", "attrValue", "undefined", "removeAttribute", "setAttribute", "ctor", "propName", "getPropertyOptions", "shouldRequestUpdate", "has", "__reflectingProperties", "__enqueueUpdate", "async", "reject", "result", "scheduleUpdate", "performUpdate", "shouldUpdate", "changedProperties", "willUpdate", "hostUpdate", "update", "__markUpdated", "_$didUpdate", "_changedProperties", "hostUpdated", "firstUpdated", "updated", "updateComplete", "getUpdateComplete", "k", "mode", "_d", "reactiveElementVersions", "UpdatingElement", "LitElement", "polyfillSupport", "_$LE", "ReactiveElement", "constructor", "this", "renderOptions", "host", "__childPart", "createRenderRoot", "renderRoot", "super", "_a", "_b", "renderBefore", "firstChild", "update", "changedProperties", "value", "render", "hasUpdated", "isConnected", "connectedCallback", "setConnected", "disconnectedCallback", "noChange", "globalThis", "litElementHydrateSupport", "call", "litElementPolyfillSupport", "_$attributeToProperty", "el", "name", "_$changedProperties", "_c", "litElementVersions", "push", "legacyPrototypeMethod", "standardPrototypeMethod", "decorateProperty", "descriptor", "proto", "name", "Object", "defineProperty", "element", "kind", "placement", "key", "finisher", "protoOrDescriptor", "_a", "originalKey", "info", "undefined", "ctor", "constructor", "customElement", "tagName", "classOrDescriptor", "clazz", "customElements", "define", "descriptor", "kind", "elements", "finisher", "property", "options", "protoOrDescriptor", "name", "proto", "constructor", "createProperty", "standardProperty", "element", "kind", "descriptor", "finisher", "clazz", "key", "Symbol", "placement", "originalKey", "initializer", "this", "call", "state", "options", "property", "eventOptions", "options", "decorateProperty", "finisher", "ctor", "name", "Object", "assign", "prototype", "query", "selector", "cache", "decorateProperty", "descriptor", "name", "get", "_b", "_a", "this", "renderRoot", "querySelector", "enumerable", "configurable", "key", "Symbol", "o", "t", "queryAll", "selector", "decorateProperty", "descriptor", "_name", "get", "_b", "_a", "this", "renderRoot", "querySelectorAll", "enumerable", "configurable", "queryAsync", "selector", "decorateProperty", "descriptor", "_name", "async", "this", "updateComplete", "_a", "renderRoot", "querySelector", "enumerable", "configurable", "queryAssignedElements", "options", "slot", "selector", "decorateProperty", "descriptor", "_name", "get", "slotSelector", "slotEl", "_a", "this", "renderRoot", "querySelector", "elements", "slotAssignedElements", "filter", "node", "matches", "enumerable", "configurable", "window", "HTMLSlotElement", "prototype", "assignedElements", "opts", "assignedNodes", "nodeType", "Node", "ELEMENT_NODE", "queryAssignedNodes", "slotOrOptions", "flatten", "selector", "assignedNodesOptions", "slot", "queryAssignedElements", "decorateProperty", "descriptor", "_name", "get", "slotSelector", "slotEl", "_a", "this", "renderRoot", "querySelector", "_b", "assignedNodes", "enumerable", "configurable", "console", "warn", "classMap", "directive", "Directive", "constructor", "partInfo", "super", "type", "PartType", "ATTRIBUTE", "name", "_a", "strings", "length", "Error", "render", "classInfo", "Object", "keys", "filter", "key", "join", "update", "part", "this", "_previousClasses", "Set", "_staticClasses", "split", "s", "has", "add", "classList", "element", "forEach", "remove", "delete", "value", "_b", "noChange", "forAwaitOf", "PseudoWeakRef", "Pauser", "async", "iterable", "callback", "v", "constructor", "ref", "this", "_ref", "disconnect", "reconnect", "deref", "_promise", "_resolve", "get", "pause", "_a", "Promise", "resolve", "resume", "call", "AsyncReplaceDirective", "asyncReplace", "AsyncDirective", "constructor", "this", "__weakThis", "PseudoWeakRef", "__pauser", "Pauser", "render", "value", "_mapper", "noChange", "update", "_part", "mapper", "isConnected", "disconnected", "__value", "i", "weakThis", "pauser", "forAwaitOf", "async", "v", "get", "_this", "deref", "commitValue", "_index", "setValue", "disconnect", "pause", "reconnected", "reconnect", "resume", "directive", "asyncAppend", "directive", "AsyncReplaceDirective", "constructor", "partInfo", "super", "type", "PartType", "CHILD", "Error", "update", "part", "params", "this", "__childPart", "commitValue", "value", "index", "clearPart", "newPart", "insertPart", "setChildPartValue", "cache", "directive", "Directive", "constructor", "partInfo", "super", "this", "_templateCache", "WeakMap", "render", "v", "update", "containerPart", "isTemplateResult", "_value", "strings", "childPart", "getCommittedValue", "pop", "cachedContainerPart", "get", "fragment", "document", "createDocumentFragment", "nothing", "setConnected", "set", "setCommittedValue", "insertPart", "cachedPart", "clearPart", "initialValue", "guard", "directive", "Directive", "constructor", "this", "_previousValue", "render", "_value", "f", "update", "_part", "value", "Array", "isArray", "length", "every", "v", "i", "noChange", "from", "ifDefined", "value", "nothing", "live", "directive", "Directive", "constructor", "partInfo", "super", "type", "PartType", "PROPERTY", "ATTRIBUTE", "BOOLEAN_ATTRIBUTE", "Error", "isSingleExpression", "render", "value", "update", "part", "noChange", "nothing", "element", "name", "hasAttribute", "getAttribute", "String", "setCommittedValue", "createRef", "Ref", "lastElementForContextAndCallback", "ref", "WeakMap", "directive", "AsyncDirective", "render", "_ref", "nothing", "update", "part", "refChanged", "this", "_updateRefValue", "undefined", "_lastElementForRef", "_element", "_context", "_a", "options", "host", "element", "context", "globalThis", "lastElementForCallback", "get", "set", "call", "value", "t", "_b", "_c", "disconnected", "reconnected", "generateMap", "repeat", "list", "start", "end", "map", "Map", "i", "set", "directive", "Directive", "constructor", "partInfo", "super", "type", "PartType", "CHILD", "Error", "_getValuesAndKeys", "items", "keyFnOrTemplate", "template", "keyFn", "keys", "values", "index", "item", "render", "this", "update", "containerPart", "oldParts", "getCommittedValue", "newValues", "newKeys", "Array", "isArray", "_itemKeys", "oldKeys", "_a", "newParts", "newKeyToIndexMap", "oldKeyToIndexMap", "oldHead", "oldTail", "length", "newHead", "newTail", "setChildPartValue", "insertPart", "has", "oldIndex", "get", "oldPart", "newPart", "removePart", "setCommittedValue", "noChange", "styleMap", "directive", "Directive", "constructor", "partInfo", "super", "type", "PartType", "ATTRIBUTE", "name", "_a", "strings", "length", "Error", "render", "styleInfo", "Object", "keys", "reduce", "style", "prop", "value", "replace", "toLowerCase", "update", "part", "element", "this", "_previousStyleProperties", "Set", "add", "forEach", "delete", "includes", "removeProperty", "setProperty", "noChange", "templateContent", "directive", "Directive", "constructor", "partInfo", "super", "type", "PartType", "CHILD", "Error", "render", "template", "this", "_previousTemplate", "noChange", "document", "importNode", "content", "UnsafeHTMLDirective", "unsafeHTML", "Directive", "constructor", "partInfo", "super", "this", "_value", "nothing", "type", "PartType", "CHILD", "Error", "directiveName", "render", "value", "_templateResult", "noChange", "strings", "raw", "_$litType$", "resultType", "values", "directive", "UnsafeSVGDirective", "unsafeSVG", "UnsafeHTMLDirective", "directiveName", "resultType", "directive", "isPromise", "UntilDirective", "until", "x", "isPrimitive", "then", "AsyncDirective", "constructor", "this", "__lastRenderedIndex", "__values", "__weakThis", "PseudoWeakRef", "__pauser", "Pauser", "render", "args", "i", "find", "_a", "noChange", "update", "_part", "previousValues", "previousLength", "length", "weakThis", "pauser", "isConnected", "disconnected", "value", "Promise", "resolve", "async", "result", "get", "_this", "deref", "index", "indexOf", "setValue", "disconnect", "pause", "reconnected", "reconnect", "resume", "directive", "choose", "value", "cases", "defaultCase", "c", "join", "items", "joiner", "isFunction", "i", "value", "keyed", "directive", "Directive", "constructor", "this", "key", "nothing", "render", "k", "v", "update", "part", "setCommittedValue", "map", "items", "f", "i", "value", "range", "startOrEnd", "end", "step", "start", "i", "when", "condition", "trueCase", "falseCase", "require_dist", "__commonJSMin", "exports", "__createBinding", "o", "m", "k", "k2", "desc", "__exportStar", "p", "lit_html_1", "Render", "config", "cls", "Renderer", "res", "setState", "shadowRoot", "_a", "_c", "_b", "detail", "error", "value", "template", "state", "exports", "__decorate", "__exportStar", "exports", "lit_html_1", "DefineDependencies", "deps", "injection", "index", "dep", "exports", "waitBeforeTrigger", "_a", "Partial", "options", "state", "loading", "error", "render", "setState", "shadowRoot", "Component", "Settings", "Providers", "State", "Render", "Loading", "Error", "require_interfaces", "__commonJSMin", "exports", "FlattenOperator", "require_utils", "__commonJSMin", "exports", "combineReducers", "rxjs_1", "operators_1", "isObject", "value", "hasType", "action", "compose", "fns", "f", "g", "args", "e", "flatCatch", "o", "mapToObservable", "reducers", "state", "hasChanged", "nextState", "key", "reducer", "prev", "next", "require_reducer_factory", "__commonJSMin", "exports", "reducerFactory$", "operators_1", "utils_1", "initialState", "reducer", "middleware", "_reducer", "state", "action", "require_defaults", "__commonJSMin", "exports", "getDefaults", "rxjs_1", "interfaces_1", "utils_1", "operators_1", "fop", "config", "options", "dispatchSubject", "_a", "reducer$", "state", "action", "actions$", "actionStream$", "actionFlatten", "initialState$", "middleware$", "destroy$", "stateFlatten", "flattenState$", "source", "bufferSize", "windowTime", "require_devtools", "__commonJSMin", "exports", "normalizeDevToolsConfig", "withDevToolsTimeTravel", "connectReduxDevTools", "rxjs_1", "operators_1", "config", "options", "reducerFn", "state", "action", "store", "_a", "_b", "extension", "devTools", "subscription", "currentState", "unsubscribeMessages", "message", "kind", "require_store", "__commonJSMin", "exports", "createStore", "rxjs_1", "operators_1", "reducer_factory_1", "defaults_1", "devtools_1", "Store", "config", "options", "_a", "_b", "_c", "_d", "action", "devToolsOptions", "state", "reducerFn", "reducer$", "actions$", "actionStream$", "middleware$", "initialState$", "destroy$", "flattenState$", "shareReplayConfig", "err", "disconnect", "opts", "require_middleware", "__commonJSMin", "exports", "mapPS", "mapFn", "reducer", "state", "Action", "mapNS", "mapA", "filterPS", "filterFn", "filterNS", "nextState", "filterA", "reducePS", "reducerFn", "reduceNS", "reduceA", "require_effects", "__commonJSMin", "exports", "ofType", "createEffect", "createSubscriptionEffect", "createEpicRegistry", "rxjs_1", "operators_1", "actionCreators", "action$", "action", "creator", "options", "effectFactory", "state$", "mappedEffect$", "error", "destroy$", "effects", "effect", "require_dist", "__commonJSMin", "exports", "__createBinding", "o", "m", "k", "k2", "desc", "__exportStar", "p", "interfaces_1", "store_1", "devtools_1", "utils_1", "init_esm5", "init_operators", "AGENT", "EMBED_AGENT", "SESSION", "SUMMARY", "MESSAGE", "EVENT", "DOCS", "SERVER_CODES", "LambforgeError", "message", "code", "status", "errorFromGraphQL", "errors", "first", "prefix", "init_esm5", "DEFAULT_URL", "graphqlUrl", "url", "subscriptionsUrl", "request$", "endpoint", "token", "query", "variables", "field", "Observable", "subscriber", "controller", "fetchImpl", "LambforgeError", "res", "body", "errorFromGraphQL", "e", "init_esm5", "WS_PROTOCOLS", "subscription$", "o", "Observable", "subscriber", "done", "ws", "modern", "send", "msg", "fail", "e", "ev", "payload", "errorFromGraphQL", "LambforgeError", "unauthorized", "lazy$", "source", "defer", "value", "isObservable", "take", "from", "RENEW_BEFORE_MS", "DEVICE_KEY", "RECONNECT_MAX_MS", "AgentClient", "options", "LambforgeError", "DEFAULT_URL", "of", "tap", "s", "expires", "map", "finalize", "shareReplay", "o", "t", "projectId", "idToken", "agents", "switchMap", "token", "request$", "DOCS", "a", "turnstileToken", "deviceId", "query", "variables", "field", "once", "catchError", "e", "throwError", "agent", "conversationId", "AgentConversation", "afterSeq", "Observable", "subscriber", "last", "held", "subs", "Subscription", "catching", "again", "flush", "accept", "catchUp", "list", "WS", "timer", "attempt", "renewed", "connect", "subscription$", "subscriptionsUrl", "wait", "client", "id", "text", "sent", "takeWhile", "c", "storage", "stored", "import_component", "import_lit_html", "init_esm5", "init_operators", "import_lit_html", "SAFE_LINK", "BULLET", "NUMBERED", "FENCE", "HEADING", "renderMarkdown", "text", "out", "lines", "i", "line", "fence", "code", "heading", "inline", "ordered", "marker", "items", "para", "l", "k", "TOKEN", "rest", "m", "t", "label", "href", "link", "__assign", "t", "s", "i", "p", "action", "type", "config", "defineType", "args", "_i", "as", "payload", "meta", "props", "payload", "defineType", "type", "creator", "__spreadArrays", "s", "i", "il", "r", "k", "a", "j", "jl", "on", "args", "_i", "reducer", "types", "result", "creator", "initialState", "ons", "map", "_a", "ons_1", "on_1", "_b", "_c", "type", "state", "action", "shown", "action", "payload", "connecting", "failed", "verifying", "agentsLoaded", "pickAgent", "historyLoaded", "newConversation", "sendMessage", "resume", "agentEvent", "runEnded", "stop", "import_redux_store", "init_esm5", "init_operators", "errorCode", "e", "fail", "of", "failed", "pickAgents", "all", "ctx", "agents", "a", "preferred", "ChatEffects", "_action$", "state$", "filter", "s", "take", "switchMap", "client", "concat", "connecting", "map", "agentsLoaded", "catchError", "action$", "merge", "payload", "pickAgent", "id", "agentId", "list", "latest", "mergeMap", "detail", "from", "historyLoaded", "resume", "EMPTY", "sendMessage", "conversationId", "text", "c", "afterSeq", "events", "takeUntil", "stop", "newConversation", "endWith", "runEnded", "ignoreElements", "tap", "announced", "takeWhile", "agentEvent", "initialChatState", "toMessage", "m", "tools", "c", "n", "LOCAL_ID", "empty", "chatReducer", "reducer", "initialChatState", "on", "shown", "s", "payload", "connecting", "failed", "verifying", "agentsLoaded", "pickAgent", "historyLoaded", "toMessage", "newConversation", "sendMessage", "agentEvent", "withEvent", "runEnded", "stop", "event", "conversationId", "message", "m", "messages", "local", "import_redux_store", "init_esm5", "init_operators", "ChatStore", "ctx", "initial", "Subject", "effects", "ChatEffects", "of", "chatReducer", "initialChatState", "distinctUntilChanged", "action", "en", "bg", "LOCALES", "stringsFor", "locale", "overrides", "lang", "base", "STYLES", "HOSTED_TURNSTILE_URL", "SCRIPT", "loading", "loadTurnstile", "doc", "win", "resolve", "reject", "s", "SCRIPT", "turnstileToken", "opts", "api", "box", "id", "end", "token", "url", "HOSTED_TURNSTILE_URL", "frame", "timer", "done", "onMessage", "ev", "data", "err", "TAG", "ICON_CHAT", "ICON_CLOSE", "ICON_NEW", "icon", "paths", "LambforgeAgentChat", "stringsFor", "defer", "store", "ChatStore", "s", "type", "detail", "finalize", "action", "shown", "url", "source", "AgentClient", "tokenUrl", "r", "verifying", "host", "turnstileToken", "i", "box", "text", "state", "clean", "sendMessage", "stop", "agentId", "pickAgent", "newConversation", "open", "ev", "input", "panel", "focusable", "el", "first", "last", "active", "notice", "t", "drawer", "agent", "a", "title", "m", "renderMarkdown", "__decorateClass", "STYLES", "script", "ATTRS", "mount", "el", "TAG", "data", "attr", "value"]
7
+ }