dexie-cloud-addon 4.0.0-beta.21 → 4.0.0-beta.23

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.
@@ -1,7 +1,7 @@
1
1
  import Dexie, { cmp, liveQuery } from 'dexie';
2
2
  import { Observable as Observable$1, BehaviorSubject, Subject, fromEvent, of, merge, Subscription as Subscription$1, from as from$1, throwError, combineLatest, map as map$1, share, timer as timer$1, switchMap as switchMap$1 } from 'rxjs';
3
3
 
4
- /*! *****************************************************************************
4
+ /******************************************************************************
5
5
  Copyright (c) Microsoft Corporation.
6
6
 
7
7
  Permission to use, copy, modify, and/or distribute this software for any
@@ -15,8 +15,24 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
15
15
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16
16
  PERFORMANCE OF THIS SOFTWARE.
17
17
  ***************************************************************************** */
18
+ /* global Reflect, Promise */
19
+
20
+ var extendStatics = function(d, b) {
21
+ extendStatics = Object.setPrototypeOf ||
22
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
23
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
24
+ return extendStatics(d, b);
25
+ };
26
+
27
+ function __extends(d, b) {
28
+ if (typeof b !== "function" && b !== null)
29
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
30
+ extendStatics(d, b);
31
+ function __() { this.constructor = d; }
32
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
33
+ }
18
34
 
19
- function __awaiter$1(thisArg, _arguments, P, generator) {
35
+ function __awaiter(thisArg, _arguments, P, generator) {
20
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
21
37
  return new (P || (P = Promise))(function (resolve, reject) {
22
38
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -24,6 +40,97 @@ function __awaiter$1(thisArg, _arguments, P, generator) {
24
40
  function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
25
41
  step((generator = generator.apply(thisArg, _arguments || [])).next());
26
42
  });
43
+ }
44
+
45
+ function __generator(thisArg, body) {
46
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
47
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48
+ function verb(n) { return function (v) { return step([n, v]); }; }
49
+ function step(op) {
50
+ if (f) throw new TypeError("Generator is already executing.");
51
+ while (_) try {
52
+ 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;
53
+ if (y = 0, t) op = [op[0] & 2, t.value];
54
+ switch (op[0]) {
55
+ case 0: case 1: t = op; break;
56
+ case 4: _.label++; return { value: op[1], done: false };
57
+ case 5: _.label++; y = op[1]; op = [0]; continue;
58
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
59
+ default:
60
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
61
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
62
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
63
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
64
+ if (t[2]) _.ops.pop();
65
+ _.trys.pop(); continue;
66
+ }
67
+ op = body.call(thisArg, _);
68
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
69
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
70
+ }
71
+ }
72
+
73
+ function __values(o) {
74
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
75
+ if (m) return m.call(o);
76
+ if (o && typeof o.length === "number") return {
77
+ next: function () {
78
+ if (o && i >= o.length) o = void 0;
79
+ return { value: o && o[i++], done: !o };
80
+ }
81
+ };
82
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
83
+ }
84
+
85
+ function __read(o, n) {
86
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
87
+ if (!m) return o;
88
+ var i = m.call(o), r, ar = [], e;
89
+ try {
90
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
91
+ }
92
+ catch (error) { e = { error: error }; }
93
+ finally {
94
+ try {
95
+ if (r && !r.done && (m = i["return"])) m.call(i);
96
+ }
97
+ finally { if (e) throw e.error; }
98
+ }
99
+ return ar;
100
+ }
101
+
102
+ function __spreadArray(to, from, pack) {
103
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
104
+ if (ar || !(i in from)) {
105
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
106
+ ar[i] = from[i];
107
+ }
108
+ }
109
+ return to.concat(ar || Array.prototype.slice.call(from));
110
+ }
111
+
112
+ function __await(v) {
113
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
114
+ }
115
+
116
+ function __asyncGenerator(thisArg, _arguments, generator) {
117
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
118
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
119
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
120
+ 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); }); }; }
121
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
122
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
123
+ function fulfill(value) { resume("next", value); }
124
+ function reject(value) { resume("throw", value); }
125
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
126
+ }
127
+
128
+ function __asyncValues(o) {
129
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
130
+ var m = o[Symbol.asyncIterator], i;
131
+ 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);
132
+ 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); }); }; }
133
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
27
134
  }
28
135
 
29
136
  const UNAUTHORIZED_USER = {
@@ -154,134 +261,6 @@ function operate(init) {
154
261
  };
155
262
  }
156
263
 
157
- /*! *****************************************************************************
158
- Copyright (c) Microsoft Corporation.
159
-
160
- Permission to use, copy, modify, and/or distribute this software for any
161
- purpose with or without fee is hereby granted.
162
-
163
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
164
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
165
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
166
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
167
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
168
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
169
- PERFORMANCE OF THIS SOFTWARE.
170
- ***************************************************************************** */
171
- /* global Reflect, Promise */
172
-
173
- var extendStatics = function(d, b) {
174
- extendStatics = Object.setPrototypeOf ||
175
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
176
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
177
- return extendStatics(d, b);
178
- };
179
-
180
- function __extends(d, b) {
181
- if (typeof b !== "function" && b !== null)
182
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
183
- extendStatics(d, b);
184
- function __() { this.constructor = d; }
185
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
186
- }
187
-
188
- function __awaiter(thisArg, _arguments, P, generator) {
189
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
190
- return new (P || (P = Promise))(function (resolve, reject) {
191
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
192
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
193
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
194
- step((generator = generator.apply(thisArg, _arguments || [])).next());
195
- });
196
- }
197
-
198
- function __generator(thisArg, body) {
199
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
200
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
201
- function verb(n) { return function (v) { return step([n, v]); }; }
202
- function step(op) {
203
- if (f) throw new TypeError("Generator is already executing.");
204
- while (_) try {
205
- 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;
206
- if (y = 0, t) op = [op[0] & 2, t.value];
207
- switch (op[0]) {
208
- case 0: case 1: t = op; break;
209
- case 4: _.label++; return { value: op[1], done: false };
210
- case 5: _.label++; y = op[1]; op = [0]; continue;
211
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
212
- default:
213
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
214
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
215
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
216
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
217
- if (t[2]) _.ops.pop();
218
- _.trys.pop(); continue;
219
- }
220
- op = body.call(thisArg, _);
221
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
222
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
223
- }
224
- }
225
-
226
- function __values(o) {
227
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
228
- if (m) return m.call(o);
229
- if (o && typeof o.length === "number") return {
230
- next: function () {
231
- if (o && i >= o.length) o = void 0;
232
- return { value: o && o[i++], done: !o };
233
- }
234
- };
235
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
236
- }
237
-
238
- function __read(o, n) {
239
- var m = typeof Symbol === "function" && o[Symbol.iterator];
240
- if (!m) return o;
241
- var i = m.call(o), r, ar = [], e;
242
- try {
243
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
244
- }
245
- catch (error) { e = { error: error }; }
246
- finally {
247
- try {
248
- if (r && !r.done && (m = i["return"])) m.call(i);
249
- }
250
- finally { if (e) throw e.error; }
251
- }
252
- return ar;
253
- }
254
-
255
- function __spreadArray(to, from) {
256
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
257
- to[j] = from[i];
258
- return to;
259
- }
260
-
261
- function __await(v) {
262
- return this instanceof __await ? (this.v = v, this) : new __await(v);
263
- }
264
-
265
- function __asyncGenerator(thisArg, _arguments, generator) {
266
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
267
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
268
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
269
- 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); }); }; }
270
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
271
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
272
- function fulfill(value) { resume("next", value); }
273
- function reject(value) { resume("throw", value); }
274
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
275
- }
276
-
277
- function __asyncValues(o) {
278
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
279
- var m = o[Symbol.asyncIterator], i;
280
- 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);
281
- 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); }); }; }
282
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
283
- }
284
-
285
264
  var isArrayLike = (function (x) { return x && typeof x.length === 'number' && typeof x !== 'function'; });
286
265
 
