dexie-cloud-addon 4.0.1-beta.46 → 4.0.1-beta.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modern/dexie-cloud-addon.js +471 -313
- package/dist/modern/dexie-cloud-addon.js.map +1 -1
- package/dist/modern/dexie-cloud-addon.min.js +1 -1
- package/dist/modern/dexie-cloud-addon.min.js.map +1 -1
- package/dist/modern/service-worker.js +455 -245
- package/dist/modern/service-worker.js.map +1 -1
- package/dist/modern/service-worker.min.js +1 -1
- package/dist/modern/service-worker.min.js.map +1 -1
- package/dist/types/DexieCloudAPI.d.ts +3 -0
- package/dist/types/DexieCloudOptions.d.ts +1 -0
- package/dist/types/InvalidLicenseError.d.ts +5 -0
- package/dist/types/authentication/TokenErrorResponseError.d.ts +10 -0
- package/dist/types/authentication/authenticate.d.ts +3 -3
- package/dist/types/authentication/interactWithUser.d.ts +3 -0
- package/dist/types/authentication/logout.d.ts +5 -0
- package/dist/types/authentication/waitUntil.d.ts +3 -0
- package/dist/types/currentUserEmitter.d.ts +1 -1
- package/dist/types/db/entities/UserLogin.d.ts +6 -0
- package/dist/types/default-ui/LoginDialog.d.ts +2 -5
- package/dist/types/dexie-cloud-client.d.ts +2 -0
- package/dist/types/helpers/resolveText.d.ts +14 -0
- package/dist/types/isEagerSyncDisabled.d.ts +2 -0
- package/dist/types/middlewares/createMutationTrackingMiddleware.d.ts +1 -1
- package/dist/types/prodLog.d.ts +9 -0
- package/dist/types/sync/performGuardedJob.d.ts +2 -4
- package/dist/types/sync/ratelimit.d.ts +3 -0
- package/dist/types/sync/sync.d.ts +0 -1
- package/dist/types/types/DXCAlert.d.ts +1 -1
- package/dist/types/types/DXCUserInteraction.d.ts +40 -2
- package/dist/types/types/SyncState.d.ts +1 -0
- package/dist/umd/dexie-cloud-addon.js +470 -312
- package/dist/umd/dexie-cloud-addon.js.map +1 -1
- package/dist/umd/dexie-cloud-addon.min.js +1 -1
- package/dist/umd/dexie-cloud-addon.min.js.map +1 -1
- package/dist/umd/service-worker.js +453 -243
- package/dist/umd/service-worker.js.map +1 -1
- package/dist/umd/service-worker.min.js +1 -1
- package/dist/umd/service-worker.min.js.map +1 -1
- package/package.json +7 -6
- package/LICENSE +0 -202
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dexie-cloud-addon.js","sources":["../../../../node_modules/.pnpm/tslib@2.4.0/node_modules/tslib/tslib.es6.js","../../../../libs/dexie-cloud-common/dist/utils.js","../../../../libs/dexie-cloud-common/dist/validation/isValidSyncableID.js","../../../../libs/dexie-cloud-common/dist/change-processing/applyOperation.js","../../../../libs/dexie-cloud-common/dist/change-processing/applyOperations.js","../../../../libs/dexie-cloud-common/dist/change-processing/subtractChanges.js","../../../../libs/dexie-cloud-common/dist/change-processing/toDBOperationSet.js","../../../../libs/dexie-cloud-common/dist/getDbNameFromDbUrl.js","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/isFunction.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/lift.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/isArrayLike.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/isPromise.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/createErrorClass.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/UnsubscriptionError.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/arrRemove.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/Subscription.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/config.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduler/timeoutProvider.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/reportUnhandledError.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/noop.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/NotificationFactories.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/errorContext.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/Subscriber.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/symbol/observable.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/identity.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/pipe.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/Observable.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/isInteropObservable.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/isAsyncIterable.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/throwUnobservableError.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/symbol/iterator.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/isIterable.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/isReadableStreamLike.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/observable/innerFrom.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/OperatorSubscriber.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduler/Action.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduler/intervalProvider.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduler/AsyncAction.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduler/dateTimestampProvider.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/Scheduler.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduler/AsyncScheduler.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduler/async.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/isScheduler.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/isDate.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/observable/timer.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/args.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/executeSchedule.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/catchError.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/observeOn.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/subscribeOn.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduled/scheduleObservable.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduled/schedulePromise.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduled/scheduleArray.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduled/scheduleIterable.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduled/scheduleAsyncIterable.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduled/scheduleReadableStreamLike.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduled/scheduled.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/observable/from.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/map.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/mergeInternals.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/mergeMap.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/mergeAll.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/concatAll.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/debounceTime.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/observable/concat.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/observable/empty.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/take.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/ignoreElements.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/mapTo.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/delayWhen.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/delay.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/distinctUntilChanged.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/filter.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/skip.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/startWith.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/switchMap.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/tap.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/timeout.ts","../../src/sync/registerSyncEvent.ts","../../src/sync/triggerSync.ts","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/common/base64.js","../../src/authentication/interactWithUser.ts","../../src/authentication/authenticate.ts","../../src/authentication/AuthPersistedContext.ts","../../src/errors/HttpError.ts","../../src/authentication/otpFetchTokenCallback.ts","../../src/authentication/setCurrentUser.ts","../../src/authentication/login.ts","../../src/authentication/UNAUTHORIZED_USER.ts","../../src/helpers/SWBroadcastChannel.ts","../../src/helpers/BroadcastedAndLocalEvent.ts","../../src/helpers/computeRealmSetHash.ts","../../src/helpers/getSyncableTables.ts","../../src/helpers/getMutationTable.ts","../../src/helpers/getTableFromMutationTable.ts","../../src/helpers/flatten.ts","../../src/sync/listClientChanges.ts","../../src/helpers/randomString.ts","../../src/sync/listSyncifiedChanges.ts","../../src/sync/getTablesToSyncify.ts","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/TypesonSimplified.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/BisonBinaryTypes.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/types/number.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/types/bigint.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/types/Date.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/types/Set.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/types/Map.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/common/_global.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/types/TypedArray.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/common/b64lex.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/types/ArrayBuffer.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/FakeBlob.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/readBlobSync.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/string2arraybuffer.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/types/Blob.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/presets/builtin.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/Bison.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/types/undefined.js","../../src/TSON.ts","../../src/sync/encodeIdsForServer.ts","../../src/sync/syncWithServer.ts","../../src/sync/modifyLocalObjectsWithNewUserId.ts","../../src/helpers/CancelToken.ts","../../src/sync/isOnline.ts","../../src/sync/updateBaseRevs.ts","../../src/sync/getLatestRevisionsPerTable.ts","../../src/helpers/bulkUpdate.ts","../../src/sync/applyServerChanges.ts","../../src/sync/sync.ts","../../src/sync/messagesFromServerQueue.ts","../../src/db/DexieCloudDB.ts","../../src/isFirefox.ts","../../src/isSafari.ts","../../src/DISABLE_SERVICEWORKER_STRATEGY.ts","../../src/helpers/dbOnClosed.ts","../../src/helpers/IS_SERVICE_WORKER.ts","../../src/helpers/throwVersionIncrementNeeded.ts","../../src/middleware-helpers/idGenerationHelpers.ts","../../src/middlewares/createIdGenerationMiddleware.ts","../../src/middlewares/createImplicitPropSetterMiddleware.ts","../../src/helpers/allSettled.ts","../../src/middleware-helpers/guardedTable.ts","../../src/middlewares/outstandingTransaction.ts","../../src/middlewares/createMutationTrackingMiddleware.ts","../../src/overrideParseStoresSpec.ts","../../src/performInitialSync.ts","../../src/userIsActive.ts","../../src/authentication/TokenExpiredError.ts","../../src/WSObservable.ts","../../src/sync/connectWebSocket.ts","../../src/sync/isSyncNeeded.ts","../../src/helpers/date-constants.ts","../../src/sync/myId.ts","../../src/sync/performGuardedJob.ts","../../src/sync/syncIfPossible.ts","../../src/sync/LocalSyncWorker.ts","../../src/updateSchemaFromOptions.ts","../../src/verifySchema.ts","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/util.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/options.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/create-element.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/component.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/create-context.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/constants.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/diff/children.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/diff/props.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/diff/index.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/render.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/diff/catch-error.js","../../src/default-ui/Styles.ts","../../src/default-ui/Dialog.tsx","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/hooks/src/index.js","../../src/helpers/resolveText.ts","../../src/default-ui/LoginDialog.tsx","../../src/default-ui/index.tsx","../../src/computeSyncState.ts","../../src/associate.ts","../../src/createSharedValueObservable.ts","../../src/getGlobalRolesObservable.ts","../../src/currentUserEmitter.ts","../../src/getInternalAccessControlObservable.ts","../../src/mapValueObservable.ts","../../src/mergePermissions.ts","../../src/getPermissionsLookupObservable.ts","../../src/PermissionChecker.ts","../../src/permissions.ts","../../src/getInvitesObservable.ts","../../src/getTiedRealmId.ts","../../src/dexie-cloud-client.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\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\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\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\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","export function assert(b) {\n if (!b)\n throw new Error('Assertion Failed');\n}\nconst _hasOwn = {}.hasOwnProperty;\nexport function hasOwn(obj, prop) {\n return _hasOwn.call(obj, prop);\n}\nexport function setByKeyPath(obj, keyPath, value) {\n if (!obj || keyPath === undefined)\n return;\n if ('isFrozen' in Object && Object.isFrozen(obj))\n return;\n if (typeof keyPath !== 'string' && 'length' in keyPath) {\n assert(typeof value !== 'string' && 'length' in value);\n for (var i = 0, l = keyPath.length; i < l; ++i) {\n setByKeyPath(obj, keyPath[i], value[i]);\n }\n }\n else {\n var period = keyPath.indexOf('.');\n if (period !== -1) {\n var currentKeyPath = keyPath.substr(0, period);\n var remainingKeyPath = keyPath.substr(period + 1);\n if (remainingKeyPath === '')\n if (value === undefined) {\n if (Array.isArray(obj)) {\n if (!isNaN(parseInt(currentKeyPath)))\n obj.splice(parseInt(currentKeyPath), 1);\n }\n else\n delete obj[currentKeyPath];\n // @ts-ignore: even if currentKeyPath would be numeric string and obj would be array - it works.\n }\n else\n obj[currentKeyPath] = value;\n else {\n //@ts-ignore: even if currentKeyPath would be numeric string and obj would be array - it works.\n var innerObj = obj[currentKeyPath];\n //@ts-ignore: even if currentKeyPath would be numeric string and obj would be array - it works.\n if (!innerObj || !hasOwn(obj, currentKeyPath))\n innerObj = (obj[currentKeyPath] = {});\n setByKeyPath(innerObj, remainingKeyPath, value);\n }\n }\n else {\n if (value === undefined) {\n if (Array.isArray(obj) && !isNaN(parseInt(keyPath)))\n // @ts-ignore: even if currentKeyPath would be numeric string and obj would be array - it works.\n obj.splice(keyPath, 1);\n //@ts-ignore: even if currentKeyPath would be numeric string and obj would be array - it works.\n else\n delete obj[keyPath];\n //@ts-ignore: even if currentKeyPath would be numeric string and obj would be array - it works.\n }\n else\n obj[keyPath] = value;\n }\n }\n}\nexport const randomString = typeof self !== 'undefined' && typeof crypto !== 'undefined' ? (bytes, randomFill = crypto.getRandomValues.bind(crypto)) => {\n // Web\n const buf = new Uint8Array(bytes);\n randomFill(buf);\n return self.btoa(String.fromCharCode.apply(null, buf));\n} : typeof Buffer !== 'undefined' ? (bytes, randomFill = simpleRandomFill) => {\n // Node\n const buf = Buffer.alloc(bytes);\n randomFill(buf);\n return buf.toString(\"base64\");\n} : () => { throw new Error(\"No implementation of randomString was found\"); };\nfunction simpleRandomFill(buf) {\n for (let i = 0; i < buf.length; ++i) {\n buf[i] = Math.floor(Math.random() * 256);\n }\n}\n","const validIDTypes = {\n Uint8Array,\n};\n/** Verifies that given primary key is valid.\n * The reason we narrow validity for valid keys are twofold:\n * 1: Make sure to only support types that can be used as an object index in DBKeyMutationSet.\n * For example, ArrayBuffer cannot be used (gives \"object ArrayBuffer\") but Uint8Array can be\n * used (gives comma-delimited list of included bytes).\n * 2: Avoid using plain numbers and Dates as keys when they are synced, as they are not globally unique.\n * 3: Since we store the key as a VARCHAR server side in current version, try not promote types that stringifies to become very long server side.\n *\n * @param id\n * @returns\n */\nexport function isValidSyncableID(id) {\n if (typeof id === \"string\")\n return true;\n //if (validIDTypes[toStringTag(id)]) return true;\n //if (Array.isArray(id)) return id.every((part) => isValidSyncableID(part));\n if (Array.isArray(id) && id.some(key => isValidSyncableID(key)) && id.every(isValidSyncableIDPart))\n return true;\n return false;\n}\n/** Verifies that given key part is valid.\n * 1: Make sure that arrays of this types are stringified correclty and works with DBKeyMutationSet.\n * For example, ArrayBuffer cannot be used (gives \"object ArrayBuffer\") but Uint8Array can be\n * used (gives comma-delimited list of included bytes).\n * 2: Since we store the key as a VARCHAR server side in current version, try not promote types that stringifies to become very long server side.\n*/\nfunction isValidSyncableIDPart(part) {\n return typeof part === \"string\" || typeof part === \"number\" || Array.isArray(part) && part.every(isValidSyncableIDPart);\n}\nexport function isValidAtID(id, idPrefix) {\n return !idPrefix || (typeof id === \"string\" && id.startsWith(idPrefix));\n}\n","import { setByKeyPath } from \"../utils.js\";\nexport function applyOperation(target, table, op) {\n const tbl = target[table] || (target[table] = {});\n const keys = op.keys.map(key => typeof key === 'string' ? key : JSON.stringify(key));\n switch (op.type) {\n case \"insert\":\n // TODO: Don't treat insert and upsert the same?\n case \"upsert\":\n keys.forEach((key, idx) => {\n tbl[key] = {\n type: \"ups\",\n val: op.values[idx],\n };\n });\n break;\n case \"update\":\n case \"modify\": {\n keys.forEach((key, idx) => {\n const changeSpec = op.type === \"update\"\n ? op.changeSpecs[idx]\n : op.changeSpec;\n const entry = tbl[key];\n if (!entry) {\n tbl[key] = {\n type: \"upd\",\n mod: changeSpec,\n };\n }\n else {\n switch (entry.type) {\n case \"ups\":\n // Adjust the existing upsert with additional updates\n for (const [propPath, value] of Object.entries(changeSpec)) {\n setByKeyPath(entry.val, propPath, value);\n }\n break;\n case \"del\":\n // No action.\n break;\n case \"upd\":\n // Adjust existing update with additional updates\n Object.assign(entry.mod, changeSpec); // May work for deep props as well - new keys is added later, right? Does the prop order persist along TSON and all? But it will not be 100% when combined with some server code (seach for \"address.city\": \"Stockholm\" comment)\n break;\n }\n }\n });\n break;\n }\n case \"delete\":\n keys.forEach((key) => {\n tbl[key] = {\n type: \"del\",\n };\n });\n break;\n }\n return target;\n}\n","import { applyOperation } from \"./applyOperation.js\";\nexport function applyOperations(target, ops) {\n for (const { table, muts } of ops) {\n for (const mut of muts) {\n applyOperation(target, table, mut);\n }\n }\n}\n","import { setByKeyPath } from '../utils.js';\nexport function subtractChanges(target, // Server change set\nchangesToSubtract // additional mutations on client during syncWithServer()\n) {\n var _a, _b, _c;\n for (const [table, mutationSet] of Object.entries(changesToSubtract)) {\n for (const [key, mut] of Object.entries(mutationSet)) {\n switch (mut.type) {\n case 'ups':\n {\n const targetMut = (_a = target[table]) === null || _a === void 0 ? void 0 : _a[key];\n if (targetMut) {\n switch (targetMut.type) {\n case 'ups':\n delete target[table][key];\n break;\n case 'del':\n // Leave delete operation.\n // (Don't resurrect objects unintenionally (using tx(get, put) pattern locally))\n break;\n case 'upd':\n delete target[table][key];\n break;\n }\n }\n }\n break;\n case 'del':\n (_b = target[table]) === null || _b === void 0 ? true : delete _b[key];\n break;\n case 'upd': {\n const targetMut = (_c = target[table]) === null || _c === void 0 ? void 0 : _c[key];\n if (targetMut) {\n switch (targetMut.type) {\n case 'ups':\n // Adjust the server upsert with locally updated values.\n for (const [propPath, value] of Object.entries(mut.mod)) {\n setByKeyPath(targetMut.val, propPath, value);\n }\n break;\n case 'del':\n // Leave delete.\n break;\n case 'upd':\n // Remove the local update props from the server update mutation.\n for (const propPath of Object.keys(mut.mod)) {\n delete targetMut.mod[propPath];\n }\n break;\n }\n }\n break;\n }\n }\n }\n }\n}\n","import { randomString } from \"../utils.js\";\n/** Convert a DBKeyMutationSet (which is an internal format capable of looking up changes per ID)\n * ...into a DBOperationsSet (which is more optimal for performing DB operations into DB (bulkAdd() etc))\n *\n * @param inSet\n * @returns DBOperationsSet representing inSet\n */\nexport function toDBOperationSet(inSet, txid = \"\") {\n // Fictive transaction:\n if (!txid)\n txid = randomString(16);\n // Convert data into a temporary map to collect mutations of same table and type\n const map = {};\n for (const [table, ops] of Object.entries(inSet)) {\n for (const [key, op] of Object.entries(ops)) {\n const mapEntry = map[table] || (map[table] = {});\n const ops = mapEntry[op.type] || (mapEntry[op.type] = []);\n ops.push(Object.assign({ key }, op)); // DBKeyMutation doesn't contain key, so we need to bring it in.\n }\n }\n // Start computing the resulting format:\n const result = [];\n for (const [table, ops] of Object.entries(map)) {\n const resultEntry = {\n table,\n muts: [],\n };\n for (const [optype, muts] of Object.entries(ops)) {\n switch (optype) {\n case \"ups\": {\n const op = {\n type: \"upsert\",\n keys: muts.map(mut => mut.key),\n values: muts.map(mut => mut.val),\n txid\n };\n resultEntry.muts.push(op);\n break;\n }\n case \"upd\": {\n const op = {\n type: \"update\",\n keys: muts.map(mut => mut.key),\n changeSpecs: muts.map(mut => mut.mod),\n txid\n };\n resultEntry.muts.push(op);\n break;\n }\n case \"del\": {\n const op = {\n type: \"delete\",\n keys: muts.map(mut => mut.key),\n txid,\n };\n resultEntry.muts.push(op);\n break;\n }\n }\n }\n result.push(resultEntry);\n }\n return result;\n}\n","export function getDbNameFromDbUrl(dbUrl) {\n const url = new URL(dbUrl);\n return url.pathname === \"/\"\n ? url.hostname.split('.')[0]\n : url.pathname.split('/')[1];\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","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","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","/**\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 *\n * @class Subscription\n */\nexport class Subscription implements SubscriptionLike {\n /** @nocollapse */\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 * @return {void}\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 `Subcription` 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 *\n * @class Subscriber<T>\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 * @nocollapse\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 {T} [value] The `next` value.\n * @return {void}\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 {any} [err] The `error` exception.\n * @return {void}\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 * @return {void}\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","/** Symbol.observable or a string \"@@observable\". Used for interop */\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 *\n * @class Observable<T>\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 * @constructor\n * @param {Function} subscribe the function that is called when the Observable is\n * initially subscribed to. This function is given a Subscriber, to which new values\n * can be `next`ed, or an `error` method can be called to raise an error, or\n * `complete` can be called to notify of a successful completion.\n */\n constructor(subscribe?: (this: Observable<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 * @owner Observable\n * @method create\n * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor\n * @return {Observable} a new observable\n * @nocollapse\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 * @method lift\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(observer?: Partial<Observer<T>>): Subscription;\n subscribe(next: (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 {Observer|Function} observerOrNext (optional) Either an observer with methods to be called,\n * or the first of three possible handlers, which is the handler for each value emitted from the subscribed\n * Observable.\n * @param {Function} error (optional) A handler for a terminal event resulting from an error. If no error handler is provided,\n * the error will be thrown asynchronously as unhandled.\n * @param {Function} complete (optional) A handler for a terminal event resulting from successful completion.\n * @return {Subscription} a subscription reference to the registered handlers\n * @method subscribe\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 * @method Symbol.observable\n * @return {Observable} this instance of the observable\n */\n [Symbol_observable]() {\n return this;\n }\n\n /* tslint:disable:max-line-length */\n pipe(): Observable<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 * @method pipe\n * @return {Observable} the Observable result of all of the operators having\n * been called in the order they were passed in.\n *\n * ## Example\n *\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 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 * @method toPromise\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 { 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 { 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 { 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 *\n * @class Action<T>\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 {T} [state] Some contextual data that the `work` function uses when\n * called by the Scheduler.\n * @param {number} [delay] Time to wait before executing the work, where the\n * time unit is implicit and defined by the Scheduler.\n * @return {void}\n */\n public schedule(state?: T, delay: number = 0): Subscription {\n return this;\n }\n}\n","import 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';\n\nexport class AsyncAction<T> extends Action<T> {\n public id: any;\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?: any, delay: number = 0): any {\n return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);\n }\n\n protected recycleAsyncId(_scheduler: AsyncScheduler, id: any, delay: number | null = 0): any {\n // If this action is rescheduled with the same delay time, don't clear the interval id.\n if (delay != null && this.delay === delay && this.pending === false) {\n return id;\n }\n // Otherwise, if the action's delay time is different from the current delay,\n // or the action has been rescheduled before it's executed, clear the interval id\n intervalProvider.clearInterval(id);\n return undefined;\n }\n\n /**\n * Immediately executes this action and the `work` it contains.\n * @return {any}\n */\n public execute(state: T, delay: number): any {\n 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","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 { 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 * @class Scheduler\n * @deprecated Scheduler is an internal implementation detail of RxJS, and\n * should not be used directly. Rather, create your own class and implement\n * {@link SchedulerLike}. 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 {number} A number that represents the current time. May or may not\n * have a relation to wall-clock time. May or may not refer to a time unit\n * (e.g. milliseconds).\n */\n public now: () => number;\n\n /**\n * Schedules a function, `work`, for execution. May happen at some point in\n * the future, according to the `delay` parameter, if specified. May be passed\n * some context object, `state`, which will be passed to the `work` function.\n *\n * The given arguments will be processed an stored as an Action object in a\n * queue of actions.\n *\n * @param {function(state: ?T): ?Subscription} work A function representing a\n * task, or some unit of work to be executed by the Scheduler.\n * @param {number} [delay] Time to wait before executing the work, where the\n * time unit is implicit and defined by the Scheduler itself.\n * @param {T} [state] Some contextual data that the `work` function uses when\n * called by the Scheduler.\n * @return {Subscription} A subscription in order to be able to unsubscribe\n * the scheduled work.\n */\n public schedule<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';\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 * @type {boolean}\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 * @type {any}\n * @internal\n */\n public _scheduled: any = 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\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 { SchedulerLike } from '../types';\nimport { isFunction } from './isFunction';\n\nexport function isScheduler(value: any): value is SchedulerLike {\n return value && isFunction(value.schedule);\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 { 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 { 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","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","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\n/* tslint:disable:max-line-length */\nexport function catchError<T, O extends ObservableInput<any>>(\n selector: (err: any, caught: Observable<T>) => O\n): OperatorFunction<T, T | ObservedValueOf<O>>;\n/* tslint:enable:max-line-length */\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 * \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 {function} 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. Whatever observable\n * 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","/** @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 * \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 * \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 {ObservableInput<T>} A subscription object, a Promise, an Observable-like,\n * an Array, an iterable, or an array-like object to be converted.\n * @param {SchedulerLike} An optional {@link SchedulerLike} on which to schedule the emission of values.\n * @return {Observable<T>}\n */\nexport function from<T>(input: ObservableInput<T>, scheduler?: SchedulerLike): Observable<T> {\n return scheduler ? scheduled(input, scheduler) : innerFrom(input);\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 * \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 {function(value: T, index: number): R} project The function to apply\n * to each `value` emitted by the source Observable. The `index` parameter is\n * the number `i` for the i-th emission that has happened since the\n * subscription, starting from the number `0`.\n * @param {any} [thisArg] An optional argument to define what `this` is in the\n * `project` function.\n * @return 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 { 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 * \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 {function(value: T, ?index: number): ObservableInput} project A function\n * that, when applied to an item emitted by the source Observable, returns an\n * Observable.\n * @param {number} [concurrent=Infinity] Maximum number of input\n * Observables 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 * \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 {number} [concurrent=Infinity] Maximum number of inner\n * Observables being subscribed to 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 * \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 { 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 * \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 {number} dueTime The timeout duration in milliseconds (or the time\n * unit determined internally by the optional `scheduler`) for the window of\n * time required to wait for emission silence before emitting the most recent\n * source value.\n * @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for\n * managing the timers that 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 { 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 * \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 Input Observables to concatenate.\n */\nexport function concat(...args: any[]): Observable<unknown> {\n return concatAll()(from(args, popScheduler(args)));\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 * \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 { 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 * \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 * \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’ `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 * \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 } from '../types';\nimport { concat } from '../observable/concat';\nimport { take } from './take';\nimport { ignoreElements } from './ignoreElements';\nimport { mapTo } from './mapTo';\nimport { mergeMap } from './mergeMap';\n\n/** @deprecated The `subscriptionDelay` parameter will be removed in v8. */\nexport function delayWhen<T>(\n delayDurationSelector: (value: T, index: number) => Observable<any>,\n subscriptionDelay: Observable<any>\n): MonoTypeOperatorFunction<T>;\nexport function delayWhen<T>(delayDurationSelector: (value: T, index: number) => Observable<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 * \n *\n * `delayWhen` time shifts each emitted value from the source Observable by a\n * time span determined by another Observable. When the source emits a value,\n * the `delayDurationSelector` function is called with the source value as\n * argument, and should return an Observable, called the \"duration\" Observable.\n * The source value is emitted on the output Observable only when the duration\n * Observable emits a value or completes.\n * The completion of the notifier triggering the emission of the source value\n * is deprecated behavior and will be removed in future versions.\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 {function(value: T, index: number): Observable} delayDurationSelector A function that\n * returns an Observable for each value emitted by the source Observable, which\n * is then used to delay the emission of that item on the output Observable\n * until the Observable returned from this function emits a value.\n * @param {Observable} subscriptionDelay An Observable that triggers the\n * subscription to the 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) => Observable<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) => 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 * \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 {number|Date} due The delay duration in milliseconds (a `number`) or\n * a `Date` until which the emission of the source items is delayed.\n * @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for\n * managing the timers 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 { 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 { 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 * \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 { 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 * \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 {Number} 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 { 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 * \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.</span>\n *\n * \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 {function(value: T, index: number): ObservableInput} project A function\n * that, when applied to an item emitted by the source Observable, returns an\n * Observable.\n * @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 subcriber 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 { MonoTypeOperatorFunction, Observer } from '../types';\nimport { isFunction } from '../util/isFunction';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { identity } from '../util/identity';\n\nexport interface TapObserver<T> extends Observer<T> {\n subscribe: () => void;\n unsubscribe: () => void;\n finalize: () => void;\n}\n\nexport function tap<T>(observer?: Partial<TapObserver<T>>): MonoTypeOperatorFunction<T>;\nexport function tap<T>(next: (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 * \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 Observable#subscribe}\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 { 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 *\n * @class TimeoutError\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 * \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 * \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 * \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 get 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 { DexieCloudDB } from '../db/DexieCloudDB';\n\n//const hasSW = 'serviceWorker' in navigator;\nlet hasComplainedAboutSyncEvent = false;\n\nexport async function registerSyncEvent(db: DexieCloudDB, purpose: \"push\" | \"pull\") {\n try {\n // Send sync event to SW:\n const sw: ServiceWorkerRegistration & {sync?: any} = await navigator.serviceWorker.ready;\n if (purpose === \"push\" && sw.sync) {\n await sw.sync.register(`dexie-cloud:${db.name}`);\n }\n if (sw.active) {\n // Use postMessage for pull syncs and for browsers not supporting sync event (Firefox, Safari).\n // Also chromium based browsers with sw.sync as a fallback for sleepy sync events not taking action for a while.\n sw.active.postMessage({\n type: 'dexie-cloud-sync',\n dbName: db.name,\n purpose\n });\n } else {\n throw new Error(`Failed to trigger sync - there's no active service worker`);\n }\n return;\n } catch (e) {\n if (!hasComplainedAboutSyncEvent) {\n console.debug(`Dexie Cloud: Could not register sync event`, e);\n hasComplainedAboutSyncEvent = true;\n }\n }\n}\n\nexport async function registerPeriodicSyncEvent(db: DexieCloudDB) {\n try {\n // Register periodicSync event to SW:\n // @ts-ignore\n const { periodicSync } = await navigator.serviceWorker.ready;\n if (periodicSync) {\n try {\n await periodicSync.register(\n `dexie-cloud:${db.name}`,\n db.cloud.options?.periodicSync\n );\n console.debug(\n `Dexie Cloud: Successfully registered periodicsync event for ${db.name}`\n );\n } catch (e) {\n console.debug(`Dexie Cloud: Failed to register periodic sync. Your PWA must be installed to allow background sync.`, e);\n }\n } else {\n console.debug(`Dexie Cloud: periodicSync not supported.`);\n }\n } catch (e) {\n console.debug(\n `Dexie Cloud: Could not register periodicSync for ${db.name}`,\n e\n );\n }\n}\n","import { DexieCloudDB } from \"../db/DexieCloudDB\";\nimport { registerSyncEvent } from \"./registerSyncEvent\";\n\nexport function triggerSync(db: DexieCloudDB, purpose: \"push\" | \"pull\") {\n if (db.cloud.usingServiceWorker) {\n registerSyncEvent(db, purpose);\n } else {\n db.localSyncEvent.next({purpose});\n }\n}","export const b64decode = typeof Buffer !== \"undefined\"\n ? (base64) => Buffer.from(base64, \"base64\")\n : (base64) => {\n const binary_string = atob(base64);\n const len = binary_string.length;\n const bytes = new Uint8Array(len);\n for (var i = 0; i < len; i++) {\n bytes[i] = binary_string.charCodeAt(i);\n }\n return bytes;\n };\nexport const b64encode = typeof Buffer !== \"undefined\"\n ? (b) => {\n if (ArrayBuffer.isView(b)) {\n return Buffer.from(b.buffer, b.byteOffset, b.byteLength).toString(\"base64\");\n }\n else {\n return Buffer.from(b).toString(\"base64\");\n }\n }\n : (b) => {\n return btoa(String.fromCharCode.apply(null, ArrayBuffer.isView(b) ? b : new Uint8Array(b)));\n };\n","import Dexie from 'dexie';\nimport { BehaviorSubject } from 'rxjs';\nimport { take } from 'rxjs/operators';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { DXCAlert } from '../types/DXCAlert';\nimport { DXCInputField } from '../types/DXCInputField';\nimport { DXCUserInteraction } from '../types/DXCUserInteraction';\n\nexport interface DXCUserInteractionRequest {\n type: DXCUserInteraction['type'];\n title: string;\n alerts: DXCAlert[];\n fields: { [name: string]: DXCInputField };\n}\n\nexport function interactWithUser<T extends DXCUserInteractionRequest>(\n userInteraction: BehaviorSubject<DXCUserInteraction | undefined>,\n req: T\n): Promise<\n {\n [P in keyof T['fields']]: string;\n }\n> {\n let done = false;\n return new Promise<\n {\n [P in keyof T['fields']]: string;\n }\n >((resolve, reject) => {\n const interactionProps = {\n ...req,\n onSubmit: (\n res: {\n [P in keyof T['fields']]: string;\n }\n ) => {\n userInteraction.next(undefined);\n done = true;\n resolve(res);\n },\n onCancel: () => {\n userInteraction.next(undefined);\n done = true;\n reject(new Dexie.AbortError(\"User cancelled\"));\n },\n } as DXCUserInteraction;\n userInteraction.next(interactionProps);\n // Start subscribing for external updates to db.cloud.userInteraction, and if so, cancel this request.\n /*const subscription = userInteraction.subscribe((currentInteractionProps) => {\n if (currentInteractionProps !== interactionProps) {\n if (subscription) subscription.unsubscribe();\n if (!done) {\n reject(new Dexie.AbortError(\"User cancelled\"));\n }\n }\n });*/\n });\n}\n\nexport function alertUser(\n userInteraction: BehaviorSubject<DXCUserInteraction | undefined>,\n title: string,\n ...alerts: DXCAlert[]\n) {\n return interactWithUser(userInteraction, {\n type: 'message-alert',\n title,\n alerts,\n fields: {}\n });\n}\n\nexport async function promptForEmail(\n userInteraction: BehaviorSubject<DXCUserInteraction | undefined>,\n title: string,\n emailHint?: string\n) {\n let email = emailHint || '';\n while (!email || !/^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,10}$/.test(email)) {\n email = (\n await interactWithUser(userInteraction, {\n type: 'email',\n title,\n alerts: email\n ? [\n {\n type: 'error',\n messageCode: 'INVALID_EMAIL',\n message: 'Please enter a valid email address',\n messageParams: {},\n },\n ]\n : [],\n fields: {\n email: {\n type: 'email',\n placeholder: 'you@somedomain.com',\n },\n },\n })\n ).email;\n }\n return email;\n}\n\nexport async function promptForOTP(\n userInteraction: BehaviorSubject<DXCUserInteraction | undefined>,\n email: string,\n alert?: DXCAlert\n) {\n const alerts: DXCAlert[] = [\n {\n type: 'info',\n messageCode: 'OTP_SENT',\n message: `A One-Time password has been sent to {email}`,\n messageParams: { email },\n },\n ];\n if (alert) {\n alerts.push(alert);\n }\n const { otp } = await interactWithUser(userInteraction, {\n type: 'otp',\n title: 'Enter OTP',\n alerts,\n fields: {\n otp: {\n type: 'otp',\n label: 'OTP',\n placeholder: 'Paste OTP here',\n },\n },\n });\n return otp;\n}\n","import type {\n RefreshTokenRequest,\n TokenFinalResponse,\n} from 'dexie-cloud-common';\nimport { b64encode } from 'dreambase-library/dist/common/base64';\nimport { BehaviorSubject } from 'rxjs';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { UserLogin } from '../db/entities/UserLogin';\nimport { DXCAlert } from '../types/DXCAlert';\nimport {\n DXCMessageAlert,\n DXCUserInteraction,\n} from '../types/DXCUserInteraction';\nimport { alertUser, interactWithUser } from './interactWithUser';\n\nexport type FetchTokenCallback = (tokenParams: {\n public_key: string;\n hints?: { userId?: string; email?: string; grant_type?: string };\n}) => Promise<TokenFinalResponse>;\n\nexport async function loadAccessToken(\n db: DexieCloudDB\n): Promise<string | undefined> {\n const currentUser = await db.getCurrentUser();\n const {\n accessToken,\n accessTokenExpiration,\n refreshToken,\n refreshTokenExpiration,\n claims,\n } = currentUser;\n if (!accessToken) return;\n const expTime = accessTokenExpiration?.getTime() ?? Infinity;\n if (expTime > Date.now()) {\n return accessToken;\n }\n if (!refreshToken) {\n throw new Error(`Refresh token missing`);\n }\n const refreshExpTime = refreshTokenExpiration?.getTime() ?? Infinity;\n if (refreshExpTime <= Date.now()) {\n throw new Error(`Refresh token has expired`);\n }\n const refreshedLogin = await refreshAccessToken(\n db.cloud.options!.databaseUrl,\n currentUser\n );\n await db.table('$logins').update(claims.sub, {\n accessToken: refreshedLogin.accessToken,\n accessTokenExpiration: refreshedLogin.accessTokenExpiration,\n });\n return refreshedLogin.accessToken;\n}\n\nexport async function authenticate(\n url: string,\n context: UserLogin,\n fetchToken: FetchTokenCallback,\n userInteraction: BehaviorSubject<DXCUserInteraction | undefined>,\n hints?: { userId?: string; email?: string; grant_type?: string }\n): Promise<UserLogin> {\n if (\n context.accessToken &&\n context.accessTokenExpiration!.getTime() > Date.now()\n ) {\n return context;\n } else if (\n context.refreshToken &&\n (!context.refreshTokenExpiration ||\n context.refreshTokenExpiration.getTime() > Date.now())\n ) {\n return await refreshAccessToken(url, context);\n } else {\n return await userAuthenticate(context, fetchToken, userInteraction, hints);\n }\n}\n\nexport async function refreshAccessToken(\n url: string,\n login: UserLogin\n): Promise<UserLogin> {\n if (!login.refreshToken)\n throw new Error(`Cannot refresh token - refresh token is missing.`);\n if (!login.nonExportablePrivateKey)\n throw new Error(\n `login.nonExportablePrivateKey is missing - cannot sign refresh token without a private key.`\n );\n\n const time_stamp = Date.now();\n const signing_algorithm = 'RSASSA-PKCS1-v1_5';\n const textEncoder = new TextEncoder();\n const data = textEncoder.encode(login.refreshToken + time_stamp);\n const binarySignature = await crypto.subtle.sign(\n signing_algorithm,\n login.nonExportablePrivateKey,\n data\n );\n const signature = b64encode(binarySignature);\n\n const tokenRequest: RefreshTokenRequest = {\n grant_type: 'refresh_token',\n refresh_token: login.refreshToken,\n scopes: ['ACCESS_DB'],\n signature,\n signing_algorithm,\n time_stamp,\n };\n const res = await fetch(`${url}/token`, {\n body: JSON.stringify(tokenRequest),\n method: 'post',\n headers: { 'Content-Type': 'application/json' },\n mode: 'cors',\n });\n if (res.status !== 200)\n throw new Error(`RefreshToken: Status ${res.status} from ${url}/token`);\n const response: TokenFinalResponse = await res.json();\n login.accessToken = response.accessToken;\n login.accessTokenExpiration = response.accessTokenExpiration\n ? new Date(response.accessTokenExpiration)\n : undefined;\n return login;\n}\n\nasync function userAuthenticate(\n context: UserLogin,\n fetchToken: FetchTokenCallback,\n userInteraction: BehaviorSubject<DXCUserInteraction | undefined>,\n hints?: { userId?: string; email?: string; grant_type?: string }\n) {\n if (!crypto.subtle) {\n if (typeof location !== 'undefined' && location.protocol === 'http:') {\n throw new Error(`Dexie Cloud Addon needs to use WebCrypto, but your browser has disabled it due to being served from an insecure location. Please serve it from https or http://localhost:<port> (See https://stackoverflow.com/questions/46670556/how-to-enable-crypto-subtle-for-unsecure-origins-in-chrome/46671627#46671627)`);\n } else {\n throw new Error(`This browser does not support WebCrypto.`);\n }\n }\n const { privateKey, publicKey } = await crypto.subtle.generateKey(\n {\n name: 'RSASSA-PKCS1-v1_5',\n modulusLength: 2048,\n publicExponent: new Uint8Array([0x01, 0x00, 0x01]),\n hash: { name: 'SHA-256' },\n },\n false, // Non-exportable...\n ['sign', 'verify']\n );\n if (!privateKey || !publicKey)\n throw new Error(`Could not generate RSA keypair`); // Typings suggest these can be undefined...\n context.nonExportablePrivateKey = privateKey; //...but storable!\n const publicKeySPKI = await crypto.subtle.exportKey('spki', publicKey);\n const publicKeyPEM = spkiToPEM(publicKeySPKI);\n context.publicKey = publicKey;\n\n try {\n const response2 = await fetchToken({\n public_key: publicKeyPEM,\n hints,\n });\n\n if (response2.type !== 'tokens')\n throw new Error(\n `Unexpected response type from token endpoint: ${response2.type}`\n );\n\n context.accessToken = response2.accessToken;\n context.accessTokenExpiration = new Date(response2.accessTokenExpiration);\n context.refreshToken = response2.refreshToken;\n if (response2.refreshTokenExpiration) {\n context.refreshTokenExpiration = new Date(\n response2.refreshTokenExpiration\n );\n }\n context.userId = response2.claims.sub;\n context.email = response2.claims.email;\n context.name = response2.claims.name;\n context.claims = response2.claims;\n\n if (response2.alerts && response2.alerts.length > 0) {\n await interactWithUser(userInteraction, {\n type: 'message-alert',\n title: 'Authentication Alert',\n fields: {},\n alerts: response2.alerts as DXCAlert[],\n });\n }\n return context;\n } catch (error) {\n await alertUser(userInteraction, 'Authentication Failed', {\n type: 'error',\n messageCode: 'GENERIC_ERROR',\n message: `We're having a problem authenticating right now.`,\n messageParams: {},\n }).catch(() => {});\n throw error;\n }\n}\n\nfunction spkiToPEM(keydata: ArrayBuffer) {\n const keydataB64 = b64encode(keydata);\n const keydataB64Pem = formatAsPem(keydataB64);\n return keydataB64Pem;\n}\n\nfunction formatAsPem(str: string) {\n let finalString = '-----BEGIN PUBLIC KEY-----\\n';\n\n while (str.length > 0) {\n finalString += str.substring(0, 64) + '\\n';\n str = str.substring(64);\n }\n\n finalString = finalString + '-----END PUBLIC KEY-----';\n\n return finalString;\n}\n","import { DexieCloudDB } from \"../db/DexieCloudDB\";\nimport { UserLogin } from \"../db/entities/UserLogin\";\n\nexport interface AuthPersistedContext extends UserLogin {\n save(): Promise<void>;\n}\n\n// Emulate true-private property db. Why? So it's not stored in DB.\nconst wm = new WeakMap<AuthPersistedContext, DexieCloudDB>();\n\nexport class AuthPersistedContext {\n constructor(db: DexieCloudDB, userLogin: UserLogin) {\n wm.set(this, db);\n Object.assign(this, userLogin);\n }\n\n static load(db: DexieCloudDB, userId: string) {\n return db\n .table(\"$logins\")\n .get(userId)\n .then(\n (userLogin) => new AuthPersistedContext(db, userLogin || {\n userId,\n claims: {\n sub: userId\n },\n lastLogin: new Date(0)\n })\n );\n }\n\n async save() {\n const db = wm.get(this)!;\n db.table(\"$logins\").put(this);\n }\n}\n","export class HttpError extends Error {\n httpStatus: number;\n constructor(\n res: Response,\n message?: string)\n {\n super(message || `${res.status} ${res.statusText}`);\n this.httpStatus = res.status;\n }\n\n get name() {\n return \"HttpError\";\n }\n}\n","import {\n TokenFinalResponse,\n TokenRequest,\n TokenResponse,\n} from 'dexie-cloud-common';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { HttpError } from '../errors/HttpError';\nimport { FetchTokenCallback } from './authenticate';\nimport { alertUser, promptForEmail, promptForOTP } from './interactWithUser';\n\nexport function otpFetchTokenCallback(db: DexieCloudDB): FetchTokenCallback {\n const { userInteraction } = db.cloud;\n return async function otpAuthenticate({ public_key, hints }) {\n let tokenRequest: TokenRequest;\n const url = db.cloud.options?.databaseUrl;\n if (!url) throw new Error(`No database URL given.`);\n if (hints?.grant_type === 'demo') {\n const demo_user = await promptForEmail(\n userInteraction,\n 'Enter a demo user email',\n hints?.email || hints?.userId\n );\n tokenRequest = {\n demo_user,\n grant_type: 'demo',\n scopes: ['ACCESS_DB'],\n public_key,\n };\n } else {\n const email = await promptForEmail(\n userInteraction,\n 'Enter email address',\n hints?.email\n );\n tokenRequest = {\n email,\n grant_type: 'otp',\n scopes: ['ACCESS_DB'],\n public_key,\n };\n }\n const res1 = await fetch(`${url}/token`, {\n body: JSON.stringify(tokenRequest),\n method: 'post',\n headers: { 'Content-Type': 'application/json', mode: 'cors' },\n });\n if (res1.status !== 200) {\n const errMsg = await res1.text();\n await alertUser(userInteraction, \"Token request failed\", {\n type: 'error',\n messageCode: 'GENERIC_ERROR',\n message: errMsg,\n messageParams: {}\n }).catch(()=>{});\n throw new HttpError(res1, errMsg);\n }\n const response: TokenResponse = await res1.json();\n if (response.type === 'tokens') {\n // Demo user request can get a \"tokens\" response right away\n return response;\n } else if (tokenRequest.grant_type === 'otp') {\n if (response.type !== 'otp-sent')\n throw new Error(`Unexpected response from ${url}/token`);\n const otp = await promptForOTP(userInteraction, tokenRequest.email);\n tokenRequest.otp = otp || '';\n tokenRequest.otp_id = response.otp_id;\n\n let res2 = await fetch(`${url}/token`, {\n body: JSON.stringify(tokenRequest),\n method: 'post',\n headers: { 'Content-Type': 'application/json' },\n mode: 'cors',\n });\n while (res2.status === 401) {\n const errorText = await res2.text();\n tokenRequest.otp = await promptForOTP(userInteraction, tokenRequest.email, {\n type: 'error',\n messageCode: 'INVALID_OTP',\n message: errorText,\n messageParams: {}\n });\n res2 = await fetch(`${url}/token`, {\n body: JSON.stringify(tokenRequest),\n method: 'post',\n headers: { 'Content-Type': 'application/json' },\n mode: 'cors',\n });\n }\n if (res2.status !== 200) {\n const errMsg = await res2.text();\n await alertUser(userInteraction, \"OTP Authentication Failed\", {\n type: 'error',\n messageCode: 'GENERIC_ERROR',\n message: errMsg,\n messageParams: {}\n }).catch(()=>{});\n throw new HttpError(res2, errMsg);\n }\n const response2: TokenFinalResponse = await res2.json();\n return response2;\n } else {\n throw new Error(`Unexpected response from ${url}/token`);\n }\n };\n}\n","import { DexieCloudDB } from '../db/DexieCloudDB';\nimport { AuthPersistedContext } from './AuthPersistedContext';\n\n/** This function changes or sets the current user as requested.\n *\n * Use cases:\n * * Initially on db.ready after reading the current user from db.$logins.\n * This will make sure that any unsynced operations from the previous user is synced before\n * changing the user.\n * * Upon user request\n *\n * @param db\n * @param newUser\n */\nexport async function setCurrentUser(\n db: DexieCloudDB,\n user: AuthPersistedContext\n) {\n if (user.userId === db.cloud.currentUserId) return; // Already this user.\n\n const $logins = db.table('$logins');\n await db.transaction('rw', $logins, async (tx) => {\n const existingLogins = await $logins.toArray();\n await Promise.all(\n existingLogins\n .filter((login) => login.userId !== user.userId && login.isLoggedIn)\n .map((login) => {\n login.isLoggedIn = false;\n return $logins.put(login);\n })\n );\n user.isLoggedIn = true;\n user.lastLogin = new Date();\n await user.save();\n console.debug('Saved new user', user.email);\n });\n await new Promise((resolve) => {\n if (db.cloud.currentUserId === user.userId) {\n resolve(null);\n } else {\n const subscription = db.cloud.currentUser.subscribe((currentUser) => {\n if (currentUser.userId === user.userId) {\n subscription.unsubscribe();\n resolve(null);\n }\n });\n }\n });\n\n // TANKAR!!!!\n // V: Service workern kommer inte ha tillgång till currentUserObservable om den inte istället härrör från ett liveQuery.\n // V: Samma med andra windows.\n // V: Så kanske göra om den till att häröra från liveQuery som läser $logins.orderBy('lastLogin').last().\n // V: Då bara vara medveten om:\n // V: En sån observable börjar hämta data vid första subscribe\n // V: Vi har inget \"inital value\" men kan emulera det till att vara ANONYMOUS_USER\n // V: Om requireAuth är true, så borde db.on(ready) hålla databasen stängd för alla utom denna observable.\n // V: Om inte så behöver den inte blocka.\n\n // Andra tankar:\n // * Man kan inte byta användare när man är offline. Skulle gå att flytta realms till undanstuff-tabell vid user-change.\n // men troligen inte värt det.\n // * Istället: sälj inte inte switch-user funktionalitet utan tala enbart om inloggat vs icke inloggat läge.\n // * populate $logins med ANONYMOUS så att en påbörjad inloggning inte räknas, alternativt ha en boolean prop!\n // Kanske bäst ha en boolean prop!\n // * Alternativ switch-user funktionalitet:\n // * DBCore gömmer data från realms man inte har tillgång till.\n // * Cursor impl behövs också då.\n // * Då blir det snabba user switch.\n // * claims-settet som skickas till servern blir summan av alla claims. Då måste servern stödja multipla tokens eller\n // att ens token är ett samlad.\n}\n","import { DexieCloudDB } from '../db/DexieCloudDB';\nimport { triggerSync } from '../sync/triggerSync';\nimport { authenticate } from './authenticate';\nimport { AuthPersistedContext } from './AuthPersistedContext';\nimport { otpFetchTokenCallback } from './otpFetchTokenCallback';\nimport { setCurrentUser } from './setCurrentUser';\n\nexport async function login(\n db: DexieCloudDB,\n hints?: { email?: string; userId?: string; grant_type?: string }\n) {\n const currentUser = await db.getCurrentUser();\n if (currentUser.isLoggedIn) {\n if (hints) {\n if (hints.email && db.cloud.currentUser.value.email !== hints.email) {\n throw new Error(`Must logout before changing user`);\n }\n if (hints.userId && db.cloud.currentUserId !== hints.userId) {\n throw new Error(`Must logout before changing user`);\n }\n }\n // Already authenticated according to given hints.\n return false;\n }\n const context = new AuthPersistedContext(db, {\n claims: {},\n lastLogin: new Date(0),\n });\n await authenticate(\n db.cloud.options!.databaseUrl,\n context,\n db.cloud.options!.fetchTokens || otpFetchTokenCallback(db),\n db.cloud.userInteraction,\n hints\n );\n try {\n await context.save();\n } catch (e) {\n try {\n if (e.name === 'DataCloneError') {\n console.debug(`Login context property names:`, Object.keys(context));\n console.debug(`Login context:`, context);\n console.debug(`Login context JSON:`, JSON.stringify(context));\n }\n } catch {}\n throw e;\n }\n await setCurrentUser(db, context);\n // Make sure to resync as the new login will be authorized\n // for new realms.\n triggerSync(db, \"pull\");\n return true;\n}\n","import { UserLogin } from '../db/entities/UserLogin';\n\nexport const UNAUTHORIZED_USER: UserLogin = {\n userId: \"unauthorized\",\n name: \"Unauthorized\",\n claims: {\n sub: \"unauthorized\",\n },\n lastLogin: new Date(0)\n}\n\ntry {\n Object.freeze(UNAUTHORIZED_USER);\n Object.freeze(UNAUTHORIZED_USER.claims);\n} catch {}\n","const swHolder: { registration?: ServiceWorkerRegistration } = {};\nconst swContainer = typeof self !== 'undefined' && self.document && // self.document is to verify we're not the SW ourself\n typeof navigator !== 'undefined' && navigator.serviceWorker; \nif (swContainer)\n swContainer.ready.then(\n (registration) => (swHolder.registration = registration)\n );\n\nif (typeof self !== 'undefined' && 'clients' in self && !self.document) {\n // We are the service worker. Propagate messages to all our clients.\n addEventListener('message', (ev: any) => {\n if (ev.data?.type?.startsWith('sw-broadcast-')) {\n [...self['clients'].matchAll({ includeUncontrolled: true })].forEach(\n (client) => client.id !== ev.source?.id && client.postMessage(ev.data)\n );\n }\n });\n}\n\n/** This class is a fallback for browsers that lacks BroadcastChannel but have\n * service workers (which is Safari versions 11.1 through 15.3).\n * Safari 15.4 with BroadcastChannel was released on 2022-03-14.\n * We might be able to remove this class in a near future as Safari < 15.4 is\n * already very low in market share as of 2023-03-10.\n */\nexport class SWBroadcastChannel {\n name: string;\n constructor(name: string) {\n this.name = name;\n }\n subscribe(listener: (message: any) => void) {\n if (!swContainer) return () => {};\n const forwarder = (ev: MessageEvent) => {\n if (ev.data?.type === `sw-broadcast-${this.name}`) {\n listener(ev.data.message);\n }\n };\n swContainer.addEventListener('message', forwarder);\n return () => swContainer.removeEventListener('message', forwarder);\n }\n postMessage(message: any) {\n if (typeof self['clients'] === 'object') {\n // We're a service worker. Propagate to our browser clients.\n [...self['clients'].matchAll({ includeUncontrolled: true })].forEach(\n (client) =>\n client.postMessage({\n type: `sw-broadcast-${this.name}`,\n message,\n })\n );\n } else if (swHolder.registration) {\n // We're a client (browser window or other worker)\n // Post to SW so it can repost to all its clients and to itself\n swHolder.registration.active?.postMessage({\n type: `sw-broadcast-${this.name}`,\n message,\n });\n }\n }\n}\n","import { Observable } from \"rxjs\";\nimport { SWBroadcastChannel } from \"./SWBroadcastChannel\";\n\nconst events: Map<string, Array<(ev: CustomEvent)=>void>> =\n globalThis['lbc-events'] || (globalThis['lbc-events'] = new Map<string, Array<(ev: CustomEvent)=>void>>());\n\nfunction addListener(name: string, listener: (ev: CustomEvent)=>void) {\n if (events.has(name)) {\n events.get(name)!.push(listener);\n } else {\n events.set(name, [listener]);\n }\n}\nfunction removeListener(name: string, listener: (ev: CustomEvent)=>void) {\n const listeners = events.get(name);\n if (listeners) {\n const idx = listeners.indexOf(listener);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n }\n}\nfunction dispatch(ev: CustomEvent) {\n const listeners = events.get(ev.type);\n if (listeners) {\n listeners.forEach(listener => {\n try {\n listener(ev);\n } catch {\n }\n });\n }\n}\n\nexport class BroadcastedAndLocalEvent<T> extends Observable<T>{\n name: string;\n bc: BroadcastChannel | SWBroadcastChannel\n\n constructor(name: string) {\n const bc = typeof BroadcastChannel === \"undefined\"\n ? new SWBroadcastChannel(name) : new BroadcastChannel(name);\n super(subscriber => {\n function onCustomEvent(ev: CustomEvent) {\n subscriber.next(ev.detail);\n }\n function onMessageEvent(ev: MessageEvent) {\n console.debug(\"BroadcastedAndLocalEvent: onMessageEvent\", ev);\n subscriber.next(ev.data);\n }\n let unsubscribe: ()=>void;\n //self.addEventListener(`lbc-${name}`, onCustomEvent); // Fails in service workers\n addListener(`lbc-${name}`, onCustomEvent); // Works better in service worker\n\n try { \n if (bc instanceof SWBroadcastChannel) {\n unsubscribe = bc.subscribe(message => subscriber.next(message));\n } else {\n console.debug(\"BroadcastedAndLocalEvent: bc.addEventListener()\", name, \"bc is a\", bc);\n bc.addEventListener(\"message\", onMessageEvent);\n }\n } catch (err) {\n // Service workers might fail to subscribe outside its initial script.\n console.warn('Failed to subscribe to broadcast channel', err);\n }\n return () => {\n //self.removeEventListener(`lbc-${name}`, onCustomEvent);\n removeListener(`lbc-${name}`, onCustomEvent);\n if (bc instanceof SWBroadcastChannel) {\n unsubscribe!();\n } else {\n bc.removeEventListener(\"message\", onMessageEvent);\n }\n }\n });\n this.name = name;\n this.bc = bc;\n }\n\n next(message: T) {\n console.debug(\"BroadcastedAndLocalEvent: bc.postMessage()\", {...message}, \"bc is a\", this.bc);\n this.bc.postMessage(message);\n const ev = new CustomEvent(`lbc-${this.name}`, { detail: message });\n //self.dispatchEvent(ev);\n dispatch(ev);\n }\n}\n","import { PersistedSyncState } from '../db/entities/PersistedSyncState';\nimport { b64encode } from 'dreambase-library/dist/common/base64';\n\nexport async function computeRealmSetHash({\n realms,\n inviteRealms,\n}: PersistedSyncState) {\n const data = JSON.stringify(\n [\n ...realms.map((realmId) => ({ realmId, accepted: true })),\n ...inviteRealms.map((realmId) => ({ realmId, accepted: false })),\n ].sort((a, b) =>\n a.realmId < b.realmId ? -1 : a.realmId > b.realmId ? 1 : 0\n )\n );\n const byteArray = new TextEncoder().encode(data);\n const digestBytes = await crypto.subtle.digest('SHA-1', byteArray);\n const base64 = b64encode(digestBytes);\n return base64;\n}\n","import { IndexableType, Table } from \"dexie\";\nimport { DexieCloudDB } from \"../db/DexieCloudDB\";\nimport { EntityCommon } from \"../db/entities/EntityCommon\";\n\nexport function getSyncableTables(db: DexieCloudDB): Table<EntityCommon>[] {\n return Object.entries(db.cloud.schema || {})\n .filter(([, { markedForSync }]) => markedForSync)\n .map(([tbl]) => db.tables.filter(({name}) => name === tbl)[0])\n .filter(cloudTableSchema => cloudTableSchema);\n}\n","\n\nexport function getMutationTable(tableName: string) {\n return `$${tableName}_mutations`;\n}\n","\n\nexport function getTableFromMutationTable(mutationTable: string) {\n const tableName = /^\\$(.*)_mutations$/.exec(mutationTable)?.[1];\n if (!tableName) throw new Error(`Given mutationTable ${mutationTable} is not correct`);\n return tableName;\n}\n","const concat = [].concat;\nexport function flatten<T>(a: (T | T[])[]): T[] {\n return concat.apply([], a);\n}\n","import { Table } from 'dexie';\nimport { getTableFromMutationTable } from '../helpers/getTableFromMutationTable';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { DBOperation, DBOperationsSet } from 'dexie-cloud-common';\nimport { flatten } from '../helpers/flatten';\n\nexport async function listClientChanges(\n mutationTables: Table[],\n db: DexieCloudDB,\n { since = {} as { [table: string]: number }, limit = Infinity } = {}\n): Promise<DBOperationsSet> {\n const allMutsOnTables = await Promise.all(\n mutationTables.map(async (mutationTable) => {\n const tableName = getTableFromMutationTable(mutationTable.name);\n const lastRevision = since[tableName];\n\n let query = lastRevision\n ? mutationTable.where('rev').above(lastRevision)\n : mutationTable;\n\n if (limit < Infinity) query = query.limit(limit);\n\n const muts: DBOperation[] = await query.toArray();\n\n //const objTable = db.table(tableName);\n /*for (const mut of muts) {\n if (mut.type === \"insert\" || mut.type === \"upsert\") {\n mut.values = await objTable.bulkGet(mut.keys);\n }\n }*/\n return muts.map((mut) => ({\n table: tableName,\n mut,\n }));\n })\n );\n\n // Sort by time to get a true order of the operations (between tables)\n const sorted = flatten(allMutsOnTables).sort((a, b) => a.mut.txid === b.mut.txid\n ? a.mut.opNo! - b.mut.opNo! // Within same transaction, sort by opNo\n : a.mut.ts! - b.mut.ts! // Different transactions - sort by timestamp when mutation resolved\n );\n const result: DBOperationsSet = [];\n let currentEntry: {\n table: string;\n muts: DBOperation[];\n } | null = null;\n let currentTxid: string | null = null;\n for (const { table, mut } of sorted) {\n if (\n currentEntry &&\n currentEntry.table === table &&\n currentTxid === mut.txid\n ) {\n currentEntry.muts.push(mut);\n } else {\n currentEntry = {\n table,\n muts: [mut],\n };\n currentTxid = mut.txid!;\n result.push(currentEntry);\n }\n }\n\n // Filter out those tables that doesn't have any mutations:\n return result;\n}\n","export function randomString(bytes: number) {\n const buf = new Uint8Array(bytes);\n if (typeof crypto !== 'undefined') {\n crypto.getRandomValues(buf);\n } else {\n for (let i = 0; i < bytes; i++) buf[i] = Math.floor(Math.random() * 256);\n }\n if (typeof Buffer !== 'undefined' && Buffer.from) {\n return Buffer.from(buf).toString('base64');\n } else if (typeof btoa !== 'undefined') {\n return btoa(String.fromCharCode.apply(null, buf));\n } else {\n throw new Error('No btoa or Buffer available');\n }\n}\n","import { UserLogin } from '../db/entities/UserLogin';\nimport { randomString } from '../helpers/randomString';\nimport { EntityCommon } from '../db/entities/EntityCommon';\nimport { Table } from 'dexie';\nimport {\n DBOperationsSet,\n DBUpsertOperation,\n DexieCloudSchema,\n isValidAtID,\n isValidSyncableID,\n} from 'dexie-cloud-common';\n\nexport async function listSyncifiedChanges(\n tablesToSyncify: Table<EntityCommon>[],\n currentUser: UserLogin,\n schema: DexieCloudSchema,\n alreadySyncedRealms?: string[]\n): Promise<DBOperationsSet> {\n const txid = `upload-${randomString(8)}`;\n if (currentUser.isLoggedIn) {\n if (tablesToSyncify.length > 0) {\n const ignoredRealms = new Set(alreadySyncedRealms || []);\n const upserts = await Promise.all(\n tablesToSyncify.map(async (table) => {\n const { extractKey } = table.core.schema.primaryKey;\n if (!extractKey) return { table: table.name, muts: [] }; // Outbound tables are not synced.\n\n const dexieCloudTableSchema = schema[table.name];\n const query = dexieCloudTableSchema?.generatedGlobalId\n ? table.filter((item) => {\n const id = extractKey(item);\n return (\n !ignoredRealms.has(item.realmId || '') &&\n //(id[0] !== '#' || !!item.$ts) && // Private obj need no sync if not changed\n isValidAtID(extractKey(item), dexieCloudTableSchema?.idPrefix)\n );\n })\n : table.filter((item) => {\n const id = extractKey(item);\n\n return (\n !ignoredRealms.has(item.realmId || '') &&\n //(id[0] !== '#' || !!item.$ts) && // Private obj need no sync if not changed\n isValidSyncableID(id)\n );\n });\n const unsyncedObjects = await query.toArray();\n if (unsyncedObjects.length > 0) {\n const mut: DBUpsertOperation = {\n type: 'upsert',\n values: unsyncedObjects,\n keys: unsyncedObjects.map(extractKey),\n userId: currentUser.userId,\n txid,\n };\n return {\n table: table.name,\n muts: [mut],\n };\n } else {\n return {\n table: table.name,\n muts: [],\n };\n }\n })\n );\n return upserts.filter((op) => op.muts.length > 0);\n }\n }\n return [];\n}\n","import { getSyncableTables } from \"../helpers/getSyncableTables\";\nimport { DexieCloudDB } from \"../db/DexieCloudDB\";\nimport { PersistedSyncState } from \"../db/entities/PersistedSyncState\";\n\nexport function getTablesToSyncify(db: DexieCloudDB, syncState: PersistedSyncState | undefined) {\n const syncedTables = syncState?.syncedTables || [];\n const syncableTables = getSyncableTables(db);\n const tablesToSyncify = syncableTables.filter(\n (tbl) => !syncedTables.includes(tbl.name)\n );\n return tablesToSyncify;\n}\n","const { toString: toStr } = {};\nfunction getToStringTag(val) {\n return toStr.call(val).slice(8, -1);\n}\nexport function escapeDollarProps(value) {\n const keys = Object.keys(value);\n let dollarKeys = null;\n for (let i = 0, l = keys.length; i < l; ++i) {\n if (keys[i][0] === \"$\") {\n dollarKeys = dollarKeys || [];\n dollarKeys.push(keys[i]);\n }\n }\n if (!dollarKeys)\n return value;\n const clone = { ...value };\n for (const k of dollarKeys) {\n delete clone[k];\n }\n for (const k of dollarKeys) {\n clone[\"$\" + k] = value[k];\n }\n return clone;\n}\nconst ObjectDef = {\n replace: escapeDollarProps,\n};\nexport function TypesonSimplified(...typeDefsInputs) {\n const typeDefs = typeDefsInputs.reduce((p, c) => ({ ...p, ...c }), typeDefsInputs.reduce((p, c) => ({ ...c, ...p }), {}));\n const protoMap = new WeakMap();\n return {\n stringify(value, alternateChannel, space) {\n const json = JSON.stringify(value, function (key) {\n const realVal = this[key];\n const typeDef = getTypeDef(realVal);\n return typeDef\n ? typeDef.replace(realVal, alternateChannel, typeDefs)\n : realVal;\n }, space);\n return json;\n },\n parse(tson, alternateChannel) {\n const stack = [];\n return JSON.parse(tson, function (key, value) {\n //\n // Parent Part\n //\n const type = value === null || value === void 0 ? void 0 : value.$t;\n if (type) {\n const typeDef = typeDefs[type];\n value = typeDef\n ? typeDef.revive(value, alternateChannel, typeDefs)\n : value;\n }\n let top = stack[stack.length - 1];\n if (top && top[0] === value) {\n // Do what the kid told us to\n // Unescape dollar props\n value = { ...value };\n // Delete keys that children wanted us to delete\n for (const k of top[1])\n delete value[k];\n // Set keys that children wanted us to set\n for (const [k, v] of Object.entries(top[2])) {\n value[k] = v;\n }\n stack.pop();\n }\n //\n // Child part\n //\n if (value === undefined || (key[0] === \"$\" && key !== \"$t\")) {\n top = stack[stack.length - 1];\n let deletes;\n let mods;\n if (top && top[0] === this) {\n deletes = top[1];\n mods = top[2];\n }\n else {\n stack.push([this, (deletes = []), (mods = {})]);\n }\n if (key[0] === \"$\" && key !== \"$t\") {\n // Unescape props (also preserves undefined if this is a combo)\n deletes.push(key);\n mods[key.substr(1)] = value;\n }\n else {\n // Preserve undefined\n mods[key] = undefined;\n }\n }\n return value;\n });\n },\n };\n function getTypeDef(realVal) {\n const type = typeof realVal;\n switch (typeof realVal) {\n case \"object\":\n case \"function\": {\n // \"object\", \"function\", null\n if (realVal === null)\n return null;\n const proto = Object.getPrototypeOf(realVal);\n if (!proto)\n return ObjectDef;\n let typeDef = protoMap.get(proto);\n if (typeDef !== undefined)\n return typeDef; // Null counts to! So the caching of Array.prototype also counts.\n const toStringTag = getToStringTag(realVal);\n const entry = Object.entries(typeDefs).find(([typeName, typeDef]) => { var _a, _b; return (_b = (_a = typeDef === null || typeDef === void 0 ? void 0 : typeDef.test) === null || _a === void 0 ? void 0 : _a.call(typeDef, realVal, toStringTag)) !== null && _b !== void 0 ? _b : typeName === toStringTag; });\n typeDef = entry === null || entry === void 0 ? void 0 : entry[1];\n if (!typeDef) {\n typeDef = Array.isArray(realVal)\n ? null\n : typeof realVal === \"function\"\n ? typeDefs.function || null\n : ObjectDef;\n }\n protoMap.set(proto, typeDef);\n return typeDef;\n }\n default:\n return typeDefs[type];\n }\n }\n}\n","export const BisonBinaryTypes = {\n Blob: {\n test: (blob, toStringTag) => toStringTag === \"Blob\",\n replace: (blob, altChannel) => {\n const i = altChannel.length;\n altChannel.push(blob);\n return {\n $t: \"Blob\",\n mimeType: blob.type,\n i,\n };\n },\n revive: ({ i, mimeType }, altChannel) => new Blob([altChannel[i]], { type: mimeType }),\n },\n};\n","export default {\n number: {\n replace: (num) => {\n switch (true) {\n case isNaN(num):\n return { $t: \"number\", v: \"NaN\" };\n case num === Infinity:\n return { $t: \"number\", v: \"Infinity\" };\n case num === -Infinity:\n return { $t: \"number\", v: \"-Infinity\" };\n default:\n return num;\n }\n },\n revive: ({ v }) => Number(v),\n },\n};\n","const bigIntDef = {\n bigint: {\n replace: (realVal) => {\n return { $t: \"bigint\", v: \"\" + realVal };\n },\n revive: (obj) => BigInt(obj.v),\n },\n};\nexport default bigIntDef;\n","export default {\n Date: {\n replace: (date) => ({\n $t: \"Date\",\n v: isNaN(date.getTime()) ? \"NaN\" : date.toISOString(),\n }),\n revive: ({ v }) => new Date(v === \"NaN\" ? NaN : Date.parse(v)),\n },\n};\n","export default {\n Set: {\n replace: (set) => ({\n $t: \"Set\",\n v: Array.from(set.entries()),\n }),\n revive: ({ v }) => new Set(v),\n },\n};\n","export default {\n Map: {\n replace: (map) => ({\n $t: \"Map\",\n v: Array.from(map.entries()),\n }),\n revive: ({ v }) => new Map(v),\n },\n};\n","export const _global = typeof globalThis !== \"undefined\"\n ? globalThis\n : typeof self !== \"undefined\"\n ? self\n : typeof global === \"undefined\"\n ? global\n : this;\n","import { _global } from \"../../common/_global.js\";\nexport default [\n \"Int8Array\",\n \"Uint8Array\",\n \"Uint8ClampedArray\",\n \"Int16Array\",\n \"Uint16Array\",\n \"Int32Array\",\n \"Uint32Array\",\n \"Float32Array\",\n \"Float64Array\",\n \"DataView\",\n \"BigInt64Array\",\n \"BigUint64Array\",\n].reduce((specs, typeName) => ({\n ...specs,\n [typeName]: {\n // Replace passes the the typed array into $t, buffer so that\n // the ArrayBuffer typedef takes care of further handling of the buffer:\n // {$t:\"Uint8Array\",buffer:{$t:\"ArrayBuffer\",idx:0}}\n // CHANGED ABOVE! Now shortcutting that for more sparse format of the typed arrays\n // to contain the b64 property directly.\n replace: (a, _, typeDefs) => {\n const result = {\n $t: typeName,\n v: typeDefs.ArrayBuffer.replace(a.byteOffset === 0 && a.byteLength === a.buffer.byteLength\n ? a.buffer\n : a.buffer.slice(a.byteOffset, a.byteOffset + a.byteLength), _, typeDefs).v,\n };\n return result;\n },\n revive: ({ v }, _, typeDefs) => {\n const TypedArray = _global[typeName];\n return (TypedArray &&\n new TypedArray(typeDefs.ArrayBuffer.revive({ v }, _, typeDefs)));\n },\n },\n}), {});\n","import { b64decode, b64encode } from \"./base64.js\";\nexport function b64LexEncode(b) {\n return b64ToLex(b64encode(b));\n}\nexport function b64LexDecode(b64Lex) {\n return b64decode(lexToB64(b64Lex));\n}\nexport function b64ToLex(base64) {\n var encoded = \"\";\n for (var i = 0, length = base64.length; i < length; i++) {\n encoded += ENCODE_TABLE[base64[i]];\n }\n return encoded;\n}\nexport function lexToB64(base64lex) {\n // only accept string input\n if (typeof base64lex !== \"string\") {\n throw new Error(\"invalid decoder input: \" + base64lex);\n }\n var base64 = \"\";\n for (var i = 0, length = base64lex.length; i < length; i++) {\n base64 += DECODE_TABLE[base64lex[i]];\n }\n return base64;\n}\nconst DECODE_TABLE = {\n \"-\": \"=\",\n \"0\": \"A\",\n \"1\": \"B\",\n \"2\": \"C\",\n \"3\": \"D\",\n \"4\": \"E\",\n \"5\": \"F\",\n \"6\": \"G\",\n \"7\": \"H\",\n \"8\": \"I\",\n \"9\": \"J\",\n A: \"K\",\n B: \"L\",\n C: \"M\",\n D: \"N\",\n E: \"O\",\n F: \"P\",\n G: \"Q\",\n H: \"R\",\n I: \"S\",\n J: \"T\",\n K: \"U\",\n L: \"V\",\n M: \"W\",\n N: \"X\",\n O: \"Y\",\n P: \"Z\",\n Q: \"a\",\n R: \"b\",\n S: \"c\",\n T: \"d\",\n U: \"e\",\n V: \"f\",\n W: \"g\",\n X: \"h\",\n Y: \"i\",\n Z: \"j\",\n _: \"k\",\n a: \"l\",\n b: \"m\",\n c: \"n\",\n d: \"o\",\n e: \"p\",\n f: \"q\",\n g: \"r\",\n h: \"s\",\n i: \"t\",\n j: \"u\",\n k: \"v\",\n l: \"w\",\n m: \"x\",\n n: \"y\",\n o: \"z\",\n p: \"0\",\n q: \"1\",\n r: \"2\",\n s: \"3\",\n t: \"4\",\n u: \"5\",\n v: \"6\",\n w: \"7\",\n x: \"8\",\n y: \"9\",\n z: \"+\",\n \"|\": \"/\",\n};\nconst ENCODE_TABLE = {};\nfor (const c of Object.keys(DECODE_TABLE)) {\n ENCODE_TABLE[DECODE_TABLE[c]] = c;\n}\n","import { b64LexDecode, b64LexEncode } from \"../../common/b64lex.js\";\nexport default {\n ArrayBuffer: {\n replace: (ab) => ({\n $t: \"ArrayBuffer\",\n v: b64LexEncode(ab),\n }),\n revive: ({ v }) => {\n const ba = b64LexDecode(v);\n return ba.buffer.byteLength === ba.byteLength\n ? ba.buffer\n : ba.buffer.slice(ba.byteOffset, ba.byteOffset + ba.byteLength);\n },\n },\n};\n","export class FakeBlob {\n constructor(buf, type) {\n this.buf = buf;\n this.type = type;\n }\n}\n","export function readBlobSync(b) {\n const req = new XMLHttpRequest();\n req.overrideMimeType(\"text/plain; charset=x-user-defined\");\n req.open(\"GET\", URL.createObjectURL(b), false); // Sync\n req.send();\n if (req.status !== 200 && req.status !== 0) {\n throw new Error(\"Bad Blob access: \" + req.status);\n }\n return req.responseText;\n}\n","export function string2ArrayBuffer(str) {\n const array = new Uint8Array(str.length);\n for (let i = 0; i < str.length; ++i) {\n array[i] = str.charCodeAt(i); // & 0xff;\n }\n return array.buffer;\n}\nexport function arrayBuffer2String(buf) {\n // TODO: Optimize\n return new Uint8Array(buf).reduce((s, byte) => s + String.fromCharCode(byte), \"\");\n}\n","import { b64decode, b64encode } from \"../../common/base64.js\";\nimport { FakeBlob } from \"../FakeBlob.js\";\nimport { readBlobSync } from \"../readBlobSync.js\";\nimport { string2ArrayBuffer } from \"../string2arraybuffer.js\";\nexport default {\n Blob: {\n test: (blob, toStringTag) => toStringTag === \"Blob\" || blob instanceof FakeBlob,\n replace: (blob) => ({\n $t: \"Blob\",\n v: blob instanceof FakeBlob\n ? b64encode(blob.buf)\n : b64encode(string2ArrayBuffer(readBlobSync(blob))),\n type: blob.type,\n }),\n revive: ({ type, v }) => {\n const ab = b64decode(v);\n return typeof Blob !== undefined\n ? new Blob([ab])\n : new FakeBlob(ab.buffer, type);\n },\n },\n};\n","import numberDef from \"../types/number.js\";\nimport bigintDef from \"../types/bigint.js\";\nimport DateDef from \"../types/Date.js\";\nimport SetDef from \"../types/Set.js\";\nimport MapDef from \"../types/Map.js\";\nimport TypedArraysDefs from \"../types/TypedArray.js\";\nimport ArrayBufferDef from \"../types/ArrayBuffer.js\";\nimport BlobDef from \"../types/Blob.js\";\nconst builtin = {\n ...numberDef,\n ...bigintDef,\n ...DateDef,\n ...SetDef,\n ...MapDef,\n ...TypedArraysDefs,\n ...ArrayBufferDef,\n ...BlobDef, // Should be moved to another preset for DOM types (or universal? since it supports node as well with FakeBlob)\n};\nexport default builtin;\n","import { BisonBinaryTypes } from \"./BisonBinaryTypes.js\";\nimport builtin from \"./presets/builtin.js\";\nimport { TypesonSimplified } from \"./TypesonSimplified.js\";\nexport function Bison(...typeDefsInputs) {\n const tson = TypesonSimplified(builtin, BisonBinaryTypes, ...typeDefsInputs);\n return {\n toBinary(value) {\n const [blob, json] = this.stringify(value);\n const lenBuf = new ArrayBuffer(4);\n new DataView(lenBuf).setUint32(0, blob.size);\n return new Blob([lenBuf, blob, json]);\n },\n stringify(value) {\n const binaries = [];\n const json = tson.stringify(value, binaries);\n const blob = new Blob(binaries.map((b) => {\n const lenBuf = new ArrayBuffer(4);\n new DataView(lenBuf).setUint32(0, \"byteLength\" in b ? b.byteLength : b.size);\n return new Blob([lenBuf, b]);\n }));\n return [blob, json];\n },\n async parse(json, binData) {\n let pos = 0;\n const arrayBuffers = [];\n const buf = await readBlobBinary(binData);\n const view = new DataView(buf);\n while (pos < buf.byteLength) {\n const len = view.getUint32(pos);\n pos += 4;\n const ab = buf.slice(pos, pos + len);\n pos += len;\n arrayBuffers.push(ab);\n }\n return tson.parse(json, arrayBuffers);\n },\n async fromBinary(blob) {\n const len = new DataView(await readBlobBinary(blob.slice(0, 4))).getUint32(0);\n const binData = blob.slice(4, len + 4);\n const json = await readBlob(blob.slice(len + 4));\n return await this.parse(json, binData);\n },\n };\n}\nexport function readBlob(blob) {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onabort = (ev) => reject(new Error(\"file read aborted\"));\n reader.onerror = (ev) => reject(ev.target.error);\n reader.onload = (ev) => resolve(ev.target.result);\n reader.readAsText(blob);\n });\n}\nexport function readBlobBinary(blob) {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onabort = (ev) => reject(new Error(\"file read aborted\"));\n reader.onerror = (ev) => reject(ev.target.error);\n reader.onload = (ev) => resolve(ev.target.result);\n reader.readAsArrayBuffer(blob);\n });\n}\n","/** The undefined type is not part of builtin but can be manually added.\n * The reason for supporting undefined is if the following object should be revived correctly:\n *\n * {foo: undefined}\n *\n * Without including this typedef, the revived object would just be {}.\n * If including this typedef, the revived object would be {foo: undefined}.\n */\nexport default {\n undefined: {\n replace: () => ({\n $t: \"undefined\"\n }),\n revive: () => undefined,\n },\n};\n","import { TypesonSimplified } from 'dreambase-library/dist/typeson-simplified/TypesonSimplified';\nimport { Bison } from \"dreambase-library/dist/typeson-simplified/Bison\";\nimport undefinedDef from 'dreambase-library/dist/typeson-simplified/types/undefined.js';\nimport tsonBuiltinDefs from 'dreambase-library/dist/typeson-simplified/presets/builtin.js';\nimport { TypeDefSet } from 'dreambase-library/dist/typeson-simplified/TypeDefSet';\n\n// Since server revisions are stored in bigints, we need to handle clients without\n// bigint support to not fail when serverRevision is passed over to client.\n// We need to not fail when reviving it and we need to somehow store the information.\n// Since the revived version will later on be put into indexedDB we have another\n// issue: When reading it back from indexedDB we will get a poco object that we\n// cannot replace correctly when sending it to server. So we will also need\n// to do an explicit workaround in the protocol where a bigint is supported.\n// The workaround should be there regardless if browser supports BigInt or not, because\n// the serverRev might have been stored in IDB before the browser was upgraded to support bigint.\n//\n// if (typeof serverRev.rev !== \"bigint\")\n// if (hasBigIntSupport)\n// serverRev.rev = bigIntDef.bigint.revive(server.rev)\n// else\n// serverRev.rev = new FakeBigInt(server.rev)\nexport const hasBigIntSupport = typeof BigInt === 'function' && typeof BigInt(0) === 'bigint';\n\nfunction getValueOfBigInt(x: bigint | FakeBigInt | string) {\n if (typeof x === 'bigint') {\n return x;\n }\n if (hasBigIntSupport) {\n return typeof x === 'string' ? BigInt(x) : BigInt(x.v);\n } else {\n return typeof x === 'string' ? Number(x) : Number(x.v);\n }\n}\n\nexport function compareBigInts(a: bigint | FakeBigInt | string, b:bigint | FakeBigInt | string) {\n const valA = getValueOfBigInt(a);\n const valB = getValueOfBigInt(b);\n return valA < valB ? -1 : valA > valB ? 1 : 0;\n}\nexport class FakeBigInt {\n v: string;\n toString() {\n return this.v;\n }\n constructor(value: string) {\n this.v = value;\n }\n}\n\nconst defs: TypeDefSet = {\n ...undefinedDef,\n ...(hasBigIntSupport\n ? {}\n : {\n bigint: {\n test: (val: any) => val instanceof FakeBigInt,\n replace: (fakeBigInt: any) => {\n return {\n $t: 'bigint',\n ...fakeBigInt\n };\n },\n revive: ({\n v,\n }: {\n $t: 'bigint';\n v: string;\n }) => new FakeBigInt(v) as any as bigint\n }\n })\n};\n\nexport const TSON = TypesonSimplified(tsonBuiltinDefs, defs);\n\nexport const BISON = Bison(defs);\n","import Dexie, { DBCoreSchema } from 'dexie';\nimport {\n DBInsertOperation,\n DBOperation,\n DBOperationsSet,\n DBOpPrimaryKey,\n} from 'dexie-cloud-common';\nimport { UserLogin } from '../db/entities/UserLogin';\n\nexport function encodeIdsForServer(\n schema: DBCoreSchema,\n currentUser: UserLogin,\n changes: DBOperationsSet\n): DBOperationsSet {\n const rv: DBOperationsSet = [];\n for (let change of changes) {\n const { table, muts } = change;\n const tableSchema = schema.tables.find((t) => t.name === table);\n if (!tableSchema)\n throw new Error(\n `Internal error: table ${table} not found in DBCore schema`\n );\n const { primaryKey } = tableSchema;\n let changeClone = change;\n muts.forEach((mut, mutIndex) => {\n const rewriteValues =\n !primaryKey.outbound &&\n (mut.type === 'upsert' || mut.type === 'insert');\n mut.keys.forEach((key, keyIndex) => {\n if (Array.isArray(key)) {\n // Server only support string keys. Dexie Cloud client support strings or array of strings.\n if (changeClone === change)\n changeClone = cloneChange(change, rewriteValues);\n const mutClone = changeClone.muts[mutIndex];\n const rewrittenKey = JSON.stringify(key);\n mutClone.keys[keyIndex] = rewrittenKey;\n /* Bug (#1777)\n We should not rewrite values. It will fail because the key is array and the value is string.\n Only the keys should be rewritten and it's already done on the server.\n We should take another round of revieweing how key transformations are being done between\n client and server and let the server do the key transformations entirely instead now that\n we have the primary key schema on the server making it possible to do so.\n if (rewriteValues) {\n Dexie.setByKeyPath(\n (mutClone as DBInsertOperation).values[keyIndex],\n primaryKey.keyPath!,\n rewrittenKey\n );\n }*/\n } else if (key[0] === '#') {\n // Private ID - translate!\n if (changeClone === change)\n changeClone = cloneChange(change, rewriteValues);\n const mutClone = changeClone.muts[mutIndex];\n if (!currentUser.isLoggedIn)\n throw new Error(\n `Internal error: Cannot sync private IDs before authenticated`\n );\n const rewrittenKey = `${key}:${currentUser.userId}`;\n mutClone.keys[keyIndex] = rewrittenKey;\n if (rewriteValues) {\n Dexie.setByKeyPath(\n (mutClone as DBInsertOperation).values[keyIndex],\n primaryKey.keyPath!,\n rewrittenKey\n );\n }\n }\n });\n });\n rv.push(changeClone);\n }\n return rv;\n}\n\nfunction cloneChange(change: DBOperationsSet[number], rewriteValues: boolean) {\n // clone on demand:\n return {\n ...change,\n muts: rewriteValues\n ? change.muts.map((m) => {\n return (m.type === 'insert' || m.type === 'upsert') && m.values\n ? {\n ...m,\n keys: m.keys.slice(),\n values: m.values.slice(),\n }\n : {\n ...m,\n keys: m.keys.slice(),\n };\n })\n : change.muts.map((m) => ({ ...m, keys: m.keys.slice() })),\n };\n}\n","import { DexieCloudDB } from '../db/DexieCloudDB';\nimport { PersistedSyncState } from '../db/entities/PersistedSyncState';\nimport { loadAccessToken } from '../authentication/authenticate';\nimport { BISON, TSON } from '../TSON';\nimport { getSyncableTables } from '../helpers/getSyncableTables';\nimport { BaseRevisionMapEntry } from '../db/entities/BaseRevisionMapEntry';\nimport { HttpError } from '../errors/HttpError';\nimport {\n DBOperationsSet,\n DexieCloudSchema,\n SyncRequest,\n SyncResponse\n} from 'dexie-cloud-common';\nimport { encodeIdsForServer } from './encodeIdsForServer';\nimport { UserLogin } from '../db/entities/UserLogin';\n//import {BisonWebStreamReader} from \"dreambase-library/dist/typeson-simplified/BisonWebStreamReader\";\n\nexport async function syncWithServer(\n changes: DBOperationsSet,\n syncState: PersistedSyncState | undefined,\n baseRevs: BaseRevisionMapEntry[],\n db: DexieCloudDB,\n databaseUrl: string,\n schema: DexieCloudSchema | null,\n clientIdentity: string,\n currentUser: UserLogin\n): Promise<SyncResponse> {\n //\n // Push changes to server using fetch\n //\n const headers: HeadersInit = {\n Accept: 'application/json, application/x-bison, application/x-bison-stream',\n 'Content-Type': 'application/tson'\n };\n const accessToken = await loadAccessToken(db);\n if (accessToken) {\n headers.Authorization = `Bearer ${accessToken}`;\n }\n\n const syncRequest: SyncRequest = {\n v:2,\n dbID: syncState?.remoteDbId,\n clientIdentity,\n schema: schema || {},\n lastPull: syncState ? {\n serverRevision: syncState.serverRevision!,\n realms: syncState.realms,\n inviteRealms: syncState.inviteRealms\n } : undefined,\n baseRevs,\n changes: encodeIdsForServer(db.dx.core.schema, currentUser, changes)\n };\n console.debug(\"Sync request\", syncRequest);\n db.syncStateChangedEvent.next({\n phase: 'pushing',\n });\n const res = await fetch(`${databaseUrl}/sync`, {\n method: 'post',\n headers,\n body: TSON.stringify(syncRequest)\n });\n //const contentLength = Number(res.headers.get('content-length'));\n db.syncStateChangedEvent.next({\n phase: 'pulling'\n });\n\n if (!res.ok) {\n throw new HttpError(res);\n }\n\n switch (res.headers.get('content-type')) {\n case 'application/x-bison':\n return BISON.fromBinary(await res.blob());\n case 'application/x-bison-stream': //return BisonWebStreamReader(BISON, res);\n default:\n case 'application/json': {\n const text = await res.text();\n const syncRes = TSON.parse(text);\n return syncRes;\n }\n }\n}\n","import { Table } from \"dexie\";\nimport { EntityCommon } from \"../db/entities/EntityCommon\";\nimport { UserLogin } from \"../db/entities/UserLogin\";\nimport { Member } from \"../db/entities/Member\";\nimport { UNAUTHORIZED_USER } from \"../authentication/UNAUTHORIZED_USER\";\nimport { Realm } from \"../db/entities/Realm\";\n\nexport async function modifyLocalObjectsWithNewUserId(\n syncifiedTables: Table<EntityCommon>[],\n currentUser: UserLogin,\n alreadySyncedRealms?: string[]) {\n const ignoredRealms = new Set(alreadySyncedRealms || []);\n for (const table of syncifiedTables) {\n if (table.name === \"members\") {\n // members\n await table.toCollection().modify((member: Member) => {\n if (!ignoredRealms.has(member.realmId) && (!member.userId || member.userId === UNAUTHORIZED_USER.userId)) {\n member.userId = currentUser.userId;\n }\n });\n } else if (table.name === \"roles\") {\n // roles\n // No changes needed.\n } else if (table.name === \"realms\") {\n // realms\n await table.toCollection().modify((realm: Realm) => {\n if (!ignoredRealms.has(realm.realmId) && (realm.owner === undefined || realm.owner === UNAUTHORIZED_USER.userId)) {\n realm.owner = currentUser.userId;\n }\n });\n } else {\n // application entities\n await table.toCollection().modify((obj) => {\n if (!obj.realmId || !ignoredRealms.has(obj.realmId)) {\n if (!obj.owner || obj.owner === UNAUTHORIZED_USER.userId)\n obj.owner = currentUser.userId;\n if (!obj.realmId || obj.realmId === UNAUTHORIZED_USER.userId) {\n obj.realmId = currentUser.userId;\n }\n }\n });\n }\n }\n}\n","import Dexie from \"dexie\";\n\nexport interface CancelToken {\n cancelled: boolean;\n}\n\nexport function throwIfCancelled(cancelToken?: CancelToken) {\n if (cancelToken?.cancelled) throw new Dexie.AbortError(`Operation was cancelled`);\n}\n","/* Need this because navigator.onLine seems to say \"false\" when it is actually online.\n This function relies initially on navigator.onLine but then uses online and offline events\n which seem to be more reliable.\n*/\nexport let isOnline = false;\nif (typeof self !== 'undefined' && typeof navigator !== 'undefined') {\n isOnline = navigator.onLine;\n self.addEventListener('online', ()=>isOnline = true);\n self.addEventListener('offline', ()=>isOnline = false);\n}\n","import { DexieCloudDB } from '../db/DexieCloudDB';\nimport { DexieCloudSchema, SyncResponse } from 'dexie-cloud-common';\n\nexport async function updateBaseRevs(db: DexieCloudDB, schema: DexieCloudSchema, latestRevisions: { [table: string]: number; }, serverRev: any) {\n await db.$baseRevs.bulkPut(\n Object.keys(schema)\n .filter((table) => schema[table].markedForSync)\n .map((tableName) => {\n const lastClientRevOnPreviousServerRev = latestRevisions[tableName] || 0;\n return {\n tableName,\n clientRev: lastClientRevOnPreviousServerRev + 1,\n serverRev,\n };\n })\n );\n}\n","import { DBOperationsSet } from 'dexie-cloud-common';\n\nexport function getLatestRevisionsPerTable(\n clientChangeSet: DBOperationsSet,\n lastRevisions = {} as { [table: string]: number; }) {\n for (const { table, muts } of clientChangeSet) {\n const lastRev = muts.length > 0 ? muts[muts.length - 1].rev : null;\n lastRevisions[table] = lastRev || lastRevisions[table] || 0;\n }\n return lastRevisions;\n}\n","import Dexie, { Table, cmp } from 'dexie';\n\nexport async function bulkUpdate(\n table: Table,\n keys: any[],\n changeSpecs: { [keyPath: string]: any }[]\n) {\n const objs = await table.bulkGet(keys);\n const resultKeys: any[] = [];\n const resultObjs: any[] = [];\n keys.forEach((key, idx) => {\n const obj = objs[idx];\n if (obj) {\n for (const [keyPath, value] of Object.entries(changeSpecs[idx])) {\n if (keyPath === table.schema.primKey.keyPath) {\n if (cmp(value, key) !== 0) {\n throw new Error(`Cannot change primary key`);\n }\n } else {\n Dexie.setByKeyPath(obj, keyPath, value);\n }\n }\n resultKeys.push(key);\n resultObjs.push(obj);\n }\n });\n await (table.schema.primKey.keyPath == null\n ? table.bulkPut(resultObjs, resultKeys)\n : table.bulkPut(resultObjs));\n}\n","import { DexieCloudDB } from '../db/DexieCloudDB';\nimport Dexie from 'dexie';\nimport { bulkUpdate } from '../helpers/bulkUpdate';\nimport { DBOperationsSet } from 'dexie-cloud-common';\n\nexport async function applyServerChanges(\n changes: DBOperationsSet<string>,\n db: DexieCloudDB\n) {\n console.debug('Applying server changes', changes, Dexie.currentTransaction);\n for (const { table: tableName, muts } of changes) {\n const table = db.table(tableName);\n if (!table) continue; // If server sends changes on a table we don't have, ignore it.\n const { primaryKey } = table.core.schema;\n const keyDecoder = (key: string) => {\n switch (key[0]) {\n case '[':\n // Decode JSON array\n if (key.endsWith(']'))\n try {\n // On server, array keys are transformed to JSON string representation\n return JSON.parse(key);\n } catch {}\n return key;\n case '#':\n // Decode private ID (do the opposite from what's done in encodeIdsForServer())\n if (key.endsWith(':' + db.cloud.currentUserId)) {\n return key.substr(\n 0,\n key.length - db.cloud.currentUserId.length - 1\n );\n }\n return key;\n default:\n return key;\n }\n };\n for (const mut of muts) {\n const keys = mut.keys.map(keyDecoder);\n switch (mut.type) {\n case 'insert':\n if (primaryKey.outbound) {\n await table.bulkAdd(mut.values, keys);\n } else {\n keys.forEach((key, i) => {\n // Make sure inbound keys are consistent\n Dexie.setByKeyPath(mut.values[i], primaryKey.keyPath!, key);\n });\n await table.bulkAdd(mut.values);\n }\n break;\n case 'upsert':\n if (primaryKey.outbound) {\n await table.bulkPut(mut.values, keys);\n } else {\n keys.forEach((key, i) => {\n // Make sure inbound keys are consistent\n Dexie.setByKeyPath(mut.values[i], primaryKey.keyPath!, key);\n });\n await table.bulkPut(mut.values);\n }\n break;\n case 'modify':\n if (keys.length === 1) {\n await table.update(keys[0], mut.changeSpec);\n } else {\n await table.where(':id').anyOf(keys).modify(mut.changeSpec);\n }\n break;\n case 'update':\n await bulkUpdate(table, keys, mut.changeSpecs);\n break;\n case 'delete':\n await table.bulkDelete(keys);\n break;\n }\n }\n }\n}\n","import { getMutationTable } from '../helpers/getMutationTable';\nimport { getSyncableTables } from '../helpers/getSyncableTables';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { listSyncifiedChanges } from './listSyncifiedChanges';\nimport { getTablesToSyncify } from './getTablesToSyncify';\nimport { listClientChanges } from './listClientChanges';\nimport { syncWithServer } from './syncWithServer';\nimport { modifyLocalObjectsWithNewUserId } from './modifyLocalObjectsWithNewUserId';\nimport { throwIfCancelled } from '../helpers/CancelToken';\nimport { DexieCloudOptions } from '../DexieCloudOptions';\nimport { BaseRevisionMapEntry } from '../db/entities/BaseRevisionMapEntry';\nimport { getTableFromMutationTable } from '../helpers/getTableFromMutationTable';\nimport {\n applyOperations,\n DBKeyMutationSet,\n DBOperationsSet,\n DexieCloudSchema,\n randomString,\n subtractChanges,\n SyncResponse,\n toDBOperationSet,\n} from 'dexie-cloud-common';\nimport { PersistedSyncState } from '../db/entities/PersistedSyncState';\nimport { isOnline } from './isOnline';\nimport { updateBaseRevs } from './updateBaseRevs';\nimport { getLatestRevisionsPerTable } from './getLatestRevisionsPerTable';\nimport { applyServerChanges } from './applyServerChanges';\n\nexport const CURRENT_SYNC_WORKER = 'currentSyncWorker';\n\nexport let numberOfSyncRequests = 0;\n\n/*\n TODO:\n 1. V: Rätta flödet och gör det persistent mellan transaktioner\n 2. Sync-requestet ska autenticera sig med nuvarande användare.\n MEN:\n Vissa medskickade operationer kan vara gjorda av annan användare.\n Därför: Om några av client-changes är andra användare, så måste de användarnas\n tokens följa med som extra parameter till fetch-requestet.\n Servern skall då validera och genomföra dessa operationer baserat på alternativt token.\n Kanske kan vi skita i det flödet just nu och hindra att det uppstår istället.\n Hur? Jo, genom:\n 1. Användare är ANONYMOUS\n 2. Data laddas ned.\n 3. Data modifieras.\n 4. Användare loggar in.\n 5. Sync: Några inledande requests är ANONYMOUS men autenticeras som användaren.\n\n X: Se till att vi förhandlar initialt sync state eller uppdaterat sync state (tabell aliases etc)\n\n Y: Använd Bison hjälpare för streamad BISON?\n\n*/\n\nexport interface SyncOptions {\n isInitialSync?: boolean;\n cancelToken?: { cancelled: boolean };\n justCheckIfNeeded?: boolean;\n retryImmediatelyOnFetchError?: boolean;\n purpose?: 'pull' | 'push';\n}\n\nexport function sync(\n db: DexieCloudDB,\n options: DexieCloudOptions,\n schema: DexieCloudSchema,\n syncOptions?: SyncOptions\n): Promise<boolean> {\n return _sync\n .apply(this, arguments)\n .then(() => {\n if (!syncOptions?.justCheckIfNeeded) { // && syncOptions?.purpose !== 'push') {\n db.syncStateChangedEvent.next({\n phase: 'in-sync',\n });\n }\n })\n .catch(async (error: any) => {\n if (syncOptions?.justCheckIfNeeded) return Promise.reject(error); // Just rethrow.\n console.debug('Error from _sync', {\n isOnline,\n syncOptions,\n error,\n });\n if (\n isOnline &&\n syncOptions?.retryImmediatelyOnFetchError &&\n error?.name === 'TypeError' &&\n /fetch/.test(error?.message)\n ) {\n db.syncStateChangedEvent.next({\n phase: 'error',\n error,\n });\n // Retry again in 500 ms but if it fails again, don't retry.\n await new Promise((resolve) => setTimeout(resolve, 500));\n return await sync(db, options, schema, {\n ...syncOptions,\n retryImmediatelyOnFetchError: false,\n });\n }\n // Make sure that no matter whether sync() explodes or not,\n // always update the timestamp. Also store the error.\n await db.$syncState.update('syncState', {\n timestamp: new Date(),\n error: '' + error,\n });\n db.syncStateChangedEvent.next({\n phase: isOnline ? 'error' : 'offline',\n error: new Error('' + error?.message || error),\n });\n return Promise.reject(error);\n });\n}\n\nasync function _sync(\n db: DexieCloudDB,\n options: DexieCloudOptions,\n schema: DexieCloudSchema,\n { isInitialSync, cancelToken, justCheckIfNeeded, purpose }: SyncOptions = {\n isInitialSync: false,\n }\n): Promise<boolean> {\n if (!justCheckIfNeeded) {\n console.debug('SYNC STARTED', { isInitialSync, purpose });\n }\n if (!db.cloud.options?.databaseUrl)\n throw new Error(\n `Internal error: sync must not be called when no databaseUrl is configured`\n );\n const { databaseUrl } = options;\n const currentUser = await db.getCurrentUser(); // Keep same value across entire sync flow:\n const tablesToSync = currentUser.isLoggedIn ? getSyncableTables(db) : [];\n\n const mutationTables = tablesToSync.map((tbl) =>\n db.table(getMutationTable(tbl.name))\n );\n\n // If this is not the initial sync,\n // go through tables that were previously not synced but should now be according to\n // logged in state and the sync table whitelist in db.cloud.options.\n //\n // Prepare for syncification by modifying locally unauthorized objects:\n //\n const persistedSyncState = await db.getPersistedSyncState();\n const readyForSyncification = !isInitialSync && currentUser.isLoggedIn;\n const tablesToSyncify = readyForSyncification\n ? getTablesToSyncify(db, persistedSyncState)\n : [];\n throwIfCancelled(cancelToken);\n const doSyncify = tablesToSyncify.length > 0;\n\n if (doSyncify) {\n if (justCheckIfNeeded) return true;\n //console.debug('sync doSyncify is true');\n await db.transaction('rw', tablesToSyncify, async (tx) => {\n // @ts-ignore\n tx.idbtrans.disableChangeTracking = true;\n // @ts-ignore\n tx.idbtrans.disableAccessControl = true; // TODO: Take care of this flag in access control middleware!\n await modifyLocalObjectsWithNewUserId(\n tablesToSyncify,\n currentUser,\n persistedSyncState?.realms\n );\n });\n throwIfCancelled(cancelToken);\n }\n //\n // List changes to sync\n //\n const [clientChangeSet, syncState, baseRevs] = await db.transaction(\n 'r',\n db.tables,\n async () => {\n const syncState = await db.getPersistedSyncState();\n const baseRevs = await db.$baseRevs.toArray();\n let clientChanges = await listClientChanges(mutationTables, db);\n throwIfCancelled(cancelToken);\n if (doSyncify) {\n const alreadySyncedRealms = [\n ...(persistedSyncState?.realms || []),\n ...(persistedSyncState?.inviteRealms || []),\n ];\n const syncificationInserts = await listSyncifiedChanges(\n tablesToSyncify,\n currentUser,\n schema!,\n alreadySyncedRealms\n );\n throwIfCancelled(cancelToken);\n clientChanges = clientChanges.concat(syncificationInserts);\n return [clientChanges, syncState, baseRevs];\n }\n return [clientChanges, syncState, baseRevs];\n }\n );\n\n const pushSyncIsNeeded = clientChangeSet.some((set) =>\n set.muts.some((mut) => mut.keys.length > 0)\n );\n if (justCheckIfNeeded) {\n console.debug('Sync is needed:', pushSyncIsNeeded);\n return pushSyncIsNeeded;\n }\n if (purpose === 'push' && !pushSyncIsNeeded) {\n // The purpose of this request was to push changes\n return false;\n }\n\n const latestRevisions = getLatestRevisionsPerTable(\n clientChangeSet,\n syncState?.latestRevisions\n );\n\n const clientIdentity = syncState?.clientIdentity || randomString(16);\n\n //\n // Push changes to server\n //\n throwIfCancelled(cancelToken);\n const res = await syncWithServer(\n clientChangeSet,\n syncState,\n baseRevs,\n db,\n databaseUrl,\n schema,\n clientIdentity,\n currentUser\n );\n console.debug('Sync response', res);\n\n //\n // Apply changes locally and clear old change entries:\n //\n const done = await db.transaction('rw', db.tables, async (tx) => {\n // @ts-ignore\n tx.idbtrans.disableChangeTracking = true;\n // @ts-ignore\n tx.idbtrans.disableAccessControl = true; // TODO: Take care of this flag in access control middleware!\n\n // Update db.cloud.schema from server response.\n // Local schema MAY include a subset of tables, so do not force all tables into local schema.\n for (const tableName of Object.keys(schema)) {\n if (res.schema[tableName]) {\n // Write directly into configured schema. This code can only be executed alone.\n schema[tableName] = res.schema[tableName];\n }\n }\n await db.$syncState.put(schema, 'schema');\n\n // List mutations that happened during our exchange with the server:\n const addedClientChanges = await listClientChanges(mutationTables, db, {\n since: latestRevisions,\n });\n\n //\n // Delete changes now as server has return success\n // (but keep changes that haven't reached server yet)\n //\n for (const mutTable of mutationTables) {\n const tableName = getTableFromMutationTable(mutTable.name);\n if (\n !addedClientChanges.some(\n (ch) => ch.table === tableName && ch.muts.length > 0\n )\n ) {\n // No added mutations for this table during the time we sent changes\n // to the server.\n // It is therefore safe to clear all changes (which is faster than\n // deleting a range)\n await Promise.all([\n mutTable.clear(),\n db.$baseRevs.where({ tableName }).delete(),\n ]);\n } else if (latestRevisions[tableName]) {\n const latestRev = latestRevisions[tableName] || 0;\n await Promise.all([\n mutTable.where('rev').belowOrEqual(latestRev).delete(),\n db.$baseRevs\n .where(':id')\n .between(\n [tableName, -Infinity],\n [tableName, latestRev + 1],\n true,\n true\n )\n .reverse()\n .offset(1) // Keep one entry (the one mapping muts that came during fetch --> previous server revision)\n .delete(),\n ]);\n } else {\n // In this case, the mutation table only contains added items after sending empty changeset to server.\n // We should not clear out anything now.\n }\n }\n\n // Update latestRevisions object according to additional changes:\n getLatestRevisionsPerTable(addedClientChanges, latestRevisions);\n\n // Update/add new entries into baseRevs map.\n // * On tables without mutations since last serverRevision,\n // this will update existing entry.\n // * On tables where mutations have been recorded since last\n // serverRevision, this will create a new entry.\n // The purpose of this operation is to mark a start revision (per table)\n // so that all client-mutations that come after this, will be mapped to current\n // server revision.\n await updateBaseRevs(db, schema, latestRevisions, res.serverRevision);\n\n const syncState = await db.getPersistedSyncState();\n\n //\n // Delete objects from removed realms\n //\n await deleteObjectsFromRemovedRealms(db, res, syncState);\n\n //\n // Update syncState\n //\n const newSyncState: PersistedSyncState = syncState || {\n syncedTables: [],\n latestRevisions: {},\n realms: [],\n inviteRealms: [],\n clientIdentity,\n };\n if (readyForSyncification) {\n newSyncState.syncedTables = tablesToSync\n .map((tbl) => tbl.name)\n .concat(tablesToSyncify.map((tbl) => tbl.name));\n }\n newSyncState.latestRevisions = latestRevisions;\n newSyncState.remoteDbId = res.dbId;\n newSyncState.initiallySynced = true;\n newSyncState.realms = res.realms;\n newSyncState.inviteRealms = res.inviteRealms;\n newSyncState.serverRevision = res.serverRevision;\n newSyncState.timestamp = new Date();\n delete newSyncState.error;\n\n const filteredChanges = filterServerChangesThroughAddedClientChanges(\n res.changes,\n addedClientChanges\n );\n\n //\n // apply server changes\n //\n await applyServerChanges(filteredChanges, db);\n\n //\n // Update syncState\n //\n db.$syncState.put(newSyncState, 'syncState');\n\n return addedClientChanges.length === 0;\n });\n if (!done) {\n console.debug('MORE SYNC NEEDED. Go for it again!');\n return await _sync(db, options, schema, { isInitialSync, cancelToken });\n }\n console.debug('SYNC DONE', { isInitialSync });\n db.syncCompleteEvent.next();\n return false; // Not needed anymore\n}\n\nasync function deleteObjectsFromRemovedRealms(\n db: DexieCloudDB,\n res: SyncResponse,\n prevState: PersistedSyncState | undefined\n) {\n const deletedRealms = new Set<string>();\n const rejectedRealms = new Set<string>();\n const previousRealmSet = prevState ? prevState.realms : [];\n const previousInviteRealmSet = prevState ? prevState.inviteRealms : [];\n const updatedRealmSet = new Set(res.realms);\n const updatedTotalRealmSet = new Set(res.realms.concat(res.inviteRealms));\n for (const realmId of previousRealmSet) {\n if (!updatedRealmSet.has(realmId)) {\n rejectedRealms.add(realmId);\n if (!updatedTotalRealmSet.has(realmId)) {\n deletedRealms.add(realmId);\n }\n }\n }\n for (const realmId of previousInviteRealmSet.concat(previousRealmSet)) {\n if (!updatedTotalRealmSet.has(realmId)) {\n deletedRealms.add(realmId);\n }\n }\n if (deletedRealms.size > 0 || rejectedRealms.size > 0) {\n const tables = getSyncableTables(db);\n for (const table of tables) {\n let realmsToDelete = ['realms', 'members', 'roles'].includes(table.name)\n ? deletedRealms // These tables should spare rejected ones.\n : rejectedRealms; // All other tables shoudl delete rejected+deleted ones\n if (realmsToDelete.size === 0) continue;\n if (\n table.schema.indexes.some(\n (idx) =>\n idx.keyPath === 'realmId' ||\n (Array.isArray(idx.keyPath) && idx.keyPath[0] === 'realmId')\n )\n ) {\n // There's an index to use:\n //console.debug(`REMOVAL: deleting all ${table.name} where realmId anyOf `, JSON.stringify([...realmsToDelete]));\n await table\n .where('realmId')\n .anyOf([...realmsToDelete])\n .delete();\n } else {\n // No index to use:\n //console.debug(`REMOVAL: deleting all ${table.name} where realmId is any of `, JSON.stringify([...realmsToDelete]), realmsToDelete.size);\n await table\n .filter((obj) => !!obj?.realmId && realmsToDelete.has(obj.realmId))\n .delete();\n }\n }\n }\n}\n\nexport function filterServerChangesThroughAddedClientChanges(\n serverChanges: DBOperationsSet<string>,\n addedClientChanges: DBOperationsSet\n): DBOperationsSet<string> {\n const changes: DBKeyMutationSet = {};\n applyOperations(changes, serverChanges);\n const localPostChanges: DBKeyMutationSet = {};\n applyOperations(localPostChanges, addedClientChanges);\n subtractChanges(changes, localPostChanges);\n return toDBOperationSet(changes);\n}\n","import { BehaviorSubject } from 'rxjs';\nimport { filter, take } from 'rxjs/operators';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { WSConnectionMsg } from '../WSObservable';\nimport { triggerSync } from './triggerSync';\nimport Dexie from 'dexie';\nimport { computeRealmSetHash } from '../helpers/computeRealmSetHash';\nimport { DBOperationsSet } from 'dexie-cloud-common';\nimport { getSyncableTables } from '../helpers/getSyncableTables';\nimport { getMutationTable } from '../helpers/getMutationTable';\nimport { listClientChanges } from './listClientChanges';\nimport { filterServerChangesThroughAddedClientChanges } from './sync';\nimport { applyServerChanges } from './applyServerChanges';\nimport { updateBaseRevs } from './updateBaseRevs';\nimport { getLatestRevisionsPerTable } from './getLatestRevisionsPerTable';\nimport { refreshAccessToken } from '../authentication/authenticate';\n\nexport type MessagesFromServerConsumer = ReturnType<\n typeof MessagesFromServerConsumer\n>;\n\nexport function MessagesFromServerConsumer(db: DexieCloudDB) {\n const queue: WSConnectionMsg[] = [];\n const readyToServe = new BehaviorSubject(true);\n const event = new BehaviorSubject(null);\n let isWorking = false;\n\n let loopWarning = 0;\n let loopDetection = [0, 0, 0, 0, 0, 0, 0, 0, 0, Date.now()];\n\n event.subscribe(async () => {\n if (isWorking) return;\n if (queue.length > 0) {\n isWorking = true;\n loopDetection.shift();\n loopDetection.push(Date.now());\n readyToServe.next(false);\n try {\n await consumeQueue();\n } finally {\n if (\n loopDetection[loopDetection.length - 1] - loopDetection[0] <\n 10000\n ) {\n // Ten loops within 10 seconds. Slow down!\n if (Date.now() - loopWarning < 5000) {\n // Last time we did this, we ended up here too. Wait for a minute.\n console.warn(`Slowing down websocket loop for one minute`);\n loopWarning = Date.now() + 60000;\n await new Promise((resolve) => setTimeout(resolve, 60000));\n } else {\n // This is a one-time event. Just pause 10 seconds.\n console.warn(`Slowing down websocket loop for 10 seconds`);\n loopWarning = Date.now() + 10000;\n await new Promise((resolve) => setTimeout(resolve, 10000));\n }\n }\n isWorking = false;\n readyToServe.next(true);\n }\n }\n });\n\n function enqueue(msg: WSConnectionMsg) {\n queue.push(msg);\n event.next(null);\n }\n\n async function consumeQueue() {\n while (queue.length > 0) {\n const msg = queue.shift();\n try {\n // If the sync worker or service worker is syncing, wait 'til thei're done.\n // It's no need to have two channels at the same time - even though it wouldnt\n // be a problem - this is an optimization.\n await db.cloud.syncState\n .pipe(\n filter(({ phase }) => phase === 'in-sync' || phase === 'error'),\n take(1)\n )\n .toPromise();\n console.debug('processing msg', msg);\n const persistedSyncState = db.cloud.persistedSyncState.value;\n //syncState.\n if (!msg) continue;\n switch (msg.type) {\n case 'token-expired':\n console.debug(\n 'WebSocket observable: Token expired. Refreshing token...'\n );\n const user = db.cloud.currentUser.value;\n // Refresh access token\n const refreshedLogin = await refreshAccessToken(\n db.cloud.options!.databaseUrl,\n user\n );\n // Persist updated access token\n await db.table('$logins').update(user.userId, {\n accessToken: refreshedLogin.accessToken,\n accessTokenExpiration: refreshedLogin.accessTokenExpiration,\n });\n // Updating $logins will trigger emission of db.cloud.currentUser observable, which\n // in turn will lead to that connectWebSocket.ts will reconnect the socket with the\n // new token. So we don't need to do anything more here.\n break;\n case 'realm-added':\n if (\n !persistedSyncState?.realms?.includes(msg.realm) &&\n !persistedSyncState?.inviteRealms?.includes(msg.realm)\n ) {\n await db.cloud.sync({ purpose: 'pull', wait: true });\n //triggerSync(db, 'pull');\n }\n break;\n case 'realm-accepted':\n if (!persistedSyncState?.realms?.includes(msg.realm)) {\n await db.cloud.sync({ purpose: 'pull', wait: true });\n //triggerSync(db, 'pull');\n }\n break;\n case 'realm-removed':\n if (\n persistedSyncState?.realms?.includes(msg.realm) ||\n persistedSyncState?.inviteRealms?.includes(msg.realm)\n ) {\n await db.cloud.sync({ purpose: 'pull', wait: true });\n //triggerSync(db, 'pull');\n }\n break;\n case 'realms-changed':\n //triggerSync(db, 'pull');\n await db.cloud.sync({ purpose: 'pull', wait: true });\n break;\n case 'changes':\n console.debug('changes');\n if (db.cloud.syncState.value?.phase === 'error') {\n triggerSync(db, 'pull');\n break;\n }\n await db.transaction('rw', db.dx.tables, async (tx) => {\n // @ts-ignore\n tx.idbtrans.disableChangeTracking = true;\n // @ts-ignore\n tx.idbtrans.disableAccessControl = true;\n const [schema, syncState, currentUser] = await Promise.all([\n db.getSchema(),\n db.getPersistedSyncState(),\n db.getCurrentUser(),\n ]);\n console.debug('ws message queue: in transaction');\n if (!syncState || !schema || !currentUser) {\n console.debug('required vars not present', {\n syncState,\n schema,\n currentUser,\n });\n return; // Initial sync must have taken place - otherwise, ignore this.\n }\n // Verify again in ACID tx that we're on same server revision.\n if (msg.baseRev !== syncState.serverRevision) {\n console.debug(\n `baseRev (${msg.baseRev}) differs from our serverRevision in syncState (${syncState.serverRevision})`\n );\n // Should we trigger a sync now? No. This is a normal case\n // when another local peer (such as the SW or a websocket channel on other tab) has\n // updated syncState from new server information but we are not aware yet. It would\n // be unnescessary to do a sync in that case. Instead, the caller of this consumeQueue()\n // function will do readyToServe.next(true) right after this return, which will lead\n // to a \"ready\" message being sent to server with the new accurate serverRev we have,\n // so that the next message indeed will be correct.\n if (\n typeof msg.baseRev === 'string' && // v2 format\n (typeof syncState.serverRevision === 'bigint' || // v1 format\n typeof syncState.serverRevision === 'object') // v1 format old browser\n ) {\n // The reason for the diff seems to be that server has migrated the revision format.\n // Do a full sync to update revision format.\n // If we don't do a sync request now, we could stuck in an endless loop.\n triggerSync(db, 'pull');\n }\n return; // Ignore message\n }\n // Verify also that the message is based on the exact same set of realms\n const ourRealmSetHash = await Dexie.waitFor(\n // Keep TX in non-IDB work\n computeRealmSetHash(syncState)\n );\n console.debug('ourRealmSetHash', ourRealmSetHash);\n if (ourRealmSetHash !== msg.realmSetHash) {\n console.debug('not same realmSetHash', msg.realmSetHash);\n triggerSync(db, 'pull');\n // The message isn't based on the same realms.\n // Trigger a sync instead to resolve all things up.\n return;\n }\n\n // Get clientChanges\n let clientChanges: DBOperationsSet = [];\n if (currentUser.isLoggedIn) {\n const mutationTables = getSyncableTables(db).map((tbl) =>\n db.table(getMutationTable(tbl.name))\n );\n clientChanges = await listClientChanges(mutationTables, db);\n console.debug('msg queue: client changes', clientChanges);\n }\n if (msg.changes.length > 0) {\n const filteredChanges =\n filterServerChangesThroughAddedClientChanges(\n msg.changes,\n clientChanges\n );\n\n //\n // apply server changes\n //\n console.debug(\n 'applying filtered server changes',\n filteredChanges\n );\n await applyServerChanges(filteredChanges, db);\n }\n\n // Update latest revisions per table in case there are unsynced changes\n // This can be a real case in future when we allow non-eagery sync.\n // And it can actually be realistic now also, but very rare.\n syncState.latestRevisions = getLatestRevisionsPerTable(\n clientChanges,\n syncState.latestRevisions\n );\n\n syncState.serverRevision = msg.newRev;\n\n // Update base revs\n console.debug('Updating baseRefs', syncState.latestRevisions);\n await updateBaseRevs(\n db,\n schema!,\n syncState.latestRevisions,\n msg.newRev\n );\n\n //\n // Update syncState\n //\n console.debug('Updating syncState', syncState);\n await db.$syncState.put(syncState, 'syncState');\n });\n console.debug('msg queue: done with rw transaction');\n break;\n }\n } catch (error) {\n console.error(`Error in msg queue`, error);\n }\n }\n }\n\n return {\n enqueue,\n readyToServe,\n };\n}\n","import Dexie, { Table } from 'dexie';\nimport { GuardedJob } from './entities/GuardedJob';\nimport { UserLogin } from './entities/UserLogin';\nimport { PersistedSyncState } from './entities/PersistedSyncState';\nimport { UNAUTHORIZED_USER } from '../authentication/UNAUTHORIZED_USER';\nimport { DexieCloudOptions } from '../DexieCloudOptions';\nimport { BehaviorSubject, Subject } from 'rxjs';\nimport { BaseRevisionMapEntry } from './entities/BaseRevisionMapEntry';\nimport {\n DBRealm,\n DBRealmMember,\n DBRealmRole,\n DexieCloudSchema,\n} from 'dexie-cloud-common';\nimport { BroadcastedAndLocalEvent } from '../helpers/BroadcastedAndLocalEvent';\nimport { SyncState, SyncStatePhase } from '../types/SyncState';\nimport { MessagesFromServerConsumer } from '../sync/messagesFromServerQueue';\n\n/*export interface DexieCloudDB extends Dexie {\n table(name: string): Table<any, any>;\n table(name: \"$jobs\"): Table<GuardedJob, string>;\n table(name: \"$logins\"): Table<UserLogin, string>;\n table(name: \"$syncState\"): Table<SyncState, \"syncState\">;\n //table(name: \"$pendingChangesFromServer\"): Table<DBOperationsSet, number>;\n}\n*/\n\nexport interface SyncStateChangedEventData {\n phase: SyncStatePhase;\n error?: Error;\n progress?: number;\n}\n\ntype SyncStateTable = Table<\n PersistedSyncState | DexieCloudSchema | DexieCloudOptions,\n 'syncState' | 'options' | 'schema'\n>;\nexport interface DexieCloudDBBase {\n readonly name: Dexie['name'];\n readonly close: Dexie['close'];\n transaction: Dexie['transaction'];\n table: Dexie['table'];\n readonly tables: Dexie['tables'];\n readonly cloud: Dexie['cloud'];\n readonly $jobs: Table<GuardedJob, string>;\n readonly $logins: Table<UserLogin, string>;\n readonly $syncState: SyncStateTable;\n readonly $baseRevs: Table<BaseRevisionMapEntry, [string, number]>;\n\n readonly realms: Table<DBRealm, string>;\n readonly members: Table<DBRealmMember, string>;\n readonly roles: Table<DBRealmRole, [string, string]>;\n\n readonly localSyncEvent: Subject<{ purpose?: 'pull' | 'push' }>;\n readonly syncStateChangedEvent: BroadcastedAndLocalEvent<SyncStateChangedEventData>;\n readonly syncCompleteEvent: BroadcastedAndLocalEvent<void>;\n readonly dx: Dexie;\n readonly initiallySynced: boolean;\n}\n\nexport interface DexieCloudDB extends DexieCloudDBBase {\n getCurrentUser(): Promise<UserLogin>;\n getSchema(): Promise<DexieCloudSchema | undefined>;\n getOptions(): Promise<DexieCloudOptions | undefined>;\n getPersistedSyncState(): Promise<PersistedSyncState | undefined>;\n setInitiallySynced(initiallySynced: boolean): void;\n reconfigure(): void;\n messageConsumer: MessagesFromServerConsumer;\n}\n\nconst wm = new WeakMap<object, DexieCloudDB>();\n\nexport const DEXIE_CLOUD_SCHEMA = {\n members: '@id, [userId+realmId], [email+realmId], realmId',\n roles: '[realmId+name]',\n realms: '@realmId',\n $jobs: '',\n $syncState: '',\n $baseRevs: '[tableName+clientRev]',\n $logins: 'claims.sub, lastLogin',\n};\n\nlet static_counter = 0;\nexport function DexieCloudDB(dx: Dexie): DexieCloudDB {\n if ('vip' in dx) dx = dx['vip']; // Avoid race condition. Always map to a vipped dexie that don't block during db.on.ready().\n let db = wm.get(dx.cloud);\n if (!db) {\n const localSyncEvent = new Subject<{ purpose: 'push' | 'pull' }>();\n let syncStateChangedEvent =\n new BroadcastedAndLocalEvent<SyncStateChangedEventData>(\n `syncstatechanged-${dx.name}`\n );\n let syncCompleteEvent = new BroadcastedAndLocalEvent<void>(\n `synccomplete-${dx.name}`\n );\n localSyncEvent['id'] = ++static_counter;\n let initiallySynced = false;\n db = {\n get name() {\n return dx.name;\n },\n close() {\n return dx.close();\n },\n transaction: dx.transaction.bind(dx),\n table: dx.table.bind(dx),\n get tables() {\n return dx.tables;\n },\n cloud: dx.cloud,\n get $jobs() {\n return dx.table('$jobs') as Table<GuardedJob, string>;\n },\n get $syncState() {\n return dx.table('$syncState') as SyncStateTable;\n },\n get $baseRevs() {\n return dx.table('$baseRevs') as Table<\n BaseRevisionMapEntry,\n [string, number]\n >;\n },\n get $logins() {\n return dx.table('$logins') as Table<UserLogin, string>;\n },\n\n get realms() {\n return dx.realms;\n },\n get members() {\n return dx.members;\n },\n get roles() {\n return dx.roles;\n },\n get initiallySynced() {\n return initiallySynced;\n },\n localSyncEvent,\n get syncStateChangedEvent() {\n return syncStateChangedEvent;\n },\n get syncCompleteEvent() {\n return syncCompleteEvent;\n },\n dx,\n } as DexieCloudDB;\n\n const helperMethods: Partial<DexieCloudDB> = {\n getCurrentUser() {\n return db!.$logins\n .toArray()\n .then(\n (logins) => logins.find((l) => l.isLoggedIn) || UNAUTHORIZED_USER\n );\n },\n getPersistedSyncState() {\n return db!.$syncState.get('syncState') as Promise<\n PersistedSyncState | undefined\n >;\n },\n getSchema() {\n return db!.$syncState.get('schema').then((schema: DexieCloudSchema) => {\n if (schema) {\n for (const table of db!.tables) {\n if (table.schema.primKey && table.schema.primKey.keyPath && schema[table.name]) {\n schema[table.name].primaryKey = nameFromKeyPath(\n table.schema.primKey.keyPath\n );\n }\n }\n }\n return schema;\n }) as Promise<DexieCloudSchema | undefined>;\n },\n getOptions() {\n return db!.$syncState.get('options') as Promise<\n DexieCloudOptions | undefined\n >;\n },\n setInitiallySynced(value) {\n initiallySynced = value;\n },\n reconfigure() {\n syncStateChangedEvent = new BroadcastedAndLocalEvent<SyncState>(\n `syncstatechanged-${dx.name}`\n );\n syncCompleteEvent = new BroadcastedAndLocalEvent<void>(\n `synccomplete-${dx.name}`\n );\n },\n };\n\n Object.assign(db, helperMethods);\n db.messageConsumer = MessagesFromServerConsumer(db);\n wm.set(dx.cloud, db);\n }\n return db;\n}\n\nfunction nameFromKeyPath (keyPath?: string | string[]): string {\n return typeof keyPath === 'string' ?\n keyPath :\n keyPath ? ('[' + [].join.call(keyPath, '+') + ']') : \"\";\n}\n","// @ts-ignore\nexport const isFirefox = typeof InstallTrigger !== 'undefined';\n","export const isSafari =\n typeof navigator !== 'undefined' &&\n /Safari\\//.test(navigator.userAgent) &&\n !/Chrom(e|ium)\\/|Edge\\//.test(navigator.userAgent);\n\nexport const safariVersion = isSafari\n ? // @ts-ignore\n [].concat(navigator.userAgent.match(/Safari\\/(\\d*)/))[1]\n : NaN;\n","import { isFirefox } from './isFirefox';\nimport { isSafari, safariVersion } from './isSafari';\n\n// What we know: Safari 14.1 (version 605) crashes when using dexie-cloud's service worker.\n// We don't know what exact call is causing this. Have tried safari-14-idb-fix with no luck.\n// Something we do in the service worker is triggering the crash.\n// When next Safari version (606) is out we will start enabling SW again, hoping that the bug is solved.\n// If not, we might increment 605 to 606.\nexport const DISABLE_SERVICEWORKER_STRATEGY =\n (isSafari && safariVersion <= 605) || // Disable for Safari for now.\n isFirefox; // Disable for Firefox for now. Seems to have a bug in reading CryptoKeys from IDB from service workers\n","import Dexie from \"dexie\";\n\n/* Helper function to subscribe to database close no matter if it was unexpectedly closed or manually using db.close()\n */\nexport function dbOnClosed(db: Dexie, handler: () => void) {\n db.on.close.subscribe(handler);\n // @ts-ignore\n const origClose = db._close;\n // @ts-ignore\n db._close = function () {\n origClose.call(this);\n handler();\n };\n return () => {\n db.on.close.unsubscribe(handler);\n // @ts-ignore\n db._close = origClose;\n };\n}\n","export const IS_SERVICE_WORKER =\n typeof self !== \"undefined\" && \"clients\" in self && !self.document;\n","import Dexie from \"dexie\";\n\nexport function throwVersionIncrementNeeded() {\n throw new Dexie.SchemaError(\n `Version increment needed to allow dexie-cloud change tracking`\n );\n}\n","import {\n DBCoreAddRequest,\n DBCoreDeleteRequest,\n DBCoreIndex, DBCorePutRequest\n} from 'dexie';\nimport { b64LexEncode } from 'dreambase-library/dist/common/b64lex';\n\nconst { toString } = {};\nexport function toStringTag(o: Object) {\n return toString.call(o).slice(8, -1);\n}\n\nexport function getEffectiveKeys(\n primaryKey: DBCoreIndex,\n req: (Pick<DBCoreAddRequest | DBCorePutRequest, 'type' | 'values'> & {\n keys?: any[];\n }) |\n Pick<DBCoreDeleteRequest, 'keys' | 'type'>\n) {\n if (req.type === 'delete')\n return req.keys;\n return req.keys?.slice() || req.values.map(primaryKey.extractKey!);\n}\nfunction applyToUpperBitFix(orig: string, bits: number) {\n return (\n (bits & 1 ? orig[0].toUpperCase() : orig[0].toLowerCase()) +\n (bits & 2 ? orig[1].toUpperCase() : orig[1].toLowerCase()) +\n (bits & 4 ? orig[2].toUpperCase() : orig[2].toLowerCase())\n );\n}\nconst consonants = /b|c|d|f|g|h|j|k|l|m|n|p|q|r|s|t|v|x|y|z/i;\nfunction isUpperCase(ch: string) {\n return ch >= 'A' && ch <= 'Z';\n}\n\nexport function generateTablePrefix(\n tableName: string,\n allPrefixes: Set<string>\n) {\n let rv = tableName[0].toLocaleLowerCase(); // \"users\" = \"usr\", \"friends\" = \"frn\", \"realms\" = \"rlm\", etc.\n for (let i = 1, l = tableName.length; i < l && rv.length < 3; ++i) {\n if (consonants.test(tableName[i]) || isUpperCase(tableName[i]))\n rv += tableName[i].toLowerCase();\n }\n while (allPrefixes.has(rv)) {\n if (/\\d/g.test(rv)) {\n rv = rv.substr(0, rv.length - 1) + (rv[rv.length - 1] + 1);\n if (rv.length > 3)\n rv = rv.substr(0, 3);\n else\n continue;\n } else if (rv.length < 3) {\n rv = rv + '2';\n continue;\n }\n let bitFix = 1;\n let upperFixed = rv;\n while (allPrefixes.has(upperFixed) && bitFix < 8) {\n upperFixed = applyToUpperBitFix(rv, bitFix);\n ++bitFix;\n }\n if (bitFix < 8)\n rv = upperFixed;\n else {\n let nextChar = (rv.charCodeAt(2) + 1) & 127;\n rv = rv.substr(0, 2) + String.fromCharCode(nextChar);\n // Here, in theory we could get an infinite loop if having 127*8 table names with identical 3 first consonants.\n }\n }\n return rv;\n}\nlet time = 0;\n/**\n *\n * @param prefix A unique 3-letter short-name of the table.\n * @param shardKey 3 last letters from another ID if colocation is requested. Verified on server on inserts - guarantees unique IDs across shards.\n * The shardKey part of the key represent the shardId where it was first created. An object with this\n * primary key can later on be moved to another shard without being altered. The reason for having\n * the origin shardKey as part of the key, is that the server will not need to check uniqueness constraint\n * across all shards on every insert. Updates / moves across shards are already controlled by the server\n * in the sense that the objects needs to be there already - we only need this part for inserts.\n * @returns\n */\nexport function generateKey(prefix: string, shardKey?: string) {\n const a = new Uint8Array(18);\n const timePart = new Uint8Array(a.buffer, 0, 6);\n const now = Date.now(); // Will fit into 6 bytes until year 10 895.\n if (time >= now) {\n // User is bulk-creating objects the same millisecond.\n // Increment the time part by one millisecond for each item.\n // If bulk-creating 1,000,000 rows client-side in 10 seconds,\n // the last time-stamp will be 990 seconds in future, which is no biggie at all.\n // The point is to create a nice order of the generated IDs instead of\n // using random ids.\n ++time;\n } else {\n time = now;\n }\n timePart[0] = time / 1099511627776; // Normal division (no bitwise operator) --> works with >= 32 bits.\n timePart[1] = time / 4294967296;\n timePart[2] = time / 16777216;\n timePart[3] = time / 65536;\n timePart[4] = time / 256;\n timePart[5] = time;\n const randomPart = new Uint8Array(a.buffer, 6);\n crypto.getRandomValues(randomPart);\n const id = new Uint8Array(a.buffer);\n return prefix + b64LexEncode(id) + (shardKey || '');\n}\n","import Dexie, {\n DBCore,\n DBCoreAddRequest,\n DBCoreMutateRequest,\n DBCorePutRequest,\n Middleware,\n} from 'dexie';\nimport { isValidSyncableID } from 'dexie-cloud-common';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport {\n getEffectiveKeys,\n generateKey,\n toStringTag,\n} from '../middleware-helpers/idGenerationHelpers';\n\nexport function createIdGenerationMiddleware(\n db: DexieCloudDB\n): Middleware<DBCore> {\n return {\n stack: 'dbcore',\n name: 'idGenerationMiddleware',\n level: 1,\n create: (core) => {\n return {\n ...core,\n table: (tableName) => {\n const table = core.table(tableName);\n\n function generateOrVerifyAtKeys(\n req: DBCoreAddRequest | DBCorePutRequest,\n idPrefix: string\n ) {\n let valueClones: null | object[] = null;\n const keys = getEffectiveKeys(table.schema.primaryKey, req);\n keys.forEach((key, idx) => {\n if (key === undefined) {\n // Generate the key\n const colocatedId =\n req.values[idx].realmId || db.cloud.currentUserId;\n const shardKey = colocatedId.substr(colocatedId.length - 3);\n keys[idx] = generateKey(idPrefix, shardKey);\n if (!table.schema.primaryKey.outbound) {\n if (!valueClones) valueClones = req.values.slice();\n valueClones[idx] = Dexie.deepClone(valueClones[idx]);\n Dexie.setByKeyPath(\n valueClones[idx],\n table.schema.primaryKey.keyPath!,\n keys[idx]\n );\n }\n } else if (\n typeof key !== 'string' ||\n (!key.startsWith(idPrefix) && !key.startsWith('#' + idPrefix))\n ) {\n // Key was specified by caller. Verify it complies with id prefix.\n throw new Dexie.ConstraintError(\n `The ID \"${key}\" is not valid for table \"${tableName}\". ` +\n `Primary '@' keys requires the key to be prefixed with \"${idPrefix}\" (or \"#${idPrefix}).\\n` +\n `If you want to generate IDs programmatically, remove '@' from the schema to get rid of this constraint. Dexie Cloud supports custom IDs as long as they are random and globally unique.`\n );\n }\n });\n return table.mutate({\n ...req,\n keys,\n values: valueClones || req.values,\n });\n }\n\n return {\n ...table,\n mutate: (req) => {\n // @ts-ignore\n if (req.trans.disableChangeTracking) {\n // Disable ID policy checks and ID generation\n return table.mutate(req);\n }\n if (req.type === 'add' || req.type === 'put') {\n const cloudTableSchema = db.cloud.schema?.[tableName];\n if (!cloudTableSchema?.generatedGlobalId) {\n if (cloudTableSchema?.markedForSync) {\n // Just make sure primary key is of a supported type:\n const keys = getEffectiveKeys(table.schema.primaryKey, req);\n keys.forEach((key, idx) => {\n if (!isValidSyncableID(key)) {\n const type = Array.isArray(key)\n ? key.map(toStringTag).join(',')\n : toStringTag(key);\n throw new Dexie.ConstraintError(\n `Invalid primary key type ${type} for table ${tableName}. Tables marked for sync has primary keys of type string or Array of string (and optional numbers)`\n );\n }\n });\n }\n } else {\n if (db.cloud.options?.databaseUrl && !db.initiallySynced) {\n // A database URL is configured but no initial sync has been performed.\n const keys = getEffectiveKeys(table.schema.primaryKey, req);\n // Check if the operation would yield any INSERT. If so, complain! We never want wrong ID prefixes stored.\n return table\n .getMany({ keys, trans: req.trans, cache: 'immutable' })\n .then((results) => {\n if (results.length < keys.length) {\n // At least one of the given objects would be created. Complain since\n // the generated ID would be based on a locally computed ID prefix only - we wouldn't\n // know if the server would give the same ID prefix until an initial sync has been\n // performed.\n throw new Error(\n `Unable to create new objects without an initial sync having been performed.`\n );\n }\n return table.mutate(req);\n });\n }\n return generateOrVerifyAtKeys(\n req,\n cloudTableSchema.idPrefix!\n );\n }\n }\n return table.mutate(req);\n },\n };\n },\n };\n },\n };\n}\n","import { DBCore, DBCoreTransaction, Middleware } from 'dexie';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { TXExpandos } from '../types/TXExpandos';\n\nexport function createImplicitPropSetterMiddleware(\n db: DexieCloudDB\n): Middleware<DBCore> {\n return {\n stack: 'dbcore',\n name: 'implicitPropSetterMiddleware',\n level: 1,\n create: (core) => {\n return {\n ...core,\n table: (tableName) => {\n const table = core.table(tableName);\n return {\n ...table,\n mutate: (req) => {\n // @ts-ignore\n if (req.trans.disableChangeTracking) {\n return table.mutate(req);\n }\n\n const trans = req.trans as DBCoreTransaction & TXExpandos;\n if (db.cloud.schema?.[tableName]?.markedForSync) {\n if (req.type === 'add' || req.type === 'put') {\n // No matter if user is logged in or not, make sure \"owner\" and \"realmId\" props are set properly.\n // If not logged in, this will be changed upon syncification of the tables (next sync after login),\n // however, application code will work better if we can always rely on that the properties realmId\n // and owner are set. Application code may index them and query them based on db.cloud.currentUserId,\n // and expect them to be returned. That scenario must work also when db.cloud.currentUserId === 'unauthorized'.\n for (const obj of req.values) {\n if (!obj.owner) {\n obj.owner = trans.currentUser.userId;\n }\n if (!obj.realmId) {\n obj.realmId = trans.currentUser.userId;\n }\n const key = table.schema.primaryKey.extractKey?.(obj);\n if (typeof key === 'string' && key[0] === '#') {\n // Add $ts prop for put operations and\n // disable update operations as well as consistent\n // modify operations. Reason: Server may not have\n // the object. Object should be created on server only\n // if is being updated. An update operation won't create it\n // so we must delete req.changeSpec to degrade operation to\n // an upsert operation with timestamp so that it will be created.\n // We must also degrade from consistent modify operations for the\n // same reason - object might be there on server. Must but put up instead.\n\n // FUTURE: This clumpsy behavior of private IDs could be refined later.\n // Suggestion is to in future, treat private IDs as we treat all objects \n // and sync operations normally. Only that deletions should become soft deletes\n // for them - so that server knows when a private ID has been deleted on server\n // not accept insert/upserts on them.\n if (req.type === 'put') {\n const now = Date.now();\n delete req.criteria;\n delete req.changeSpec;\n delete req.updates;\n obj.$ts = Date.now();\n }\n }\n }\n }\n }\n return table.mutate(req);\n },\n };\n },\n };\n },\n };\n}\n","\nexport function allSettled(possiblePromises: any[]) {\n return new Promise(resolve => {\n if (possiblePromises.length === 0) resolve([]);\n let remaining = possiblePromises.length;\n const results = new Array(remaining);\n possiblePromises.forEach((p, i) => Promise.resolve(p).then(\n value => results[i] = {status: \"fulfilled\", value},\n reason => results[i] = {status: \"rejected\", reason})\n .then(()=>--remaining || resolve(results)));\n });\n}\n","import { DBCoreTable, DBCoreTransaction } from \"dexie\";\nimport { allSettled } from \"../helpers/allSettled\";\n\nlet counter = 0;\n\nexport function guardedTable(table: DBCoreTable) {\n const prop = \"$lock\"+ (++counter);\n return {\n ...table,\n count: readLock(table.count, prop),\n get: readLock(table.get, prop),\n getMany: readLock(table.getMany, prop),\n openCursor: readLock(table.openCursor, prop),\n query: readLock(table.query, prop),\n mutate: writeLock(table.mutate, prop),\n };\n}\n\nfunction readLock<TReq extends { trans: DBCoreTransaction }, TRes>(\n fn: (req: TReq) => Promise<TRes>,\n prop: string\n): (req: TReq) => Promise<TRes> {\n return function readLocker(req): Promise<TRes> {\n const {\n readers,\n writers,\n }: { writers: Promise<any>[]; readers: Promise<any>[] } =\n req.trans[prop] || (req.trans[prop] = { writers: [], readers: [] });\n const numWriters = writers.length;\n const promise = (numWriters > 0\n ? writers[numWriters - 1].then(() => fn(req), () => fn(req))\n : fn(req)\n ).finally(() => readers.splice(readers.indexOf(promise)));\n readers.push(promise);\n return promise;\n };\n}\n\nfunction writeLock<TReq extends { trans: DBCoreTransaction }, TRes>(\n fn: (req: TReq) => Promise<TRes>,\n prop: string\n): (req: TReq) => Promise<TRes> {\n return function writeLocker(req): Promise<TRes> {\n const {\n readers,\n writers,\n }: { writers: Promise<any>[]; readers: Promise<any>[] } =\n req.trans[prop] || (req.trans[prop] = { writers: [], readers: [] });\n let promise = (writers.length > 0\n ? writers[writers.length - 1].then(() => fn(req), () => fn(req))\n : readers.length > 0\n ? allSettled(readers).then(() => fn(req))\n : fn(req)\n ).finally(() => writers.shift());\n writers.push(promise);\n return promise;\n };\n}\n","import { DBCoreTransaction } from 'dexie';\nimport { BehaviorSubject } from 'rxjs';\nimport { TXExpandos } from '../types/TXExpandos';\n\nexport const outstandingTransactions = new BehaviorSubject<Set<DBCoreTransaction & IDBTransaction & TXExpandos>>(new Set());\n","import {\n DBCore,\n DBCoreAddRequest,\n DBCoreDeleteRequest,\n DBCoreMutateResponse,\n DBCorePutRequest,\n DBCoreTable,\n DBCoreTransaction,\n Middleware\n} from 'dexie';\nimport { DBOperation } from 'dexie-cloud-common';\nimport { BehaviorSubject } from 'rxjs';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { UserLogin } from '../db/entities/UserLogin';\nimport { getMutationTable } from '../helpers/getMutationTable';\nimport { randomString } from '../helpers/randomString';\nimport { throwVersionIncrementNeeded } from '../helpers/throwVersionIncrementNeeded';\nimport { guardedTable } from '../middleware-helpers/guardedTable';\nimport { registerSyncEvent } from '../sync/registerSyncEvent';\nimport { TXExpandos } from '../types/TXExpandos';\nimport { outstandingTransactions } from './outstandingTransaction';\n\nexport interface MutationTrackingMiddlewareArgs {\n currentUserObservable: BehaviorSubject<UserLogin>;\n db: DexieCloudDB;\n}\n\n/** Tracks all mutations in the same transaction as the mutations -\n * so it is guaranteed that no mutation goes untracked - and if transaction\n * aborts, the mutations won't be tracked.\n *\n * The sync job will use the tracked mutations as the source of truth when pushing\n * changes to server and cleanup the tracked mutations once the server has\n * ackowledged that it got them.\n */\nexport function createMutationTrackingMiddleware({\n currentUserObservable,\n db\n}: MutationTrackingMiddlewareArgs): Middleware<DBCore> {\n return {\n stack: 'dbcore',\n name: 'MutationTrackingMiddleware',\n level: 1,\n create: (core) => {\n const ordinaryTables = core.schema.tables.filter(\n (t) => !/^\\$/.test(t.name)\n );\n let mutTableMap: Map<string, DBCoreTable>;\n try {\n mutTableMap = new Map(\n ordinaryTables.map((tbl) => [\n tbl.name,\n core.table(`$${tbl.name}_mutations`)\n ])\n );\n } catch {\n throwVersionIncrementNeeded();\n }\n\n return {\n ...core,\n transaction: (tables, mode) => {\n let tx: DBCoreTransaction & IDBTransaction & TXExpandos;\n if (mode === 'readwrite') {\n const mutationTables = tables\n .filter((tbl) => db.cloud.schema?.[tbl]?.markedForSync)\n .map((tbl) => getMutationTable(tbl));\n tx = core.transaction(\n [...tables, ...mutationTables],\n mode\n ) as DBCoreTransaction & IDBTransaction & TXExpandos;\n } else {\n tx = core.transaction(tables, mode) as DBCoreTransaction &\n IDBTransaction &\n TXExpandos;\n }\n\n if (mode === 'readwrite') {\n // Give each transaction a globally unique id.\n tx.txid = randomString(16);\n tx.opCount = 0;\n // Introduce the concept of current user that lasts through the entire transaction.\n // This is important because the tracked mutations must be connected to the user.\n tx.currentUser = currentUserObservable.value;\n outstandingTransactions.value.add(tx);\n outstandingTransactions.next(outstandingTransactions.value);\n const removeTransaction = () => {\n tx.removeEventListener('complete', txComplete);\n tx.removeEventListener('error', removeTransaction);\n tx.removeEventListener('abort', removeTransaction);\n outstandingTransactions.value.delete(tx);\n outstandingTransactions.next(outstandingTransactions.value);\n };\n const txComplete = () => {\n if (tx.mutationsAdded && db.cloud.options?.databaseUrl) {\n if (db.cloud.usingServiceWorker) {\n console.debug('registering sync event');\n registerSyncEvent(db, \"push\");\n } else {\n db.localSyncEvent.next({purpose: \"push\"});\n }\n }\n removeTransaction();\n };\n tx.addEventListener('complete', txComplete);\n tx.addEventListener('error', removeTransaction);\n tx.addEventListener('abort', removeTransaction);\n }\n return tx;\n },\n table: (tableName) => {\n const table = core.table(tableName);\n if (/^\\$/.test(tableName)) {\n if (tableName.endsWith('_mutations')) {\n // In case application code adds items to ..._mutations tables,\n // make sure to set the mutationsAdded flag on transaction.\n // This is also done in mutateAndLog() as that function talks to a\n // lower level DBCore and wouldn't be catched by this code.\n return {\n ...table,\n mutate: (req) => {\n if (req.type === 'add' || req.type === 'put') {\n (\n req.trans as DBCoreTransaction & TXExpandos\n ).mutationsAdded = true;\n }\n return table.mutate(req);\n }\n };\n } else if (tableName === '$logins') {\n return {\n ...table,\n mutate: (req) => {\n //console.debug('Mutating $logins table', req);\n return table\n .mutate(req)\n .then((res) => {\n //console.debug('Mutating $logins');\n (\n req.trans as DBCoreTransaction & TXExpandos\n ).mutationsAdded = true;\n //console.debug('$logins mutated');\n return res;\n })\n .catch((err) => {\n console.debug('Failed mutation $logins', err);\n return Promise.reject(err);\n });\n }\n };\n } else {\n return table;\n }\n }\n const { schema } = table;\n const mutsTable = mutTableMap.get(tableName)!;\n return guardedTable({\n ...table,\n mutate: (req) => {\n const trans = req.trans as DBCoreTransaction & TXExpandos;\n if (!trans.txid) return table.mutate(req); // Upgrade transactions not guarded by us.\n if (trans.disableChangeTracking) return table.mutate(req);\n if (!db.cloud.schema?.[tableName]?.markedForSync) return table.mutate(req);\n if (!trans.currentUser?.isLoggedIn) {\n // Unauthorized user should not log mutations.\n // Instead, after login all local data should be logged at once.\n return table.mutate(req);\n }\n\n return req.type === 'deleteRange'\n ? table\n // Query the actual keys (needed for server sending correct rollback to us)\n .query({\n query: { range: req.range, index: schema.primaryKey },\n trans: req.trans,\n values: false\n })\n // Do a delete request instead, but keep the criteria info for the server to execute\n .then((res) => {\n return mutateAndLog({\n type: 'delete',\n keys: res.result,\n trans: req.trans,\n criteria: { index: null, range: req.range }\n });\n })\n : mutateAndLog(req);\n }\n });\n\n function mutateAndLog(\n req: DBCoreDeleteRequest | DBCoreAddRequest | DBCorePutRequest\n ): Promise<DBCoreMutateResponse> {\n const trans = req.trans as DBCoreTransaction & TXExpandos;\n trans.mutationsAdded = true;\n const {\n txid,\n currentUser: { userId }\n } = trans;\n const { type } = req;\n const opNo = ++trans.opCount;\n\n return table.mutate(req).then((res) => {\n const { numFailures: hasFailures, failures } = res;\n let keys = type === 'delete' ? req.keys! : res.results!;\n let values = 'values' in req ? req.values : [];\n let updates = 'updates' in req && req.updates!;\n if (hasFailures) {\n keys = keys.filter((_, idx) => !failures[idx]);\n values = values.filter((_, idx) => !failures[idx]);\n }\n const ts = Date.now();\n\n const mut: DBOperation =\n req.type === 'delete'\n ? {\n type: 'delete',\n ts,\n opNo,\n keys,\n criteria: req.criteria,\n txid,\n userId\n }\n : req.type === 'add'\n ? {\n type: 'insert',\n ts,\n opNo,\n keys,\n txid,\n userId,\n values\n }\n : req.criteria && req.changeSpec\n ? {\n // Common changeSpec for all keys\n type: 'modify',\n ts,\n opNo,\n keys,\n criteria: req.criteria,\n changeSpec: req.changeSpec,\n txid,\n userId\n }\n : updates\n ? {\n // One changeSpec per key\n type: 'update',\n ts,\n opNo,\n keys: updates.keys,\n changeSpecs: updates.changeSpecs,\n txid,\n userId\n }\n : {\n type: 'upsert',\n ts,\n opNo,\n keys,\n values,\n txid,\n userId\n };\n return keys.length > 0 || ('criteria' in req && req.criteria)\n ? mutsTable\n .mutate({ type: 'add', trans, values: [mut] }) // Log entry\n .then(() => res) // Return original response\n : res;\n });\n }\n }\n };\n }\n };\n}\n","import Dexie, { DbSchema } from 'dexie';\nimport { DEXIE_CLOUD_SCHEMA } from './db/DexieCloudDB';\nimport { generateTablePrefix } from './middleware-helpers/idGenerationHelpers';\n\nexport function overrideParseStoresSpec(origFunc: Function, dexie: Dexie) {\n return function(stores: {[tableName: string]: string}, dbSchema: DbSchema) {\n const storesClone = {\n ...DEXIE_CLOUD_SCHEMA,\n ...stores,\n };\n // Merge indexes of DEXIE_CLOUD_SCHEMA with stores\n Object.keys(DEXIE_CLOUD_SCHEMA).forEach((tableName: keyof typeof DEXIE_CLOUD_SCHEMA) => {\n const schemaSrc = storesClone[tableName];\n // Verify that they don't try to delete a table that is needed for access control of Dexie Cloud\n if (schemaSrc == null) {\n // They try to delete one of the built-in schema tables.\n throw new Error(`Cannot delete table ${tableName} as it is needed for access control of Dexie Cloud`);\n }\n // If not trying to override a built-in table, then we can skip this and continue to next table.\n if (!stores[tableName]) {\n // They haven't tried to declare this table. No need to merge indexes.\n return; // Continue\n }\n\n // They have declared this table. Merge indexes in case they didn't declare all indexes we need.\n const requestedIndexes = schemaSrc.split(',').map(spec => spec.trim());\n const builtInIndexes = DEXIE_CLOUD_SCHEMA[tableName].split(',').map(spec => spec.trim());\n const requestedIndexSet = new Set(requestedIndexes.map(index => index.replace(/([&*]|\\+\\+)/g, \"\")));\n // Verify that primary key is unchanged\n if (requestedIndexes[0] !== builtInIndexes[0]) {\n // Primary key must match exactly\n throw new Error(`Cannot override primary key of table ${tableName}. Please declare it as {${\n tableName}: ${\n JSON.stringify(DEXIE_CLOUD_SCHEMA[tableName])\n }`);\n }\n // Merge indexes\n for (let i=1; i<builtInIndexes.length; ++i) {\n const builtInIndex = builtInIndexes[i];\n if (!requestedIndexSet.has(builtInIndex.replace(/([&*]|\\+\\+)/g, \"\"))) {\n // Add built-in index if not already requested\n storesClone[tableName] += `,${builtInIndex}`;\n }\n }\n });\n\n // Populate dexie.cloud.schema\n const cloudSchema = dexie.cloud.schema || (dexie.cloud.schema = {});\n const allPrefixes = new Set<string>();\n Object.keys(storesClone).forEach(tableName => {\n const schemaSrc = storesClone[tableName];\n const cloudTableSchema = cloudSchema[tableName] || (cloudSchema[tableName] = {});\n if (schemaSrc != null) {\n if (/^\\@/.test(schemaSrc)) {\n storesClone[tableName] = storesClone[tableName].substr(1);\n cloudTableSchema.generatedGlobalId = true;\n cloudTableSchema.idPrefix = generateTablePrefix(tableName, allPrefixes);\n allPrefixes.add(cloudTableSchema.idPrefix);\n }\n if (!/^\\$/.test(tableName)) {\n storesClone[`$${tableName}_mutations`] = '++rev';\n cloudTableSchema.markedForSync = true;\n }\n if (cloudTableSchema.deleted) {\n cloudTableSchema.deleted = false;\n }\n } else {\n cloudTableSchema.deleted = true;\n cloudTableSchema.markedForSync = false;\n storesClone[`$${tableName}_mutations`] = null;\n }\n });\n const rv = origFunc.call(this, storesClone, dbSchema);\n return rv;\n }\n}\n","import { DexieCloudSchema } from 'dexie-cloud-common';\nimport { DexieCloudDB } from './db/DexieCloudDB';\nimport { DexieCloudOptions } from './DexieCloudOptions';\nimport { performGuardedJob } from './sync/performGuardedJob';\nimport { sync } from './sync/sync';\n\nexport async function performInitialSync(\n db: DexieCloudDB,\n cloudOptions: DexieCloudOptions,\n cloudSchema: DexieCloudSchema\n) {\n console.debug('Performing initial sync'); \n await sync(db, cloudOptions, cloudSchema, { isInitialSync: true });\n console.debug('Done initial sync');\n}\n","import { BehaviorSubject, fromEvent, merge, of } from 'rxjs';\nimport {\n debounceTime,\n delay,\n distinctUntilChanged,\n filter,\n map,\n skip,\n startWith,\n switchMap,\n tap,\n} from 'rxjs/operators';\n\nconst USER_INACTIVITY_TIMEOUT = 180_000; // 3 minutes\nconst ACTIVE_WAIT_TIME = 0; // For now, it's nicer to react instantly on user activity\nconst INACTIVE_WAIT_TIME = 20_000;\n\n// This observable will be emitted to later down....\nexport const userIsActive = new BehaviorSubject<boolean>(true);\n\n// A refined version that waits before changing state:\n// * Wait another INACTIVE_WAIT_TIME before accepting that the user is inactive.\n// Reason 1: Spare resources - no need to setup the entire websocket flow when\n// switching tabs back and forth.\n// Reason 2: Less flickering for the end user when switching tabs back and forth.\n// * Wait another ACTIVE_WAIT_TIME before accepting that the user is active.\n// Possible reason to have a value here: Sparing resources if users often temporary click the tab\n// for just a short time.\nexport const userIsReallyActive = new BehaviorSubject<boolean>(true);\nuserIsActive\n .pipe(\n switchMap((isActive) => {\n //console.debug('SyncStatus: DUBB: isActive changed to', isActive);\n return isActive\n ? ACTIVE_WAIT_TIME\n ? of(true).pipe(delay(ACTIVE_WAIT_TIME))\n : of(true)\n : INACTIVE_WAIT_TIME\n ? of(false).pipe(delay(INACTIVE_WAIT_TIME))\n : of(false);}\n ),\n distinctUntilChanged()\n )\n .subscribe(userIsReallyActive);\n\n//\n// First create some corner-stone observables to build the flow on\n//\n\n// document.onvisibilitychange:\nexport const visibilityStateIsChanged =\n typeof document !== 'undefined'\n ? fromEvent(document, 'visibilitychange')\n : of({});\n\n// document.onvisibilitychange makes document hidden:\nexport const documentBecomesHidden = visibilityStateIsChanged.pipe(\n filter(() => document.visibilityState === 'hidden')\n);\n\n// document.onvisibilitychange makes document visible\nexport const documentBecomesVisible = visibilityStateIsChanged.pipe(\n filter(() => document.visibilityState === 'visible')\n);\n\n// Any of various user-activity-related events happen:\nexport const userDoesSomething =\n typeof window !== 'undefined'\n ? merge(\n documentBecomesVisible,\n fromEvent(window, 'mousedown'),\n fromEvent(window, 'mousemove'),\n fromEvent(window, 'keydown'),\n fromEvent(window, 'wheel'),\n fromEvent(window, 'touchmove')\n )\n : of({});\n\nif (typeof document !== 'undefined') {\n //\n // Now, create a final observable and start subscribing to it in order\n // to make it emit values to userIsActive BehaviourSubject (which is the\n // most important global hot observable we have here)\n //\n // Live test: https://jsitor.com/LboCDHgbn\n //\n merge(\n of(true), // Make sure something is always emitted from start\n documentBecomesHidden, // so that we can eagerly emit false!\n userDoesSomething\n )\n .pipe(\n // No matter event source, compute whether user is visible using visibilityState:\n map(() => document.visibilityState === 'visible'),\n // Make sure to emit it\n tap((isActive) => {\n if (userIsActive.value !== isActive) {\n // Emit new value unless it already has that value\n userIsActive.next(isActive);\n }\n }),\n // Now, if true was emitted, make sure to set a timeout to emit false\n // unless new user activity things happen (in that case, the timeout will be cancelled!)\n switchMap((isActive) =>\n isActive\n ? of(0).pipe(\n delay(USER_INACTIVITY_TIMEOUT - INACTIVE_WAIT_TIME),\n tap(() => userIsActive.next(false))\n )\n : of(0)\n )\n )\n .subscribe(() => {}); // Unless we subscribe nothing will be propagated to userIsActive observable\n}\n","export class TokenExpiredError extends Error {\n name = \"TokenExpiredError\";\n}\n","import { DBOperationsSet } from 'dexie-cloud-common';\nimport { BehaviorSubject, Observable, Subscriber, Subscription } from 'rxjs';\nimport { TokenExpiredError } from './authentication/TokenExpiredError';\nimport { DXCWebSocketStatus } from './DXCWebSocketStatus';\nimport { TSON } from './TSON';\n\nconst SERVER_PING_TIMEOUT = 20000;\nconst CLIENT_PING_INTERVAL = 30000;\nconst FAIL_RETRY_WAIT_TIME = 60000;\n\nexport type WSClientToServerMsg = ReadyForChangesMessage;\nexport interface ReadyForChangesMessage {\n type: 'ready';\n realmSetHash: string;\n rev: string;\n}\n\nexport type WSConnectionMsg =\n | RevisionChangedMessage\n | RealmAddedMessage\n | RealmAcceptedMessage\n | RealmRemovedMessage\n | RealmsChangedMessage\n | ChangesFromServerMessage\n | TokenExpiredMessage;\ninterface PingMessage {\n type: 'ping';\n}\n\ninterface PongMessage {\n type: 'pong';\n}\n\ninterface ErrorMessage {\n type: 'error';\n error: string;\n}\n\nexport interface ChangesFromServerMessage {\n type: 'changes';\n baseRev: string;\n realmSetHash: string;\n newRev: string;\n changes: DBOperationsSet<string>;\n}\nexport interface RevisionChangedMessage {\n type: 'rev';\n rev: string;\n}\n\nexport interface RealmAddedMessage {\n type: 'realm-added';\n realm: string;\n}\n\nexport interface RealmAcceptedMessage {\n type: 'realm-accepted';\n realm: string;\n}\n\nexport interface RealmRemovedMessage {\n type: 'realm-removed';\n realm: string;\n}\n\nexport interface RealmsChangedMessage {\n type: 'realms-changed';\n realmsHash: string;\n}\nexport interface TokenExpiredMessage {\n type: 'token-expired';\n}\n\nexport class WSObservable extends Observable<WSConnectionMsg> {\n constructor(\n databaseUrl: string,\n rev: string,\n realmSetHash: string,\n clientIdentity: string,\n messageProducer: Observable<WSClientToServerMsg>,\n webSocketStatus: BehaviorSubject<DXCWebSocketStatus>,\n token?: string,\n tokenExpiration?: Date\n ) {\n super(\n (subscriber) =>\n new WSConnection(\n databaseUrl,\n rev,\n realmSetHash,\n clientIdentity,\n token,\n tokenExpiration,\n subscriber,\n messageProducer,\n webSocketStatus\n )\n );\n }\n}\n\nlet counter = 0;\n\nexport class WSConnection extends Subscription {\n ws: WebSocket | null;\n lastServerActivity: Date;\n lastUserActivity: Date;\n lastPing: Date;\n databaseUrl: string;\n rev: string;\n realmSetHash: string;\n clientIdentity: string;\n token: string | undefined;\n tokenExpiration: Date | undefined;\n subscriber: Subscriber<WSConnectionMsg>;\n pauseUntil?: Date;\n messageProducer: Observable<WSClientToServerMsg>;\n webSocketStatus: BehaviorSubject<DXCWebSocketStatus>;\n id = ++counter;\n\n private pinger: any;\n private messageProducerSubscription: null | Subscription;\n\n constructor(\n databaseUrl: string,\n rev: string,\n realmSetHash: string,\n clientIdentity: string,\n token: string | undefined,\n tokenExpiration: Date | undefined,\n subscriber: Subscriber<WSConnectionMsg>,\n messageProducer: Observable<WSClientToServerMsg>,\n webSocketStatus: BehaviorSubject<DXCWebSocketStatus>\n ) {\n super(() => this.teardown());\n console.debug(\n 'New WebSocket Connection',\n this.id,\n token ? 'authorized' : 'unauthorized'\n );\n this.databaseUrl = databaseUrl;\n this.rev = rev;\n this.realmSetHash = realmSetHash;\n this.clientIdentity = clientIdentity;\n this.token = token;\n this.tokenExpiration = tokenExpiration;\n this.subscriber = subscriber;\n this.lastUserActivity = new Date();\n this.messageProducer = messageProducer;\n this.messageProducerSubscription = null;\n this.webSocketStatus = webSocketStatus;\n this.connect();\n }\n\n private teardown() {\n console.debug('Teardown WebSocket Connection', this.id);\n this.disconnect();\n }\n\n private disconnect() {\n this.webSocketStatus.next('disconnected');\n if (this.pinger) {\n clearInterval(this.pinger);\n this.pinger = null;\n }\n if (this.ws) {\n try {\n this.ws.close();\n } catch {}\n }\n this.ws = null;\n if (this.messageProducerSubscription) {\n this.messageProducerSubscription.unsubscribe();\n this.messageProducerSubscription = null;\n }\n }\n\n reconnecting = false;\n reconnect() {\n if (this.reconnecting) return;\n this.reconnecting = true;\n try {\n this.disconnect();\n } catch {}\n this.connect()\n .catch(() => {})\n .then(() => (this.reconnecting = false)); // finally()\n }\n\n async connect() {\n this.lastServerActivity = new Date();\n if (this.pauseUntil && this.pauseUntil > new Date()) {\n console.debug('WS not reconnecting just yet', {\n id: this.id,\n pauseUntil: this.pauseUntil,\n });\n return;\n }\n if (this.ws) {\n throw new Error(`Called connect() when a connection is already open`);\n }\n if (!this.databaseUrl)\n throw new Error(`Cannot connect without a database URL`);\n if (this.closed) {\n //console.debug('SyncStatus: DUBB: Ooops it was closed!');\n return;\n }\n if (this.tokenExpiration && this.tokenExpiration < new Date()) {\n this.subscriber.error(new TokenExpiredError()); // Will be handled in connectWebSocket.ts.\n return;\n }\n this.webSocketStatus.next('connecting');\n this.pinger = setInterval(async () => {\n if (this.closed) {\n console.debug('pinger check', this.id, 'CLOSED.');\n this.teardown();\n return;\n }\n if (this.ws) {\n try {\n this.ws.send(JSON.stringify({ type: 'ping' } as PingMessage));\n setTimeout(() => {\n console.debug(\n 'pinger setTimeout',\n this.id,\n this.pinger ? `alive` : 'dead'\n );\n if (!this.pinger) return;\n if (this.closed) {\n console.debug(\n 'pinger setTimeout',\n this.id,\n 'subscription is closed'\n );\n this.teardown();\n return;\n }\n if (\n this.lastServerActivity <\n new Date(Date.now() - SERVER_PING_TIMEOUT)\n ) {\n // Server inactive. Reconnect if user is active.\n console.debug('pinger: server is inactive');\n console.debug('pinger reconnecting');\n this.reconnect();\n } else {\n console.debug('pinger: server still active');\n }\n }, SERVER_PING_TIMEOUT);\n } catch {\n console.debug('pinger catch error', this.id, 'reconnecting');\n this.reconnect();\n }\n } else {\n console.debug('pinger', this.id, 'reconnecting');\n this.reconnect();\n }\n }, CLIENT_PING_INTERVAL);\n\n // The following vars are needed because we must know which callback to ack when server sends it's ack to us.\n const wsUrl = new URL(this.databaseUrl);\n wsUrl.protocol = wsUrl.protocol === 'http:' ? 'ws' : 'wss';\n const searchParams = new URLSearchParams();\n if (this.subscriber.closed) return;\n searchParams.set('v', '2');\n searchParams.set('rev', this.rev);\n searchParams.set('realmsHash', this.realmSetHash);\n searchParams.set('clientId', this.clientIdentity);\n if (this.token) {\n searchParams.set('token', this.token);\n }\n\n // Connect the WebSocket to given url:\n console.debug('dexie-cloud WebSocket create');\n const ws = (this.ws = new WebSocket(`${wsUrl}/changes?${searchParams}`));\n //ws.binaryType = \"arraybuffer\"; // For future when subscribing to actual changes.\n\n ws.onclose = (event: Event) => {\n if (!this.pinger) return;\n console.debug('dexie-cloud WebSocket onclosed', this.id);\n this.reconnect();\n };\n\n ws.onmessage = (event: MessageEvent) => {\n if (!this.pinger) return;\n console.debug('dexie-cloud WebSocket onmessage', event.data);\n\n this.lastServerActivity = new Date();\n try {\n const msg = TSON.parse(event.data) as\n | WSConnectionMsg\n | PongMessage\n | ErrorMessage;\n if (msg.type === 'error') {\n throw new Error(`Error message from dexie-cloud: ${msg.error}`);\n }\n if (msg.type === 'rev') {\n this.rev = msg.rev; // No meaning but seems reasonable.\n }\n if (msg.type !== 'pong') {\n this.subscriber.next(msg);\n }\n } catch (e) {\n this.subscriber.error(e);\n }\n };\n\n try {\n let everConnected = false;\n await new Promise((resolve, reject) => {\n ws.onopen = (event) => {\n console.debug('dexie-cloud WebSocket onopen');\n everConnected = true;\n resolve(null);\n };\n ws.onerror = (event: ErrorEvent) => {\n if (!everConnected) {\n const error = event.error || new Error('WebSocket Error');\n this.subscriber.error(error);\n this.webSocketStatus.next('error');\n reject(error);\n } else {\n this.reconnect();\n }\n };\n });\n this.messageProducerSubscription = this.messageProducer.subscribe(\n (msg) => {\n if (!this.closed) {\n if (\n msg.type === 'ready' &&\n this.webSocketStatus.value !== 'connected'\n ) {\n this.webSocketStatus.next('connected');\n }\n this.ws?.send(TSON.stringify(msg));\n }\n }\n );\n } catch (error) {\n this.pauseUntil = new Date(Date.now() + FAIL_RETRY_WAIT_TIME);\n }\n }\n}\n","import { BehaviorSubject, from, Observable, of, throwError } from 'rxjs';\nimport {\n catchError,\n debounceTime,\n delay,\n distinctUntilChanged,\n filter,\n map,\n switchMap,\n take,\n tap,\n} from 'rxjs/operators';\nimport { refreshAccessToken } from '../authentication/authenticate';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { PersistedSyncState } from '../db/entities/PersistedSyncState';\nimport { computeRealmSetHash } from '../helpers/computeRealmSetHash';\nimport {\n userDoesSomething,\n userIsActive,\n userIsReallyActive,\n} from '../userIsActive';\nimport {\n ReadyForChangesMessage,\n WSConnectionMsg,\n WSObservable,\n} from '../WSObservable';\n\nfunction sleep(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nasync function waitAndReconnectWhenUserDoesSomething(error: Error) {\n console.error(\n `WebSocket observable: error but revive when user does some active thing...`,\n error\n );\n // Sleep some seconds...\n await sleep(3000);\n // Wait til user does something (move mouse, tap, scroll, click etc)\n console.debug('waiting for someone to do something');\n await userDoesSomething.pipe(take(1)).toPromise();\n console.debug('someone did something!');\n}\n\nexport function connectWebSocket(db: DexieCloudDB) {\n if (!db.cloud.options?.databaseUrl) {\n throw new Error(`No database URL to connect WebSocket to`);\n }\n\n const messageProducer = db.messageConsumer.readyToServe.pipe(\n filter((isReady) => isReady), // When consumer is ready for new messages, produce such a message to inform server about it\n switchMap(() => db.getPersistedSyncState()), // We need the info on which server revision we are at:\n filter((syncState) => syncState && syncState.serverRevision), // We wont send anything to server before inital sync has taken place\n switchMap<PersistedSyncState, Promise<ReadyForChangesMessage>>(async (syncState) => ({\n // Produce the message to trigger server to send us new messages to consume:\n type: 'ready',\n rev: syncState.serverRevision,\n realmSetHash: await computeRealmSetHash(syncState)\n }))\n );\n\n function createObservable(): Observable<WSConnectionMsg | null> {\n return db.cloud.persistedSyncState.pipe(\n filter((syncState) => syncState?.serverRevision), // Don't connect before there's no initial sync performed.\n take(1), // Don't continue waking up whenever syncState change\n switchMap((syncState) =>\n db.cloud.currentUser.pipe(\n map((userLogin) => [userLogin, syncState] as const)\n )\n ),\n switchMap(([userLogin, syncState]) =>\n userIsReallyActive.pipe(\n map((isActive) => [isActive ? userLogin : null, syncState] as const)\n )\n ),\n switchMap(([userLogin, syncState]) => {\n if (userLogin?.isLoggedIn && !syncState?.realms.includes(userLogin.userId!)) {\n // We're in an in-between state when user is logged in but the user's realms are not yet synced.\n // Don't make this change reconnect the websocket just yet. Wait till syncState is updated\n // to iclude the user's realm.\n return db.cloud.persistedSyncState.pipe(\n filter((syncState) => syncState?.realms.includes(userLogin!.userId!) || false),\n take(1),\n map((syncState) => [userLogin, syncState] as const)\n );\n }\n return new BehaviorSubject([userLogin, syncState] as const);\n }),\n switchMap(\n async ([userLogin, syncState]) =>\n [userLogin, await computeRealmSetHash(syncState!)] as const\n ),\n distinctUntilChanged(([prevUser, prevHash], [currUser, currHash]) => prevUser === currUser && prevHash === currHash ),\n switchMap(([userLogin, realmSetHash]) => {\n // Let server end query changes from last entry of same client-ID and forward.\n // If no new entries, server won't bother the client. If new entries, server sends only those\n // and the baseRev of the last from same client-ID.\n if (userLogin) {\n return new WSObservable(\n db.cloud.options!.databaseUrl,\n db.cloud.persistedSyncState!.value!.serverRevision,\n realmSetHash,\n db.cloud.persistedSyncState!.value!.clientIdentity,\n messageProducer,\n db.cloud.webSocketStatus,\n userLogin.accessToken,\n userLogin.accessTokenExpiration\n );\n } else {\n return from([] as WSConnectionMsg[]);\n }}),\n catchError((error) => {\n if (error?.name === 'TokenExpiredError') {\n console.debug(\n 'WebSocket observable: Token expired. Refreshing token...'\n );\n return of(true).pipe(\n switchMap(async () => {\n // Refresh access token\n const user = await db.getCurrentUser();\n const refreshedLogin = await refreshAccessToken(\n db.cloud.options!.databaseUrl,\n user\n );\n // Persist updated access token\n await db.table('$logins').update(user.userId, {\n accessToken: refreshedLogin.accessToken,\n accessTokenExpiration: refreshedLogin.accessTokenExpiration,\n });\n }),\n switchMap(() => createObservable())\n );\n } else {\n return throwError(error);\n }\n }),\n catchError((error) => {\n db.cloud.webSocketStatus.next(\"error\");\n return from(waitAndReconnectWhenUserDoesSomething(error)).pipe(\n switchMap(() => createObservable())\n );\n })\n ) as Observable<WSConnectionMsg | null>;\n }\n\n return createObservable().subscribe({\n next: (msg) => {\n if (msg) {\n console.debug('WS got message', msg);\n db.messageConsumer.enqueue(msg);\n }\n },\n error: (error) => {\n console.error('WS got error', error);\n },\n complete: () => {\n console.debug('WS observable completed');\n },\n });\n}\n","import { DexieCloudDB } from \"../db/DexieCloudDB\";\nimport { sync } from \"./sync\";\n\nexport async function isSyncNeeded(db: DexieCloudDB) {\n return db.cloud.options?.databaseUrl && db.cloud.schema\n ? await sync(db, db.cloud.options, db.cloud.schema, {justCheckIfNeeded: true})\n : false;\n}\n","export const SECONDS = 1000;\nexport const MINUTES = 60 * SECONDS;\nexport const HOURS = 60 * MINUTES;\nexport const DAYS = 24 * HOURS;\nexport const WEEKS = 7 * DAYS;\n","import { randomString } from \"../helpers/randomString\";\n\nexport const myId = randomString(16);\n","import { liveQuery, Table } from 'dexie';\nimport { MINUTES, SECONDS } from '../helpers/date-constants';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { GuardedJob } from '../db/entities/GuardedJob';\nimport { myId } from './myId';\nimport { from } from 'rxjs';\nimport { filter, timeout } from 'rxjs/operators';\n\nconst GUARDED_JOB_HEARTBEAT = 1 * SECONDS;\nconst GUARDED_JOB_TIMEOUT = 1 * MINUTES;\n\nexport async function performGuardedJob(\n db: DexieCloudDB,\n jobName: string,\n jobsTableName: string,\n job: () => Promise<any>,\n { awaitRemoteJob }: { awaitRemoteJob?: boolean } = {}\n): Promise<void> {\n // Start working.\n //\n // Check if someone else is working on this already.\n //\n const jobsTable = db.table(jobsTableName) as Table<GuardedJob, string>;\n\n async function aquireLock() {\n const gotTheLock = await db.transaction('rw!', jobsTableName, async () => {\n const currentWork = await jobsTable.get(jobName);\n if (!currentWork) {\n // No one else is working. Let's record that we are.\n await jobsTable.add(\n {\n nodeId: myId,\n started: new Date(),\n heartbeat: new Date()\n },\n jobName\n );\n return true;\n } else if (\n currentWork.heartbeat.getTime() <\n Date.now() - GUARDED_JOB_TIMEOUT\n ) {\n console.warn(\n `Latest ${jobName} worker seem to have died.\\n`,\n `The dead job started:`,\n currentWork.started,\n `\\n`,\n `Last heart beat was:`,\n currentWork.heartbeat,\n '\\n',\n `We're now taking over!`\n );\n // Now, take over!\n await jobsTable.put(\n {\n nodeId: myId,\n started: new Date(),\n heartbeat: new Date()\n },\n jobName\n );\n return true;\n }\n return false;\n });\n\n if (gotTheLock) return true;\n\n // Someone else took the job.\n if (awaitRemoteJob) {\n try {\n const jobDoneObservable = from(\n liveQuery(() => jobsTable.get(jobName))\n ).pipe(\n timeout(GUARDED_JOB_TIMEOUT),\n filter((job) => !job)\n ); // Wait til job is not there anymore.\n await jobDoneObservable.toPromise();\n return false;\n } catch (err) {\n if (err.name !== 'TimeoutError') {\n throw err;\n }\n // Timeout stopped us! Try aquire the lock now.\n // It will likely succeed this time unless\n // another client took it.\n return await aquireLock();\n }\n }\n return false;\n }\n\n if (await aquireLock()) {\n // We own the lock entry and can do our job undisturbed.\n // We're not within a transaction, but these type of locks\n // spans over transactions.\n\n // Start our heart beat during the job.\n // Use setInterval to make sure we are updating heartbeat even during long-lived fetch calls.\n const heartbeat = setInterval(() => {\n jobsTable.update(\n jobName,\n (job) => {\n if (job.nodeId === myId) {\n job.heartbeat = new Date();\n }\n }\n );\n }, GUARDED_JOB_HEARTBEAT);\n\n try {\n return await job();\n } finally {\n // Stop heartbeat\n clearInterval(heartbeat);\n // Remove the persisted job state:\n await db.transaction('rw!', jobsTableName, async () => {\n const currentWork = await jobsTable.get(jobName);\n if (currentWork && currentWork.nodeId === myId) {\n await jobsTable.delete(jobName);\n }\n });\n }\n }\n}\n","import { IS_SERVICE_WORKER } from '../helpers/IS_SERVICE_WORKER';\nimport { performGuardedJob } from './performGuardedJob';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { sync, CURRENT_SYNC_WORKER, SyncOptions } from './sync';\nimport { DexieCloudOptions } from '../DexieCloudOptions';\nimport { assert, DexieCloudSchema } from 'dexie-cloud-common';\n\nconst ongoingSyncs = new WeakMap<\n DexieCloudDB,\n { promise: Promise<void>; pull: boolean }\n>();\n\nexport function syncIfPossible(\n db: DexieCloudDB,\n cloudOptions: DexieCloudOptions,\n cloudSchema: DexieCloudSchema,\n options?: SyncOptions\n) {\n const ongoing = ongoingSyncs.get(db);\n if (ongoing) {\n if (ongoing.pull || options?.purpose === 'push') {\n console.debug('syncIfPossible(): returning the ongoing sync promise.');\n return ongoing.promise;\n } else {\n // Ongoing sync may never do anything in case there are no outstanding changes\n // to sync (because its purpose was \"push\" not \"pull\")\n // Now, however, we are asked to do a sync with the purpose of \"pull\"\n // We want to optimize here. We must wait for the ongoing to complete\n // and then, if the ongoing sync never resulted in a sync request,\n // we must redo the sync.\n\n // To inspect what is happening in the ongoing request, let's subscribe\n // to db.cloud.syncState and look for if it is doing any \"pulling\" phase:\n let hasPullTakenPlace = false;\n const subscription = db.cloud.syncState.subscribe((syncState) => {\n if (syncState.phase === 'pulling') {\n hasPullTakenPlace = true;\n }\n });\n // Ok, so now we are watching. At the same time, wait for the ongoing to complete\n // and when it has completed, check if we're all set or if we need to redo\n // the call:\n return (\n ongoing.promise\n // This is a finally block but we are still running tests on\n // browsers that don't support it, so need to do it like this:\n .then(() => {\n subscription.unsubscribe();\n })\n .catch((error) => {\n subscription.unsubscribe();\n return Promise.reject(error);\n })\n .then(() => {\n if (!hasPullTakenPlace) {\n // No pull took place in the ongoing sync but the caller had \"pull\" as\n // an explicit purpose of this call - so we need to redo the call!\n return syncIfPossible(db, cloudOptions, cloudSchema, options);\n }\n })\n );\n }\n }\n const promise = _syncIfPossible();\n ongoingSyncs.set(db, { promise, pull: options?.purpose !== 'push' });\n return promise;\n\n async function _syncIfPossible() {\n try {\n if (db.cloud.isServiceWorkerDB) {\n // We are the dedicated sync SW:\n await sync(db, cloudOptions, cloudSchema, options);\n } else if (!db.cloud.usingServiceWorker) {\n // We use a flow that is better suited for the case when multiple workers want to\n // do the same thing.\n await performGuardedJob(db, CURRENT_SYNC_WORKER, '$jobs', () =>\n sync(db, cloudOptions, cloudSchema, options)\n );\n } else {\n assert(false);\n throw new Error('Internal _syncIfPossible() - invalid precondition - should not have been called.');\n }\n ongoingSyncs.delete(db);\n console.debug('Done sync');\n } catch (error) {\n ongoingSyncs.delete(db);\n console.error(`Failed to sync client changes`, error);\n throw error; // Make sure we rethrow error so that sync event is retried.\n // I don't think we should setTimout or so here.\n // Unless server tells us to in some response.\n // Then we could follow that advice but not by waiting here but by registering\n // Something that triggers an event listened to in startPushWorker()\n }\n }\n}\n","import Dexie from 'dexie';\nimport { Subscription } from 'rxjs';\nimport { syncIfPossible } from './syncIfPossible';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { MINUTES } from '../helpers/date-constants';\nimport { DexieCloudOptions } from '../DexieCloudOptions';\nimport { DexieCloudSchema } from 'dexie-cloud-common';\n\nexport function LocalSyncWorker(\n db: DexieCloudDB,\n cloudOptions: DexieCloudOptions,\n cloudSchema: DexieCloudSchema\n) {\n let localSyncEventSubscription: Subscription | null = null;\n //let syncHandler: ((event: Event) => void) | null = null;\n //let periodicSyncHandler: ((event: Event) => void) | null = null;\n let cancelToken = { cancelled: false };\n\n function syncAndRetry(purpose: 'pull' | 'push', retryNum = 1) {\n // Use setTimeout() to get onto a clean stack and\n // break free from possible active transaction:\n setTimeout(() => {\n syncIfPossible(db, cloudOptions, cloudSchema, {\n cancelToken,\n retryImmediatelyOnFetchError: true, // workaround for \"net::ERR_NETWORK_CHANGED\" in chrome.\n purpose,\n }).catch((e) => {\n console.error('error in syncIfPossible()', e);\n if (cancelToken.cancelled) {\n stop();\n } else if (retryNum < 3) {\n // Mimic service worker sync event: retry 3 times\n // * first retry after 5 minutes\n // * second retry 15 minutes later\n setTimeout(\n () => syncAndRetry(purpose, retryNum + 1),\n [0, 5, 15][retryNum] * MINUTES\n );\n }\n });\n }, 0);\n }\n\n const start = () => {\n // Sync eagerly whenever a change has happened (+ initially when there's no syncState yet)\n // This initial subscribe will also trigger an sync also now.\n console.debug('Starting LocalSyncWorker', db.localSyncEvent['id']);\n localSyncEventSubscription = db.localSyncEvent.subscribe(({ purpose }) => {\n try {\n syncAndRetry(purpose || 'pull');\n } catch (err) {\n console.error('What-the....', err);\n }\n });\n //setTimeout(()=>db.localSyncEvent.next({}), 5000);\n };\n\n const stop = () => {\n console.debug('Stopping LocalSyncWorker');\n cancelToken.cancelled = true;\n if (localSyncEventSubscription) localSyncEventSubscription.unsubscribe();\n };\n\n return {\n start,\n stop,\n };\n}\n","import { DexieCloudSchema } from \"dexie-cloud-common\";\nimport { DexieCloudOptions } from \"./DexieCloudOptions\";\n\nexport function updateSchemaFromOptions(schema?: DexieCloudSchema | null, options?: DexieCloudOptions | null) {\n if (schema && options) {\n if (options.unsyncedTables) {\n for (const tableName of options.unsyncedTables) {\n if (schema[tableName]) {\n schema[tableName].markedForSync = false;\n }\n }\n }\n }\n}","import Dexie from \"dexie\";\nimport { DexieCloudDB } from \"./db/DexieCloudDB\";\n\nexport function verifySchema(db: DexieCloudDB) {\n for (const table of db.tables) {\n if (db.cloud.schema?.[table.name]?.markedForSync) {\n if (table.schema.primKey.auto) {\n throw new Dexie.SchemaError(\n `Table ${table.name} is both autoIncremented and synced. ` +\n `Use db.cloud.configure({unsyncedTables: [${JSON.stringify(\n table.name\n )}]}) to blacklist it from sync`\n );\n }\n if (!table.schema.primKey.keyPath) {\n throw new Dexie.SchemaError(\n `Table ${table.name} cannot be both synced and outbound. ` +\n `Use db.cloud.configure({unsyncedTables: [${JSON.stringify(\n table.name\n )}]}) to blacklist it from sync`\n );\n }\n }\n }\n}\n","import { EMPTY_ARR } from \"./constants\";\n\n/**\n * Assign properties from `props` to `obj`\n * @template O, P The obj and props types\n * @param {O} obj The object to copy properties to\n * @param {P} props The object to copy properties from\n * @returns {O & P}\n */\nexport function assign(obj, props) {\n\t// @ts-ignore We change the type of `obj` to be `O & P`\n\tfor (let i in props) obj[i] = props[i];\n\treturn /** @type {O & P} */ (obj);\n}\n\n/**\n * Remove a child node from its parent if attached. This is a workaround for\n * IE11 which doesn't support `Element.prototype.remove()`. Using this function\n * is smaller than including a dedicated polyfill.\n * @param {Node} node The node to remove\n */\nexport function removeNode(node) {\n\tlet parentNode = node.parentNode;\n\tif (parentNode) parentNode.removeChild(node);\n}\n\nexport const slice = EMPTY_ARR.slice;\n","import { _catchError } from './diff/catch-error';\n\n/**\n * The `option` object can potentially contain callback functions\n * that are called during various stages of our renderer. This is the\n * foundation on which all our addons like `preact/debug`, `preact/compat`,\n * and `preact/hooks` are based on. See the `Options` type in `internal.d.ts`\n * for a full list of available option hooks (most editors/IDEs allow you to\n * ctrl+click or cmd+click on mac the type definition below).\n * @type {import('./internal').Options}\n */\nconst options = {\n\t_catchError\n};\n\nexport default options;\n","import { slice } from './util';\nimport options from './options';\n\nlet vnodeId = 0;\n\n/**\n * Create an virtual node (used for JSX)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component\n * constructor for this virtual node\n * @param {object | null | undefined} [props] The properties of the virtual node\n * @param {Array<import('.').ComponentChildren>} [children] The children of the virtual node\n * @returns {import('./internal').VNode}\n */\nexport function createElement(type, props, children) {\n\tlet normalizedProps = {},\n\t\tkey,\n\t\tref,\n\t\ti;\n\tfor (i in props) {\n\t\tif (i == 'key') key = props[i];\n\t\telse if (i == 'ref') ref = props[i];\n\t\telse normalizedProps[i] = props[i];\n\t}\n\n\tif (arguments.length > 2) {\n\t\tnormalizedProps.children =\n\t\t\targuments.length > 3 ? slice.call(arguments, 2) : children;\n\t}\n\n\t// If a Component VNode, check for and apply defaultProps\n\t// Note: type may be undefined in development, must never error here.\n\tif (typeof type == 'function' && type.defaultProps != null) {\n\t\tfor (i in type.defaultProps) {\n\t\t\tif (normalizedProps[i] === undefined) {\n\t\t\t\tnormalizedProps[i] = type.defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn createVNode(type, normalizedProps, key, ref, null);\n}\n\n/**\n * Create a VNode (used internally by Preact)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component\n * Constructor for this virtual node\n * @param {object | string | number | null} props The properties of this virtual node.\n * If this virtual node represents a text node, this is the text of the node (string or number).\n * @param {string | number | null} key The key for this virtual node, used when\n * diffing it against its children\n * @param {import('./internal').VNode[\"ref\"]} ref The ref property that will\n * receive a reference to its created child\n * @returns {import('./internal').VNode}\n */\nexport function createVNode(type, props, key, ref, original) {\n\t// V8 seems to be better at detecting type shapes if the object is allocated from the same call site\n\t// Do not inline into createElement and coerceToVNode!\n\tconst vnode = {\n\t\ttype,\n\t\tprops,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t// _nextDom must be initialized to undefined b/c it will eventually\n\t\t// be set to dom.nextSibling which can return `null` and it is important\n\t\t// to be able to distinguish between an uninitialized _nextDom and\n\t\t// a _nextDom that has been set to `null`\n\t\t_nextDom: undefined,\n\t\t_component: null,\n\t\t_hydrating: null,\n\t\tconstructor: undefined,\n\t\t_original: original == null ? ++vnodeId : original\n\t};\n\n\t// Only invoke the vnode hook if this was *not* a direct copy:\n\tif (original == null && options.vnode != null) options.vnode(vnode);\n\n\treturn vnode;\n}\n\nexport function createRef() {\n\treturn { current: null };\n}\n\nexport function Fragment(props) {\n\treturn props.children;\n}\n\n/**\n * Check if a the argument is a valid Preact VNode.\n * @param {*} vnode\n * @returns {vnode is import('./internal').VNode}\n */\nexport const isValidElement = vnode =>\n\tvnode != null && vnode.constructor === undefined;\n","import { assign } from './util';\nimport { diff, commitRoot } from './diff/index';\nimport options from './options';\nimport { Fragment } from './create-element';\n\n/**\n * Base Component class. Provides `setState()` and `forceUpdate()`, which\n * trigger rendering\n * @param {object} props The initial component props\n * @param {object} context The initial context from parent components'\n * getChildContext\n */\nexport function Component(props, context) {\n\tthis.props = props;\n\tthis.context = context;\n}\n\n/**\n * Update component state and schedule a re-render.\n * @this {import('./internal').Component}\n * @param {object | ((s: object, p: object) => object)} update A hash of state\n * properties to update with new values or a function that given the current\n * state and props returns a new partial state\n * @param {() => void} [callback] A function to be called once component state is\n * updated\n */\nComponent.prototype.setState = function(update, callback) {\n\t// only clone state when copying to nextState the first time.\n\tlet s;\n\tif (this._nextState != null && this._nextState !== this.state) {\n\t\ts = this._nextState;\n\t} else {\n\t\ts = this._nextState = assign({}, this.state);\n\t}\n\n\tif (typeof update == 'function') {\n\t\t// Some libraries like `immer` mark the current state as readonly,\n\t\t// preventing us from mutating it, so we need to clone it. See #2716\n\t\tupdate = update(assign({}, s), this.props);\n\t}\n\n\tif (update) {\n\t\tassign(s, update);\n\t}\n\n\t// Skip update if updater function returned null\n\tif (update == null) return;\n\n\tif (this._vnode) {\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Immediately perform a synchronous re-render of the component\n * @this {import('./internal').Component}\n * @param {() => void} [callback] A function to be called after component is\n * re-rendered\n */\nComponent.prototype.forceUpdate = function(callback) {\n\tif (this._vnode) {\n\t\t// Set render mode so that we can differentiate where the render request\n\t\t// is coming from. We need this because forceUpdate should never call\n\t\t// shouldComponentUpdate\n\t\tthis._force = true;\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Accepts `props` and `state`, and returns a new Virtual DOM tree to build.\n * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx).\n * @param {object} props Props (eg: JSX attributes) received from parent\n * element/component\n * @param {object} state The component's current state\n * @param {object} context Context object, as returned by the nearest\n * ancestor's `getChildContext()`\n * @returns {import('./index').ComponentChildren | void}\n */\nComponent.prototype.render = Fragment;\n\n/**\n * @param {import('./internal').VNode} vnode\n * @param {number | null} [childIndex]\n */\nexport function getDomSibling(vnode, childIndex) {\n\tif (childIndex == null) {\n\t\t// Use childIndex==null as a signal to resume the search from the vnode's sibling\n\t\treturn vnode._parent\n\t\t\t? getDomSibling(vnode._parent, vnode._parent._children.indexOf(vnode) + 1)\n\t\t\t: null;\n\t}\n\n\tlet sibling;\n\tfor (; childIndex < vnode._children.length; childIndex++) {\n\t\tsibling = vnode._children[childIndex];\n\n\t\tif (sibling != null && sibling._dom != null) {\n\t\t\t// Since updateParentDomPointers keeps _dom pointer correct,\n\t\t\t// we can rely on _dom to tell us if this subtree contains a\n\t\t\t// rendered DOM node, and what the first rendered DOM node is\n\t\t\treturn sibling._dom;\n\t\t}\n\t}\n\n\t// If we get here, we have not found a DOM node in this vnode's children.\n\t// We must resume from this vnode's sibling (in it's parent _children array)\n\t// Only climb up and search the parent if we aren't searching through a DOM\n\t// VNode (meaning we reached the DOM parent of the original vnode that began\n\t// the search)\n\treturn typeof vnode.type == 'function' ? getDomSibling(vnode) : null;\n}\n\n/**\n * Trigger in-place re-rendering of a component.\n * @param {import('./internal').Component} component The component to rerender\n */\nfunction renderComponent(component) {\n\tlet vnode = component._vnode,\n\t\toldDom = vnode._dom,\n\t\tparentDom = component._parentDom;\n\n\tif (parentDom) {\n\t\tlet commitQueue = [];\n\t\tconst oldVNode = assign({}, vnode);\n\t\toldVNode._original = vnode._original + 1;\n\n\t\tdiff(\n\t\t\tparentDom,\n\t\t\tvnode,\n\t\t\toldVNode,\n\t\t\tcomponent._globalContext,\n\t\t\tparentDom.ownerSVGElement !== undefined,\n\t\t\tvnode._hydrating != null ? [oldDom] : null,\n\t\t\tcommitQueue,\n\t\t\toldDom == null ? getDomSibling(vnode) : oldDom,\n\t\t\tvnode._hydrating\n\t\t);\n\t\tcommitRoot(commitQueue, vnode);\n\n\t\tif (vnode._dom != oldDom) {\n\t\t\tupdateParentDomPointers(vnode);\n\t\t}\n\t}\n}\n\n/**\n * @param {import('./internal').VNode} vnode\n */\nfunction updateParentDomPointers(vnode) {\n\tif ((vnode = vnode._parent) != null && vnode._component != null) {\n\t\tvnode._dom = vnode._component.base = null;\n\t\tfor (let i = 0; i < vnode._children.length; i++) {\n\t\t\tlet child = vnode._children[i];\n\t\t\tif (child != null && child._dom != null) {\n\t\t\t\tvnode._dom = vnode._component.base = child._dom;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn updateParentDomPointers(vnode);\n\t}\n}\n\n/**\n * The render queue\n * @type {Array<import('./internal').Component>}\n */\nlet rerenderQueue = [];\n\n/*\n * The value of `Component.debounce` must asynchronously invoke the passed in callback. It is\n * important that contributors to Preact can consistently reason about what calls to `setState`, etc.\n * do, and when their effects will be applied. See the links below for some further reading on designing\n * asynchronous APIs.\n * * [Designing APIs for Asynchrony](https://blog.izs.me/2013/08/designing-apis-for-asynchrony)\n * * [Callbacks synchronous and asynchronous](https://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/)\n */\n\nlet prevDebounce;\n\n/**\n * Enqueue a rerender of a component\n * @param {import('./internal').Component} c The component to rerender\n */\nexport function enqueueRender(c) {\n\tif (\n\t\t(!c._dirty &&\n\t\t\t(c._dirty = true) &&\n\t\t\trerenderQueue.push(c) &&\n\t\t\t!process._rerenderCount++) ||\n\t\tprevDebounce !== options.debounceRendering\n\t) {\n\t\tprevDebounce = options.debounceRendering;\n\t\t(prevDebounce || setTimeout)(process);\n\t}\n}\n\n/** Flush the render queue by rerendering all queued components */\nfunction process() {\n\tlet queue;\n\twhile ((process._rerenderCount = rerenderQueue.length)) {\n\t\tqueue = rerenderQueue.sort((a, b) => a._vnode._depth - b._vnode._depth);\n\t\trerenderQueue = [];\n\t\t// Don't update `renderCount` yet. Keep its value non-zero to prevent unnecessary\n\t\t// process() calls from getting scheduled while `queue` is still being consumed.\n\t\tqueue.some(c => {\n\t\t\tif (c._dirty) renderComponent(c);\n\t\t});\n\t}\n}\nprocess._rerenderCount = 0;\n","import { enqueueRender } from './component';\n\nexport let i = 0;\n\nexport function createContext(defaultValue, contextId) {\n\tcontextId = '__cC' + i++;\n\n\tconst context = {\n\t\t_id: contextId,\n\t\t_defaultValue: defaultValue,\n\t\t/** @type {import('./internal').FunctionComponent} */\n\t\tConsumer(props, contextValue) {\n\t\t\t// return props.children(\n\t\t\t// \tcontext[contextId] ? context[contextId].props.value : defaultValue\n\t\t\t// );\n\t\t\treturn props.children(contextValue);\n\t\t},\n\t\t/** @type {import('./internal').FunctionComponent} */\n\t\tProvider(props) {\n\t\t\tif (!this.getChildContext) {\n\t\t\t\tlet subs = [];\n\t\t\t\tlet ctx = {};\n\t\t\t\tctx[contextId] = this;\n\n\t\t\t\tthis.getChildContext = () => ctx;\n\n\t\t\t\tthis.shouldComponentUpdate = function(_props) {\n\t\t\t\t\tif (this.props.value !== _props.value) {\n\t\t\t\t\t\t// I think the forced value propagation here was only needed when `options.debounceRendering` was being bypassed:\n\t\t\t\t\t\t// https://github.com/preactjs/preact/commit/4d339fb803bea09e9f198abf38ca1bf8ea4b7771#diff-54682ce380935a717e41b8bfc54737f6R358\n\t\t\t\t\t\t// In those cases though, even with the value corrected, we're double-rendering all nodes.\n\t\t\t\t\t\t// It might be better to just tell folks not to use force-sync mode.\n\t\t\t\t\t\t// Currently, using `useContext()` in a class component will overwrite its `this.context` value.\n\t\t\t\t\t\t// subs.some(c => {\n\t\t\t\t\t\t// \tc.context = _props.value;\n\t\t\t\t\t\t// \tenqueueRender(c);\n\t\t\t\t\t\t// });\n\n\t\t\t\t\t\t// subs.some(c => {\n\t\t\t\t\t\t// \tc.context[contextId] = _props.value;\n\t\t\t\t\t\t// \tenqueueRender(c);\n\t\t\t\t\t\t// });\n\t\t\t\t\t\tsubs.some(enqueueRender);\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tthis.sub = c => {\n\t\t\t\t\tsubs.push(c);\n\t\t\t\t\tlet old = c.componentWillUnmount;\n\t\t\t\t\tc.componentWillUnmount = () => {\n\t\t\t\t\t\tsubs.splice(subs.indexOf(c), 1);\n\t\t\t\t\t\tif (old) old.call(c);\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn props.children;\n\t\t}\n\t};\n\n\t// Devtools needs access to the context object when it\n\t// encounters a Provider. This is necessary to support\n\t// setting `displayName` on the context object instead\n\t// of on the component itself. See:\n\t// https://reactjs.org/docs/context.html#contextdisplayname\n\n\treturn (context.Provider._contextRef = context.Consumer.contextType = context);\n}\n","export const EMPTY_OBJ = {};\nexport const EMPTY_ARR = [];\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n","import { diff, unmount, applyRef } from './index';\nimport { createVNode, Fragment } from '../create-element';\nimport { EMPTY_OBJ, EMPTY_ARR } from '../constants';\nimport { getDomSibling } from '../component';\n\n/**\n * Diff the children of a virtual node\n * @param {import('../internal').PreactElement} parentDom The DOM element whose\n * children are being diffed\n * @param {import('../internal').ComponentChildren[]} renderResult\n * @param {import('../internal').VNode} newParentVNode The new virtual\n * node whose children should be diff'ed against oldParentVNode\n * @param {import('../internal').VNode} oldParentVNode The old virtual\n * node whose children should be diff'ed against newParentVNode\n * @param {object} globalContext The current context object - modified by getChildContext\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node\n * @param {Array<import('../internal').PreactElement>} excessDomChildren\n * @param {Array<import('../internal').Component>} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').PreactElement} oldDom The current attached DOM\n * element any new dom elements should be placed around. Likely `null` on first\n * render (except when hydrating). Can be a sibling DOM element when diffing\n * Fragments that have siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} isHydrating Whether or not we are in hydration\n */\nexport function diffChildren(\n\tparentDom,\n\trenderResult,\n\tnewParentVNode,\n\toldParentVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating\n) {\n\tlet i, j, oldVNode, childVNode, newDom, firstChildDom, refs;\n\n\t// This is a compression of oldParentVNode!=null && oldParentVNode != EMPTY_OBJ && oldParentVNode._children || EMPTY_ARR\n\t// as EMPTY_OBJ._children should be `undefined`.\n\tlet oldChildren = (oldParentVNode && oldParentVNode._children) || EMPTY_ARR;\n\n\tlet oldChildrenLength = oldChildren.length;\n\n\tnewParentVNode._children = [];\n\tfor (i = 0; i < renderResult.length; i++) {\n\t\tchildVNode = renderResult[i];\n\n\t\tif (childVNode == null || typeof childVNode == 'boolean') {\n\t\t\tchildVNode = newParentVNode._children[i] = null;\n\t\t}\n\t\t// If this newVNode is being reused (e.g. <div>{reuse}{reuse}</div>) in the same diff,\n\t\t// or we are rendering a component (e.g. setState) copy the oldVNodes so it can have\n\t\t// it's own DOM & etc. pointers\n\t\telse if (\n\t\t\ttypeof childVNode == 'string' ||\n\t\t\ttypeof childVNode == 'number' ||\n\t\t\t// eslint-disable-next-line valid-typeof\n\t\t\ttypeof childVNode == 'bigint'\n\t\t) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tnull,\n\t\t\t\tchildVNode,\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tchildVNode\n\t\t\t);\n\t\t} else if (Array.isArray(childVNode)) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tFragment,\n\t\t\t\t{ children: childVNode },\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tnull\n\t\t\t);\n\t\t} else if (childVNode._depth > 0) {\n\t\t\t// VNode is already in use, clone it. This can happen in the following\n\t\t\t// scenario:\n\t\t\t// const reuse = <div />\n\t\t\t// <div>{reuse}<span />{reuse}</div>\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tchildVNode.type,\n\t\t\t\tchildVNode.props,\n\t\t\t\tchildVNode.key,\n\t\t\t\tnull,\n\t\t\t\tchildVNode._original\n\t\t\t);\n\t\t} else {\n\t\t\tchildVNode = newParentVNode._children[i] = childVNode;\n\t\t}\n\n\t\t// Terser removes the `continue` here and wraps the loop body\n\t\t// in a `if (childVNode) { ... } condition\n\t\tif (childVNode == null) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tchildVNode._parent = newParentVNode;\n\t\tchildVNode._depth = newParentVNode._depth + 1;\n\n\t\t// Check if we find a corresponding element in oldChildren.\n\t\t// If found, delete the array item by setting to `undefined`.\n\t\t// We use `undefined`, as `null` is reserved for empty placeholders\n\t\t// (holes).\n\t\toldVNode = oldChildren[i];\n\n\t\tif (\n\t\t\toldVNode === null ||\n\t\t\t(oldVNode &&\n\t\t\t\tchildVNode.key == oldVNode.key &&\n\t\t\t\tchildVNode.type === oldVNode.type)\n\t\t) {\n\t\t\toldChildren[i] = undefined;\n\t\t} else {\n\t\t\t// Either oldVNode === undefined or oldChildrenLength > 0,\n\t\t\t// so after this loop oldVNode == null or oldVNode is a valid value.\n\t\t\tfor (j = 0; j < oldChildrenLength; j++) {\n\t\t\t\toldVNode = oldChildren[j];\n\t\t\t\t// If childVNode is unkeyed, we only match similarly unkeyed nodes, otherwise we match by key.\n\t\t\t\t// We always match by type (in either case).\n\t\t\t\tif (\n\t\t\t\t\toldVNode &&\n\t\t\t\t\tchildVNode.key == oldVNode.key &&\n\t\t\t\t\tchildVNode.type === oldVNode.type\n\t\t\t\t) {\n\t\t\t\t\toldChildren[j] = undefined;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\toldVNode = null;\n\t\t\t}\n\t\t}\n\n\t\toldVNode = oldVNode || EMPTY_OBJ;\n\n\t\t// Morph the old element into the new one, but don't append it to the dom yet\n\t\tdiff(\n\t\t\tparentDom,\n\t\t\tchildVNode,\n\t\t\toldVNode,\n\t\t\tglobalContext,\n\t\t\tisSvg,\n\t\t\texcessDomChildren,\n\t\t\tcommitQueue,\n\t\t\toldDom,\n\t\t\tisHydrating\n\t\t);\n\n\t\tnewDom = childVNode._dom;\n\n\t\tif ((j = childVNode.ref) && oldVNode.ref != j) {\n\t\t\tif (!refs) refs = [];\n\t\t\tif (oldVNode.ref) refs.push(oldVNode.ref, null, childVNode);\n\t\t\trefs.push(j, childVNode._component || newDom, childVNode);\n\t\t}\n\n\t\tif (newDom != null) {\n\t\t\tif (firstChildDom == null) {\n\t\t\t\tfirstChildDom = newDom;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\ttypeof childVNode.type == 'function' &&\n\t\t\t\tchildVNode._children === oldVNode._children\n\t\t\t) {\n\t\t\t\tchildVNode._nextDom = oldDom = reorderChildren(\n\t\t\t\t\tchildVNode,\n\t\t\t\t\toldDom,\n\t\t\t\t\tparentDom\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\toldDom = placeChild(\n\t\t\t\t\tparentDom,\n\t\t\t\t\tchildVNode,\n\t\t\t\t\toldVNode,\n\t\t\t\t\toldChildren,\n\t\t\t\t\tnewDom,\n\t\t\t\t\toldDom\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (typeof newParentVNode.type == 'function') {\n\t\t\t\t// Because the newParentVNode is Fragment-like, we need to set it's\n\t\t\t\t// _nextDom property to the nextSibling of its last child DOM node.\n\t\t\t\t//\n\t\t\t\t// `oldDom` contains the correct value here because if the last child\n\t\t\t\t// is a Fragment-like, then oldDom has already been set to that child's _nextDom.\n\t\t\t\t// If the last child is a DOM VNode, then oldDom will be set to that DOM\n\t\t\t\t// node's nextSibling.\n\t\t\t\tnewParentVNode._nextDom = oldDom;\n\t\t\t}\n\t\t} else if (\n\t\t\toldDom &&\n\t\t\toldVNode._dom == oldDom &&\n\t\t\toldDom.parentNode != parentDom\n\t\t) {\n\t\t\t// The above condition is to handle null placeholders. See test in placeholder.test.js:\n\t\t\t// `efficiently replace null placeholders in parent rerenders`\n\t\t\toldDom = getDomSibling(oldVNode);\n\t\t}\n\t}\n\n\tnewParentVNode._dom = firstChildDom;\n\n\t// Remove remaining oldChildren if there are any.\n\tfor (i = oldChildrenLength; i--; ) {\n\t\tif (oldChildren[i] != null) {\n\t\t\tif (\n\t\t\t\ttypeof newParentVNode.type == 'function' &&\n\t\t\t\toldChildren[i]._dom != null &&\n\t\t\t\toldChildren[i]._dom == newParentVNode._nextDom\n\t\t\t) {\n\t\t\t\t// If the newParentVNode.__nextDom points to a dom node that is about to\n\t\t\t\t// be unmounted, then get the next sibling of that vnode and set\n\t\t\t\t// _nextDom to it\n\t\t\t\tnewParentVNode._nextDom = getDomSibling(oldParentVNode, i + 1);\n\t\t\t}\n\n\t\t\tunmount(oldChildren[i], oldChildren[i]);\n\t\t}\n\t}\n\n\t// Set refs only after unmount\n\tif (refs) {\n\t\tfor (i = 0; i < refs.length; i++) {\n\t\t\tapplyRef(refs[i], refs[++i], refs[++i]);\n\t\t}\n\t}\n}\n\nfunction reorderChildren(childVNode, oldDom, parentDom) {\n\t// Note: VNodes in nested suspended trees may be missing _children.\n\tlet c = childVNode._children;\n\tlet tmp = 0;\n\tfor (; c && tmp < c.length; tmp++) {\n\t\tlet vnode = c[tmp];\n\t\tif (vnode) {\n\t\t\t// We typically enter this code path on sCU bailout, where we copy\n\t\t\t// oldVNode._children to newVNode._children. If that is the case, we need\n\t\t\t// to update the old children's _parent pointer to point to the newVNode\n\t\t\t// (childVNode here).\n\t\t\tvnode._parent = childVNode;\n\n\t\t\tif (typeof vnode.type == 'function') {\n\t\t\t\toldDom = reorderChildren(vnode, oldDom, parentDom);\n\t\t\t} else {\n\t\t\t\toldDom = placeChild(\n\t\t\t\t\tparentDom,\n\t\t\t\t\tvnode,\n\t\t\t\t\tvnode,\n\t\t\t\t\tc,\n\t\t\t\t\tvnode._dom,\n\t\t\t\t\toldDom\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn oldDom;\n}\n\n/**\n * Flatten and loop through the children of a virtual node\n * @param {import('../index').ComponentChildren} children The unflattened\n * children of a virtual node\n * @returns {import('../internal').VNode[]}\n */\nexport function toChildArray(children, out) {\n\tout = out || [];\n\tif (children == null || typeof children == 'boolean') {\n\t} else if (Array.isArray(children)) {\n\t\tchildren.some(child => {\n\t\t\ttoChildArray(child, out);\n\t\t});\n\t} else {\n\t\tout.push(children);\n\t}\n\treturn out;\n}\n\nfunction placeChild(\n\tparentDom,\n\tchildVNode,\n\toldVNode,\n\toldChildren,\n\tnewDom,\n\toldDom\n) {\n\tlet nextDom;\n\tif (childVNode._nextDom !== undefined) {\n\t\t// Only Fragments or components that return Fragment like VNodes will\n\t\t// have a non-undefined _nextDom. Continue the diff from the sibling\n\t\t// of last DOM child of this child VNode\n\t\tnextDom = childVNode._nextDom;\n\n\t\t// Eagerly cleanup _nextDom. We don't need to persist the value because\n\t\t// it is only used by `diffChildren` to determine where to resume the diff after\n\t\t// diffing Components and Fragments. Once we store it the nextDOM local var, we\n\t\t// can clean up the property\n\t\tchildVNode._nextDom = undefined;\n\t} else if (\n\t\toldVNode == null ||\n\t\tnewDom != oldDom ||\n\t\tnewDom.parentNode == null\n\t) {\n\t\touter: if (oldDom == null || oldDom.parentNode !== parentDom) {\n\t\t\tparentDom.appendChild(newDom);\n\t\t\tnextDom = null;\n\t\t} else {\n\t\t\t// `j<oldChildrenLength; j+=2` is an alternative to `j++<oldChildrenLength/2`\n\t\t\tfor (\n\t\t\t\tlet sibDom = oldDom, j = 0;\n\t\t\t\t(sibDom = sibDom.nextSibling) && j < oldChildren.length;\n\t\t\t\tj += 2\n\t\t\t) {\n\t\t\t\tif (sibDom == newDom) {\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t}\n\t\t\tparentDom.insertBefore(newDom, oldDom);\n\t\t\tnextDom = oldDom;\n\t\t}\n\t}\n\n\t// If we have pre-calculated the nextDOM node, use it. Else calculate it now\n\t// Strictly check for `undefined` here cuz `null` is a valid value of `nextDom`.\n\t// See more detail in create-element.js:createVNode\n\tif (nextDom !== undefined) {\n\t\toldDom = nextDom;\n\t} else {\n\t\toldDom = newDom.nextSibling;\n\t}\n\n\treturn oldDom;\n}\n","import { IS_NON_DIMENSIONAL } from '../constants';\nimport options from '../options';\n\n/**\n * Diff the old and new properties of a VNode and apply changes to the DOM node\n * @param {import('../internal').PreactElement} dom The DOM node to apply\n * changes to\n * @param {object} newProps The new props\n * @param {object} oldProps The old props\n * @param {boolean} isSvg Whether or not this node is an SVG node\n * @param {boolean} hydrate Whether or not we are in hydration mode\n */\nexport function diffProps(dom, newProps, oldProps, isSvg, hydrate) {\n\tlet i;\n\n\tfor (i in oldProps) {\n\t\tif (i !== 'children' && i !== 'key' && !(i in newProps)) {\n\t\t\tsetProperty(dom, i, null, oldProps[i], isSvg);\n\t\t}\n\t}\n\n\tfor (i in newProps) {\n\t\tif (\n\t\t\t(!hydrate || typeof newProps[i] == 'function') &&\n\t\t\ti !== 'children' &&\n\t\t\ti !== 'key' &&\n\t\t\ti !== 'value' &&\n\t\t\ti !== 'checked' &&\n\t\t\toldProps[i] !== newProps[i]\n\t\t) {\n\t\t\tsetProperty(dom, i, newProps[i], oldProps[i], isSvg);\n\t\t}\n\t}\n}\n\nfunction setStyle(style, key, value) {\n\tif (key[0] === '-') {\n\t\tstyle.setProperty(key, value);\n\t} else if (value == null) {\n\t\tstyle[key] = '';\n\t} else if (typeof value != 'number' || IS_NON_DIMENSIONAL.test(key)) {\n\t\tstyle[key] = value;\n\t} else {\n\t\tstyle[key] = value + 'px';\n\t}\n}\n\n/**\n * Set a property value on a DOM node\n * @param {import('../internal').PreactElement} dom The DOM node to modify\n * @param {string} name The name of the property to set\n * @param {*} value The value to set the property to\n * @param {*} oldValue The old value the property had\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node or not\n */\nexport function setProperty(dom, name, value, oldValue, isSvg) {\n\tlet useCapture;\n\n\to: if (name === 'style') {\n\t\tif (typeof value == 'string') {\n\t\t\tdom.style.cssText = value;\n\t\t} else {\n\t\t\tif (typeof oldValue == 'string') {\n\t\t\t\tdom.style.cssText = oldValue = '';\n\t\t\t}\n\n\t\t\tif (oldValue) {\n\t\t\t\tfor (name in oldValue) {\n\t\t\t\t\tif (!(value && name in value)) {\n\t\t\t\t\t\tsetStyle(dom.style, name, '');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (value) {\n\t\t\t\tfor (name in value) {\n\t\t\t\t\tif (!oldValue || value[name] !== oldValue[name]) {\n\t\t\t\t\t\tsetStyle(dom.style, name, value[name]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// Benchmark for comparison: https://esbench.com/bench/574c954bdb965b9a00965ac6\n\telse if (name[0] === 'o' && name[1] === 'n') {\n\t\tuseCapture = name !== (name = name.replace(/Capture$/, ''));\n\n\t\t// Infer correct casing for DOM built-in events:\n\t\tif (name.toLowerCase() in dom) name = name.toLowerCase().slice(2);\n\t\telse name = name.slice(2);\n\n\t\tif (!dom._listeners) dom._listeners = {};\n\t\tdom._listeners[name + useCapture] = value;\n\n\t\tif (value) {\n\t\t\tif (!oldValue) {\n\t\t\t\tconst handler = useCapture ? eventProxyCapture : eventProxy;\n\t\t\t\tdom.addEventListener(name, handler, useCapture);\n\t\t\t}\n\t\t} else {\n\t\t\tconst handler = useCapture ? eventProxyCapture : eventProxy;\n\t\t\tdom.removeEventListener(name, handler, useCapture);\n\t\t}\n\t} else if (name !== 'dangerouslySetInnerHTML') {\n\t\tif (isSvg) {\n\t\t\t// Normalize incorrect prop usage for SVG:\n\t\t\t// - xlink:href / xlinkHref --> href (xlink:href was removed from SVG and isn't needed)\n\t\t\t// - className --> class\n\t\t\tname = name.replace(/xlink(H|:h)/, 'h').replace(/sName$/, 's');\n\t\t} else if (\n\t\t\tname !== 'href' &&\n\t\t\tname !== 'list' &&\n\t\t\tname !== 'form' &&\n\t\t\t// Default value in browsers is `-1` and an empty string is\n\t\t\t// cast to `0` instead\n\t\t\tname !== 'tabIndex' &&\n\t\t\tname !== 'download' &&\n\t\t\tname in dom\n\t\t) {\n\t\t\ttry {\n\t\t\t\tdom[name] = value == null ? '' : value;\n\t\t\t\t// labelled break is 1b smaller here than a return statement (sorry)\n\t\t\t\tbreak o;\n\t\t\t} catch (e) {}\n\t\t}\n\n\t\t// ARIA-attributes have a different notion of boolean values.\n\t\t// The value `false` is different from the attribute not\n\t\t// existing on the DOM, so we can't remove it. For non-boolean\n\t\t// ARIA-attributes we could treat false as a removal, but the\n\t\t// amount of exceptions would cost us too many bytes. On top of\n\t\t// that other VDOM frameworks also always stringify `false`.\n\n\t\tif (typeof value === 'function') {\n\t\t\t// never serialize functions as attribute values\n\t\t} else if (\n\t\t\tvalue != null &&\n\t\t\t(value !== false || (name[0] === 'a' && name[1] === 'r'))\n\t\t) {\n\t\t\tdom.setAttribute(name, value);\n\t\t} else {\n\t\t\tdom.removeAttribute(name);\n\t\t}\n\t}\n}\n\n/**\n * Proxy an event to hooked event handlers\n * @param {Event} e The event object from the browser\n * @private\n */\nfunction eventProxy(e) {\n\tthis._listeners[e.type + false](options.event ? options.event(e) : e);\n}\n\nfunction eventProxyCapture(e) {\n\tthis._listeners[e.type + true](options.event ? options.event(e) : e);\n}\n","import { EMPTY_OBJ } from '../constants';\nimport { Component, getDomSibling } from '../component';\nimport { Fragment } from '../create-element';\nimport { diffChildren } from './children';\nimport { diffProps, setProperty } from './props';\nimport { assign, removeNode, slice } from '../util';\nimport options from '../options';\n\n/**\n * Diff two virtual nodes and apply proper changes to the DOM\n * @param {import('../internal').PreactElement} parentDom The parent of the DOM element\n * @param {import('../internal').VNode} newVNode The new virtual node\n * @param {import('../internal').VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object. Modified by getChildContext\n * @param {boolean} isSvg Whether or not this element is an SVG node\n * @param {Array<import('../internal').PreactElement>} excessDomChildren\n * @param {Array<import('../internal').Component>} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').PreactElement} oldDom The current attached DOM\n * element any new dom elements should be placed around. Likely `null` on first\n * render (except when hydrating). Can be a sibling DOM element when diffing\n * Fragments that have siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} [isHydrating] Whether or not we are in hydration\n */\nexport function diff(\n\tparentDom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating\n) {\n\tlet tmp,\n\t\tnewType = newVNode.type;\n\n\t// When passing through createElement it assigns the object\n\t// constructor as undefined. This to prevent JSON-injection.\n\tif (newVNode.constructor !== undefined) return null;\n\n\t// If the previous diff bailed out, resume creating/hydrating.\n\tif (oldVNode._hydrating != null) {\n\t\tisHydrating = oldVNode._hydrating;\n\t\toldDom = newVNode._dom = oldVNode._dom;\n\t\t// if we resume, we want the tree to be \"unlocked\"\n\t\tnewVNode._hydrating = null;\n\t\texcessDomChildren = [oldDom];\n\t}\n\n\tif ((tmp = options._diff)) tmp(newVNode);\n\n\ttry {\n\t\touter: if (typeof newType == 'function') {\n\t\t\tlet c, isNew, oldProps, oldState, snapshot, clearProcessingException;\n\t\t\tlet newProps = newVNode.props;\n\n\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t// the context value as `this.context` just for this component.\n\t\t\ttmp = newType.contextType;\n\t\t\tlet provider = tmp && globalContext[tmp._id];\n\t\t\tlet componentContext = tmp\n\t\t\t\t? provider\n\t\t\t\t\t? provider.props.value\n\t\t\t\t\t: tmp._defaultValue\n\t\t\t\t: globalContext;\n\n\t\t\t// Get component and set it to `c`\n\t\t\tif (oldVNode._component) {\n\t\t\t\tc = newVNode._component = oldVNode._component;\n\t\t\t\tclearProcessingException = c._processingException = c._pendingError;\n\t\t\t} else {\n\t\t\t\t// Instantiate the new component\n\t\t\t\tif ('prototype' in newType && newType.prototype.render) {\n\t\t\t\t\t// @ts-ignore The check above verifies that newType is suppose to be constructed\n\t\t\t\t\tnewVNode._component = c = new newType(newProps, componentContext); // eslint-disable-line new-cap\n\t\t\t\t} else {\n\t\t\t\t\t// @ts-ignore Trust me, Component implements the interface we want\n\t\t\t\t\tnewVNode._component = c = new Component(newProps, componentContext);\n\t\t\t\t\tc.constructor = newType;\n\t\t\t\t\tc.render = doRender;\n\t\t\t\t}\n\t\t\t\tif (provider) provider.sub(c);\n\n\t\t\t\tc.props = newProps;\n\t\t\t\tif (!c.state) c.state = {};\n\t\t\t\tc.context = componentContext;\n\t\t\t\tc._globalContext = globalContext;\n\t\t\t\tisNew = c._dirty = true;\n\t\t\t\tc._renderCallbacks = [];\n\t\t\t}\n\n\t\t\t// Invoke getDerivedStateFromProps\n\t\t\tif (c._nextState == null) {\n\t\t\t\tc._nextState = c.state;\n\t\t\t}\n\t\t\tif (newType.getDerivedStateFromProps != null) {\n\t\t\t\tif (c._nextState == c.state) {\n\t\t\t\t\tc._nextState = assign({}, c._nextState);\n\t\t\t\t}\n\n\t\t\t\tassign(\n\t\t\t\t\tc._nextState,\n\t\t\t\t\tnewType.getDerivedStateFromProps(newProps, c._nextState)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\toldProps = c.props;\n\t\t\toldState = c.state;\n\n\t\t\t// Invoke pre-render lifecycle methods\n\t\t\tif (isNew) {\n\t\t\t\tif (\n\t\t\t\t\tnewType.getDerivedStateFromProps == null &&\n\t\t\t\t\tc.componentWillMount != null\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillMount();\n\t\t\t\t}\n\n\t\t\t\tif (c.componentDidMount != null) {\n\t\t\t\t\tc._renderCallbacks.push(c.componentDidMount);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tnewType.getDerivedStateFromProps == null &&\n\t\t\t\t\tnewProps !== oldProps &&\n\t\t\t\t\tc.componentWillReceiveProps != null\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillReceiveProps(newProps, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t(!c._force &&\n\t\t\t\t\t\tc.shouldComponentUpdate != null &&\n\t\t\t\t\t\tc.shouldComponentUpdate(\n\t\t\t\t\t\t\tnewProps,\n\t\t\t\t\t\t\tc._nextState,\n\t\t\t\t\t\t\tcomponentContext\n\t\t\t\t\t\t) === false) ||\n\t\t\t\t\tnewVNode._original === oldVNode._original\n\t\t\t\t) {\n\t\t\t\t\tc.props = newProps;\n\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t\t// More info about this here: https://gist.github.com/JoviDeCroock/bec5f2ce93544d2e6070ef8e0036e4e8\n\t\t\t\t\tif (newVNode._original !== oldVNode._original) c._dirty = false;\n\t\t\t\t\tc._vnode = newVNode;\n\t\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t\t\tnewVNode._children = oldVNode._children;\n\t\t\t\t\tnewVNode._children.forEach(vnode => {\n\t\t\t\t\t\tif (vnode) vnode._parent = newVNode;\n\t\t\t\t\t});\n\t\t\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\t\t\tcommitQueue.push(c);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\n\t\t\t\tif (c.componentWillUpdate != null) {\n\t\t\t\t\tc.componentWillUpdate(newProps, c._nextState, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (c.componentDidUpdate != null) {\n\t\t\t\t\tc._renderCallbacks.push(() => {\n\t\t\t\t\t\tc.componentDidUpdate(oldProps, oldState, snapshot);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tc.context = componentContext;\n\t\t\tc.props = newProps;\n\t\t\tc._vnode = newVNode;\n\t\t\tc._parentDom = parentDom;\n\n\t\t\tlet renderHook = options._render,\n\t\t\t\tcount = 0;\n\t\t\tif ('prototype' in newType && newType.prototype.render) {\n\t\t\t\tc.state = c._nextState;\n\t\t\t\tc._dirty = false;\n\n\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\t\t\t} else {\n\t\t\t\tdo {\n\t\t\t\t\tc._dirty = false;\n\t\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\t\t// Handle setState called in render, see #2553\n\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t} while (c._dirty && ++count < 25);\n\t\t\t}\n\n\t\t\t// Handle setState called in render, see #2553\n\t\t\tc.state = c._nextState;\n\n\t\t\tif (c.getChildContext != null) {\n\t\t\t\tglobalContext = assign(assign({}, globalContext), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (!isNew && c.getSnapshotBeforeUpdate != null) {\n\t\t\t\tsnapshot = c.getSnapshotBeforeUpdate(oldProps, oldState);\n\t\t\t}\n\n\t\t\tlet isTopLevelFragment =\n\t\t\t\ttmp != null && tmp.type === Fragment && tmp.key == null;\n\t\t\tlet renderResult = isTopLevelFragment ? tmp.props.children : tmp;\n\n\t\t\tdiffChildren(\n\t\t\t\tparentDom,\n\t\t\t\tArray.isArray(renderResult) ? renderResult : [renderResult],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\toldDom,\n\t\t\t\tisHydrating\n\t\t\t);\n\n\t\t\tc.base = newVNode._dom;\n\n\t\t\t// We successfully rendered this VNode, unset any stored hydration/bailout state:\n\t\t\tnewVNode._hydrating = null;\n\n\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\tcommitQueue.push(c);\n\t\t\t}\n\n\t\t\tif (clearProcessingException) {\n\t\t\t\tc._pendingError = c._processingException = null;\n\t\t\t}\n\n\t\t\tc._force = false;\n\t\t} else if (\n\t\t\texcessDomChildren == null &&\n\t\t\tnewVNode._original === oldVNode._original\n\t\t) {\n\t\t\tnewVNode._children = oldVNode._children;\n\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t} else {\n\t\t\tnewVNode._dom = diffElementNodes(\n\t\t\t\toldVNode._dom,\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\tisHydrating\n\t\t\t);\n\t\t}\n\n\t\tif ((tmp = options.diffed)) tmp(newVNode);\n\t} catch (e) {\n\t\tnewVNode._original = null;\n\t\t// if hydrating or creating initial tree, bailout preserves DOM:\n\t\tif (isHydrating || excessDomChildren != null) {\n\t\t\tnewVNode._dom = oldDom;\n\t\t\tnewVNode._hydrating = !!isHydrating;\n\t\t\texcessDomChildren[excessDomChildren.indexOf(oldDom)] = null;\n\t\t\t// ^ could possibly be simplified to:\n\t\t\t// excessDomChildren.length = 0;\n\t\t}\n\t\toptions._catchError(e, newVNode, oldVNode);\n\t}\n}\n\n/**\n * @param {Array<import('../internal').Component>} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').VNode} root\n */\nexport function commitRoot(commitQueue, root) {\n\tif (options._commit) options._commit(root, commitQueue);\n\n\tcommitQueue.some(c => {\n\t\ttry {\n\t\t\t// @ts-ignore Reuse the commitQueue variable here so the type changes\n\t\t\tcommitQueue = c._renderCallbacks;\n\t\t\tc._renderCallbacks = [];\n\t\t\tcommitQueue.some(cb => {\n\t\t\t\t// @ts-ignore See above ts-ignore on commitQueue\n\t\t\t\tcb.call(c);\n\t\t\t});\n\t\t} catch (e) {\n\t\t\toptions._catchError(e, c._vnode);\n\t\t}\n\t});\n}\n\n/**\n * Diff two virtual nodes representing DOM element\n * @param {import('../internal').PreactElement} dom The DOM element representing\n * the virtual nodes being diffed\n * @param {import('../internal').VNode} newVNode The new virtual node\n * @param {import('../internal').VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node\n * @param {*} excessDomChildren\n * @param {Array<import('../internal').Component>} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @returns {import('../internal').PreactElement}\n */\nfunction diffElementNodes(\n\tdom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\tisHydrating\n) {\n\tlet oldProps = oldVNode.props;\n\tlet newProps = newVNode.props;\n\tlet nodeType = newVNode.type;\n\tlet i = 0;\n\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\n\tif (nodeType === 'svg') isSvg = true;\n\n\tif (excessDomChildren != null) {\n\t\tfor (; i < excessDomChildren.length; i++) {\n\t\t\tconst child = excessDomChildren[i];\n\n\t\t\t// if newVNode matches an element in excessDomChildren or the `dom`\n\t\t\t// argument matches an element in excessDomChildren, remove it from\n\t\t\t// excessDomChildren so it isn't later removed in diffChildren\n\t\t\tif (\n\t\t\t\tchild &&\n\t\t\t\t'setAttribute' in child === !!nodeType &&\n\t\t\t\t(nodeType ? child.localName === nodeType : child.nodeType === 3)\n\t\t\t) {\n\t\t\t\tdom = child;\n\t\t\t\texcessDomChildren[i] = null;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (dom == null) {\n\t\tif (nodeType === null) {\n\t\t\t// @ts-ignore createTextNode returns Text, we expect PreactElement\n\t\t\treturn document.createTextNode(newProps);\n\t\t}\n\n\t\tif (isSvg) {\n\t\t\tdom = document.createElementNS(\n\t\t\t\t'http://www.w3.org/2000/svg',\n\t\t\t\t// @ts-ignore We know `newVNode.type` is a string\n\t\t\t\tnodeType\n\t\t\t);\n\t\t} else {\n\t\t\tdom = document.createElement(\n\t\t\t\t// @ts-ignore We know `newVNode.type` is a string\n\t\t\t\tnodeType,\n\t\t\t\tnewProps.is && newProps\n\t\t\t);\n\t\t}\n\n\t\t// we created a new parent, so none of the previously attached children can be reused:\n\t\texcessDomChildren = null;\n\t\t// we are creating a new node, so we can assume this is a new subtree (in case we are hydrating), this deopts the hydrate\n\t\tisHydrating = false;\n\t}\n\n\tif (nodeType === null) {\n\t\t// During hydration, we still have to split merged text from SSR'd HTML.\n\t\tif (oldProps !== newProps && (!isHydrating || dom.data !== newProps)) {\n\t\t\tdom.data = newProps;\n\t\t}\n\t} else {\n\t\t// If excessDomChildren was not null, repopulate it with the current element's children:\n\t\texcessDomChildren = excessDomChildren && slice.call(dom.childNodes);\n\n\t\toldProps = oldVNode.props || EMPTY_OBJ;\n\n\t\tlet oldHtml = oldProps.dangerouslySetInnerHTML;\n\t\tlet newHtml = newProps.dangerouslySetInnerHTML;\n\n\t\t// During hydration, props are not diffed at all (including dangerouslySetInnerHTML)\n\t\t// @TODO we should warn in debug mode when props don't match here.\n\t\tif (!isHydrating) {\n\t\t\t// But, if we are in a situation where we are using existing DOM (e.g. replaceNode)\n\t\t\t// we should read the existing DOM attributes to diff them\n\t\t\tif (excessDomChildren != null) {\n\t\t\t\toldProps = {};\n\t\t\t\tfor (i = 0; i < dom.attributes.length; i++) {\n\t\t\t\t\toldProps[dom.attributes[i].name] = dom.attributes[i].value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (newHtml || oldHtml) {\n\t\t\t\t// Avoid re-applying the same '__html' if it did not changed between re-render\n\t\t\t\tif (\n\t\t\t\t\t!newHtml ||\n\t\t\t\t\t((!oldHtml || newHtml.__html != oldHtml.__html) &&\n\t\t\t\t\t\tnewHtml.__html !== dom.innerHTML)\n\t\t\t\t) {\n\t\t\t\t\tdom.innerHTML = (newHtml && newHtml.__html) || '';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdiffProps(dom, newProps, oldProps, isSvg, isHydrating);\n\n\t\t// If the new vnode didn't have dangerouslySetInnerHTML, diff its children\n\t\tif (newHtml) {\n\t\t\tnewVNode._children = [];\n\t\t} else {\n\t\t\ti = newVNode.props.children;\n\t\t\tdiffChildren(\n\t\t\t\tdom,\n\t\t\t\tArray.isArray(i) ? i : [i],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg && nodeType !== 'foreignObject',\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\texcessDomChildren\n\t\t\t\t\t? excessDomChildren[0]\n\t\t\t\t\t: oldVNode._children && getDomSibling(oldVNode, 0),\n\t\t\t\tisHydrating\n\t\t\t);\n\n\t\t\t// Remove children that are not part of any vnode.\n\t\t\tif (excessDomChildren != null) {\n\t\t\t\tfor (i = excessDomChildren.length; i--; ) {\n\t\t\t\t\tif (excessDomChildren[i] != null) removeNode(excessDomChildren[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// (as above, don't diff props during hydration)\n\t\tif (!isHydrating) {\n\t\t\tif (\n\t\t\t\t'value' in newProps &&\n\t\t\t\t(i = newProps.value) !== undefined &&\n\t\t\t\t// #2756 For the <progress>-element the initial value is 0,\n\t\t\t\t// despite the attribute not being present. When the attribute\n\t\t\t\t// is missing the progress bar is treated as indeterminate.\n\t\t\t\t// To fix that we'll always update it when it is 0 for progress elements\n\t\t\t\t(i !== dom.value ||\n\t\t\t\t\t(nodeType === 'progress' && !i) ||\n\t\t\t\t\t// This is only for IE 11 to fix <select> value not being updated.\n\t\t\t\t\t// To avoid a stale select value we need to set the option.value\n\t\t\t\t\t// again, which triggers IE11 to re-evaluate the select value\n\t\t\t\t\t(nodeType === 'option' && i !== oldProps.value))\n\t\t\t) {\n\t\t\t\tsetProperty(dom, 'value', i, oldProps.value, false);\n\t\t\t}\n\t\t\tif (\n\t\t\t\t'checked' in newProps &&\n\t\t\t\t(i = newProps.checked) !== undefined &&\n\t\t\t\ti !== dom.checked\n\t\t\t) {\n\t\t\t\tsetProperty(dom, 'checked', i, oldProps.checked, false);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn dom;\n}\n\n/**\n * Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {object|function} ref\n * @param {any} value\n * @param {import('../internal').VNode} vnode\n */\nexport function applyRef(ref, value, vnode) {\n\ttry {\n\t\tif (typeof ref == 'function') ref(value);\n\t\telse ref.current = value;\n\t} catch (e) {\n\t\toptions._catchError(e, vnode);\n\t}\n}\n\n/**\n * Unmount a virtual node from the tree and apply DOM changes\n * @param {import('../internal').VNode} vnode The virtual node to unmount\n * @param {import('../internal').VNode} parentVNode The parent of the VNode that\n * initiated the unmount\n * @param {boolean} [skipRemove] Flag that indicates that a parent node of the\n * current element is already detached from the DOM.\n */\nexport function unmount(vnode, parentVNode, skipRemove) {\n\tlet r;\n\tif (options.unmount) options.unmount(vnode);\n\n\tif ((r = vnode.ref)) {\n\t\tif (!r.current || r.current === vnode._dom) applyRef(r, null, parentVNode);\n\t}\n\n\tif ((r = vnode._component) != null) {\n\t\tif (r.componentWillUnmount) {\n\t\t\ttry {\n\t\t\t\tr.componentWillUnmount();\n\t\t\t} catch (e) {\n\t\t\t\toptions._catchError(e, parentVNode);\n\t\t\t}\n\t\t}\n\n\t\tr.base = r._parentDom = null;\n\t}\n\n\tif ((r = vnode._children)) {\n\t\tfor (let i = 0; i < r.length; i++) {\n\t\t\tif (r[i]) {\n\t\t\t\tunmount(r[i], parentVNode, typeof vnode.type != 'function');\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!skipRemove && vnode._dom != null) removeNode(vnode._dom);\n\n\t// Must be set to `undefined` to properly clean up `_nextDom`\n\t// for which `null` is a valid value. See comment in `create-element.js`\n\tvnode._dom = vnode._nextDom = undefined;\n}\n\n/** The `.render()` method for a PFC backing instance. */\nfunction doRender(props, state, context) {\n\treturn this.constructor(props, context);\n}\n","import { EMPTY_OBJ } from './constants';\nimport { commitRoot, diff } from './diff/index';\nimport { createElement, Fragment } from './create-element';\nimport options from './options';\nimport { slice } from './util';\n\n/**\n * Render a Preact virtual node into a DOM element\n * @param {import('./internal').ComponentChild} vnode The virtual node to render\n * @param {import('./internal').PreactElement} parentDom The DOM element to\n * render into\n * @param {import('./internal').PreactElement | object} [replaceNode] Optional: Attempt to re-use an\n * existing DOM tree rooted at `replaceNode`\n */\nexport function render(vnode, parentDom, replaceNode) {\n\tif (options._root) options._root(vnode, parentDom);\n\n\t// We abuse the `replaceNode` parameter in `hydrate()` to signal if we are in\n\t// hydration mode or not by passing the `hydrate` function instead of a DOM\n\t// element..\n\tlet isHydrating = typeof replaceNode === 'function';\n\n\t// To be able to support calling `render()` multiple times on the same\n\t// DOM node, we need to obtain a reference to the previous tree. We do\n\t// this by assigning a new `_children` property to DOM nodes which points\n\t// to the last rendered tree. By default this property is not present, which\n\t// means that we are mounting a new tree for the first time.\n\tlet oldVNode = isHydrating\n\t\t? null\n\t\t: (replaceNode && replaceNode._children) || parentDom._children;\n\n\tvnode = (\n\t\t(!isHydrating && replaceNode) ||\n\t\tparentDom\n\t)._children = createElement(Fragment, null, [vnode]);\n\n\t// List of effects that need to be called after diffing.\n\tlet commitQueue = [];\n\tdiff(\n\t\tparentDom,\n\t\t// Determine the new vnode tree and store it on the DOM element on\n\t\t// our custom `_children` property.\n\t\tvnode,\n\t\toldVNode || EMPTY_OBJ,\n\t\tEMPTY_OBJ,\n\t\tparentDom.ownerSVGElement !== undefined,\n\t\t!isHydrating && replaceNode\n\t\t\t? [replaceNode]\n\t\t\t: oldVNode\n\t\t\t? null\n\t\t\t: parentDom.firstChild\n\t\t\t? slice.call(parentDom.childNodes)\n\t\t\t: null,\n\t\tcommitQueue,\n\t\t!isHydrating && replaceNode\n\t\t\t? replaceNode\n\t\t\t: oldVNode\n\t\t\t? oldVNode._dom\n\t\t\t: parentDom.firstChild,\n\t\tisHydrating\n\t);\n\n\t// Flush all queued effects\n\tcommitRoot(commitQueue, vnode);\n}\n\n/**\n * Update an existing DOM element with data from a Preact virtual node\n * @param {import('./internal').ComponentChild} vnode The virtual node to render\n * @param {import('./internal').PreactElement} parentDom The DOM element to\n * update\n */\nexport function hydrate(vnode, parentDom) {\n\trender(vnode, parentDom, hydrate);\n}\n","/**\n * Find the closest error boundary to a thrown error and call it\n * @param {object} error The thrown value\n * @param {import('../internal').VNode} vnode The vnode that threw\n * the error that was caught (except for unmounting when this parameter\n * is the highest parent that was being unmounted)\n * @param {import('../internal').VNode} [oldVNode]\n * @param {import('../internal').ErrorInfo} [errorInfo]\n */\nexport function _catchError(error, vnode, oldVNode, errorInfo) {\n\t/** @type {import('../internal').Component} */\n\tlet component, ctor, handled;\n\n\tfor (; (vnode = vnode._parent); ) {\n\t\tif ((component = vnode._component) && !component._processingException) {\n\t\t\ttry {\n\t\t\t\tctor = component.constructor;\n\n\t\t\t\tif (ctor && ctor.getDerivedStateFromError != null) {\n\t\t\t\t\tcomponent.setState(ctor.getDerivedStateFromError(error));\n\t\t\t\t\thandled = component._dirty;\n\t\t\t\t}\n\n\t\t\t\tif (component.componentDidCatch != null) {\n\t\t\t\t\tcomponent.componentDidCatch(error, errorInfo || {});\n\t\t\t\t\thandled = component._dirty;\n\t\t\t\t}\n\n\t\t\t\t// This is an error boundary. Mark it as having bailed out, and whether it was mid-hydration.\n\t\t\t\tif (handled) {\n\t\t\t\t\treturn (component._pendingError = component);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\terror = e;\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow error;\n}\n","export const Styles: { [styleAlias: string]: Partial<CSSStyleDeclaration> | any} = {\n Error: {\n color: \"red\",\n },\n Alert: {\n error: {\n color: \"red\"\n },\n warning: {\n color: \"yellow\"\n },\n info: {\n color: \"black\"\n }\n },\n Darken: {\n position: \"fixed\",\n top: 0,\n left: 0,\n opacity: 0.5,\n backgroundColor: \"#000\",\n width: \"100vw\",\n height: \"100vh\",\n zIndex: 150,\n webkitBackdropFilter: \"blur(2px)\",\n backdropFilter: \"blur(2px)\",\n },\n DialogOuter: {\n position: \"fixed\",\n top: 0,\n left: 0,\n width: \"100vw\",\n height: \"100vh\",\n zIndex: 150,\n alignItems: \"center\",\n display: \"flex\",\n justifyContent: \"center\",\n },\n DialogInner: {\n position: \"relative\",\n color: \"#222\",\n backgroundColor: \"#fff\",\n padding: \"30px\",\n marginBottom: \"2em\",\n maxWidth: \"90%\",\n maxHeight: \"90%\",\n overflowY: \"auto\",\n border: \"3px solid #3d3d5d\",\n borderRadius: \"8px\",\n boxShadow: \"0 0 80px 10px #666\",\n width: \"auto\"\n },\n Input: {\n height: \"35px\",\n width: \"17em\",\n borderColor: \"#ccf4\",\n outline: \"none\",\n fontSize: \"17pt\",\n padding: \"8px\"\n \n }\n};\n","import { Styles } from './Styles';\nimport { ComponentChildren, h } from 'preact';\n\nexport function Dialog({ children, className }: { children?: ComponentChildren, className?: string }) {\n return (\n <div className={className}>\n <div style={Styles.Darken} />\n <div style={Styles.DialogOuter}>\n <div style={Styles.DialogInner}>{children}</div>\n </div>\n </div>\n );\n}\n","import { options } from 'preact';\n\n/** @type {number} */\nlet currentIndex;\n\n/** @type {import('./internal').Component} */\nlet currentComponent;\n\n/** @type {import('./internal').Component} */\nlet previousComponent;\n\n/** @type {number} */\nlet currentHook = 0;\n\n/** @type {Array<import('./internal').Component>} */\nlet afterPaintEffects = [];\n\nlet EMPTY = [];\n\nlet oldBeforeDiff = options._diff;\nlet oldBeforeRender = options._render;\nlet oldAfterDiff = options.diffed;\nlet oldCommit = options._commit;\nlet oldBeforeUnmount = options.unmount;\n\nconst RAF_TIMEOUT = 100;\nlet prevRaf;\n\noptions._diff = vnode => {\n\tcurrentComponent = null;\n\tif (oldBeforeDiff) oldBeforeDiff(vnode);\n};\n\noptions._render = vnode => {\n\tif (oldBeforeRender) oldBeforeRender(vnode);\n\n\tcurrentComponent = vnode._component;\n\tcurrentIndex = 0;\n\n\tconst hooks = currentComponent.__hooks;\n\tif (hooks) {\n\t\tif (previousComponent === currentComponent) {\n\t\t\thooks._pendingEffects = [];\n\t\t\tcurrentComponent._renderCallbacks = [];\n\t\t\thooks._list.forEach(hookItem => {\n\t\t\t\tif (hookItem._nextValue) {\n\t\t\t\t\thookItem._value = hookItem._nextValue;\n\t\t\t\t}\n\t\t\t\thookItem._pendingValue = EMPTY;\n\t\t\t\thookItem._nextValue = hookItem._pendingArgs = undefined;\n\t\t\t});\n\t\t} else {\n\t\t\thooks._pendingEffects.forEach(invokeCleanup);\n\t\t\thooks._pendingEffects.forEach(invokeEffect);\n\t\t\thooks._pendingEffects = [];\n\t\t}\n\t}\n\tpreviousComponent = currentComponent;\n};\n\noptions.diffed = vnode => {\n\tif (oldAfterDiff) oldAfterDiff(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks) {\n\t\tif (c.__hooks._pendingEffects.length) afterPaint(afterPaintEffects.push(c));\n\t\tc.__hooks._list.forEach(hookItem => {\n\t\t\tif (hookItem._pendingArgs) {\n\t\t\t\thookItem._args = hookItem._pendingArgs;\n\t\t\t}\n\t\t\tif (hookItem._pendingValue !== EMPTY) {\n\t\t\t\thookItem._value = hookItem._pendingValue;\n\t\t\t}\n\t\t\thookItem._pendingArgs = undefined;\n\t\t\thookItem._pendingValue = EMPTY;\n\t\t});\n\t}\n\tpreviousComponent = currentComponent = null;\n};\n\noptions._commit = (vnode, commitQueue) => {\n\tcommitQueue.some(component => {\n\t\ttry {\n\t\t\tcomponent._renderCallbacks.forEach(invokeCleanup);\n\t\t\tcomponent._renderCallbacks = component._renderCallbacks.filter(cb =>\n\t\t\t\tcb._value ? invokeEffect(cb) : true\n\t\t\t);\n\t\t} catch (e) {\n\t\t\tcommitQueue.some(c => {\n\t\t\t\tif (c._renderCallbacks) c._renderCallbacks = [];\n\t\t\t});\n\t\t\tcommitQueue = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t});\n\n\tif (oldCommit) oldCommit(vnode, commitQueue);\n};\n\noptions.unmount = vnode => {\n\tif (oldBeforeUnmount) oldBeforeUnmount(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks) {\n\t\tlet hasErrored;\n\t\tc.__hooks._list.forEach(s => {\n\t\t\ttry {\n\t\t\t\tinvokeCleanup(s);\n\t\t\t} catch (e) {\n\t\t\t\thasErrored = e;\n\t\t\t}\n\t\t});\n\t\tif (hasErrored) options._catchError(hasErrored, c._vnode);\n\t}\n};\n\n/**\n * Get a hook's state from the currentComponent\n * @param {number} index The index of the hook to get\n * @param {number} type The index of the hook to get\n * @returns {any}\n */\nfunction getHookState(index, type) {\n\tif (options._hook) {\n\t\toptions._hook(currentComponent, index, currentHook || type);\n\t}\n\tcurrentHook = 0;\n\n\t// Largely inspired by:\n\t// * https://github.com/michael-klein/funcy.js/blob/f6be73468e6ec46b0ff5aa3cc4c9baf72a29025a/src/hooks/core_hooks.mjs\n\t// * https://github.com/michael-klein/funcy.js/blob/650beaa58c43c33a74820a3c98b3c7079cf2e333/src/renderer.mjs\n\t// Other implementations to look at:\n\t// * https://codesandbox.io/s/mnox05qp8\n\tconst hooks =\n\t\tcurrentComponent.__hooks ||\n\t\t(currentComponent.__hooks = {\n\t\t\t_list: [],\n\t\t\t_pendingEffects: []\n\t\t});\n\n\tif (index >= hooks._list.length) {\n\t\thooks._list.push({ _pendingValue: EMPTY });\n\t}\n\treturn hooks._list[index];\n}\n\n/**\n * @param {import('./index').StateUpdater<any>} [initialState]\n */\nexport function useState(initialState) {\n\tcurrentHook = 1;\n\treturn useReducer(invokeOrReturn, initialState);\n}\n\n/**\n * @param {import('./index').Reducer<any, any>} reducer\n * @param {import('./index').StateUpdater<any>} initialState\n * @param {(initialState: any) => void} [init]\n * @returns {[ any, (state: any) => void ]}\n */\nexport function useReducer(reducer, initialState, init) {\n\t/** @type {import('./internal').ReducerHookState} */\n\tconst hookState = getHookState(currentIndex++, 2);\n\thookState._reducer = reducer;\n\tif (!hookState._component) {\n\t\thookState._value = [\n\t\t\t!init ? invokeOrReturn(undefined, initialState) : init(initialState),\n\n\t\t\taction => {\n\t\t\t\tconst currentValue = hookState._nextValue\n\t\t\t\t\t? hookState._nextValue[0]\n\t\t\t\t\t: hookState._value[0];\n\t\t\t\tconst nextValue = hookState._reducer(currentValue, action);\n\n\t\t\t\tif (currentValue !== nextValue) {\n\t\t\t\t\thookState._nextValue = [nextValue, hookState._value[1]];\n\t\t\t\t\thookState._component.setState({});\n\t\t\t\t}\n\t\t\t}\n\t\t];\n\n\t\thookState._component = currentComponent;\n\n\t\tif (!currentComponent._hasScuFromHooks) {\n\t\t\tcurrentComponent._hasScuFromHooks = true;\n\t\t\tconst prevScu = currentComponent.shouldComponentUpdate;\n\n\t\t\t// This SCU has the purpose of bailing out after repeated updates\n\t\t\t// to stateful hooks.\n\t\t\t// we store the next value in _nextValue[0] and keep doing that for all\n\t\t\t// state setters, if we have next states and\n\t\t\t// all next states within a component end up being equal to their original state\n\t\t\t// we are safe to bail out for this specific component.\n\t\t\tcurrentComponent.shouldComponentUpdate = function(p, s, c) {\n\t\t\t\tif (!hookState._component.__hooks) return true;\n\n\t\t\t\tconst stateHooks = hookState._component.__hooks._list.filter(\n\t\t\t\t\tx => x._component\n\t\t\t\t);\n\t\t\t\tconst allHooksEmpty = stateHooks.every(x => !x._nextValue);\n\t\t\t\t// When we have no updated hooks in the component we invoke the previous SCU or\n\t\t\t\t// traverse the VDOM tree further.\n\t\t\t\tif (allHooksEmpty) {\n\t\t\t\t\treturn prevScu ? prevScu.call(this, p, s, c) : true;\n\t\t\t\t}\n\n\t\t\t\t// We check whether we have components with a nextValue set that\n\t\t\t\t// have values that aren't equal to one another this pushes\n\t\t\t\t// us to update further down the tree\n\t\t\t\tlet shouldUpdate = false;\n\t\t\t\tstateHooks.forEach(hookItem => {\n\t\t\t\t\tif (hookItem._nextValue) {\n\t\t\t\t\t\tconst currentValue = hookItem._value[0];\n\t\t\t\t\t\thookItem._value = hookItem._nextValue;\n\t\t\t\t\t\thookItem._nextValue = undefined;\n\t\t\t\t\t\tif (currentValue !== hookItem._value[0]) shouldUpdate = true;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\treturn shouldUpdate\n\t\t\t\t\t? prevScu\n\t\t\t\t\t\t? prevScu.call(this, p, s, c)\n\t\t\t\t\t\t: true\n\t\t\t\t\t: false;\n\t\t\t};\n\t\t}\n\t}\n\n\treturn hookState._nextValue || hookState._value;\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {any[]} args\n */\nexport function useEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 3);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._pendingArgs = args;\n\n\t\tcurrentComponent.__hooks._pendingEffects.push(state);\n\t}\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {any[]} args\n */\nexport function useLayoutEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 4);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._pendingArgs = args;\n\n\t\tcurrentComponent._renderCallbacks.push(state);\n\t}\n}\n\nexport function useRef(initialValue) {\n\tcurrentHook = 5;\n\treturn useMemo(() => ({ current: initialValue }), []);\n}\n\n/**\n * @param {object} ref\n * @param {() => object} createHandle\n * @param {any[]} args\n */\nexport function useImperativeHandle(ref, createHandle, args) {\n\tcurrentHook = 6;\n\tuseLayoutEffect(\n\t\t() => {\n\t\t\tif (typeof ref == 'function') {\n\t\t\t\tref(createHandle());\n\t\t\t\treturn () => ref(null);\n\t\t\t} else if (ref) {\n\t\t\t\tref.current = createHandle();\n\t\t\t\treturn () => (ref.current = null);\n\t\t\t}\n\t\t},\n\t\targs == null ? args : args.concat(ref)\n\t);\n}\n\n/**\n * @param {() => any} factory\n * @param {any[]} args\n */\nexport function useMemo(factory, args) {\n\t/** @type {import('./internal').MemoHookState} */\n\tconst state = getHookState(currentIndex++, 7);\n\tif (argsChanged(state._args, args)) {\n\t\tstate._pendingValue = factory();\n\t\tstate._pendingArgs = args;\n\t\tstate._factory = factory;\n\t\treturn state._pendingValue;\n\t}\n\n\treturn state._value;\n}\n\n/**\n * @param {() => void} callback\n * @param {any[]} args\n */\nexport function useCallback(callback, args) {\n\tcurrentHook = 8;\n\treturn useMemo(() => callback, args);\n}\n\n/**\n * @param {import('./internal').PreactContext} context\n */\nexport function useContext(context) {\n\tconst provider = currentComponent.context[context._id];\n\t// We could skip this call here, but than we'd not call\n\t// `options._hook`. We need to do that in order to make\n\t// the devtools aware of this hook.\n\t/** @type {import('./internal').ContextHookState} */\n\tconst state = getHookState(currentIndex++, 9);\n\t// The devtools needs access to the context object to\n\t// be able to pull of the default value when no provider\n\t// is present in the tree.\n\tstate._context = context;\n\tif (!provider) return context._defaultValue;\n\t// This is probably not safe to convert to \"!\"\n\tif (state._value == null) {\n\t\tstate._value = true;\n\t\tprovider.sub(currentComponent);\n\t}\n\treturn provider.props.value;\n}\n\n/**\n * Display a custom label for a custom hook for the devtools panel\n * @type {<T>(value: T, cb?: (value: T) => string | number) => void}\n */\nexport function useDebugValue(value, formatter) {\n\tif (options.useDebugValue) {\n\t\toptions.useDebugValue(formatter ? formatter(value) : value);\n\t}\n}\n\n/**\n * @param {(error: any) => void} cb\n */\nexport function useErrorBoundary(cb) {\n\t/** @type {import('./internal').ErrorBoundaryHookState} */\n\tconst state = getHookState(currentIndex++, 10);\n\tconst errState = useState();\n\tstate._value = cb;\n\tif (!currentComponent.componentDidCatch) {\n\t\tcurrentComponent.componentDidCatch = err => {\n\t\t\tif (state._value) state._value(err);\n\t\t\terrState[1](err);\n\t\t};\n\t}\n\treturn [\n\t\terrState[0],\n\t\t() => {\n\t\t\terrState[1](undefined);\n\t\t}\n\t];\n}\n\n/**\n * After paint effects consumer.\n */\nfunction flushAfterPaintEffects() {\n\tlet component;\n\twhile ((component = afterPaintEffects.shift())) {\n\t\tif (!component._parentDom || !component.__hooks) continue;\n\t\ttry {\n\t\t\tcomponent.__hooks._pendingEffects.forEach(invokeCleanup);\n\t\t\tcomponent.__hooks._pendingEffects.forEach(invokeEffect);\n\t\t\tcomponent.__hooks._pendingEffects = [];\n\t\t} catch (e) {\n\t\t\tcomponent.__hooks._pendingEffects = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t}\n}\n\nlet HAS_RAF = typeof requestAnimationFrame == 'function';\n\n/**\n * Schedule a callback to be invoked after the browser has a chance to paint a new frame.\n * Do this by combining requestAnimationFrame (rAF) + setTimeout to invoke a callback after\n * the next browser frame.\n *\n * Also, schedule a timeout in parallel to the the rAF to ensure the callback is invoked\n * even if RAF doesn't fire (for example if the browser tab is not visible)\n *\n * @param {() => void} callback\n */\nfunction afterNextFrame(callback) {\n\tconst done = () => {\n\t\tclearTimeout(timeout);\n\t\tif (HAS_RAF) cancelAnimationFrame(raf);\n\t\tsetTimeout(callback);\n\t};\n\tconst timeout = setTimeout(done, RAF_TIMEOUT);\n\n\tlet raf;\n\tif (HAS_RAF) {\n\t\traf = requestAnimationFrame(done);\n\t}\n}\n\n// Note: if someone used options.debounceRendering = requestAnimationFrame,\n// then effects will ALWAYS run on the NEXT frame instead of the current one, incurring a ~16ms delay.\n// Perhaps this is not such a big deal.\n/**\n * Schedule afterPaintEffects flush after the browser paints\n * @param {number} newQueueLength\n */\nfunction afterPaint(newQueueLength) {\n\tif (newQueueLength === 1 || prevRaf !== options.requestAnimationFrame) {\n\t\tprevRaf = options.requestAnimationFrame;\n\t\t(prevRaf || afterNextFrame)(flushAfterPaintEffects);\n\t}\n}\n\n/**\n * @param {import('./internal').EffectHookState} hook\n */\nfunction invokeCleanup(hook) {\n\t// A hook cleanup can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\tlet cleanup = hook._cleanup;\n\tif (typeof cleanup == 'function') {\n\t\thook._cleanup = undefined;\n\t\tcleanup();\n\t}\n\n\tcurrentComponent = comp;\n}\n\n/**\n * Invoke a Hook's effect\n * @param {import('./internal').EffectHookState} hook\n */\nfunction invokeEffect(hook) {\n\t// A hook call can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\thook._cleanup = hook._value();\n\tcurrentComponent = comp;\n}\n\n/**\n * @param {any[]} oldArgs\n * @param {any[]} newArgs\n */\nfunction argsChanged(oldArgs, newArgs) {\n\treturn (\n\t\t!oldArgs ||\n\t\toldArgs.length !== newArgs.length ||\n\t\tnewArgs.some((arg, index) => arg !== oldArgs[index])\n\t);\n}\n\nfunction invokeOrReturn(arg, f) {\n\treturn typeof f == 'function' ? f(arg) : f;\n}\n","import { DXCAlert } from \"../types/DXCAlert\";\n\nexport function resolveText({message, messageCode, messageParams}: DXCAlert) {\n return message.replace(/\\{\\w+\\}/ig, n => messageParams[n.substr(1, n.length-2)]);\n}\n","import { Dialog } from './Dialog';\nimport { Styles } from './Styles';\nimport { h, Fragment } from 'preact';\nimport { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks';\nimport {\n DXCGenericUserInteraction,\n DXCUserInteraction,\n} from '../types/DXCUserInteraction';\nimport { resolveText } from '../helpers/resolveText';\nimport { DXCInputField } from '../types/DXCInputField';\n\nexport function LoginDialog({\n title,\n alerts,\n fields,\n onCancel,\n onSubmit,\n}: DXCGenericUserInteraction<string, { [name: string]: DXCInputField }>) {\n const [params, setParams] = useState<{ [param: string]: string }>({});\n\n const firstFieldRef = useRef<HTMLInputElement>(null);\n useLayoutEffect(()=>firstFieldRef.current?.focus(), []);\n\n return (\n <Dialog className=\"dxc-login-dlg\">\n <>\n <h3 style={Styles.WindowHeader}>{title}</h3>\n {alerts.map((alert) => (\n <p style={Styles.Alert[alert.type]}>{resolveText(alert)}</p>\n ))}\n <form onSubmit={ev => {\n ev.preventDefault();\n onSubmit(params);\n }}>\n {Object.entries(fields).map(\n ([fieldName, { type, label, placeholder }], idx) => (\n <label style={Styles.Label}>\n {label ? `${label}: ` : ''}\n <input\n ref={idx === 0 ? firstFieldRef : undefined}\n type={type}\n name={fieldName}\n autoComplete=\"on\"\n style={Styles.Input}\n autoFocus\n placeholder={placeholder}\n value={params[fieldName] || ''}\n onInput={(ev) =>\n setParams({ ...params, [fieldName]: valueTransformer(type, ev.target?.['value']) })\n }\n />\n </label>\n )\n )}\n </form>\n </>\n <div style={Styles.ButtonsDiv}>\n <button type=\"submit\" style={Styles.Button} onClick={() => onSubmit(params)}>\n Submit\n </button>\n <button style={Styles.Button} onClick={onCancel}>\n Cancel\n </button>\n </div>\n </Dialog>\n );\n}\n\nfunction valueTransformer(type: string, value: string) {\n switch(type) {\n case \"email\": return value.toLowerCase();\n case \"otp\": return value.toUpperCase();\n default: return value;\n }\n}","import Dexie from \"dexie\";\nimport \"../extend-dexie-interface\";\nimport { h, Component } from \"preact\";\nimport { from, Observer, Subscription } from \"rxjs\";\nimport { LoginDialog } from './LoginDialog';\nimport { Styles } from \"./Styles\";\nimport { DXCGenericUserInteraction, DXCUserInteraction } from \"../types/DXCUserInteraction\";\nimport { DXCInputField } from \"../types/DXCInputField\";\nimport { DexieCloudDB } from \"../db/DexieCloudDB\";\nimport * as preact from \"preact\";\n\nexport interface Props {\n db: Dexie;\n}\n\ninterface State {\n userInteraction: DXCUserInteraction | undefined;\n}\n\nexport default class LoginGui extends Component<Props, State> {\n subscription?: Subscription;\n observer = (userInteraction: DXCUserInteraction | undefined) => this.setState({userInteraction});\n\n constructor(props: Props) {\n super(props);\n this.state = { userInteraction: undefined };\n }\n\n componentDidMount() {\n this.subscription = from(this.props.db.cloud.userInteraction).subscribe(this.observer);\n }\n\n componentWillUnmount() {\n if (this.subscription) {\n this.subscription.unsubscribe();\n delete this.subscription;\n }\n }\n\n render(props: Props, {userInteraction}: State) {\n if (!userInteraction) return null;\n //if (props.db.cloud.userInteraction.observers.length > 1) return null; // Someone else subscribes.\n return <LoginDialog {...userInteraction as DXCGenericUserInteraction<string, {[name: string]: DXCInputField}>} />;\n }\n}\n\nexport function setupDefaultGUI(db: Dexie) {\n let closed = false;\n\n const el = document.createElement('div');\n if (document.body) {\n document.body.appendChild(el);\n preact.render(<LoginGui db={db.vip} />, el);\n } else {\n addEventListener('DOMContentLoaded', ()=>{\n if (!closed) {\n document.body.appendChild(el);\n preact.render(<LoginGui db={db.vip} />, el);\n }\n });\n }\n\n return {\n unsubscribe() {\n try { el.remove(); } catch {}\n closed = true;\n },\n get closed() {\n return closed;\n }\n }\n}\n\n// TODO:\n/*\n * Gjort klart allt kring user interaction förutom att mounta default-ui på ett element.\n * Också att kolla först om nån annan subscribar och i så fall inte göra nåt.\n*/","import { combineLatest, Observable, of } from 'rxjs';\nimport { debounceTime, map, startWith, switchMap } from 'rxjs/operators';\nimport { DexieCloudDB, SyncStateChangedEventData } from './db/DexieCloudDB';\nimport { isOnline } from './sync/isOnline';\nimport { SyncState } from './types/SyncState';\nimport { userIsActive, userIsReallyActive } from './userIsActive';\n\nexport function computeSyncState(db: DexieCloudDB): Observable<SyncState> {\n let _prevStatus = db.cloud.webSocketStatus.value;\n const lazyWebSocketStatus = db.cloud.webSocketStatus.pipe(\n switchMap((status) => {\n const prevStatus = _prevStatus;\n _prevStatus = status;\n const rv = of(status);\n switch (status) {\n // A normal scenario is that the WS reconnects and falls shortly in disconnected-->connection-->connected.\n // Don't distract user with this unless these things take more time than normal:\n\n // Only show disconnected if disconnected more than 500ms, or if we can\n // see that the user is indeed not active.\n case 'disconnected':\n return userIsActive.value ? rv.pipe(debounceTime(500)) : rv;\n\n // Only show connecting if previous state was 'not-started' or 'error', or if\n // the time it takes to connect goes beyond 4 seconds.\n case 'connecting':\n return prevStatus === 'not-started' || prevStatus === 'error'\n ? rv\n : rv.pipe(debounceTime(4000));\n default:\n return rv;\n }\n })\n );\n return combineLatest([\n lazyWebSocketStatus,\n db.syncStateChangedEvent.pipe(startWith({ phase: 'initial' } as SyncStateChangedEventData)),\n userIsReallyActive\n ]).pipe(\n map(([status, syncState, userIsActive]) => {\n let { phase, error, progress } = syncState;\n let adjustedStatus = status;\n if (phase === 'error') {\n // Let users only rely on the status property to display an icon.\n // If there's an error in the sync phase, let it show on that\n // status icon also.\n adjustedStatus = 'error';\n }\n if (status === 'not-started') {\n // If websocket isn't yet connected becase we're doing\n // the startup sync, let the icon show the symbol for connecting.\n if (phase === 'pushing' || phase === 'pulling') {\n adjustedStatus = 'connecting';\n }\n } \n const previousPhase = db.cloud.syncState.value.phase;\n //const previousStatus = db.cloud.syncState.value.status;\n if (previousPhase === 'error' && (syncState.phase === 'pushing' || syncState.phase === 'pulling')) {\n // We were in an errored state but is now doing sync. Show \"connecting\" icon.\n adjustedStatus = 'connecting';\n }\n /*if (syncState.phase === 'in-sync' && adjustedStatus === 'connecting') {\n adjustedStatus = 'connected';\n }*/\n \n if (!userIsActive) {\n adjustedStatus = 'disconnected';\n }\n\n const retState: SyncState = {\n phase,\n error,\n progress,\n status: isOnline ? adjustedStatus : 'offline',\n };\n\n return retState;\n })\n );\n}\n","export function associate<T extends object,M>(factory: (x: T)=>M): (x: T) => M {\n const wm = new WeakMap<T, M>();\n return (x: T) => {\n let rv = wm.get(x);\n if (!rv) {\n rv = factory(x);\n wm.set(x, rv);\n }\n return rv;\n }\n}\n","import {\n concat,\n from,\n InteropObservable,\n map,\n Observable,\n ObservableInput,\n share,\n timer,\n} from 'rxjs';\nimport { ObservableWithCurrentValue } from './mapValueObservable';\n\nexport function createSharedValueObservable<T>(\n o: ObservableInput<T>,\n defaultValue: T\n): ObservableWithCurrentValue<T> {\n let currentValue = defaultValue;\n let shared = from(o).pipe(\n map((x) => (currentValue = x)),\n share({ resetOnRefCountZero: () => timer(1000) })\n ) as ObservableWithCurrentValue<T>;\n\n const rv = new Observable((observer) => {\n let didEmit = false;\n const subscription = shared.subscribe({\n next(value) {\n didEmit = true;\n observer.next(value);\n },\n error(error) {\n observer.error(error);\n },\n complete() {\n observer.complete();\n }\n });\n if (!didEmit && !subscription.closed) {\n observer.next(currentValue);\n }\n return subscription;\n }) as ObservableWithCurrentValue<T>;\n\n rv.getValue = () => currentValue;\n return rv;\n}\n","import Dexie, { liveQuery } from 'dexie';\nimport { DBRealmRole } from 'dexie-cloud-common';\nimport { associate } from './associate';\nimport { createSharedValueObservable } from './createSharedValueObservable';\n\nexport const getGlobalRolesObservable = associate((db: Dexie) => {\n return createSharedValueObservable(\n liveQuery(() =>\n db.roles\n .where({ realmId: 'rlm-public' })\n .toArray()\n .then((roles) => {\n const rv: { [roleName: string]: DBRealmRole } = {};\n for (const role of roles\n .slice()\n .sort((a, b) => (a.sortOrder || 0) - (b.sortOrder || 0))) {\n rv[role.name] = role;\n }\n return rv;\n })\n ),\n {}\n );\n});\n","import Dexie from \"dexie\";\nimport { BehaviorSubject } from \"rxjs\";\nimport { associate } from \"./associate\";\nimport { UNAUTHORIZED_USER } from \"./authentication/UNAUTHORIZED_USER\";\n\nexport const getCurrentUserEmitter = associate((db: Dexie) => new BehaviorSubject(UNAUTHORIZED_USER));\n","import Dexie, { liveQuery } from 'dexie';\nimport { DBRealm, DBRealmMember } from 'dexie-cloud-common';\nimport { concat, Observable, timer } from 'rxjs';\nimport { share, switchMap } from 'rxjs/operators';\nimport { associate } from './associate';\nimport { createSharedValueObservable } from './createSharedValueObservable';\nimport { getCurrentUserEmitter } from './currentUserEmitter';\n\nexport type InternalAccessControlData = {\n readonly selfMembers: DBRealmMember[];\n readonly realms: DBRealm[];\n readonly userId: string;\n};\n\nexport const getInternalAccessControlObservable = associate((db: Dexie) => {\n return createSharedValueObservable(\n getCurrentUserEmitter(db._novip).pipe(\n switchMap((currentUser) =>\n liveQuery(() =>\n db.transaction('r', 'realms', 'members', () =>\n Promise.all([\n db.members.where({ userId: currentUser.userId }).toArray(),\n db.realms.toArray(),\n currentUser.userId!,\n ] as const).then(([selfMembers, realms, userId]) => {\n //console.debug(`PERMS: Result from liveQUery():`, JSON.stringify({selfMembers, realms, userId}, null, 2))\n return { selfMembers, realms, userId };\n })\n )\n )\n )\n ), {\n selfMembers: [],\n realms: [],\n get userId() {\n return db.cloud.currentUserId;\n },\n }\n );\n /* let refCount = 0;\n return new Observable(observer => {\n const subscription = o.subscribe(observer);\n console.debug ('PERMS subscribe', ++refCount);\n return {\n unsubscribe() {\n console.debug ('PERMS unsubscribe', --refCount);\n subscription.unsubscribe();\n }\n }\n })*/\n});\n","import { map, Observable } from 'rxjs';\n\nexport interface ObservableWithCurrentValue<T> extends Observable<T> {\n getValue(): T;\n}\n\nexport function mapValueObservable<T, R>(\n o: ObservableWithCurrentValue<T>,\n mapper: (x: T) => R\n): ObservableWithCurrentValue<R> {\n let currentValue: R | undefined;\n const rv = o.pipe(\n map((x) => (currentValue = mapper(x)))\n ) as ObservableWithCurrentValue<R>;\n rv.getValue = () =>\n currentValue !== undefined\n ? currentValue\n : (currentValue = mapper(o.getValue()));\n return rv;\n}\n","// TODO: Move to dexie-cloud-common\n\nimport { DBPermissionSet } from 'dexie-cloud-common';\n\nexport function mergePermissions(\n ...permissions: DBPermissionSet[]\n): DBPermissionSet {\n if (permissions.length === 0) return {};\n const reduced = permissions.reduce((result, next) => {\n const ret = { ...result } as DBPermissionSet;\n for (const [verb, rights] of Object.entries(next) as [\n keyof DBPermissionSet,\n DBPermissionSet[keyof DBPermissionSet]\n ][]) {\n if (verb in ret && ret[verb]) {\n if (ret[verb] === '*') continue;\n if (rights === '*') {\n ret[verb] = '*';\n } else if (Array.isArray(rights) && Array.isArray(ret[verb])) {\n // Both are arrays (verb is 'add' or 'manage')\n const r = ret as { [v in typeof verb]?: string[] };\n const retVerb = r[verb]!; // \"!\" because Array.isArray(ret[verb])\n r[verb] = [...new Set([...retVerb, ...rights])];\n } else if (\n typeof rights === 'object' &&\n rights &&\n typeof ret[verb] === 'object'\n ) {\n // Both are objects (verb is 'update')\n const mergedRights = ret[verb] as {\n [tableName: string]: '*' | string[];\n }; // because we've checked that typeof ret[verb] === 'object' and earlier that not ret[verb] === '*'.\n for (const [tableName, tableRights] of Object.entries(rights) as [\n string,\n string[] | '*'\n ][]) {\n if (mergedRights[tableName] === '*') continue;\n if (tableRights === '*') {\n mergedRights[tableName] = '*';\n } else if (\n Array.isArray(mergedRights[tableName]) &&\n Array.isArray(tableRights)\n ) {\n mergedRights[tableName] = [\n ...new Set([...mergedRights[tableName], ...tableRights]),\n ];\n }\n }\n }\n } else {\n /* This compiles without type assertions. Keeping the comment to\n explain why we do tsignore on the next statement.\n if (verb === \"add\") {\n ret[verb] = next[verb];\n } else if (verb === \"update\") {\n ret[verb] = next[verb];\n } else if (verb === \"manage\") {\n ret[verb] = next[verb];\n } else {\n ret[verb] = next[verb];\n }\n */\n //@ts-ignore\n ret[verb] = next[verb];\n }\n }\n return ret;\n });\n return reduced;\n}\n","import Dexie from 'dexie';\nimport { DBPermissionSet, DBRealm, DBRealmMember } from 'dexie-cloud-common';\nimport { combineLatest, Observable } from 'rxjs';\nimport { map, startWith, tap } from 'rxjs/operators';\nimport { associate } from './associate';\nimport { UNAUTHORIZED_USER } from './authentication/UNAUTHORIZED_USER';\nimport { createSharedValueObservable } from './createSharedValueObservable';\nimport { getGlobalRolesObservable } from './getGlobalRolesObservable';\nimport { getInternalAccessControlObservable } from './getInternalAccessControlObservable';\nimport { flatten } from './helpers/flatten';\nimport { mapValueObservable } from './mapValueObservable';\nimport { mergePermissions } from './mergePermissions';\n\nexport type PermissionsLookup = {\n [realmId: string]: DBRealm & { permissions: DBPermissionSet };\n};\n\nexport type PermissionsLookupObservable = Observable<PermissionsLookup> & {\n getValue(): PermissionsLookup;\n};\n\nexport const getPermissionsLookupObservable = associate((db: Dexie) => {\n const o = createSharedValueObservable(\n combineLatest([\n getInternalAccessControlObservable(db._novip),\n getGlobalRolesObservable(db._novip),\n ]).pipe(\n map(([{ selfMembers, realms, userId }, globalRoles]) => ({\n selfMembers,\n realms,\n userId,\n globalRoles,\n }))\n ),\n {\n selfMembers: [],\n realms: [],\n userId: UNAUTHORIZED_USER.userId!,\n globalRoles: {},\n }\n );\n\n return mapValueObservable(\n o,\n ({ selfMembers, realms, userId, globalRoles }) => {\n const rv = realms\n .map((realm) => {\n const selfRealmMembers = selfMembers.filter(\n (m) => m.realmId === realm.realmId\n );\n const directPermissionSets = selfRealmMembers\n .map((m) => m.permissions!)\n .filter((p) => p);\n const rolePermissionSets = flatten(\n selfRealmMembers.map((m) => m.roles!).filter((roleName) => roleName)\n )\n .map((role) => globalRoles[role]!)\n .filter((role) => role)\n .map((role) => role.permissions);\n\n return {\n ...realm,\n permissions:\n realm.owner === userId\n ? ({ manage: '*' } as DBPermissionSet)\n : mergePermissions(\n ...directPermissionSets,\n ...rolePermissionSets\n ),\n };\n })\n .reduce((p, c) => ({ ...p, [c.realmId]: c }), {\n [userId!]: {\n realmId: userId,\n owner: userId,\n name: userId,\n permissions: { manage: '*' },\n } as DBRealm & { permissions: DBPermissionSet },\n });\n return rv;\n }\n );\n});\n","import { KeyPaths } from 'dexie';\nimport { DBPermissionSet } from 'dexie-cloud-common';\n\ntype TableName<T> = T extends {table: ()=>infer TABLE} ? TABLE extends string ? TABLE : string : string;\n\nexport class PermissionChecker<T, TableNames extends string = TableName<T>> {\n private permissions: DBPermissionSet;\n private tableName: TableNames;\n private isOwner: boolean;\n\n constructor(\n permissions: DBPermissionSet,\n tableName: TableNames,\n isOwner: boolean\n ) {\n this.permissions = permissions || {};\n this.tableName = tableName;\n this.isOwner = isOwner;\n }\n\n add(...tableNames: TableNames[]): boolean {\n // If user can manage the whole realm, return true.\n if (this.permissions.manage === '*') return true;\n // If user can manage given table in realm, return true\n if (this.permissions.manage?.includes(this.tableName)) return true;\n // If user can add any type, return true\n if (this.permissions.add === '*') return true;\n // If user can add objects into given table names in the realm, return true\n if (\n tableNames.every((tableName) => this.permissions.add?.includes(tableName))\n ) {\n return true;\n }\n return false;\n }\n\n update(...props: KeyPaths<T>[]): boolean {\n // If user is owner of this object, or if user can manage the whole realm, return true.\n if (this.isOwner || this.permissions.manage === '*') return true;\n // If user can manage given table in realm, return true\n if (this.permissions.manage?.includes(this.tableName)) return true;\n // If user can update any prop in any table in this realm, return true unless\n // it regards to ownership change:\n if (this.permissions.update === '*') {\n return props.every((prop) => prop !== 'owner');\n }\n const tablePermissions = this.permissions.update?.[this.tableName];\n // If user can update any prop in table and realm, return true unless\n // accessing special props owner or realmId\n if (tablePermissions === '*')\n return props.every((prop) => prop !== 'owner');\n\n // Explicitely listed properties to allow updates on:\n return props.every((prop) =>\n tablePermissions?.some(\n (permittedProp) =>\n permittedProp === prop || (permittedProp === '*' && prop !== 'owner')\n )\n );\n }\n\n delete(): boolean {\n // If user is owner of this object, or if user can manage the whole realm, return true.\n if (this.isOwner || this.permissions.manage === '*') return true;\n // If user can manage given table in realm, return true\n if (this.permissions.manage?.includes(this.tableName)) return true;\n return false;\n }\n}\n","import Dexie, { liveQuery } from 'dexie';\nimport { DBRealmMember } from 'dexie-cloud-common';\nimport { from, Observable } from 'rxjs';\nimport { map, startWith } from 'rxjs/operators';\nimport { mergePermissions } from './mergePermissions';\nimport {\n getPermissionsLookupObservable,\n PermissionsLookup,\n} from './getPermissionsLookupObservable';\nimport { PermissionChecker } from './PermissionChecker';\nimport './extend-dexie-interface';\n\nexport function permissions(\n dexie: Dexie,\n obj: { owner?: string; realmId?: string; table?: () => string },\n tableName?: string\n): Observable<PermissionChecker<any>> {\n if (!obj)\n throw new TypeError(\n `Cannot check permissions of undefined or null. A Dexie Cloud object with realmId and owner expected.`\n );\n const { owner, realmId } = obj;\n if (!tableName) {\n if (typeof obj.table !== 'function') {\n throw new TypeError(\n `Missing 'table' argument to permissions and table could not be extracted from entity`\n );\n }\n tableName = obj.table();\n }\n const source = getPermissionsLookupObservable(dexie);\n const mapper = (permissionsLookup: PermissionsLookup) => {\n // If realmId is undefined, it can be due to that the object is not yet syncified - it exists\n // locally only as the user might not yet be authenticated. This is ok and we shall treat it\n // as if the realmId is dexie.cloud.currentUserId (which is \"unauthorized\" by the way)\n const realm = permissionsLookup[realmId || dexie.cloud.currentUserId];\n if (!realm)\n return new PermissionChecker(\n {},\n tableName!,\n !owner || owner === dexie.cloud.currentUserId\n );\n return new PermissionChecker(\n realm.permissions,\n tableName!,\n realmId === dexie.cloud.currentUserId || owner === dexie.cloud.currentUserId\n );\n };\n const o = source.pipe(map(mapper)) as Observable<PermissionChecker<any>> & {\n getValue: () => PermissionChecker<any>;\n };\n o.getValue = () => mapper(source.getValue());\n return o;\n}\n","import { Dexie, liveQuery } from 'dexie';\nimport { DBRealmMember } from 'dexie-cloud-common';\nimport { combineLatest } from 'rxjs';\nimport { map, switchMap } from 'rxjs/operators';\nimport { associate } from './associate';\nimport { createSharedValueObservable } from './createSharedValueObservable';\nimport { getCurrentUserEmitter } from './currentUserEmitter';\nimport { getInternalAccessControlObservable } from './getInternalAccessControlObservable';\nimport { getPermissionsLookupObservable } from './getPermissionsLookupObservable';\nimport { Invite } from './Invite';\nimport { mapValueObservable } from './mapValueObservable';\n\nexport const getInvitesObservable = associate((db: Dexie) => {\n const membersByEmail = getCurrentUserEmitter(db._novip).pipe(\n switchMap((currentUser) =>\n liveQuery(() =>\n db.members.where({ email: currentUser.email || '' }).toArray()\n )\n )\n );\n const permissions = getPermissionsLookupObservable(db._novip);\n const accessControl = getInternalAccessControlObservable(db._novip);\n return createSharedValueObservable(\n combineLatest([membersByEmail, accessControl, permissions]).pipe(\n map(([membersByEmail, accessControl, realmLookup]) => {\n const reducer = (\n result: { [id: string]: Invite },\n m: DBRealmMember\n ) => ({ ...result, [m.id!]: { ...m, realm: realmLookup[m.realmId] } });\n const emailMembersById = membersByEmail.reduce(reducer, {});\n const membersById = accessControl.selfMembers.reduce(\n reducer,\n emailMembersById\n );\n return Object.values(membersById)\n .filter((invite: DBRealmMember) => !invite.accepted)\n .map(\n (invite: DBRealmMember) =>\n ({\n ...invite,\n async accept() {\n await db.members.update(invite.id!, { accepted: new Date() });\n },\n async reject() {\n await db.members.update(invite.id!, { rejected: new Date() });\n },\n } satisfies Invite)\n );\n })\n ),\n []\n );\n});\n","\nexport function getTiedRealmId(objectId: string) {\n return 'rlm~' + objectId;\n}\n\nexport function getTiedObjectId(realmId: string) {\n return realmId.startsWith('rlm~') ? realmId.substr(4) : null;\n}\n","import Dexie, { liveQuery, Subscription, Table } from 'dexie';\nimport {\n DBPermissionSet,\n DBRealmMember,\n getDbNameFromDbUrl,\n} from 'dexie-cloud-common';\nimport { BehaviorSubject, combineLatest, from, fromEvent, Subject } from 'rxjs';\nimport { filter, map, skip, startWith, switchMap, take } from 'rxjs/operators';\nimport { login } from './authentication/login';\nimport { UNAUTHORIZED_USER } from './authentication/UNAUTHORIZED_USER';\nimport { DexieCloudDB } from './db/DexieCloudDB';\nimport { PersistedSyncState } from './db/entities/PersistedSyncState';\nimport { DexieCloudOptions } from './DexieCloudOptions';\nimport { DISABLE_SERVICEWORKER_STRATEGY } from './DISABLE_SERVICEWORKER_STRATEGY';\nimport './extend-dexie-interface';\nimport { DexieCloudSyncOptions } from './DexieCloudSyncOptions';\nimport { dbOnClosed } from './helpers/dbOnClosed';\nimport { IS_SERVICE_WORKER } from './helpers/IS_SERVICE_WORKER';\nimport { throwVersionIncrementNeeded } from './helpers/throwVersionIncrementNeeded';\nimport { createIdGenerationMiddleware } from './middlewares/createIdGenerationMiddleware';\nimport { createImplicitPropSetterMiddleware } from './middlewares/createImplicitPropSetterMiddleware';\nimport { createMutationTrackingMiddleware } from './middlewares/createMutationTrackingMiddleware';\n//import { dexieCloudSyncProtocol } from \"./dexieCloudSyncProtocol\";\nimport { overrideParseStoresSpec } from './overrideParseStoresSpec';\nimport { performInitialSync } from './performInitialSync';\nimport { connectWebSocket } from './sync/connectWebSocket';\nimport { isSyncNeeded } from './sync/isSyncNeeded';\nimport { LocalSyncWorker } from './sync/LocalSyncWorker';\nimport {\n registerPeriodicSyncEvent,\n registerSyncEvent,\n} from './sync/registerSyncEvent';\nimport { triggerSync } from './sync/triggerSync';\nimport { DXCUserInteraction } from './types/DXCUserInteraction';\nimport { SyncState } from './types/SyncState';\nimport { updateSchemaFromOptions } from './updateSchemaFromOptions';\nimport { verifySchema } from './verifySchema';\nimport { setupDefaultGUI } from './default-ui';\nimport { DXCWebSocketStatus } from './DXCWebSocketStatus';\nimport { computeSyncState } from './computeSyncState';\nimport { generateKey } from './middleware-helpers/idGenerationHelpers';\nimport { permissions } from './permissions';\nimport { getCurrentUserEmitter } from './currentUserEmitter';\nimport { NewIdOptions } from './types/NewIdOptions';\nimport { getInvitesObservable } from './getInvitesObservable';\nimport { getGlobalRolesObservable } from './getGlobalRolesObservable';\nimport { UserLogin } from './db/entities/UserLogin';\nexport { DexieCloudTable } from './DexieCloudTable';\nexport * from './getTiedRealmId';\nexport {\n DBRealm,\n DBRealmMember,\n DBRealmRole,\n DBSyncedObject,\n DBPermissionSet,\n} from 'dexie-cloud-common';\nexport { Invite } from './Invite';\n\nconst DEFAULT_OPTIONS: Partial<DexieCloudOptions> = {\n nameSuffix: true,\n};\n\nexport function dexieCloud(dexie: Dexie) {\n const origIdbName = dexie.name;\n //\n //\n //\n const currentUserEmitter = getCurrentUserEmitter(dexie);\n const subscriptions: Subscription[] = [];\n let configuredProgramatically = false;\n\n // local sync worker - used when there's no service worker.\n let localSyncWorker: { start: () => void; stop: () => void } | null = null;\n dexie.on(\n 'ready',\n async (dexie: Dexie) => {\n try {\n await onDbReady(dexie);\n } catch (error) {\n console.error(error);\n // Make sure to succeed with database open even if network is down.\n }\n },\n true // true = sticky\n );\n\n /** Void starting subscribers after a close has happened. */\n let closed = false;\n function throwIfClosed() {\n if (closed) throw new Dexie.DatabaseClosedError();\n }\n\n dbOnClosed(dexie, () => {\n subscriptions.forEach((subscription) => subscription.unsubscribe());\n closed = true;\n localSyncWorker && localSyncWorker.stop();\n localSyncWorker = null;\n currentUserEmitter.next(UNAUTHORIZED_USER);\n });\n\n const syncComplete = new Subject<void>();\n\n dexie.cloud = {\n version: '{version}',\n options: { ...DEFAULT_OPTIONS } as DexieCloudOptions,\n schema: null,\n get currentUserId() {\n return currentUserEmitter.value.userId || UNAUTHORIZED_USER.userId!;\n },\n currentUser: currentUserEmitter,\n syncState: new BehaviorSubject<SyncState>({\n phase: 'initial',\n status: 'not-started',\n }),\n\n events: {\n syncComplete,\n },\n \n persistedSyncState: new BehaviorSubject<PersistedSyncState | undefined>(\n undefined\n ),\n userInteraction: new BehaviorSubject<DXCUserInteraction | undefined>(\n undefined\n ),\n webSocketStatus: new BehaviorSubject<DXCWebSocketStatus>('not-started'),\n async login(hint) {\n const db = DexieCloudDB(dexie);\n await db.cloud.sync();\n await login(db, hint);\n },\n invites: getInvitesObservable(dexie),\n roles: getGlobalRolesObservable(dexie),\n configure(options: DexieCloudOptions) {\n options = dexie.cloud.options = { ...dexie.cloud.options, ...options };\n configuredProgramatically = true;\n if (options.databaseUrl && options.nameSuffix) {\n // @ts-ignore\n dexie.name = `${origIdbName}-${getDbNameFromDbUrl(\n options.databaseUrl\n )}`;\n DexieCloudDB(dexie).reconfigure(); // Update observable from new dexie.name\n }\n updateSchemaFromOptions(dexie.cloud.schema, dexie.cloud.options);\n },\n async sync(\n { wait, purpose }: DexieCloudSyncOptions = { wait: true, purpose: 'push' }\n ) {\n if (wait === undefined) wait = true;\n const db = DexieCloudDB(dexie);\n if (purpose === 'pull') {\n const syncState = db.cloud.persistedSyncState.value;\n triggerSync(db, purpose);\n if (wait) {\n const newSyncState = await db.cloud.persistedSyncState\n .pipe(\n filter(\n (newSyncState) =>\n newSyncState?.timestamp != null &&\n (!syncState || newSyncState.timestamp > syncState.timestamp!)\n ),\n take(1)\n )\n .toPromise();\n if (newSyncState?.error) {\n throw new Error(`Sync error: ` + newSyncState.error);\n }\n }\n } else if (await isSyncNeeded(db)) {\n const syncState = db.cloud.persistedSyncState.value;\n triggerSync(db, purpose);\n if (wait) {\n console.debug('db.cloud.login() is waiting for sync completion...');\n await from(\n liveQuery(async () => {\n const syncNeeded = await isSyncNeeded(db);\n const newSyncState = await db.getPersistedSyncState();\n if (\n newSyncState?.timestamp !== syncState?.timestamp &&\n newSyncState?.error\n )\n throw new Error(`Sync error: ` + newSyncState.error);\n return syncNeeded;\n })\n )\n .pipe(\n filter((isNeeded) => !isNeeded),\n take(1)\n )\n .toPromise();\n console.debug(\n 'Done waiting for sync completion because we have nothing to push anymore'\n );\n }\n }\n },\n permissions(\n obj: { owner: string; realmId: string; table?: () => string },\n tableName?: string\n ) {\n return permissions(dexie._novip, obj, tableName);\n },\n };\n\n dexie.Version.prototype['_parseStoresSpec'] = Dexie.override(\n dexie.Version.prototype['_parseStoresSpec'],\n (origFunc) => overrideParseStoresSpec(origFunc, dexie)\n );\n\n dexie.Table.prototype.newId = function (\n this: Table<any>,\n { colocateWith }: NewIdOptions = {}\n ) {\n const shardKey =\n colocateWith && colocateWith.substr(colocateWith.length - 3);\n return generateKey(dexie.cloud.schema![this.name].idPrefix || '', shardKey);\n };\n\n dexie.Table.prototype.idPrefix = function (this: Table<any>) {\n return this.db.cloud.schema?.[this.name]?.idPrefix || '';\n };\n\n dexie.use(\n createMutationTrackingMiddleware({\n currentUserObservable: dexie.cloud.currentUser,\n db: DexieCloudDB(dexie),\n })\n );\n dexie.use(createImplicitPropSetterMiddleware(DexieCloudDB(dexie)));\n dexie.use(createIdGenerationMiddleware(DexieCloudDB(dexie)));\n\n async function onDbReady(dexie: Dexie) {\n closed = false; // As Dexie calls us, we are not closed anymore. Maybe reopened? Remember db.ready event is registered with sticky flag!\n const db = DexieCloudDB(dexie);\n // Setup default GUI:\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n if (!db.cloud.options?.customLoginGui) {\n subscriptions.push(setupDefaultGUI(dexie));\n }\n }\n if (!db.cloud.isServiceWorkerDB) {\n subscriptions.push(computeSyncState(db).subscribe(dexie.cloud.syncState));\n }\n\n // Forward db.syncCompleteEvent to be publicly consumable via db.cloud.events.syncComplete:\n subscriptions.push(db.syncCompleteEvent.subscribe(syncComplete));\n\n //verifyConfig(db.cloud.options); Not needed (yet at least!)\n // Verify the user has allowed version increment.\n if (!db.tables.every((table) => table.core)) {\n throwVersionIncrementNeeded();\n }\n const swRegistrations =\n 'serviceWorker' in navigator\n ? await navigator.serviceWorker.getRegistrations()\n : [];\n\n const initiallySynced = await db.transaction(\n 'rw',\n db.$syncState,\n async () => {\n const { options, schema } = db.cloud;\n const [persistedOptions, persistedSchema, persistedSyncState] =\n await Promise.all([\n db.getOptions(),\n db.getSchema(),\n db.getPersistedSyncState(),\n ]);\n if (!configuredProgramatically) {\n // Options not specified programatically (use case for SW!)\n // Take persisted options:\n db.cloud.options = persistedOptions || null;\n } else if (\n !persistedOptions ||\n JSON.stringify(persistedOptions) !== JSON.stringify(options)\n ) {\n // Update persisted options:\n if (!options) throw new Error(`Internal error`); // options cannot be null if configuredProgramatically is set.\n const newPersistedOptions: DexieCloudOptions = {\n ...options\n };\n delete newPersistedOptions.fetchTokens;\n await db.$syncState.put(newPersistedOptions, 'options');\n }\n if (\n db.cloud.options?.tryUseServiceWorker &&\n 'serviceWorker' in navigator &&\n swRegistrations.length > 0 &&\n !DISABLE_SERVICEWORKER_STRATEGY\n ) {\n // * Configured for using service worker if available.\n // * Browser supports service workers\n // * There are at least one service worker registration\n console.debug('Dexie Cloud Addon: Using service worker');\n db.cloud.usingServiceWorker = true;\n } else {\n // Not configured for using service worker or no service worker\n // registration exists. Don't rely on service worker to do any job.\n // Use LocalSyncWorker instead.\n if (\n db.cloud.options?.tryUseServiceWorker &&\n !db.cloud.isServiceWorkerDB\n ) {\n console.debug(\n 'dexie-cloud-addon: Not using service worker.',\n swRegistrations.length === 0\n ? 'No SW registrations found.'\n : 'serviceWorker' in navigator && DISABLE_SERVICEWORKER_STRATEGY\n ? 'Avoiding SW background sync and SW periodic bg sync for this browser due to browser bugs.'\n : 'navigator.serviceWorker not present'\n );\n }\n db.cloud.usingServiceWorker = false;\n }\n updateSchemaFromOptions(schema, db.cloud.options);\n updateSchemaFromOptions(persistedSchema, db.cloud.options);\n if (!schema) {\n // Database opened dynamically (use case for SW!)\n // Take persisted schema:\n db.cloud.schema = persistedSchema || null;\n } else if (\n !persistedSchema ||\n JSON.stringify(persistedSchema) !== JSON.stringify(schema)\n ) {\n // Update persisted schema (but don't overwrite table prefixes)\n const newPersistedSchema = persistedSchema || {};\n for (const [table, tblSchema] of Object.entries(schema)) {\n const newTblSchema = newPersistedSchema[table];\n if (!newTblSchema) {\n newPersistedSchema[table] = { ...tblSchema };\n } else {\n newTblSchema.markedForSync = tblSchema.markedForSync;\n tblSchema.deleted = newTblSchema.deleted;\n newTblSchema.generatedGlobalId = tblSchema.generatedGlobalId;\n }\n }\n await db.$syncState.put(newPersistedSchema, 'schema');\n\n // Make sure persisted table prefixes are being used instead of computed ones:\n // Let's assign all props as the newPersistedSchems should be what we should be working with.\n Object.assign(schema, newPersistedSchema);\n }\n return persistedSyncState?.initiallySynced;\n }\n );\n\n if (initiallySynced) {\n db.setInitiallySynced(true);\n }\n\n verifySchema(db);\n\n if (db.cloud.options?.databaseUrl && !initiallySynced) {\n await performInitialSync(db, db.cloud.options, db.cloud.schema!);\n db.setInitiallySynced(true);\n }\n\n // Manage CurrentUser observable:\n throwIfClosed();\n if (!db.cloud.isServiceWorkerDB) {\n subscriptions.push(\n liveQuery(() => db.getCurrentUser()).subscribe(currentUserEmitter)\n );\n // Manage PersistendSyncState observable:\n subscriptions.push(\n liveQuery(() => db.getPersistedSyncState()).subscribe(\n db.cloud.persistedSyncState\n )\n );\n // Wait till currentUser and persistedSyncState gets populated\n // with things from the database and not just the default values.\n // This is so that when db.open() completes, user should be safe\n // to subscribe to these observables and get actual data.\n await combineLatest([\n currentUserEmitter.pipe(skip(1), take(1)),\n db.cloud.persistedSyncState.pipe(skip(1), take(1)),\n ]).toPromise();\n }\n\n // HERE: If requireAuth, do athentication now.\n let changedUser = false;\n if (db.cloud.options?.requireAuth) {\n changedUser = await login(db);\n }\n\n if (localSyncWorker) localSyncWorker.stop();\n localSyncWorker = null;\n throwIfClosed();\n if (db.cloud.usingServiceWorker && db.cloud.options?.databaseUrl) {\n registerSyncEvent(db, changedUser ? 'pull' : 'push').catch(() => {});\n registerPeriodicSyncEvent(db).catch(() => {});\n } else if (\n db.cloud.options?.databaseUrl &&\n db.cloud.schema &&\n !db.cloud.isServiceWorkerDB\n ) {\n // There's no SW. Start SyncWorker instead.\n localSyncWorker = LocalSyncWorker(db, db.cloud.options, db.cloud.schema!);\n localSyncWorker.start();\n triggerSync(db, changedUser ? 'pull' : 'push');\n }\n\n // Listen to online event and do sync.\n throwIfClosed();\n if (!db.cloud.isServiceWorkerDB) {\n subscriptions.push(\n fromEvent(self, 'online').subscribe(() => {\n console.debug('online!');\n db.syncStateChangedEvent.next({\n phase: 'not-in-sync',\n });\n triggerSync(db, 'push');\n }),\n fromEvent(self, 'offline').subscribe(() => {\n console.debug('offline!');\n db.syncStateChangedEvent.next({\n phase: 'offline',\n });\n })\n );\n }\n\n // Connect WebSocket unless we\n if (\n db.cloud.options?.databaseUrl &&\n !db.cloud.options?.disableWebSocket &&\n !IS_SERVICE_WORKER\n ) {\n subscriptions.push(connectWebSocket(db));\n }\n }\n}\n\ndexieCloud.version = '{version}';\n\nDexie.Cloud = dexieCloud;\n\n//Dexie.addons.push(dexieCloud);\n\nexport default dexieCloud;\n"],"names":["randomString","Symbol_observable","Symbol_iterator","asyncScheduler","iterator","concat","wm","Observable","this","bigintDef","tsonBuiltinDefs","counter","Subscription","from","slice","options","vnodeId","rerenderQueue","prevDebounce","i","EMPTY_OBJ","EMPTY_ARR","IS_NON_DIMENSIONAL","assign","obj","props","removeNode","node","parentNode","removeChild","createElement","type","children","key","ref","normalizedProps","arguments","length","call","defaultProps","undefined","createVNode","original","vnode","constructor","Fragment","Component","context","getDomSibling","childIndex","indexOf","sibling","updateParentDomPointers","child","base","enqueueRender","c","push","process","debounceRendering","setTimeout","queue","sort","a","b","some","component","commitQueue","oldVNode","oldDom","parentDom","diff","ownerSVGElement","commitRoot","diffChildren","renderResult","newParentVNode","oldParentVNode","globalContext","isSvg","excessDomChildren","isHydrating","j","childVNode","newDom","firstChildDom","refs","oldChildren","oldChildrenLength","Array","isArray","reorderChildren","placeChild","unmount","applyRef","tmp","nextDom","sibDom","outer","appendChild","nextSibling","insertBefore","diffProps","dom","newProps","oldProps","hydrate","setProperty","setStyle","style","value","test","name","oldValue","useCapture","o","cssText","replace","toLowerCase","_listeners","addEventListener","eventProxyCapture","eventProxy","removeEventListener","e","setAttribute","removeAttribute","event","newVNode","isNew","oldState","snapshot","clearProcessingException","provider","componentContext","renderHook","count","newType","contextType","prototype","render","doRender","sub","state","getDerivedStateFromProps","componentWillMount","componentDidMount","componentWillReceiveProps","shouldComponentUpdate","forEach","componentWillUpdate","componentDidUpdate","getChildContext","getSnapshotBeforeUpdate","diffElementNodes","diffed","root","cb","oldHtml","newHtml","nodeType","localName","document","createTextNode","createElementNS","is","data","childNodes","dangerouslySetInnerHTML","attributes","innerHTML","checked","current","parentVNode","skipRemove","r","componentWillUnmount","replaceNode","firstChild","error","errorInfo","ctor","handled","getDerivedStateFromError","setState","componentDidCatch","isValidElement","update","callback","s","forceUpdate","currentIndex","currentComponent","previousComponent","prevRaf","currentHook","afterPaintEffects","EMPTY","oldBeforeDiff","oldBeforeRender","oldAfterDiff","oldCommit","oldBeforeUnmount","getHookState","index","hooks","useState","initialState","useReducer","invokeOrReturn","reducer","init","hookState","_reducer","action","currentValue","nextValue","_hasScuFromHooks","prevScu","p","stateHooks","filter","x","every","shouldUpdate","hookItem","useLayoutEffect","args","argsChanged","_pendingArgs","useRef","initialValue","useMemo","factory","flushAfterPaintEffects","shift","invokeCleanup","invokeEffect","requestAnimationFrame","raf","done","clearTimeout","timeout","HAS_RAF","cancelAnimationFrame","hasErrored","hook","comp","cleanup","oldArgs","newArgs","arg","f","preact.render","map","timer"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;AACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;AACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;AACpF,QAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1G,IAAI,OAAO,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC;AACF;AACO,SAAS,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE;AAChC,IAAI,IAAI,OAAO,CAAC,KAAK,UAAU,IAAI,CAAC,KAAK,IAAI;AAC7C,QAAQ,MAAM,IAAI,SAAS,CAAC,sBAAsB,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,+BAA+B,CAAC,CAAC;AAClG,IAAI,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACxB,IAAI,SAAS,EAAE,GAAG,EAA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,CAAC;AAC1B,iBAAC,CAAC,EACF,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,SAAS,CAAC,MAAK;AACxC,oBAAA,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;AAC1B,oBAAA,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC;AAC5B,wBAAA,KAAK,EAAE,SAAS;AACjB,qBAAA,CAAC,CAAC;iBACJ,CAAC,CACH,CAAC;AACH,aAAA;;YAGD,IACE,CAAA,MAAA,EAAE,CAAC,KAAK,CAAC,OAAO,0CAAE,WAAW;gBAC7B,EAAC,MAAA,EAAE,CAAC,KAAK,CAAC,OAAO,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,gBAAgB,CAAA;AACnC,gBAAA,CAAC,iBAAiB,EAClB;gBACA,aAAa,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1C,aAAA;;AACF,KAAA;AACH,CAAC;AAED,UAAU,CAAC,OAAO,GAAG,WAAW,CAAC;AAEjC,KAAK,CAAC,KAAK,GAAG,UAAU;;;;"}
|
|
1
|
+
{"version":3,"file":"dexie-cloud-addon.js","sources":["../../../../node_modules/.pnpm/tslib@2.4.0/node_modules/tslib/tslib.es6.js","../../../../libs/dexie-cloud-common/dist/utils.js","../../../../libs/dexie-cloud-common/dist/validation/isValidSyncableID.js","../../../../libs/dexie-cloud-common/dist/change-processing/applyOperation.js","../../../../libs/dexie-cloud-common/dist/change-processing/applyOperations.js","../../../../libs/dexie-cloud-common/dist/change-processing/subtractChanges.js","../../../../libs/dexie-cloud-common/dist/change-processing/toDBOperationSet.js","../../../../libs/dexie-cloud-common/dist/getDbNameFromDbUrl.js","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/isFunction.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/lift.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/isArrayLike.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/isPromise.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/createErrorClass.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/UnsubscriptionError.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/arrRemove.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/Subscription.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/config.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduler/timeoutProvider.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/reportUnhandledError.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/noop.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/NotificationFactories.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/errorContext.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/Subscriber.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/symbol/observable.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/identity.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/pipe.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/Observable.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/isInteropObservable.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/isAsyncIterable.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/throwUnobservableError.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/symbol/iterator.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/isIterable.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/isReadableStreamLike.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/observable/innerFrom.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/OperatorSubscriber.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduler/Action.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduler/intervalProvider.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduler/AsyncAction.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduler/dateTimestampProvider.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/Scheduler.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduler/AsyncScheduler.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduler/async.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/isScheduler.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/isDate.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/observable/timer.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/args.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/util/executeSchedule.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/catchError.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/observeOn.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/subscribeOn.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduled/scheduleObservable.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduled/schedulePromise.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduled/scheduleArray.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduled/scheduleIterable.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduled/scheduleAsyncIterable.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduled/scheduleReadableStreamLike.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/scheduled/scheduled.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/observable/from.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/map.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/mergeInternals.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/mergeMap.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/mergeAll.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/concatAll.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/debounceTime.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/observable/concat.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/observable/empty.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/take.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/ignoreElements.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/mapTo.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/delayWhen.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/delay.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/distinctUntilChanged.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/filter.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/skip.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/startWith.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/switchMap.ts","../../../../node_modules/.pnpm/rxjs@7.5.6/node_modules/rxjs/src/internal/operators/tap.ts","../../src/sync/registerSyncEvent.ts","../../src/sync/triggerSync.ts","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/common/base64.js","../../src/authentication/TokenErrorResponseError.ts","../../src/authentication/interactWithUser.ts","../../src/authentication/authenticate.ts","../../src/authentication/AuthPersistedContext.ts","../../src/authentication/UNAUTHORIZED_USER.ts","../../src/authentication/waitUntil.ts","../../src/authentication/logout.ts","../../src/errors/HttpError.ts","../../src/authentication/otpFetchTokenCallback.ts","../../src/prodLog.ts","../../src/authentication/setCurrentUser.ts","../../src/authentication/login.ts","../../src/helpers/SWBroadcastChannel.ts","../../src/helpers/BroadcastedAndLocalEvent.ts","../../src/helpers/computeRealmSetHash.ts","../../src/helpers/getSyncableTables.ts","../../src/helpers/getMutationTable.ts","../../src/helpers/getTableFromMutationTable.ts","../../src/helpers/flatten.ts","../../src/sync/listClientChanges.ts","../../src/helpers/randomString.ts","../../src/sync/listSyncifiedChanges.ts","../../src/sync/getTablesToSyncify.ts","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/TypesonSimplified.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/BisonBinaryTypes.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/types/number.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/types/bigint.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/types/Date.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/types/Set.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/types/Map.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/common/_global.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/types/TypedArray.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/common/b64lex.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/types/ArrayBuffer.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/FakeBlob.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/readBlobSync.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/string2arraybuffer.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/types/Blob.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/presets/builtin.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/Bison.js","../../../../node_modules/.pnpm/dreambase-library@1.0.19/node_modules/dreambase-library/dist/typeson-simplified/types/undefined.js","../../src/TSON.ts","../../src/sync/encodeIdsForServer.ts","../../src/sync/ratelimit.ts","../../src/sync/syncWithServer.ts","../../src/sync/modifyLocalObjectsWithNewUserId.ts","../../src/helpers/CancelToken.ts","../../src/sync/isOnline.ts","../../src/sync/updateBaseRevs.ts","../../src/sync/getLatestRevisionsPerTable.ts","../../src/helpers/bulkUpdate.ts","../../src/sync/applyServerChanges.ts","../../src/sync/sync.ts","../../src/sync/messagesFromServerQueue.ts","../../src/db/DexieCloudDB.ts","../../src/isFirefox.ts","../../src/isSafari.ts","../../src/DISABLE_SERVICEWORKER_STRATEGY.ts","../../src/helpers/dbOnClosed.ts","../../src/helpers/IS_SERVICE_WORKER.ts","../../src/helpers/throwVersionIncrementNeeded.ts","../../src/middleware-helpers/idGenerationHelpers.ts","../../src/middlewares/createIdGenerationMiddleware.ts","../../src/middlewares/createImplicitPropSetterMiddleware.ts","../../src/helpers/allSettled.ts","../../src/middleware-helpers/guardedTable.ts","../../src/middlewares/outstandingTransaction.ts","../../src/isEagerSyncDisabled.ts","../../src/middlewares/createMutationTrackingMiddleware.ts","../../src/overrideParseStoresSpec.ts","../../src/performInitialSync.ts","../../src/userIsActive.ts","../../src/authentication/TokenExpiredError.ts","../../src/WSObservable.ts","../../src/InvalidLicenseError.ts","../../src/sync/connectWebSocket.ts","../../src/sync/isSyncNeeded.ts","../../src/sync/performGuardedJob.ts","../../src/sync/syncIfPossible.ts","../../src/helpers/date-constants.ts","../../src/sync/LocalSyncWorker.ts","../../src/updateSchemaFromOptions.ts","../../src/verifySchema.ts","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/util.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/options.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/create-element.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/component.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/create-context.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/constants.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/diff/children.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/diff/props.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/diff/index.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/render.js","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/src/diff/catch-error.js","../../src/default-ui/Styles.ts","../../src/default-ui/Dialog.tsx","../../../../node_modules/.pnpm/preact@10.10.6/node_modules/preact/hooks/src/index.js","../../src/helpers/resolveText.ts","../../src/default-ui/LoginDialog.tsx","../../src/default-ui/index.tsx","../../src/associate.ts","../../src/currentUserEmitter.ts","../../src/computeSyncState.ts","../../src/createSharedValueObservable.ts","../../src/getGlobalRolesObservable.ts","../../src/getInternalAccessControlObservable.ts","../../src/mapValueObservable.ts","../../src/mergePermissions.ts","../../src/getPermissionsLookupObservable.ts","../../src/PermissionChecker.ts","../../src/permissions.ts","../../src/getInvitesObservable.ts","../../src/getTiedRealmId.ts","../../src/dexie-cloud-client.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\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\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\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\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","export function assert(b) {\n if (!b)\n throw new Error('Assertion Failed');\n}\nconst _hasOwn = {}.hasOwnProperty;\nexport function hasOwn(obj, prop) {\n return _hasOwn.call(obj, prop);\n}\nexport function setByKeyPath(obj, keyPath, value) {\n if (!obj || keyPath === undefined)\n return;\n if ('isFrozen' in Object && Object.isFrozen(obj))\n return;\n if (typeof keyPath !== 'string' && 'length' in keyPath) {\n assert(typeof value !== 'string' && 'length' in value);\n for (var i = 0, l = keyPath.length; i < l; ++i) {\n setByKeyPath(obj, keyPath[i], value[i]);\n }\n }\n else {\n var period = keyPath.indexOf('.');\n if (period !== -1) {\n var currentKeyPath = keyPath.substr(0, period);\n var remainingKeyPath = keyPath.substr(period + 1);\n if (remainingKeyPath === '')\n if (value === undefined) {\n if (Array.isArray(obj)) {\n if (!isNaN(parseInt(currentKeyPath)))\n obj.splice(parseInt(currentKeyPath), 1);\n }\n else\n delete obj[currentKeyPath];\n // @ts-ignore: even if currentKeyPath would be numeric string and obj would be array - it works.\n }\n else\n obj[currentKeyPath] = value;\n else {\n //@ts-ignore: even if currentKeyPath would be numeric string and obj would be array - it works.\n var innerObj = obj[currentKeyPath];\n //@ts-ignore: even if currentKeyPath would be numeric string and obj would be array - it works.\n if (!innerObj || !hasOwn(obj, currentKeyPath))\n innerObj = (obj[currentKeyPath] = {});\n setByKeyPath(innerObj, remainingKeyPath, value);\n }\n }\n else {\n if (value === undefined) {\n if (Array.isArray(obj) && !isNaN(parseInt(keyPath)))\n // @ts-ignore: even if currentKeyPath would be numeric string and obj would be array - it works.\n obj.splice(keyPath, 1);\n //@ts-ignore: even if currentKeyPath would be numeric string and obj would be array - it works.\n else\n delete obj[keyPath];\n //@ts-ignore: even if currentKeyPath would be numeric string and obj would be array - it works.\n }\n else\n obj[keyPath] = value;\n }\n }\n}\nexport const randomString = typeof self !== 'undefined' && typeof crypto !== 'undefined' ? (bytes, randomFill = crypto.getRandomValues.bind(crypto)) => {\n // Web\n const buf = new Uint8Array(bytes);\n randomFill(buf);\n return self.btoa(String.fromCharCode.apply(null, buf));\n} : typeof Buffer !== 'undefined' ? (bytes, randomFill = simpleRandomFill) => {\n // Node\n const buf = Buffer.alloc(bytes);\n randomFill(buf);\n return buf.toString(\"base64\");\n} : () => { throw new Error(\"No implementation of randomString was found\"); };\nfunction simpleRandomFill(buf) {\n for (let i = 0; i < buf.length; ++i) {\n buf[i] = Math.floor(Math.random() * 256);\n }\n}\n","const validIDTypes = {\n Uint8Array,\n};\n/** Verifies that given primary key is valid.\n * The reason we narrow validity for valid keys are twofold:\n * 1: Make sure to only support types that can be used as an object index in DBKeyMutationSet.\n * For example, ArrayBuffer cannot be used (gives \"object ArrayBuffer\") but Uint8Array can be\n * used (gives comma-delimited list of included bytes).\n * 2: Avoid using plain numbers and Dates as keys when they are synced, as they are not globally unique.\n * 3: Since we store the key as a VARCHAR server side in current version, try not promote types that stringifies to become very long server side.\n *\n * @param id\n * @returns\n */\nexport function isValidSyncableID(id) {\n if (typeof id === \"string\")\n return true;\n //if (validIDTypes[toStringTag(id)]) return true;\n //if (Array.isArray(id)) return id.every((part) => isValidSyncableID(part));\n if (Array.isArray(id) && id.some(key => isValidSyncableID(key)) && id.every(isValidSyncableIDPart))\n return true;\n return false;\n}\n/** Verifies that given key part is valid.\n * 1: Make sure that arrays of this types are stringified correclty and works with DBKeyMutationSet.\n * For example, ArrayBuffer cannot be used (gives \"object ArrayBuffer\") but Uint8Array can be\n * used (gives comma-delimited list of included bytes).\n * 2: Since we store the key as a VARCHAR server side in current version, try not promote types that stringifies to become very long server side.\n*/\nfunction isValidSyncableIDPart(part) {\n return typeof part === \"string\" || typeof part === \"number\" || Array.isArray(part) && part.every(isValidSyncableIDPart);\n}\nexport function isValidAtID(id, idPrefix) {\n return !idPrefix || (typeof id === \"string\" && id.startsWith(idPrefix));\n}\n","import { setByKeyPath } from \"../utils.js\";\nexport function applyOperation(target, table, op) {\n const tbl = target[table] || (target[table] = {});\n const keys = op.keys.map(key => typeof key === 'string' ? key : JSON.stringify(key));\n switch (op.type) {\n case \"insert\":\n // TODO: Don't treat insert and upsert the same?\n case \"upsert\":\n keys.forEach((key, idx) => {\n tbl[key] = {\n type: \"ups\",\n val: op.values[idx],\n };\n });\n break;\n case \"update\":\n case \"modify\": {\n keys.forEach((key, idx) => {\n const changeSpec = op.type === \"update\"\n ? op.changeSpecs[idx]\n : op.changeSpec;\n const entry = tbl[key];\n if (!entry) {\n tbl[key] = {\n type: \"upd\",\n mod: changeSpec,\n };\n }\n else {\n switch (entry.type) {\n case \"ups\":\n // Adjust the existing upsert with additional updates\n for (const [propPath, value] of Object.entries(changeSpec)) {\n setByKeyPath(entry.val, propPath, value);\n }\n break;\n case \"del\":\n // No action.\n break;\n case \"upd\":\n // Adjust existing update with additional updates\n Object.assign(entry.mod, changeSpec); // May work for deep props as well - new keys is added later, right? Does the prop order persist along TSON and all? But it will not be 100% when combined with some server code (seach for \"address.city\": \"Stockholm\" comment)\n break;\n }\n }\n });\n break;\n }\n case \"delete\":\n keys.forEach((key) => {\n tbl[key] = {\n type: \"del\",\n };\n });\n break;\n }\n return target;\n}\n","import { applyOperation } from \"./applyOperation.js\";\nexport function applyOperations(target, ops) {\n for (const { table, muts } of ops) {\n for (const mut of muts) {\n applyOperation(target, table, mut);\n }\n }\n}\n","import { setByKeyPath } from '../utils.js';\nexport function subtractChanges(target, // Server change set\nchangesToSubtract // additional mutations on client during syncWithServer()\n) {\n var _a, _b, _c;\n for (const [table, mutationSet] of Object.entries(changesToSubtract)) {\n for (const [key, mut] of Object.entries(mutationSet)) {\n switch (mut.type) {\n case 'ups':\n {\n const targetMut = (_a = target[table]) === null || _a === void 0 ? void 0 : _a[key];\n if (targetMut) {\n switch (targetMut.type) {\n case 'ups':\n delete target[table][key];\n break;\n case 'del':\n // Leave delete operation.\n // (Don't resurrect objects unintenionally (using tx(get, put) pattern locally))\n break;\n case 'upd':\n delete target[table][key];\n break;\n }\n }\n }\n break;\n case 'del':\n (_b = target[table]) === null || _b === void 0 ? true : delete _b[key];\n break;\n case 'upd': {\n const targetMut = (_c = target[table]) === null || _c === void 0 ? void 0 : _c[key];\n if (targetMut) {\n switch (targetMut.type) {\n case 'ups':\n // Adjust the server upsert with locally updated values.\n for (const [propPath, value] of Object.entries(mut.mod)) {\n setByKeyPath(targetMut.val, propPath, value);\n }\n break;\n case 'del':\n // Leave delete.\n break;\n case 'upd':\n // Remove the local update props from the server update mutation.\n for (const propPath of Object.keys(mut.mod)) {\n delete targetMut.mod[propPath];\n }\n break;\n }\n }\n break;\n }\n }\n }\n }\n}\n","import { randomString } from \"../utils.js\";\n/** Convert a DBKeyMutationSet (which is an internal format capable of looking up changes per ID)\n * ...into a DBOperationsSet (which is more optimal for performing DB operations into DB (bulkAdd() etc))\n *\n * @param inSet\n * @returns DBOperationsSet representing inSet\n */\nexport function toDBOperationSet(inSet, txid = \"\") {\n // Fictive transaction:\n if (!txid)\n txid = randomString(16);\n // Convert data into a temporary map to collect mutations of same table and type\n const map = {};\n for (const [table, ops] of Object.entries(inSet)) {\n for (const [key, op] of Object.entries(ops)) {\n const mapEntry = map[table] || (map[table] = {});\n const ops = mapEntry[op.type] || (mapEntry[op.type] = []);\n ops.push(Object.assign({ key }, op)); // DBKeyMutation doesn't contain key, so we need to bring it in.\n }\n }\n // Start computing the resulting format:\n const result = [];\n for (const [table, ops] of Object.entries(map)) {\n const resultEntry = {\n table,\n muts: [],\n };\n for (const [optype, muts] of Object.entries(ops)) {\n switch (optype) {\n case \"ups\": {\n const op = {\n type: \"upsert\",\n keys: muts.map(mut => mut.key),\n values: muts.map(mut => mut.val),\n txid\n };\n resultEntry.muts.push(op);\n break;\n }\n case \"upd\": {\n const op = {\n type: \"update\",\n keys: muts.map(mut => mut.key),\n changeSpecs: muts.map(mut => mut.mod),\n txid\n };\n resultEntry.muts.push(op);\n break;\n }\n case \"del\": {\n const op = {\n type: \"delete\",\n keys: muts.map(mut => mut.key),\n txid,\n };\n resultEntry.muts.push(op);\n break;\n }\n }\n }\n result.push(resultEntry);\n }\n return result;\n}\n","export function getDbNameFromDbUrl(dbUrl) {\n const url = new URL(dbUrl);\n return url.pathname === \"/\"\n ? url.hostname.split('.')[0]\n : url.pathname.split('/')[1];\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","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","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","/**\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 *\n * @class Subscription\n */\nexport class Subscription implements SubscriptionLike {\n /** @nocollapse */\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 * @return {void}\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 `Subcription` 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 *\n * @class Subscriber<T>\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 * @nocollapse\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 {T} [value] The `next` value.\n * @return {void}\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 {any} [err] The `error` exception.\n * @return {void}\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 * @return {void}\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","/** Symbol.observable or a string \"@@observable\". Used for interop */\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 *\n * @class Observable<T>\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 * @constructor\n * @param {Function} subscribe the function that is called when the Observable is\n * initially subscribed to. This function is given a Subscriber, to which new values\n * can be `next`ed, or an `error` method can be called to raise an error, or\n * `complete` can be called to notify of a successful completion.\n */\n constructor(subscribe?: (this: Observable<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 * @owner Observable\n * @method create\n * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor\n * @return {Observable} a new observable\n * @nocollapse\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 * @method lift\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(observer?: Partial<Observer<T>>): Subscription;\n subscribe(next: (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 {Observer|Function} observerOrNext (optional) Either an observer with methods to be called,\n * or the first of three possible handlers, which is the handler for each value emitted from the subscribed\n * Observable.\n * @param {Function} error (optional) A handler for a terminal event resulting from an error. If no error handler is provided,\n * the error will be thrown asynchronously as unhandled.\n * @param {Function} complete (optional) A handler for a terminal event resulting from successful completion.\n * @return {Subscription} a subscription reference to the registered handlers\n * @method subscribe\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 * @method Symbol.observable\n * @return {Observable} this instance of the observable\n */\n [Symbol_observable]() {\n return this;\n }\n\n /* tslint:disable:max-line-length */\n pipe(): Observable<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 * @method pipe\n * @return {Observable} the Observable result of all of the operators having\n * been called in the order they were passed in.\n *\n * ## Example\n *\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 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 * @method toPromise\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 { 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 { 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 { 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 *\n * @class Action<T>\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 {T} [state] Some contextual data that the `work` function uses when\n * called by the Scheduler.\n * @param {number} [delay] Time to wait before executing the work, where the\n * time unit is implicit and defined by the Scheduler.\n * @return {void}\n */\n public schedule(state?: T, delay: number = 0): Subscription {\n return this;\n }\n}\n","import 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';\n\nexport class AsyncAction<T> extends Action<T> {\n public id: any;\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?: any, delay: number = 0): any {\n return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);\n }\n\n protected recycleAsyncId(_scheduler: AsyncScheduler, id: any, delay: number | null = 0): any {\n // If this action is rescheduled with the same delay time, don't clear the interval id.\n if (delay != null && this.delay === delay && this.pending === false) {\n return id;\n }\n // Otherwise, if the action's delay time is different from the current delay,\n // or the action has been rescheduled before it's executed, clear the interval id\n intervalProvider.clearInterval(id);\n return undefined;\n }\n\n /**\n * Immediately executes this action and the `work` it contains.\n * @return {any}\n */\n public execute(state: T, delay: number): any {\n 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","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 { 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 * @class Scheduler\n * @deprecated Scheduler is an internal implementation detail of RxJS, and\n * should not be used directly. Rather, create your own class and implement\n * {@link SchedulerLike}. 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 {number} A number that represents the current time. May or may not\n * have a relation to wall-clock time. May or may not refer to a time unit\n * (e.g. milliseconds).\n */\n public now: () => number;\n\n /**\n * Schedules a function, `work`, for execution. May happen at some point in\n * the future, according to the `delay` parameter, if specified. May be passed\n * some context object, `state`, which will be passed to the `work` function.\n *\n * The given arguments will be processed an stored as an Action object in a\n * queue of actions.\n *\n * @param {function(state: ?T): ?Subscription} work A function representing a\n * task, or some unit of work to be executed by the Scheduler.\n * @param {number} [delay] Time to wait before executing the work, where the\n * time unit is implicit and defined by the Scheduler itself.\n * @param {T} [state] Some contextual data that the `work` function uses when\n * called by the Scheduler.\n * @return {Subscription} A subscription in order to be able to unsubscribe\n * the scheduled work.\n */\n public schedule<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';\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 * @type {boolean}\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 * @type {any}\n * @internal\n */\n public _scheduled: any = 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\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 { SchedulerLike } from '../types';\nimport { isFunction } from './isFunction';\n\nexport function isScheduler(value: any): value is SchedulerLike {\n return value && isFunction(value.schedule);\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 { 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 { 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","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","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\n/* tslint:disable:max-line-length */\nexport function catchError<T, O extends ObservableInput<any>>(\n selector: (err: any, caught: Observable<T>) => O\n): OperatorFunction<T, T | ObservedValueOf<O>>;\n/* tslint:enable:max-line-length */\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 * \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 {function} 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. Whatever observable\n * 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","/** @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 * \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 * \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 {ObservableInput<T>} A subscription object, a Promise, an Observable-like,\n * an Array, an iterable, or an array-like object to be converted.\n * @param {SchedulerLike} An optional {@link SchedulerLike} on which to schedule the emission of values.\n * @return {Observable<T>}\n */\nexport function from<T>(input: ObservableInput<T>, scheduler?: SchedulerLike): Observable<T> {\n return scheduler ? scheduled(input, scheduler) : innerFrom(input);\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 * \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 {function(value: T, index: number): R} project The function to apply\n * to each `value` emitted by the source Observable. The `index` parameter is\n * the number `i` for the i-th emission that has happened since the\n * subscription, starting from the number `0`.\n * @param {any} [thisArg] An optional argument to define what `this` is in the\n * `project` function.\n * @return 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 { 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 * \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 {function(value: T, ?index: number): ObservableInput} project A function\n * that, when applied to an item emitted by the source Observable, returns an\n * Observable.\n * @param {number} [concurrent=Infinity] Maximum number of input\n * Observables 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 * \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 {number} [concurrent=Infinity] Maximum number of inner\n * Observables being subscribed to 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 * \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 { 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 * \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 {number} dueTime The timeout duration in milliseconds (or the time\n * unit determined internally by the optional `scheduler`) for the window of\n * time required to wait for emission silence before emitting the most recent\n * source value.\n * @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for\n * managing the timers that 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 { 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 * \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 Input Observables to concatenate.\n */\nexport function concat(...args: any[]): Observable<unknown> {\n return concatAll()(from(args, popScheduler(args)));\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 * \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 { 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 * \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 * \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’ `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 * \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 } from '../types';\nimport { concat } from '../observable/concat';\nimport { take } from './take';\nimport { ignoreElements } from './ignoreElements';\nimport { mapTo } from './mapTo';\nimport { mergeMap } from './mergeMap';\n\n/** @deprecated The `subscriptionDelay` parameter will be removed in v8. */\nexport function delayWhen<T>(\n delayDurationSelector: (value: T, index: number) => Observable<any>,\n subscriptionDelay: Observable<any>\n): MonoTypeOperatorFunction<T>;\nexport function delayWhen<T>(delayDurationSelector: (value: T, index: number) => Observable<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 * \n *\n * `delayWhen` time shifts each emitted value from the source Observable by a\n * time span determined by another Observable. When the source emits a value,\n * the `delayDurationSelector` function is called with the source value as\n * argument, and should return an Observable, called the \"duration\" Observable.\n * The source value is emitted on the output Observable only when the duration\n * Observable emits a value or completes.\n * The completion of the notifier triggering the emission of the source value\n * is deprecated behavior and will be removed in future versions.\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 {function(value: T, index: number): Observable} delayDurationSelector A function that\n * returns an Observable for each value emitted by the source Observable, which\n * is then used to delay the emission of that item on the output Observable\n * until the Observable returned from this function emits a value.\n * @param {Observable} subscriptionDelay An Observable that triggers the\n * subscription to the 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) => Observable<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) => 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 * \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 {number|Date} due The delay duration in milliseconds (a `number`) or\n * a `Date` until which the emission of the source items is delayed.\n * @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for\n * managing the timers 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 { 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 { 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 * \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 { 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 * \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 {Number} 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 { 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 * \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.</span>\n *\n * \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 {function(value: T, index: number): ObservableInput} project A function\n * that, when applied to an item emitted by the source Observable, returns an\n * Observable.\n * @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 subcriber 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 { MonoTypeOperatorFunction, Observer } from '../types';\nimport { isFunction } from '../util/isFunction';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { identity } from '../util/identity';\n\nexport interface TapObserver<T> extends Observer<T> {\n subscribe: () => void;\n unsubscribe: () => void;\n finalize: () => void;\n}\n\nexport function tap<T>(observer?: Partial<TapObserver<T>>): MonoTypeOperatorFunction<T>;\nexport function tap<T>(next: (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 * \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 Observable#subscribe}\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 { DexieCloudDB } from '../db/DexieCloudDB';\n\n//const hasSW = 'serviceWorker' in navigator;\nlet hasComplainedAboutSyncEvent = false;\n\nexport async function registerSyncEvent(db: DexieCloudDB, purpose: \"push\" | \"pull\") {\n try {\n // Send sync event to SW:\n const sw: ServiceWorkerRegistration & {sync?: any} = await navigator.serviceWorker.ready;\n if (purpose === \"push\" && sw.sync) {\n await sw.sync.register(`dexie-cloud:${db.name}`);\n }\n if (sw.active) {\n // Use postMessage for pull syncs and for browsers not supporting sync event (Firefox, Safari).\n // Also chromium based browsers with sw.sync as a fallback for sleepy sync events not taking action for a while.\n sw.active.postMessage({\n type: 'dexie-cloud-sync',\n dbName: db.name,\n purpose\n });\n } else {\n throw new Error(`Failed to trigger sync - there's no active service worker`);\n }\n return;\n } catch (e) {\n if (!hasComplainedAboutSyncEvent) {\n console.debug(`Dexie Cloud: Could not register sync event`, e);\n hasComplainedAboutSyncEvent = true;\n }\n }\n}\n\nexport async function registerPeriodicSyncEvent(db: DexieCloudDB) {\n try {\n // Register periodicSync event to SW:\n // @ts-ignore\n const { periodicSync } = await navigator.serviceWorker.ready;\n if (periodicSync) {\n try {\n await periodicSync.register(\n `dexie-cloud:${db.name}`,\n db.cloud.options?.periodicSync\n );\n console.debug(\n `Dexie Cloud: Successfully registered periodicsync event for ${db.name}`\n );\n } catch (e) {\n console.debug(`Dexie Cloud: Failed to register periodic sync. Your PWA must be installed to allow background sync.`, e);\n }\n } else {\n console.debug(`Dexie Cloud: periodicSync not supported.`);\n }\n } catch (e) {\n console.debug(\n `Dexie Cloud: Could not register periodicSync for ${db.name}`,\n e\n );\n }\n}\n","import { DexieCloudDB } from \"../db/DexieCloudDB\";\nimport { registerSyncEvent } from \"./registerSyncEvent\";\n\nexport function triggerSync(db: DexieCloudDB, purpose: \"push\" | \"pull\") {\n if (db.cloud.usingServiceWorker) {\n console.debug('registering sync event');\n registerSyncEvent(db, purpose);\n } else {\n db.localSyncEvent.next({purpose});\n }\n}","export const b64decode = typeof Buffer !== \"undefined\"\n ? (base64) => Buffer.from(base64, \"base64\")\n : (base64) => {\n const binary_string = atob(base64);\n const len = binary_string.length;\n const bytes = new Uint8Array(len);\n for (var i = 0; i < len; i++) {\n bytes[i] = binary_string.charCodeAt(i);\n }\n return bytes;\n };\nexport const b64encode = typeof Buffer !== \"undefined\"\n ? (b) => {\n if (ArrayBuffer.isView(b)) {\n return Buffer.from(b.buffer, b.byteOffset, b.byteLength).toString(\"base64\");\n }\n else {\n return Buffer.from(b).toString(\"base64\");\n }\n }\n : (b) => {\n return btoa(String.fromCharCode.apply(null, ArrayBuffer.isView(b) ? b : new Uint8Array(b)));\n };\n","import { TokenErrorResponse } from 'dexie-cloud-common';\n\nexport class TokenErrorResponseError extends Error {\n title: string;\n messageCode:\n | 'INVALID_OTP'\n | 'INVALID_EMAIL'\n | 'LICENSE_LIMIT_REACHED'\n | 'GENERIC_ERROR';\n message: string;\n messageParams?: { [param: string]: string };\n\n constructor({\n title,\n message,\n messageCode,\n messageParams,\n }: TokenErrorResponse) {\n super(message);\n this.name = 'TokenErrorResponseError';\n this.title = title;\n this.messageCode = messageCode;\n this.messageParams = messageParams;\n }\n}\n","import Dexie from 'dexie';\nimport { BehaviorSubject } from 'rxjs';\nimport { take } from 'rxjs/operators';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { DXCAlert } from '../types/DXCAlert';\nimport { DXCInputField } from '../types/DXCInputField';\nimport { DXCUserInteraction } from '../types/DXCUserInteraction';\n\nexport interface DXCUserInteractionRequest {\n type: DXCUserInteraction['type'];\n title: string;\n alerts: DXCAlert[];\n submitLabel?: string;\n cancelLabel?: string | null;\n fields: { [name: string]: DXCInputField };\n}\n\nexport function interactWithUser<T extends DXCUserInteractionRequest>(\n userInteraction: BehaviorSubject<DXCUserInteraction | undefined>,\n req: T\n): Promise<{\n [P in keyof T['fields']]: string;\n}> {\n let done = false;\n return new Promise<{\n [P in keyof T['fields']]: string;\n }>((resolve, reject) => {\n const interactionProps = {\n submitLabel: 'Submit',\n cancelLabel: 'Cancel',\n ...req,\n onSubmit: (res: {\n [P in keyof T['fields']]: string;\n }) => {\n userInteraction.next(undefined);\n done = true;\n resolve(res);\n },\n onCancel: () => {\n userInteraction.next(undefined);\n done = true;\n reject(new Dexie.AbortError('User cancelled'));\n },\n } as DXCUserInteraction;\n userInteraction.next(interactionProps);\n // Start subscribing for external updates to db.cloud.userInteraction, and if so, cancel this request.\n /*const subscription = userInteraction.subscribe((currentInteractionProps) => {\n if (currentInteractionProps !== interactionProps) {\n if (subscription) subscription.unsubscribe();\n if (!done) {\n reject(new Dexie.AbortError(\"User cancelled\"));\n }\n }\n });*/\n });\n}\n\nexport function alertUser(\n userInteraction: BehaviorSubject<DXCUserInteraction | undefined>,\n title: string,\n ...alerts: DXCAlert[]\n) {\n return interactWithUser(userInteraction, {\n type: 'message-alert',\n title,\n alerts,\n fields: {},\n submitLabel: 'OK',\n cancelLabel: null,\n });\n}\n\nexport async function promptForEmail(\n userInteraction: BehaviorSubject<DXCUserInteraction | undefined>,\n title: string,\n emailHint?: string\n) {\n let email = emailHint || '';\n while (!email || !/^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,10}$/.test(email)) {\n email = (\n await interactWithUser(userInteraction, {\n type: 'email',\n title,\n alerts: email\n ? [\n {\n type: 'error',\n messageCode: 'INVALID_EMAIL',\n message: 'Please enter a valid email address',\n messageParams: {},\n },\n ]\n : [],\n fields: {\n email: {\n type: 'email',\n placeholder: 'you@somedomain.com',\n },\n },\n })\n ).email;\n }\n return email;\n}\n\nexport async function promptForOTP(\n userInteraction: BehaviorSubject<DXCUserInteraction | undefined>,\n email: string,\n alert?: DXCAlert\n) {\n const alerts: DXCAlert[] = [\n {\n type: 'info',\n messageCode: 'OTP_SENT',\n message: `A One-Time password has been sent to {email}`,\n messageParams: { email },\n },\n ];\n if (alert) {\n alerts.push(alert);\n }\n const { otp } = await interactWithUser(userInteraction, {\n type: 'otp',\n title: 'Enter OTP',\n alerts,\n fields: {\n otp: {\n type: 'otp',\n label: 'OTP',\n placeholder: 'Paste OTP here',\n },\n },\n });\n return otp;\n}\n\nexport async function confirmLogout(\n userInteraction: BehaviorSubject<DXCUserInteraction | undefined>,\n currentUserId: string,\n numUnsyncedChanges: number\n) {\n const alerts: DXCAlert[] = [\n {\n type: 'warning',\n messageCode: 'LOGOUT_CONFIRMATION',\n message: `{numUnsyncedChanges} unsynced changes will get lost!\n Logout anyway?`,\n messageParams: {\n currentUserId,\n numUnsyncedChanges: numUnsyncedChanges.toString(),\n }\n },\n ];\n return await interactWithUser(userInteraction, {\n type: 'logout-confirmation',\n title: 'Confirm Logout',\n alerts,\n fields: {},\n submitLabel: 'Confirm logout',\n cancelLabel: 'Cancel'\n })\n .then(() => true)\n .catch(() => false);\n}\n","import Dexie from 'dexie';\nimport type {\n RefreshTokenRequest,\n TokenErrorResponse,\n TokenFinalResponse,\n} from 'dexie-cloud-common';\nimport { b64encode } from 'dreambase-library/dist/common/base64';\nimport { BehaviorSubject } from 'rxjs';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { UserLogin } from '../db/entities/UserLogin';\nimport { DXCAlert } from '../types/DXCAlert';\nimport {\n DXCMessageAlert,\n DXCUserInteraction,\n} from '../types/DXCUserInteraction';\nimport { TokenErrorResponseError } from './TokenErrorResponseError';\nimport { alertUser, interactWithUser } from './interactWithUser';\nimport { InvalidLicenseError } from '../InvalidLicenseError';\n\nexport type FetchTokenCallback = (tokenParams: {\n public_key: string;\n hints?: { userId?: string; email?: string; grant_type?: string };\n}) => Promise<TokenFinalResponse | TokenErrorResponse>;\n\nexport async function loadAccessToken(\n db: DexieCloudDB\n): Promise<UserLogin | null> {\n const currentUser = await db.getCurrentUser();\n const {\n accessToken,\n accessTokenExpiration,\n refreshToken,\n refreshTokenExpiration,\n claims,\n } = currentUser;\n if (!accessToken) return null;\n const expTime = accessTokenExpiration?.getTime() ?? Infinity;\n if (expTime > Date.now() && (currentUser.license?.status || 'ok') === 'ok') {\n return currentUser;\n }\n if (!refreshToken) {\n throw new Error(`Refresh token missing`);\n }\n const refreshExpTime = refreshTokenExpiration?.getTime() ?? Infinity;\n if (refreshExpTime <= Date.now()) {\n throw new Error(`Refresh token has expired`);\n }\n const refreshedLogin = await refreshAccessToken(\n db.cloud.options!.databaseUrl,\n currentUser\n );\n await db.table('$logins').update(claims.sub, {\n accessToken: refreshedLogin.accessToken,\n accessTokenExpiration: refreshedLogin.accessTokenExpiration,\n claims: refreshedLogin.claims,\n license: refreshedLogin.license,\n });\n return refreshedLogin;\n}\n\nexport async function authenticate(\n url: string,\n context: UserLogin,\n fetchToken: FetchTokenCallback,\n userInteraction: BehaviorSubject<DXCUserInteraction | undefined>,\n hints?: { userId?: string; email?: string; grant_type?: string }\n): Promise<UserLogin> {\n if (\n context.accessToken &&\n context.accessTokenExpiration!.getTime() > Date.now()\n ) {\n return context;\n } else if (\n context.refreshToken &&\n (!context.refreshTokenExpiration ||\n context.refreshTokenExpiration.getTime() > Date.now())\n ) {\n return await refreshAccessToken(url, context);\n } else {\n return await userAuthenticate(context, fetchToken, userInteraction, hints);\n }\n}\n\nexport async function refreshAccessToken(\n url: string,\n login: UserLogin\n): Promise<UserLogin> {\n if (!login.refreshToken)\n throw new Error(`Cannot refresh token - refresh token is missing.`);\n if (!login.nonExportablePrivateKey)\n throw new Error(\n `login.nonExportablePrivateKey is missing - cannot sign refresh token without a private key.`\n );\n\n const time_stamp = Date.now();\n const signing_algorithm = 'RSASSA-PKCS1-v1_5';\n const textEncoder = new TextEncoder();\n const data = textEncoder.encode(login.refreshToken + time_stamp);\n const binarySignature = await crypto.subtle.sign(\n signing_algorithm,\n login.nonExportablePrivateKey,\n data\n );\n const signature = b64encode(binarySignature);\n\n const tokenRequest: RefreshTokenRequest = {\n grant_type: 'refresh_token',\n refresh_token: login.refreshToken,\n scopes: ['ACCESS_DB'],\n signature,\n signing_algorithm,\n time_stamp,\n };\n const res = await fetch(`${url}/token`, {\n body: JSON.stringify(tokenRequest),\n method: 'post',\n headers: { 'Content-Type': 'application/json' },\n mode: 'cors',\n });\n if (res.status !== 200)\n throw new Error(`RefreshToken: Status ${res.status} from ${url}/token`);\n const response: TokenFinalResponse | TokenErrorResponse = await res.json();\n if (response.type === 'error') {\n throw new TokenErrorResponseError(response);\n }\n login.accessToken = response.accessToken;\n login.accessTokenExpiration = response.accessTokenExpiration\n ? new Date(response.accessTokenExpiration)\n : undefined;\n login.claims = response.claims;\n login.license = {\n type: response.userType,\n status: response.claims.license || 'ok',\n }\n if (response.evalDaysLeft != null) {\n login.license.evalDaysLeft = response.evalDaysLeft;\n }\n if (response.userValidUntil != null) {\n login.license.validUntil = new Date(response.userValidUntil);\n }\n return login;\n}\n\nasync function userAuthenticate(\n context: UserLogin,\n fetchToken: FetchTokenCallback,\n userInteraction: BehaviorSubject<DXCUserInteraction | undefined>,\n hints?: { userId?: string; email?: string; grant_type?: string }\n) {\n if (!crypto.subtle) {\n if (typeof location !== 'undefined' && location.protocol === 'http:') {\n throw new Error(`Dexie Cloud Addon needs to use WebCrypto, but your browser has disabled it due to being served from an insecure location. Please serve it from https or http://localhost:<port> (See https://stackoverflow.com/questions/46670556/how-to-enable-crypto-subtle-for-unsecure-origins-in-chrome/46671627#46671627)`);\n } else {\n throw new Error(`This browser does not support WebCrypto.`);\n }\n }\n const { privateKey, publicKey } = await crypto.subtle.generateKey(\n {\n name: 'RSASSA-PKCS1-v1_5',\n modulusLength: 2048,\n publicExponent: new Uint8Array([0x01, 0x00, 0x01]),\n hash: { name: 'SHA-256' },\n },\n false, // Non-exportable...\n ['sign', 'verify']\n );\n if (!privateKey || !publicKey)\n throw new Error(`Could not generate RSA keypair`); // Typings suggest these can be undefined...\n context.nonExportablePrivateKey = privateKey; //...but storable!\n const publicKeySPKI = await crypto.subtle.exportKey('spki', publicKey);\n const publicKeyPEM = spkiToPEM(publicKeySPKI);\n context.publicKey = publicKey;\n\n try {\n const response2 = await fetchToken({\n public_key: publicKeyPEM,\n hints,\n });\n\n if (response2.type === 'error') {\n throw new TokenErrorResponseError(response2);\n }\n\n if (response2.type !== 'tokens')\n throw new Error(\n `Unexpected response type from token endpoint: ${(response2 as any).type}`\n );\n\n /*const licenseStatus = response2.claims.license || 'ok';\n if (licenseStatus !== 'ok') {\n throw new InvalidLicenseError(licenseStatus);\n }*/\n\n context.accessToken = response2.accessToken;\n context.accessTokenExpiration = new Date(response2.accessTokenExpiration);\n context.refreshToken = response2.refreshToken;\n if (response2.refreshTokenExpiration) {\n context.refreshTokenExpiration = new Date(\n response2.refreshTokenExpiration\n );\n }\n context.userId = response2.claims.sub;\n context.email = response2.claims.email;\n context.name = response2.claims.name;\n context.claims = response2.claims;\n context.license = {\n type: response2.userType,\n status: response2.claims.license || 'ok',\n }\n if (response2.evalDaysLeft != null) {\n context.license.evalDaysLeft = response2.evalDaysLeft;\n }\n if (response2.userValidUntil != null) {\n context.license.validUntil = new Date(response2.userValidUntil);\n }\n\n if (response2.alerts && response2.alerts.length > 0) {\n await interactWithUser(userInteraction, {\n type: 'message-alert',\n title: 'Authentication Alert',\n fields: {},\n alerts: response2.alerts as DXCAlert[],\n });\n }\n return context;\n } catch (error) {\n if (error instanceof TokenErrorResponseError) {\n await alertUser(userInteraction, error.title, {\n type: 'error',\n messageCode: error.messageCode,\n message: error.message,\n messageParams: {},\n });\n throw error;\n }\n let message = `We're having a problem authenticating right now.`;\n console.error (`Error authenticating`, error);\n if (error instanceof TypeError) {\n const isOffline = typeof navigator !== undefined && !navigator.onLine;\n if (isOffline) {\n message = `You seem to be offline. Please connect to the internet and try again.`;\n } else if (Dexie.debug || (typeof location !== 'undefined' && (location.hostname === 'localhost' || location.hostname === '127.0.0.1'))) {\n // The audience is most likely the developer. Suggest to whitelist the localhost origin:\n message = `Could not connect to server. Please verify that your origin '${location.origin}' is whitelisted using \\`npx dexie-cloud whitelist\\``;\n } else {\n message = `Could not connect to server. Please verify the connection.`;\n }\n await alertUser(userInteraction, 'Authentication Failed', {\n type: 'error',\n messageCode: 'GENERIC_ERROR',\n message,\n messageParams: {},\n }).catch(() => {}); \n }\n\n throw error;\n }\n}\n\nfunction spkiToPEM(keydata: ArrayBuffer) {\n const keydataB64 = b64encode(keydata);\n const keydataB64Pem = formatAsPem(keydataB64);\n return keydataB64Pem;\n}\n\nfunction formatAsPem(str: string) {\n let finalString = '-----BEGIN PUBLIC KEY-----\\n';\n\n while (str.length > 0) {\n finalString += str.substring(0, 64) + '\\n';\n str = str.substring(64);\n }\n\n finalString = finalString + '-----END PUBLIC KEY-----';\n\n return finalString;\n}\n","import { DexieCloudDB } from \"../db/DexieCloudDB\";\nimport { UserLogin } from \"../db/entities/UserLogin\";\n\nexport interface AuthPersistedContext extends UserLogin {\n save(): Promise<void>;\n}\n\n// Emulate true-private property db. Why? So it's not stored in DB.\nconst wm = new WeakMap<AuthPersistedContext, DexieCloudDB>();\n\nexport class AuthPersistedContext {\n constructor(db: DexieCloudDB, userLogin: UserLogin) {\n wm.set(this, db);\n Object.assign(this, userLogin);\n }\n\n static load(db: DexieCloudDB, userId: string) {\n return db\n .table(\"$logins\")\n .get(userId)\n .then(\n (userLogin) => new AuthPersistedContext(db, userLogin || {\n userId,\n claims: {\n sub: userId\n },\n lastLogin: new Date(0)\n })\n );\n }\n\n async save() {\n const db = wm.get(this)!;\n db.table(\"$logins\").put(this);\n }\n}\n","import { UserLogin } from '../db/entities/UserLogin';\n\nexport const UNAUTHORIZED_USER: UserLogin = {\n userId: \"unauthorized\",\n name: \"Unauthorized\",\n claims: {\n sub: \"unauthorized\",\n },\n lastLogin: new Date(0)\n}\n\ntry {\n Object.freeze(UNAUTHORIZED_USER);\n Object.freeze(UNAUTHORIZED_USER.claims);\n} catch {}\n","import { filter, firstValueFrom, from, InteropObservable, Observable } from 'rxjs';\n\nexport function waitUntil<T>(\n o: Observable<T> | InteropObservable<T>, // Works with Dexie's liveQuery observables if we'd need that\n predicate: (value: T) => boolean\n) {\n return firstValueFrom(from(o).pipe(\n filter(predicate),\n ));\n}\n","import { DexieCloudDB } from '../db/DexieCloudDB';\nimport { TXExpandos } from '../types/TXExpandos';\nimport { confirmLogout } from './interactWithUser';\nimport { UNAUTHORIZED_USER } from './UNAUTHORIZED_USER';\nimport { waitUntil } from './waitUntil';\n\nexport async function logout(db: DexieCloudDB) {\n const numUnsyncedChanges = await _logout(db);\n if (numUnsyncedChanges) {\n if (\n await confirmLogout(\n db.cloud.userInteraction,\n db.cloud.currentUserId,\n numUnsyncedChanges\n )\n ) {\n await _logout(db, { deleteUnsyncedData: true });\n } else {\n throw new Error(`User cancelled logout due to unsynced changes`);\n }\n }\n}\n\nexport async function _logout(db: DexieCloudDB, { deleteUnsyncedData = false } = {}) {\n // Clear the database without emptying configuration options.\n const [numUnsynced, loggedOut] = await db.dx.transaction('rw', db.dx.tables, async (tx) => {\n // @ts-ignore\n const idbtrans: IDBTransaction & TXExpandos = tx.idbtrans;\n idbtrans.disableChangeTracking = true;\n idbtrans.disableAccessControl = true;\n const mutationTables = tx.storeNames.filter((tableName) =>\n tableName.endsWith('_mutations')\n );\n\n // Count unsynced changes\n const unsyncCounts = await Promise.all(\n mutationTables.map((mutationTable) => tx.table(mutationTable).count())\n );\n const sumUnSynced = unsyncCounts.reduce((a, b) => a + b, 0);\n\n if (sumUnSynced > 0 && !deleteUnsyncedData) {\n // Let caller ask user if they want to delete unsynced data.\n return [sumUnSynced, false];\n }\n \n // Either there are no unsynched changes, or caller provided flag deleteUnsynchedData = true.\n // Clear all tables except $jobs and $syncState (except the persisted sync state which is\n // also cleared because we're going to rebuild it using a fresh sync).\n db.$syncState.delete('syncState');\n for (const table of db.dx.tables) {\n if (table.name !== '$jobs' && table.name !== '$syncState') {\n table.clear();\n }\n }\n return [sumUnSynced, true];\n });\n\n if (loggedOut) {\n // Wait for currentUser observable to emit UNAUTHORIZED_USER\n await waitUntil(db.cloud.currentUser, (user) => user.userId === UNAUTHORIZED_USER.userId);\n // Then perform an initial sync\n await db.cloud.sync({purpose: 'pull', wait: true});\n }\n return numUnsynced;\n}\n","export class HttpError extends Error {\n httpStatus: number;\n constructor(\n res: Response,\n message?: string)\n {\n super(message || `${res.status} ${res.statusText}`);\n this.httpStatus = res.status;\n }\n\n get name() {\n return \"HttpError\";\n }\n}\n","import {\n TokenErrorResponse,\n TokenFinalResponse,\n TokenRequest,\n TokenResponse,\n} from 'dexie-cloud-common';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { HttpError } from '../errors/HttpError';\nimport { FetchTokenCallback } from './authenticate';\nimport { alertUser, promptForEmail, promptForOTP } from './interactWithUser';\n\nexport function otpFetchTokenCallback(db: DexieCloudDB): FetchTokenCallback {\n const { userInteraction } = db.cloud;\n return async function otpAuthenticate({ public_key, hints }) {\n let tokenRequest: TokenRequest;\n const url = db.cloud.options?.databaseUrl;\n if (!url) throw new Error(`No database URL given.`);\n if (hints?.grant_type === 'demo') {\n const demo_user = await promptForEmail(\n userInteraction,\n 'Enter a demo user email',\n hints?.email || hints?.userId\n );\n tokenRequest = {\n demo_user,\n grant_type: 'demo',\n scopes: ['ACCESS_DB'],\n public_key,\n };\n } else {\n const email = await promptForEmail(\n userInteraction,\n 'Enter email address',\n hints?.email\n );\n tokenRequest = {\n email,\n grant_type: 'otp',\n scopes: ['ACCESS_DB'],\n public_key,\n };\n }\n const res1 = await fetch(`${url}/token`, {\n body: JSON.stringify(tokenRequest),\n method: 'post',\n headers: { 'Content-Type': 'application/json', mode: 'cors' },\n });\n if (res1.status !== 200) {\n const errMsg = await res1.text();\n await alertUser(userInteraction, \"Token request failed\", {\n type: 'error',\n messageCode: 'GENERIC_ERROR',\n message: errMsg,\n messageParams: {}\n }).catch(()=>{});\n throw new HttpError(res1, errMsg);\n }\n const response: TokenResponse = await res1.json();\n if (response.type === 'tokens' || response.type === 'error') {\n // Demo user request can get a \"tokens\" response right away\n // Error can also be returned right away.\n return response;\n } else if (tokenRequest.grant_type === 'otp') {\n if (response.type !== 'otp-sent')\n throw new Error(`Unexpected response from ${url}/token`);\n const otp = await promptForOTP(userInteraction, tokenRequest.email);\n tokenRequest.otp = otp || '';\n tokenRequest.otp_id = response.otp_id;\n\n let res2 = await fetch(`${url}/token`, {\n body: JSON.stringify(tokenRequest),\n method: 'post',\n headers: { 'Content-Type': 'application/json' },\n mode: 'cors',\n });\n while (res2.status === 401) {\n const errorText = await res2.text();\n tokenRequest.otp = await promptForOTP(userInteraction, tokenRequest.email, {\n type: 'error',\n messageCode: 'INVALID_OTP',\n message: errorText,\n messageParams: {}\n });\n res2 = await fetch(`${url}/token`, {\n body: JSON.stringify(tokenRequest),\n method: 'post',\n headers: { 'Content-Type': 'application/json' },\n mode: 'cors',\n });\n }\n if (res2.status !== 200) {\n const errMsg = await res2.text();\n throw new HttpError(res2, errMsg);\n }\n const response2: TokenFinalResponse | TokenErrorResponse = await res2.json();\n return response2;\n } else {\n throw new Error(`Unexpected response from ${url}/token`);\n }\n };\n}\n","/** A way to log to console in production without terser stripping out\n * it from the release bundle.\n * This should be used very rarely and only in places where it's\n * absolutely necessary to log something in production.\n * \n * @param level \n * @param args \n */\nexport function prodLog(level: 'log' | 'warn' | 'error' | 'debug', ...args: any[]) {\n globalThis[\"con\"+\"sole\"][level](...args);\n}\n","import { DexieCloudDB } from '../db/DexieCloudDB';\nimport { prodLog } from '../prodLog';\nimport { AuthPersistedContext } from './AuthPersistedContext';\nimport { waitUntil } from './waitUntil';\n\n/** This function changes or sets the current user as requested.\n *\n * Use cases:\n * * Initially on db.ready after reading the current user from db.$logins.\n * This will make sure that any unsynced operations from the previous user is synced before\n * changing the user.\n * * Upon user request\n *\n * @param db\n * @param newUser\n */\nexport async function setCurrentUser(\n db: DexieCloudDB,\n user: AuthPersistedContext\n) {\n if (user.userId === db.cloud.currentUserId) return; // Already this user.\n\n const $logins = db.table('$logins');\n await db.transaction('rw', $logins, async (tx) => {\n const existingLogins = await $logins.toArray();\n await Promise.all(\n existingLogins\n .filter((login) => login.userId !== user.userId && login.isLoggedIn)\n .map((login) => {\n login.isLoggedIn = false;\n return $logins.put(login);\n })\n );\n user.isLoggedIn = true;\n user.lastLogin = new Date();\n try {\n await user.save();\n } catch (e) {\n try {\n if (e.name === 'DataCloneError') {\n // We've seen this buggy behavior in some browsers and in case it happens\n // again we really need to collect the details to understand what's going on.\n prodLog('debug', `Login context property names:`, Object.keys(user));\n prodLog('debug', `Login context property names:`, Object.keys(user));\n prodLog('debug', `Login context:`, user);\n prodLog('debug', `Login context JSON:`, JSON.stringify(user));\n }\n } catch {}\n throw e;\n } \n console.debug('Saved new user', user.email);\n });\n await waitUntil(db.cloud.currentUser, (currentUser) => currentUser.userId === user.userId);\n}","import { DexieCloudDB } from '../db/DexieCloudDB';\nimport { triggerSync } from '../sync/triggerSync';\nimport { authenticate, loadAccessToken } from './authenticate';\nimport { AuthPersistedContext } from './AuthPersistedContext';\nimport { logout } from './logout';\nimport { otpFetchTokenCallback } from './otpFetchTokenCallback';\nimport { setCurrentUser } from './setCurrentUser';\nimport { UNAUTHORIZED_USER } from './UNAUTHORIZED_USER';\n\nexport async function login(\n db: DexieCloudDB,\n hints?: { email?: string; userId?: string; grant_type?: string }\n) {\n const currentUser = await db.getCurrentUser();\n const origUserId = currentUser.userId;\n if (currentUser.isLoggedIn && (!hints || (!hints.email && !hints.userId))) {\n const licenseStatus = currentUser.license?.status || 'ok';\n if (licenseStatus === 'ok' && currentUser.accessToken && (!currentUser.accessTokenExpiration || currentUser.accessTokenExpiration.getTime() > Date.now())) {\n // Already authenticated according to given hints. And license is valid.\n return false;\n }\n if (currentUser.refreshToken && (!currentUser.refreshTokenExpiration || currentUser.refreshTokenExpiration.getTime() > Date.now())) {\n // Refresh the token\n await loadAccessToken(db);\n return false;\n }\n // No refresh token - must re-authenticate:\n }\n const context = new AuthPersistedContext(db, {\n claims: {},\n lastLogin: new Date(0),\n });\n await authenticate(\n db.cloud.options!.databaseUrl,\n context,\n db.cloud.options!.fetchTokens || otpFetchTokenCallback(db),\n db.cloud.userInteraction,\n hints\n );\n if (origUserId !== UNAUTHORIZED_USER.userId && context.userId !== origUserId) {\n // User was logged in before, but now logged in as another user.\n await logout(db);\n }\n\n /*try {\n await context.save();\n } catch (e) {\n try {\n if (e.name === 'DataCloneError') {\n console.debug(`Login context property names:`, Object.keys(context));\n console.debug(`Login context:`, context);\n console.debug(`Login context JSON:`, JSON.stringify(context));\n }\n } catch {}\n throw e;\n }*/\n await setCurrentUser(db, context);\n // Make sure to resync as the new login will be authorized\n // for new realms.\n triggerSync(db, \"pull\");\n return context.userId !== origUserId;\n}\n\n","const swHolder: { registration?: ServiceWorkerRegistration } = {};\nconst swContainer = typeof self !== 'undefined' && self.document && // self.document is to verify we're not the SW ourself\n typeof navigator !== 'undefined' && navigator.serviceWorker; \nif (swContainer)\n swContainer.ready.then(\n (registration) => (swHolder.registration = registration)\n );\n\nif (typeof self !== 'undefined' && 'clients' in self && !self.document) {\n // We are the service worker. Propagate messages to all our clients.\n addEventListener('message', (ev: any) => {\n if (ev.data?.type?.startsWith('sw-broadcast-')) {\n [...self['clients'].matchAll({ includeUncontrolled: true })].forEach(\n (client) => client.id !== ev.source?.id && client.postMessage(ev.data)\n );\n }\n });\n}\n\n/** This class is a fallback for browsers that lacks BroadcastChannel but have\n * service workers (which is Safari versions 11.1 through 15.3).\n * Safari 15.4 with BroadcastChannel was released on 2022-03-14.\n * We might be able to remove this class in a near future as Safari < 15.4 is\n * already very low in market share as of 2023-03-10.\n */\nexport class SWBroadcastChannel {\n name: string;\n constructor(name: string) {\n this.name = name;\n }\n subscribe(listener: (message: any) => void) {\n if (!swContainer) return () => {};\n const forwarder = (ev: MessageEvent) => {\n if (ev.data?.type === `sw-broadcast-${this.name}`) {\n listener(ev.data.message);\n }\n };\n swContainer.addEventListener('message', forwarder);\n return () => swContainer.removeEventListener('message', forwarder);\n }\n postMessage(message: any) {\n if (typeof self['clients'] === 'object') {\n // We're a service worker. Propagate to our browser clients.\n [...self['clients'].matchAll({ includeUncontrolled: true })].forEach(\n (client) =>\n client.postMessage({\n type: `sw-broadcast-${this.name}`,\n message,\n })\n );\n } else if (swHolder.registration) {\n // We're a client (browser window or other worker)\n // Post to SW so it can repost to all its clients and to itself\n swHolder.registration.active?.postMessage({\n type: `sw-broadcast-${this.name}`,\n message,\n });\n }\n }\n}\n","import { Observable } from \"rxjs\";\nimport { SWBroadcastChannel } from \"./SWBroadcastChannel\";\n\nconst events: Map<string, Array<(ev: CustomEvent)=>void>> =\n globalThis['lbc-events'] || (globalThis['lbc-events'] = new Map<string, Array<(ev: CustomEvent)=>void>>());\n\nfunction addListener(name: string, listener: (ev: CustomEvent)=>void) {\n if (events.has(name)) {\n events.get(name)!.push(listener);\n } else {\n events.set(name, [listener]);\n }\n}\nfunction removeListener(name: string, listener: (ev: CustomEvent)=>void) {\n const listeners = events.get(name);\n if (listeners) {\n const idx = listeners.indexOf(listener);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n }\n}\nfunction dispatch(ev: CustomEvent) {\n const listeners = events.get(ev.type);\n if (listeners) {\n listeners.forEach(listener => {\n try {\n listener(ev);\n } catch {\n }\n });\n }\n}\n\nexport class BroadcastedAndLocalEvent<T> extends Observable<T>{\n name: string;\n bc: BroadcastChannel | SWBroadcastChannel\n\n constructor(name: string) {\n const bc = typeof BroadcastChannel === \"undefined\"\n ? new SWBroadcastChannel(name) : new BroadcastChannel(name);\n super(subscriber => {\n function onCustomEvent(ev: CustomEvent) {\n subscriber.next(ev.detail);\n }\n function onMessageEvent(ev: MessageEvent) {\n console.debug(\"BroadcastedAndLocalEvent: onMessageEvent\", ev);\n subscriber.next(ev.data);\n }\n let unsubscribe: ()=>void;\n //self.addEventListener(`lbc-${name}`, onCustomEvent); // Fails in service workers\n addListener(`lbc-${name}`, onCustomEvent); // Works better in service worker\n\n try { \n if (bc instanceof SWBroadcastChannel) {\n unsubscribe = bc.subscribe(message => subscriber.next(message));\n } else {\n console.debug(\"BroadcastedAndLocalEvent: bc.addEventListener()\", name, \"bc is a\", bc);\n bc.addEventListener(\"message\", onMessageEvent);\n }\n } catch (err) {\n // Service workers might fail to subscribe outside its initial script.\n console.warn('Failed to subscribe to broadcast channel', err);\n }\n return () => {\n //self.removeEventListener(`lbc-${name}`, onCustomEvent);\n removeListener(`lbc-${name}`, onCustomEvent);\n if (bc instanceof SWBroadcastChannel) {\n unsubscribe!();\n } else {\n bc.removeEventListener(\"message\", onMessageEvent);\n }\n }\n });\n this.name = name;\n this.bc = bc;\n }\n\n next(message: T) {\n console.debug(\"BroadcastedAndLocalEvent: bc.postMessage()\", {...message}, \"bc is a\", this.bc);\n this.bc.postMessage(message);\n const ev = new CustomEvent(`lbc-${this.name}`, { detail: message });\n //self.dispatchEvent(ev);\n dispatch(ev);\n }\n}\n","import { PersistedSyncState } from '../db/entities/PersistedSyncState';\nimport { b64encode } from 'dreambase-library/dist/common/base64';\n\nexport async function computeRealmSetHash({\n realms,\n inviteRealms,\n}: PersistedSyncState) {\n const data = JSON.stringify(\n [\n ...realms.map((realmId) => ({ realmId, accepted: true })),\n ...inviteRealms.map((realmId) => ({ realmId, accepted: false })),\n ].sort((a, b) =>\n a.realmId < b.realmId ? -1 : a.realmId > b.realmId ? 1 : 0\n )\n );\n const byteArray = new TextEncoder().encode(data);\n const digestBytes = await crypto.subtle.digest('SHA-1', byteArray);\n const base64 = b64encode(digestBytes);\n return base64;\n}\n","import { IndexableType, Table } from \"dexie\";\nimport { DexieCloudDB } from \"../db/DexieCloudDB\";\nimport { EntityCommon } from \"../db/entities/EntityCommon\";\n\nexport function getSyncableTables(db: DexieCloudDB): Table<EntityCommon>[] {\n return Object.entries(db.cloud.schema || {})\n .filter(([, { markedForSync }]) => markedForSync)\n .map(([tbl]) => db.tables.filter(({name}) => name === tbl)[0])\n .filter(cloudTableSchema => cloudTableSchema);\n}\n","\n\nexport function getMutationTable(tableName: string) {\n return `$${tableName}_mutations`;\n}\n","\n\nexport function getTableFromMutationTable(mutationTable: string) {\n const tableName = /^\\$(.*)_mutations$/.exec(mutationTable)?.[1];\n if (!tableName) throw new Error(`Given mutationTable ${mutationTable} is not correct`);\n return tableName;\n}\n","const concat = [].concat;\nexport function flatten<T>(a: (T | T[])[]): T[] {\n return concat.apply([], a);\n}\n","import { Table } from 'dexie';\nimport { getTableFromMutationTable } from '../helpers/getTableFromMutationTable';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { DBOperation, DBOperationsSet } from 'dexie-cloud-common';\nimport { flatten } from '../helpers/flatten';\n\nexport async function listClientChanges(\n mutationTables: Table[],\n db: DexieCloudDB,\n { since = {} as { [table: string]: number }, limit = Infinity } = {}\n): Promise<DBOperationsSet> {\n const allMutsOnTables = await Promise.all(\n mutationTables.map(async (mutationTable) => {\n const tableName = getTableFromMutationTable(mutationTable.name);\n const lastRevision = since[tableName];\n\n let query = lastRevision\n ? mutationTable.where('rev').above(lastRevision)\n : mutationTable;\n\n if (limit < Infinity) query = query.limit(limit);\n\n const muts: DBOperation[] = await query.toArray();\n\n //const objTable = db.table(tableName);\n /*for (const mut of muts) {\n if (mut.type === \"insert\" || mut.type === \"upsert\") {\n mut.values = await objTable.bulkGet(mut.keys);\n }\n }*/\n return muts.map((mut) => ({\n table: tableName,\n mut,\n }));\n })\n );\n\n // Sort by time to get a true order of the operations (between tables)\n const sorted = flatten(allMutsOnTables).sort((a, b) => a.mut.txid === b.mut.txid\n ? a.mut.opNo! - b.mut.opNo! // Within same transaction, sort by opNo\n : a.mut.ts! - b.mut.ts! // Different transactions - sort by timestamp when mutation resolved\n );\n const result: DBOperationsSet = [];\n let currentEntry: {\n table: string;\n muts: DBOperation[];\n } | null = null;\n let currentTxid: string | null = null;\n for (const { table, mut } of sorted) {\n if (\n currentEntry &&\n currentEntry.table === table &&\n currentTxid === mut.txid\n ) {\n currentEntry.muts.push(mut);\n } else {\n currentEntry = {\n table,\n muts: [mut],\n };\n currentTxid = mut.txid!;\n result.push(currentEntry);\n }\n }\n\n // Filter out those tables that doesn't have any mutations:\n return result;\n}\n","export function randomString(bytes: number) {\n const buf = new Uint8Array(bytes);\n if (typeof crypto !== 'undefined') {\n crypto.getRandomValues(buf);\n } else {\n for (let i = 0; i < bytes; i++) buf[i] = Math.floor(Math.random() * 256);\n }\n if (typeof Buffer !== 'undefined' && Buffer.from) {\n return Buffer.from(buf).toString('base64');\n } else if (typeof btoa !== 'undefined') {\n return btoa(String.fromCharCode.apply(null, buf));\n } else {\n throw new Error('No btoa or Buffer available');\n }\n}\n","import { UserLogin } from '../db/entities/UserLogin';\nimport { randomString } from '../helpers/randomString';\nimport { EntityCommon } from '../db/entities/EntityCommon';\nimport { Table } from 'dexie';\nimport {\n DBOperationsSet,\n DBUpsertOperation,\n DexieCloudSchema,\n isValidAtID,\n isValidSyncableID,\n} from 'dexie-cloud-common';\n\nexport async function listSyncifiedChanges(\n tablesToSyncify: Table<EntityCommon>[],\n currentUser: UserLogin,\n schema: DexieCloudSchema,\n alreadySyncedRealms?: string[]\n): Promise<DBOperationsSet> {\n const txid = `upload-${randomString(8)}`;\n if (currentUser.isLoggedIn) {\n if (tablesToSyncify.length > 0) {\n const ignoredRealms = new Set(alreadySyncedRealms || []);\n const upserts = await Promise.all(\n tablesToSyncify.map(async (table) => {\n const { extractKey } = table.core.schema.primaryKey;\n if (!extractKey) return { table: table.name, muts: [] }; // Outbound tables are not synced.\n\n const dexieCloudTableSchema = schema[table.name];\n const query = dexieCloudTableSchema?.generatedGlobalId\n ? table.filter((item) => {\n const id = extractKey(item);\n return (\n !ignoredRealms.has(item.realmId || '') &&\n //(id[0] !== '#' || !!item.$ts) && // Private obj need no sync if not changed\n isValidAtID(extractKey(item), dexieCloudTableSchema?.idPrefix)\n );\n })\n : table.filter((item) => {\n const id = extractKey(item);\n\n return (\n !ignoredRealms.has(item.realmId || '') &&\n //(id[0] !== '#' || !!item.$ts) && // Private obj need no sync if not changed\n isValidSyncableID(id)\n );\n });\n const unsyncedObjects = await query.toArray();\n if (unsyncedObjects.length > 0) {\n const mut: DBUpsertOperation = {\n type: 'upsert',\n values: unsyncedObjects,\n keys: unsyncedObjects.map(extractKey),\n userId: currentUser.userId,\n txid,\n };\n return {\n table: table.name,\n muts: [mut],\n };\n } else {\n return {\n table: table.name,\n muts: [],\n };\n }\n })\n );\n return upserts.filter((op) => op.muts.length > 0);\n }\n }\n return [];\n}\n","import { getSyncableTables } from \"../helpers/getSyncableTables\";\nimport { DexieCloudDB } from \"../db/DexieCloudDB\";\nimport { PersistedSyncState } from \"../db/entities/PersistedSyncState\";\n\nexport function getTablesToSyncify(db: DexieCloudDB, syncState: PersistedSyncState | undefined) {\n const syncedTables = syncState?.syncedTables || [];\n const syncableTables = getSyncableTables(db);\n const tablesToSyncify = syncableTables.filter(\n (tbl) => !syncedTables.includes(tbl.name)\n );\n return tablesToSyncify;\n}\n","const { toString: toStr } = {};\nfunction getToStringTag(val) {\n return toStr.call(val).slice(8, -1);\n}\nexport function escapeDollarProps(value) {\n const keys = Object.keys(value);\n let dollarKeys = null;\n for (let i = 0, l = keys.length; i < l; ++i) {\n if (keys[i][0] === \"$\") {\n dollarKeys = dollarKeys || [];\n dollarKeys.push(keys[i]);\n }\n }\n if (!dollarKeys)\n return value;\n const clone = { ...value };\n for (const k of dollarKeys) {\n delete clone[k];\n }\n for (const k of dollarKeys) {\n clone[\"$\" + k] = value[k];\n }\n return clone;\n}\nconst ObjectDef = {\n replace: escapeDollarProps,\n};\nexport function TypesonSimplified(...typeDefsInputs) {\n const typeDefs = typeDefsInputs.reduce((p, c) => ({ ...p, ...c }), typeDefsInputs.reduce((p, c) => ({ ...c, ...p }), {}));\n const protoMap = new WeakMap();\n return {\n stringify(value, alternateChannel, space) {\n const json = JSON.stringify(value, function (key) {\n const realVal = this[key];\n const typeDef = getTypeDef(realVal);\n return typeDef\n ? typeDef.replace(realVal, alternateChannel, typeDefs)\n : realVal;\n }, space);\n return json;\n },\n parse(tson, alternateChannel) {\n const stack = [];\n return JSON.parse(tson, function (key, value) {\n //\n // Parent Part\n //\n const type = value === null || value === void 0 ? void 0 : value.$t;\n if (type) {\n const typeDef = typeDefs[type];\n value = typeDef\n ? typeDef.revive(value, alternateChannel, typeDefs)\n : value;\n }\n let top = stack[stack.length - 1];\n if (top && top[0] === value) {\n // Do what the kid told us to\n // Unescape dollar props\n value = { ...value };\n // Delete keys that children wanted us to delete\n for (const k of top[1])\n delete value[k];\n // Set keys that children wanted us to set\n for (const [k, v] of Object.entries(top[2])) {\n value[k] = v;\n }\n stack.pop();\n }\n //\n // Child part\n //\n if (value === undefined || (key[0] === \"$\" && key !== \"$t\")) {\n top = stack[stack.length - 1];\n let deletes;\n let mods;\n if (top && top[0] === this) {\n deletes = top[1];\n mods = top[2];\n }\n else {\n stack.push([this, (deletes = []), (mods = {})]);\n }\n if (key[0] === \"$\" && key !== \"$t\") {\n // Unescape props (also preserves undefined if this is a combo)\n deletes.push(key);\n mods[key.substr(1)] = value;\n }\n else {\n // Preserve undefined\n mods[key] = undefined;\n }\n }\n return value;\n });\n },\n };\n function getTypeDef(realVal) {\n const type = typeof realVal;\n switch (typeof realVal) {\n case \"object\":\n case \"function\": {\n // \"object\", \"function\", null\n if (realVal === null)\n return null;\n const proto = Object.getPrototypeOf(realVal);\n if (!proto)\n return ObjectDef;\n let typeDef = protoMap.get(proto);\n if (typeDef !== undefined)\n return typeDef; // Null counts to! So the caching of Array.prototype also counts.\n const toStringTag = getToStringTag(realVal);\n const entry = Object.entries(typeDefs).find(([typeName, typeDef]) => { var _a, _b; return (_b = (_a = typeDef === null || typeDef === void 0 ? void 0 : typeDef.test) === null || _a === void 0 ? void 0 : _a.call(typeDef, realVal, toStringTag)) !== null && _b !== void 0 ? _b : typeName === toStringTag; });\n typeDef = entry === null || entry === void 0 ? void 0 : entry[1];\n if (!typeDef) {\n typeDef = Array.isArray(realVal)\n ? null\n : typeof realVal === \"function\"\n ? typeDefs.function || null\n : ObjectDef;\n }\n protoMap.set(proto, typeDef);\n return typeDef;\n }\n default:\n return typeDefs[type];\n }\n }\n}\n","export const BisonBinaryTypes = {\n Blob: {\n test: (blob, toStringTag) => toStringTag === \"Blob\",\n replace: (blob, altChannel) => {\n const i = altChannel.length;\n altChannel.push(blob);\n return {\n $t: \"Blob\",\n mimeType: blob.type,\n i,\n };\n },\n revive: ({ i, mimeType }, altChannel) => new Blob([altChannel[i]], { type: mimeType }),\n },\n};\n","export default {\n number: {\n replace: (num) => {\n switch (true) {\n case isNaN(num):\n return { $t: \"number\", v: \"NaN\" };\n case num === Infinity:\n return { $t: \"number\", v: \"Infinity\" };\n case num === -Infinity:\n return { $t: \"number\", v: \"-Infinity\" };\n default:\n return num;\n }\n },\n revive: ({ v }) => Number(v),\n },\n};\n","const bigIntDef = {\n bigint: {\n replace: (realVal) => {\n return { $t: \"bigint\", v: \"\" + realVal };\n },\n revive: (obj) => BigInt(obj.v),\n },\n};\nexport default bigIntDef;\n","export default {\n Date: {\n replace: (date) => ({\n $t: \"Date\",\n v: isNaN(date.getTime()) ? \"NaN\" : date.toISOString(),\n }),\n revive: ({ v }) => new Date(v === \"NaN\" ? NaN : Date.parse(v)),\n },\n};\n","export default {\n Set: {\n replace: (set) => ({\n $t: \"Set\",\n v: Array.from(set.entries()),\n }),\n revive: ({ v }) => new Set(v),\n },\n};\n","export default {\n Map: {\n replace: (map) => ({\n $t: \"Map\",\n v: Array.from(map.entries()),\n }),\n revive: ({ v }) => new Map(v),\n },\n};\n","export const _global = typeof globalThis !== \"undefined\"\n ? globalThis\n : typeof self !== \"undefined\"\n ? self\n : typeof global === \"undefined\"\n ? global\n : this;\n","import { _global } from \"../../common/_global.js\";\nexport default [\n \"Int8Array\",\n \"Uint8Array\",\n \"Uint8ClampedArray\",\n \"Int16Array\",\n \"Uint16Array\",\n \"Int32Array\",\n \"Uint32Array\",\n \"Float32Array\",\n \"Float64Array\",\n \"DataView\",\n \"BigInt64Array\",\n \"BigUint64Array\",\n].reduce((specs, typeName) => ({\n ...specs,\n [typeName]: {\n // Replace passes the the typed array into $t, buffer so that\n // the ArrayBuffer typedef takes care of further handling of the buffer:\n // {$t:\"Uint8Array\",buffer:{$t:\"ArrayBuffer\",idx:0}}\n // CHANGED ABOVE! Now shortcutting that for more sparse format of the typed arrays\n // to contain the b64 property directly.\n replace: (a, _, typeDefs) => {\n const result = {\n $t: typeName,\n v: typeDefs.ArrayBuffer.replace(a.byteOffset === 0 && a.byteLength === a.buffer.byteLength\n ? a.buffer\n : a.buffer.slice(a.byteOffset, a.byteOffset + a.byteLength), _, typeDefs).v,\n };\n return result;\n },\n revive: ({ v }, _, typeDefs) => {\n const TypedArray = _global[typeName];\n return (TypedArray &&\n new TypedArray(typeDefs.ArrayBuffer.revive({ v }, _, typeDefs)));\n },\n },\n}), {});\n","import { b64decode, b64encode } from \"./base64.js\";\nexport function b64LexEncode(b) {\n return b64ToLex(b64encode(b));\n}\nexport function b64LexDecode(b64Lex) {\n return b64decode(lexToB64(b64Lex));\n}\nexport function b64ToLex(base64) {\n var encoded = \"\";\n for (var i = 0, length = base64.length; i < length; i++) {\n encoded += ENCODE_TABLE[base64[i]];\n }\n return encoded;\n}\nexport function lexToB64(base64lex) {\n // only accept string input\n if (typeof base64lex !== \"string\") {\n throw new Error(\"invalid decoder input: \" + base64lex);\n }\n var base64 = \"\";\n for (var i = 0, length = base64lex.length; i < length; i++) {\n base64 += DECODE_TABLE[base64lex[i]];\n }\n return base64;\n}\nconst DECODE_TABLE = {\n \"-\": \"=\",\n \"0\": \"A\",\n \"1\": \"B\",\n \"2\": \"C\",\n \"3\": \"D\",\n \"4\": \"E\",\n \"5\": \"F\",\n \"6\": \"G\",\n \"7\": \"H\",\n \"8\": \"I\",\n \"9\": \"J\",\n A: \"K\",\n B: \"L\",\n C: \"M\",\n D: \"N\",\n E: \"O\",\n F: \"P\",\n G: \"Q\",\n H: \"R\",\n I: \"S\",\n J: \"T\",\n K: \"U\",\n L: \"V\",\n M: \"W\",\n N: \"X\",\n O: \"Y\",\n P: \"Z\",\n Q: \"a\",\n R: \"b\",\n S: \"c\",\n T: \"d\",\n U: \"e\",\n V: \"f\",\n W: \"g\",\n X: \"h\",\n Y: \"i\",\n Z: \"j\",\n _: \"k\",\n a: \"l\",\n b: \"m\",\n c: \"n\",\n d: \"o\",\n e: \"p\",\n f: \"q\",\n g: \"r\",\n h: \"s\",\n i: \"t\",\n j: \"u\",\n k: \"v\",\n l: \"w\",\n m: \"x\",\n n: \"y\",\n o: \"z\",\n p: \"0\",\n q: \"1\",\n r: \"2\",\n s: \"3\",\n t: \"4\",\n u: \"5\",\n v: \"6\",\n w: \"7\",\n x: \"8\",\n y: \"9\",\n z: \"+\",\n \"|\": \"/\",\n};\nconst ENCODE_TABLE = {};\nfor (const c of Object.keys(DECODE_TABLE)) {\n ENCODE_TABLE[DECODE_TABLE[c]] = c;\n}\n","import { b64LexDecode, b64LexEncode } from \"../../common/b64lex.js\";\nexport default {\n ArrayBuffer: {\n replace: (ab) => ({\n $t: \"ArrayBuffer\",\n v: b64LexEncode(ab),\n }),\n revive: ({ v }) => {\n const ba = b64LexDecode(v);\n return ba.buffer.byteLength === ba.byteLength\n ? ba.buffer\n : ba.buffer.slice(ba.byteOffset, ba.byteOffset + ba.byteLength);\n },\n },\n};\n","export class FakeBlob {\n constructor(buf, type) {\n this.buf = buf;\n this.type = type;\n }\n}\n","export function readBlobSync(b) {\n const req = new XMLHttpRequest();\n req.overrideMimeType(\"text/plain; charset=x-user-defined\");\n req.open(\"GET\", URL.createObjectURL(b), false); // Sync\n req.send();\n if (req.status !== 200 && req.status !== 0) {\n throw new Error(\"Bad Blob access: \" + req.status);\n }\n return req.responseText;\n}\n","export function string2ArrayBuffer(str) {\n const array = new Uint8Array(str.length);\n for (let i = 0; i < str.length; ++i) {\n array[i] = str.charCodeAt(i); // & 0xff;\n }\n return array.buffer;\n}\nexport function arrayBuffer2String(buf) {\n // TODO: Optimize\n return new Uint8Array(buf).reduce((s, byte) => s + String.fromCharCode(byte), \"\");\n}\n","import { b64decode, b64encode } from \"../../common/base64.js\";\nimport { FakeBlob } from \"../FakeBlob.js\";\nimport { readBlobSync } from \"../readBlobSync.js\";\nimport { string2ArrayBuffer } from \"../string2arraybuffer.js\";\nexport default {\n Blob: {\n test: (blob, toStringTag) => toStringTag === \"Blob\" || blob instanceof FakeBlob,\n replace: (blob) => ({\n $t: \"Blob\",\n v: blob instanceof FakeBlob\n ? b64encode(blob.buf)\n : b64encode(string2ArrayBuffer(readBlobSync(blob))),\n type: blob.type,\n }),\n revive: ({ type, v }) => {\n const ab = b64decode(v);\n return typeof Blob !== undefined\n ? new Blob([ab])\n : new FakeBlob(ab.buffer, type);\n },\n },\n};\n","import numberDef from \"../types/number.js\";\nimport bigintDef from \"../types/bigint.js\";\nimport DateDef from \"../types/Date.js\";\nimport SetDef from \"../types/Set.js\";\nimport MapDef from \"../types/Map.js\";\nimport TypedArraysDefs from \"../types/TypedArray.js\";\nimport ArrayBufferDef from \"../types/ArrayBuffer.js\";\nimport BlobDef from \"../types/Blob.js\";\nconst builtin = {\n ...numberDef,\n ...bigintDef,\n ...DateDef,\n ...SetDef,\n ...MapDef,\n ...TypedArraysDefs,\n ...ArrayBufferDef,\n ...BlobDef, // Should be moved to another preset for DOM types (or universal? since it supports node as well with FakeBlob)\n};\nexport default builtin;\n","import { BisonBinaryTypes } from \"./BisonBinaryTypes.js\";\nimport builtin from \"./presets/builtin.js\";\nimport { TypesonSimplified } from \"./TypesonSimplified.js\";\nexport function Bison(...typeDefsInputs) {\n const tson = TypesonSimplified(builtin, BisonBinaryTypes, ...typeDefsInputs);\n return {\n toBinary(value) {\n const [blob, json] = this.stringify(value);\n const lenBuf = new ArrayBuffer(4);\n new DataView(lenBuf).setUint32(0, blob.size);\n return new Blob([lenBuf, blob, json]);\n },\n stringify(value) {\n const binaries = [];\n const json = tson.stringify(value, binaries);\n const blob = new Blob(binaries.map((b) => {\n const lenBuf = new ArrayBuffer(4);\n new DataView(lenBuf).setUint32(0, \"byteLength\" in b ? b.byteLength : b.size);\n return new Blob([lenBuf, b]);\n }));\n return [blob, json];\n },\n async parse(json, binData) {\n let pos = 0;\n const arrayBuffers = [];\n const buf = await readBlobBinary(binData);\n const view = new DataView(buf);\n while (pos < buf.byteLength) {\n const len = view.getUint32(pos);\n pos += 4;\n const ab = buf.slice(pos, pos + len);\n pos += len;\n arrayBuffers.push(ab);\n }\n return tson.parse(json, arrayBuffers);\n },\n async fromBinary(blob) {\n const len = new DataView(await readBlobBinary(blob.slice(0, 4))).getUint32(0);\n const binData = blob.slice(4, len + 4);\n const json = await readBlob(blob.slice(len + 4));\n return await this.parse(json, binData);\n },\n };\n}\nexport function readBlob(blob) {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onabort = (ev) => reject(new Error(\"file read aborted\"));\n reader.onerror = (ev) => reject(ev.target.error);\n reader.onload = (ev) => resolve(ev.target.result);\n reader.readAsText(blob);\n });\n}\nexport function readBlobBinary(blob) {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onabort = (ev) => reject(new Error(\"file read aborted\"));\n reader.onerror = (ev) => reject(ev.target.error);\n reader.onload = (ev) => resolve(ev.target.result);\n reader.readAsArrayBuffer(blob);\n });\n}\n","/** The undefined type is not part of builtin but can be manually added.\n * The reason for supporting undefined is if the following object should be revived correctly:\n *\n * {foo: undefined}\n *\n * Without including this typedef, the revived object would just be {}.\n * If including this typedef, the revived object would be {foo: undefined}.\n */\nexport default {\n undefined: {\n replace: () => ({\n $t: \"undefined\"\n }),\n revive: () => undefined,\n },\n};\n","import { TypesonSimplified } from 'dreambase-library/dist/typeson-simplified/TypesonSimplified';\nimport { Bison } from \"dreambase-library/dist/typeson-simplified/Bison\";\nimport undefinedDef from 'dreambase-library/dist/typeson-simplified/types/undefined.js';\nimport tsonBuiltinDefs from 'dreambase-library/dist/typeson-simplified/presets/builtin.js';\nimport { TypeDefSet } from 'dreambase-library/dist/typeson-simplified/TypeDefSet';\n\n// Since server revisions are stored in bigints, we need to handle clients without\n// bigint support to not fail when serverRevision is passed over to client.\n// We need to not fail when reviving it and we need to somehow store the information.\n// Since the revived version will later on be put into indexedDB we have another\n// issue: When reading it back from indexedDB we will get a poco object that we\n// cannot replace correctly when sending it to server. So we will also need\n// to do an explicit workaround in the protocol where a bigint is supported.\n// The workaround should be there regardless if browser supports BigInt or not, because\n// the serverRev might have been stored in IDB before the browser was upgraded to support bigint.\n//\n// if (typeof serverRev.rev !== \"bigint\")\n// if (hasBigIntSupport)\n// serverRev.rev = bigIntDef.bigint.revive(server.rev)\n// else\n// serverRev.rev = new FakeBigInt(server.rev)\nexport const hasBigIntSupport = typeof BigInt === 'function' && typeof BigInt(0) === 'bigint';\n\nfunction getValueOfBigInt(x: bigint | FakeBigInt | string) {\n if (typeof x === 'bigint') {\n return x;\n }\n if (hasBigIntSupport) {\n return typeof x === 'string' ? BigInt(x) : BigInt(x.v);\n } else {\n return typeof x === 'string' ? Number(x) : Number(x.v);\n }\n}\n\nexport function compareBigInts(a: bigint | FakeBigInt | string, b:bigint | FakeBigInt | string) {\n const valA = getValueOfBigInt(a);\n const valB = getValueOfBigInt(b);\n return valA < valB ? -1 : valA > valB ? 1 : 0;\n}\nexport class FakeBigInt {\n v: string;\n toString() {\n return this.v;\n }\n constructor(value: string) {\n this.v = value;\n }\n}\n\nconst defs: TypeDefSet = {\n ...undefinedDef,\n ...(hasBigIntSupport\n ? {}\n : {\n bigint: {\n test: (val: any) => val instanceof FakeBigInt,\n replace: (fakeBigInt: any) => {\n return {\n $t: 'bigint',\n ...fakeBigInt\n };\n },\n revive: ({\n v,\n }: {\n $t: 'bigint';\n v: string;\n }) => new FakeBigInt(v) as any as bigint\n }\n })\n};\n\nexport const TSON = TypesonSimplified(tsonBuiltinDefs, defs);\n\nexport const BISON = Bison(defs);\n","import Dexie, { DBCoreSchema } from 'dexie';\nimport {\n DBInsertOperation,\n DBOperation,\n DBOperationsSet,\n DBOpPrimaryKey,\n} from 'dexie-cloud-common';\nimport { UserLogin } from '../db/entities/UserLogin';\n\nexport function encodeIdsForServer(\n schema: DBCoreSchema,\n currentUser: UserLogin,\n changes: DBOperationsSet\n): DBOperationsSet {\n const rv: DBOperationsSet = [];\n for (let change of changes) {\n const { table, muts } = change;\n const tableSchema = schema.tables.find((t) => t.name === table);\n if (!tableSchema)\n throw new Error(\n `Internal error: table ${table} not found in DBCore schema`\n );\n const { primaryKey } = tableSchema;\n let changeClone = change;\n muts.forEach((mut, mutIndex) => {\n const rewriteValues =\n !primaryKey.outbound &&\n (mut.type === 'upsert' || mut.type === 'insert');\n mut.keys.forEach((key, keyIndex) => {\n if (Array.isArray(key)) {\n // Server only support string keys. Dexie Cloud client support strings or array of strings.\n if (changeClone === change)\n changeClone = cloneChange(change, rewriteValues);\n const mutClone = changeClone.muts[mutIndex];\n const rewrittenKey = JSON.stringify(key);\n mutClone.keys[keyIndex] = rewrittenKey;\n /* Bug (#1777)\n We should not rewrite values. It will fail because the key is array and the value is string.\n Only the keys should be rewritten and it's already done on the server.\n We should take another round of revieweing how key transformations are being done between\n client and server and let the server do the key transformations entirely instead now that\n we have the primary key schema on the server making it possible to do so.\n if (rewriteValues) {\n Dexie.setByKeyPath(\n (mutClone as DBInsertOperation).values[keyIndex],\n primaryKey.keyPath!,\n rewrittenKey\n );\n }*/\n } else if (key[0] === '#') {\n // Private ID - translate!\n if (changeClone === change)\n changeClone = cloneChange(change, rewriteValues);\n const mutClone = changeClone.muts[mutIndex];\n if (!currentUser.isLoggedIn)\n throw new Error(\n `Internal error: Cannot sync private IDs before authenticated`\n );\n const rewrittenKey = `${key}:${currentUser.userId}`;\n mutClone.keys[keyIndex] = rewrittenKey;\n if (rewriteValues) {\n Dexie.setByKeyPath(\n (mutClone as DBInsertOperation).values[keyIndex],\n primaryKey.keyPath!,\n rewrittenKey\n );\n }\n }\n });\n });\n rv.push(changeClone);\n }\n return rv;\n}\n\nfunction cloneChange(change: DBOperationsSet[number], rewriteValues: boolean) {\n // clone on demand:\n return {\n ...change,\n muts: rewriteValues\n ? change.muts.map((m) => {\n return (m.type === 'insert' || m.type === 'upsert') && m.values\n ? {\n ...m,\n keys: m.keys.slice(),\n values: m.values.slice(),\n }\n : {\n ...m,\n keys: m.keys.slice(),\n };\n })\n : change.muts.map((m) => ({ ...m, keys: m.keys.slice() })),\n };\n}\n","import { DexieCloudDB } from '../db/DexieCloudDB';\n\n// If we get Ratelimit-Limit and Ratelimit-Remaining where Ratelimit-Remaining is below\n// (Ratelimit-Limit / 2), we should delay the next sync by (Ratelimit-Reset / Ratelimit-Remaining)\n// seconds (given that there is a Ratelimit-Reset header).\n\nlet syncRatelimitDelays = new WeakMap<DexieCloudDB, Date>();\n\nexport async function checkSyncRateLimitDelay(db: DexieCloudDB) {\n const delatMilliseconds = (syncRatelimitDelays.get(db)?.getTime() ?? 0) - Date.now();\n if (delatMilliseconds > 0) {\n console.debug(`Stalling sync request ${delatMilliseconds} ms to spare ratelimits`);\n await new Promise(resolve => setTimeout(resolve, delatMilliseconds));\n }\n}\n\nexport function updateSyncRateLimitDelays(db: DexieCloudDB, res: Response) {\n const limit = res.headers.get('Ratelimit-Limit');\n const remaining = res.headers.get('Ratelimit-Remaining');\n const reset = res.headers.get('Ratelimit-Reset');\n if (limit && remaining && reset) {\n const limitNum = Number(limit);\n const remainingNum = Math.max(0, Number(remaining));\n const willResetInSeconds = Number(reset);\n if (remainingNum < limitNum / 2) {\n const delay = Math.ceil(willResetInSeconds / (remainingNum + 1));\n syncRatelimitDelays.set(db, new Date(Date.now() + delay * 1000));\n console.debug(`Sync ratelimit delay set to ${delay} seconds`);\n } else {\n syncRatelimitDelays.delete(db);\n console.debug(`Sync ratelimit delay cleared`);\n }\n }\n}\n","import { DexieCloudDB } from '../db/DexieCloudDB';\nimport { PersistedSyncState } from '../db/entities/PersistedSyncState';\nimport { loadAccessToken } from '../authentication/authenticate';\nimport { BISON, TSON } from '../TSON';\nimport { getSyncableTables } from '../helpers/getSyncableTables';\nimport { BaseRevisionMapEntry } from '../db/entities/BaseRevisionMapEntry';\nimport { HttpError } from '../errors/HttpError';\nimport {\n DBOperationsSet,\n DexieCloudSchema,\n SyncRequest,\n SyncResponse,\n} from 'dexie-cloud-common';\nimport { encodeIdsForServer } from './encodeIdsForServer';\nimport { UserLogin } from '../db/entities/UserLogin';\nimport { updateSyncRateLimitDelays } from './ratelimit';\n//import {BisonWebStreamReader} from \"dreambase-library/dist/typeson-simplified/BisonWebStreamReader\";\n\nexport async function syncWithServer(\n changes: DBOperationsSet,\n syncState: PersistedSyncState | undefined,\n baseRevs: BaseRevisionMapEntry[],\n db: DexieCloudDB,\n databaseUrl: string,\n schema: DexieCloudSchema | null,\n clientIdentity: string,\n currentUser: UserLogin\n): Promise<SyncResponse> {\n //\n // Push changes to server using fetch\n //\n const headers: HeadersInit = {\n Accept: 'application/json, application/x-bison, application/x-bison-stream',\n 'Content-Type': 'application/tson',\n };\n const updatedUser = await loadAccessToken(db);\n /*\n if (updatedUser?.license && changes.length > 0) {\n if (updatedUser.license.status === 'expired') {\n throw new Error(`License has expired`);\n }\n if (updatedUser.license.status === 'deactivated') {\n throw new Error(`License deactivated`);\n }\n }\n */\n const accessToken = updatedUser?.accessToken;\n if (accessToken) {\n headers.Authorization = `Bearer ${accessToken}`;\n }\n\n const syncRequest: SyncRequest = {\n v: 2,\n dbID: syncState?.remoteDbId,\n clientIdentity,\n schema: schema || {},\n lastPull: syncState\n ? {\n serverRevision: syncState.serverRevision!,\n realms: syncState.realms,\n inviteRealms: syncState.inviteRealms,\n }\n : undefined,\n baseRevs,\n changes: encodeIdsForServer(db.dx.core.schema, currentUser, changes),\n };\n console.debug('Sync request', syncRequest);\n db.syncStateChangedEvent.next({\n phase: 'pushing',\n });\n const res = await fetch(`${databaseUrl}/sync`, {\n method: 'post',\n headers,\n credentials: 'include', // For Arr Affinity cookie only, for better Rate-Limit counting only.\n body: TSON.stringify(syncRequest),\n });\n //const contentLength = Number(res.headers.get('content-length'));\n db.syncStateChangedEvent.next({\n phase: 'pulling',\n });\n\n updateSyncRateLimitDelays(db, res);\n\n if (!res.ok) {\n throw new HttpError(res);\n }\n\n switch (res.headers.get('content-type')) {\n case 'application/x-bison':\n return BISON.fromBinary(await res.blob());\n case 'application/x-bison-stream': //return BisonWebStreamReader(BISON, res);\n default:\n case 'application/json': {\n const text = await res.text();\n const syncRes = TSON.parse(text);\n return syncRes;\n }\n }\n}\n","import { Table } from \"dexie\";\nimport { EntityCommon } from \"../db/entities/EntityCommon\";\nimport { UserLogin } from \"../db/entities/UserLogin\";\nimport { Member } from \"../db/entities/Member\";\nimport { UNAUTHORIZED_USER } from \"../authentication/UNAUTHORIZED_USER\";\nimport { Realm } from \"../db/entities/Realm\";\n\nexport async function modifyLocalObjectsWithNewUserId(\n syncifiedTables: Table<EntityCommon>[],\n currentUser: UserLogin,\n alreadySyncedRealms?: string[]) {\n const ignoredRealms = new Set(alreadySyncedRealms || []);\n for (const table of syncifiedTables) {\n if (table.name === \"members\") {\n // members\n await table.toCollection().modify((member: Member) => {\n if (!ignoredRealms.has(member.realmId) && (!member.userId || member.userId === UNAUTHORIZED_USER.userId)) {\n member.userId = currentUser.userId;\n }\n });\n } else if (table.name === \"roles\") {\n // roles\n // No changes needed.\n } else if (table.name === \"realms\") {\n // realms\n await table.toCollection().modify((realm: Realm) => {\n if (!ignoredRealms.has(realm.realmId) && (realm.owner === undefined || realm.owner === UNAUTHORIZED_USER.userId)) {\n realm.owner = currentUser.userId;\n }\n });\n } else {\n // application entities\n await table.toCollection().modify((obj) => {\n if (!obj.realmId || !ignoredRealms.has(obj.realmId)) {\n if (!obj.owner || obj.owner === UNAUTHORIZED_USER.userId)\n obj.owner = currentUser.userId;\n if (!obj.realmId || obj.realmId === UNAUTHORIZED_USER.userId) {\n obj.realmId = currentUser.userId;\n }\n }\n });\n }\n }\n}\n","import Dexie from \"dexie\";\n\nexport interface CancelToken {\n cancelled: boolean;\n}\n\nexport function throwIfCancelled(cancelToken?: CancelToken) {\n if (cancelToken?.cancelled) throw new Dexie.AbortError(`Operation was cancelled`);\n}\n","/* Need this because navigator.onLine seems to say \"false\" when it is actually online.\n This function relies initially on navigator.onLine but then uses online and offline events\n which seem to be more reliable.\n*/\nexport let isOnline = false;\nif (typeof self !== 'undefined' && typeof navigator !== 'undefined') {\n isOnline = navigator.onLine;\n self.addEventListener('online', ()=>isOnline = true);\n self.addEventListener('offline', ()=>isOnline = false);\n}\n","import { DexieCloudDB } from '../db/DexieCloudDB';\nimport { DexieCloudSchema, SyncResponse } from 'dexie-cloud-common';\n\nexport async function updateBaseRevs(db: DexieCloudDB, schema: DexieCloudSchema, latestRevisions: { [table: string]: number; }, serverRev: any) {\n await db.$baseRevs.bulkPut(\n Object.keys(schema)\n .filter((table) => schema[table].markedForSync)\n .map((tableName) => {\n const lastClientRevOnPreviousServerRev = latestRevisions[tableName] || 0;\n return {\n tableName,\n clientRev: lastClientRevOnPreviousServerRev + 1,\n serverRev,\n };\n })\n );\n}\n","import { DBOperationsSet } from 'dexie-cloud-common';\n\nexport function getLatestRevisionsPerTable(\n clientChangeSet: DBOperationsSet,\n lastRevisions = {} as { [table: string]: number; }) {\n for (const { table, muts } of clientChangeSet) {\n const lastRev = muts.length > 0 ? muts[muts.length - 1].rev : null;\n lastRevisions[table] = lastRev || lastRevisions[table] || 0;\n }\n return lastRevisions;\n}\n","import Dexie, { Table, cmp } from 'dexie';\n\nexport async function bulkUpdate(\n table: Table,\n keys: any[],\n changeSpecs: { [keyPath: string]: any }[]\n) {\n const objs = await table.bulkGet(keys);\n const resultKeys: any[] = [];\n const resultObjs: any[] = [];\n keys.forEach((key, idx) => {\n const obj = objs[idx];\n if (obj) {\n for (const [keyPath, value] of Object.entries(changeSpecs[idx])) {\n if (keyPath === table.schema.primKey.keyPath) {\n if (cmp(value, key) !== 0) {\n throw new Error(`Cannot change primary key`);\n }\n } else {\n Dexie.setByKeyPath(obj, keyPath, value);\n }\n }\n resultKeys.push(key);\n resultObjs.push(obj);\n }\n });\n await (table.schema.primKey.keyPath == null\n ? table.bulkPut(resultObjs, resultKeys)\n : table.bulkPut(resultObjs));\n}\n","import { DexieCloudDB } from '../db/DexieCloudDB';\nimport Dexie from 'dexie';\nimport { bulkUpdate } from '../helpers/bulkUpdate';\nimport { DBOperationsSet } from 'dexie-cloud-common';\n\nexport async function applyServerChanges(\n changes: DBOperationsSet<string>,\n db: DexieCloudDB\n) {\n console.debug('Applying server changes', changes, Dexie.currentTransaction);\n for (const { table: tableName, muts } of changes) {\n const table = db.table(tableName);\n if (!table) continue; // If server sends changes on a table we don't have, ignore it.\n const { primaryKey } = table.core.schema;\n const keyDecoder = (key: string) => {\n switch (key[0]) {\n case '[':\n // Decode JSON array\n if (key.endsWith(']'))\n try {\n // On server, array keys are transformed to JSON string representation\n return JSON.parse(key);\n } catch {}\n return key;\n case '#':\n // Decode private ID (do the opposite from what's done in encodeIdsForServer())\n if (key.endsWith(':' + db.cloud.currentUserId)) {\n return key.substr(\n 0,\n key.length - db.cloud.currentUserId.length - 1\n );\n }\n return key;\n default:\n return key;\n }\n };\n for (const mut of muts) {\n const keys = mut.keys.map(keyDecoder);\n switch (mut.type) {\n case 'insert':\n if (primaryKey.outbound) {\n await table.bulkAdd(mut.values, keys);\n } else {\n keys.forEach((key, i) => {\n // Make sure inbound keys are consistent\n Dexie.setByKeyPath(mut.values[i], primaryKey.keyPath!, key);\n });\n await table.bulkAdd(mut.values);\n }\n break;\n case 'upsert':\n if (primaryKey.outbound) {\n await table.bulkPut(mut.values, keys);\n } else {\n keys.forEach((key, i) => {\n // Make sure inbound keys are consistent\n Dexie.setByKeyPath(mut.values[i], primaryKey.keyPath!, key);\n });\n await table.bulkPut(mut.values);\n }\n break;\n case 'modify':\n if (keys.length === 1) {\n await table.update(keys[0], mut.changeSpec);\n } else {\n await table.where(':id').anyOf(keys).modify(mut.changeSpec);\n }\n break;\n case 'update':\n await bulkUpdate(table, keys, mut.changeSpecs);\n break;\n case 'delete':\n await table.bulkDelete(keys);\n break;\n }\n }\n }\n}\n","import { getMutationTable } from '../helpers/getMutationTable';\nimport { getSyncableTables } from '../helpers/getSyncableTables';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { listSyncifiedChanges } from './listSyncifiedChanges';\nimport { getTablesToSyncify } from './getTablesToSyncify';\nimport { listClientChanges } from './listClientChanges';\nimport { syncWithServer } from './syncWithServer';\nimport { modifyLocalObjectsWithNewUserId } from './modifyLocalObjectsWithNewUserId';\nimport { throwIfCancelled } from '../helpers/CancelToken';\nimport { DexieCloudOptions } from '../DexieCloudOptions';\nimport { BaseRevisionMapEntry } from '../db/entities/BaseRevisionMapEntry';\nimport { getTableFromMutationTable } from '../helpers/getTableFromMutationTable';\nimport {\n applyOperations,\n DBKeyMutationSet,\n DBOperationsSet,\n DexieCloudSchema,\n randomString,\n subtractChanges,\n SyncResponse,\n toDBOperationSet,\n} from 'dexie-cloud-common';\nimport { PersistedSyncState } from '../db/entities/PersistedSyncState';\nimport { isOnline } from './isOnline';\nimport { updateBaseRevs } from './updateBaseRevs';\nimport { getLatestRevisionsPerTable } from './getLatestRevisionsPerTable';\nimport { applyServerChanges } from './applyServerChanges';\nimport { checkSyncRateLimitDelay } from './ratelimit';\n\nexport const CURRENT_SYNC_WORKER = 'currentSyncWorker';\n\nexport interface SyncOptions {\n isInitialSync?: boolean;\n cancelToken?: { cancelled: boolean };\n justCheckIfNeeded?: boolean;\n retryImmediatelyOnFetchError?: boolean;\n purpose?: 'pull' | 'push';\n}\n\nexport function sync(\n db: DexieCloudDB,\n options: DexieCloudOptions,\n schema: DexieCloudSchema,\n syncOptions?: SyncOptions\n): Promise<boolean> {\n return _sync\n .apply(this, arguments)\n .then((result) => {\n if (!syncOptions?.justCheckIfNeeded) { // && syncOptions?.purpose !== 'push') {\n db.syncStateChangedEvent.next({\n phase: 'in-sync',\n });\n }\n return result;\n })\n .catch(async (error: any) => {\n if (syncOptions?.justCheckIfNeeded) return Promise.reject(error); // Just rethrow.\n console.debug('Error from _sync', {\n isOnline,\n syncOptions,\n error,\n });\n if (\n isOnline &&\n syncOptions?.retryImmediatelyOnFetchError &&\n error?.name === 'TypeError' &&\n /fetch/.test(error?.message)\n ) {\n db.syncStateChangedEvent.next({\n phase: 'error',\n error,\n });\n // Retry again in 500 ms but if it fails again, don't retry.\n await new Promise((resolve) => setTimeout(resolve, 500));\n return await sync(db, options, schema, {\n ...syncOptions,\n retryImmediatelyOnFetchError: false,\n });\n }\n // Make sure that no matter whether sync() explodes or not,\n // always update the timestamp. Also store the error.\n await db.$syncState.update('syncState', {\n timestamp: new Date(),\n error: '' + error,\n });\n db.syncStateChangedEvent.next({\n phase: isOnline ? 'error' : 'offline',\n error: new Error('' + error?.message || error),\n });\n return Promise.reject(error);\n });\n}\n\nasync function _sync(\n db: DexieCloudDB,\n options: DexieCloudOptions,\n schema: DexieCloudSchema,\n { isInitialSync, cancelToken, justCheckIfNeeded, purpose }: SyncOptions = {\n isInitialSync: false,\n }\n): Promise<boolean> {\n if (!justCheckIfNeeded) {\n console.debug('SYNC STARTED', { isInitialSync, purpose });\n }\n if (!db.cloud.options?.databaseUrl)\n throw new Error(\n `Internal error: sync must not be called when no databaseUrl is configured`\n );\n const { databaseUrl } = options;\n const currentUser = await db.getCurrentUser(); // Keep same value across entire sync flow:\n const tablesToSync = currentUser.isLoggedIn ? getSyncableTables(db) : [];\n\n const mutationTables = tablesToSync.map((tbl) =>\n db.table(getMutationTable(tbl.name))\n );\n\n // If this is not the initial sync,\n // go through tables that were previously not synced but should now be according to\n // logged in state and the sync table whitelist in db.cloud.options.\n //\n // Prepare for syncification by modifying locally unauthorized objects:\n //\n const persistedSyncState = await db.getPersistedSyncState();\n const readyForSyncification = !isInitialSync && currentUser.isLoggedIn;\n const tablesToSyncify = readyForSyncification\n ? getTablesToSyncify(db, persistedSyncState)\n : [];\n throwIfCancelled(cancelToken);\n const doSyncify = tablesToSyncify.length > 0;\n\n if (doSyncify) {\n if (justCheckIfNeeded) return true;\n //console.debug('sync doSyncify is true');\n await db.transaction('rw', tablesToSyncify, async (tx) => {\n // @ts-ignore\n tx.idbtrans.disableChangeTracking = true;\n // @ts-ignore\n tx.idbtrans.disableAccessControl = true; // TODO: Take care of this flag in access control middleware!\n await modifyLocalObjectsWithNewUserId(\n tablesToSyncify,\n currentUser,\n persistedSyncState?.realms\n );\n });\n throwIfCancelled(cancelToken);\n }\n //\n // List changes to sync\n //\n const [clientChangeSet, syncState, baseRevs] = await db.transaction(\n 'r',\n db.tables,\n async () => {\n const syncState = await db.getPersistedSyncState();\n const baseRevs = await db.$baseRevs.toArray();\n let clientChanges = await listClientChanges(mutationTables, db);\n throwIfCancelled(cancelToken);\n if (doSyncify) {\n const alreadySyncedRealms = [\n ...(persistedSyncState?.realms || []),\n ...(persistedSyncState?.inviteRealms || []),\n ];\n const syncificationInserts = await listSyncifiedChanges(\n tablesToSyncify,\n currentUser,\n schema!,\n alreadySyncedRealms\n );\n throwIfCancelled(cancelToken);\n clientChanges = clientChanges.concat(syncificationInserts);\n return [clientChanges, syncState, baseRevs];\n }\n return [clientChanges, syncState, baseRevs];\n }\n );\n\n const pushSyncIsNeeded = clientChangeSet.some((set) =>\n set.muts.some((mut) => mut.keys.length > 0)\n );\n if (justCheckIfNeeded) {\n console.debug('Sync is needed:', pushSyncIsNeeded);\n return pushSyncIsNeeded;\n }\n if (purpose === 'push' && !pushSyncIsNeeded) {\n // The purpose of this request was to push changes\n return false;\n }\n\n const latestRevisions = getLatestRevisionsPerTable(\n clientChangeSet,\n syncState?.latestRevisions\n );\n\n const clientIdentity = syncState?.clientIdentity || randomString(16);\n\n //\n // Push changes to server\n //\n throwIfCancelled(cancelToken);\n const res = await syncWithServer(\n clientChangeSet,\n syncState,\n baseRevs,\n db,\n databaseUrl,\n schema,\n clientIdentity,\n currentUser\n );\n console.debug('Sync response', res);\n\n //\n // Apply changes locally and clear old change entries:\n //\n const done = await db.transaction('rw', db.tables, async (tx) => {\n // @ts-ignore\n tx.idbtrans.disableChangeTracking = true;\n // @ts-ignore\n tx.idbtrans.disableAccessControl = true; // TODO: Take care of this flag in access control middleware!\n\n // Update db.cloud.schema from server response.\n // Local schema MAY include a subset of tables, so do not force all tables into local schema.\n for (const tableName of Object.keys(schema)) {\n if (res.schema[tableName]) {\n // Write directly into configured schema. This code can only be executed alone.\n schema[tableName] = res.schema[tableName];\n }\n }\n await db.$syncState.put(schema, 'schema');\n\n // List mutations that happened during our exchange with the server:\n const addedClientChanges = await listClientChanges(mutationTables, db, {\n since: latestRevisions,\n });\n\n //\n // Delete changes now as server has return success\n // (but keep changes that haven't reached server yet)\n //\n for (const mutTable of mutationTables) {\n const tableName = getTableFromMutationTable(mutTable.name);\n if (\n !addedClientChanges.some(\n (ch) => ch.table === tableName && ch.muts.length > 0\n )\n ) {\n // No added mutations for this table during the time we sent changes\n // to the server.\n // It is therefore safe to clear all changes (which is faster than\n // deleting a range)\n await Promise.all([\n mutTable.clear(),\n db.$baseRevs.where({ tableName }).delete(),\n ]);\n } else if (latestRevisions[tableName]) {\n const latestRev = latestRevisions[tableName] || 0;\n await Promise.all([\n mutTable.where('rev').belowOrEqual(latestRev).delete(),\n db.$baseRevs\n .where(':id')\n .between(\n [tableName, -Infinity],\n [tableName, latestRev + 1],\n true,\n true\n )\n .reverse()\n .offset(1) // Keep one entry (the one mapping muts that came during fetch --> previous server revision)\n .delete(),\n ]);\n } else {\n // In this case, the mutation table only contains added items after sending empty changeset to server.\n // We should not clear out anything now.\n }\n }\n\n // Update latestRevisions object according to additional changes:\n getLatestRevisionsPerTable(addedClientChanges, latestRevisions);\n\n // Update/add new entries into baseRevs map.\n // * On tables without mutations since last serverRevision,\n // this will update existing entry.\n // * On tables where mutations have been recorded since last\n // serverRevision, this will create a new entry.\n // The purpose of this operation is to mark a start revision (per table)\n // so that all client-mutations that come after this, will be mapped to current\n // server revision.\n await updateBaseRevs(db, schema, latestRevisions, res.serverRevision);\n\n const syncState = await db.getPersistedSyncState();\n\n //\n // Delete objects from removed realms\n //\n await deleteObjectsFromRemovedRealms(db, res, syncState);\n\n //\n // Update syncState\n //\n const newSyncState: PersistedSyncState = syncState || {\n syncedTables: [],\n latestRevisions: {},\n realms: [],\n inviteRealms: [],\n clientIdentity,\n };\n if (readyForSyncification) {\n newSyncState.syncedTables = tablesToSync\n .map((tbl) => tbl.name)\n .concat(tablesToSyncify.map((tbl) => tbl.name));\n }\n newSyncState.latestRevisions = latestRevisions;\n newSyncState.remoteDbId = res.dbId;\n newSyncState.initiallySynced = true;\n newSyncState.realms = res.realms;\n newSyncState.inviteRealms = res.inviteRealms;\n newSyncState.serverRevision = res.serverRevision;\n newSyncState.timestamp = new Date();\n delete newSyncState.error;\n\n const filteredChanges = filterServerChangesThroughAddedClientChanges(\n res.changes,\n addedClientChanges\n );\n\n //\n // apply server changes\n //\n await applyServerChanges(filteredChanges, db);\n\n //\n // Update syncState\n //\n db.$syncState.put(newSyncState, 'syncState');\n\n return addedClientChanges.length === 0;\n });\n if (!done) {\n console.debug('MORE SYNC NEEDED. Go for it again!');\n await checkSyncRateLimitDelay(db);\n return await _sync(db, options, schema, { isInitialSync, cancelToken });\n }\n console.debug('SYNC DONE', { isInitialSync });\n db.syncCompleteEvent.next();\n return false; // Not needed anymore\n}\n\nasync function deleteObjectsFromRemovedRealms(\n db: DexieCloudDB,\n res: SyncResponse,\n prevState: PersistedSyncState | undefined\n) {\n const deletedRealms = new Set<string>();\n const rejectedRealms = new Set<string>();\n const previousRealmSet = prevState ? prevState.realms : [];\n const previousInviteRealmSet = prevState ? prevState.inviteRealms : [];\n const updatedRealmSet = new Set(res.realms);\n const updatedTotalRealmSet = new Set(res.realms.concat(res.inviteRealms));\n for (const realmId of previousRealmSet) {\n if (!updatedRealmSet.has(realmId)) {\n rejectedRealms.add(realmId);\n if (!updatedTotalRealmSet.has(realmId)) {\n deletedRealms.add(realmId);\n }\n }\n }\n for (const realmId of previousInviteRealmSet.concat(previousRealmSet)) {\n if (!updatedTotalRealmSet.has(realmId)) {\n deletedRealms.add(realmId);\n }\n }\n if (deletedRealms.size > 0 || rejectedRealms.size > 0) {\n const tables = getSyncableTables(db);\n for (const table of tables) {\n let realmsToDelete = ['realms', 'members', 'roles'].includes(table.name)\n ? deletedRealms // These tables should spare rejected ones.\n : rejectedRealms; // All other tables shoudl delete rejected+deleted ones\n if (realmsToDelete.size === 0) continue;\n if (\n table.schema.indexes.some(\n (idx) =>\n idx.keyPath === 'realmId' ||\n (Array.isArray(idx.keyPath) && idx.keyPath[0] === 'realmId')\n )\n ) {\n // There's an index to use:\n //console.debug(`REMOVAL: deleting all ${table.name} where realmId anyOf `, JSON.stringify([...realmsToDelete]));\n await table\n .where('realmId')\n .anyOf([...realmsToDelete])\n .delete();\n } else {\n // No index to use:\n //console.debug(`REMOVAL: deleting all ${table.name} where realmId is any of `, JSON.stringify([...realmsToDelete]), realmsToDelete.size);\n await table\n .filter((obj) => !!obj?.realmId && realmsToDelete.has(obj.realmId))\n .delete();\n }\n }\n }\n}\n\nexport function filterServerChangesThroughAddedClientChanges(\n serverChanges: DBOperationsSet<string>,\n addedClientChanges: DBOperationsSet\n): DBOperationsSet<string> {\n const changes: DBKeyMutationSet = {};\n applyOperations(changes, serverChanges);\n const localPostChanges: DBKeyMutationSet = {};\n applyOperations(localPostChanges, addedClientChanges);\n subtractChanges(changes, localPostChanges);\n return toDBOperationSet(changes);\n}\n","import { BehaviorSubject } from 'rxjs';\nimport { filter, take } from 'rxjs/operators';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { WSConnectionMsg } from '../WSObservable';\nimport { triggerSync } from './triggerSync';\nimport Dexie from 'dexie';\nimport { computeRealmSetHash } from '../helpers/computeRealmSetHash';\nimport { DBOperationsSet } from 'dexie-cloud-common';\nimport { getSyncableTables } from '../helpers/getSyncableTables';\nimport { getMutationTable } from '../helpers/getMutationTable';\nimport { listClientChanges } from './listClientChanges';\nimport { filterServerChangesThroughAddedClientChanges } from './sync';\nimport { applyServerChanges } from './applyServerChanges';\nimport { updateBaseRevs } from './updateBaseRevs';\nimport { getLatestRevisionsPerTable } from './getLatestRevisionsPerTable';\nimport { refreshAccessToken } from '../authentication/authenticate';\n\nexport type MessagesFromServerConsumer = ReturnType<\n typeof MessagesFromServerConsumer\n>;\n\nexport function MessagesFromServerConsumer(db: DexieCloudDB) {\n const queue: WSConnectionMsg[] = [];\n const readyToServe = new BehaviorSubject(true);\n const event = new BehaviorSubject(null);\n let isWorking = false;\n\n let loopWarning = 0;\n let loopDetection = [0, 0, 0, 0, 0, 0, 0, 0, 0, Date.now()];\n\n event.subscribe(async () => {\n if (isWorking) return;\n if (queue.length > 0) {\n isWorking = true;\n loopDetection.shift();\n loopDetection.push(Date.now());\n readyToServe.next(false);\n try {\n await consumeQueue();\n } finally {\n if (\n loopDetection[loopDetection.length - 1] - loopDetection[0] <\n 10000\n ) {\n // Ten loops within 10 seconds. Slow down!\n if (Date.now() - loopWarning < 5000) {\n // Last time we did this, we ended up here too. Wait for a minute.\n console.warn(`Slowing down websocket loop for one minute`);\n loopWarning = Date.now() + 60000;\n await new Promise((resolve) => setTimeout(resolve, 60000));\n } else {\n // This is a one-time event. Just pause 10 seconds.\n console.warn(`Slowing down websocket loop for 10 seconds`);\n loopWarning = Date.now() + 10000;\n await new Promise((resolve) => setTimeout(resolve, 10000));\n }\n }\n isWorking = false;\n readyToServe.next(true);\n }\n }\n });\n\n function enqueue(msg: WSConnectionMsg) {\n queue.push(msg);\n event.next(null);\n }\n\n async function consumeQueue() {\n while (queue.length > 0) {\n const msg = queue.shift();\n try {\n // If the sync worker or service worker is syncing, wait 'til thei're done.\n // It's no need to have two channels at the same time - even though it wouldnt\n // be a problem - this is an optimization.\n await db.cloud.syncState\n .pipe(\n filter(({ phase }) => phase === 'in-sync' || phase === 'error'),\n take(1)\n )\n .toPromise();\n console.debug('processing msg', msg);\n const persistedSyncState = db.cloud.persistedSyncState.value;\n //syncState.\n if (!msg) continue;\n switch (msg.type) {\n case 'token-expired':\n console.debug(\n 'WebSocket observable: Token expired. Refreshing token...'\n );\n const user = db.cloud.currentUser.value;\n // Refresh access token\n const refreshedLogin = await refreshAccessToken(\n db.cloud.options!.databaseUrl,\n user\n );\n // Persist updated access token\n await db.table('$logins').update(user.userId, {\n accessToken: refreshedLogin.accessToken,\n accessTokenExpiration: refreshedLogin.accessTokenExpiration,\n claims: refreshedLogin.claims,\n license: refreshedLogin.license,\n });\n // Updating $logins will trigger emission of db.cloud.currentUser observable, which\n // in turn will lead to that connectWebSocket.ts will reconnect the socket with the\n // new token. So we don't need to do anything more here.\n break;\n case 'realm-added':\n if (\n !persistedSyncState?.realms?.includes(msg.realm) &&\n !persistedSyncState?.inviteRealms?.includes(msg.realm)\n ) {\n await db.cloud.sync({ purpose: 'pull', wait: true });\n //triggerSync(db, 'pull');\n }\n break;\n case 'realm-accepted':\n if (!persistedSyncState?.realms?.includes(msg.realm)) {\n await db.cloud.sync({ purpose: 'pull', wait: true });\n //triggerSync(db, 'pull');\n }\n break;\n case 'realm-removed':\n if (\n persistedSyncState?.realms?.includes(msg.realm) ||\n persistedSyncState?.inviteRealms?.includes(msg.realm)\n ) {\n await db.cloud.sync({ purpose: 'pull', wait: true });\n //triggerSync(db, 'pull');\n }\n break;\n case 'realms-changed':\n //triggerSync(db, 'pull');\n await db.cloud.sync({ purpose: 'pull', wait: true });\n break;\n case 'changes':\n console.debug('changes');\n if (db.cloud.syncState.value?.phase === 'error') {\n triggerSync(db, 'pull');\n break;\n }\n await db.transaction('rw', db.dx.tables, async (tx) => {\n // @ts-ignore\n tx.idbtrans.disableChangeTracking = true;\n // @ts-ignore\n tx.idbtrans.disableAccessControl = true;\n const [schema, syncState, currentUser] = await Promise.all([\n db.getSchema(),\n db.getPersistedSyncState(),\n db.getCurrentUser(),\n ]);\n console.debug('ws message queue: in transaction');\n if (!syncState || !schema || !currentUser) {\n console.debug('required vars not present', {\n syncState,\n schema,\n currentUser,\n });\n return; // Initial sync must have taken place - otherwise, ignore this.\n }\n // Verify again in ACID tx that we're on same server revision.\n if (msg.baseRev !== syncState.serverRevision) {\n console.debug(\n `baseRev (${msg.baseRev}) differs from our serverRevision in syncState (${syncState.serverRevision})`\n );\n // Should we trigger a sync now? No. This is a normal case\n // when another local peer (such as the SW or a websocket channel on other tab) has\n // updated syncState from new server information but we are not aware yet. It would\n // be unnescessary to do a sync in that case. Instead, the caller of this consumeQueue()\n // function will do readyToServe.next(true) right after this return, which will lead\n // to a \"ready\" message being sent to server with the new accurate serverRev we have,\n // so that the next message indeed will be correct.\n if (\n typeof msg.baseRev === 'string' && // v2 format\n (typeof syncState.serverRevision === 'bigint' || // v1 format\n typeof syncState.serverRevision === 'object') // v1 format old browser\n ) {\n // The reason for the diff seems to be that server has migrated the revision format.\n // Do a full sync to update revision format.\n // If we don't do a sync request now, we could stuck in an endless loop.\n triggerSync(db, 'pull');\n }\n return; // Ignore message\n }\n // Verify also that the message is based on the exact same set of realms\n const ourRealmSetHash = await Dexie.waitFor(\n // Keep TX in non-IDB work\n computeRealmSetHash(syncState)\n );\n console.debug('ourRealmSetHash', ourRealmSetHash);\n if (ourRealmSetHash !== msg.realmSetHash) {\n console.debug('not same realmSetHash', msg.realmSetHash);\n triggerSync(db, 'pull');\n // The message isn't based on the same realms.\n // Trigger a sync instead to resolve all things up.\n return;\n }\n\n // Get clientChanges\n let clientChanges: DBOperationsSet = [];\n if (currentUser.isLoggedIn) {\n const mutationTables = getSyncableTables(db).map((tbl) =>\n db.table(getMutationTable(tbl.name))\n );\n clientChanges = await listClientChanges(mutationTables, db);\n console.debug('msg queue: client changes', clientChanges);\n }\n if (msg.changes.length > 0) {\n const filteredChanges =\n filterServerChangesThroughAddedClientChanges(\n msg.changes,\n clientChanges\n );\n\n //\n // apply server changes\n //\n console.debug(\n 'applying filtered server changes',\n filteredChanges\n );\n await applyServerChanges(filteredChanges, db);\n }\n\n // Update latest revisions per table in case there are unsynced changes\n // This can be a real case in future when we allow non-eagery sync.\n // And it can actually be realistic now also, but very rare.\n syncState.latestRevisions = getLatestRevisionsPerTable(\n clientChanges,\n syncState.latestRevisions\n );\n\n syncState.serverRevision = msg.newRev;\n\n // Update base revs\n console.debug('Updating baseRefs', syncState.latestRevisions);\n await updateBaseRevs(\n db,\n schema!,\n syncState.latestRevisions,\n msg.newRev\n );\n\n //\n // Update syncState\n //\n console.debug('Updating syncState', syncState);\n await db.$syncState.put(syncState, 'syncState');\n });\n console.debug('msg queue: done with rw transaction');\n break;\n }\n } catch (error) {\n console.error(`Error in msg queue`, error);\n }\n }\n }\n\n return {\n enqueue,\n readyToServe,\n };\n}\n","import Dexie, { Table } from 'dexie';\nimport { GuardedJob } from './entities/GuardedJob';\nimport { UserLogin } from './entities/UserLogin';\nimport { PersistedSyncState } from './entities/PersistedSyncState';\nimport { UNAUTHORIZED_USER } from '../authentication/UNAUTHORIZED_USER';\nimport { DexieCloudOptions } from '../DexieCloudOptions';\nimport { BehaviorSubject, Subject } from 'rxjs';\nimport { BaseRevisionMapEntry } from './entities/BaseRevisionMapEntry';\nimport {\n DBRealm,\n DBRealmMember,\n DBRealmRole,\n DexieCloudSchema,\n} from 'dexie-cloud-common';\nimport { BroadcastedAndLocalEvent } from '../helpers/BroadcastedAndLocalEvent';\nimport { SyncState, SyncStatePhase } from '../types/SyncState';\nimport { MessagesFromServerConsumer } from '../sync/messagesFromServerQueue';\n\n/*export interface DexieCloudDB extends Dexie {\n table(name: string): Table<any, any>;\n table(name: \"$jobs\"): Table<GuardedJob, string>;\n table(name: \"$logins\"): Table<UserLogin, string>;\n table(name: \"$syncState\"): Table<SyncState, \"syncState\">;\n //table(name: \"$pendingChangesFromServer\"): Table<DBOperationsSet, number>;\n}\n*/\n\nexport interface SyncStateChangedEventData {\n phase: SyncStatePhase;\n error?: Error;\n progress?: number;\n}\n\ntype SyncStateTable = Table<\n PersistedSyncState | DexieCloudSchema | DexieCloudOptions,\n 'syncState' | 'options' | 'schema'\n>;\nexport interface DexieCloudDBBase {\n readonly name: Dexie['name'];\n readonly close: Dexie['close'];\n transaction: Dexie['transaction'];\n table: Dexie['table'];\n readonly tables: Dexie['tables'];\n readonly cloud: Dexie['cloud'];\n readonly $jobs: Table<GuardedJob, string>;\n readonly $logins: Table<UserLogin, string>;\n readonly $syncState: SyncStateTable;\n readonly $baseRevs: Table<BaseRevisionMapEntry, [string, number]>;\n\n readonly realms: Table<DBRealm, string>;\n readonly members: Table<DBRealmMember, string>;\n readonly roles: Table<DBRealmRole, [string, string]>;\n\n readonly localSyncEvent: Subject<{ purpose?: 'pull' | 'push' }>;\n readonly syncStateChangedEvent: BroadcastedAndLocalEvent<SyncStateChangedEventData>;\n readonly syncCompleteEvent: BroadcastedAndLocalEvent<void>;\n readonly dx: Dexie;\n readonly initiallySynced: boolean;\n}\n\nexport interface DexieCloudDB extends DexieCloudDBBase {\n getCurrentUser(): Promise<UserLogin>;\n getSchema(): Promise<DexieCloudSchema | undefined>;\n getOptions(): Promise<DexieCloudOptions | undefined>;\n getPersistedSyncState(): Promise<PersistedSyncState | undefined>;\n setInitiallySynced(initiallySynced: boolean): void;\n reconfigure(): void;\n messageConsumer: MessagesFromServerConsumer;\n}\n\nconst wm = new WeakMap<object, DexieCloudDB>();\n\nexport const DEXIE_CLOUD_SCHEMA = {\n members: '@id, [userId+realmId], [email+realmId], realmId',\n roles: '[realmId+name]',\n realms: '@realmId',\n $jobs: '',\n $syncState: '',\n $baseRevs: '[tableName+clientRev]',\n $logins: 'claims.sub, lastLogin',\n};\n\nlet static_counter = 0;\nexport function DexieCloudDB(dx: Dexie): DexieCloudDB {\n if ('vip' in dx) dx = dx['vip']; // Avoid race condition. Always map to a vipped dexie that don't block during db.on.ready().\n let db = wm.get(dx.cloud);\n if (!db) {\n const localSyncEvent = new Subject<{ purpose: 'push' | 'pull' }>();\n let syncStateChangedEvent =\n new BroadcastedAndLocalEvent<SyncStateChangedEventData>(\n `syncstatechanged-${dx.name}`\n );\n let syncCompleteEvent = new BroadcastedAndLocalEvent<void>(\n `synccomplete-${dx.name}`\n );\n localSyncEvent['id'] = ++static_counter;\n let initiallySynced = false;\n db = {\n get name() {\n return dx.name;\n },\n close() {\n return dx.close();\n },\n transaction: dx.transaction.bind(dx),\n table: dx.table.bind(dx),\n get tables() {\n return dx.tables;\n },\n cloud: dx.cloud,\n get $jobs() {\n return dx.table('$jobs') as Table<GuardedJob, string>;\n },\n get $syncState() {\n return dx.table('$syncState') as SyncStateTable;\n },\n get $baseRevs() {\n return dx.table('$baseRevs') as Table<\n BaseRevisionMapEntry,\n [string, number]\n >;\n },\n get $logins() {\n return dx.table('$logins') as Table<UserLogin, string>;\n },\n\n get realms() {\n return dx.realms;\n },\n get members() {\n return dx.members;\n },\n get roles() {\n return dx.roles;\n },\n get initiallySynced() {\n return initiallySynced;\n },\n localSyncEvent,\n get syncStateChangedEvent() {\n return syncStateChangedEvent;\n },\n get syncCompleteEvent() {\n return syncCompleteEvent;\n },\n dx,\n } as DexieCloudDB;\n\n const helperMethods: Partial<DexieCloudDB> = {\n getCurrentUser() {\n return db!.$logins\n .toArray()\n .then(\n (logins) => logins.find((l) => l.isLoggedIn) || UNAUTHORIZED_USER\n );\n },\n getPersistedSyncState() {\n return db!.$syncState.get('syncState') as Promise<\n PersistedSyncState | undefined\n >;\n },\n getSchema() {\n return db!.$syncState.get('schema').then((schema: DexieCloudSchema) => {\n if (schema) {\n for (const table of db!.tables) {\n if (table.schema.primKey && table.schema.primKey.keyPath && schema[table.name]) {\n schema[table.name].primaryKey = nameFromKeyPath(\n table.schema.primKey.keyPath\n );\n }\n }\n }\n return schema;\n }) as Promise<DexieCloudSchema | undefined>;\n },\n getOptions() {\n return db!.$syncState.get('options') as Promise<\n DexieCloudOptions | undefined\n >;\n },\n setInitiallySynced(value) {\n initiallySynced = value;\n },\n reconfigure() {\n syncStateChangedEvent = new BroadcastedAndLocalEvent<SyncState>(\n `syncstatechanged-${dx.name}`\n );\n syncCompleteEvent = new BroadcastedAndLocalEvent<void>(\n `synccomplete-${dx.name}`\n );\n },\n };\n\n Object.assign(db, helperMethods);\n db.messageConsumer = MessagesFromServerConsumer(db);\n wm.set(dx.cloud, db);\n }\n return db;\n}\n\nfunction nameFromKeyPath (keyPath?: string | string[]): string {\n return typeof keyPath === 'string' ?\n keyPath :\n keyPath ? ('[' + [].join.call(keyPath, '+') + ']') : \"\";\n}\n","// @ts-ignore\nexport const isFirefox = typeof InstallTrigger !== 'undefined';\n","export const isSafari =\n typeof navigator !== 'undefined' &&\n /Safari\\//.test(navigator.userAgent) &&\n !/Chrom(e|ium)\\/|Edge\\//.test(navigator.userAgent);\n\nexport const safariVersion = isSafari\n ? // @ts-ignore\n [].concat(navigator.userAgent.match(/Safari\\/(\\d*)/))[1]\n : NaN;\n","import { isFirefox } from './isFirefox';\nimport { isSafari, safariVersion } from './isSafari';\n\n// What we know: Safari 14.1 (version 605) crashes when using dexie-cloud's service worker.\n// We don't know what exact call is causing this. Have tried safari-14-idb-fix with no luck.\n// Something we do in the service worker is triggering the crash.\n// When next Safari version (606) is out we will start enabling SW again, hoping that the bug is solved.\n// If not, we might increment 605 to 606.\nexport const DISABLE_SERVICEWORKER_STRATEGY =\n (isSafari && safariVersion <= 605) || // Disable for Safari for now.\n isFirefox; // Disable for Firefox for now. Seems to have a bug in reading CryptoKeys from IDB from service workers\n","import Dexie from \"dexie\";\n\n/* Helper function to subscribe to database close no matter if it was unexpectedly closed or manually using db.close()\n */\nexport function dbOnClosed(db: Dexie, handler: () => void) {\n db.on.close.subscribe(handler);\n // @ts-ignore\n const origClose = db._close;\n // @ts-ignore\n db._close = function () {\n origClose.call(this);\n handler();\n };\n return () => {\n db.on.close.unsubscribe(handler);\n // @ts-ignore\n db._close = origClose;\n };\n}\n","export const IS_SERVICE_WORKER =\n typeof self !== \"undefined\" && \"clients\" in self && !self.document;\n","import Dexie from \"dexie\";\n\nexport function throwVersionIncrementNeeded() {\n throw new Dexie.SchemaError(\n `Version increment needed to allow dexie-cloud change tracking`\n );\n}\n","import {\n DBCoreAddRequest,\n DBCoreDeleteRequest,\n DBCoreIndex, DBCorePutRequest\n} from 'dexie';\nimport { b64LexEncode } from 'dreambase-library/dist/common/b64lex';\n\nconst { toString } = {};\nexport function toStringTag(o: Object) {\n return toString.call(o).slice(8, -1);\n}\n\nexport function getEffectiveKeys(\n primaryKey: DBCoreIndex,\n req: (Pick<DBCoreAddRequest | DBCorePutRequest, 'type' | 'values'> & {\n keys?: any[];\n }) |\n Pick<DBCoreDeleteRequest, 'keys' | 'type'>\n) {\n if (req.type === 'delete')\n return req.keys;\n return req.keys?.slice() || req.values.map(primaryKey.extractKey!);\n}\nfunction applyToUpperBitFix(orig: string, bits: number) {\n return (\n (bits & 1 ? orig[0].toUpperCase() : orig[0].toLowerCase()) +\n (bits & 2 ? orig[1].toUpperCase() : orig[1].toLowerCase()) +\n (bits & 4 ? orig[2].toUpperCase() : orig[2].toLowerCase())\n );\n}\nconst consonants = /b|c|d|f|g|h|j|k|l|m|n|p|q|r|s|t|v|x|y|z/i;\nfunction isUpperCase(ch: string) {\n return ch >= 'A' && ch <= 'Z';\n}\n\nexport function generateTablePrefix(\n tableName: string,\n allPrefixes: Set<string>\n) {\n let rv = tableName[0].toLocaleLowerCase(); // \"users\" = \"usr\", \"friends\" = \"frn\", \"realms\" = \"rlm\", etc.\n for (let i = 1, l = tableName.length; i < l && rv.length < 3; ++i) {\n if (consonants.test(tableName[i]) || isUpperCase(tableName[i]))\n rv += tableName[i].toLowerCase();\n }\n while (allPrefixes.has(rv)) {\n if (/\\d/g.test(rv)) {\n rv = rv.substr(0, rv.length - 1) + (rv[rv.length - 1] + 1);\n if (rv.length > 3)\n rv = rv.substr(0, 3);\n else\n continue;\n } else if (rv.length < 3) {\n rv = rv + '2';\n continue;\n }\n let bitFix = 1;\n let upperFixed = rv;\n while (allPrefixes.has(upperFixed) && bitFix < 8) {\n upperFixed = applyToUpperBitFix(rv, bitFix);\n ++bitFix;\n }\n if (bitFix < 8)\n rv = upperFixed;\n else {\n let nextChar = (rv.charCodeAt(2) + 1) & 127;\n rv = rv.substr(0, 2) + String.fromCharCode(nextChar);\n // Here, in theory we could get an infinite loop if having 127*8 table names with identical 3 first consonants.\n }\n }\n return rv;\n}\nlet time = 0;\n/**\n *\n * @param prefix A unique 3-letter short-name of the table.\n * @param shardKey 3 last letters from another ID if colocation is requested. Verified on server on inserts - guarantees unique IDs across shards.\n * The shardKey part of the key represent the shardId where it was first created. An object with this\n * primary key can later on be moved to another shard without being altered. The reason for having\n * the origin shardKey as part of the key, is that the server will not need to check uniqueness constraint\n * across all shards on every insert. Updates / moves across shards are already controlled by the server\n * in the sense that the objects needs to be there already - we only need this part for inserts.\n * @returns\n */\nexport function generateKey(prefix: string, shardKey?: string) {\n const a = new Uint8Array(18);\n const timePart = new Uint8Array(a.buffer, 0, 6);\n const now = Date.now(); // Will fit into 6 bytes until year 10 895.\n if (time >= now) {\n // User is bulk-creating objects the same millisecond.\n // Increment the time part by one millisecond for each item.\n // If bulk-creating 1,000,000 rows client-side in 10 seconds,\n // the last time-stamp will be 990 seconds in future, which is no biggie at all.\n // The point is to create a nice order of the generated IDs instead of\n // using random ids.\n ++time;\n } else {\n time = now;\n }\n timePart[0] = time / 1099511627776; // Normal division (no bitwise operator) --> works with >= 32 bits.\n timePart[1] = time / 4294967296;\n timePart[2] = time / 16777216;\n timePart[3] = time / 65536;\n timePart[4] = time / 256;\n timePart[5] = time;\n const randomPart = new Uint8Array(a.buffer, 6);\n crypto.getRandomValues(randomPart);\n const id = new Uint8Array(a.buffer);\n return prefix + b64LexEncode(id) + (shardKey || '');\n}\n","import Dexie, {\n DBCore,\n DBCoreAddRequest,\n DBCoreMutateRequest,\n DBCorePutRequest,\n Middleware,\n} from 'dexie';\nimport { isValidSyncableID } from 'dexie-cloud-common';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport {\n getEffectiveKeys,\n generateKey,\n toStringTag,\n} from '../middleware-helpers/idGenerationHelpers';\n\nexport function createIdGenerationMiddleware(\n db: DexieCloudDB\n): Middleware<DBCore> {\n return {\n stack: 'dbcore',\n name: 'idGenerationMiddleware',\n level: 1,\n create: (core) => {\n return {\n ...core,\n table: (tableName) => {\n const table = core.table(tableName);\n\n function generateOrVerifyAtKeys(\n req: DBCoreAddRequest | DBCorePutRequest,\n idPrefix: string\n ) {\n let valueClones: null | object[] = null;\n const keys = getEffectiveKeys(table.schema.primaryKey, req);\n keys.forEach((key, idx) => {\n if (key === undefined) {\n // Generate the key\n const colocatedId =\n req.values[idx].realmId || db.cloud.currentUserId;\n const shardKey = colocatedId.substr(colocatedId.length - 3);\n keys[idx] = generateKey(idPrefix, shardKey);\n if (!table.schema.primaryKey.outbound) {\n if (!valueClones) valueClones = req.values.slice();\n valueClones[idx] = Dexie.deepClone(valueClones[idx]);\n Dexie.setByKeyPath(\n valueClones[idx],\n table.schema.primaryKey.keyPath!,\n keys[idx]\n );\n }\n } else if (\n typeof key !== 'string' ||\n (!key.startsWith(idPrefix) && !key.startsWith('#' + idPrefix))\n ) {\n // Key was specified by caller. Verify it complies with id prefix.\n throw new Dexie.ConstraintError(\n `The ID \"${key}\" is not valid for table \"${tableName}\". ` +\n `Primary '@' keys requires the key to be prefixed with \"${idPrefix}\" (or \"#${idPrefix}).\\n` +\n `If you want to generate IDs programmatically, remove '@' from the schema to get rid of this constraint. Dexie Cloud supports custom IDs as long as they are random and globally unique.`\n );\n }\n });\n return table.mutate({\n ...req,\n keys,\n values: valueClones || req.values,\n });\n }\n\n return {\n ...table,\n mutate: (req) => {\n // @ts-ignore\n if (req.trans.disableChangeTracking) {\n // Disable ID policy checks and ID generation\n return table.mutate(req);\n }\n if (req.type === 'add' || req.type === 'put') {\n const cloudTableSchema = db.cloud.schema?.[tableName];\n if (!cloudTableSchema?.generatedGlobalId) {\n if (cloudTableSchema?.markedForSync) {\n // Just make sure primary key is of a supported type:\n const keys = getEffectiveKeys(table.schema.primaryKey, req);\n keys.forEach((key, idx) => {\n if (!isValidSyncableID(key)) {\n const type = Array.isArray(key)\n ? key.map(toStringTag).join(',')\n : toStringTag(key);\n throw new Dexie.ConstraintError(\n `Invalid primary key type ${type} for table ${tableName}. Tables marked for sync has primary keys of type string or Array of string (and optional numbers)`\n );\n }\n });\n }\n } else {\n if (db.cloud.options?.databaseUrl && !db.initiallySynced) {\n // A database URL is configured but no initial sync has been performed.\n const keys = getEffectiveKeys(table.schema.primaryKey, req);\n // Check if the operation would yield any INSERT. If so, complain! We never want wrong ID prefixes stored.\n return table\n .getMany({ keys, trans: req.trans, cache: 'immutable' })\n .then((results) => {\n if (results.length < keys.length) {\n // At least one of the given objects would be created. Complain since\n // the generated ID would be based on a locally computed ID prefix only - we wouldn't\n // know if the server would give the same ID prefix until an initial sync has been\n // performed.\n throw new Error(\n `Unable to create new objects without an initial sync having been performed.`\n );\n }\n return table.mutate(req);\n });\n }\n return generateOrVerifyAtKeys(\n req,\n cloudTableSchema.idPrefix!\n );\n }\n }\n return table.mutate(req);\n },\n };\n },\n };\n },\n };\n}\n","import { DBCore, DBCoreTransaction, Middleware } from 'dexie';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { TXExpandos } from '../types/TXExpandos';\n\nexport function createImplicitPropSetterMiddleware(\n db: DexieCloudDB\n): Middleware<DBCore> {\n return {\n stack: 'dbcore',\n name: 'implicitPropSetterMiddleware',\n level: 1,\n create: (core) => {\n return {\n ...core,\n table: (tableName) => {\n const table = core.table(tableName);\n return {\n ...table,\n mutate: (req) => {\n // @ts-ignore\n if (req.trans.disableChangeTracking) {\n return table.mutate(req);\n }\n\n const trans = req.trans as DBCoreTransaction & TXExpandos;\n if (db.cloud.schema?.[tableName]?.markedForSync) {\n if (req.type === 'add' || req.type === 'put') {\n // No matter if user is logged in or not, make sure \"owner\" and \"realmId\" props are set properly.\n // If not logged in, this will be changed upon syncification of the tables (next sync after login),\n // however, application code will work better if we can always rely on that the properties realmId\n // and owner are set. Application code may index them and query them based on db.cloud.currentUserId,\n // and expect them to be returned. That scenario must work also when db.cloud.currentUserId === 'unauthorized'.\n for (const obj of req.values) {\n if (!obj.owner) {\n obj.owner = trans.currentUser.userId;\n }\n if (!obj.realmId) {\n obj.realmId = trans.currentUser.userId;\n }\n const key = table.schema.primaryKey.extractKey?.(obj);\n if (typeof key === 'string' && key[0] === '#') {\n // Add $ts prop for put operations and\n // disable update operations as well as consistent\n // modify operations. Reason: Server may not have\n // the object. Object should be created on server only\n // if is being updated. An update operation won't create it\n // so we must delete req.changeSpec to degrade operation to\n // an upsert operation with timestamp so that it will be created.\n // We must also degrade from consistent modify operations for the\n // same reason - object might be there on server. Must but put up instead.\n\n // FUTURE: This clumpsy behavior of private IDs could be refined later.\n // Suggestion is to in future, treat private IDs as we treat all objects \n // and sync operations normally. Only that deletions should become soft deletes\n // for them - so that server knows when a private ID has been deleted on server\n // not accept insert/upserts on them.\n if (req.type === 'put') {\n const now = Date.now();\n delete req.criteria;\n delete req.changeSpec;\n delete req.updates;\n obj.$ts = Date.now();\n }\n }\n }\n }\n }\n return table.mutate(req);\n },\n };\n },\n };\n },\n };\n}\n","\nexport function allSettled(possiblePromises: any[]) {\n return new Promise(resolve => {\n if (possiblePromises.length === 0) resolve([]);\n let remaining = possiblePromises.length;\n const results = new Array(remaining);\n possiblePromises.forEach((p, i) => Promise.resolve(p).then(\n value => results[i] = {status: \"fulfilled\", value},\n reason => results[i] = {status: \"rejected\", reason})\n .then(()=>--remaining || resolve(results)));\n });\n}\n","import { DBCoreTable, DBCoreTransaction } from \"dexie\";\nimport { allSettled } from \"../helpers/allSettled\";\n\nlet counter = 0;\n\nexport function guardedTable(table: DBCoreTable) {\n const prop = \"$lock\"+ (++counter);\n return {\n ...table,\n count: readLock(table.count, prop),\n get: readLock(table.get, prop),\n getMany: readLock(table.getMany, prop),\n openCursor: readLock(table.openCursor, prop),\n query: readLock(table.query, prop),\n mutate: writeLock(table.mutate, prop),\n };\n}\n\nfunction readLock<TReq extends { trans: DBCoreTransaction }, TRes>(\n fn: (req: TReq) => Promise<TRes>,\n prop: string\n): (req: TReq) => Promise<TRes> {\n return function readLocker(req): Promise<TRes> {\n const {\n readers,\n writers,\n }: { writers: Promise<any>[]; readers: Promise<any>[] } =\n req.trans[prop] || (req.trans[prop] = { writers: [], readers: [] });\n const numWriters = writers.length;\n const promise = (numWriters > 0\n ? writers[numWriters - 1].then(() => fn(req), () => fn(req))\n : fn(req)\n ).finally(() => readers.splice(readers.indexOf(promise)));\n readers.push(promise);\n return promise;\n };\n}\n\nfunction writeLock<TReq extends { trans: DBCoreTransaction }, TRes>(\n fn: (req: TReq) => Promise<TRes>,\n prop: string\n): (req: TReq) => Promise<TRes> {\n return function writeLocker(req): Promise<TRes> {\n const {\n readers,\n writers,\n }: { writers: Promise<any>[]; readers: Promise<any>[] } =\n req.trans[prop] || (req.trans[prop] = { writers: [], readers: [] });\n let promise = (writers.length > 0\n ? writers[writers.length - 1].then(() => fn(req), () => fn(req))\n : readers.length > 0\n ? allSettled(readers).then(() => fn(req))\n : fn(req)\n ).finally(() => writers.shift());\n writers.push(promise);\n return promise;\n };\n}\n","import { DBCoreTransaction } from 'dexie';\nimport { BehaviorSubject } from 'rxjs';\nimport { TXExpandos } from '../types/TXExpandos';\n\nexport const outstandingTransactions = new BehaviorSubject<Set<DBCoreTransaction & IDBTransaction & TXExpandos>>(new Set());\n","import { DexieCloudDB } from './db/DexieCloudDB';\n\nexport function isEagerSyncDisabled(db: DexieCloudDB) {\n return (\n db.cloud.options?.disableEagerSync ||\n db.cloud.currentUser.value?.license?.status !== 'ok' ||\n !db.cloud.options?.databaseUrl\n );\n}\n","import {\n DBCore,\n DBCoreAddRequest,\n DBCoreDeleteRequest,\n DBCoreMutateResponse,\n DBCorePutRequest,\n DBCoreTable,\n DBCoreTransaction,\n Middleware,\n} from 'dexie';\nimport { DBOperation } from 'dexie-cloud-common';\nimport { BehaviorSubject } from 'rxjs';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { UserLogin } from '../db/entities/UserLogin';\nimport { getMutationTable } from '../helpers/getMutationTable';\nimport { randomString } from '../helpers/randomString';\nimport { throwVersionIncrementNeeded } from '../helpers/throwVersionIncrementNeeded';\nimport { guardedTable } from '../middleware-helpers/guardedTable';\nimport { registerSyncEvent } from '../sync/registerSyncEvent';\nimport { TXExpandos } from '../types/TXExpandos';\nimport { outstandingTransactions } from './outstandingTransaction';\nimport { isEagerSyncDisabled } from '../isEagerSyncDisabled';\nimport { triggerSync } from '../sync/triggerSync';\n\nexport interface MutationTrackingMiddlewareArgs {\n currentUserObservable: BehaviorSubject<UserLogin>;\n db: DexieCloudDB;\n}\n\n/** Tracks all mutations in the same transaction as the mutations -\n * so it is guaranteed that no mutation goes untracked - and if transaction\n * aborts, the mutations won't be tracked.\n *\n * The sync job will use the tracked mutations as the source of truth when pushing\n * changes to server and cleanup the tracked mutations once the server has\n * ackowledged that it got them.\n */\nexport function createMutationTrackingMiddleware({\n currentUserObservable,\n db,\n}: MutationTrackingMiddlewareArgs): Middleware<DBCore> {\n return {\n stack: 'dbcore',\n name: 'MutationTrackingMiddleware',\n level: 1,\n create: (core) => {\n const ordinaryTables = core.schema.tables.filter(\n (t) => !/^\\$/.test(t.name)\n );\n let mutTableMap: Map<string, DBCoreTable>;\n try {\n mutTableMap = new Map(\n ordinaryTables.map((tbl) => [\n tbl.name,\n core.table(`$${tbl.name}_mutations`),\n ])\n );\n } catch {\n throwVersionIncrementNeeded();\n }\n\n return {\n ...core,\n transaction: (tables, mode) => {\n let tx: DBCoreTransaction & IDBTransaction & TXExpandos;\n if (mode === 'readwrite') {\n const mutationTables = tables\n .filter((tbl) => db.cloud.schema?.[tbl]?.markedForSync)\n .map((tbl) => getMutationTable(tbl));\n tx = core.transaction(\n [...tables, ...mutationTables],\n mode\n ) as DBCoreTransaction & IDBTransaction & TXExpandos;\n } else {\n tx = core.transaction(tables, mode) as DBCoreTransaction &\n IDBTransaction &\n TXExpandos;\n }\n\n if (mode === 'readwrite') {\n // Give each transaction a globally unique id.\n tx.txid = randomString(16);\n tx.opCount = 0;\n // Introduce the concept of current user that lasts through the entire transaction.\n // This is important because the tracked mutations must be connected to the user.\n tx.currentUser = currentUserObservable.value;\n outstandingTransactions.value.add(tx);\n outstandingTransactions.next(outstandingTransactions.value);\n const removeTransaction = () => {\n tx.removeEventListener('complete', txComplete);\n tx.removeEventListener('error', removeTransaction);\n tx.removeEventListener('abort', removeTransaction);\n outstandingTransactions.value.delete(tx);\n outstandingTransactions.next(outstandingTransactions.value);\n };\n const txComplete = () => {\n if (\n tx.mutationsAdded &&\n !isEagerSyncDisabled(db)\n ) {\n triggerSync(db, 'push');\n }\n removeTransaction();\n };\n tx.addEventListener('complete', txComplete);\n tx.addEventListener('error', removeTransaction);\n tx.addEventListener('abort', removeTransaction);\n }\n return tx;\n },\n table: (tableName) => {\n const table = core.table(tableName);\n if (/^\\$/.test(tableName)) {\n if (tableName.endsWith('_mutations')) {\n // In case application code adds items to ..._mutations tables,\n // make sure to set the mutationsAdded flag on transaction.\n // This is also done in mutateAndLog() as that function talks to a\n // lower level DBCore and wouldn't be catched by this code.\n return {\n ...table,\n mutate: (req) => {\n if (req.type === 'add' || req.type === 'put') {\n (\n req.trans as DBCoreTransaction & TXExpandos\n ).mutationsAdded = true;\n }\n return table.mutate(req);\n },\n };\n } else if (tableName === '$logins') {\n return {\n ...table,\n mutate: (req) => {\n //console.debug('Mutating $logins table', req);\n return table\n .mutate(req)\n .then((res) => {\n //console.debug('Mutating $logins');\n (\n req.trans as DBCoreTransaction & TXExpandos\n ).mutationsAdded = true;\n //console.debug('$logins mutated');\n return res;\n })\n .catch((err) => {\n console.debug('Failed mutation $logins', err);\n return Promise.reject(err);\n });\n },\n };\n } else {\n return table;\n }\n }\n const { schema } = table;\n const mutsTable = mutTableMap.get(tableName)!;\n return guardedTable({\n ...table,\n mutate: (req) => {\n const trans = req.trans as DBCoreTransaction & TXExpandos;\n if (!trans.txid) return table.mutate(req); // Upgrade transactions not guarded by us.\n if (trans.disableChangeTracking) return table.mutate(req);\n if (!db.cloud.schema?.[tableName]?.markedForSync)\n return table.mutate(req);\n if (!trans.currentUser?.isLoggedIn) {\n // Unauthorized user should not log mutations.\n // Instead, after login all local data should be logged at once.\n return table.mutate(req);\n }\n\n return req.type === 'deleteRange'\n ? table\n // Query the actual keys (needed for server sending correct rollback to us)\n .query({\n query: { range: req.range, index: schema.primaryKey },\n trans: req.trans,\n values: false,\n })\n // Do a delete request instead, but keep the criteria info for the server to execute\n .then((res) => {\n return mutateAndLog({\n type: 'delete',\n keys: res.result,\n trans: req.trans,\n criteria: { index: null, range: req.range },\n });\n })\n : mutateAndLog(req);\n },\n });\n\n function mutateAndLog(\n req: DBCoreDeleteRequest | DBCoreAddRequest | DBCorePutRequest\n ): Promise<DBCoreMutateResponse> {\n const trans = req.trans as DBCoreTransaction & TXExpandos;\n trans.mutationsAdded = true;\n const {\n txid,\n currentUser: { userId },\n } = trans;\n const { type } = req;\n const opNo = ++trans.opCount;\n\n return table.mutate(req).then((res) => {\n const { numFailures: hasFailures, failures } = res;\n let keys = type === 'delete' ? req.keys! : res.results!;\n let values = 'values' in req ? req.values : [];\n let updates = 'updates' in req && req.updates!;\n if (hasFailures) {\n keys = keys.filter((_, idx) => !failures[idx]);\n values = values.filter((_, idx) => !failures[idx]);\n }\n const ts = Date.now();\n\n const mut: DBOperation =\n req.type === 'delete'\n ? {\n type: 'delete',\n ts,\n opNo,\n keys,\n criteria: req.criteria,\n txid,\n userId,\n }\n : req.type === 'add'\n ? {\n type: 'insert',\n ts,\n opNo,\n keys,\n txid,\n userId,\n values,\n }\n : req.criteria && req.changeSpec\n ? {\n // Common changeSpec for all keys\n type: 'modify',\n ts,\n opNo,\n keys,\n criteria: req.criteria,\n changeSpec: req.changeSpec,\n txid,\n userId,\n }\n : updates\n ? {\n // One changeSpec per key\n type: 'update',\n ts,\n opNo,\n keys: updates.keys,\n changeSpecs: updates.changeSpecs,\n txid,\n userId,\n }\n : {\n type: 'upsert',\n ts,\n opNo,\n keys,\n values,\n txid,\n userId,\n };\n return keys.length > 0 || ('criteria' in req && req.criteria)\n ? mutsTable\n .mutate({ type: 'add', trans, values: [mut] }) // Log entry\n .then(() => res) // Return original response\n : res;\n });\n }\n },\n };\n },\n };\n}\n","import Dexie, { DbSchema } from 'dexie';\nimport { DEXIE_CLOUD_SCHEMA } from './db/DexieCloudDB';\nimport { generateTablePrefix } from './middleware-helpers/idGenerationHelpers';\n\nexport function overrideParseStoresSpec(origFunc: Function, dexie: Dexie) {\n return function(stores: {[tableName: string]: string}, dbSchema: DbSchema) {\n const storesClone = {\n ...DEXIE_CLOUD_SCHEMA,\n ...stores,\n };\n // Merge indexes of DEXIE_CLOUD_SCHEMA with stores\n Object.keys(DEXIE_CLOUD_SCHEMA).forEach((tableName: keyof typeof DEXIE_CLOUD_SCHEMA) => {\n const schemaSrc = storesClone[tableName];\n // Verify that they don't try to delete a table that is needed for access control of Dexie Cloud\n if (schemaSrc == null) {\n // They try to delete one of the built-in schema tables.\n throw new Error(`Cannot delete table ${tableName} as it is needed for access control of Dexie Cloud`);\n }\n // If not trying to override a built-in table, then we can skip this and continue to next table.\n if (!stores[tableName]) {\n // They haven't tried to declare this table. No need to merge indexes.\n return; // Continue\n }\n\n // They have declared this table. Merge indexes in case they didn't declare all indexes we need.\n const requestedIndexes = schemaSrc.split(',').map(spec => spec.trim());\n const builtInIndexes = DEXIE_CLOUD_SCHEMA[tableName].split(',').map(spec => spec.trim());\n const requestedIndexSet = new Set(requestedIndexes.map(index => index.replace(/([&*]|\\+\\+)/g, \"\")));\n // Verify that primary key is unchanged\n if (requestedIndexes[0] !== builtInIndexes[0]) {\n // Primary key must match exactly\n throw new Error(`Cannot override primary key of table ${tableName}. Please declare it as {${\n tableName}: ${\n JSON.stringify(DEXIE_CLOUD_SCHEMA[tableName])\n }`);\n }\n // Merge indexes\n for (let i=1; i<builtInIndexes.length; ++i) {\n const builtInIndex = builtInIndexes[i];\n if (!requestedIndexSet.has(builtInIndex.replace(/([&*]|\\+\\+)/g, \"\"))) {\n // Add built-in index if not already requested\n storesClone[tableName] += `,${builtInIndex}`;\n }\n }\n });\n\n // Populate dexie.cloud.schema\n const cloudSchema = dexie.cloud.schema || (dexie.cloud.schema = {});\n const allPrefixes = new Set<string>();\n Object.keys(storesClone).forEach(tableName => {\n const schemaSrc = storesClone[tableName];\n const cloudTableSchema = cloudSchema[tableName] || (cloudSchema[tableName] = {});\n if (schemaSrc != null) {\n if (/^\\@/.test(schemaSrc)) {\n storesClone[tableName] = storesClone[tableName].substr(1);\n cloudTableSchema.generatedGlobalId = true;\n cloudTableSchema.idPrefix = generateTablePrefix(tableName, allPrefixes);\n allPrefixes.add(cloudTableSchema.idPrefix);\n }\n if (!/^\\$/.test(tableName)) {\n storesClone[`$${tableName}_mutations`] = '++rev';\n cloudTableSchema.markedForSync = true;\n }\n if (cloudTableSchema.deleted) {\n cloudTableSchema.deleted = false;\n }\n } else {\n cloudTableSchema.deleted = true;\n cloudTableSchema.markedForSync = false;\n storesClone[`$${tableName}_mutations`] = null;\n }\n });\n const rv = origFunc.call(this, storesClone, dbSchema);\n return rv;\n }\n}\n","import { DexieCloudSchema } from 'dexie-cloud-common';\nimport { DexieCloudDB } from './db/DexieCloudDB';\nimport { DexieCloudOptions } from './DexieCloudOptions';\nimport { performGuardedJob } from './sync/performGuardedJob';\nimport { sync } from './sync/sync';\n\nexport async function performInitialSync(\n db: DexieCloudDB,\n cloudOptions: DexieCloudOptions,\n cloudSchema: DexieCloudSchema\n) {\n console.debug('Performing initial sync'); \n await sync(db, cloudOptions, cloudSchema, { isInitialSync: true });\n console.debug('Done initial sync');\n}\n","import { BehaviorSubject, fromEvent, merge, of } from 'rxjs';\nimport {\n debounceTime,\n delay,\n distinctUntilChanged,\n filter,\n map,\n skip,\n startWith,\n switchMap,\n tap,\n} from 'rxjs/operators';\n\nconst USER_INACTIVITY_TIMEOUT = 180_000; // 3 minutes\nconst ACTIVE_WAIT_TIME = 0; // For now, it's nicer to react instantly on user activity\nconst INACTIVE_WAIT_TIME = 20_000;\n\n// This observable will be emitted to later down....\nexport const userIsActive = new BehaviorSubject<boolean>(true);\n\n// A refined version that waits before changing state:\n// * Wait another INACTIVE_WAIT_TIME before accepting that the user is inactive.\n// Reason 1: Spare resources - no need to setup the entire websocket flow when\n// switching tabs back and forth.\n// Reason 2: Less flickering for the end user when switching tabs back and forth.\n// * Wait another ACTIVE_WAIT_TIME before accepting that the user is active.\n// Possible reason to have a value here: Sparing resources if users often temporary click the tab\n// for just a short time.\nexport const userIsReallyActive = new BehaviorSubject<boolean>(true);\nuserIsActive\n .pipe(\n switchMap((isActive) => {\n //console.debug('SyncStatus: DUBB: isActive changed to', isActive);\n return isActive\n ? ACTIVE_WAIT_TIME\n ? of(true).pipe(delay(ACTIVE_WAIT_TIME))\n : of(true)\n : INACTIVE_WAIT_TIME\n ? of(false).pipe(delay(INACTIVE_WAIT_TIME))\n : of(false);}\n ),\n distinctUntilChanged()\n )\n .subscribe(userIsReallyActive);\n\n//\n// First create some corner-stone observables to build the flow on\n//\n\n// document.onvisibilitychange:\nexport const visibilityStateIsChanged =\n typeof document !== 'undefined'\n ? fromEvent(document, 'visibilitychange')\n : of({});\n\n// document.onvisibilitychange makes document hidden:\nexport const documentBecomesHidden = visibilityStateIsChanged.pipe(\n filter(() => document.visibilityState === 'hidden')\n);\n\n// document.onvisibilitychange makes document visible\nexport const documentBecomesVisible = visibilityStateIsChanged.pipe(\n filter(() => document.visibilityState === 'visible')\n);\n\n// Any of various user-activity-related events happen:\nexport const userDoesSomething =\n typeof window !== 'undefined'\n ? merge(\n documentBecomesVisible,\n fromEvent(window, 'mousedown'),\n fromEvent(window, 'mousemove'),\n fromEvent(window, 'keydown'),\n fromEvent(window, 'wheel'),\n fromEvent(window, 'touchmove')\n )\n : of({});\n\nif (typeof document !== 'undefined') {\n //\n // Now, create a final observable and start subscribing to it in order\n // to make it emit values to userIsActive BehaviourSubject (which is the\n // most important global hot observable we have here)\n //\n // Live test: https://jsitor.com/LboCDHgbn\n //\n merge(\n of(true), // Make sure something is always emitted from start\n documentBecomesHidden, // so that we can eagerly emit false!\n userDoesSomething\n )\n .pipe(\n // No matter event source, compute whether user is visible using visibilityState:\n map(() => document.visibilityState === 'visible'),\n // Make sure to emit it\n tap((isActive) => {\n if (userIsActive.value !== isActive) {\n // Emit new value unless it already has that value\n userIsActive.next(isActive);\n }\n }),\n // Now, if true was emitted, make sure to set a timeout to emit false\n // unless new user activity things happen (in that case, the timeout will be cancelled!)\n switchMap((isActive) =>\n isActive\n ? of(0).pipe(\n delay(USER_INACTIVITY_TIMEOUT - INACTIVE_WAIT_TIME),\n tap(() => userIsActive.next(false))\n )\n : of(0)\n )\n )\n .subscribe(() => {}); // Unless we subscribe nothing will be propagated to userIsActive observable\n}\n","export class TokenExpiredError extends Error {\n name = \"TokenExpiredError\";\n}\n","import { DBOperationsSet } from 'dexie-cloud-common';\nimport { BehaviorSubject, Observable, Subscriber, Subscription } from 'rxjs';\nimport { TokenExpiredError } from './authentication/TokenExpiredError';\nimport { DXCWebSocketStatus } from './DXCWebSocketStatus';\nimport { TSON } from './TSON';\n\nconst SERVER_PING_TIMEOUT = 20000;\nconst CLIENT_PING_INTERVAL = 30000;\nconst FAIL_RETRY_WAIT_TIME = 60000;\n\nexport type WSClientToServerMsg = ReadyForChangesMessage;\nexport interface ReadyForChangesMessage {\n type: 'ready';\n realmSetHash: string;\n rev: string;\n}\n\nexport type WSConnectionMsg =\n | RevisionChangedMessage\n | RealmAddedMessage\n | RealmAcceptedMessage\n | RealmRemovedMessage\n | RealmsChangedMessage\n | ChangesFromServerMessage\n | TokenExpiredMessage;\ninterface PingMessage {\n type: 'ping';\n}\n\ninterface PongMessage {\n type: 'pong';\n}\n\ninterface ErrorMessage {\n type: 'error';\n error: string;\n}\n\nexport interface ChangesFromServerMessage {\n type: 'changes';\n baseRev: string;\n realmSetHash: string;\n newRev: string;\n changes: DBOperationsSet<string>;\n}\nexport interface RevisionChangedMessage {\n type: 'rev';\n rev: string;\n}\n\nexport interface RealmAddedMessage {\n type: 'realm-added';\n realm: string;\n}\n\nexport interface RealmAcceptedMessage {\n type: 'realm-accepted';\n realm: string;\n}\n\nexport interface RealmRemovedMessage {\n type: 'realm-removed';\n realm: string;\n}\n\nexport interface RealmsChangedMessage {\n type: 'realms-changed';\n realmsHash: string;\n}\nexport interface TokenExpiredMessage {\n type: 'token-expired';\n}\n\nexport class WSObservable extends Observable<WSConnectionMsg> {\n constructor(\n databaseUrl: string,\n rev: string,\n realmSetHash: string,\n clientIdentity: string,\n messageProducer: Observable<WSClientToServerMsg>,\n webSocketStatus: BehaviorSubject<DXCWebSocketStatus>,\n token?: string,\n tokenExpiration?: Date\n ) {\n super(\n (subscriber) =>\n new WSConnection(\n databaseUrl,\n rev,\n realmSetHash,\n clientIdentity,\n token,\n tokenExpiration,\n subscriber,\n messageProducer,\n webSocketStatus\n )\n );\n }\n}\n\nlet counter = 0;\n\nexport class WSConnection extends Subscription {\n ws: WebSocket | null;\n lastServerActivity: Date;\n lastUserActivity: Date;\n lastPing: Date;\n databaseUrl: string;\n rev: string;\n realmSetHash: string;\n clientIdentity: string;\n token: string | undefined;\n tokenExpiration: Date | undefined;\n subscriber: Subscriber<WSConnectionMsg>;\n pauseUntil?: Date;\n messageProducer: Observable<WSClientToServerMsg>;\n webSocketStatus: BehaviorSubject<DXCWebSocketStatus>;\n id = ++counter;\n\n private pinger: any;\n private messageProducerSubscription: null | Subscription;\n\n constructor(\n databaseUrl: string,\n rev: string,\n realmSetHash: string,\n clientIdentity: string,\n token: string | undefined,\n tokenExpiration: Date | undefined,\n subscriber: Subscriber<WSConnectionMsg>,\n messageProducer: Observable<WSClientToServerMsg>,\n webSocketStatus: BehaviorSubject<DXCWebSocketStatus>\n ) {\n super(() => this.teardown());\n console.debug(\n 'New WebSocket Connection',\n this.id,\n token ? 'authorized' : 'unauthorized'\n );\n this.databaseUrl = databaseUrl;\n this.rev = rev;\n this.realmSetHash = realmSetHash;\n this.clientIdentity = clientIdentity;\n this.token = token;\n this.tokenExpiration = tokenExpiration;\n this.subscriber = subscriber;\n this.lastUserActivity = new Date();\n this.messageProducer = messageProducer;\n this.messageProducerSubscription = null;\n this.webSocketStatus = webSocketStatus;\n this.connect();\n }\n\n private teardown() {\n console.debug('Teardown WebSocket Connection', this.id);\n this.disconnect();\n }\n\n private disconnect() {\n this.webSocketStatus.next('disconnected');\n if (this.pinger) {\n clearInterval(this.pinger);\n this.pinger = null;\n }\n if (this.ws) {\n try {\n this.ws.close();\n } catch {}\n }\n this.ws = null;\n if (this.messageProducerSubscription) {\n this.messageProducerSubscription.unsubscribe();\n this.messageProducerSubscription = null;\n }\n }\n\n reconnecting = false;\n reconnect() {\n if (this.reconnecting) return;\n this.reconnecting = true;\n try {\n this.disconnect();\n } catch {}\n this.connect()\n .catch(() => {})\n .then(() => (this.reconnecting = false)); // finally()\n }\n\n async connect() {\n this.lastServerActivity = new Date();\n if (this.pauseUntil && this.pauseUntil > new Date()) {\n console.debug('WS not reconnecting just yet', {\n id: this.id,\n pauseUntil: this.pauseUntil,\n });\n return;\n }\n if (this.ws) {\n throw new Error(`Called connect() when a connection is already open`);\n }\n if (!this.databaseUrl)\n throw new Error(`Cannot connect without a database URL`);\n if (this.closed) {\n //console.debug('SyncStatus: DUBB: Ooops it was closed!');\n return;\n }\n if (this.tokenExpiration && this.tokenExpiration < new Date()) {\n this.subscriber.error(new TokenExpiredError()); // Will be handled in connectWebSocket.ts.\n return;\n }\n this.webSocketStatus.next('connecting');\n this.pinger = setInterval(async () => {\n if (this.closed) {\n console.debug('pinger check', this.id, 'CLOSED.');\n this.teardown();\n return;\n }\n if (this.ws) {\n try {\n this.ws.send(JSON.stringify({ type: 'ping' } as PingMessage));\n setTimeout(() => {\n console.debug(\n 'pinger setTimeout',\n this.id,\n this.pinger ? `alive` : 'dead'\n );\n if (!this.pinger) return;\n if (this.closed) {\n console.debug(\n 'pinger setTimeout',\n this.id,\n 'subscription is closed'\n );\n this.teardown();\n return;\n }\n if (\n this.lastServerActivity <\n new Date(Date.now() - SERVER_PING_TIMEOUT)\n ) {\n // Server inactive. Reconnect if user is active.\n console.debug('pinger: server is inactive');\n console.debug('pinger reconnecting');\n this.reconnect();\n } else {\n console.debug('pinger: server still active');\n }\n }, SERVER_PING_TIMEOUT);\n } catch {\n console.debug('pinger catch error', this.id, 'reconnecting');\n this.reconnect();\n }\n } else {\n console.debug('pinger', this.id, 'reconnecting');\n this.reconnect();\n }\n }, CLIENT_PING_INTERVAL);\n\n // The following vars are needed because we must know which callback to ack when server sends it's ack to us.\n const wsUrl = new URL(this.databaseUrl);\n wsUrl.protocol = wsUrl.protocol === 'http:' ? 'ws' : 'wss';\n const searchParams = new URLSearchParams();\n if (this.subscriber.closed) return;\n searchParams.set('v', '2');\n searchParams.set('rev', this.rev);\n searchParams.set('realmsHash', this.realmSetHash);\n searchParams.set('clientId', this.clientIdentity);\n if (this.token) {\n searchParams.set('token', this.token);\n }\n\n // Connect the WebSocket to given url:\n console.debug('dexie-cloud WebSocket create');\n const ws = (this.ws = new WebSocket(`${wsUrl}/changes?${searchParams}`));\n //ws.binaryType = \"arraybuffer\"; // For future when subscribing to actual changes.\n\n ws.onclose = (event: Event) => {\n if (!this.pinger) return;\n console.debug('dexie-cloud WebSocket onclosed', this.id);\n this.reconnect();\n };\n\n ws.onmessage = (event: MessageEvent) => {\n if (!this.pinger) return;\n console.debug('dexie-cloud WebSocket onmessage', event.data);\n\n this.lastServerActivity = new Date();\n try {\n const msg = TSON.parse(event.data) as\n | WSConnectionMsg\n | PongMessage\n | ErrorMessage;\n if (msg.type === 'error') {\n throw new Error(`Error message from dexie-cloud: ${msg.error}`);\n }\n if (msg.type === 'rev') {\n this.rev = msg.rev; // No meaning but seems reasonable.\n }\n if (msg.type !== 'pong') {\n this.subscriber.next(msg);\n }\n } catch (e) {\n this.subscriber.error(e);\n }\n };\n\n try {\n let everConnected = false;\n await new Promise((resolve, reject) => {\n ws.onopen = (event) => {\n console.debug('dexie-cloud WebSocket onopen');\n everConnected = true;\n resolve(null);\n };\n ws.onerror = (event: ErrorEvent) => {\n if (!everConnected) {\n const error = event.error || new Error('WebSocket Error');\n this.subscriber.error(error);\n this.webSocketStatus.next('error');\n reject(error);\n } else {\n this.reconnect();\n }\n };\n });\n this.messageProducerSubscription = this.messageProducer.subscribe(\n (msg) => {\n if (!this.closed) {\n if (\n msg.type === 'ready' &&\n this.webSocketStatus.value !== 'connected'\n ) {\n this.webSocketStatus.next('connected');\n }\n this.ws?.send(TSON.stringify(msg));\n }\n }\n );\n } catch (error) {\n this.pauseUntil = new Date(Date.now() + FAIL_RETRY_WAIT_TIME);\n }\n }\n}\n","export class InvalidLicenseError extends Error {\n name = 'InvalidLicenseError';\n license?: 'expired' | 'deactivated';\n constructor(license?: 'expired' | 'deactivated') {\n super(\n license === 'expired'\n ? `License expired`\n : license === 'deactivated'\n ? `User deactivated`\n : 'Invalid license'\n );\n if (license) {\n this.license = license;\n }\n }\n}\n","import { BehaviorSubject, from, Observable, of, throwError } from 'rxjs';\nimport {\n catchError,\n debounceTime,\n delay,\n distinctUntilChanged,\n filter,\n map,\n switchMap,\n take,\n tap,\n} from 'rxjs/operators';\nimport { refreshAccessToken } from '../authentication/authenticate';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { PersistedSyncState } from '../db/entities/PersistedSyncState';\nimport { computeRealmSetHash } from '../helpers/computeRealmSetHash';\nimport {\n userDoesSomething,\n userIsActive,\n userIsReallyActive,\n} from '../userIsActive';\nimport {\n ReadyForChangesMessage,\n WSConnectionMsg,\n WSObservable,\n} from '../WSObservable';\nimport { InvalidLicenseError } from '../InvalidLicenseError';\n\nfunction sleep(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nasync function waitAndReconnectWhenUserDoesSomething(error: Error) {\n console.error(\n `WebSocket observable: error but revive when user does some active thing...`,\n error\n );\n // Sleep some seconds...\n await sleep(3000);\n // Wait til user does something (move mouse, tap, scroll, click etc)\n console.debug('waiting for someone to do something');\n await userDoesSomething.pipe(take(1)).toPromise();\n console.debug('someone did something!');\n}\n\nexport function connectWebSocket(db: DexieCloudDB) {\n if (!db.cloud.options?.databaseUrl) {\n throw new Error(`No database URL to connect WebSocket to`);\n }\n\n const messageProducer = db.messageConsumer.readyToServe.pipe(\n filter((isReady) => isReady), // When consumer is ready for new messages, produce such a message to inform server about it\n switchMap(() => db.getPersistedSyncState()), // We need the info on which server revision we are at:\n filter((syncState) => syncState && syncState.serverRevision), // We wont send anything to server before inital sync has taken place\n switchMap<PersistedSyncState, Promise<ReadyForChangesMessage>>(async (syncState) => ({\n // Produce the message to trigger server to send us new messages to consume:\n type: 'ready',\n rev: syncState.serverRevision,\n realmSetHash: await computeRealmSetHash(syncState)\n }))\n );\n\n function createObservable(): Observable<WSConnectionMsg | null> {\n return db.cloud.persistedSyncState.pipe(\n filter((syncState) => syncState?.serverRevision), // Don't connect before there's no initial sync performed.\n take(1), // Don't continue waking up whenever syncState change\n switchMap((syncState) =>\n db.cloud.currentUser.pipe(\n map((userLogin) => [userLogin, syncState] as const)\n )\n ),\n switchMap(([userLogin, syncState]) => {\n /*if (userLogin.license?.status && userLogin.license.status !== 'ok') {\n throw new InvalidLicenseError();\n }*/\n return userIsReallyActive.pipe(\n map((isActive) => [isActive ? userLogin : null, syncState] as const)\n );\n }),\n switchMap(([userLogin, syncState]) => {\n if (userLogin?.isLoggedIn && !syncState?.realms.includes(userLogin.userId!)) {\n // We're in an in-between state when user is logged in but the user's realms are not yet synced.\n // Don't make this change reconnect the websocket just yet. Wait till syncState is updated\n // to iclude the user's realm.\n return db.cloud.persistedSyncState.pipe(\n filter((syncState) => syncState?.realms.includes(userLogin!.userId!) || false),\n take(1),\n map((syncState) => [userLogin, syncState] as const)\n );\n }\n return new BehaviorSubject([userLogin, syncState] as const);\n }),\n switchMap(\n async ([userLogin, syncState]) =>\n [userLogin, await computeRealmSetHash(syncState!)] as const\n ),\n distinctUntilChanged(([prevUser, prevHash], [currUser, currHash]) => prevUser === currUser && prevHash === currHash ),\n switchMap(([userLogin, realmSetHash]) => {\n // Let server end query changes from last entry of same client-ID and forward.\n // If no new entries, server won't bother the client. If new entries, server sends only those\n // and the baseRev of the last from same client-ID.\n if (userLogin) {\n return new WSObservable(\n db.cloud.options!.databaseUrl,\n db.cloud.persistedSyncState!.value!.serverRevision,\n realmSetHash,\n db.cloud.persistedSyncState!.value!.clientIdentity,\n messageProducer,\n db.cloud.webSocketStatus,\n userLogin.accessToken,\n userLogin.accessTokenExpiration\n );\n } else {\n return from([] as WSConnectionMsg[]);\n }}),\n catchError((error) => {\n if (error?.name === 'TokenExpiredError') {\n console.debug(\n 'WebSocket observable: Token expired. Refreshing token...'\n );\n return of(true).pipe(\n switchMap(async () => {\n // Refresh access token\n const user = await db.getCurrentUser();\n const refreshedLogin = await refreshAccessToken(\n db.cloud.options!.databaseUrl,\n user\n );\n // Persist updated access token\n await db.table('$logins').update(user.userId, {\n accessToken: refreshedLogin.accessToken,\n accessTokenExpiration: refreshedLogin.accessTokenExpiration,\n claims: refreshedLogin.claims,\n license: refreshedLogin.license,\n });\n }),\n switchMap(() => createObservable())\n );\n } else {\n return throwError(()=>error);\n }\n }),\n catchError((error) => {\n db.cloud.webSocketStatus.next(\"error\");\n if (error instanceof InvalidLicenseError) {\n // Don't retry. Just throw and don't try connect again.\n return throwError(() => error);\n }\n return from(waitAndReconnectWhenUserDoesSomething(error)).pipe(\n switchMap(() => createObservable())\n );\n })\n ) as Observable<WSConnectionMsg | null>;\n }\n\n return createObservable().subscribe({\n next: (msg) => {\n if (msg) {\n console.debug('WS got message', msg);\n db.messageConsumer.enqueue(msg);\n }\n },\n error: (error) => {\n console.error('WS got error', error);\n },\n complete: () => {\n console.debug('WS observable completed');\n },\n });\n}\n","import { DexieCloudDB } from \"../db/DexieCloudDB\";\nimport { sync } from \"./sync\";\n\nexport async function isSyncNeeded(db: DexieCloudDB) {\n return db.cloud.options?.databaseUrl && db.cloud.schema\n ? await sync(db, db.cloud.options, db.cloud.schema, {justCheckIfNeeded: true})\n : false;\n}\n","import { DexieCloudDB } from \"../db/DexieCloudDB\";\n\nexport function performGuardedJob<T>(\n db: DexieCloudDB,\n jobName: string,\n job: () => Promise<T>\n): Promise<T> {\n if (typeof navigator === 'undefined' || !navigator.locks) {\n // No support for guarding jobs. IE11, node.js, etc.\n return job();\n }\n return navigator.locks.request(db.name + '|' + jobName, () => job());\n}\n","import { IS_SERVICE_WORKER } from '../helpers/IS_SERVICE_WORKER';\nimport { performGuardedJob } from './performGuardedJob';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { sync, CURRENT_SYNC_WORKER, SyncOptions } from './sync';\nimport { DexieCloudOptions } from '../DexieCloudOptions';\nimport { assert, DexieCloudSchema } from 'dexie-cloud-common';\nimport { checkSyncRateLimitDelay } from './ratelimit';\n\nconst ongoingSyncs = new WeakMap<\n DexieCloudDB,\n { promise: Promise<void>; pull: boolean }\n>();\n\nexport function syncIfPossible(\n db: DexieCloudDB,\n cloudOptions: DexieCloudOptions,\n cloudSchema: DexieCloudSchema,\n options?: SyncOptions\n) {\n const ongoing = ongoingSyncs.get(db);\n if (ongoing) {\n if (ongoing.pull || options?.purpose === 'push') {\n console.debug('syncIfPossible(): returning the ongoing sync promise.');\n return ongoing.promise;\n } else {\n // Ongoing sync may never do anything in case there are no outstanding changes\n // to sync (because its purpose was \"push\" not \"pull\")\n // Now, however, we are asked to do a sync with the purpose of \"pull\"\n // We want to optimize here. We must wait for the ongoing to complete\n // and then, if the ongoing sync never resulted in a sync request,\n // we must redo the sync.\n\n // To inspect what is happening in the ongoing request, let's subscribe\n // to db.cloud.syncState and look for if it is doing any \"pulling\" phase:\n let hasPullTakenPlace = false;\n const subscription = db.cloud.syncState.subscribe((syncState) => {\n if (syncState.phase === 'pulling') {\n hasPullTakenPlace = true;\n }\n });\n // Ok, so now we are watching. At the same time, wait for the ongoing to complete\n // and when it has completed, check if we're all set or if we need to redo\n // the call:\n return (\n ongoing.promise\n // This is a finally block but we are still running tests on\n // browsers that don't support it, so need to do it like this:\n .then(() => {\n subscription.unsubscribe();\n })\n .catch((error) => {\n subscription.unsubscribe();\n return Promise.reject(error);\n })\n .then(() => {\n if (!hasPullTakenPlace) {\n // No pull took place in the ongoing sync but the caller had \"pull\" as\n // an explicit purpose of this call - so we need to redo the call!\n return syncIfPossible(db, cloudOptions, cloudSchema, options);\n }\n })\n );\n }\n }\n\n const promise = _syncIfPossible();\n ongoingSyncs.set(db, { promise, pull: options?.purpose !== 'push' });\n return promise;\n\n async function _syncIfPossible() {\n try {\n // Check if should delay sync due to ratelimit:\n await checkSyncRateLimitDelay(db);\n \n // Check if we need to lock the sync job. Not needed if we are the service worker.\n if (db.cloud.isServiceWorkerDB) {\n // We are the dedicated sync SW:\n await sync(db, cloudOptions, cloudSchema, options);\n } else if (!db.cloud.usingServiceWorker) {\n // We use a flow that is better suited for the case when multiple workers want to\n // do the same thing.\n await performGuardedJob(db, CURRENT_SYNC_WORKER, () =>\n sync(db, cloudOptions, cloudSchema, options)\n );\n } else {\n assert(false);\n throw new Error('Internal _syncIfPossible() - invalid precondition - should not have been called.');\n }\n ongoingSyncs.delete(db);\n console.debug('Done sync');\n } catch (error) {\n ongoingSyncs.delete(db);\n console.error(`Failed to sync client changes`, error);\n throw error; // Make sure we rethrow error so that sync event is retried.\n // I don't think we should setTimout or so here.\n // Unless server tells us to in some response.\n // Then we could follow that advice but not by waiting here but by registering\n // Something that triggers an event listened to in startPushWorker()\n }\n }\n}\n","export const SECONDS = 1000;\nexport const MINUTES = 60 * SECONDS;\nexport const HOURS = 60 * MINUTES;\nexport const DAYS = 24 * HOURS;\nexport const WEEKS = 7 * DAYS;\n","import Dexie from 'dexie';\nimport { Subscription } from 'rxjs';\nimport { syncIfPossible } from './syncIfPossible';\nimport { DexieCloudDB } from '../db/DexieCloudDB';\nimport { MINUTES } from '../helpers/date-constants';\nimport { DexieCloudOptions } from '../DexieCloudOptions';\nimport { DexieCloudSchema } from 'dexie-cloud-common';\n\nexport function LocalSyncWorker(\n db: DexieCloudDB,\n cloudOptions: DexieCloudOptions,\n cloudSchema: DexieCloudSchema\n) {\n let localSyncEventSubscription: Subscription | null = null;\n //let syncHandler: ((event: Event) => void) | null = null;\n //let periodicSyncHandler: ((event: Event) => void) | null = null;\n let cancelToken = { cancelled: false };\n\n let retryHandle: any = null;\n let retryPurpose: 'pull' | 'push' | null = null; // \"pull\" is superset of \"push\"\n\n function syncAndRetry(purpose: 'pull' | 'push', retryNum = 1) {\n // Use setTimeout() to get onto a clean stack and\n // break free from possible active transaction:\n setTimeout(() => {\n if (retryHandle) clearTimeout(retryHandle);\n const combPurpose = retryPurpose === 'pull' ? 'pull' : purpose;\n retryHandle = null;\n retryPurpose = null;\n syncIfPossible(db, cloudOptions, cloudSchema, {\n cancelToken,\n retryImmediatelyOnFetchError: true, // workaround for \"net::ERR_NETWORK_CHANGED\" in chrome.\n purpose: combPurpose,\n }).catch((e) => {\n console.error('error in syncIfPossible()', e);\n if (cancelToken.cancelled) {\n stop();\n } else if (retryNum < 3) {\n\n // Mimic service worker sync event: retry 3 times\n // * first retry after 5 minutes\n // * second retry 15 minutes later\n const combinedPurpose = retryPurpose && retryPurpose === 'pull' ? 'pull' : purpose;\n\n const handle = setTimeout(\n () => syncAndRetry(combinedPurpose, retryNum + 1),\n [0, 5, 15][retryNum] * MINUTES\n );\n\n // Cancel the previous retryHandle if it exists to avoid scheduling loads of retries.\n if (retryHandle) clearTimeout(retryHandle);\n retryHandle = handle;\n retryPurpose = combinedPurpose;\n }\n });\n }, 0);\n }\n\n const start = () => {\n // Sync eagerly whenever a change has happened (+ initially when there's no syncState yet)\n // This initial subscribe will also trigger an sync also now.\n console.debug('Starting LocalSyncWorker', db.localSyncEvent['id']);\n localSyncEventSubscription = db.localSyncEvent.subscribe(({ purpose }) => {\n try {\n syncAndRetry(purpose || 'pull');\n } catch (err) {\n console.error('What-the....', err);\n }\n });\n //setTimeout(()=>db.localSyncEvent.next({}), 5000);\n };\n\n const stop = () => {\n console.debug('Stopping LocalSyncWorker');\n cancelToken.cancelled = true;\n if (localSyncEventSubscription) localSyncEventSubscription.unsubscribe();\n };\n\n return {\n start,\n stop,\n };\n}\n","import { DexieCloudSchema } from \"dexie-cloud-common\";\nimport { DexieCloudOptions } from \"./DexieCloudOptions\";\n\nexport function updateSchemaFromOptions(schema?: DexieCloudSchema | null, options?: DexieCloudOptions | null) {\n if (schema && options) {\n if (options.unsyncedTables) {\n for (const tableName of options.unsyncedTables) {\n if (schema[tableName]) {\n schema[tableName].markedForSync = false;\n }\n }\n }\n }\n}","import Dexie from \"dexie\";\nimport { DexieCloudDB } from \"./db/DexieCloudDB\";\n\nexport function verifySchema(db: DexieCloudDB) {\n for (const table of db.tables) {\n if (db.cloud.schema?.[table.name]?.markedForSync) {\n if (table.schema.primKey.auto) {\n throw new Dexie.SchemaError(\n `Table ${table.name} is both autoIncremented and synced. ` +\n `Use db.cloud.configure({unsyncedTables: [${JSON.stringify(\n table.name\n )}]}) to blacklist it from sync`\n );\n }\n if (!table.schema.primKey.keyPath) {\n throw new Dexie.SchemaError(\n `Table ${table.name} cannot be both synced and outbound. ` +\n `Use db.cloud.configure({unsyncedTables: [${JSON.stringify(\n table.name\n )}]}) to blacklist it from sync`\n );\n }\n }\n }\n}\n","import { EMPTY_ARR } from \"./constants\";\n\n/**\n * Assign properties from `props` to `obj`\n * @template O, P The obj and props types\n * @param {O} obj The object to copy properties to\n * @param {P} props The object to copy properties from\n * @returns {O & P}\n */\nexport function assign(obj, props) {\n\t// @ts-ignore We change the type of `obj` to be `O & P`\n\tfor (let i in props) obj[i] = props[i];\n\treturn /** @type {O & P} */ (obj);\n}\n\n/**\n * Remove a child node from its parent if attached. This is a workaround for\n * IE11 which doesn't support `Element.prototype.remove()`. Using this function\n * is smaller than including a dedicated polyfill.\n * @param {Node} node The node to remove\n */\nexport function removeNode(node) {\n\tlet parentNode = node.parentNode;\n\tif (parentNode) parentNode.removeChild(node);\n}\n\nexport const slice = EMPTY_ARR.slice;\n","import { _catchError } from './diff/catch-error';\n\n/**\n * The `option` object can potentially contain callback functions\n * that are called during various stages of our renderer. This is the\n * foundation on which all our addons like `preact/debug`, `preact/compat`,\n * and `preact/hooks` are based on. See the `Options` type in `internal.d.ts`\n * for a full list of available option hooks (most editors/IDEs allow you to\n * ctrl+click or cmd+click on mac the type definition below).\n * @type {import('./internal').Options}\n */\nconst options = {\n\t_catchError\n};\n\nexport default options;\n","import { slice } from './util';\nimport options from './options';\n\nlet vnodeId = 0;\n\n/**\n * Create an virtual node (used for JSX)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component\n * constructor for this virtual node\n * @param {object | null | undefined} [props] The properties of the virtual node\n * @param {Array<import('.').ComponentChildren>} [children] The children of the virtual node\n * @returns {import('./internal').VNode}\n */\nexport function createElement(type, props, children) {\n\tlet normalizedProps = {},\n\t\tkey,\n\t\tref,\n\t\ti;\n\tfor (i in props) {\n\t\tif (i == 'key') key = props[i];\n\t\telse if (i == 'ref') ref = props[i];\n\t\telse normalizedProps[i] = props[i];\n\t}\n\n\tif (arguments.length > 2) {\n\t\tnormalizedProps.children =\n\t\t\targuments.length > 3 ? slice.call(arguments, 2) : children;\n\t}\n\n\t// If a Component VNode, check for and apply defaultProps\n\t// Note: type may be undefined in development, must never error here.\n\tif (typeof type == 'function' && type.defaultProps != null) {\n\t\tfor (i in type.defaultProps) {\n\t\t\tif (normalizedProps[i] === undefined) {\n\t\t\t\tnormalizedProps[i] = type.defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn createVNode(type, normalizedProps, key, ref, null);\n}\n\n/**\n * Create a VNode (used internally by Preact)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component\n * Constructor for this virtual node\n * @param {object | string | number | null} props The properties of this virtual node.\n * If this virtual node represents a text node, this is the text of the node (string or number).\n * @param {string | number | null} key The key for this virtual node, used when\n * diffing it against its children\n * @param {import('./internal').VNode[\"ref\"]} ref The ref property that will\n * receive a reference to its created child\n * @returns {import('./internal').VNode}\n */\nexport function createVNode(type, props, key, ref, original) {\n\t// V8 seems to be better at detecting type shapes if the object is allocated from the same call site\n\t// Do not inline into createElement and coerceToVNode!\n\tconst vnode = {\n\t\ttype,\n\t\tprops,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t// _nextDom must be initialized to undefined b/c it will eventually\n\t\t// be set to dom.nextSibling which can return `null` and it is important\n\t\t// to be able to distinguish between an uninitialized _nextDom and\n\t\t// a _nextDom that has been set to `null`\n\t\t_nextDom: undefined,\n\t\t_component: null,\n\t\t_hydrating: null,\n\t\tconstructor: undefined,\n\t\t_original: original == null ? ++vnodeId : original\n\t};\n\n\t// Only invoke the vnode hook if this was *not* a direct copy:\n\tif (original == null && options.vnode != null) options.vnode(vnode);\n\n\treturn vnode;\n}\n\nexport function createRef() {\n\treturn { current: null };\n}\n\nexport function Fragment(props) {\n\treturn props.children;\n}\n\n/**\n * Check if a the argument is a valid Preact VNode.\n * @param {*} vnode\n * @returns {vnode is import('./internal').VNode}\n */\nexport const isValidElement = vnode =>\n\tvnode != null && vnode.constructor === undefined;\n","import { assign } from './util';\nimport { diff, commitRoot } from './diff/index';\nimport options from './options';\nimport { Fragment } from './create-element';\n\n/**\n * Base Component class. Provides `setState()` and `forceUpdate()`, which\n * trigger rendering\n * @param {object} props The initial component props\n * @param {object} context The initial context from parent components'\n * getChildContext\n */\nexport function Component(props, context) {\n\tthis.props = props;\n\tthis.context = context;\n}\n\n/**\n * Update component state and schedule a re-render.\n * @this {import('./internal').Component}\n * @param {object | ((s: object, p: object) => object)} update A hash of state\n * properties to update with new values or a function that given the current\n * state and props returns a new partial state\n * @param {() => void} [callback] A function to be called once component state is\n * updated\n */\nComponent.prototype.setState = function(update, callback) {\n\t// only clone state when copying to nextState the first time.\n\tlet s;\n\tif (this._nextState != null && this._nextState !== this.state) {\n\t\ts = this._nextState;\n\t} else {\n\t\ts = this._nextState = assign({}, this.state);\n\t}\n\n\tif (typeof update == 'function') {\n\t\t// Some libraries like `immer` mark the current state as readonly,\n\t\t// preventing us from mutating it, so we need to clone it. See #2716\n\t\tupdate = update(assign({}, s), this.props);\n\t}\n\n\tif (update) {\n\t\tassign(s, update);\n\t}\n\n\t// Skip update if updater function returned null\n\tif (update == null) return;\n\n\tif (this._vnode) {\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Immediately perform a synchronous re-render of the component\n * @this {import('./internal').Component}\n * @param {() => void} [callback] A function to be called after component is\n * re-rendered\n */\nComponent.prototype.forceUpdate = function(callback) {\n\tif (this._vnode) {\n\t\t// Set render mode so that we can differentiate where the render request\n\t\t// is coming from. We need this because forceUpdate should never call\n\t\t// shouldComponentUpdate\n\t\tthis._force = true;\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Accepts `props` and `state`, and returns a new Virtual DOM tree to build.\n * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx).\n * @param {object} props Props (eg: JSX attributes) received from parent\n * element/component\n * @param {object} state The component's current state\n * @param {object} context Context object, as returned by the nearest\n * ancestor's `getChildContext()`\n * @returns {import('./index').ComponentChildren | void}\n */\nComponent.prototype.render = Fragment;\n\n/**\n * @param {import('./internal').VNode} vnode\n * @param {number | null} [childIndex]\n */\nexport function getDomSibling(vnode, childIndex) {\n\tif (childIndex == null) {\n\t\t// Use childIndex==null as a signal to resume the search from the vnode's sibling\n\t\treturn vnode._parent\n\t\t\t? getDomSibling(vnode._parent, vnode._parent._children.indexOf(vnode) + 1)\n\t\t\t: null;\n\t}\n\n\tlet sibling;\n\tfor (; childIndex < vnode._children.length; childIndex++) {\n\t\tsibling = vnode._children[childIndex];\n\n\t\tif (sibling != null && sibling._dom != null) {\n\t\t\t// Since updateParentDomPointers keeps _dom pointer correct,\n\t\t\t// we can rely on _dom to tell us if this subtree contains a\n\t\t\t// rendered DOM node, and what the first rendered DOM node is\n\t\t\treturn sibling._dom;\n\t\t}\n\t}\n\n\t// If we get here, we have not found a DOM node in this vnode's children.\n\t// We must resume from this vnode's sibling (in it's parent _children array)\n\t// Only climb up and search the parent if we aren't searching through a DOM\n\t// VNode (meaning we reached the DOM parent of the original vnode that began\n\t// the search)\n\treturn typeof vnode.type == 'function' ? getDomSibling(vnode) : null;\n}\n\n/**\n * Trigger in-place re-rendering of a component.\n * @param {import('./internal').Component} component The component to rerender\n */\nfunction renderComponent(component) {\n\tlet vnode = component._vnode,\n\t\toldDom = vnode._dom,\n\t\tparentDom = component._parentDom;\n\n\tif (parentDom) {\n\t\tlet commitQueue = [];\n\t\tconst oldVNode = assign({}, vnode);\n\t\toldVNode._original = vnode._original + 1;\n\n\t\tdiff(\n\t\t\tparentDom,\n\t\t\tvnode,\n\t\t\toldVNode,\n\t\t\tcomponent._globalContext,\n\t\t\tparentDom.ownerSVGElement !== undefined,\n\t\t\tvnode._hydrating != null ? [oldDom] : null,\n\t\t\tcommitQueue,\n\t\t\toldDom == null ? getDomSibling(vnode) : oldDom,\n\t\t\tvnode._hydrating\n\t\t);\n\t\tcommitRoot(commitQueue, vnode);\n\n\t\tif (vnode._dom != oldDom) {\n\t\t\tupdateParentDomPointers(vnode);\n\t\t}\n\t}\n}\n\n/**\n * @param {import('./internal').VNode} vnode\n */\nfunction updateParentDomPointers(vnode) {\n\tif ((vnode = vnode._parent) != null && vnode._component != null) {\n\t\tvnode._dom = vnode._component.base = null;\n\t\tfor (let i = 0; i < vnode._children.length; i++) {\n\t\t\tlet child = vnode._children[i];\n\t\t\tif (child != null && child._dom != null) {\n\t\t\t\tvnode._dom = vnode._component.base = child._dom;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn updateParentDomPointers(vnode);\n\t}\n}\n\n/**\n * The render queue\n * @type {Array<import('./internal').Component>}\n */\nlet rerenderQueue = [];\n\n/*\n * The value of `Component.debounce` must asynchronously invoke the passed in callback. It is\n * important that contributors to Preact can consistently reason about what calls to `setState`, etc.\n * do, and when their effects will be applied. See the links below for some further reading on designing\n * asynchronous APIs.\n * * [Designing APIs for Asynchrony](https://blog.izs.me/2013/08/designing-apis-for-asynchrony)\n * * [Callbacks synchronous and asynchronous](https://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/)\n */\n\nlet prevDebounce;\n\n/**\n * Enqueue a rerender of a component\n * @param {import('./internal').Component} c The component to rerender\n */\nexport function enqueueRender(c) {\n\tif (\n\t\t(!c._dirty &&\n\t\t\t(c._dirty = true) &&\n\t\t\trerenderQueue.push(c) &&\n\t\t\t!process._rerenderCount++) ||\n\t\tprevDebounce !== options.debounceRendering\n\t) {\n\t\tprevDebounce = options.debounceRendering;\n\t\t(prevDebounce || setTimeout)(process);\n\t}\n}\n\n/** Flush the render queue by rerendering all queued components */\nfunction process() {\n\tlet queue;\n\twhile ((process._rerenderCount = rerenderQueue.length)) {\n\t\tqueue = rerenderQueue.sort((a, b) => a._vnode._depth - b._vnode._depth);\n\t\trerenderQueue = [];\n\t\t// Don't update `renderCount` yet. Keep its value non-zero to prevent unnecessary\n\t\t// process() calls from getting scheduled while `queue` is still being consumed.\n\t\tqueue.some(c => {\n\t\t\tif (c._dirty) renderComponent(c);\n\t\t});\n\t}\n}\nprocess._rerenderCount = 0;\n","import { enqueueRender } from './component';\n\nexport let i = 0;\n\nexport function createContext(defaultValue, contextId) {\n\tcontextId = '__cC' + i++;\n\n\tconst context = {\n\t\t_id: contextId,\n\t\t_defaultValue: defaultValue,\n\t\t/** @type {import('./internal').FunctionComponent} */\n\t\tConsumer(props, contextValue) {\n\t\t\t// return props.children(\n\t\t\t// \tcontext[contextId] ? context[contextId].props.value : defaultValue\n\t\t\t// );\n\t\t\treturn props.children(contextValue);\n\t\t},\n\t\t/** @type {import('./internal').FunctionComponent} */\n\t\tProvider(props) {\n\t\t\tif (!this.getChildContext) {\n\t\t\t\tlet subs = [];\n\t\t\t\tlet ctx = {};\n\t\t\t\tctx[contextId] = this;\n\n\t\t\t\tthis.getChildContext = () => ctx;\n\n\t\t\t\tthis.shouldComponentUpdate = function(_props) {\n\t\t\t\t\tif (this.props.value !== _props.value) {\n\t\t\t\t\t\t// I think the forced value propagation here was only needed when `options.debounceRendering` was being bypassed:\n\t\t\t\t\t\t// https://github.com/preactjs/preact/commit/4d339fb803bea09e9f198abf38ca1bf8ea4b7771#diff-54682ce380935a717e41b8bfc54737f6R358\n\t\t\t\t\t\t// In those cases though, even with the value corrected, we're double-rendering all nodes.\n\t\t\t\t\t\t// It might be better to just tell folks not to use force-sync mode.\n\t\t\t\t\t\t// Currently, using `useContext()` in a class component will overwrite its `this.context` value.\n\t\t\t\t\t\t// subs.some(c => {\n\t\t\t\t\t\t// \tc.context = _props.value;\n\t\t\t\t\t\t// \tenqueueRender(c);\n\t\t\t\t\t\t// });\n\n\t\t\t\t\t\t// subs.some(c => {\n\t\t\t\t\t\t// \tc.context[contextId] = _props.value;\n\t\t\t\t\t\t// \tenqueueRender(c);\n\t\t\t\t\t\t// });\n\t\t\t\t\t\tsubs.some(enqueueRender);\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tthis.sub = c => {\n\t\t\t\t\tsubs.push(c);\n\t\t\t\t\tlet old = c.componentWillUnmount;\n\t\t\t\t\tc.componentWillUnmount = () => {\n\t\t\t\t\t\tsubs.splice(subs.indexOf(c), 1);\n\t\t\t\t\t\tif (old) old.call(c);\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn props.children;\n\t\t}\n\t};\n\n\t// Devtools needs access to the context object when it\n\t// encounters a Provider. This is necessary to support\n\t// setting `displayName` on the context object instead\n\t// of on the component itself. See:\n\t// https://reactjs.org/docs/context.html#contextdisplayname\n\n\treturn (context.Provider._contextRef = context.Consumer.contextType = context);\n}\n","export const EMPTY_OBJ = {};\nexport const EMPTY_ARR = [];\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n","import { diff, unmount, applyRef } from './index';\nimport { createVNode, Fragment } from '../create-element';\nimport { EMPTY_OBJ, EMPTY_ARR } from '../constants';\nimport { getDomSibling } from '../component';\n\n/**\n * Diff the children of a virtual node\n * @param {import('../internal').PreactElement} parentDom The DOM element whose\n * children are being diffed\n * @param {import('../internal').ComponentChildren[]} renderResult\n * @param {import('../internal').VNode} newParentVNode The new virtual\n * node whose children should be diff'ed against oldParentVNode\n * @param {import('../internal').VNode} oldParentVNode The old virtual\n * node whose children should be diff'ed against newParentVNode\n * @param {object} globalContext The current context object - modified by getChildContext\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node\n * @param {Array<import('../internal').PreactElement>} excessDomChildren\n * @param {Array<import('../internal').Component>} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').PreactElement} oldDom The current attached DOM\n * element any new dom elements should be placed around. Likely `null` on first\n * render (except when hydrating). Can be a sibling DOM element when diffing\n * Fragments that have siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} isHydrating Whether or not we are in hydration\n */\nexport function diffChildren(\n\tparentDom,\n\trenderResult,\n\tnewParentVNode,\n\toldParentVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating\n) {\n\tlet i, j, oldVNode, childVNode, newDom, firstChildDom, refs;\n\n\t// This is a compression of oldParentVNode!=null && oldParentVNode != EMPTY_OBJ && oldParentVNode._children || EMPTY_ARR\n\t// as EMPTY_OBJ._children should be `undefined`.\n\tlet oldChildren = (oldParentVNode && oldParentVNode._children) || EMPTY_ARR;\n\n\tlet oldChildrenLength = oldChildren.length;\n\n\tnewParentVNode._children = [];\n\tfor (i = 0; i < renderResult.length; i++) {\n\t\tchildVNode = renderResult[i];\n\n\t\tif (childVNode == null || typeof childVNode == 'boolean') {\n\t\t\tchildVNode = newParentVNode._children[i] = null;\n\t\t}\n\t\t// If this newVNode is being reused (e.g. <div>{reuse}{reuse}</div>) in the same diff,\n\t\t// or we are rendering a component (e.g. setState) copy the oldVNodes so it can have\n\t\t// it's own DOM & etc. pointers\n\t\telse if (\n\t\t\ttypeof childVNode == 'string' ||\n\t\t\ttypeof childVNode == 'number' ||\n\t\t\t// eslint-disable-next-line valid-typeof\n\t\t\ttypeof childVNode == 'bigint'\n\t\t) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tnull,\n\t\t\t\tchildVNode,\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tchildVNode\n\t\t\t);\n\t\t} else if (Array.isArray(childVNode)) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tFragment,\n\t\t\t\t{ children: childVNode },\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tnull\n\t\t\t);\n\t\t} else if (childVNode._depth > 0) {\n\t\t\t// VNode is already in use, clone it. This can happen in the following\n\t\t\t// scenario:\n\t\t\t// const reuse = <div />\n\t\t\t// <div>{reuse}<span />{reuse}</div>\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tchildVNode.type,\n\t\t\t\tchildVNode.props,\n\t\t\t\tchildVNode.key,\n\t\t\t\tnull,\n\t\t\t\tchildVNode._original\n\t\t\t);\n\t\t} else {\n\t\t\tchildVNode = newParentVNode._children[i] = childVNode;\n\t\t}\n\n\t\t// Terser removes the `continue` here and wraps the loop body\n\t\t// in a `if (childVNode) { ... } condition\n\t\tif (childVNode == null) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tchildVNode._parent = newParentVNode;\n\t\tchildVNode._depth = newParentVNode._depth + 1;\n\n\t\t// Check if we find a corresponding element in oldChildren.\n\t\t// If found, delete the array item by setting to `undefined`.\n\t\t// We use `undefined`, as `null` is reserved for empty placeholders\n\t\t// (holes).\n\t\toldVNode = oldChildren[i];\n\n\t\tif (\n\t\t\toldVNode === null ||\n\t\t\t(oldVNode &&\n\t\t\t\tchildVNode.key == oldVNode.key &&\n\t\t\t\tchildVNode.type === oldVNode.type)\n\t\t) {\n\t\t\toldChildren[i] = undefined;\n\t\t} else {\n\t\t\t// Either oldVNode === undefined or oldChildrenLength > 0,\n\t\t\t// so after this loop oldVNode == null or oldVNode is a valid value.\n\t\t\tfor (j = 0; j < oldChildrenLength; j++) {\n\t\t\t\toldVNode = oldChildren[j];\n\t\t\t\t// If childVNode is unkeyed, we only match similarly unkeyed nodes, otherwise we match by key.\n\t\t\t\t// We always match by type (in either case).\n\t\t\t\tif (\n\t\t\t\t\toldVNode &&\n\t\t\t\t\tchildVNode.key == oldVNode.key &&\n\t\t\t\t\tchildVNode.type === oldVNode.type\n\t\t\t\t) {\n\t\t\t\t\toldChildren[j] = undefined;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\toldVNode = null;\n\t\t\t}\n\t\t}\n\n\t\toldVNode = oldVNode || EMPTY_OBJ;\n\n\t\t// Morph the old element into the new one, but don't append it to the dom yet\n\t\tdiff(\n\t\t\tparentDom,\n\t\t\tchildVNode,\n\t\t\toldVNode,\n\t\t\tglobalContext,\n\t\t\tisSvg,\n\t\t\texcessDomChildren,\n\t\t\tcommitQueue,\n\t\t\toldDom,\n\t\t\tisHydrating\n\t\t);\n\n\t\tnewDom = childVNode._dom;\n\n\t\tif ((j = childVNode.ref) && oldVNode.ref != j) {\n\t\t\tif (!refs) refs = [];\n\t\t\tif (oldVNode.ref) refs.push(oldVNode.ref, null, childVNode);\n\t\t\trefs.push(j, childVNode._component || newDom, childVNode);\n\t\t}\n\n\t\tif (newDom != null) {\n\t\t\tif (firstChildDom == null) {\n\t\t\t\tfirstChildDom = newDom;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\ttypeof childVNode.type == 'function' &&\n\t\t\t\tchildVNode._children === oldVNode._children\n\t\t\t) {\n\t\t\t\tchildVNode._nextDom = oldDom = reorderChildren(\n\t\t\t\t\tchildVNode,\n\t\t\t\t\toldDom,\n\t\t\t\t\tparentDom\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\toldDom = placeChild(\n\t\t\t\t\tparentDom,\n\t\t\t\t\tchildVNode,\n\t\t\t\t\toldVNode,\n\t\t\t\t\toldChildren,\n\t\t\t\t\tnewDom,\n\t\t\t\t\toldDom\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (typeof newParentVNode.type == 'function') {\n\t\t\t\t// Because the newParentVNode is Fragment-like, we need to set it's\n\t\t\t\t// _nextDom property to the nextSibling of its last child DOM node.\n\t\t\t\t//\n\t\t\t\t// `oldDom` contains the correct value here because if the last child\n\t\t\t\t// is a Fragment-like, then oldDom has already been set to that child's _nextDom.\n\t\t\t\t// If the last child is a DOM VNode, then oldDom will be set to that DOM\n\t\t\t\t// node's nextSibling.\n\t\t\t\tnewParentVNode._nextDom = oldDom;\n\t\t\t}\n\t\t} else if (\n\t\t\toldDom &&\n\t\t\toldVNode._dom == oldDom &&\n\t\t\toldDom.parentNode != parentDom\n\t\t) {\n\t\t\t// The above condition is to handle null placeholders. See test in placeholder.test.js:\n\t\t\t// `efficiently replace null placeholders in parent rerenders`\n\t\t\toldDom = getDomSibling(oldVNode);\n\t\t}\n\t}\n\n\tnewParentVNode._dom = firstChildDom;\n\n\t// Remove remaining oldChildren if there are any.\n\tfor (i = oldChildrenLength; i--; ) {\n\t\tif (oldChildren[i] != null) {\n\t\t\tif (\n\t\t\t\ttypeof newParentVNode.type == 'function' &&\n\t\t\t\toldChildren[i]._dom != null &&\n\t\t\t\toldChildren[i]._dom == newParentVNode._nextDom\n\t\t\t) {\n\t\t\t\t// If the newParentVNode.__nextDom points to a dom node that is about to\n\t\t\t\t// be unmounted, then get the next sibling of that vnode and set\n\t\t\t\t// _nextDom to it\n\t\t\t\tnewParentVNode._nextDom = getDomSibling(oldParentVNode, i + 1);\n\t\t\t}\n\n\t\t\tunmount(oldChildren[i], oldChildren[i]);\n\t\t}\n\t}\n\n\t// Set refs only after unmount\n\tif (refs) {\n\t\tfor (i = 0; i < refs.length; i++) {\n\t\t\tapplyRef(refs[i], refs[++i], refs[++i]);\n\t\t}\n\t}\n}\n\nfunction reorderChildren(childVNode, oldDom, parentDom) {\n\t// Note: VNodes in nested suspended trees may be missing _children.\n\tlet c = childVNode._children;\n\tlet tmp = 0;\n\tfor (; c && tmp < c.length; tmp++) {\n\t\tlet vnode = c[tmp];\n\t\tif (vnode) {\n\t\t\t// We typically enter this code path on sCU bailout, where we copy\n\t\t\t// oldVNode._children to newVNode._children. If that is the case, we need\n\t\t\t// to update the old children's _parent pointer to point to the newVNode\n\t\t\t// (childVNode here).\n\t\t\tvnode._parent = childVNode;\n\n\t\t\tif (typeof vnode.type == 'function') {\n\t\t\t\toldDom = reorderChildren(vnode, oldDom, parentDom);\n\t\t\t} else {\n\t\t\t\toldDom = placeChild(\n\t\t\t\t\tparentDom,\n\t\t\t\t\tvnode,\n\t\t\t\t\tvnode,\n\t\t\t\t\tc,\n\t\t\t\t\tvnode._dom,\n\t\t\t\t\toldDom\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn oldDom;\n}\n\n/**\n * Flatten and loop through the children of a virtual node\n * @param {import('../index').ComponentChildren} children The unflattened\n * children of a virtual node\n * @returns {import('../internal').VNode[]}\n */\nexport function toChildArray(children, out) {\n\tout = out || [];\n\tif (children == null || typeof children == 'boolean') {\n\t} else if (Array.isArray(children)) {\n\t\tchildren.some(child => {\n\t\t\ttoChildArray(child, out);\n\t\t});\n\t} else {\n\t\tout.push(children);\n\t}\n\treturn out;\n}\n\nfunction placeChild(\n\tparentDom,\n\tchildVNode,\n\toldVNode,\n\toldChildren,\n\tnewDom,\n\toldDom\n) {\n\tlet nextDom;\n\tif (childVNode._nextDom !== undefined) {\n\t\t// Only Fragments or components that return Fragment like VNodes will\n\t\t// have a non-undefined _nextDom. Continue the diff from the sibling\n\t\t// of last DOM child of this child VNode\n\t\tnextDom = childVNode._nextDom;\n\n\t\t// Eagerly cleanup _nextDom. We don't need to persist the value because\n\t\t// it is only used by `diffChildren` to determine where to resume the diff after\n\t\t// diffing Components and Fragments. Once we store it the nextDOM local var, we\n\t\t// can clean up the property\n\t\tchildVNode._nextDom = undefined;\n\t} else if (\n\t\toldVNode == null ||\n\t\tnewDom != oldDom ||\n\t\tnewDom.parentNode == null\n\t) {\n\t\touter: if (oldDom == null || oldDom.parentNode !== parentDom) {\n\t\t\tparentDom.appendChild(newDom);\n\t\t\tnextDom = null;\n\t\t} else {\n\t\t\t// `j<oldChildrenLength; j+=2` is an alternative to `j++<oldChildrenLength/2`\n\t\t\tfor (\n\t\t\t\tlet sibDom = oldDom, j = 0;\n\t\t\t\t(sibDom = sibDom.nextSibling) && j < oldChildren.length;\n\t\t\t\tj += 2\n\t\t\t) {\n\t\t\t\tif (sibDom == newDom) {\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t}\n\t\t\tparentDom.insertBefore(newDom, oldDom);\n\t\t\tnextDom = oldDom;\n\t\t}\n\t}\n\n\t// If we have pre-calculated the nextDOM node, use it. Else calculate it now\n\t// Strictly check for `undefined` here cuz `null` is a valid value of `nextDom`.\n\t// See more detail in create-element.js:createVNode\n\tif (nextDom !== undefined) {\n\t\toldDom = nextDom;\n\t} else {\n\t\toldDom = newDom.nextSibling;\n\t}\n\n\treturn oldDom;\n}\n","import { IS_NON_DIMENSIONAL } from '../constants';\nimport options from '../options';\n\n/**\n * Diff the old and new properties of a VNode and apply changes to the DOM node\n * @param {import('../internal').PreactElement} dom The DOM node to apply\n * changes to\n * @param {object} newProps The new props\n * @param {object} oldProps The old props\n * @param {boolean} isSvg Whether or not this node is an SVG node\n * @param {boolean} hydrate Whether or not we are in hydration mode\n */\nexport function diffProps(dom, newProps, oldProps, isSvg, hydrate) {\n\tlet i;\n\n\tfor (i in oldProps) {\n\t\tif (i !== 'children' && i !== 'key' && !(i in newProps)) {\n\t\t\tsetProperty(dom, i, null, oldProps[i], isSvg);\n\t\t}\n\t}\n\n\tfor (i in newProps) {\n\t\tif (\n\t\t\t(!hydrate || typeof newProps[i] == 'function') &&\n\t\t\ti !== 'children' &&\n\t\t\ti !== 'key' &&\n\t\t\ti !== 'value' &&\n\t\t\ti !== 'checked' &&\n\t\t\toldProps[i] !== newProps[i]\n\t\t) {\n\t\t\tsetProperty(dom, i, newProps[i], oldProps[i], isSvg);\n\t\t}\n\t}\n}\n\nfunction setStyle(style, key, value) {\n\tif (key[0] === '-') {\n\t\tstyle.setProperty(key, value);\n\t} else if (value == null) {\n\t\tstyle[key] = '';\n\t} else if (typeof value != 'number' || IS_NON_DIMENSIONAL.test(key)) {\n\t\tstyle[key] = value;\n\t} else {\n\t\tstyle[key] = value + 'px';\n\t}\n}\n\n/**\n * Set a property value on a DOM node\n * @param {import('../internal').PreactElement} dom The DOM node to modify\n * @param {string} name The name of the property to set\n * @param {*} value The value to set the property to\n * @param {*} oldValue The old value the property had\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node or not\n */\nexport function setProperty(dom, name, value, oldValue, isSvg) {\n\tlet useCapture;\n\n\to: if (name === 'style') {\n\t\tif (typeof value == 'string') {\n\t\t\tdom.style.cssText = value;\n\t\t} else {\n\t\t\tif (typeof oldValue == 'string') {\n\t\t\t\tdom.style.cssText = oldValue = '';\n\t\t\t}\n\n\t\t\tif (oldValue) {\n\t\t\t\tfor (name in oldValue) {\n\t\t\t\t\tif (!(value && name in value)) {\n\t\t\t\t\t\tsetStyle(dom.style, name, '');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (value) {\n\t\t\t\tfor (name in value) {\n\t\t\t\t\tif (!oldValue || value[name] !== oldValue[name]) {\n\t\t\t\t\t\tsetStyle(dom.style, name, value[name]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// Benchmark for comparison: https://esbench.com/bench/574c954bdb965b9a00965ac6\n\telse if (name[0] === 'o' && name[1] === 'n') {\n\t\tuseCapture = name !== (name = name.replace(/Capture$/, ''));\n\n\t\t// Infer correct casing for DOM built-in events:\n\t\tif (name.toLowerCase() in dom) name = name.toLowerCase().slice(2);\n\t\telse name = name.slice(2);\n\n\t\tif (!dom._listeners) dom._listeners = {};\n\t\tdom._listeners[name + useCapture] = value;\n\n\t\tif (value) {\n\t\t\tif (!oldValue) {\n\t\t\t\tconst handler = useCapture ? eventProxyCapture : eventProxy;\n\t\t\t\tdom.addEventListener(name, handler, useCapture);\n\t\t\t}\n\t\t} else {\n\t\t\tconst handler = useCapture ? eventProxyCapture : eventProxy;\n\t\t\tdom.removeEventListener(name, handler, useCapture);\n\t\t}\n\t} else if (name !== 'dangerouslySetInnerHTML') {\n\t\tif (isSvg) {\n\t\t\t// Normalize incorrect prop usage for SVG:\n\t\t\t// - xlink:href / xlinkHref --> href (xlink:href was removed from SVG and isn't needed)\n\t\t\t// - className --> class\n\t\t\tname = name.replace(/xlink(H|:h)/, 'h').replace(/sName$/, 's');\n\t\t} else if (\n\t\t\tname !== 'href' &&\n\t\t\tname !== 'list' &&\n\t\t\tname !== 'form' &&\n\t\t\t// Default value in browsers is `-1` and an empty string is\n\t\t\t// cast to `0` instead\n\t\t\tname !== 'tabIndex' &&\n\t\t\tname !== 'download' &&\n\t\t\tname in dom\n\t\t) {\n\t\t\ttry {\n\t\t\t\tdom[name] = value == null ? '' : value;\n\t\t\t\t// labelled break is 1b smaller here than a return statement (sorry)\n\t\t\t\tbreak o;\n\t\t\t} catch (e) {}\n\t\t}\n\n\t\t// ARIA-attributes have a different notion of boolean values.\n\t\t// The value `false` is different from the attribute not\n\t\t// existing on the DOM, so we can't remove it. For non-boolean\n\t\t// ARIA-attributes we could treat false as a removal, but the\n\t\t// amount of exceptions would cost us too many bytes. On top of\n\t\t// that other VDOM frameworks also always stringify `false`.\n\n\t\tif (typeof value === 'function') {\n\t\t\t// never serialize functions as attribute values\n\t\t} else if (\n\t\t\tvalue != null &&\n\t\t\t(value !== false || (name[0] === 'a' && name[1] === 'r'))\n\t\t) {\n\t\t\tdom.setAttribute(name, value);\n\t\t} else {\n\t\t\tdom.removeAttribute(name);\n\t\t}\n\t}\n}\n\n/**\n * Proxy an event to hooked event handlers\n * @param {Event} e The event object from the browser\n * @private\n */\nfunction eventProxy(e) {\n\tthis._listeners[e.type + false](options.event ? options.event(e) : e);\n}\n\nfunction eventProxyCapture(e) {\n\tthis._listeners[e.type + true](options.event ? options.event(e) : e);\n}\n","import { EMPTY_OBJ } from '../constants';\nimport { Component, getDomSibling } from '../component';\nimport { Fragment } from '../create-element';\nimport { diffChildren } from './children';\nimport { diffProps, setProperty } from './props';\nimport { assign, removeNode, slice } from '../util';\nimport options from '../options';\n\n/**\n * Diff two virtual nodes and apply proper changes to the DOM\n * @param {import('../internal').PreactElement} parentDom The parent of the DOM element\n * @param {import('../internal').VNode} newVNode The new virtual node\n * @param {import('../internal').VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object. Modified by getChildContext\n * @param {boolean} isSvg Whether or not this element is an SVG node\n * @param {Array<import('../internal').PreactElement>} excessDomChildren\n * @param {Array<import('../internal').Component>} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').PreactElement} oldDom The current attached DOM\n * element any new dom elements should be placed around. Likely `null` on first\n * render (except when hydrating). Can be a sibling DOM element when diffing\n * Fragments that have siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} [isHydrating] Whether or not we are in hydration\n */\nexport function diff(\n\tparentDom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating\n) {\n\tlet tmp,\n\t\tnewType = newVNode.type;\n\n\t// When passing through createElement it assigns the object\n\t// constructor as undefined. This to prevent JSON-injection.\n\tif (newVNode.constructor !== undefined) return null;\n\n\t// If the previous diff bailed out, resume creating/hydrating.\n\tif (oldVNode._hydrating != null) {\n\t\tisHydrating = oldVNode._hydrating;\n\t\toldDom = newVNode._dom = oldVNode._dom;\n\t\t// if we resume, we want the tree to be \"unlocked\"\n\t\tnewVNode._hydrating = null;\n\t\texcessDomChildren = [oldDom];\n\t}\n\n\tif ((tmp = options._diff)) tmp(newVNode);\n\n\ttry {\n\t\touter: if (typeof newType == 'function') {\n\t\t\tlet c, isNew, oldProps, oldState, snapshot, clearProcessingException;\n\t\t\tlet newProps = newVNode.props;\n\n\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t// the context value as `this.context` just for this component.\n\t\t\ttmp = newType.contextType;\n\t\t\tlet provider = tmp && globalContext[tmp._id];\n\t\t\tlet componentContext = tmp\n\t\t\t\t? provider\n\t\t\t\t\t? provider.props.value\n\t\t\t\t\t: tmp._defaultValue\n\t\t\t\t: globalContext;\n\n\t\t\t// Get component and set it to `c`\n\t\t\tif (oldVNode._component) {\n\t\t\t\tc = newVNode._component = oldVNode._component;\n\t\t\t\tclearProcessingException = c._processingException = c._pendingError;\n\t\t\t} else {\n\t\t\t\t// Instantiate the new component\n\t\t\t\tif ('prototype' in newType && newType.prototype.render) {\n\t\t\t\t\t// @ts-ignore The check above verifies that newType is suppose to be constructed\n\t\t\t\t\tnewVNode._component = c = new newType(newProps, componentContext); // eslint-disable-line new-cap\n\t\t\t\t} else {\n\t\t\t\t\t// @ts-ignore Trust me, Component implements the interface we want\n\t\t\t\t\tnewVNode._component = c = new Component(newProps, componentContext);\n\t\t\t\t\tc.constructor = newType;\n\t\t\t\t\tc.render = doRender;\n\t\t\t\t}\n\t\t\t\tif (provider) provider.sub(c);\n\n\t\t\t\tc.props = newProps;\n\t\t\t\tif (!c.state) c.state = {};\n\t\t\t\tc.context = componentContext;\n\t\t\t\tc._globalContext = globalContext;\n\t\t\t\tisNew = c._dirty = true;\n\t\t\t\tc._renderCallbacks = [];\n\t\t\t}\n\n\t\t\t// Invoke getDerivedStateFromProps\n\t\t\tif (c._nextState == null) {\n\t\t\t\tc._nextState = c.state;\n\t\t\t}\n\t\t\tif (newType.getDerivedStateFromProps != null) {\n\t\t\t\tif (c._nextState == c.state) {\n\t\t\t\t\tc._nextState = assign({}, c._nextState);\n\t\t\t\t}\n\n\t\t\t\tassign(\n\t\t\t\t\tc._nextState,\n\t\t\t\t\tnewType.getDerivedStateFromProps(newProps, c._nextState)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\toldProps = c.props;\n\t\t\toldState = c.state;\n\n\t\t\t// Invoke pre-render lifecycle methods\n\t\t\tif (isNew) {\n\t\t\t\tif (\n\t\t\t\t\tnewType.getDerivedStateFromProps == null &&\n\t\t\t\t\tc.componentWillMount != null\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillMount();\n\t\t\t\t}\n\n\t\t\t\tif (c.componentDidMount != null) {\n\t\t\t\t\tc._renderCallbacks.push(c.componentDidMount);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tnewType.getDerivedStateFromProps == null &&\n\t\t\t\t\tnewProps !== oldProps &&\n\t\t\t\t\tc.componentWillReceiveProps != null\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillReceiveProps(newProps, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t(!c._force &&\n\t\t\t\t\t\tc.shouldComponentUpdate != null &&\n\t\t\t\t\t\tc.shouldComponentUpdate(\n\t\t\t\t\t\t\tnewProps,\n\t\t\t\t\t\t\tc._nextState,\n\t\t\t\t\t\t\tcomponentContext\n\t\t\t\t\t\t) === false) ||\n\t\t\t\t\tnewVNode._original === oldVNode._original\n\t\t\t\t) {\n\t\t\t\t\tc.props = newProps;\n\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t\t// More info about this here: https://gist.github.com/JoviDeCroock/bec5f2ce93544d2e6070ef8e0036e4e8\n\t\t\t\t\tif (newVNode._original !== oldVNode._original) c._dirty = false;\n\t\t\t\t\tc._vnode = newVNode;\n\t\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t\t\tnewVNode._children = oldVNode._children;\n\t\t\t\t\tnewVNode._children.forEach(vnode => {\n\t\t\t\t\t\tif (vnode) vnode._parent = newVNode;\n\t\t\t\t\t});\n\t\t\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\t\t\tcommitQueue.push(c);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\n\t\t\t\tif (c.componentWillUpdate != null) {\n\t\t\t\t\tc.componentWillUpdate(newProps, c._nextState, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (c.componentDidUpdate != null) {\n\t\t\t\t\tc._renderCallbacks.push(() => {\n\t\t\t\t\t\tc.componentDidUpdate(oldProps, oldState, snapshot);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tc.context = componentContext;\n\t\t\tc.props = newProps;\n\t\t\tc._vnode = newVNode;\n\t\t\tc._parentDom = parentDom;\n\n\t\t\tlet renderHook = options._render,\n\t\t\t\tcount = 0;\n\t\t\tif ('prototype' in newType && newType.prototype.render) {\n\t\t\t\tc.state = c._nextState;\n\t\t\t\tc._dirty = false;\n\n\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\t\t\t} else {\n\t\t\t\tdo {\n\t\t\t\t\tc._dirty = false;\n\t\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\t\t// Handle setState called in render, see #2553\n\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t} while (c._dirty && ++count < 25);\n\t\t\t}\n\n\t\t\t// Handle setState called in render, see #2553\n\t\t\tc.state = c._nextState;\n\n\t\t\tif (c.getChildContext != null) {\n\t\t\t\tglobalContext = assign(assign({}, globalContext), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (!isNew && c.getSnapshotBeforeUpdate != null) {\n\t\t\t\tsnapshot = c.getSnapshotBeforeUpdate(oldProps, oldState);\n\t\t\t}\n\n\t\t\tlet isTopLevelFragment =\n\t\t\t\ttmp != null && tmp.type === Fragment && tmp.key == null;\n\t\t\tlet renderResult = isTopLevelFragment ? tmp.props.children : tmp;\n\n\t\t\tdiffChildren(\n\t\t\t\tparentDom,\n\t\t\t\tArray.isArray(renderResult) ? renderResult : [renderResult],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\toldDom,\n\t\t\t\tisHydrating\n\t\t\t);\n\n\t\t\tc.base = newVNode._dom;\n\n\t\t\t// We successfully rendered this VNode, unset any stored hydration/bailout state:\n\t\t\tnewVNode._hydrating = null;\n\n\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\tcommitQueue.push(c);\n\t\t\t}\n\n\t\t\tif (clearProcessingException) {\n\t\t\t\tc._pendingError = c._processingException = null;\n\t\t\t}\n\n\t\t\tc._force = false;\n\t\t} else if (\n\t\t\texcessDomChildren == null &&\n\t\t\tnewVNode._original === oldVNode._original\n\t\t) {\n\t\t\tnewVNode._children = oldVNode._children;\n\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t} else {\n\t\t\tnewVNode._dom = diffElementNodes(\n\t\t\t\toldVNode._dom,\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\tisHydrating\n\t\t\t);\n\t\t}\n\n\t\tif ((tmp = options.diffed)) tmp(newVNode);\n\t} catch (e) {\n\t\tnewVNode._original = null;\n\t\t// if hydrating or creating initial tree, bailout preserves DOM:\n\t\tif (isHydrating || excessDomChildren != null) {\n\t\t\tnewVNode._dom = oldDom;\n\t\t\tnewVNode._hydrating = !!isHydrating;\n\t\t\texcessDomChildren[excessDomChildren.indexOf(oldDom)] = null;\n\t\t\t// ^ could possibly be simplified to:\n\t\t\t// excessDomChildren.length = 0;\n\t\t}\n\t\toptions._catchError(e, newVNode, oldVNode);\n\t}\n}\n\n/**\n * @param {Array<import('../internal').Component>} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').VNode} root\n */\nexport function commitRoot(commitQueue, root) {\n\tif (options._commit) options._commit(root, commitQueue);\n\n\tcommitQueue.some(c => {\n\t\ttry {\n\t\t\t// @ts-ignore Reuse the commitQueue variable here so the type changes\n\t\t\tcommitQueue = c._renderCallbacks;\n\t\t\tc._renderCallbacks = [];\n\t\t\tcommitQueue.some(cb => {\n\t\t\t\t// @ts-ignore See above ts-ignore on commitQueue\n\t\t\t\tcb.call(c);\n\t\t\t});\n\t\t} catch (e) {\n\t\t\toptions._catchError(e, c._vnode);\n\t\t}\n\t});\n}\n\n/**\n * Diff two virtual nodes representing DOM element\n * @param {import('../internal').PreactElement} dom The DOM element representing\n * the virtual nodes being diffed\n * @param {import('../internal').VNode} newVNode The new virtual node\n * @param {import('../internal').VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node\n * @param {*} excessDomChildren\n * @param {Array<import('../internal').Component>} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @returns {import('../internal').PreactElement}\n */\nfunction diffElementNodes(\n\tdom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\tisHydrating\n) {\n\tlet oldProps = oldVNode.props;\n\tlet newProps = newVNode.props;\n\tlet nodeType = newVNode.type;\n\tlet i = 0;\n\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\n\tif (nodeType === 'svg') isSvg = true;\n\n\tif (excessDomChildren != null) {\n\t\tfor (; i < excessDomChildren.length; i++) {\n\t\t\tconst child = excessDomChildren[i];\n\n\t\t\t// if newVNode matches an element in excessDomChildren or the `dom`\n\t\t\t// argument matches an element in excessDomChildren, remove it from\n\t\t\t// excessDomChildren so it isn't later removed in diffChildren\n\t\t\tif (\n\t\t\t\tchild &&\n\t\t\t\t'setAttribute' in child === !!nodeType &&\n\t\t\t\t(nodeType ? child.localName === nodeType : child.nodeType === 3)\n\t\t\t) {\n\t\t\t\tdom = child;\n\t\t\t\texcessDomChildren[i] = null;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (dom == null) {\n\t\tif (nodeType === null) {\n\t\t\t// @ts-ignore createTextNode returns Text, we expect PreactElement\n\t\t\treturn document.createTextNode(newProps);\n\t\t}\n\n\t\tif (isSvg) {\n\t\t\tdom = document.createElementNS(\n\t\t\t\t'http://www.w3.org/2000/svg',\n\t\t\t\t// @ts-ignore We know `newVNode.type` is a string\n\t\t\t\tnodeType\n\t\t\t);\n\t\t} else {\n\t\t\tdom = document.createElement(\n\t\t\t\t// @ts-ignore We know `newVNode.type` is a string\n\t\t\t\tnodeType,\n\t\t\t\tnewProps.is && newProps\n\t\t\t);\n\t\t}\n\n\t\t// we created a new parent, so none of the previously attached children can be reused:\n\t\texcessDomChildren = null;\n\t\t// we are creating a new node, so we can assume this is a new subtree (in case we are hydrating), this deopts the hydrate\n\t\tisHydrating = false;\n\t}\n\n\tif (nodeType === null) {\n\t\t// During hydration, we still have to split merged text from SSR'd HTML.\n\t\tif (oldProps !== newProps && (!isHydrating || dom.data !== newProps)) {\n\t\t\tdom.data = newProps;\n\t\t}\n\t} else {\n\t\t// If excessDomChildren was not null, repopulate it with the current element's children:\n\t\texcessDomChildren = excessDomChildren && slice.call(dom.childNodes);\n\n\t\toldProps = oldVNode.props || EMPTY_OBJ;\n\n\t\tlet oldHtml = oldProps.dangerouslySetInnerHTML;\n\t\tlet newHtml = newProps.dangerouslySetInnerHTML;\n\n\t\t// During hydration, props are not diffed at all (including dangerouslySetInnerHTML)\n\t\t// @TODO we should warn in debug mode when props don't match here.\n\t\tif (!isHydrating) {\n\t\t\t// But, if we are in a situation where we are using existing DOM (e.g. replaceNode)\n\t\t\t// we should read the existing DOM attributes to diff them\n\t\t\tif (excessDomChildren != null) {\n\t\t\t\toldProps = {};\n\t\t\t\tfor (i = 0; i < dom.attributes.length; i++) {\n\t\t\t\t\toldProps[dom.attributes[i].name] = dom.attributes[i].value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (newHtml || oldHtml) {\n\t\t\t\t// Avoid re-applying the same '__html' if it did not changed between re-render\n\t\t\t\tif (\n\t\t\t\t\t!newHtml ||\n\t\t\t\t\t((!oldHtml || newHtml.__html != oldHtml.__html) &&\n\t\t\t\t\t\tnewHtml.__html !== dom.innerHTML)\n\t\t\t\t) {\n\t\t\t\t\tdom.innerHTML = (newHtml && newHtml.__html) || '';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdiffProps(dom, newProps, oldProps, isSvg, isHydrating);\n\n\t\t// If the new vnode didn't have dangerouslySetInnerHTML, diff its children\n\t\tif (newHtml) {\n\t\t\tnewVNode._children = [];\n\t\t} else {\n\t\t\ti = newVNode.props.children;\n\t\t\tdiffChildren(\n\t\t\t\tdom,\n\t\t\t\tArray.isArray(i) ? i : [i],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg && nodeType !== 'foreignObject',\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\texcessDomChildren\n\t\t\t\t\t? excessDomChildren[0]\n\t\t\t\t\t: oldVNode._children && getDomSibling(oldVNode, 0),\n\t\t\t\tisHydrating\n\t\t\t);\n\n\t\t\t// Remove children that are not part of any vnode.\n\t\t\tif (excessDomChildren != null) {\n\t\t\t\tfor (i = excessDomChildren.length; i--; ) {\n\t\t\t\t\tif (excessDomChildren[i] != null) removeNode(excessDomChildren[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// (as above, don't diff props during hydration)\n\t\tif (!isHydrating) {\n\t\t\tif (\n\t\t\t\t'value' in newProps &&\n\t\t\t\t(i = newProps.value) !== undefined &&\n\t\t\t\t// #2756 For the <progress>-element the initial value is 0,\n\t\t\t\t// despite the attribute not being present. When the attribute\n\t\t\t\t// is missing the progress bar is treated as indeterminate.\n\t\t\t\t// To fix that we'll always update it when it is 0 for progress elements\n\t\t\t\t(i !== dom.value ||\n\t\t\t\t\t(nodeType === 'progress' && !i) ||\n\t\t\t\t\t// This is only for IE 11 to fix <select> value not being updated.\n\t\t\t\t\t// To avoid a stale select value we need to set the option.value\n\t\t\t\t\t// again, which triggers IE11 to re-evaluate the select value\n\t\t\t\t\t(nodeType === 'option' && i !== oldProps.value))\n\t\t\t) {\n\t\t\t\tsetProperty(dom, 'value', i, oldProps.value, false);\n\t\t\t}\n\t\t\tif (\n\t\t\t\t'checked' in newProps &&\n\t\t\t\t(i = newProps.checked) !== undefined &&\n\t\t\t\ti !== dom.checked\n\t\t\t) {\n\t\t\t\tsetProperty(dom, 'checked', i, oldProps.checked, false);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn dom;\n}\n\n/**\n * Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {object|function} ref\n * @param {any} value\n * @param {import('../internal').VNode} vnode\n */\nexport function applyRef(ref, value, vnode) {\n\ttry {\n\t\tif (typeof ref == 'function') ref(value);\n\t\telse ref.current = value;\n\t} catch (e) {\n\t\toptions._catchError(e, vnode);\n\t}\n}\n\n/**\n * Unmount a virtual node from the tree and apply DOM changes\n * @param {import('../internal').VNode} vnode The virtual node to unmount\n * @param {import('../internal').VNode} parentVNode The parent of the VNode that\n * initiated the unmount\n * @param {boolean} [skipRemove] Flag that indicates that a parent node of the\n * current element is already detached from the DOM.\n */\nexport function unmount(vnode, parentVNode, skipRemove) {\n\tlet r;\n\tif (options.unmount) options.unmount(vnode);\n\n\tif ((r = vnode.ref)) {\n\t\tif (!r.current || r.current === vnode._dom) applyRef(r, null, parentVNode);\n\t}\n\n\tif ((r = vnode._component) != null) {\n\t\tif (r.componentWillUnmount) {\n\t\t\ttry {\n\t\t\t\tr.componentWillUnmount();\n\t\t\t} catch (e) {\n\t\t\t\toptions._catchError(e, parentVNode);\n\t\t\t}\n\t\t}\n\n\t\tr.base = r._parentDom = null;\n\t}\n\n\tif ((r = vnode._children)) {\n\t\tfor (let i = 0; i < r.length; i++) {\n\t\t\tif (r[i]) {\n\t\t\t\tunmount(r[i], parentVNode, typeof vnode.type != 'function');\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!skipRemove && vnode._dom != null) removeNode(vnode._dom);\n\n\t// Must be set to `undefined` to properly clean up `_nextDom`\n\t// for which `null` is a valid value. See comment in `create-element.js`\n\tvnode._dom = vnode._nextDom = undefined;\n}\n\n/** The `.render()` method for a PFC backing instance. */\nfunction doRender(props, state, context) {\n\treturn this.constructor(props, context);\n}\n","import { EMPTY_OBJ } from './constants';\nimport { commitRoot, diff } from './diff/index';\nimport { createElement, Fragment } from './create-element';\nimport options from './options';\nimport { slice } from './util';\n\n/**\n * Render a Preact virtual node into a DOM element\n * @param {import('./internal').ComponentChild} vnode The virtual node to render\n * @param {import('./internal').PreactElement} parentDom The DOM element to\n * render into\n * @param {import('./internal').PreactElement | object} [replaceNode] Optional: Attempt to re-use an\n * existing DOM tree rooted at `replaceNode`\n */\nexport function render(vnode, parentDom, replaceNode) {\n\tif (options._root) options._root(vnode, parentDom);\n\n\t// We abuse the `replaceNode` parameter in `hydrate()` to signal if we are in\n\t// hydration mode or not by passing the `hydrate` function instead of a DOM\n\t// element..\n\tlet isHydrating = typeof replaceNode === 'function';\n\n\t// To be able to support calling `render()` multiple times on the same\n\t// DOM node, we need to obtain a reference to the previous tree. We do\n\t// this by assigning a new `_children` property to DOM nodes which points\n\t// to the last rendered tree. By default this property is not present, which\n\t// means that we are mounting a new tree for the first time.\n\tlet oldVNode = isHydrating\n\t\t? null\n\t\t: (replaceNode && replaceNode._children) || parentDom._children;\n\n\tvnode = (\n\t\t(!isHydrating && replaceNode) ||\n\t\tparentDom\n\t)._children = createElement(Fragment, null, [vnode]);\n\n\t// List of effects that need to be called after diffing.\n\tlet commitQueue = [];\n\tdiff(\n\t\tparentDom,\n\t\t// Determine the new vnode tree and store it on the DOM element on\n\t\t// our custom `_children` property.\n\t\tvnode,\n\t\toldVNode || EMPTY_OBJ,\n\t\tEMPTY_OBJ,\n\t\tparentDom.ownerSVGElement !== undefined,\n\t\t!isHydrating && replaceNode\n\t\t\t? [replaceNode]\n\t\t\t: oldVNode\n\t\t\t? null\n\t\t\t: parentDom.firstChild\n\t\t\t? slice.call(parentDom.childNodes)\n\t\t\t: null,\n\t\tcommitQueue,\n\t\t!isHydrating && replaceNode\n\t\t\t? replaceNode\n\t\t\t: oldVNode\n\t\t\t? oldVNode._dom\n\t\t\t: parentDom.firstChild,\n\t\tisHydrating\n\t);\n\n\t// Flush all queued effects\n\tcommitRoot(commitQueue, vnode);\n}\n\n/**\n * Update an existing DOM element with data from a Preact virtual node\n * @param {import('./internal').ComponentChild} vnode The virtual node to render\n * @param {import('./internal').PreactElement} parentDom The DOM element to\n * update\n */\nexport function hydrate(vnode, parentDom) {\n\trender(vnode, parentDom, hydrate);\n}\n","/**\n * Find the closest error boundary to a thrown error and call it\n * @param {object} error The thrown value\n * @param {import('../internal').VNode} vnode The vnode that threw\n * the error that was caught (except for unmounting when this parameter\n * is the highest parent that was being unmounted)\n * @param {import('../internal').VNode} [oldVNode]\n * @param {import('../internal').ErrorInfo} [errorInfo]\n */\nexport function _catchError(error, vnode, oldVNode, errorInfo) {\n\t/** @type {import('../internal').Component} */\n\tlet component, ctor, handled;\n\n\tfor (; (vnode = vnode._parent); ) {\n\t\tif ((component = vnode._component) && !component._processingException) {\n\t\t\ttry {\n\t\t\t\tctor = component.constructor;\n\n\t\t\t\tif (ctor && ctor.getDerivedStateFromError != null) {\n\t\t\t\t\tcomponent.setState(ctor.getDerivedStateFromError(error));\n\t\t\t\t\thandled = component._dirty;\n\t\t\t\t}\n\n\t\t\t\tif (component.componentDidCatch != null) {\n\t\t\t\t\tcomponent.componentDidCatch(error, errorInfo || {});\n\t\t\t\t\thandled = component._dirty;\n\t\t\t\t}\n\n\t\t\t\t// This is an error boundary. Mark it as having bailed out, and whether it was mid-hydration.\n\t\t\t\tif (handled) {\n\t\t\t\t\treturn (component._pendingError = component);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\terror = e;\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow error;\n}\n","export const Styles: { [styleAlias: string]: Partial<CSSStyleDeclaration> | any} = {\n Error: {\n color: \"red\",\n },\n Alert: {\n error: {\n color: \"red\",\n fontWeight: \"bold\"\n },\n warning: {\n color: \"#f80\",\n fontWeight: \"bold\"\n },\n info: {\n color: \"black\"\n }\n },\n Darken: {\n position: \"fixed\",\n top: 0,\n left: 0,\n opacity: 0.5,\n backgroundColor: \"#000\",\n width: \"100vw\",\n height: \"100vh\",\n zIndex: 150,\n webkitBackdropFilter: \"blur(2px)\",\n backdropFilter: \"blur(2px)\",\n },\n DialogOuter: {\n position: \"fixed\",\n top: 0,\n left: 0,\n width: \"100vw\",\n height: \"100vh\",\n zIndex: 150,\n alignItems: \"center\",\n display: \"flex\",\n justifyContent: \"center\",\n },\n DialogInner: {\n position: \"relative\",\n color: \"#222\",\n backgroundColor: \"#fff\",\n padding: \"30px\",\n marginBottom: \"2em\",\n maxWidth: \"90%\",\n maxHeight: \"90%\",\n overflowY: \"auto\",\n border: \"3px solid #3d3d5d\",\n borderRadius: \"8px\",\n boxShadow: \"0 0 80px 10px #666\",\n width: \"auto\",\n fontFamily: \"sans-serif\",\n },\n Input: {\n height: \"35px\",\n width: \"17em\",\n borderColor: \"#ccf4\",\n outline: \"none\",\n fontSize: \"17pt\",\n padding: \"8px\"\n \n }\n};\n","import { Styles } from './Styles';\nimport { ComponentChildren, h } from 'preact';\n\nexport function Dialog({ children, className }: { children?: ComponentChildren, className?: string }) {\n return (\n <div className={className}>\n <div style={Styles.Darken} />\n <div style={Styles.DialogOuter}>\n <div style={Styles.DialogInner}>{children}</div>\n </div>\n </div>\n );\n}\n","import { options } from 'preact';\n\n/** @type {number} */\nlet currentIndex;\n\n/** @type {import('./internal').Component} */\nlet currentComponent;\n\n/** @type {import('./internal').Component} */\nlet previousComponent;\n\n/** @type {number} */\nlet currentHook = 0;\n\n/** @type {Array<import('./internal').Component>} */\nlet afterPaintEffects = [];\n\nlet EMPTY = [];\n\nlet oldBeforeDiff = options._diff;\nlet oldBeforeRender = options._render;\nlet oldAfterDiff = options.diffed;\nlet oldCommit = options._commit;\nlet oldBeforeUnmount = options.unmount;\n\nconst RAF_TIMEOUT = 100;\nlet prevRaf;\n\noptions._diff = vnode => {\n\tcurrentComponent = null;\n\tif (oldBeforeDiff) oldBeforeDiff(vnode);\n};\n\noptions._render = vnode => {\n\tif (oldBeforeRender) oldBeforeRender(vnode);\n\n\tcurrentComponent = vnode._component;\n\tcurrentIndex = 0;\n\n\tconst hooks = currentComponent.__hooks;\n\tif (hooks) {\n\t\tif (previousComponent === currentComponent) {\n\t\t\thooks._pendingEffects = [];\n\t\t\tcurrentComponent._renderCallbacks = [];\n\t\t\thooks._list.forEach(hookItem => {\n\t\t\t\tif (hookItem._nextValue) {\n\t\t\t\t\thookItem._value = hookItem._nextValue;\n\t\t\t\t}\n\t\t\t\thookItem._pendingValue = EMPTY;\n\t\t\t\thookItem._nextValue = hookItem._pendingArgs = undefined;\n\t\t\t});\n\t\t} else {\n\t\t\thooks._pendingEffects.forEach(invokeCleanup);\n\t\t\thooks._pendingEffects.forEach(invokeEffect);\n\t\t\thooks._pendingEffects = [];\n\t\t}\n\t}\n\tpreviousComponent = currentComponent;\n};\n\noptions.diffed = vnode => {\n\tif (oldAfterDiff) oldAfterDiff(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks) {\n\t\tif (c.__hooks._pendingEffects.length) afterPaint(afterPaintEffects.push(c));\n\t\tc.__hooks._list.forEach(hookItem => {\n\t\t\tif (hookItem._pendingArgs) {\n\t\t\t\thookItem._args = hookItem._pendingArgs;\n\t\t\t}\n\t\t\tif (hookItem._pendingValue !== EMPTY) {\n\t\t\t\thookItem._value = hookItem._pendingValue;\n\t\t\t}\n\t\t\thookItem._pendingArgs = undefined;\n\t\t\thookItem._pendingValue = EMPTY;\n\t\t});\n\t}\n\tpreviousComponent = currentComponent = null;\n};\n\noptions._commit = (vnode, commitQueue) => {\n\tcommitQueue.some(component => {\n\t\ttry {\n\t\t\tcomponent._renderCallbacks.forEach(invokeCleanup);\n\t\t\tcomponent._renderCallbacks = component._renderCallbacks.filter(cb =>\n\t\t\t\tcb._value ? invokeEffect(cb) : true\n\t\t\t);\n\t\t} catch (e) {\n\t\t\tcommitQueue.some(c => {\n\t\t\t\tif (c._renderCallbacks) c._renderCallbacks = [];\n\t\t\t});\n\t\t\tcommitQueue = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t});\n\n\tif (oldCommit) oldCommit(vnode, commitQueue);\n};\n\noptions.unmount = vnode => {\n\tif (oldBeforeUnmount) oldBeforeUnmount(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks) {\n\t\tlet hasErrored;\n\t\tc.__hooks._list.forEach(s => {\n\t\t\ttry {\n\t\t\t\tinvokeCleanup(s);\n\t\t\t} catch (e) {\n\t\t\t\thasErrored = e;\n\t\t\t}\n\t\t});\n\t\tif (hasErrored) options._catchError(hasErrored, c._vnode);\n\t}\n};\n\n/**\n * Get a hook's state from the currentComponent\n * @param {number} index The index of the hook to get\n * @param {number} type The index of the hook to get\n * @returns {any}\n */\nfunction getHookState(index, type) {\n\tif (options._hook) {\n\t\toptions._hook(currentComponent, index, currentHook || type);\n\t}\n\tcurrentHook = 0;\n\n\t// Largely inspired by:\n\t// * https://github.com/michael-klein/funcy.js/blob/f6be73468e6ec46b0ff5aa3cc4c9baf72a29025a/src/hooks/core_hooks.mjs\n\t// * https://github.com/michael-klein/funcy.js/blob/650beaa58c43c33a74820a3c98b3c7079cf2e333/src/renderer.mjs\n\t// Other implementations to look at:\n\t// * https://codesandbox.io/s/mnox05qp8\n\tconst hooks =\n\t\tcurrentComponent.__hooks ||\n\t\t(currentComponent.__hooks = {\n\t\t\t_list: [],\n\t\t\t_pendingEffects: []\n\t\t});\n\n\tif (index >= hooks._list.length) {\n\t\thooks._list.push({ _pendingValue: EMPTY });\n\t}\n\treturn hooks._list[index];\n}\n\n/**\n * @param {import('./index').StateUpdater<any>} [initialState]\n */\nexport function useState(initialState) {\n\tcurrentHook = 1;\n\treturn useReducer(invokeOrReturn, initialState);\n}\n\n/**\n * @param {import('./index').Reducer<any, any>} reducer\n * @param {import('./index').StateUpdater<any>} initialState\n * @param {(initialState: any) => void} [init]\n * @returns {[ any, (state: any) => void ]}\n */\nexport function useReducer(reducer, initialState, init) {\n\t/** @type {import('./internal').ReducerHookState} */\n\tconst hookState = getHookState(currentIndex++, 2);\n\thookState._reducer = reducer;\n\tif (!hookState._component) {\n\t\thookState._value = [\n\t\t\t!init ? invokeOrReturn(undefined, initialState) : init(initialState),\n\n\t\t\taction => {\n\t\t\t\tconst currentValue = hookState._nextValue\n\t\t\t\t\t? hookState._nextValue[0]\n\t\t\t\t\t: hookState._value[0];\n\t\t\t\tconst nextValue = hookState._reducer(currentValue, action);\n\n\t\t\t\tif (currentValue !== nextValue) {\n\t\t\t\t\thookState._nextValue = [nextValue, hookState._value[1]];\n\t\t\t\t\thookState._component.setState({});\n\t\t\t\t}\n\t\t\t}\n\t\t];\n\n\t\thookState._component = currentComponent;\n\n\t\tif (!currentComponent._hasScuFromHooks) {\n\t\t\tcurrentComponent._hasScuFromHooks = true;\n\t\t\tconst prevScu = currentComponent.shouldComponentUpdate;\n\n\t\t\t// This SCU has the purpose of bailing out after repeated updates\n\t\t\t// to stateful hooks.\n\t\t\t// we store the next value in _nextValue[0] and keep doing that for all\n\t\t\t// state setters, if we have next states and\n\t\t\t// all next states within a component end up being equal to their original state\n\t\t\t// we are safe to bail out for this specific component.\n\t\t\tcurrentComponent.shouldComponentUpdate = function(p, s, c) {\n\t\t\t\tif (!hookState._component.__hooks) return true;\n\n\t\t\t\tconst stateHooks = hookState._component.__hooks._list.filter(\n\t\t\t\t\tx => x._component\n\t\t\t\t);\n\t\t\t\tconst allHooksEmpty = stateHooks.every(x => !x._nextValue);\n\t\t\t\t// When we have no updated hooks in the component we invoke the previous SCU or\n\t\t\t\t// traverse the VDOM tree further.\n\t\t\t\tif (allHooksEmpty) {\n\t\t\t\t\treturn prevScu ? prevScu.call(this, p, s, c) : true;\n\t\t\t\t}\n\n\t\t\t\t// We check whether we have components with a nextValue set that\n\t\t\t\t// have values that aren't equal to one another this pushes\n\t\t\t\t// us to update further down the tree\n\t\t\t\tlet shouldUpdate = false;\n\t\t\t\tstateHooks.forEach(hookItem => {\n\t\t\t\t\tif (hookItem._nextValue) {\n\t\t\t\t\t\tconst currentValue = hookItem._value[0];\n\t\t\t\t\t\thookItem._value = hookItem._nextValue;\n\t\t\t\t\t\thookItem._nextValue = undefined;\n\t\t\t\t\t\tif (currentValue !== hookItem._value[0]) shouldUpdate = true;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\treturn shouldUpdate\n\t\t\t\t\t? prevScu\n\t\t\t\t\t\t? prevScu.call(this, p, s, c)\n\t\t\t\t\t\t: true\n\t\t\t\t\t: false;\n\t\t\t};\n\t\t}\n\t}\n\n\treturn hookState._nextValue || hookState._value;\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {any[]} args\n */\nexport function useEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 3);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._pendingArgs = args;\n\n\t\tcurrentComponent.__hooks._pendingEffects.push(state);\n\t}\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {any[]} args\n */\nexport function useLayoutEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 4);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._pendingArgs = args;\n\n\t\tcurrentComponent._renderCallbacks.push(state);\n\t}\n}\n\nexport function useRef(initialValue) {\n\tcurrentHook = 5;\n\treturn useMemo(() => ({ current: initialValue }), []);\n}\n\n/**\n * @param {object} ref\n * @param {() => object} createHandle\n * @param {any[]} args\n */\nexport function useImperativeHandle(ref, createHandle, args) {\n\tcurrentHook = 6;\n\tuseLayoutEffect(\n\t\t() => {\n\t\t\tif (typeof ref == 'function') {\n\t\t\t\tref(createHandle());\n\t\t\t\treturn () => ref(null);\n\t\t\t} else if (ref) {\n\t\t\t\tref.current = createHandle();\n\t\t\t\treturn () => (ref.current = null);\n\t\t\t}\n\t\t},\n\t\targs == null ? args : args.concat(ref)\n\t);\n}\n\n/**\n * @param {() => any} factory\n * @param {any[]} args\n */\nexport function useMemo(factory, args) {\n\t/** @type {import('./internal').MemoHookState} */\n\tconst state = getHookState(currentIndex++, 7);\n\tif (argsChanged(state._args, args)) {\n\t\tstate._pendingValue = factory();\n\t\tstate._pendingArgs = args;\n\t\tstate._factory = factory;\n\t\treturn state._pendingValue;\n\t}\n\n\treturn state._value;\n}\n\n/**\n * @param {() => void} callback\n * @param {any[]} args\n */\nexport function useCallback(callback, args) {\n\tcurrentHook = 8;\n\treturn useMemo(() => callback, args);\n}\n\n/**\n * @param {import('./internal').PreactContext} context\n */\nexport function useContext(context) {\n\tconst provider = currentComponent.context[context._id];\n\t// We could skip this call here, but than we'd not call\n\t// `options._hook`. We need to do that in order to make\n\t// the devtools aware of this hook.\n\t/** @type {import('./internal').ContextHookState} */\n\tconst state = getHookState(currentIndex++, 9);\n\t// The devtools needs access to the context object to\n\t// be able to pull of the default value when no provider\n\t// is present in the tree.\n\tstate._context = context;\n\tif (!provider) return context._defaultValue;\n\t// This is probably not safe to convert to \"!\"\n\tif (state._value == null) {\n\t\tstate._value = true;\n\t\tprovider.sub(currentComponent);\n\t}\n\treturn provider.props.value;\n}\n\n/**\n * Display a custom label for a custom hook for the devtools panel\n * @type {<T>(value: T, cb?: (value: T) => string | number) => void}\n */\nexport function useDebugValue(value, formatter) {\n\tif (options.useDebugValue) {\n\t\toptions.useDebugValue(formatter ? formatter(value) : value);\n\t}\n}\n\n/**\n * @param {(error: any) => void} cb\n */\nexport function useErrorBoundary(cb) {\n\t/** @type {import('./internal').ErrorBoundaryHookState} */\n\tconst state = getHookState(currentIndex++, 10);\n\tconst errState = useState();\n\tstate._value = cb;\n\tif (!currentComponent.componentDidCatch) {\n\t\tcurrentComponent.componentDidCatch = err => {\n\t\t\tif (state._value) state._value(err);\n\t\t\terrState[1](err);\n\t\t};\n\t}\n\treturn [\n\t\terrState[0],\n\t\t() => {\n\t\t\terrState[1](undefined);\n\t\t}\n\t];\n}\n\n/**\n * After paint effects consumer.\n */\nfunction flushAfterPaintEffects() {\n\tlet component;\n\twhile ((component = afterPaintEffects.shift())) {\n\t\tif (!component._parentDom || !component.__hooks) continue;\n\t\ttry {\n\t\t\tcomponent.__hooks._pendingEffects.forEach(invokeCleanup);\n\t\t\tcomponent.__hooks._pendingEffects.forEach(invokeEffect);\n\t\t\tcomponent.__hooks._pendingEffects = [];\n\t\t} catch (e) {\n\t\t\tcomponent.__hooks._pendingEffects = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t}\n}\n\nlet HAS_RAF = typeof requestAnimationFrame == 'function';\n\n/**\n * Schedule a callback to be invoked after the browser has a chance to paint a new frame.\n * Do this by combining requestAnimationFrame (rAF) + setTimeout to invoke a callback after\n * the next browser frame.\n *\n * Also, schedule a timeout in parallel to the the rAF to ensure the callback is invoked\n * even if RAF doesn't fire (for example if the browser tab is not visible)\n *\n * @param {() => void} callback\n */\nfunction afterNextFrame(callback) {\n\tconst done = () => {\n\t\tclearTimeout(timeout);\n\t\tif (HAS_RAF) cancelAnimationFrame(raf);\n\t\tsetTimeout(callback);\n\t};\n\tconst timeout = setTimeout(done, RAF_TIMEOUT);\n\n\tlet raf;\n\tif (HAS_RAF) {\n\t\traf = requestAnimationFrame(done);\n\t}\n}\n\n// Note: if someone used options.debounceRendering = requestAnimationFrame,\n// then effects will ALWAYS run on the NEXT frame instead of the current one, incurring a ~16ms delay.\n// Perhaps this is not such a big deal.\n/**\n * Schedule afterPaintEffects flush after the browser paints\n * @param {number} newQueueLength\n */\nfunction afterPaint(newQueueLength) {\n\tif (newQueueLength === 1 || prevRaf !== options.requestAnimationFrame) {\n\t\tprevRaf = options.requestAnimationFrame;\n\t\t(prevRaf || afterNextFrame)(flushAfterPaintEffects);\n\t}\n}\n\n/**\n * @param {import('./internal').EffectHookState} hook\n */\nfunction invokeCleanup(hook) {\n\t// A hook cleanup can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\tlet cleanup = hook._cleanup;\n\tif (typeof cleanup == 'function') {\n\t\thook._cleanup = undefined;\n\t\tcleanup();\n\t}\n\n\tcurrentComponent = comp;\n}\n\n/**\n * Invoke a Hook's effect\n * @param {import('./internal').EffectHookState} hook\n */\nfunction invokeEffect(hook) {\n\t// A hook call can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\thook._cleanup = hook._value();\n\tcurrentComponent = comp;\n}\n\n/**\n * @param {any[]} oldArgs\n * @param {any[]} newArgs\n */\nfunction argsChanged(oldArgs, newArgs) {\n\treturn (\n\t\t!oldArgs ||\n\t\toldArgs.length !== newArgs.length ||\n\t\tnewArgs.some((arg, index) => arg !== oldArgs[index])\n\t);\n}\n\nfunction invokeOrReturn(arg, f) {\n\treturn typeof f == 'function' ? f(arg) : f;\n}\n","import { DXCAlert } from \"../types/DXCAlert\";\n\n/** Resolve a message template with parameters.\n * \n * Example:\n * resolveText({\n * message: \"Hello {name}!\",\n * messageCode: \"HELLO\",\n * messageParams: {name: \"David\"}\n * }) => \"Hello David!\"\n * \n * @param message Template message with {vars} in it.\n * @param messageCode Unique code for the message. Can be used for translation.\n * @param messageParams Parameters to be used in the message.\n * @returns A final message where parameters have been replaced with values.\n */\nexport function resolveText({message, messageCode, messageParams}: DXCAlert) {\n return message.replace(/\\{\\w+\\}/ig, n => messageParams[n.substring(1, n.length-1)]);\n}\n","import { Dialog } from './Dialog';\nimport { Styles } from './Styles';\nimport { h, Fragment } from 'preact';\nimport { useLayoutEffect, useRef, useState } from 'preact/hooks';\nimport { DXCUserInteraction } from '../types/DXCUserInteraction';\nimport { resolveText } from '../helpers/resolveText';\nimport { DXCInputField } from '../types/DXCInputField';\n\nconst OTP_LENGTH = 8;\n\nexport function LoginDialog({\n title,\n type,\n alerts,\n fields,\n submitLabel,\n cancelLabel,\n onCancel,\n onSubmit,\n}: DXCUserInteraction) {\n const [params, setParams] = useState<{ [param: string]: string }>({});\n\n const firstFieldRef = useRef<HTMLInputElement>(null);\n useLayoutEffect(() => firstFieldRef.current?.focus(), []);\n\n return (\n <Dialog className=\"dxc-login-dlg\">\n <>\n <h3 style={Styles.WindowHeader}>{title}</h3>\n {alerts.map((alert) => (\n <p style={Styles.Alert[alert.type]}>{resolveText(alert)}</p>\n ))}\n <form\n onSubmit={(ev) => {\n ev.preventDefault();\n onSubmit(params);\n }}\n >\n {(Object.entries(fields) as [string, DXCInputField][]).map(\n ([fieldName, { type, label, placeholder }], idx) => (\n <label style={Styles.Label} key={idx}>\n {label ? `${label}: ` : ''}\n <input\n ref={idx === 0 ? firstFieldRef : undefined}\n type={type}\n name={fieldName}\n autoComplete=\"on\"\n style={Styles.Input}\n autoFocus\n placeholder={placeholder}\n value={params[fieldName] || ''}\n onInput={(ev) => {\n const value = valueTransformer(type, ev.target?.['value']);\n let updatedParams = {\n ...params,\n [fieldName]: value,\n };\n setParams(updatedParams);\n if (type === 'otp' && value?.trim().length === OTP_LENGTH) {\n // Auto-submit when OTP is filled in.\n onSubmit(updatedParams);\n }\n }}\n />\n </label>\n )\n )}\n </form>\n </>\n <div style={Styles.ButtonsDiv}>\n <>\n <button\n type=\"submit\"\n style={Styles.Button}\n onClick={() => onSubmit(params)}\n >\n {submitLabel}\n </button>\n {cancelLabel && (\n <button style={Styles.Button} onClick={onCancel}>\n {cancelLabel}\n </button>\n )}\n </>\n </div>\n </Dialog>\n );\n}\n\nfunction valueTransformer(type: string, value: string) {\n switch (type) {\n case 'email':\n return value.toLowerCase();\n case 'otp':\n return value.toUpperCase();\n default:\n return value;\n }\n}\n","import Dexie from \"dexie\";\nimport \"../extend-dexie-interface\";\nimport { h, Component } from \"preact\";\nimport { from, Subscription } from \"rxjs\";\nimport { LoginDialog } from './LoginDialog';\nimport { DXCUserInteraction } from \"../types/DXCUserInteraction\";\nimport * as preact from \"preact\";\n\nexport interface Props {\n db: Dexie;\n}\n\ninterface State {\n userInteraction: DXCUserInteraction | undefined;\n}\n\nexport default class LoginGui extends Component<Props, State> {\n subscription?: Subscription;\n observer = (userInteraction: DXCUserInteraction | undefined) => this.setState({userInteraction});\n\n constructor(props: Props) {\n super(props);\n this.state = { userInteraction: undefined };\n }\n\n componentDidMount() {\n this.subscription = from(this.props.db.cloud.userInteraction).subscribe(this.observer);\n }\n\n componentWillUnmount() {\n if (this.subscription) {\n this.subscription.unsubscribe();\n delete this.subscription;\n }\n }\n\n render(props: Props, {userInteraction}: State) {\n if (!userInteraction) return null;\n //if (props.db.cloud.userInteraction.observers.length > 1) return null; // Someone else subscribes.\n return <LoginDialog {...userInteraction} />;\n }\n}\n\nexport function setupDefaultGUI(db: Dexie) {\n let closed = false;\n\n const el = document.createElement('div');\n if (document.body) {\n document.body.appendChild(el);\n preact.render(<LoginGui db={db.vip} />, el);\n } else {\n addEventListener('DOMContentLoaded', ()=>{\n if (!closed) {\n document.body.appendChild(el);\n preact.render(<LoginGui db={db.vip} />, el);\n }\n });\n }\n\n return {\n unsubscribe() {\n try { el.remove(); } catch {}\n closed = true;\n },\n get closed() {\n return closed;\n }\n }\n}\n","export function associate<T extends object,M>(factory: (x: T)=>M): (x: T) => M {\n const wm = new WeakMap<T, M>();\n return (x: T) => {\n let rv = wm.get(x);\n if (!rv) {\n rv = factory(x);\n wm.set(x, rv);\n }\n return rv;\n }\n}\n","import Dexie from \"dexie\";\nimport { BehaviorSubject } from \"rxjs\";\nimport { associate } from \"./associate\";\nimport { UNAUTHORIZED_USER } from \"./authentication/UNAUTHORIZED_USER\";\n\nexport const getCurrentUserEmitter = associate((db: Dexie) => new BehaviorSubject(UNAUTHORIZED_USER));\n","import { combineLatest, Observable, of } from 'rxjs';\nimport { debounceTime, map, startWith, switchMap } from 'rxjs/operators';\nimport { getCurrentUserEmitter } from './currentUserEmitter';\nimport { DexieCloudDB, SyncStateChangedEventData } from './db/DexieCloudDB';\nimport { isOnline } from './sync/isOnline';\nimport { SyncState } from './types/SyncState';\nimport { userIsActive, userIsReallyActive } from './userIsActive';\n\nexport function computeSyncState(db: DexieCloudDB): Observable<SyncState> {\n let _prevStatus = db.cloud.webSocketStatus.value;\n const lazyWebSocketStatus = db.cloud.webSocketStatus.pipe(\n switchMap((status) => {\n const prevStatus = _prevStatus;\n _prevStatus = status;\n const rv = of(status);\n switch (status) {\n // A normal scenario is that the WS reconnects and falls shortly in disconnected-->connection-->connected.\n // Don't distract user with this unless these things take more time than normal:\n\n // Only show disconnected if disconnected more than 500ms, or if we can\n // see that the user is indeed not active.\n case 'disconnected':\n return userIsActive.value ? rv.pipe(debounceTime(500)) : rv;\n\n // Only show connecting if previous state was 'not-started' or 'error', or if\n // the time it takes to connect goes beyond 4 seconds.\n case 'connecting':\n return prevStatus === 'not-started' || prevStatus === 'error'\n ? rv\n : rv.pipe(debounceTime(4000));\n default:\n return rv;\n }\n })\n );\n return combineLatest([\n lazyWebSocketStatus,\n db.syncStateChangedEvent.pipe(startWith({ phase: 'initial' } as SyncStateChangedEventData)),\n getCurrentUserEmitter(db.dx._novip),\n userIsReallyActive\n ]).pipe(\n map(([status, syncState, user, userIsActive]) => {\n if (user.license?.status && user.license.status !== 'ok') {\n return {\n phase: 'offline',\n status: 'offline',\n license: user.license.status\n } satisfies SyncState;\n }\n let { phase, error, progress } = syncState;\n let adjustedStatus = status;\n if (phase === 'error') {\n // Let users only rely on the status property to display an icon.\n // If there's an error in the sync phase, let it show on that\n // status icon also.\n adjustedStatus = 'error';\n }\n if (status === 'not-started') {\n // If websocket isn't yet connected becase we're doing\n // the startup sync, let the icon show the symbol for connecting.\n if (phase === 'pushing' || phase === 'pulling') {\n adjustedStatus = 'connecting';\n }\n } \n const previousPhase = db.cloud.syncState.value.phase;\n //const previousStatus = db.cloud.syncState.value.status;\n if (previousPhase === 'error' && (syncState.phase === 'pushing' || syncState.phase === 'pulling')) {\n // We were in an errored state but is now doing sync. Show \"connecting\" icon.\n adjustedStatus = 'connecting';\n }\n /*if (syncState.phase === 'in-sync' && adjustedStatus === 'connecting') {\n adjustedStatus = 'connected';\n }*/\n \n if (!userIsActive) {\n adjustedStatus = 'disconnected';\n }\n\n const retState: SyncState = {\n phase,\n error,\n progress,\n status: isOnline ? adjustedStatus : 'offline',\n license: 'ok'\n };\n\n return retState;\n })\n );\n}\n","import {\n concat,\n from,\n InteropObservable,\n map,\n Observable,\n ObservableInput,\n share,\n timer,\n} from 'rxjs';\nimport { ObservableWithCurrentValue } from './mapValueObservable';\n\nexport function createSharedValueObservable<T>(\n o: ObservableInput<T>,\n defaultValue: T\n): ObservableWithCurrentValue<T> {\n let currentValue = defaultValue;\n let shared = from(o).pipe(\n map((x) => (currentValue = x)),\n share({ resetOnRefCountZero: () => timer(1000) })\n ) as ObservableWithCurrentValue<T>;\n\n const rv = new Observable((observer) => {\n let didEmit = false;\n const subscription = shared.subscribe({\n next(value) {\n didEmit = true;\n observer.next(value);\n },\n error(error) {\n observer.error(error);\n },\n complete() {\n observer.complete();\n }\n });\n if (!didEmit && !subscription.closed) {\n observer.next(currentValue);\n }\n return subscription;\n }) as ObservableWithCurrentValue<T>;\n\n rv.getValue = () => currentValue;\n return rv;\n}\n","import Dexie, { liveQuery } from 'dexie';\nimport { DBRealmRole } from 'dexie-cloud-common';\nimport { associate } from './associate';\nimport { createSharedValueObservable } from './createSharedValueObservable';\n\nexport const getGlobalRolesObservable = associate((db: Dexie) => {\n return createSharedValueObservable(\n liveQuery(() =>\n db.roles\n .where({ realmId: 'rlm-public' })\n .toArray()\n .then((roles) => {\n const rv: { [roleName: string]: DBRealmRole } = {};\n for (const role of roles\n .slice()\n .sort((a, b) => (a.sortOrder || 0) - (b.sortOrder || 0))) {\n rv[role.name] = role;\n }\n return rv;\n })\n ),\n {}\n );\n});\n","import Dexie, { liveQuery } from 'dexie';\nimport { DBRealm, DBRealmMember } from 'dexie-cloud-common';\nimport { concat, Observable, timer } from 'rxjs';\nimport { share, switchMap } from 'rxjs/operators';\nimport { associate } from './associate';\nimport { createSharedValueObservable } from './createSharedValueObservable';\nimport { getCurrentUserEmitter } from './currentUserEmitter';\n\nexport type InternalAccessControlData = {\n readonly selfMembers: DBRealmMember[];\n readonly realms: DBRealm[];\n readonly userId: string;\n};\n\nexport const getInternalAccessControlObservable = associate((db: Dexie) => {\n return createSharedValueObservable(\n getCurrentUserEmitter(db._novip).pipe(\n switchMap((currentUser) =>\n liveQuery(() =>\n db.transaction('r', 'realms', 'members', () =>\n Promise.all([\n db.members.where({ userId: currentUser.userId }).toArray(),\n db.realms.toArray(),\n currentUser.userId!,\n ] as const).then(([selfMembers, realms, userId]) => {\n //console.debug(`PERMS: Result from liveQUery():`, JSON.stringify({selfMembers, realms, userId}, null, 2))\n return { selfMembers, realms, userId };\n })\n )\n )\n )\n ), {\n selfMembers: [],\n realms: [],\n get userId() {\n return db.cloud.currentUserId;\n },\n }\n );\n /* let refCount = 0;\n return new Observable(observer => {\n const subscription = o.subscribe(observer);\n console.debug ('PERMS subscribe', ++refCount);\n return {\n unsubscribe() {\n console.debug ('PERMS unsubscribe', --refCount);\n subscription.unsubscribe();\n }\n }\n })*/\n});\n","import { map, Observable } from 'rxjs';\n\nexport interface ObservableWithCurrentValue<T> extends Observable<T> {\n getValue(): T;\n}\n\nexport function mapValueObservable<T, R>(\n o: ObservableWithCurrentValue<T>,\n mapper: (x: T) => R\n): ObservableWithCurrentValue<R> {\n let currentValue: R | undefined;\n const rv = o.pipe(\n map((x) => (currentValue = mapper(x)))\n ) as ObservableWithCurrentValue<R>;\n rv.getValue = () =>\n currentValue !== undefined\n ? currentValue\n : (currentValue = mapper(o.getValue()));\n return rv;\n}\n","// TODO: Move to dexie-cloud-common\n\nimport { DBPermissionSet } from 'dexie-cloud-common';\n\nexport function mergePermissions(\n ...permissions: DBPermissionSet[]\n): DBPermissionSet {\n if (permissions.length === 0) return {};\n const reduced = permissions.reduce((result, next) => {\n const ret = { ...result } as DBPermissionSet;\n for (const [verb, rights] of Object.entries(next) as [\n keyof DBPermissionSet,\n DBPermissionSet[keyof DBPermissionSet]\n ][]) {\n if (verb in ret && ret[verb]) {\n if (ret[verb] === '*') continue;\n if (rights === '*') {\n ret[verb] = '*';\n } else if (Array.isArray(rights) && Array.isArray(ret[verb])) {\n // Both are arrays (verb is 'add' or 'manage')\n const r = ret as { [v in typeof verb]?: string[] };\n const retVerb = r[verb]!; // \"!\" because Array.isArray(ret[verb])\n r[verb] = [...new Set([...retVerb, ...rights])];\n } else if (\n typeof rights === 'object' &&\n rights &&\n typeof ret[verb] === 'object'\n ) {\n // Both are objects (verb is 'update')\n const mergedRights = ret[verb] as {\n [tableName: string]: '*' | string[];\n }; // because we've checked that typeof ret[verb] === 'object' and earlier that not ret[verb] === '*'.\n for (const [tableName, tableRights] of Object.entries(rights) as [\n string,\n string[] | '*'\n ][]) {\n if (mergedRights[tableName] === '*') continue;\n if (tableRights === '*') {\n mergedRights[tableName] = '*';\n } else if (\n Array.isArray(mergedRights[tableName]) &&\n Array.isArray(tableRights)\n ) {\n mergedRights[tableName] = [\n ...new Set([...mergedRights[tableName], ...tableRights]),\n ];\n }\n }\n }\n } else {\n /* This compiles without type assertions. Keeping the comment to\n explain why we do tsignore on the next statement.\n if (verb === \"add\") {\n ret[verb] = next[verb];\n } else if (verb === \"update\") {\n ret[verb] = next[verb];\n } else if (verb === \"manage\") {\n ret[verb] = next[verb];\n } else {\n ret[verb] = next[verb];\n }\n */\n //@ts-ignore\n ret[verb] = next[verb];\n }\n }\n return ret;\n });\n return reduced;\n}\n","import Dexie from 'dexie';\nimport { DBPermissionSet, DBRealm, DBRealmMember } from 'dexie-cloud-common';\nimport { combineLatest, Observable } from 'rxjs';\nimport { map, startWith, tap } from 'rxjs/operators';\nimport { associate } from './associate';\nimport { UNAUTHORIZED_USER } from './authentication/UNAUTHORIZED_USER';\nimport { createSharedValueObservable } from './createSharedValueObservable';\nimport { getGlobalRolesObservable } from './getGlobalRolesObservable';\nimport { getInternalAccessControlObservable } from './getInternalAccessControlObservable';\nimport { flatten } from './helpers/flatten';\nimport { mapValueObservable } from './mapValueObservable';\nimport { mergePermissions } from './mergePermissions';\n\nexport type PermissionsLookup = {\n [realmId: string]: DBRealm & { permissions: DBPermissionSet };\n};\n\nexport type PermissionsLookupObservable = Observable<PermissionsLookup> & {\n getValue(): PermissionsLookup;\n};\n\nexport const getPermissionsLookupObservable = associate((db: Dexie) => {\n const o = createSharedValueObservable(\n combineLatest([\n getInternalAccessControlObservable(db._novip),\n getGlobalRolesObservable(db._novip),\n ]).pipe(\n map(([{ selfMembers, realms, userId }, globalRoles]) => ({\n selfMembers,\n realms,\n userId,\n globalRoles,\n }))\n ),\n {\n selfMembers: [],\n realms: [],\n userId: UNAUTHORIZED_USER.userId!,\n globalRoles: {},\n }\n );\n\n return mapValueObservable(\n o,\n ({ selfMembers, realms, userId, globalRoles }) => {\n const rv = realms\n .map((realm) => {\n const selfRealmMembers = selfMembers.filter(\n (m) => m.realmId === realm.realmId\n );\n const directPermissionSets = selfRealmMembers\n .map((m) => m.permissions!)\n .filter((p) => p);\n const rolePermissionSets = flatten(\n selfRealmMembers.map((m) => m.roles!).filter((roleName) => roleName)\n )\n .map((role) => globalRoles[role]!)\n .filter((role) => role)\n .map((role) => role.permissions);\n\n return {\n ...realm,\n permissions:\n realm.owner === userId\n ? ({ manage: '*' } as DBPermissionSet)\n : mergePermissions(\n ...directPermissionSets,\n ...rolePermissionSets\n ),\n };\n })\n .reduce((p, c) => ({ ...p, [c.realmId]: c }), {\n [userId!]: {\n realmId: userId,\n owner: userId,\n name: userId,\n permissions: { manage: '*' },\n } as DBRealm & { permissions: DBPermissionSet },\n });\n return rv;\n }\n );\n});\n","import { KeyPaths } from 'dexie';\nimport { DBPermissionSet } from 'dexie-cloud-common';\n\ntype TableName<T> = T extends {table: ()=>infer TABLE} ? TABLE extends string ? TABLE : string : string;\n\nexport class PermissionChecker<T, TableNames extends string = TableName<T>> {\n private permissions: DBPermissionSet;\n private tableName: TableNames;\n private isOwner: boolean;\n\n constructor(\n permissions: DBPermissionSet,\n tableName: TableNames,\n isOwner: boolean\n ) {\n this.permissions = permissions || {};\n this.tableName = tableName;\n this.isOwner = isOwner;\n }\n\n add(...tableNames: TableNames[]): boolean {\n // If user can manage the whole realm, return true.\n if (this.permissions.manage === '*') return true;\n // If user can manage given table in realm, return true\n if (this.permissions.manage?.includes(this.tableName)) return true;\n // If user can add any type, return true\n if (this.permissions.add === '*') return true;\n // If user can add objects into given table names in the realm, return true\n if (\n tableNames.every((tableName) => this.permissions.add?.includes(tableName))\n ) {\n return true;\n }\n return false;\n }\n\n update(...props: KeyPaths<T>[]): boolean {\n // If user is owner of this object, or if user can manage the whole realm, return true.\n if (this.isOwner || this.permissions.manage === '*') return true;\n // If user can manage given table in realm, return true\n if (this.permissions.manage?.includes(this.tableName)) return true;\n // If user can update any prop in any table in this realm, return true unless\n // it regards to ownership change:\n if (this.permissions.update === '*') {\n return props.every((prop) => prop !== 'owner');\n }\n const tablePermissions = this.permissions.update?.[this.tableName];\n // If user can update any prop in table and realm, return true unless\n // accessing special props owner or realmId\n if (tablePermissions === '*')\n return props.every((prop) => prop !== 'owner');\n\n // Explicitely listed properties to allow updates on:\n return props.every((prop) =>\n tablePermissions?.some(\n (permittedProp) =>\n permittedProp === prop || (permittedProp === '*' && prop !== 'owner')\n )\n );\n }\n\n delete(): boolean {\n // If user is owner of this object, or if user can manage the whole realm, return true.\n if (this.isOwner || this.permissions.manage === '*') return true;\n // If user can manage given table in realm, return true\n if (this.permissions.manage?.includes(this.tableName)) return true;\n return false;\n }\n}\n","import Dexie, { liveQuery } from 'dexie';\nimport { DBRealmMember } from 'dexie-cloud-common';\nimport { from, Observable } from 'rxjs';\nimport { map, startWith } from 'rxjs/operators';\nimport { mergePermissions } from './mergePermissions';\nimport {\n getPermissionsLookupObservable,\n PermissionsLookup,\n} from './getPermissionsLookupObservable';\nimport { PermissionChecker } from './PermissionChecker';\nimport './extend-dexie-interface';\n\nexport function permissions(\n dexie: Dexie,\n obj: { owner?: string; realmId?: string; table?: () => string },\n tableName?: string\n): Observable<PermissionChecker<any>> {\n if (!obj)\n throw new TypeError(\n `Cannot check permissions of undefined or null. A Dexie Cloud object with realmId and owner expected.`\n );\n const { owner, realmId } = obj;\n if (!tableName) {\n if (typeof obj.table !== 'function') {\n throw new TypeError(\n `Missing 'table' argument to permissions and table could not be extracted from entity`\n );\n }\n tableName = obj.table();\n }\n const source = getPermissionsLookupObservable(dexie);\n const mapper = (permissionsLookup: PermissionsLookup) => {\n // If realmId is undefined, it can be due to that the object is not yet syncified - it exists\n // locally only as the user might not yet be authenticated. This is ok and we shall treat it\n // as if the realmId is dexie.cloud.currentUserId (which is \"unauthorized\" by the way)\n const realm = permissionsLookup[realmId || dexie.cloud.currentUserId];\n if (!realm)\n return new PermissionChecker(\n {},\n tableName!,\n !owner || owner === dexie.cloud.currentUserId\n );\n return new PermissionChecker(\n realm.permissions,\n tableName!,\n realmId === dexie.cloud.currentUserId || owner === dexie.cloud.currentUserId\n );\n };\n const o = source.pipe(map(mapper)) as Observable<PermissionChecker<any>> & {\n getValue: () => PermissionChecker<any>;\n };\n o.getValue = () => mapper(source.getValue());\n return o;\n}\n","import { Dexie, liveQuery } from 'dexie';\nimport { DBRealmMember } from 'dexie-cloud-common';\nimport { combineLatest } from 'rxjs';\nimport { map, switchMap } from 'rxjs/operators';\nimport { associate } from './associate';\nimport { createSharedValueObservable } from './createSharedValueObservable';\nimport { getCurrentUserEmitter } from './currentUserEmitter';\nimport { getInternalAccessControlObservable } from './getInternalAccessControlObservable';\nimport { getPermissionsLookupObservable } from './getPermissionsLookupObservable';\nimport { Invite } from './Invite';\nimport { mapValueObservable } from './mapValueObservable';\n\nexport const getInvitesObservable = associate((db: Dexie) => {\n const membersByEmail = getCurrentUserEmitter(db._novip).pipe(\n switchMap((currentUser) =>\n liveQuery(() =>\n db.members.where({ email: currentUser.email || '' }).toArray()\n )\n )\n );\n const permissions = getPermissionsLookupObservable(db._novip);\n const accessControl = getInternalAccessControlObservable(db._novip);\n return createSharedValueObservable(\n combineLatest([membersByEmail, accessControl, permissions]).pipe(\n map(([membersByEmail, accessControl, realmLookup]) => {\n const reducer = (\n result: { [id: string]: Invite },\n m: DBRealmMember\n ) => ({ ...result, [m.id!]: { ...m, realm: realmLookup[m.realmId] } });\n const emailMembersById = membersByEmail.reduce(reducer, {});\n const membersById = accessControl.selfMembers.reduce(\n reducer,\n emailMembersById\n );\n return Object.values(membersById)\n .filter((invite: DBRealmMember) => !invite.accepted)\n .map(\n (invite: DBRealmMember) =>\n ({\n ...invite,\n async accept() {\n await db.members.update(invite.id!, { accepted: new Date() });\n },\n async reject() {\n await db.members.update(invite.id!, { rejected: new Date() });\n },\n } satisfies Invite)\n );\n })\n ),\n []\n );\n});\n","\nexport function getTiedRealmId(objectId: string) {\n return 'rlm~' + objectId;\n}\n\nexport function getTiedObjectId(realmId: string) {\n return realmId.startsWith('rlm~') ? realmId.substr(4) : null;\n}\n","import Dexie, { liveQuery, Subscription, Table } from 'dexie';\nimport {\n DBPermissionSet,\n DBRealmMember,\n getDbNameFromDbUrl,\n} from 'dexie-cloud-common';\nimport { BehaviorSubject, combineLatest, from, fromEvent, Subject } from 'rxjs';\nimport { filter, map, skip, startWith, switchMap, take } from 'rxjs/operators';\nimport { login } from './authentication/login';\nimport { UNAUTHORIZED_USER } from './authentication/UNAUTHORIZED_USER';\nimport { DexieCloudDB } from './db/DexieCloudDB';\nimport { PersistedSyncState } from './db/entities/PersistedSyncState';\nimport { DexieCloudOptions } from './DexieCloudOptions';\nimport { DISABLE_SERVICEWORKER_STRATEGY } from './DISABLE_SERVICEWORKER_STRATEGY';\nimport './extend-dexie-interface';\nimport { DexieCloudSyncOptions } from './DexieCloudSyncOptions';\nimport { dbOnClosed } from './helpers/dbOnClosed';\nimport { IS_SERVICE_WORKER } from './helpers/IS_SERVICE_WORKER';\nimport { throwVersionIncrementNeeded } from './helpers/throwVersionIncrementNeeded';\nimport { createIdGenerationMiddleware } from './middlewares/createIdGenerationMiddleware';\nimport { createImplicitPropSetterMiddleware } from './middlewares/createImplicitPropSetterMiddleware';\nimport { createMutationTrackingMiddleware } from './middlewares/createMutationTrackingMiddleware';\n//import { dexieCloudSyncProtocol } from \"./dexieCloudSyncProtocol\";\nimport { overrideParseStoresSpec } from './overrideParseStoresSpec';\nimport { performInitialSync } from './performInitialSync';\nimport { connectWebSocket } from './sync/connectWebSocket';\nimport { isSyncNeeded } from './sync/isSyncNeeded';\nimport { LocalSyncWorker } from './sync/LocalSyncWorker';\nimport {\n registerPeriodicSyncEvent,\n registerSyncEvent,\n} from './sync/registerSyncEvent';\nimport { triggerSync } from './sync/triggerSync';\nimport { DXCUserInteraction } from './types/DXCUserInteraction';\nimport { SyncState } from './types/SyncState';\nimport { updateSchemaFromOptions } from './updateSchemaFromOptions';\nimport { verifySchema } from './verifySchema';\nimport { setupDefaultGUI } from './default-ui';\nimport { DXCWebSocketStatus } from './DXCWebSocketStatus';\nimport { computeSyncState } from './computeSyncState';\nimport { generateKey } from './middleware-helpers/idGenerationHelpers';\nimport { permissions } from './permissions';\nimport { getCurrentUserEmitter } from './currentUserEmitter';\nimport { NewIdOptions } from './types/NewIdOptions';\nimport { getInvitesObservable } from './getInvitesObservable';\nimport { getGlobalRolesObservable } from './getGlobalRolesObservable';\nimport { UserLogin } from './db/entities/UserLogin';\nimport { InvalidLicenseError } from './InvalidLicenseError';\nimport { logout, _logout } from './authentication/logout';\nimport { loadAccessToken } from './authentication/authenticate';\nimport { isEagerSyncDisabled } from './isEagerSyncDisabled';\nexport { DexieCloudTable } from './DexieCloudTable';\nexport * from './getTiedRealmId';\nexport {\n DBRealm,\n DBRealmMember,\n DBRealmRole,\n DBSyncedObject,\n DBPermissionSet,\n} from 'dexie-cloud-common';\nexport { Invite } from './Invite';\nexport { UserLogin };\n\nconst DEFAULT_OPTIONS: Partial<DexieCloudOptions> = {\n nameSuffix: true,\n};\n\nexport function dexieCloud(dexie: Dexie) {\n const origIdbName = dexie.name;\n //\n //\n //\n const currentUserEmitter = getCurrentUserEmitter(dexie);\n const subscriptions: Subscription[] = [];\n let configuredProgramatically = false;\n\n // local sync worker - used when there's no service worker.\n let localSyncWorker: { start: () => void; stop: () => void } | null = null;\n dexie.on(\n 'ready',\n async (dexie: Dexie) => {\n try {\n await onDbReady(dexie);\n } catch (error) {\n console.error(error);\n // Make sure to succeed with database open even if network is down.\n }\n },\n true // true = sticky\n );\n\n /** Void starting subscribers after a close has happened. */\n let closed = false;\n function throwIfClosed() {\n if (closed) throw new Dexie.DatabaseClosedError();\n }\n\n dbOnClosed(dexie, () => {\n subscriptions.forEach((subscription) => subscription.unsubscribe());\n closed = true;\n localSyncWorker && localSyncWorker.stop();\n localSyncWorker = null;\n currentUserEmitter.next(UNAUTHORIZED_USER);\n });\n\n const syncComplete = new Subject<void>();\n\n dexie.cloud = {\n version: '{version}',\n options: { ...DEFAULT_OPTIONS } as DexieCloudOptions,\n schema: null,\n get currentUserId() {\n return currentUserEmitter.value.userId || UNAUTHORIZED_USER.userId!;\n },\n currentUser: currentUserEmitter,\n syncState: new BehaviorSubject<SyncState>({\n phase: 'initial',\n status: 'not-started',\n }),\n\n events: {\n syncComplete,\n },\n\n persistedSyncState: new BehaviorSubject<PersistedSyncState | undefined>(\n undefined\n ),\n userInteraction: new BehaviorSubject<DXCUserInteraction | undefined>(\n undefined\n ),\n webSocketStatus: new BehaviorSubject<DXCWebSocketStatus>('not-started'),\n async login(hint) {\n const db = DexieCloudDB(dexie);\n await db.cloud.sync();\n await login(db, hint);\n },\n invites: getInvitesObservable(dexie),\n roles: getGlobalRolesObservable(dexie),\n configure(options: DexieCloudOptions) {\n options = dexie.cloud.options = { ...dexie.cloud.options, ...options };\n configuredProgramatically = true;\n if (options.databaseUrl && options.nameSuffix) {\n // @ts-ignore\n dexie.name = `${origIdbName}-${getDbNameFromDbUrl(\n options.databaseUrl\n )}`;\n DexieCloudDB(dexie).reconfigure(); // Update observable from new dexie.name\n }\n updateSchemaFromOptions(dexie.cloud.schema, dexie.cloud.options);\n },\n async logout({ force } = {}) {\n force\n ? await _logout(DexieCloudDB(dexie), { deleteUnsyncedData: true })\n : await logout(DexieCloudDB(dexie));\n },\n async sync(\n { wait, purpose }: DexieCloudSyncOptions = { wait: true, purpose: 'push' }\n ) {\n if (wait === undefined) wait = true;\n const db = DexieCloudDB(dexie);\n const licenseStatus = db.cloud.currentUser.value.license?.status || 'ok';\n if (licenseStatus !== 'ok') {\n // Refresh access token to check for updated license\n await loadAccessToken(db);\n }\n if (purpose === 'pull') {\n const syncState = db.cloud.persistedSyncState.value;\n triggerSync(db, purpose);\n if (wait) {\n const newSyncState = await db.cloud.persistedSyncState\n .pipe(\n filter(\n (newSyncState) =>\n newSyncState?.timestamp != null &&\n (!syncState || newSyncState.timestamp > syncState.timestamp!)\n ),\n take(1)\n )\n .toPromise();\n if (newSyncState?.error) {\n throw new Error(`Sync error: ` + newSyncState.error);\n }\n }\n } else if (await isSyncNeeded(db)) {\n const syncState = db.cloud.persistedSyncState.value;\n triggerSync(db, purpose);\n if (wait) {\n console.debug('db.cloud.login() is waiting for sync completion...');\n await from(\n liveQuery(async () => {\n const syncNeeded = await isSyncNeeded(db);\n const newSyncState = await db.getPersistedSyncState();\n if (\n newSyncState?.timestamp !== syncState?.timestamp &&\n newSyncState?.error\n )\n throw new Error(`Sync error: ` + newSyncState.error);\n return syncNeeded;\n })\n )\n .pipe(\n filter((isNeeded) => !isNeeded),\n take(1)\n )\n .toPromise();\n console.debug(\n 'Done waiting for sync completion because we have nothing to push anymore'\n );\n }\n }\n },\n permissions(\n obj: { owner: string; realmId: string; table?: () => string },\n tableName?: string\n ) {\n return permissions(dexie._novip, obj, tableName);\n },\n };\n\n dexie.Version.prototype['_parseStoresSpec'] = Dexie.override(\n dexie.Version.prototype['_parseStoresSpec'],\n (origFunc) => overrideParseStoresSpec(origFunc, dexie)\n );\n\n dexie.Table.prototype.newId = function (\n this: Table<any>,\n { colocateWith }: NewIdOptions = {}\n ) {\n const shardKey =\n colocateWith && colocateWith.substr(colocateWith.length - 3);\n return generateKey(dexie.cloud.schema![this.name].idPrefix || '', shardKey);\n };\n\n dexie.Table.prototype.idPrefix = function (this: Table<any>) {\n return this.db.cloud.schema?.[this.name]?.idPrefix || '';\n };\n\n dexie.use(\n createMutationTrackingMiddleware({\n currentUserObservable: dexie.cloud.currentUser,\n db: DexieCloudDB(dexie),\n })\n );\n dexie.use(createImplicitPropSetterMiddleware(DexieCloudDB(dexie)));\n dexie.use(createIdGenerationMiddleware(DexieCloudDB(dexie)));\n\n async function onDbReady(dexie: Dexie) {\n closed = false; // As Dexie calls us, we are not closed anymore. Maybe reopened? Remember db.ready event is registered with sticky flag!\n const db = DexieCloudDB(dexie);\n // Setup default GUI:\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n if (!db.cloud.options?.customLoginGui) {\n subscriptions.push(setupDefaultGUI(dexie));\n }\n }\n if (!db.cloud.isServiceWorkerDB) {\n subscriptions.push(computeSyncState(db).subscribe(dexie.cloud.syncState));\n }\n\n // Forward db.syncCompleteEvent to be publicly consumable via db.cloud.events.syncComplete:\n subscriptions.push(db.syncCompleteEvent.subscribe(syncComplete));\n\n //verifyConfig(db.cloud.options); Not needed (yet at least!)\n // Verify the user has allowed version increment.\n if (!db.tables.every((table) => table.core)) {\n throwVersionIncrementNeeded();\n }\n const swRegistrations =\n 'serviceWorker' in navigator\n ? await navigator.serviceWorker.getRegistrations()\n : [];\n\n const initiallySynced = await db.transaction(\n 'rw',\n db.$syncState,\n async () => {\n const { options, schema } = db.cloud;\n const [persistedOptions, persistedSchema, persistedSyncState] =\n await Promise.all([\n db.getOptions(),\n db.getSchema(),\n db.getPersistedSyncState(),\n ]);\n if (!configuredProgramatically) {\n // Options not specified programatically (use case for SW!)\n // Take persisted options:\n db.cloud.options = persistedOptions || null;\n } else if (\n !persistedOptions ||\n JSON.stringify(persistedOptions) !== JSON.stringify(options)\n ) {\n // Update persisted options:\n if (!options) throw new Error(`Internal error`); // options cannot be null if configuredProgramatically is set.\n const newPersistedOptions: DexieCloudOptions = {\n ...options,\n };\n delete newPersistedOptions.fetchTokens;\n await db.$syncState.put(newPersistedOptions, 'options');\n }\n if (\n db.cloud.options?.tryUseServiceWorker &&\n 'serviceWorker' in navigator &&\n swRegistrations.length > 0 &&\n !DISABLE_SERVICEWORKER_STRATEGY\n ) {\n // * Configured for using service worker if available.\n // * Browser supports service workers\n // * There are at least one service worker registration\n console.debug('Dexie Cloud Addon: Using service worker');\n db.cloud.usingServiceWorker = true;\n } else {\n // Not configured for using service worker or no service worker\n // registration exists. Don't rely on service worker to do any job.\n // Use LocalSyncWorker instead.\n if (\n db.cloud.options?.tryUseServiceWorker &&\n !db.cloud.isServiceWorkerDB\n ) {\n console.debug(\n 'dexie-cloud-addon: Not using service worker.',\n swRegistrations.length === 0\n ? 'No SW registrations found.'\n : 'serviceWorker' in navigator && DISABLE_SERVICEWORKER_STRATEGY\n ? 'Avoiding SW background sync and SW periodic bg sync for this browser due to browser bugs.'\n : 'navigator.serviceWorker not present'\n );\n }\n db.cloud.usingServiceWorker = false;\n }\n updateSchemaFromOptions(schema, db.cloud.options);\n updateSchemaFromOptions(persistedSchema, db.cloud.options);\n if (!schema) {\n // Database opened dynamically (use case for SW!)\n // Take persisted schema:\n db.cloud.schema = persistedSchema || null;\n } else if (\n !persistedSchema ||\n JSON.stringify(persistedSchema) !== JSON.stringify(schema)\n ) {\n // Update persisted schema (but don't overwrite table prefixes)\n const newPersistedSchema = persistedSchema || {};\n for (const [table, tblSchema] of Object.entries(schema)) {\n const newTblSchema = newPersistedSchema[table];\n if (!newTblSchema) {\n newPersistedSchema[table] = { ...tblSchema };\n } else {\n newTblSchema.markedForSync = tblSchema.markedForSync;\n tblSchema.deleted = newTblSchema.deleted;\n newTblSchema.generatedGlobalId = tblSchema.generatedGlobalId;\n }\n }\n await db.$syncState.put(newPersistedSchema, 'schema');\n\n // Make sure persisted table prefixes are being used instead of computed ones:\n // Let's assign all props as the newPersistedSchems should be what we should be working with.\n Object.assign(schema, newPersistedSchema);\n }\n return persistedSyncState?.initiallySynced;\n }\n );\n\n if (initiallySynced) {\n db.setInitiallySynced(true);\n }\n\n verifySchema(db);\n\n if (db.cloud.options?.databaseUrl && !initiallySynced) {\n await performInitialSync(db, db.cloud.options, db.cloud.schema!);\n db.setInitiallySynced(true);\n }\n\n // Manage CurrentUser observable:\n throwIfClosed();\n if (!db.cloud.isServiceWorkerDB) {\n subscriptions.push(\n liveQuery(() => db.getCurrentUser()).subscribe(currentUserEmitter)\n );\n // Manage PersistendSyncState observable:\n subscriptions.push(\n liveQuery(() => db.getPersistedSyncState()).subscribe(\n db.cloud.persistedSyncState\n )\n );\n // Wait till currentUser and persistedSyncState gets populated\n // with things from the database and not just the default values.\n // This is so that when db.open() completes, user should be safe\n // to subscribe to these observables and get actual data.\n await combineLatest([\n currentUserEmitter.pipe(skip(1), take(1)),\n db.cloud.persistedSyncState.pipe(skip(1), take(1)),\n ]).toPromise();\n }\n\n // HERE: If requireAuth, do athentication now.\n let changedUser = false;\n if (db.cloud.options?.requireAuth) {\n changedUser = await login(db);\n }\n\n if (localSyncWorker) localSyncWorker.stop();\n localSyncWorker = null;\n throwIfClosed();\n if (db.cloud.usingServiceWorker && db.cloud.options?.databaseUrl) {\n registerSyncEvent(db, changedUser ? 'pull' : 'push').catch(() => {});\n registerPeriodicSyncEvent(db).catch(() => {});\n } else if (\n db.cloud.options?.databaseUrl &&\n db.cloud.schema &&\n !db.cloud.isServiceWorkerDB\n ) {\n // There's no SW. Start SyncWorker instead.\n localSyncWorker = LocalSyncWorker(db, db.cloud.options, db.cloud.schema!);\n localSyncWorker.start();\n triggerSync(db, changedUser ? 'pull' : 'push');\n }\n\n // Listen to online event and do sync.\n throwIfClosed();\n if (!db.cloud.isServiceWorkerDB) {\n subscriptions.push(\n fromEvent(self, 'online').subscribe(() => {\n console.debug('online!');\n db.syncStateChangedEvent.next({\n phase: 'not-in-sync',\n });\n if (!isEagerSyncDisabled(db)) {\n triggerSync(db, 'push');\n }\n }),\n fromEvent(self, 'offline').subscribe(() => {\n console.debug('offline!');\n db.syncStateChangedEvent.next({\n phase: 'offline',\n });\n })\n );\n }\n\n // Connect WebSocket unless we\n if (\n db.cloud.options?.databaseUrl &&\n !db.cloud.options?.disableWebSocket &&\n !IS_SERVICE_WORKER\n ) {\n subscriptions.push(connectWebSocket(db));\n }\n }\n}\n\ndexieCloud.version = '{version}';\n\nDexie.Cloud = dexieCloud;\n\n//Dexie.addons.push(dexieCloud);\n\nexport default dexieCloud;\n"],"names":["randomString","Symbol_observable","Symbol_iterator","asyncScheduler","iterator","concat","wm","from","filter","Observable","this","bigintDef","tsonBuiltinDefs","counter","Subscription","slice","options","vnodeId","rerenderQueue","prevDebounce","i","EMPTY_OBJ","EMPTY_ARR","IS_NON_DIMENSIONAL","assign","obj","props","removeNode","node","parentNode","removeChild","createElement","type","children","key","ref","normalizedProps","arguments","length","call","defaultProps","undefined","createVNode","original","vnode","constructor","Fragment","Component","context","getDomSibling","childIndex","indexOf","sibling","updateParentDomPointers","child","base","enqueueRender","c","push","process","debounceRendering","setTimeout","queue","sort","a","b","some","component","commitQueue","oldVNode","oldDom","parentDom","diff","ownerSVGElement","commitRoot","diffChildren","renderResult","newParentVNode","oldParentVNode","globalContext","isSvg","excessDomChildren","isHydrating","j","childVNode","newDom","firstChildDom","refs","oldChildren","oldChildrenLength","Array","isArray","reorderChildren","placeChild","unmount","applyRef","tmp","nextDom","sibDom","outer","appendChild","nextSibling","insertBefore","diffProps","dom","newProps","oldProps","hydrate","setProperty","setStyle","style","value","test","name","oldValue","useCapture","o","cssText","replace","toLowerCase","_listeners","addEventListener","eventProxyCapture","eventProxy","removeEventListener","e","setAttribute","removeAttribute","event","newVNode","isNew","oldState","snapshot","clearProcessingException","provider","componentContext","renderHook","count","newType","contextType","prototype","render","doRender","sub","state","getDerivedStateFromProps","componentWillMount","componentDidMount","componentWillReceiveProps","shouldComponentUpdate","forEach","componentWillUpdate","componentDidUpdate","getChildContext","getSnapshotBeforeUpdate","diffElementNodes","diffed","root","cb","oldHtml","newHtml","nodeType","localName","document","createTextNode","createElementNS","is","data","childNodes","dangerouslySetInnerHTML","attributes","innerHTML","checked","current","parentVNode","skipRemove","r","componentWillUnmount","replaceNode","firstChild","error","errorInfo","ctor","handled","getDerivedStateFromError","setState","componentDidCatch","isValidElement","update","callback","s","forceUpdate","currentIndex","currentComponent","previousComponent","prevRaf","currentHook","afterPaintEffects","EMPTY","oldBeforeDiff","oldBeforeRender","oldAfterDiff","oldCommit","oldBeforeUnmount","getHookState","index","hooks","useState","initialState","useReducer","invokeOrReturn","reducer","init","hookState","_reducer","action","currentValue","nextValue","_hasScuFromHooks","prevScu","p","stateHooks","x","every","shouldUpdate","hookItem","useLayoutEffect","args","argsChanged","_pendingArgs","useRef","initialValue","useMemo","factory","flushAfterPaintEffects","shift","invokeCleanup","invokeEffect","requestAnimationFrame","raf","done","clearTimeout","timeout","HAS_RAF","cancelAnimationFrame","hasErrored","hook","comp","cleanup","oldArgs","newArgs","arg","f","preact.render","map","timer"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;AACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;AACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;AACpF,QAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1G,IAAI,OAAO,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC;AACF;AACO,SAAS,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE;AAChC,IAAI,IAAI,OAAO,CAAC,KAAK,UAAU,IAAI,CAAC,KAAK,IAAI;AAC7C,QAAQ,MAAM,IAAI,SAAS,CAAC,sBAAsB,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