287
266
  function isPromise(value) {
@@ -322,7 +301,7 @@ var Subscription = (function () {
322
301
  this.initialTeardown = initialTeardown;
323
302
  this.closed = false;
324
303
  this._parentage = null;
325
- this._teardowns = null;
304
+ this._finalizers = null;
326
305
  }
327
306
  Subscription.prototype.unsubscribe = function () {
328
307
  var e_1, _a, e_2, _b;
@@ -351,23 +330,23 @@ var Subscription = (function () {
351
330
  _parentage.remove(this);
352
331
  }
353
332
  }
354
- var initialTeardown = this.initialTeardown;
355
- if (isFunction(initialTeardown)) {
333
+ var initialFinalizer = this.initialTeardown;
334
+ if (isFunction(initialFinalizer)) {
356
335
  try {
357
- initialTeardown();
336
+ initialFinalizer();
358
337
  }
359
338
  catch (e) {
360
339
  errors = e instanceof UnsubscriptionError ? e.errors : [e];
361
340
  }
362
341
  }
363
- var _teardowns = this._teardowns;
364
- if (_teardowns) {
365
- this._teardowns = null;
342
+ var _finalizers = this._finalizers;
343
+ if (_finalizers) {
344
+ this._finalizers = null;
366
345
  try {
367
- for (var _teardowns_1 = __values(_teardowns), _teardowns_1_1 = _teardowns_1.next(); !_teardowns_1_1.done; _teardowns_1_1 = _teardowns_1.next()) {
368
- var teardown_1 = _teardowns_1_1.value;
346
+ for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
347
+ var finalizer = _finalizers_1_1.value;
369
348
  try {
370
- execTeardown(teardown_1);
349
+ execFinalizer(finalizer);
371
350
  }
372
351
  catch (err) {
373
352
  errors = errors !== null && errors !== void 0 ? errors : [];
@@ -383,7 +362,7 @@ var Subscription = (function () {
383
362
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
384
363
  finally {
385
364
  try {
386
- if (_teardowns_1_1 && !_teardowns_1_1.done && (_b = _teardowns_1.return)) _b.call(_teardowns_1);
365
+ if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
387
366
  }
388
367
  finally { if (e_2) throw e_2.error; }
389
368
  }
@@ -397,7 +376,7 @@ var Subscription = (function () {
397
376
  var _a;
398
377
  if (teardown && teardown !== this) {
399
378
  if (this.closed) {
400
- execTeardown(teardown);
379
+ execFinalizer(teardown);
401
380
  }
402
381
  else {
403
382
  if (teardown instanceof Subscription) {
@@ -406,7 +385,7 @@ var Subscription = (function () {
406
385
  }
407
386
  teardown._addParent(this);
408
387
  }
409
- (this._teardowns = (_a = this._teardowns) !== null && _a !== void 0 ? _a : []).push(teardown);
388
+ (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
410
389
  }
411
390
  }
412
391
  };
@@ -428,8 +407,8 @@ var Subscription = (function () {
428
407
  }
429
408
  };
430
409
  Subscription.prototype.remove = function (teardown) {
431
- var _teardowns = this._teardowns;
432
- _teardowns && arrRemove(_teardowns, teardown);
410
+ var _finalizers = this._finalizers;
411
+ _finalizers && arrRemove(_finalizers, teardown);
433
412
  if (teardown instanceof Subscription) {
434
413
  teardown._removeParent(this);
435
414
  }
@@ -441,16 +420,17 @@ var Subscription = (function () {
441
420
  })();
442
421
  return Subscription;
443
422
  }());
423
+ Subscription.EMPTY;
444
424
  function isSubscription(value) {
445
425
  return (value instanceof Subscription ||
446
426
  (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
447
427
  }
448
- function execTeardown(teardown) {
449
- if (isFunction(teardown)) {
450
- teardown();
428
+ function execFinalizer(finalizer) {
429
+ if (isFunction(finalizer)) {
430
+ finalizer();
451
431
  }
452
432
  else {
453
- teardown.unsubscribe();
433
+ finalizer.unsubscribe();
454
434
  }
455
435
  }
456
436
 
@@ -463,13 +443,16 @@ var config = {
463
443
  };
464
444
 
465
445
  var timeoutProvider = {
466
- setTimeout: function () {
446
+ setTimeout: function (handler, timeout) {
467
447
  var args = [];
468
- for (var _i = 0; _i < arguments.length; _i++) {
469
- args[_i] = arguments[_i];
448
+ for (var _i = 2; _i < arguments.length; _i++) {
449
+ args[_i - 2] = arguments[_i];
470
450
  }
471
451
  var delegate = timeoutProvider.delegate;
472
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) || setTimeout).apply(void 0, __spreadArray([], __read(args)));
452
+ if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
453
+ return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));
454
+ }
455
+ return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
473
456
  },
474
457
  clearTimeout: function (handle) {
475
458
  var delegate = timeoutProvider.delegate;
@@ -480,7 +463,11 @@ var timeoutProvider = {
480
463
 
481
464
  function reportUnhandledError(err) {
482
465
  timeoutProvider.setTimeout(function () {
483
- {
466
+ var onUnhandledError = config.onUnhandledError;
467
+ if (onUnhandledError) {
468
+ onUnhandledError(err);
469
+ }
470
+ else {
484
471
  throw err;
485
472
  }
486
473
  });
@@ -505,14 +492,22 @@ function createNotification(kind, value, error) {
505
492
 
506
493
  var context = null;
507
494
  function errorContext(cb) {
508
- {
495
+ if (config.useDeprecatedSynchronousErrorHandling) {
496
+ var isRoot = !context;
497
+ if (isRoot) {
498
+ context = { errorThrown: false, error: null };
499
+ }
509
500
  cb();
501
+ if (isRoot) {
502
+ var _a = context, errorThrown = _a.errorThrown, error = _a.error;
503
+ context = null;
504
+ if (errorThrown) {
505
+ throw error;
506
+ }
507
+ }
510
508
  }
511
- }
512
- function captureError(err) {
513
- if (config.useDeprecatedSynchronousErrorHandling && context) {
514
- context.errorThrown = true;
515
- context.error = err;
509
+ else {
510
+ cb();
516
511
  }
517
512
  }
518
513
 
@@ -589,55 +584,88 @@ var Subscriber = (function (_super) {
589
584
  };
590
585
  return Subscriber;
591
586
  }(Subscription));
587
+ var _bind = Function.prototype.bind;
588
+ function bind(fn, thisArg) {
589
+ return _bind.call(fn, thisArg);
590
+ }
591
+ var ConsumerObserver = (function () {
592
+ function ConsumerObserver(partialObserver) {
593
+ this.partialObserver = partialObserver;
594
+ }
595
+ ConsumerObserver.prototype.next = function (value) {
596
+ var partialObserver = this.partialObserver;
597
+ if (partialObserver.next) {
598
+ try {
599
+ partialObserver.next(value);
600
+ }
601
+ catch (error) {
602
+ handleUnhandledError(error);
603
+ }
604
+ }
605
+ };
606
+ ConsumerObserver.prototype.error = function (err) {
607
+ var partialObserver = this.partialObserver;
608
+ if (partialObserver.error) {
609
+ try {
610
+ partialObserver.error(err);
611
+ }
612
+ catch (error) {
613
+ handleUnhandledError(error);
614
+ }
615
+ }
616
+ else {
617
+ handleUnhandledError(err);
618
+ }
619
+ };
620
+ ConsumerObserver.prototype.complete = function () {
621
+ var partialObserver = this.partialObserver;
622
+ if (partialObserver.complete) {
623
+ try {
624
+ partialObserver.complete();
625
+ }
626
+ catch (error) {
627
+ handleUnhandledError(error);
628
+ }
629
+ }
630
+ };
631
+ return ConsumerObserver;
632
+ }());
592
633
  var SafeSubscriber = (function (_super) {
593
634
  __extends(SafeSubscriber, _super);
594
635
  function SafeSubscriber(observerOrNext, error, complete) {
595
636
  var _this = _super.call(this) || this;
596
- var next;
597
- if (isFunction(observerOrNext)) {
598
- next = observerOrNext;
637
+ var partialObserver;
638
+ if (isFunction(observerOrNext) || !observerOrNext) {
639
+ partialObserver = {
640
+ next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
641
+ error: error !== null && error !== void 0 ? error : undefined,
642
+ complete: complete !== null && complete !== void 0 ? complete : undefined,
643
+ };
599
644
  }
600
- else if (observerOrNext) {
601
- (next = observerOrNext.next, error = observerOrNext.error, complete = observerOrNext.complete);
645
+ else {
602
646
  var context_1;
603
647
  if (_this && config.useDeprecatedNextContext) {
604
648
  context_1 = Object.create(observerOrNext);
605
649
  context_1.unsubscribe = function () { return _this.unsubscribe(); };
650
+ partialObserver = {
651
+ next: observerOrNext.next && bind(observerOrNext.next, context_1),
652
+ error: observerOrNext.error && bind(observerOrNext.error, context_1),
653
+ complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
654
+ };
606
655
  }
607
656
  else {
608
- context_1 = observerOrNext;
657
+ partialObserver = observerOrNext;
609
658
  }
610
- next = next === null || next === void 0 ? void 0 : next.bind(context_1);
611
- error = error === null || error === void 0 ? void 0 : error.bind(context_1);
612
- complete = complete === null || complete === void 0 ? void 0 : complete.bind(context_1);
613
659
  }
614
- _this.destination = {
615
- next: next ? wrapForErrorHandling(next) : noop,
616
- error: wrapForErrorHandling(error !== null && error !== void 0 ? error : defaultErrorHandler),
617
- complete: complete ? wrapForErrorHandling(complete) : noop,
618
- };
660
+ _this.destination = new ConsumerObserver(partialObserver);
619
661
  return _this;
620
662
  }
621
663
  return SafeSubscriber;
622
664
  }(Subscriber));
623
- function wrapForErrorHandling(handler, instance) {
624
- return function () {
625
- var args = [];
626
- for (var _i = 0; _i < arguments.length; _i++) {
627
- args[_i] = arguments[_i];
628
- }
629
- try {
630
- handler.apply(void 0, __spreadArray([], __read(args)));
631
- }
632
- catch (err) {
633
- if (config.useDeprecatedSynchronousErrorHandling) {
634
- captureError(err);
635
- }
636
- else {
637
- reportUnhandledError(err);
638
- }
639
- }
640
- };
665
+ function handleUnhandledError(error) {
666
+ {
667
+ reportUnhandledError(error);
668
+ }
641
669
  }
642
670
  function defaultErrorHandler(err) {
643
671
  throw err;
@@ -711,16 +739,20 @@ var Observable = (function () {
711
739
  var _this = this;
712
740
  promiseCtor = getPromiseCtor(promiseCtor);
713
741
  return new promiseCtor(function (resolve, reject) {
714
- var subscription;
715
- subscription = _this.subscribe(function (value) {
716
- try {
717
- next(value);
718
- }
719
- catch (err) {
720
- reject(err);
721
- subscription === null || subscription === void 0 ? void 0 : subscription.unsubscribe();
722
- }
723
- }, reject, resolve);
742
+ var subscriber = new SafeSubscriber({
743
+ next: function (value) {
744
+ try {
745
+ next(value);
746
+ }
747
+ catch (err) {
748
+ reject(err);
749
+ subscriber.unsubscribe();
750
+ }
751
+ },
752
+ error: reject,
753
+ complete: resolve,
754
+ });
755
+ _this.subscribe(subscriber);
724
756
  });
725
757
  };
726
758
  Observable.prototype._subscribe = function (subscriber) {
@@ -952,11 +984,15 @@ function process(asyncIterable, subscriber) {
952
984
  });
953
985
  }
954
986
 
987
+ function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
988
+ return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
989
+ }
955
990
  var OperatorSubscriber = (function (_super) {
956
991
  __extends(OperatorSubscriber, _super);
957
- function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
992
+ function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
958
993
  var _this = _super.call(this, destination) || this;
959
994
  _this.onFinalize = onFinalize;
995
+ _this.shouldUnsubscribe = shouldUnsubscribe;
960
996
  _this._next = onNext
961
997
  ? function (value) {
962
998
  try {
@@ -997,9 +1033,11 @@ var OperatorSubscriber = (function (_super) {
997
1033
  }
998
1034
  OperatorSubscriber.prototype.unsubscribe = function () {
999
1035
  var _a;
1000
- var closed = this.closed;
1001
- _super.prototype.unsubscribe.call(this);
1002
- !closed && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
1036
+ if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
1037
+ var closed_1 = this.closed;
1038
+ _super.prototype.unsubscribe.call(this);
1039
+ !closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
1040
+ }
1003
1041
  };
1004
1042
  return OperatorSubscriber;
1005
1043
  }(Subscriber));
@@ -1016,13 +1054,16 @@ var Action = (function (_super) {
1016
1054
  }(Subscription));
1017
1055
 
1018
1056
  var intervalProvider = {
1019
- setInterval: function () {
1057
+ setInterval: function (handler, timeout) {
1020
1058
  var args = [];
1021
- for (var _i = 0; _i < arguments.length; _i++) {
1022
- args[_i] = arguments[_i];
1059
+ for (var _i = 2; _i < arguments.length; _i++) {
1060
+ args[_i - 2] = arguments[_i];
1023
1061
  }
1024
1062
  var delegate = intervalProvider.delegate;
1025
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) || setInterval).apply(void 0, __spreadArray([], __read(args)));
1063
+ if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {
1064
+ return delegate.setInterval.apply(delegate, __spreadArray([handler, timeout], __read(args)));
1065
+ }
1066
+ return setInterval.apply(void 0, __spreadArray([handler, timeout], __read(args)));
1026
1067
  },
1027
1068
  clearInterval: function (handle) {
1028
1069
  var delegate = intervalProvider.delegate;
@@ -1241,7 +1282,7 @@ function catchError(selector) {
1241
1282
  var innerSub = null;
1242
1283
  var syncUnsub = false;
1243
1284
  var handledResult;
1244
- innerSub = source.subscribe(new OperatorSubscriber(subscriber, undefined, undefined, function (err) {
1285
+ innerSub = source.subscribe(createOperatorSubscriber(subscriber, undefined, undefined, function (err) {
1245
1286
  handledResult = innerFrom(selector(err, catchError(selector)(source)));
1246
1287
  if (innerSub) {
1247
1288
  innerSub.unsubscribe();
@@ -1263,7 +1304,7 @@ function catchError(selector) {
1263
1304
  function observeOn(scheduler, delay) {
1264
1305
  if (delay === void 0) { delay = 0; }
1265
1306
  return operate(function (source, subscriber) {
1266
- source.subscribe(new OperatorSubscriber(subscriber, function (value) { return executeSchedule(subscriber, scheduler, function () { return subscriber.next(value); }, delay); }, function () { return executeSchedule(subscriber, scheduler, function () { return subscriber.complete(); }, delay); }, function (err) { return executeSchedule(subscriber, scheduler, function () { return subscriber.error(err); }, delay); }));
1307
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) { return executeSchedule(subscriber, scheduler, function () { return subscriber.next(value); }, delay); }, function () { return executeSchedule(subscriber, scheduler, function () { return subscriber.complete(); }, delay); }, function (err) { return executeSchedule(subscriber, scheduler, function () { return subscriber.error(err); }, delay); }));
1267
1308
  });
1268
1309
  }
1269
1310
 
@@ -1383,13 +1424,13 @@ function from(input, scheduler) {
1383
1424
  function map(project, thisArg) {
1384
1425
  return operate(function (source, subscriber) {
1385
1426
  var index = 0;
1386
- source.subscribe(new OperatorSubscriber(subscriber, function (value) {
1427
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1387
1428
  subscriber.next(project.call(thisArg, value, index++));
1388
1429
  }));
1389
1430
  });
1390
1431
  }
1391
1432
 
1392
- function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalTeardown) {
1433
+ function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {
1393
1434
  var buffer = [];
1394
1435
  var active = 0;
1395
1436
  var index = 0;
@@ -1404,7 +1445,7 @@ function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, e
1404
1445
  expand && subscriber.next(value);
1405
1446
  active++;
1406
1447
  var innerComplete = false;
1407
- innerFrom(project(value, index++)).subscribe(new OperatorSubscriber(subscriber, function (innerValue) {
1448
+ innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, function (innerValue) {
1408
1449
  onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue);
1409
1450
  if (expand) {
1410
1451
  outerNext(innerValue);
@@ -1438,12 +1479,12 @@ function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, e
1438
1479
  }
1439
1480
  }));
1440
1481
  };
1441
- source.subscribe(new OperatorSubscriber(subscriber, outerNext, function () {
1482
+ source.subscribe(createOperatorSubscriber(subscriber, outerNext, function () {
1442
1483
  isComplete = true;
1443
1484
  checkComplete();
1444
1485
  }));
1445
1486
  return function () {
1446
- additionalTeardown === null || additionalTeardown === void 0 ? void 0 : additionalTeardown();
1487
+ additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();
1447
1488
  };
1448
1489
  }
1449
1490
 
@@ -1492,7 +1533,7 @@ function debounceTime(dueTime, scheduler) {
1492
1533
  }
1493
1534
  emit();
1494
1535
  }
1495
- source.subscribe(new OperatorSubscriber(subscriber, function (value) {
1536
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1496
1537
  lastValue = value;
1497
1538
  lastTime = scheduler.now();
1498
1539
  if (!activeTask) {
@@ -1524,7 +1565,7 @@ function take(count) {
1524
1565
  function () { return EMPTY; }
1525
1566
  : operate(function (source, subscriber) {
1526
1567
  var seen = 0;
1527
- source.subscribe(new OperatorSubscriber(subscriber, function (value) {
1568
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1528
1569
  if (++seen <= count) {
1529
1570
  subscriber.next(value);
1530
1571
  if (count <= seen) {
@@ -1537,7 +1578,7 @@ function take(count) {
1537
1578
 
1538
1579
  function ignoreElements() {
1539
1580
  return operate(function (source, subscriber) {
1540
- source.subscribe(new OperatorSubscriber(subscriber, noop));
1581
+ source.subscribe(createOperatorSubscriber(subscriber, noop));
1541
1582
  });
1542
1583
  }
1543
1584
 
@@ -1566,7 +1607,7 @@ function distinctUntilChanged(comparator, keySelector) {
1566
1607
  return operate(function (source, subscriber) {
1567
1608
  var previousKey;
1568
1609
  var first = true;
1569
- source.subscribe(new OperatorSubscriber(subscriber, function (value) {
1610
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1570
1611
  var currentKey = keySelector(value);
1571
1612
  if (first || !comparator(previousKey, currentKey)) {
1572
1613
  first = false;
@@ -1583,7 +1624,7 @@ function defaultCompare(a, b) {
1583
1624
  function filter(predicate, thisArg) {
1584
1625
  return operate(function (source, subscriber) {
1585
1626
  var index = 0;
1586
- source.subscribe(new OperatorSubscriber(subscriber, function (value) { return predicate.call(thisArg, value, index++) && subscriber.next(value); }));
1627
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) { return predicate.call(thisArg, value, index++) && subscriber.next(value); }));
1587
1628
  });
1588
1629
  }
1589
1630
 
@@ -1608,11 +1649,11 @@ function switchMap(project, resultSelector) {
1608
1649
  var index = 0;
1609
1650
  var isComplete = false;
1610
1651
  var checkComplete = function () { return isComplete && !innerSubscriber && subscriber.complete(); };
1611
- source.subscribe(new OperatorSubscriber(subscriber, function (value) {
1652
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1612
1653
  innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();
1613
1654
  var innerIndex = 0;
1614
1655
  var outerIndex = index++;
1615
- innerFrom(project(value, outerIndex)).subscribe((innerSubscriber = new OperatorSubscriber(subscriber, function (innerValue) { return subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue); }, function () {
1656
+ innerFrom(project(value, outerIndex)).subscribe((innerSubscriber = createOperatorSubscriber(subscriber, function (innerValue) { return subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue); }, function () {
1616
1657
  innerSubscriber = null;
1617
1658
  checkComplete();
1618
1659
  })));
@@ -1633,7 +1674,7 @@ function tap(observerOrNext, error, complete) {
1633
1674
  var _a;
1634
1675
  (_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
1635
1676
  var isUnsub = true;
1636
- source.subscribe(new OperatorSubscriber(subscriber, function (value) {
1677
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1637
1678
  var _a;
1638
1679
  (_a = tapObserver.next) === null || _a === void 0 ? void 0 : _a.call(tapObserver, value);
1639
1680
  subscriber.next(value);
@@ -1669,11 +1710,7 @@ var TimeoutError = createErrorClass(function (_super) {
1669
1710
  };
1670
1711
  });
1671
1712
  function timeout(config, schedulerArg) {
1672
- var _a = (isValidDate(config)
1673
- ? { first: config }
1674
- : typeof config === 'number'
1675
- ? { each: config }
1676
- : config), first = _a.first, each = _a.each, _b = _a.with, _with = _b === void 0 ? timeoutErrorFactory : _b, _c = _a.scheduler, scheduler = _c === void 0 ? schedulerArg !== null && schedulerArg !== void 0 ? schedulerArg : asyncScheduler : _c, _d = _a.meta, meta = _d === void 0 ? null : _d;
1713
+ var _a = (isValidDate(config) ? { first: config } : typeof config === 'number' ? { each: config } : config), first = _a.first, each = _a.each, _b = _a.with, _with = _b === void 0 ? timeoutErrorFactory : _b, _c = _a.scheduler, scheduler = _c === void 0 ? schedulerArg !== null && schedulerArg !== void 0 ? schedulerArg : asyncScheduler : _c, _d = _a.meta, meta = _d === void 0 ? null : _d;
1677
1714
  if (first == null && each == null) {
1678
1715
  throw new TypeError('No timeout provided.');
1679
1716
  }
@@ -1697,7 +1734,7 @@ function timeout(config, schedulerArg) {
1697
1734
  }
1698
1735
  }, delay);
1699
1736
  };
1700
- originalSourceSubscription = source.subscribe(new OperatorSubscriber(subscriber, function (value) {
1737
+ originalSourceSubscription = source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1701
1738
  timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.unsubscribe();
1702
1739
  seen++;
1703
1740
  subscriber.next((lastValue = value));
@@ -1708,7 +1745,7 @@ function timeout(config, schedulerArg) {
1708
1745
  }
1709
1746
  lastValue = null;
1710
1747
  }));
1711
- startTimer(first != null ? (typeof first === 'number' ? first : +first - scheduler.now()) : each);
1748
+ !seen && startTimer(first != null ? (typeof first === 'number' ? first : +first - scheduler.now()) : each);
1712
1749
  });
1713
1750
  }
1714
1751
  function timeoutErrorFactory(info) {
@@ -1718,7 +1755,7 @@ function timeoutErrorFactory(info) {
1718
1755
  //const hasSW = 'serviceWorker' in navigator;
1719
1756
  let hasComplainedAboutSyncEvent = false;
1720
1757
  function registerSyncEvent(db, purpose) {
1721
- return __awaiter$1(this, void 0, void 0, function* () {
1758
+ return __awaiter(this, void 0, void 0, function* () {
1722
1759
  try {
1723
1760
  // Send sync event to SW:
1724
1761
  const sw = yield navigator.serviceWorker.ready;
@@ -1749,7 +1786,7 @@ function registerSyncEvent(db, purpose) {
1749
1786
  }
1750
1787
  function registerPeriodicSyncEvent(db) {
1751
1788
  var _a;
1752
- return __awaiter$1(this, void 0, void 0, function* () {
1789
+ return __awaiter(this, void 0, void 0, function* () {
1753
1790
  try {
1754
1791
  // Register periodicSync event to SW:
1755
1792
  // @ts-ignore
@@ -1794,13 +1831,20 @@ const b64decode = typeof Buffer !== "undefined"
1794
1831
  return bytes;
1795
1832
  };
1796
1833
  const b64encode = typeof Buffer !== "undefined"
1797
- ? (b) => ArrayBuffer.isView(b)
1798
- ? Buffer.from(b.buffer, b.byteOffset, b.byteLength).toString("base64")
1799
- : Buffer.from(b).toString("base64")
1800
- : (b) => btoa(String.fromCharCode.apply(null, b));
1834
+ ? (b) => {
1835
+ if (ArrayBuffer.isView(b)) {
1836
+ return Buffer.from(b.buffer, b.byteOffset, b.byteLength).toString("base64");
1837
+ }
1838
+ else {
1839
+ return Buffer.from(b).toString("base64");
1840
+ }
1841
+ }
1842
+ : (b) => {
1843
+ return btoa(String.fromCharCode.apply(null, ArrayBuffer.isView(b) ? b : new Uint8Array(b)));
1844
+ };
1801
1845
 
1802
1846
  function computeRealmSetHash({ realms, inviteRealms, }) {
1803
- return __awaiter$1(this, void 0, void 0, function* () {
1847
+ return __awaiter(this, void 0, void 0, function* () {
1804
1848
  const data = JSON.stringify([
1805
1849
  ...realms.map((realmId) => ({ realmId, accepted: true })),
1806
1850
  ...inviteRealms.map((realmId) => ({ realmId, accepted: false })),
@@ -1837,8 +1881,8 @@ function flatten(a) {
1837
1881
  }
1838
1882
 
1839
1883
  function listClientChanges(mutationTables, db, { since = {}, limit = Infinity } = {}) {
1840
- return __awaiter$1(this, void 0, void 0, function* () {
1841
- const allMutsOnTables = yield Promise.all(mutationTables.map((mutationTable) => __awaiter$1(this, void 0, void 0, function* () {
1884
+ return __awaiter(this, void 0, void 0, function* () {
1885
+ const allMutsOnTables = yield Promise.all(mutationTables.map((mutationTable) => __awaiter(this, void 0, void 0, function* () {
1842
1886
  const tableName = getTableFromMutationTable(mutationTable.name);
1843
1887
  const lastRevision = since[tableName];
1844
1888
  let query = lastRevision
@@ -1896,6 +1940,10 @@ function assert(b) {
1896
1940
  if (!b)
1897
1941
  throw new Error('Assertion Failed');
1898
1942
  }
1943
+ const _hasOwn = {}.hasOwnProperty;
1944
+ function hasOwn(obj, prop) {
1945
+ return _hasOwn.call(obj, prop);
1946
+ }
1899
1947
  function setByKeyPath(obj, keyPath, value) {
1900
1948
  if (!obj || keyPath === undefined)
1901
1949
  return;
@@ -1928,8 +1976,8 @@ function setByKeyPath(obj, keyPath, value) {
1928
1976
  //@ts-ignore: even if currentKeyPath would be numeric string and obj would be array - it works.
1929
1977
  var innerObj = obj[currentKeyPath];
1930
1978
  //@ts-ignore: even if currentKeyPath would be numeric string and obj would be array - it works.
1931
- if (!innerObj)
1932
- innerObj = obj[currentKeyPath] = {};
1979
+ if (!innerObj || !hasOwn(obj, currentKeyPath))
1980
+ innerObj = (obj[currentKeyPath] = {});
1933
1981
  setByKeyPath(innerObj, remainingKeyPath, value);
1934
1982
  }
1935
1983
  }
@@ -1948,7 +1996,7 @@ function setByKeyPath(obj, keyPath, value) {
1948
1996
  }
1949
1997
  }
1950
1998
  }
1951
- const randomString = typeof self === 'undefined' ? (bytes) => {
1999
+ const randomString = typeof Buffer !== 'undefined' ? (bytes) => {
1952
2000
  // Node
1953
2001
  const buf = Buffer.alloc(bytes);
1954
2002
  randomFillSync(buf);
@@ -2187,28 +2235,28 @@ function getDbNameFromDbUrl(dbUrl) {
2187
2235
  }
2188
2236
 
2189
2237
  function listSyncifiedChanges(tablesToSyncify, currentUser, schema, alreadySyncedRealms) {
2190
- return __awaiter$1(this, void 0, void 0, function* () {
2238
+ return __awaiter(this, void 0, void 0, function* () {
2191
2239
  const txid = `upload-${randomString$1(8)}`;
2192
2240
  if (currentUser.isLoggedIn) {
2193
2241
  if (tablesToSyncify.length > 0) {
2194
2242
  const ignoredRealms = new Set(alreadySyncedRealms || []);
2195
- const upserts = yield Promise.all(tablesToSyncify.map((table) => __awaiter$1(this, void 0, void 0, function* () {
2243
+ const upserts = yield Promise.all(tablesToSyncify.map((table) => __awaiter(this, void 0, void 0, function* () {
2196
2244
  const { extractKey } = table.core.schema.primaryKey;
2197
2245
  if (!extractKey)
2198
2246
  return { table: table.name, muts: [] }; // Outbound tables are not synced.
2199
2247
  const dexieCloudTableSchema = schema[table.name];
2200
2248
  const query = (dexieCloudTableSchema === null || dexieCloudTableSchema === void 0 ? void 0 : dexieCloudTableSchema.generatedGlobalId)
2201
2249
  ? table.filter((item) => {
2202
- const id = extractKey(item);
2250
+ extractKey(item);
2203
2251
  return (!ignoredRealms.has(item.realmId || '') &&
2204
2252
  //(id[0] !== '#' || !!item.$ts) && // Private obj need no sync if not changed
2205
- isValidSyncableID(id));
2253
+ isValidAtID(extractKey(item), dexieCloudTableSchema === null || dexieCloudTableSchema === void 0 ? void 0 : dexieCloudTableSchema.idPrefix));
2206
2254
  })
2207
2255
  : table.filter((item) => {
2208
- extractKey(item);
2256
+ const id = extractKey(item);
2209
2257
  return (!ignoredRealms.has(item.realmId || '') &&
2210
2258
  //(id[0] !== '#' || !!item.$ts) && // Private obj need no sync if not changed
2211
- isValidAtID(extractKey(item), dexieCloudTableSchema === null || dexieCloudTableSchema === void 0 ? void 0 : dexieCloudTableSchema.idPrefix));
2259
+ isValidSyncableID(id));
2212
2260
  });
2213
2261
  const unsyncedObjects = yield query.toArray();
2214
2262
  if (unsyncedObjects.length > 0) {
@@ -2246,15 +2294,12 @@ function getTablesToSyncify(db, syncState) {
2246
2294
  }
2247
2295
 
2248
2296
  function interactWithUser(userInteraction, req) {
2249
- let done = false;
2250
2297
  return new Promise((resolve, reject) => {
2251
2298
  const interactionProps = Object.assign(Object.assign({}, req), { onSubmit: (res) => {
2252
2299
  userInteraction.next(undefined);
2253
- done = true;
2254
2300
  resolve(res);
2255
2301
  }, onCancel: () => {
2256
2302
  userInteraction.next(undefined);
2257
- done = true;
2258
2303
  reject(new Dexie.AbortError("User cancelled"));
2259
2304
  } });
2260
2305
  userInteraction.next(interactionProps);
@@ -2278,7 +2323,7 @@ function alertUser(userInteraction, title, ...alerts) {
2278
2323
  });
2279
2324
  }
2280
2325
  function promptForEmail(userInteraction, title, emailHint) {
2281
- return __awaiter$1(this, void 0, void 0, function* () {
2326
+ return __awaiter(this, void 0, void 0, function* () {
2282
2327
  let email = emailHint || '';
2283
2328
  while (!email || !/^[\w-\.]+@([\w-]+\.)+[\w-]{2,10}$/.test(email)) {
2284
2329
  email = (yield interactWithUser(userInteraction, {
@@ -2306,7 +2351,7 @@ function promptForEmail(userInteraction, title, emailHint) {
2306
2351
  });
2307
2352
  }
2308
2353
  function promptForOTP(userInteraction, email, alert) {
2309
- return __awaiter$1(this, void 0, void 0, function* () {
2354
+ return __awaiter(this, void 0, void 0, function* () {
2310
2355
  const alerts = [
2311
2356
  {
2312
2357
  type: 'info',
@@ -2336,7 +2381,7 @@ function promptForOTP(userInteraction, email, alert) {
2336
2381
 
2337
2382
  function loadAccessToken(db) {
2338
2383
  var _a, _b;
2339
- return __awaiter$1(this, void 0, void 0, function* () {
2384
+ return __awaiter(this, void 0, void 0, function* () {
2340
2385
  const currentUser = yield db.getCurrentUser();
2341
2386
  const { accessToken, accessTokenExpiration, refreshToken, refreshTokenExpiration, claims, } = currentUser;
2342
2387
  if (!accessToken)
@@ -2361,7 +2406,7 @@ function loadAccessToken(db) {
2361
2406
  });
2362
2407
  }
2363
2408
  function authenticate(url, context, fetchToken, userInteraction, hints) {
2364
- return __awaiter$1(this, void 0, void 0, function* () {
2409
+ return __awaiter(this, void 0, void 0, function* () {
2365
2410
  if (context.accessToken &&
2366
2411
  context.accessTokenExpiration.getTime() > Date.now()) {
2367
2412
  return context;
@@ -2377,7 +2422,7 @@ function authenticate(url, context, fetchToken, userInteraction, hints) {
2377
2422
  });
2378
2423
  }
2379
2424
  function refreshAccessToken(url, login) {
2380
- return __awaiter$1(this, void 0, void 0, function* () {
2425
+ return __awaiter(this, void 0, void 0, function* () {
2381
2426
  if (!login.refreshToken)
2382
2427
  throw new Error(`Cannot refresh token - refresh token is missing.`);
2383
2428
  if (!login.nonExportablePrivateKey)
@@ -2413,7 +2458,7 @@ function refreshAccessToken(url, login) {
2413
2458
  });
2414
2459
  }
2415
2460
  function userAuthenticate(context, fetchToken, userInteraction, hints) {
2416
- return __awaiter$1(this, void 0, void 0, function* () {
2461
+ return __awaiter(this, void 0, void 0, function* () {
2417
2462
  const { privateKey, publicKey } = yield crypto.subtle.generateKey({
2418
2463
  name: 'RSASSA-PKCS1-v1_5',
2419
2464
  modulusLength: 2048,
@@ -3072,7 +3117,7 @@ function cloneChange(change, rewriteValues) {
3072
3117
 
3073
3118
  //import {BisonWebStreamReader} from "dreambase-library/dist/typeson-simplified/BisonWebStreamReader";
3074
3119
  function syncWithServer(changes, syncState, baseRevs, db, databaseUrl, schema, clientIdentity, currentUser) {
3075
- return __awaiter$1(this, void 0, void 0, function* () {
3120
+ return __awaiter(this, void 0, void 0, function* () {
3076
3121
  //
3077
3122
  // Push changes to server using fetch
3078
3123
  //
@@ -3128,7 +3173,7 @@ function syncWithServer(changes, syncState, baseRevs, db, databaseUrl, schema, c
3128
3173
  }
3129
3174
 
3130
3175
  function modifyLocalObjectsWithNewUserId(syncifiedTables, currentUser, alreadySyncedRealms) {
3131
- return __awaiter$1(this, void 0, void 0, function* () {
3176
+ return __awaiter(this, void 0, void 0, function* () {
3132
3177
  const ignoredRealms = new Set(alreadySyncedRealms || []);
3133
3178
  for (const table of syncifiedTables) {
3134
3179
  if (table.name === "members") {
@@ -3178,7 +3223,7 @@ self.addEventListener('online', () => isOnline = true);
3178
3223
  self.addEventListener('offline', () => isOnline = false);
3179
3224
 
3180
3225
  function updateBaseRevs(db, schema, latestRevisions, serverRev) {
3181
- return __awaiter$1(this, void 0, void 0, function* () {
3226
+ return __awaiter(this, void 0, void 0, function* () {
3182
3227
  yield db.$baseRevs.bulkPut(Object.keys(schema)
3183
3228
  .filter((table) => schema[table].markedForSync)
3184
3229
  .map((tableName) => {
@@ -3201,7 +3246,7 @@ function getLatestRevisionsPerTable(clientChangeSet, lastRevisions = {}) {
3201
3246
  }
3202
3247
 
3203
3248
  function bulkUpdate(table, keys, changeSpecs) {
3204
- return __awaiter$1(this, void 0, void 0, function* () {
3249
+ return __awaiter(this, void 0, void 0, function* () {
3205
3250
  const objs = yield table.bulkGet(keys);
3206
3251
  const resultKeys = [];
3207
3252
  const resultObjs = [];
@@ -3229,7 +3274,7 @@ function bulkUpdate(table, keys, changeSpecs) {
3229
3274
  }
3230
3275
 
3231
3276
  function applyServerChanges(changes, db) {
3232
- return __awaiter$1(this, void 0, void 0, function* () {
3277
+ return __awaiter(this, void 0, void 0, function* () {
3233
3278
  console.debug('Applying server changes', changes, Dexie.currentTransaction);
3234
3279
  for (const { table: tableName, muts } of changes) {
3235
3280
  const table = db.table(tableName);
@@ -3315,7 +3360,7 @@ function sync(db, options, schema, syncOptions) {
3315
3360
  });
3316
3361
  }
3317
3362
  })
3318
- .catch((error) => __awaiter$1(this, void 0, void 0, function* () {
3363
+ .catch((error) => __awaiter(this, void 0, void 0, function* () {
3319
3364
  if (syncOptions === null || syncOptions === void 0 ? void 0 : syncOptions.justCheckIfNeeded)
3320
3365
  return Promise.reject(error); // Just rethrow.
3321
3366
  console.debug('Error from _sync', {
@@ -3352,7 +3397,7 @@ function _sync(db, options, schema, { isInitialSync, cancelToken, justCheckIfNee
3352
3397
  isInitialSync: false,
3353
3398
  }) {
3354
3399
  var _a;
3355
- return __awaiter$1(this, void 0, void 0, function* () {
3400
+ return __awaiter(this, void 0, void 0, function* () {
3356
3401
  if (!justCheckIfNeeded) {
3357
3402
  console.debug('SYNC STARTED', { isInitialSync, purpose });
3358
3403
  }
@@ -3369,7 +3414,8 @@ function _sync(db, options, schema, { isInitialSync, cancelToken, justCheckIfNee
3369
3414
  // Prepare for syncification by modifying locally unauthorized objects:
3370
3415
  //
3371
3416
  const persistedSyncState = yield db.getPersistedSyncState();
3372
- const tablesToSyncify = !isInitialSync && currentUser.isLoggedIn
3417
+ const readyForSyncification = !isInitialSync && currentUser.isLoggedIn;
3418
+ const tablesToSyncify = readyForSyncification
3373
3419
  ? getTablesToSyncify(db, persistedSyncState)
3374
3420
  : [];
3375
3421
  throwIfCancelled(cancelToken);
@@ -3378,7 +3424,7 @@ function _sync(db, options, schema, { isInitialSync, cancelToken, justCheckIfNee
3378
3424
  if (justCheckIfNeeded)
3379
3425
  return true;
3380
3426
  //console.debug('sync doSyncify is true');
3381
- yield db.transaction('rw', tablesToSyncify, (tx) => __awaiter$1(this, void 0, void 0, function* () {
3427
+ yield db.transaction('rw', tablesToSyncify, (tx) => __awaiter(this, void 0, void 0, function* () {
3382
3428
  // @ts-ignore
3383
3429
  tx.idbtrans.disableChangeTracking = true;
3384
3430
  // @ts-ignore
@@ -3390,7 +3436,7 @@ function _sync(db, options, schema, { isInitialSync, cancelToken, justCheckIfNee
3390
3436
  //
3391
3437
  // List changes to sync
3392
3438
  //
3393
- const [clientChangeSet, syncState, baseRevs] = yield db.transaction('r', db.tables, () => __awaiter$1(this, void 0, void 0, function* () {
3439
+ const [clientChangeSet, syncState, baseRevs] = yield db.transaction('r', db.tables, () => __awaiter(this, void 0, void 0, function* () {
3394
3440
  const syncState = yield db.getPersistedSyncState();
3395
3441
  const baseRevs = yield db.$baseRevs.toArray();
3396
3442
  let clientChanges = yield listClientChanges(mutationTables);
@@ -3427,7 +3473,7 @@ function _sync(db, options, schema, { isInitialSync, cancelToken, justCheckIfNee
3427
3473
  //
3428
3474
  // Apply changes locally and clear old change entries:
3429
3475
  //
3430
- const done = yield db.transaction('rw', db.tables, (tx) => __awaiter$1(this, void 0, void 0, function* () {
3476
+ const done = yield db.transaction('rw', db.tables, (tx) => __awaiter(this, void 0, void 0, function* () {
3431
3477
  // @ts-ignore
3432
3478
  tx.idbtrans.disableChangeTracking = true;
3433
3479
  // @ts-ignore
@@ -3501,9 +3547,11 @@ function _sync(db, options, schema, { isInitialSync, cancelToken, justCheckIfNee
3501
3547
  inviteRealms: [],
3502
3548
  clientIdentity,
3503
3549
  };
3504
- newSyncState.syncedTables = tablesToSync
3505
- .map((tbl) => tbl.name)
3506
- .concat(tablesToSyncify.map((tbl) => tbl.name));
3550
+ if (readyForSyncification) {
3551
+ newSyncState.syncedTables = tablesToSync
3552
+ .map((tbl) => tbl.name)
3553
+ .concat(tablesToSyncify.map((tbl) => tbl.name));
3554
+ }
3507
3555
  newSyncState.latestRevisions = latestRevisions;
3508
3556
  newSyncState.remoteDbId = res.dbId;
3509
3557
  newSyncState.initiallySynced = true;
@@ -3532,7 +3580,7 @@ function _sync(db, options, schema, { isInitialSync, cancelToken, justCheckIfNee
3532
3580
  });
3533
3581
  }
3534
3582
  function deleteObjectsFromRemovedRealms(db, res, prevState) {
3535
- return __awaiter$1(this, void 0, void 0, function* () {
3583
+ return __awaiter(this, void 0, void 0, function* () {
3536
3584
  const deletedRealms = new Set();
3537
3585
  const rejectedRealms = new Set();
3538
3586
  const previousRealmSet = prevState ? prevState.realms : [];
@@ -3596,7 +3644,7 @@ function MessagesFromServerConsumer(db) {
3596
3644
  let isWorking = false;
3597
3645
  let loopWarning = 0;
3598
3646
  let loopDetection = [0, 0, 0, 0, 0, 0, 0, 0, 0, Date.now()];
3599
- event.subscribe(() => __awaiter$1(this, void 0, void 0, function* () {
3647
+ event.subscribe(() => __awaiter(this, void 0, void 0, function* () {
3600
3648
  if (isWorking)
3601
3649
  return;
3602
3650
  if (queue.length > 0) {
@@ -3635,7 +3683,7 @@ function MessagesFromServerConsumer(db) {
3635
3683
  }
3636
3684
  function consumeQueue() {
3637
3685
  var _a, _b, _c;
3638
- return __awaiter$1(this, void 0, void 0, function* () {
3686
+ return __awaiter(this, void 0, void 0, function* () {
3639
3687
  while (queue.length > 0) {
3640
3688
  const msg = queue.shift();
3641
3689
  try {
@@ -3692,7 +3740,7 @@ function MessagesFromServerConsumer(db) {
3692
3740
  triggerSync(db, 'pull');
3693
3741
  break;
3694
3742
  }
3695
- yield db.transaction('rw', db.dx.tables, (tx) => __awaiter$1(this, void 0, void 0, function* () {
3743
+ yield db.transaction('rw', db.dx.tables, (tx) => __awaiter(this, void 0, void 0, function* () {
3696
3744
  // @ts-ignore
3697
3745
  tx.idbtrans.disableChangeTracking = true;
3698
3746
  // @ts-ignore
@@ -3901,7 +3949,7 @@ class AuthPersistedContext {
3901
3949
  }));
3902
3950
  }
3903
3951
  save() {
3904
- return __awaiter$1(this, void 0, void 0, function* () {
3952
+ return __awaiter(this, void 0, void 0, function* () {
3905
3953
  const db = wm.get(this);
3906
3954
  db.table("$logins").put(this);
3907
3955
  });
@@ -3912,7 +3960,7 @@ function otpFetchTokenCallback(db) {
3912
3960
  const { userInteraction } = db.cloud;
3913
3961
  return function otpAuthenticate({ public_key, hints }) {
3914
3962
  var _a;
3915
- return __awaiter$1(this, void 0, void 0, function* () {
3963
+ return __awaiter(this, void 0, void 0, function* () {
3916
3964
  let tokenRequest;
3917
3965
  const url = (_a = db.cloud.options) === null || _a === void 0 ? void 0 : _a.databaseUrl;
3918
3966
  if (!url)
@@ -4014,11 +4062,11 @@ function otpFetchTokenCallback(db) {
4014
4062
  * @param newUser
4015
4063
  */
4016
4064
  function setCurrentUser(db, user) {
4017
- return __awaiter$1(this, void 0, void 0, function* () {
4065
+ return __awaiter(this, void 0, void 0, function* () {
4018
4066
  if (user.userId === db.cloud.currentUserId)
4019
4067
  return; // Already this user.
4020
4068
  const $logins = db.table('$logins');
4021
- yield db.transaction('rw', $logins, (tx) => __awaiter$1(this, void 0, void 0, function* () {
4069
+ yield db.transaction('rw', $logins, (tx) => __awaiter(this, void 0, void 0, function* () {
4022
4070
  const existingLogins = yield $logins.toArray();
4023
4071
  yield Promise.all(existingLogins
4024
4072
  .filter((login) => login.userId !== user.userId && login.isLoggedIn)
@@ -4069,7 +4117,7 @@ function setCurrentUser(db, user) {
4069
4117
  }
4070
4118
 
4071
4119
  function login(db, hints) {
4072
- return __awaiter$1(this, void 0, void 0, function* () {
4120
+ return __awaiter(this, void 0, void 0, function* () {
4073
4121
  const currentUser = yield db.getCurrentUser();
4074
4122
  if (currentUser.isLoggedIn) {
4075
4123
  if (hints) {
@@ -4668,7 +4716,7 @@ function overrideParseStoresSpec(origFunc, dexie) {
4668
4716
  }
4669
4717
 
4670
4718
  function performInitialSync(db, cloudOptions, cloudSchema) {
4671
- return __awaiter$1(this, void 0, void 0, function* () {
4719
+ return __awaiter(this, void 0, void 0, function* () {
4672
4720
  console.debug('Performing initial sync');
4673
4721
  yield sync(db, cloudOptions, cloudSchema, { isInitialSync: true });
4674
4722
  console.debug('Done initial sync');
@@ -4811,7 +4859,7 @@ class WSConnection extends Subscription$1 {
4811
4859
  .then(() => (this.reconnecting = false)); // finally()
4812
4860
  }
4813
4861
  connect() {
4814
- return __awaiter$1(this, void 0, void 0, function* () {
4862
+ return __awaiter(this, void 0, void 0, function* () {
4815
4863
  this.lastServerActivity = new Date();
4816
4864
  if (this.pauseUntil && this.pauseUntil > new Date()) {
4817
4865
  console.debug('WS not reconnecting just yet', {
@@ -4834,7 +4882,7 @@ class WSConnection extends Subscription$1 {
4834
4882
  return;
4835
4883
  }
4836
4884
  this.webSocketStatus.next('connecting');
4837
- this.pinger = setInterval(() => __awaiter$1(this, void 0, void 0, function* () {
4885
+ this.pinger = setInterval(() => __awaiter(this, void 0, void 0, function* () {
4838
4886
  if (this.closed) {
4839
4887
  console.debug('pinger check', this.id, 'CLOSED.');
4840
4888
  this.teardown();
@@ -4960,7 +5008,7 @@ function sleep$1(ms) {
4960
5008
  return new Promise((resolve) => setTimeout(resolve, ms));
4961
5009
  }
4962
5010
  function waitAndReconnectWhenUserDoesSomething(error) {
4963
- return __awaiter$1(this, void 0, void 0, function* () {
5011
+ return __awaiter(this, void 0, void 0, function* () {
4964
5012
  console.error(`WebSocket observable: error but revive when user does some active thing...`, error);
4965
5013
  // Sleep some seconds...
4966
5014
  yield sleep$1(3000);
@@ -4986,7 +5034,7 @@ function connectWebSocket(db) {
4986
5034
  function createObservable() {
4987
5035
  return db.cloud.persistedSyncState.pipe(filter((syncState) => syncState === null || syncState === void 0 ? void 0 : syncState.serverRevision), // Don't connect before there's no initial sync performed.
4988
5036
  take(1), // Don't continue waking up whenever syncState change
4989
- switchMap((syncState) => db.cloud.currentUser.pipe(map((userLogin) => [userLogin, syncState]))), switchMap(([userLogin, syncState]) => userIsReallyActive.pipe(map((isActive) => [isActive ? userLogin : null, syncState]))), switchMap(([userLogin, syncState]) => __awaiter$1(this, void 0, void 0, function* () { return [userLogin, yield computeRealmSetHash(syncState)]; })), switchMap(([userLogin, realmSetHash]) =>
5037
+ switchMap((syncState) => db.cloud.currentUser.pipe(map((userLogin) => [userLogin, syncState]))), switchMap(([userLogin, syncState]) => userIsReallyActive.pipe(map((isActive) => [isActive ? userLogin : null, syncState]))), switchMap(([userLogin, syncState]) => __awaiter(this, void 0, void 0, function* () { return [userLogin, yield computeRealmSetHash(syncState)]; })), switchMap(([userLogin, realmSetHash]) =>
4990
5038
  // Let server end query changes from last entry of same client-ID and forward.
4991
5039
  // If no new entries, server won't bother the client. If new entries, server sends only those
4992
5040
  // and the baseRev of the last from same client-ID.
@@ -4995,7 +5043,7 @@ function connectWebSocket(db) {
4995
5043
  : from$1([])), catchError((error) => {
4996
5044
  if ((error === null || error === void 0 ? void 0 : error.name) === 'TokenExpiredError') {
4997
5045
  console.debug('WebSocket observable: Token expired. Refreshing token...');
4998
- return of(true).pipe(switchMap(() => __awaiter$1(this, void 0, void 0, function* () {
5046
+ return of(true).pipe(switchMap(() => __awaiter(this, void 0, void 0, function* () {
4999
5047
  // Refresh access token
5000
5048
  const user = yield db.getCurrentUser();
5001
5049
  const refreshedLogin = yield refreshAccessToken(db.cloud.options.databaseUrl, user);
@@ -5028,7 +5076,7 @@ function connectWebSocket(db) {
5028
5076
 
5029
5077
  function isSyncNeeded(db) {
5030
5078
  var _a;
5031
- return __awaiter$1(this, void 0, void 0, function* () {
5079
+ return __awaiter(this, void 0, void 0, function* () {
5032
5080
  return ((_a = db.cloud.options) === null || _a === void 0 ? void 0 : _a.databaseUrl) && db.cloud.schema
5033
5081
  ? yield sync(db, db.cloud.options, db.cloud.schema, { justCheckIfNeeded: true })
5034
5082
  : false;
@@ -5043,15 +5091,15 @@ const myId = randomString$1(16);
5043
5091
  const GUARDED_JOB_HEARTBEAT = 1 * SECONDS;
5044
5092
  const GUARDED_JOB_TIMEOUT = 1 * MINUTES;
5045
5093
  function performGuardedJob(db, jobName, jobsTableName, job, { awaitRemoteJob } = {}) {
5046
- return __awaiter$1(this, void 0, void 0, function* () {
5094
+ return __awaiter(this, void 0, void 0, function* () {
5047
5095
  // Start working.
5048
5096
  //
5049
5097
  // Check if someone else is working on this already.
5050
5098
  //
5051
5099
  const jobsTable = db.table(jobsTableName);
5052
5100
  function aquireLock() {
5053
- return __awaiter$1(this, void 0, void 0, function* () {
5054
- const gotTheLock = yield db.transaction('rw!', jobsTableName, () => __awaiter$1(this, void 0, void 0, function* () {
5101
+ return __awaiter(this, void 0, void 0, function* () {
5102
+ const gotTheLock = yield db.transaction('rw!', jobsTableName, () => __awaiter(this, void 0, void 0, function* () {
5055
5103
  const currentWork = yield jobsTable.get(jobName);
5056
5104
  if (!currentWork) {
5057
5105
  // No one else is working. Let's record that we are.
@@ -5117,7 +5165,7 @@ function performGuardedJob(db, jobName, jobsTableName, job, { awaitRemoteJob } =
5117
5165
  // Stop heartbeat
5118
5166
  clearInterval(heartbeat);
5119
5167
  // Remove the persisted job state:
5120
- yield db.transaction('rw!', jobsTableName, () => __awaiter$1(this, void 0, void 0, function* () {
5168
+ yield db.transaction('rw!', jobsTableName, () => __awaiter(this, void 0, void 0, function* () {
5121
5169
  const currentWork = yield jobsTable.get(jobName);
5122
5170
  if (currentWork && currentWork.nodeId === myId) {
5123
5171
  yield jobsTable.delete(jobName);
@@ -5177,7 +5225,7 @@ function syncIfPossible(db, cloudOptions, cloudSchema, options) {
5177
5225
  ongoingSyncs.set(db, { promise, pull: (options === null || options === void 0 ? void 0 : options.purpose) !== 'push' });
5178
5226
  return promise;
5179
5227
  function _syncIfPossible() {
5180
- return __awaiter$1(this, void 0, void 0, function* () {
5228
+ return __awaiter(this, void 0, void 0, function* () {
5181
5229
  try {
5182
5230
  if (db.cloud.isServiceWorkerDB) {
5183
5231
  // We are the dedicated sync SW:
@@ -5289,7 +5337,7 @@ function verifySchema(db) {
5289
5337
  }
5290
5338
  }
5291
5339
 
5292
- var n,u$1,i$1,t$1,r$1={},f$1=[],e$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function c$1(n,l){for(var u in l)n[u]=l[u];return n}function s$1(n){var l=n.parentNode;l&&l.removeChild(n);}function a$1(n,l,u){var i,t,o,r=arguments,f={};for(o in l)"key"==o?i=l[o]:"ref"==o?t=l[o]:f[o]=l[o];if(arguments.length>3)for(u=[u],o=3;o<arguments.length;o++)u.push(r[o]);if(null!=u&&(f.children=u),"function"==typeof n&&null!=n.defaultProps)for(o in n.defaultProps)void 0===f[o]&&(f[o]=n.defaultProps[o]);return v$1(n,f,i,t,null)}function v$1(l,u,i,t,o){var r={type:l,props:u,key:i,ref:t,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++n.__v:o};return null!=n.vnode&&n.vnode(r),r}function y(n){return n.children}function p$1(n,l){this.props=n,this.context=l;}function d$1(n,l){if(null==l)return n.__?d$1(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?d$1(n):null}function _(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return _(n)}}function k$1(l){(!l.__d&&(l.__d=!0)&&u$1.push(l)&&!b$1.__r++||t$1!==n.debounceRendering)&&((t$1=n.debounceRendering)||i$1)(b$1);}function b$1(){for(var n;b$1.__r=u$1.length;)n=u$1.sort(function(n,l){return n.__v.__b-l.__v.__b}),u$1=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=c$1({},t)).__v=t.__v+1,I(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?d$1(t):o,t.__h),T(u,t),t.__e!=o&&_(t)));});}function m$1(n,l,u,i,t,o,e,c,s,a){var h,p,_,k,b,m,w,A=i&&i.__k||f$1,P=A.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(k=u.__k[h]=null==(k=l[h])||"boolean"==typeof k?null:"string"==typeof k||"number"==typeof k||"bigint"==typeof k?v$1(null,k,null,null,k):Array.isArray(k)?v$1(y,{children:k},null,null,null):k.__b>0?v$1(k.type,k.props,k.key,null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(_=A[h])||_&&k.key==_.key&&k.type===_.type)A[h]=void 0;else for(p=0;p<P;p++){if((_=A[p])&&k.key==_.key&&k.type===_.type){A[p]=void 0;break}_=null;}I(n,k,_=_||r$1,t,o,e,c,s,a),b=k.__e,(p=k.ref)&&_.ref!=p&&(w||(w=[]),_.ref&&w.push(_.ref,null,k),w.push(p,k.__c||b,k)),null!=b?(null==m&&(m=b),"function"==typeof k.type&&null!=k.__k&&k.__k===_.__k?k.__d=s=g$1(k,s,n):s=x$1(n,k,_,A,b,s),a||"option"!==u.type?"function"==typeof u.type&&(u.__d=s):n.value=""):s&&_.__e==s&&s.parentNode!=n&&(s=d$1(_));}for(u.__e=m,h=P;h--;)null!=A[h]&&("function"==typeof u.type&&null!=A[h].__e&&A[h].__e==u.__d&&(u.__d=d$1(i,h+1)),L(A[h],A[h]));if(w)for(h=0;h<w.length;h++)z(w[h],w[++h],w[++h]);}function g$1(n,l,u){var i,t;for(i=0;i<n.__k.length;i++)(t=n.__k[i])&&(t.__=n,l="function"==typeof t.type?g$1(t,l,u):x$1(u,t,t,n.__k,t.__e,l));return l}function x$1(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else {for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=2)if(f==t)break n;n.insertBefore(t,o),r=o;}return void 0!==r?r:t.nextSibling}function A(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||C(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||C(n,o,l[o],u[o],i);}function P(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||e$1.test(l)?u:u+"px";}function C(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||P(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||P(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?H:$,o):n.removeEventListener(l,o?H:$,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null!=u&&(!1!==u||"a"===l[0]&&"r"===l[1])?n.setAttribute(l,u):n.removeAttribute(l));}}function $(l){this.l[l.type+!1](n.event?n.event(l):l);}function H(l){this.l[l.type+!0](n.event?n.event(l):l);}function I(l,u,i,t,o,r,f,e,s){var a,v,h,d,_,k,b,g,w,x,A,P=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(s=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=n.__b)&&a(u);try{n:if("function"==typeof P){if(g=u.props,w=(a=P.contextType)&&t[a.__c],x=a?w?w.props.value:a.__:t,i.__c?b=(v=u.__c=i.__c).__=v.__E:("prototype"in P&&P.prototype.render?u.__c=v=new P(g,x):(u.__c=v=new p$1(g,x),v.constructor=P,v.render=M),w&&w.sub(v),v.props=g,v.state||(v.state={}),v.context=x,v.__n=t,h=v.__d=!0,v.__h=[]),null==v.__s&&(v.__s=v.state),null!=P.getDerivedStateFromProps&&(v.__s==v.state&&(v.__s=c$1({},v.__s)),c$1(v.__s,P.getDerivedStateFromProps(g,v.__s))),d=v.props,_=v.state,h)null==P.getDerivedStateFromProps&&null!=v.componentWillMount&&v.componentWillMount(),null!=v.componentDidMount&&v.__h.push(v.componentDidMount);else {if(null==P.getDerivedStateFromProps&&g!==d&&null!=v.componentWillReceiveProps&&v.componentWillReceiveProps(g,x),!v.__e&&null!=v.shouldComponentUpdate&&!1===v.shouldComponentUpdate(g,v.__s,x)||u.__v===i.__v){v.props=g,v.state=v.__s,u.__v!==i.__v&&(v.__d=!1),v.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),v.__h.length&&f.push(v);break n}null!=v.componentWillUpdate&&v.componentWillUpdate(g,v.__s,x),null!=v.componentDidUpdate&&v.__h.push(function(){v.componentDidUpdate(d,_,k);});}v.context=x,v.props=g,v.state=v.__s,(a=n.__r)&&a(u),v.__d=!1,v.__v=u,v.__P=l,a=v.render(v.props,v.state,v.context),v.state=v.__s,null!=v.getChildContext&&(t=c$1(c$1({},t),v.getChildContext())),h||null==v.getSnapshotBeforeUpdate||(k=v.getSnapshotBeforeUpdate(d,_)),A=null!=a&&a.type===y&&null==a.key?a.props.children:a,m$1(l,Array.isArray(A)?A:[A],u,i,t,o,r,f,e,s),v.base=u.__e,u.__h=null,v.__h.length&&f.push(v),b&&(v.__E=v.__=null),v.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=j$1(i.__e,u,i,t,o,r,f,s);(a=n.diffed)&&a(u);}catch(l){u.__v=null,(s||null!=r)&&(u.__e=e,u.__h=!!s,r[r.indexOf(e)]=null),n.__e(l,u,i);}}function T(l,u){n.__c&&n.__c(u,l),l.some(function(u){try{l=u.__h,u.__h=[],l.some(function(n){n.call(u);});}catch(l){n.__e(l,u.__v);}});}function j$1(n,l,u,i,t,o,e,c){var a,v,h,y,p=u.props,d=l.props,_=l.type,k=0;if("svg"===_&&(t=!0),null!=o)for(;k<o.length;k++)if((a=o[k])&&(a===n||(_?a.localName==_:3==a.nodeType))){n=a,o[k]=null;break}if(null==n){if(null===_)return document.createTextNode(d);n=t?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,d.is&&d),o=null,c=!1;}if(null===_)p===d||c&&n.data===d||(n.data=d);else {if(o=o&&f$1.slice.call(n.childNodes),v=(p=u.props||r$1).dangerouslySetInnerHTML,h=d.dangerouslySetInnerHTML,!c){if(null!=o)for(p={},y=0;y<n.attributes.length;y++)p[n.attributes[y].name]=n.attributes[y].value;(h||v)&&(h&&(v&&h.__html==v.__html||h.__html===n.innerHTML)||(n.innerHTML=h&&h.__html||""));}if(A(n,d,p,t,c),h)l.__k=[];else if(k=l.props.children,m$1(n,Array.isArray(k)?k:[k],l,u,i,t&&"foreignObject"!==_,o,e,n.firstChild,c),null!=o)for(k=o.length;k--;)null!=o[k]&&s$1(o[k]);c||("value"in d&&void 0!==(k=d.value)&&(k!==n.value||"progress"===_&&!k)&&C(n,"value",k,p.value,!1),"checked"in d&&void 0!==(k=d.checked)&&k!==n.checked&&C(n,"checked",k,p.checked,!1));}return n}function z(l,u,i){try{"function"==typeof l?l(u):l.current=u;}catch(l){n.__e(l,i);}}function L(l,u,i){var t,o,r;if(n.unmount&&n.unmount(l),(t=l.ref)&&(t.current&&t.current!==l.__e||z(t,null,u)),i||"function"==typeof l.type||(i=null!=(o=l.__e)),l.__e=l.__d=void 0,null!=(t=l.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(l){n.__e(l,u);}t.base=t.__P=null;}if(t=l.__k)for(r=0;r<t.length;r++)t[r]&&L(t[r],u,i);null!=o&&s$1(o);}function M(n,l,u){return this.constructor(n,u)}function N(l,u,i){var t,o,e;n.__&&n.__(l,u),o=(t="function"==typeof i)?null:i&&i.__k||u.__k,e=[],I(u,l=(!t&&i||u).__k=a$1(y,null,[l]),o||r$1,r$1,void 0!==u.ownerSVGElement,!t&&i?[i]:o?null:u.firstChild?f$1.slice.call(u.childNodes):null,e,!t&&i?i:o?o.__e:u.firstChild,t),T(e,l);}n={__e:function(n,l){for(var u,i,t;l=l.__;)if((u=l.__c)&&!u.__)try{if((i=u.constructor)&&null!=i.getDerivedStateFromError&&(u.setState(i.getDerivedStateFromError(n)),t=u.__d),null!=u.componentDidCatch&&(u.componentDidCatch(n),t=u.__d),t)return u.__E=u}catch(l){n=l;}throw n},__v:0},p$1.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=c$1({},this.state),"function"==typeof n&&(n=n(c$1({},u),this.props)),n&&c$1(u,n),null!=n&&this.__v&&(l&&this.__h.push(l),k$1(this));},p$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),k$1(this));},p$1.prototype.render=y,u$1=[],i$1="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,b$1.__r=0;
5340
+ var n,l$1,u$1,t$1,o$1,f$1={},e$1=[],c$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s$1(n,l){for(var u in l)n[u]=l[u];return n}function a$1(n){var l=n.parentNode;l&&l.removeChild(n);}function h(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return v$1(l,f,t,o,null)}function v$1(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$1:r};return null==r&&null!=l$1.vnode&&l$1.vnode(f),f}function p$1(n){return n.children}function d$1(n,l){this.props=n,this.context=l;}function _$1(n,l){if(null==l)return n.__?_$1(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?_$1(n):null}function k$1(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k$1(n)}}function b$1(n){(!n.__d&&(n.__d=!0)&&t$1.push(n)&&!g$1.__r++||o$1!==l$1.debounceRendering)&&((o$1=l$1.debounceRendering)||setTimeout)(g$1);}function g$1(){for(var n;g$1.__r=t$1.length;)n=t$1.sort(function(n,l){return n.__v.__b-l.__v.__b}),t$1=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=s$1({},t)).__v=t.__v+1,j$1(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?_$1(t):o,t.__h),z$1(u,t),t.__e!=o&&k$1(t)));});}function w$1(n,l,u,i,t,o,r,c,s,a){var h,y,d,k,b,g,w,x=i&&i.__k||e$1,C=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(k=u.__k[h]=null==(k=l[h])||"boolean"==typeof k?null:"string"==typeof k||"number"==typeof k||"bigint"==typeof k?v$1(null,k,null,null,k):Array.isArray(k)?v$1(p$1,{children:k},null,null,null):k.__b>0?v$1(k.type,k.props,k.key,null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(d=x[h])||d&&k.key==d.key&&k.type===d.type)x[h]=void 0;else for(y=0;y<C;y++){if((d=x[y])&&k.key==d.key&&k.type===d.type){x[y]=void 0;break}d=null;}j$1(n,k,d=d||f$1,t,o,r,c,s,a),b=k.__e,(y=k.ref)&&d.ref!=y&&(w||(w=[]),d.ref&&w.push(d.ref,null,k),w.push(y,k.__c||b,k)),null!=b?(null==g&&(g=b),"function"==typeof k.type&&k.__k===d.__k?k.__d=s=m$1(k,s,n):s=A(n,k,d,x,b,s),"function"==typeof u.type&&(u.__d=s)):s&&d.__e==s&&s.parentNode!=n&&(s=_$1(d));}for(u.__e=g,h=C;h--;)null!=x[h]&&("function"==typeof u.type&&null!=x[h].__e&&x[h].__e==u.__d&&(u.__d=_$1(i,h+1)),N(x[h],x[h]));if(w)for(h=0;h<w.length;h++)M(w[h],w[++h],w[++h]);}function m$1(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?m$1(i,l,u):A(u,i,i,t,i.__e,l));return l}function A(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else {for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=2)if(f==t)break n;n.insertBefore(t,o),r=o;}return void 0!==r?r:t.nextSibling}function C(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||H(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||H(n,o,l[o],u[o],i);}function $(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||c$1.test(l)?u:u+"px";}function H(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T:I,o):n.removeEventListener(l,o?T:I,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null!=u&&(!1!==u||"a"===l[0]&&"r"===l[1])?n.setAttribute(l,u):n.removeAttribute(l));}}function I(n){this.l[n.type+!1](l$1.event?l$1.event(n):n);}function T(n){this.l[n.type+!0](l$1.event?l$1.event(n):n);}function j$1(n,u,i,t,o,r,f,e,c){var a,h,v,y,_,k,b,g,m,x,A,C,$,H=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=l$1.__b)&&a(u);try{n:if("function"==typeof H){if(g=u.props,m=(a=H.contextType)&&t[a.__c],x=a?m?m.props.value:a.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in H&&H.prototype.render?u.__c=h=new H(g,x):(u.__c=h=new d$1(g,x),h.constructor=H,h.render=O),m&&m.sub(h),h.props=g,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[]),null==h.__s&&(h.__s=h.state),null!=H.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=s$1({},h.__s)),s$1(h.__s,H.getDerivedStateFromProps(g,h.__s))),y=h.props,_=h.state,v)null==H.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(null==H.getDerivedStateFromProps&&g!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(g,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(g,h.__s,x)||u.__v===i.__v){h.props=g,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(g,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,_,k);});}if(h.context=x,h.props=g,h.__v=u,h.__P=n,A=l$1.__r,C=0,"prototype"in H&&H.prototype.render)h.state=h.__s,h.__d=!1,A&&A(u),a=h.render(h.props,h.state,h.context);else do{h.__d=!1,A&&A(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++C<25);h.state=h.__s,null!=h.getChildContext&&(t=s$1(s$1({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,_)),$=null!=a&&a.type===p$1&&null==a.key?a.props.children:a,w$1(n,Array.isArray($)?$:[$],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L(i.__e,u,i,t,o,r,f,c);(a=l$1.diffed)&&a(u);}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l$1.__e(n,u,i);}}function z$1(n,u){l$1.__c&&l$1.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$1.__e(n,u.__v);}});}function L(l,u,i,t,o,r,e,c){var s,h,v,y=i.props,p=u.props,d=u.type,k=0;if("svg"===d&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),r=null,c=!1;}if(null===d)y===p||c&&l.data===p||(l.data=p);else {if(r=r&&n.call(l.childNodes),h=(y=i.props||f$1).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(v||h)&&(v&&(h&&v.__html==h.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""));}if(C(l,p,y,o,c),v)u.__k=[];else if(k=u.props.children,w$1(l,Array.isArray(k)?k:[k],u,i,t,o&&"foreignObject"!==d,r,e,r?r[0]:i.__k&&_$1(i,0),c),null!=r)for(k=r.length;k--;)null!=r[k]&&a$1(r[k]);c||("value"in p&&void 0!==(k=p.value)&&(k!==l.value||"progress"===d&&!k||"option"===d&&k!==y.value)&&H(l,"value",k,y.value,!1),"checked"in p&&void 0!==(k=p.checked)&&k!==l.checked&&H(l,"checked",k,y.checked,!1));}return l}function M(n,u,i){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$1.__e(n,i);}}function N(n,u,i){var t,o;if(l$1.unmount&&l$1.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(n){l$1.__e(n,u);}t.base=t.__P=null;}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N(t[o],u,"function"!=typeof n.type);i||null==n.__e||a$1(n.__e),n.__e=n.__d=void 0;}function O(n,l,u){return this.constructor(n,u)}function P(u,i,t){var o,r,e;l$1.__&&l$1.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,e=[],j$1(i,u=(!o&&t||i).__k=h(p$1,null,[u]),r||f$1,f$1,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,e,!o&&t?t:r?r.__e:i.firstChild,o),z$1(e,u);}n=e$1.slice,l$1={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l;}throw n}},u$1=0,d$1.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s$1({},this.state),"function"==typeof n&&(n=n(s$1({},u),this.props)),n&&s$1(u,n),null!=n&&this.__v&&(l&&this.__h.push(l),b$1(this));},d$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),b$1(this));},d$1.prototype.render=p$1,t$1=[],g$1.__r=0;
5293
5341
 
5294
5342
  const Styles = {
5295
5343
  Error: {
@@ -5354,35 +5402,35 @@ const Styles = {
5354
5402
  };
5355
5403
 
5356
5404
  function Dialog({ children, className }) {
5357
- return (a$1("div", { className: className },
5358
- a$1("div", { style: Styles.Darken }),
5359
- a$1("div", { style: Styles.DialogOuter },
5360
- a$1("div", { style: Styles.DialogInner }, children))));
5405
+ return (h("div", { className: className },
5406
+ h("div", { style: Styles.Darken }),
5407
+ h("div", { style: Styles.DialogOuter },
5408
+ h("div", { style: Styles.DialogInner }, children))));
5361
5409
  }
5362
5410
 
5363
- var t,u,r,o=0,i=[],c=n.__b,f=n.__r,e=n.diffed,a=n.__c,v=n.unmount;function m(t,r){n.__h&&n.__h(u,t,o||r),o=0;var i=u.__H||(u.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function l(n){return o=1,p(w,n)}function p(n,r,o){var i=m(t++,2);return i.t=n,i.__c||(i.__=[o?o(r):w(void 0,r),function(n){var t=i.t(i.__[0],n);i.__[0]!==t&&(i.__=[t,i.__[1]],i.__c.setState({}));}],i.__c=u),i.__}function h(r,o){var i=m(t++,4);!n.__s&&k(i.__H,o)&&(i.__=r,i.__H=o,u.__h.push(i));}function s(n){return o=5,d(function(){return {current:n}},[])}function d(n,u){var r=m(t++,7);return k(r.__H,u)&&(r.__=n(),r.__H=u,r.__h=n),r.__}function x(){i.forEach(function(t){if(t.__P)try{t.__H.__h.forEach(g),t.__H.__h.forEach(j),t.__H.__h=[];}catch(u){t.__H.__h=[],n.__e(u,t.__v);}}),i=[];}n.__b=function(n){u=null,c&&c(n);},n.__r=function(n){f&&f(n),t=0;var r=(u=n.__c).__H;r&&(r.__h.forEach(g),r.__h.forEach(j),r.__h=[]);},n.diffed=function(t){e&&e(t);var o=t.__c;o&&o.__H&&o.__H.__h.length&&(1!==i.push(o)&&r===n.requestAnimationFrame||((r=n.requestAnimationFrame)||function(n){var t,u=function(){clearTimeout(r),b&&cancelAnimationFrame(t),setTimeout(n);},r=setTimeout(u,100);b&&(t=requestAnimationFrame(u));})(x)),u=void 0;},n.__c=function(t,u){u.some(function(t){try{t.__h.forEach(g),t.__h=t.__h.filter(function(n){return !n.__||j(n)});}catch(r){u.some(function(n){n.__h&&(n.__h=[]);}),u=[],n.__e(r,t.__v);}}),a&&a(t,u);},n.unmount=function(t){v&&v(t);var u=t.__c;if(u&&u.__H)try{u.__H.__.forEach(g);}catch(t){n.__e(t,u.__v);}};var b="function"==typeof requestAnimationFrame;function g(n){var t=u;"function"==typeof n.__c&&n.__c(),u=t;}function j(n){var t=u;n.__c=n.__(),u=t;}function k(n,t){return !n||n.length!==t.length||t.some(function(t,u){return t!==n[u]})}function w(n,t){return "function"==typeof t?t(n):t}
5411
+ var t,r,u,i,o=0,c=[],f=[],e=l$1.__b,a=l$1.__r,v=l$1.diffed,l=l$1.__c,m=l$1.unmount;function d(t,u){l$1.__h&&l$1.__h(r,t,o||u),o=0;var i=r.__H||(r.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:f}),i.__[t]}function p(n){return o=1,y(z,n)}function y(n,u,i){var o=d(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):z(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=r,!r.u)){r.u=!0;var c=r.shouldComponentUpdate;r.shouldComponentUpdate=function(n,t,r){if(!o.__c.__H)return !0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return !n.__N}))return !c||c.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0);}}),!!i&&(!c||c.call(this,n,t,r))};}return o.__N||o.__}function s(u,i){var o=d(t++,4);!l$1.__s&&w(o.__H,i)&&(o.__=u,o.i=i,r.__h.push(o));}function _(n){return o=5,F(function(){return {current:n}},[])}function F(n,r){var u=d(t++,7);return w(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function b(){for(var t;t=c.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(j),t.__H.__h.forEach(k),t.__H.__h=[];}catch(r){t.__H.__h=[],l$1.__e(r,t.__v);}}l$1.__b=function(n){r=null,e&&e(n);},l$1.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=f,n.__N=n.i=void 0;})):(i.__h.forEach(j),i.__h.forEach(k),i.__h=[])),u=r;},l$1.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==c.push(o)&&i===l$1.requestAnimationFrame||((i=l$1.requestAnimationFrame)||function(n){var t,r=function(){clearTimeout(u),g&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);g&&(t=requestAnimationFrame(r));})(b)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==f&&(n.__=n.__V),n.i=void 0,n.__V=f;})),u=r=null;},l$1.__c=function(t,r){r.some(function(t){try{t.__h.forEach(j),t.__h=t.__h.filter(function(n){return !n.__||k(n)});}catch(u){r.some(function(n){n.__h&&(n.__h=[]);}),r=[],l$1.__e(u,t.__v);}}),l&&l(t,r);},l$1.unmount=function(t){m&&m(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{j(n);}catch(n){r=n;}}),r&&l$1.__e(r,u.__v));};var g="function"==typeof requestAnimationFrame;function j(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t;}function k(n){var t=r;n.__c=n.__(),r=t;}function w(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function z(n,t){return "function"==typeof t?t(n):t}
5364
5412
 
5365
5413
  function resolveText({ message, messageCode, messageParams }) {
5366
5414
  return message.replace(/\{\w+\}/ig, n => messageParams[n.substr(1, n.length - 2)]);
5367
5415
  }
5368
5416
 
5369
5417
  function LoginDialog({ title, alerts, fields, onCancel, onSubmit, }) {
5370
- const [params, setParams] = l({});
5371
- const firstFieldRef = s();
5372
- h(() => { var _a; return (_a = firstFieldRef.current) === null || _a === void 0 ? void 0 : _a.focus(); }, []);
5373
- return (a$1(Dialog, { className: "dxc-login-dlg" },
5374
- a$1(y, null,
5375
- a$1("h3", { style: Styles.WindowHeader }, title),
5376
- alerts.map((alert) => (a$1("p", { style: Styles.Alert[alert.type] }, resolveText(alert)))),
5377
- a$1("form", { onSubmit: ev => {
5418
+ const [params, setParams] = p({});
5419
+ const firstFieldRef = _(null);
5420
+ s(() => { var _a; return (_a = firstFieldRef.current) === null || _a === void 0 ? void 0 : _a.focus(); }, []);
5421
+ return (h(Dialog, { className: "dxc-login-dlg" },
5422
+ h(p$1, null,
5423
+ h("h3", { style: Styles.WindowHeader }, title),
5424
+ alerts.map((alert) => (h("p", { style: Styles.Alert[alert.type] }, resolveText(alert)))),
5425
+ h("form", { onSubmit: ev => {
5378
5426
  ev.preventDefault();
5379
5427
  onSubmit(params);
5380
- } }, Object.entries(fields).map(([fieldName, { type, label, placeholder }], idx) => (a$1("label", { style: Styles.Label },
5428
+ } }, Object.entries(fields).map(([fieldName, { type, label, placeholder }], idx) => (h("label", { style: Styles.Label },
5381
5429
  label ? `${label}: ` : '',
5382
- a$1("input", { ref: idx === 0 ? firstFieldRef : undefined, type: type, name: fieldName, autoComplete: "on", style: Styles.Input, autoFocus: true, placeholder: placeholder, value: params[fieldName] || '', onInput: (ev) => { var _a; return setParams(Object.assign(Object.assign({}, params), { [fieldName]: valueTransformer(type, (_a = ev.target) === null || _a === void 0 ? void 0 : _a['value']) })); } })))))),
5383
- a$1("div", { style: Styles.ButtonsDiv },
5384
- a$1("button", { type: "submit", style: Styles.Button, onClick: () => onSubmit(params) }, "Submit"),
5385
- a$1("button", { style: Styles.Button, onClick: onCancel }, "Cancel"))));
5430
+ h("input", { ref: idx === 0 ? firstFieldRef : undefined, type: type, name: fieldName, autoComplete: "on", style: Styles.Input, autoFocus: true, placeholder: placeholder, value: params[fieldName] || '', onInput: (ev) => { var _a; return setParams(Object.assign(Object.assign({}, params), { [fieldName]: valueTransformer(type, (_a = ev.target) === null || _a === void 0 ? void 0 : _a['value']) })); } })))))),
5431
+ h("div", { style: Styles.ButtonsDiv },
5432
+ h("button", { type: "submit", style: Styles.Button, onClick: () => onSubmit(params) }, "Submit"),
5433
+ h("button", { style: Styles.Button, onClick: onCancel }, "Cancel"))));
5386
5434
  }
5387
5435
  function valueTransformer(type, value) {
5388
5436
  switch (type) {
@@ -5392,7 +5440,7 @@ function valueTransformer(type, value) {
5392
5440
  }
5393
5441
  }
5394
5442
 
5395
- class LoginGui extends p$1 {
5443
+ class LoginGui extends d$1 {
5396
5444
  constructor(props) {
5397
5445
  super(props);
5398
5446
  this.observer = (userInteraction) => this.setState({ userInteraction });
@@ -5411,13 +5459,13 @@ class LoginGui extends p$1 {
5411
5459
  if (!userInteraction)
5412
5460
  return null;
5413
5461
  //if (props.db.cloud.userInteraction.observers.length > 1) return null; // Someone else subscribes.
5414
- return a$1(LoginDialog, Object.assign({}, userInteraction));
5462
+ return h(LoginDialog, Object.assign({}, userInteraction));
5415
5463
  }
5416
5464
  }
5417
5465
  function setupDefaultGUI(db) {
5418
5466
  const el = document.createElement('div');
5419
5467
  document.body.appendChild(el);
5420
- N(a$1(LoginGui, { db: db.vip }), el);
5468
+ P(h(LoginGui, { db: db.vip }), el);
5421
5469
  let closed = false;
5422
5470
  return {
5423
5471
  unsubscribe() {
@@ -5787,12 +5835,12 @@ const getInvitesObservable = associate((db) => {
5787
5835
  return Object.values(membersById)
5788
5836
  .filter((invite) => !invite.accepted && !invite.rejected)
5789
5837
  .map((invite) => (Object.assign(Object.assign({}, invite), { accept() {
5790
- return __awaiter$1(this, void 0, void 0, function* () {
5838
+ return __awaiter(this, void 0, void 0, function* () {
5791
5839
  yield db.members.update(invite.id, { accepted: new Date() });
5792
5840
  });
5793
5841
  },
5794
5842
  reject() {
5795
- return __awaiter$1(this, void 0, void 0, function* () {
5843
+ return __awaiter(this, void 0, void 0, function* () {
5796
5844
  yield db.members.update(invite.id, { rejected: new Date() });
5797
5845
  });
5798
5846
  } })));
@@ -5812,7 +5860,7 @@ function dexieCloud(dexie) {
5812
5860
  let configuredProgramatically = false;
5813
5861
  // local sync worker - used when there's no service worker.
5814
5862
  let localSyncWorker = null;
5815
- dexie.on('ready', (dexie) => __awaiter$1(this, void 0, void 0, function* () {
5863
+ dexie.on('ready', (dexie) => __awaiter(this, void 0, void 0, function* () {
5816
5864
  try {
5817
5865
  yield onDbReady(dexie);
5818
5866
  }
@@ -5836,7 +5884,7 @@ function dexieCloud(dexie) {
5836
5884
  currentUserEmitter.next(UNAUTHORIZED_USER);
5837
5885
  });
5838
5886
  dexie.cloud = {
5839
- version: '4.0.0-beta.21',
5887
+ version: '4.0.0-beta.23',
5840
5888
  options: Object.assign({}, DEFAULT_OPTIONS),
5841
5889
  schema: null,
5842
5890
  get currentUserId() {
@@ -5851,7 +5899,7 @@ function dexieCloud(dexie) {
5851
5899
  userInteraction: new BehaviorSubject(undefined),
5852
5900
  webSocketStatus: new BehaviorSubject('not-started'),
5853
5901
  login(hint) {
5854
- return __awaiter$1(this, void 0, void 0, function* () {
5902
+ return __awaiter(this, void 0, void 0, function* () {
5855
5903
  const db = DexieCloudDB(dexie);
5856
5904
  yield db.cloud.sync();
5857
5905
  yield login(db, hint);
@@ -5870,7 +5918,7 @@ function dexieCloud(dexie) {
5870
5918
  updateSchemaFromOptions(dexie.cloud.schema, dexie.cloud.options);
5871
5919
  },
5872
5920
  sync({ wait, purpose } = { wait: true, purpose: 'push' }) {
5873
- return __awaiter$1(this, void 0, void 0, function* () {
5921
+ return __awaiter(this, void 0, void 0, function* () {
5874
5922
  if (wait === undefined)
5875
5923
  wait = true;
5876
5924
  const db = DexieCloudDB(dexie);
@@ -5892,7 +5940,7 @@ function dexieCloud(dexie) {
5892
5940
  triggerSync(db, purpose);
5893
5941
  if (wait) {
5894
5942
  console.debug('db.cloud.login() is waiting for sync completion...');
5895
- yield from$1(liveQuery(() => __awaiter$1(this, void 0, void 0, function* () {
5943
+ yield from$1(liveQuery(() => __awaiter(this, void 0, void 0, function* () {
5896
5944
  const syncNeeded = yield isSyncNeeded(db);
5897
5945
  const newSyncState = yield db.getPersistedSyncState();
5898
5946
  if ((newSyncState === null || newSyncState === void 0 ? void 0 : newSyncState.timestamp) !== (syncState === null || syncState === void 0 ? void 0 : syncState.timestamp) &&
@@ -5928,7 +5976,7 @@ function dexieCloud(dexie) {
5928
5976
  dexie.use(createIdGenerationMiddleware(DexieCloudDB(dexie)));
5929
5977
  function onDbReady(dexie) {
5930
5978
  var _a, _b, _c, _d, _e, _f, _g;
5931
- return __awaiter$1(this, void 0, void 0, function* () {
5979
+ return __awaiter(this, void 0, void 0, function* () {
5932
5980
  closed = false; // As Dexie calls us, we are not closed anymore. Maybe reopened? Remember db.ready event is registered with sticky flag!
5933
5981
  const db = DexieCloudDB(dexie);
5934
5982
  // Setup default GUI:
@@ -5948,7 +5996,7 @@ function dexieCloud(dexie) {
5948
5996
  const swRegistrations = 'serviceWorker' in navigator
5949
5997
  ? yield navigator.serviceWorker.getRegistrations()
5950
5998
  : [];
5951
- const initiallySynced = yield db.transaction('rw', db.$syncState, () => __awaiter$1(this, void 0, void 0, function* () {
5999
+ const initiallySynced = yield db.transaction('rw', db.$syncState, () => __awaiter(this, void 0, void 0, function* () {
5952
6000
  var _h, _j;
5953
6001
  const { options, schema } = db.cloud;
5954
6002
  const [persistedOptions, persistedSchema, persistedSyncState] = yield Promise.all([
@@ -6089,7 +6137,7 @@ function dexieCloud(dexie) {
6089
6137
  });
6090
6138
  }
6091
6139
  }
6092
- dexieCloud.version = '4.0.0-beta.21';
6140
+ dexieCloud.version = '4.0.0-beta.23';
6093
6141
  Dexie.Cloud = dexieCloud;
6094
6142
 
6095
6143
  // In case the SW lives for a while, let it reuse already opened connections:
@@ -6120,7 +6168,7 @@ function syncDB(dbName, purpose) {
6120
6168
  return promise;
6121
6169
  function _syncDB(dbName, purpose) {
6122
6170
  var _a;
6123
- return __awaiter$1(this, void 0, void 0, function* () {
6171
+ return __awaiter(this, void 0, void 0, function* () {
6124
6172
  let db = managedDBs.get(dbName);
6125
6173
  if (!db) {
6126
6174
  console.debug('Dexie Cloud SW: Creating new Dexie instance for', dbName);
@@ -6198,7 +6246,7 @@ if (!DISABLE_SERVICEWORKER_STRATEGY) {
6198
6246
  // Mimic background sync behavior - retry in X minutes on failure.
6199
6247
  // But lesser timeout and more number of times.
6200
6248
  const syncAndRetry = (num = 1) => {
6201
- return syncDB(dbName, event.data.purpose || "pull").catch((e) => __awaiter$1(void 0, void 0, void 0, function* () {
6249
+ return syncDB(dbName, event.data.purpose || "pull").catch((e) => __awaiter(void 0, void 0, void 0, function* () {
6202
6250
  if (num === 3)
6203
6251
  throw e;
6204
6252
  yield sleep(60000); // 1 minute