buzzcasting-storage 3.12.4 → 3.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/buzzcasting-storage.esm.js +410 -402
- package/package.json +4 -4
|
@@ -26,8 +26,8 @@ function Oe(h, t) {
|
|
|
26
26
|
}
|
|
27
27
|
function Na(h, t, o) {
|
|
28
28
|
return Object.keys(t).sort().reduce(l, h);
|
|
29
|
-
function l(g,
|
|
30
|
-
return jr(g, t[
|
|
29
|
+
function l(g, b) {
|
|
30
|
+
return jr(g, t[b], b, o);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
function jr(h, t, o, l) {
|
|
@@ -40,13 +40,13 @@ function jr(h, t, o, l) {
|
|
|
40
40
|
if (l.includes(t))
|
|
41
41
|
return Oe(g, `[Circular]${o}`);
|
|
42
42
|
l.push(t);
|
|
43
|
-
const
|
|
43
|
+
const b = Na(g, t, l);
|
|
44
44
|
if (!("valueOf" in t) || typeof t.valueOf != "function")
|
|
45
|
-
return
|
|
45
|
+
return b;
|
|
46
46
|
try {
|
|
47
|
-
return Oe(
|
|
48
|
-
} catch (
|
|
49
|
-
return Oe(
|
|
47
|
+
return Oe(b, String(t.valueOf()));
|
|
48
|
+
} catch (x) {
|
|
49
|
+
return Oe(b, `[valueOf exception]${x.stack || x.message}`);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
return Oe(g, t.toString());
|
|
@@ -117,10 +117,10 @@ function Ta(h) {
|
|
|
117
117
|
}
|
|
118
118
|
function Ot(h, t) {
|
|
119
119
|
var o;
|
|
120
|
-
let l, g,
|
|
120
|
+
let l, g, b, x, $;
|
|
121
121
|
switch (h.moderation) {
|
|
122
122
|
case en.BEFORE:
|
|
123
|
-
l = /* @__PURE__ */ new Date(), g = (o = h.beforeTime) == null ? void 0 : o.split(":"),
|
|
123
|
+
l = /* @__PURE__ */ new Date(), g = (o = h.beforeTime) == null ? void 0 : o.split(":"), b = Number.parseInt(g ? g[0] : "00"), x = Number.parseInt(g ? g[1] : "00"), $ = Number.parseInt(g ? g[2] : "00"), t.before = l.setHours(b, x, $, 0) / 1e3, t.period || (t.period = l.getDay() === 1 ? 72 : 24);
|
|
124
124
|
break;
|
|
125
125
|
case en.DELAYED:
|
|
126
126
|
h.delay && h.delay > 0 && (t.delay = `${h.delay}`);
|
|
@@ -133,7 +133,7 @@ function Ot(h, t) {
|
|
|
133
133
|
}
|
|
134
134
|
return t;
|
|
135
135
|
}
|
|
136
|
-
const xa = "3.12.
|
|
136
|
+
const xa = "3.12.5";
|
|
137
137
|
class ka {
|
|
138
138
|
options;
|
|
139
139
|
url;
|
|
@@ -173,17 +173,17 @@ class ka {
|
|
|
173
173
|
async get(t) {
|
|
174
174
|
const { version: o } = this.options, l = this.headers(), g = Object.assign({}, t);
|
|
175
175
|
delete g.type, delete g.hash, delete g.order, g.topics = `${g.dashboard}-${g.widget}`, delete g.presentation;
|
|
176
|
-
const
|
|
177
|
-
let
|
|
176
|
+
const b = Object.keys(g).length > 0 ? `?${new URLSearchParams(g).toString()}` : "";
|
|
177
|
+
let x = "";
|
|
178
178
|
switch (t.type) {
|
|
179
179
|
case _.MESSAGES:
|
|
180
|
-
|
|
180
|
+
x = c.MESSAGES;
|
|
181
181
|
break;
|
|
182
182
|
case _.SERIES:
|
|
183
|
-
|
|
183
|
+
x = c.SERIES;
|
|
184
184
|
break;
|
|
185
185
|
case _.CLOUD:
|
|
186
|
-
|
|
186
|
+
x = c.CLOUD;
|
|
187
187
|
break;
|
|
188
188
|
}
|
|
189
189
|
return K(3, [
|
|
@@ -192,16 +192,16 @@ class ka {
|
|
|
192
192
|
c.NONE,
|
|
193
193
|
c.API,
|
|
194
194
|
c.NONE,
|
|
195
|
-
|
|
195
|
+
x,
|
|
196
196
|
t.widget
|
|
197
197
|
]), K(4, [t.type, g]), await fetch(
|
|
198
|
-
[this.url, "api", o, t.type].join("/") +
|
|
198
|
+
[this.url, "api", o, t.type].join("/") + b,
|
|
199
199
|
{ ...l, method: "get" }
|
|
200
|
-
).then(async (
|
|
201
|
-
if (
|
|
202
|
-
throw new Error(`${
|
|
203
|
-
return
|
|
204
|
-
}).then((
|
|
200
|
+
).then(async ($) => {
|
|
201
|
+
if (!$.ok)
|
|
202
|
+
throw new Error(`${$.status}`);
|
|
203
|
+
return $;
|
|
204
|
+
}).then(($) => $.json()).then(($) => ($.query = t, $)).catch(($) => ({ success: !1, message: `${$}`, data: null, query: t }));
|
|
205
205
|
}
|
|
206
206
|
async hideMessage(t) {
|
|
207
207
|
const { version: o } = this.options, l = this.headers(), g = "?action=visible";
|
|
@@ -216,16 +216,16 @@ class ka {
|
|
|
216
216
|
), await fetch(
|
|
217
217
|
[this.url, "api", o, "messages", t.id].join("/") + g,
|
|
218
218
|
{ ...l, method: "put" }
|
|
219
|
-
).then((
|
|
220
|
-
if (!
|
|
221
|
-
throw new Error(
|
|
222
|
-
return
|
|
223
|
-
}).then((
|
|
219
|
+
).then((b) => {
|
|
220
|
+
if (!b.ok)
|
|
221
|
+
throw new Error(b.statusText);
|
|
222
|
+
return b;
|
|
223
|
+
}).then((b) => b.json()).catch((b) => ({ succes: !1, message: b, data: [] }));
|
|
224
224
|
}
|
|
225
225
|
async hideLabels(t) {
|
|
226
|
-
const { version: o } = this.options, l = this.formHeaders(), g = new URLSearchParams(),
|
|
227
|
-
for (const [
|
|
228
|
-
g.append(`custom_filters[${
|
|
226
|
+
const { version: o } = this.options, l = this.formHeaders(), g = new URLSearchParams(), b = t.labels || [];
|
|
227
|
+
for (const [x, $] of b.entries())
|
|
228
|
+
g.append(`custom_filters[${x}]`, $);
|
|
229
229
|
return console.info(
|
|
230
230
|
"%capi%c %cput",
|
|
231
231
|
c.API,
|
|
@@ -233,26 +233,31 @@ class ka {
|
|
|
233
233
|
c.GET_DATA,
|
|
234
234
|
X.HIDE_LABELS,
|
|
235
235
|
t.widget,
|
|
236
|
-
|
|
236
|
+
b
|
|
237
237
|
), await fetch(
|
|
238
238
|
[this.url, "api", o, t.type, t.widget].join("/"),
|
|
239
239
|
{ ...l, body: g, method: "put" }
|
|
240
|
-
).then((
|
|
241
|
-
if (!
|
|
242
|
-
throw new Error(
|
|
243
|
-
return
|
|
244
|
-
}).then((
|
|
240
|
+
).then((x) => {
|
|
241
|
+
if (!x.ok)
|
|
242
|
+
throw new Error(x.statusText);
|
|
243
|
+
return x;
|
|
244
|
+
}).then((x) => x.json()).catch((x) => ({ succes: !1, message: x, data: [] }));
|
|
245
245
|
}
|
|
246
246
|
async loadSlide(t) {
|
|
247
247
|
const { version: o } = this.options, l = this.headers(), g = Object.assign({}, t);
|
|
248
248
|
return delete g.type, delete g.hash, K(3, ["%capi%c %cloadSlide", c.API, c.NONE, c.SLIDE, t.id]), await fetch(
|
|
249
249
|
[this.url, "api", o, "slides", t.id].join("/"),
|
|
250
250
|
{ ...l, method: "get" }
|
|
251
|
-
).then(async (
|
|
252
|
-
if (!
|
|
253
|
-
throw new Error(`${
|
|
254
|
-
return
|
|
255
|
-
}).then((
|
|
251
|
+
).then(async (b) => {
|
|
252
|
+
if (!b.ok)
|
|
253
|
+
throw new Error(`${b.status}`);
|
|
254
|
+
return b;
|
|
255
|
+
}).then((b) => b.json()).then((b) => {
|
|
256
|
+
let x;
|
|
257
|
+
return t.type = "slides", b.query = t, b?.data && (Array.isArray(b.data) ? (x = structuredClone(b.data), x.forEach(($) => {
|
|
258
|
+
typeof $.json == "string" && ($.json = JSON.parse($.json));
|
|
259
|
+
})) : (x = structuredClone(b.data), x.json = JSON.parse(x.json)), b.data = x), b;
|
|
260
|
+
}).catch((b) => ({ success: !1, message: `${b}`, data: null }));
|
|
256
261
|
}
|
|
257
262
|
/**
|
|
258
263
|
* Store slide definition
|
|
@@ -277,11 +282,11 @@ class ka {
|
|
|
277
282
|
]), await fetch(
|
|
278
283
|
[this.url, "api", o, "slides", t.id].join("/"),
|
|
279
284
|
{ ...l, body: g, method: "put" }
|
|
280
|
-
).then((
|
|
281
|
-
if (!
|
|
282
|
-
throw new Error(
|
|
283
|
-
return
|
|
284
|
-
}).then((
|
|
285
|
+
).then((b) => {
|
|
286
|
+
if (!b.ok)
|
|
287
|
+
throw new Error(b.statusText);
|
|
288
|
+
return b;
|
|
289
|
+
}).then((b) => b.json()).catch((b) => ({ succes: !1, message: b, data: [] }));
|
|
285
290
|
}
|
|
286
291
|
async loadPresentation(t) {
|
|
287
292
|
const { version: o } = this.options, l = this.headers();
|
|
@@ -300,7 +305,10 @@ class ka {
|
|
|
300
305
|
if (!g.ok)
|
|
301
306
|
throw new Error(`${g.status}`);
|
|
302
307
|
return g;
|
|
303
|
-
}).then((g) => g.json()).then((g) =>
|
|
308
|
+
}).then((g) => g.json()).then((g) => {
|
|
309
|
+
let b;
|
|
310
|
+
return t.type = "presentations", g.query = t, g?.data && (b = structuredClone(g.data), g.data = b), g;
|
|
311
|
+
}).catch((g) => ({ success: !1, message: `${g}`, data: null }));
|
|
304
312
|
}
|
|
305
313
|
/**
|
|
306
314
|
* Store slide definition
|
|
@@ -316,11 +324,11 @@ class ka {
|
|
|
316
324
|
return K(2, ["%capi%c %cput", c.API, c.NONE, c.PRESENTATION, t.name]), await fetch(
|
|
317
325
|
[this.url, "api", o, _.PRESENTATIONS, t.id].join("/"),
|
|
318
326
|
{ ...l, body: g, method: "put" }
|
|
319
|
-
).then((
|
|
320
|
-
if (!
|
|
321
|
-
throw new Error(
|
|
322
|
-
return
|
|
323
|
-
}).then((
|
|
327
|
+
).then((b) => {
|
|
328
|
+
if (!b.ok)
|
|
329
|
+
throw new Error(b.statusText);
|
|
330
|
+
return b;
|
|
331
|
+
}).then((b) => b.json()).catch((b) => ({ succes: !1, message: b, data: [] }));
|
|
324
332
|
}
|
|
325
333
|
async loadPreference(t) {
|
|
326
334
|
const { version: o } = this.options, l = this.headers();
|
|
@@ -337,7 +345,7 @@ class ka {
|
|
|
337
345
|
if (!g.ok)
|
|
338
346
|
throw new Error(`${g.status}`);
|
|
339
347
|
return g;
|
|
340
|
-
}).then((g) => g.json()).then((g) => g).catch((g) => ({ success: !1, message: `${g}`, data: null }));
|
|
348
|
+
}).then((g) => g.json()).then((g) => (t.type = "preference", g.query = t, g)).catch((g) => ({ success: !1, message: `${g}`, data: null }));
|
|
341
349
|
}
|
|
342
350
|
async storePreference(t) {
|
|
343
351
|
const { version: o } = this.options, l = this.formHeaders();
|
|
@@ -352,11 +360,11 @@ class ka {
|
|
|
352
360
|
), await fetch(
|
|
353
361
|
[this.url, "api", o, _.PREFERENCES, t.id].join("/"),
|
|
354
362
|
{ ...l, body: g, method: "put" }
|
|
355
|
-
).then((
|
|
356
|
-
if (!
|
|
357
|
-
throw new Error(
|
|
358
|
-
return
|
|
359
|
-
}).then((
|
|
363
|
+
).then((b) => {
|
|
364
|
+
if (!b.ok)
|
|
365
|
+
throw new Error(b.statusText);
|
|
366
|
+
return b;
|
|
367
|
+
}).then((b) => b.json()).catch((b) => ({ succes: !1, message: b, data: [] }));
|
|
360
368
|
}
|
|
361
369
|
/*public async loadDashboardWidgets(query: IQuery): Promise<any> {
|
|
362
370
|
if (query?.dashboard === undefined)
|
|
@@ -450,11 +458,11 @@ class ka {
|
|
|
450
458
|
body: g,
|
|
451
459
|
method: "post"
|
|
452
460
|
}
|
|
453
|
-
).then((
|
|
454
|
-
if (!
|
|
455
|
-
throw new Error(
|
|
456
|
-
return
|
|
457
|
-
}).then((
|
|
461
|
+
).then((b) => {
|
|
462
|
+
if (!b.ok)
|
|
463
|
+
throw new Error(b.statusText);
|
|
464
|
+
return b;
|
|
465
|
+
}).then((b) => b.json()).catch((b) => ({ succes: !1, message: b, data: [] }));
|
|
458
466
|
}
|
|
459
467
|
async deleteImage(t, o) {
|
|
460
468
|
const { version: l } = this.options, g = this.formHeaders();
|
|
@@ -469,11 +477,11 @@ class ka {
|
|
|
469
477
|
"/"
|
|
470
478
|
)}?folder=${t}`,
|
|
471
479
|
{ ...g, method: "delete" }
|
|
472
|
-
).then((
|
|
473
|
-
if (!
|
|
474
|
-
throw new Error(
|
|
475
|
-
return
|
|
476
|
-
}).then((
|
|
480
|
+
).then((b) => {
|
|
481
|
+
if (!b.ok)
|
|
482
|
+
throw new Error(b.statusText);
|
|
483
|
+
return b;
|
|
484
|
+
}).then((b) => b.json()).catch((b) => ({ succes: !1, message: b, data: [] }));
|
|
477
485
|
}
|
|
478
486
|
}
|
|
479
487
|
var Ca = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
@@ -502,19 +510,19 @@ function Ma() {
|
|
|
502
510
|
for (var a, s = 0, i = n.length; s < i; s++) !a && s in n || ((a = a || Array.prototype.slice.call(n, 0, s))[s] = n[s]);
|
|
503
511
|
return e.concat(a || Array.prototype.slice.call(n));
|
|
504
512
|
}
|
|
505
|
-
var
|
|
513
|
+
var b = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Ca, x = Object.keys, $ = Array.isArray;
|
|
506
514
|
function te(e, n) {
|
|
507
|
-
return typeof n != "object" ||
|
|
515
|
+
return typeof n != "object" || x(n).forEach(function(r) {
|
|
508
516
|
e[r] = n[r];
|
|
509
517
|
}), e;
|
|
510
518
|
}
|
|
511
|
-
typeof Promise > "u" ||
|
|
519
|
+
typeof Promise > "u" || b.Promise || (b.Promise = Promise);
|
|
512
520
|
var ge = Object.getPrototypeOf, Ce = {}.hasOwnProperty;
|
|
513
521
|
function ie(e, n) {
|
|
514
522
|
return Ce.call(e, n);
|
|
515
523
|
}
|
|
516
524
|
function be(e, n) {
|
|
517
|
-
typeof n == "function" && (n = n(ge(e))), (typeof Reflect > "u" ?
|
|
525
|
+
typeof n == "function" && (n = n(ge(e))), (typeof Reflect > "u" ? x : Reflect.ownKeys)(n).forEach(function(r) {
|
|
518
526
|
Ae(e, r, n[r]);
|
|
519
527
|
});
|
|
520
528
|
}
|
|
@@ -538,7 +546,7 @@ function Ma() {
|
|
|
538
546
|
if (!e) throw new Error("Assertion Failed");
|
|
539
547
|
}
|
|
540
548
|
function Yn(e) {
|
|
541
|
-
|
|
549
|
+
b.setImmediate ? setImmediate(e) : setTimeout(e, 0);
|
|
542
550
|
}
|
|
543
551
|
function ve(e, n) {
|
|
544
552
|
if (typeof n == "string" && ie(e, n)) return e[n];
|
|
@@ -562,7 +570,7 @@ function Ma() {
|
|
|
562
570
|
for (var a = 0, s = n.length; a < s; ++a) ue(e, n[a], r[a]);
|
|
563
571
|
} else {
|
|
564
572
|
var i, u, d = n.indexOf(".");
|
|
565
|
-
d !== -1 ? (i = n.substr(0, d), (u = n.substr(d + 1)) === "" ? r === void 0 ?
|
|
573
|
+
d !== -1 ? (i = n.substr(0, d), (u = n.substr(d + 1)) === "" ? r === void 0 ? $(e) && !isNaN(parseInt(i)) ? e.splice(i, 1) : delete e[i] : e[i] = r : ue(d = !(d = e[i]) || !ie(e, i) ? e[i] = {} : d, u, r)) : r === void 0 ? $(e) && !isNaN(parseInt(n)) ? e.splice(n, 1) : delete e[n] : e[n] = r;
|
|
566
574
|
}
|
|
567
575
|
}
|
|
568
576
|
function Qn(e) {
|
|
@@ -579,16 +587,16 @@ function Ma() {
|
|
|
579
587
|
return n + e + "Array";
|
|
580
588
|
});
|
|
581
589
|
}))).filter(function(e) {
|
|
582
|
-
return
|
|
590
|
+
return b[e];
|
|
583
591
|
}), Jn = new Set(Ge.map(function(e) {
|
|
584
|
-
return
|
|
592
|
+
return b[e];
|
|
585
593
|
})), it = null;
|
|
586
594
|
function $e(e) {
|
|
587
595
|
return it = /* @__PURE__ */ new WeakMap(), e = function n(r) {
|
|
588
596
|
if (!r || typeof r != "object") return r;
|
|
589
597
|
var a = it.get(r);
|
|
590
598
|
if (a) return a;
|
|
591
|
-
if (
|
|
599
|
+
if ($(r)) {
|
|
592
600
|
a = [], it.set(r, a);
|
|
593
601
|
for (var s = 0, i = r.length; s < i; ++s) a.push(n(r[s]));
|
|
594
602
|
} else if (Jn.has(r.constructor)) a = r;
|
|
@@ -616,7 +624,7 @@ function Ma() {
|
|
|
616
624
|
function Ee(e) {
|
|
617
625
|
var n, r, a, s;
|
|
618
626
|
if (arguments.length === 1) {
|
|
619
|
-
if (
|
|
627
|
+
if ($(e)) return e.slice();
|
|
620
628
|
if (this === Qe && typeof e == "string") return [e];
|
|
621
629
|
if (s = Vr(e)) {
|
|
622
630
|
for (r = []; !(a = s.next()).done; ) r.push(a.value);
|
|
@@ -999,11 +1007,11 @@ function Ma() {
|
|
|
999
1007
|
var r, a = B;
|
|
1000
1008
|
(n ? !ne.echoes || kt++ && e === B : !kt || --kt && e === B) || queueMicrotask(n ? function(s) {
|
|
1001
1009
|
++Ct, ne.echoes && --ne.echoes != 0 || (ne.echoes = ne.awaits = ne.id = 0), xt.push(B), Ne(s, !0);
|
|
1002
|
-
}.bind(null, e) : sa), e !== B && (B = e, a === Pe && (Pe.env = ar()), cn && (r = Pe.env.Promise, n = e.env, (a.global || e.global) && (Object.defineProperty(
|
|
1010
|
+
}.bind(null, e) : sa), e !== B && (B = e, a === Pe && (Pe.env = ar()), cn && (r = Pe.env.Promise, n = e.env, (a.global || e.global) && (Object.defineProperty(b, "Promise", n.PromiseProp), r.all = n.all, r.race = n.race, r.resolve = n.resolve, r.reject = n.reject, n.allSettled && (r.allSettled = n.allSettled), n.any && (r.any = n.any))));
|
|
1003
1011
|
}
|
|
1004
1012
|
function ar() {
|
|
1005
|
-
var e =
|
|
1006
|
-
return cn ? { Promise: e, PromiseProp: Object.getOwnPropertyDescriptor(
|
|
1013
|
+
var e = b.Promise;
|
|
1014
|
+
return cn ? { Promise: e, PromiseProp: Object.getOwnPropertyDescriptor(b, "Promise"), all: e.all, race: e.race, allSettled: e.allSettled, any: e.any, resolve: e.resolve, reject: e.reject } : {};
|
|
1007
1015
|
}
|
|
1008
1016
|
function We(e, n, r, a, s) {
|
|
1009
1017
|
var i = B;
|
|
@@ -1099,9 +1107,9 @@ function Ma() {
|
|
|
1099
1107
|
return y(w, f, O, m);
|
|
1100
1108
|
})) : q(S);
|
|
1101
1109
|
}
|
|
1102
|
-
return E._promise(f, function(S,
|
|
1110
|
+
return E._promise(f, function(S, v) {
|
|
1103
1111
|
return De(function() {
|
|
1104
|
-
return B.trans = E, m(S,
|
|
1112
|
+
return B.trans = E, m(S, v, E);
|
|
1105
1113
|
});
|
|
1106
1114
|
}).then(function(S) {
|
|
1107
1115
|
if (f === "readwrite") try {
|
|
@@ -1137,8 +1145,8 @@ function Ma() {
|
|
|
1137
1145
|
}).then(n);
|
|
1138
1146
|
}, J.prototype.where = function(e) {
|
|
1139
1147
|
if (typeof e == "string") return new this.db.WhereClause(this, e);
|
|
1140
|
-
if (
|
|
1141
|
-
var n =
|
|
1148
|
+
if ($(e)) return new this.db.WhereClause(this, "[".concat(e.join("+"), "]"));
|
|
1149
|
+
var n = x(e);
|
|
1142
1150
|
if (n.length === 1) return this.where(n[0]).equals(e[n[0]]);
|
|
1143
1151
|
var r = this.schema.indexes.concat(this.schema.primKey).filter(function(d) {
|
|
1144
1152
|
if (d.compound && n.every(function(y) {
|
|
@@ -1165,7 +1173,7 @@ function Ma() {
|
|
|
1165
1173
|
var u = n.reduce(function(f, p) {
|
|
1166
1174
|
var y = f[0], w = f[1], f = a[p], O = e[p];
|
|
1167
1175
|
return [y || f, y || !f ? Ue(w, f && f.multi ? function(m) {
|
|
1168
|
-
return m = ve(m, p),
|
|
1176
|
+
return m = ve(m, p), $(m) && m.some(function(E) {
|
|
1169
1177
|
return s(O, E);
|
|
1170
1178
|
});
|
|
1171
1179
|
} : function(m) {
|
|
@@ -1188,7 +1196,7 @@ function Ma() {
|
|
|
1188
1196
|
}, J.prototype.toCollection = function() {
|
|
1189
1197
|
return new this.db.Collection(new this.db.WhereClause(this));
|
|
1190
1198
|
}, J.prototype.orderBy = function(e) {
|
|
1191
|
-
return new this.db.Collection(new this.db.WhereClause(this,
|
|
1199
|
+
return new this.db.Collection(new this.db.WhereClause(this, $(e) ? "[".concat(e.join("+"), "]") : e));
|
|
1192
1200
|
}, J.prototype.reverse = function() {
|
|
1193
1201
|
return this.toCollection().reverse();
|
|
1194
1202
|
}, J.prototype.mapToClass = function(e) {
|
|
@@ -1238,7 +1246,7 @@ function Ma() {
|
|
|
1238
1246
|
return d;
|
|
1239
1247
|
});
|
|
1240
1248
|
}, J.prototype.update = function(e, n) {
|
|
1241
|
-
return typeof e != "object" ||
|
|
1249
|
+
return typeof e != "object" || $(e) ? this.where(":id").equals(e).modify(n) : (e = ve(e, this.schema.primKey.keyPath), e === void 0 ? q(new L.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(n));
|
|
1242
1250
|
}, J.prototype.put = function(e, n) {
|
|
1243
1251
|
var r = this, a = this.schema.primKey, s = a.auto, i = a.keyPath, u = e;
|
|
1244
1252
|
return i && s && (u = Mt(i)(e)), this._trans("readwrite", function(d) {
|
|
@@ -1313,8 +1321,8 @@ function Ma() {
|
|
|
1313
1321
|
e.forEach(function(f, O) {
|
|
1314
1322
|
var m = f.key, E = f.changes, S = d[O];
|
|
1315
1323
|
if (S) {
|
|
1316
|
-
for (var
|
|
1317
|
-
var P = A[
|
|
1324
|
+
for (var v = 0, A = Object.keys(E); v < A.length; v++) {
|
|
1325
|
+
var P = A[v], D = E[P];
|
|
1318
1326
|
if (P === n.schema.primKey.keyPath) {
|
|
1319
1327
|
if (H(D, m) !== 0) throw new L.Constraint("Cannot update primary key in bulkUpdate()");
|
|
1320
1328
|
} else ue(S, P, D);
|
|
@@ -1327,8 +1335,8 @@ function Ma() {
|
|
|
1327
1335
|
var O = f.numFailures, m = f.failures;
|
|
1328
1336
|
if (O === 0) return w;
|
|
1329
1337
|
for (var E = 0, S = Object.keys(m); E < S.length; E++) {
|
|
1330
|
-
var
|
|
1331
|
-
P != null && (
|
|
1338
|
+
var v, A = S[E], P = i[Number(A)];
|
|
1339
|
+
P != null && (v = m[A], delete m[A], m[P] = v);
|
|
1332
1340
|
}
|
|
1333
1341
|
throw new Je("".concat(n.name, ".bulkUpdate(): ").concat(O, " of ").concat(w, " operations failed"), m);
|
|
1334
1342
|
});
|
|
@@ -1371,16 +1379,16 @@ function Ma() {
|
|
|
1371
1379
|
} };
|
|
1372
1380
|
return r[u] = n[u] = w;
|
|
1373
1381
|
}
|
|
1374
|
-
|
|
1382
|
+
x(y = u).forEach(function(f) {
|
|
1375
1383
|
var O = y[f];
|
|
1376
|
-
if (
|
|
1384
|
+
if ($(O)) i(f, y[f][0], y[f][1]);
|
|
1377
1385
|
else {
|
|
1378
1386
|
if (O !== "asap") throw new L.InvalidArgument("Invalid event config");
|
|
1379
1387
|
var m = i(f, ct, function() {
|
|
1380
1388
|
for (var E = arguments.length, S = new Array(E); E--; ) S[E] = arguments[E];
|
|
1381
|
-
m.subscribers.forEach(function(
|
|
1389
|
+
m.subscribers.forEach(function(v) {
|
|
1382
1390
|
Yn(function() {
|
|
1383
|
-
|
|
1391
|
+
v.apply(null, S);
|
|
1384
1392
|
});
|
|
1385
1393
|
});
|
|
1386
1394
|
});
|
|
@@ -1453,7 +1461,7 @@ function Ma() {
|
|
|
1453
1461
|
var n = this["@@propmod"];
|
|
1454
1462
|
if (n.add !== void 0) {
|
|
1455
1463
|
var r = n.add;
|
|
1456
|
-
if (
|
|
1464
|
+
if ($(r)) return g(g([], $(e) ? e : [], !0), r).sort();
|
|
1457
1465
|
if (typeof r == "number") return (Number(e) || 0) + r;
|
|
1458
1466
|
if (typeof r == "bigint") try {
|
|
1459
1467
|
return BigInt(e) + r;
|
|
@@ -1464,7 +1472,7 @@ function Ma() {
|
|
|
1464
1472
|
}
|
|
1465
1473
|
if (n.remove !== void 0) {
|
|
1466
1474
|
var a = n.remove;
|
|
1467
|
-
if (
|
|
1475
|
+
if ($(a)) return $(e) ? e.filter(function(s) {
|
|
1468
1476
|
return !a.includes(s);
|
|
1469
1477
|
}).sort() : [];
|
|
1470
1478
|
if (typeof a == "number") return Number(e) - a;
|
|
@@ -1645,52 +1653,52 @@ function Ma() {
|
|
|
1645
1653
|
var n = this, r = this._ctx;
|
|
1646
1654
|
return this._write(function(a) {
|
|
1647
1655
|
var s, i, u;
|
|
1648
|
-
u = typeof e == "function" ? e : (s =
|
|
1656
|
+
u = typeof e == "function" ? e : (s = x(e), i = s.length, function(v) {
|
|
1649
1657
|
for (var A = !1, P = 0; P < i; ++P) {
|
|
1650
|
-
var D = s[P], I = e[D], N = ve(
|
|
1651
|
-
I instanceof pt ? (ue(
|
|
1658
|
+
var D = s[P], I = e[D], N = ve(v, D);
|
|
1659
|
+
I instanceof pt ? (ue(v, D, I.execute(N)), A = !0) : N !== I && (ue(v, D, I), A = !0);
|
|
1652
1660
|
}
|
|
1653
1661
|
return A;
|
|
1654
1662
|
});
|
|
1655
1663
|
var d = r.table.core, f = d.schema.primaryKey, p = f.outbound, y = f.extractKey, w = 200, f = n.db._options.modifyChunkSize;
|
|
1656
1664
|
f && (w = typeof f == "object" ? f[d.name] || f["*"] || 200 : f);
|
|
1657
|
-
function O(
|
|
1665
|
+
function O(v, D) {
|
|
1658
1666
|
var P = D.failures, D = D.numFailures;
|
|
1659
|
-
E +=
|
|
1660
|
-
for (var I = 0, N =
|
|
1661
|
-
var
|
|
1662
|
-
m.push(P[
|
|
1667
|
+
E += v - D;
|
|
1668
|
+
for (var I = 0, N = x(P); I < N.length; I++) {
|
|
1669
|
+
var C = N[I];
|
|
1670
|
+
m.push(P[C]);
|
|
1663
1671
|
}
|
|
1664
1672
|
}
|
|
1665
1673
|
var m = [], E = 0, S = [];
|
|
1666
|
-
return n.clone().primaryKeys().then(function(
|
|
1674
|
+
return n.clone().primaryKeys().then(function(v) {
|
|
1667
1675
|
function A(D) {
|
|
1668
|
-
var I = Math.min(w,
|
|
1669
|
-
return d.getMany({ trans: a, keys:
|
|
1670
|
-
for (var
|
|
1671
|
-
var G = N[
|
|
1672
|
-
u.call(F, F.value, F) !== !1 && (F.value == null ?
|
|
1676
|
+
var I = Math.min(w, v.length - D);
|
|
1677
|
+
return d.getMany({ trans: a, keys: v.slice(D, D + I), cache: "immutable" }).then(function(N) {
|
|
1678
|
+
for (var C = [], R = [], T = p ? [] : null, j = [], k = 0; k < I; ++k) {
|
|
1679
|
+
var G = N[k], F = { value: $e(G), primKey: v[D + k] };
|
|
1680
|
+
u.call(F, F.value, F) !== !1 && (F.value == null ? j.push(v[D + k]) : p || H(y(G), y(F.value)) === 0 ? (R.push(F.value), p && T.push(v[D + k])) : (j.push(v[D + k]), C.push(F.value)));
|
|
1673
1681
|
}
|
|
1674
|
-
return Promise.resolve(0 <
|
|
1675
|
-
for (var z in U.failures)
|
|
1676
|
-
O(
|
|
1682
|
+
return Promise.resolve(0 < C.length && d.mutate({ trans: a, type: "add", values: C }).then(function(U) {
|
|
1683
|
+
for (var z in U.failures) j.splice(parseInt(z), 1);
|
|
1684
|
+
O(C.length, U);
|
|
1677
1685
|
})).then(function() {
|
|
1678
1686
|
return (0 < R.length || P && typeof e == "object") && d.mutate({ trans: a, type: "put", keys: T, values: R, criteria: P, changeSpec: typeof e != "function" && e, isAdditionalChunk: 0 < D }).then(function(U) {
|
|
1679
1687
|
return O(R.length, U);
|
|
1680
1688
|
});
|
|
1681
1689
|
}).then(function() {
|
|
1682
|
-
return (0 <
|
|
1683
|
-
return O(
|
|
1690
|
+
return (0 < j.length || P && e === En) && d.mutate({ trans: a, type: "delete", keys: j, criteria: P, isAdditionalChunk: 0 < D }).then(function(U) {
|
|
1691
|
+
return O(j.length, U);
|
|
1684
1692
|
});
|
|
1685
1693
|
}).then(function() {
|
|
1686
|
-
return
|
|
1694
|
+
return v.length > D + I && A(D + w);
|
|
1687
1695
|
});
|
|
1688
1696
|
});
|
|
1689
1697
|
}
|
|
1690
1698
|
var P = nt(r) && r.limit === 1 / 0 && (typeof e != "function" || e === En) && { index: r.index, range: r.range };
|
|
1691
1699
|
return A(0).then(function() {
|
|
1692
1700
|
if (0 < m.length) throw new Pt("Error modifying one or more objects", m, E, S);
|
|
1693
|
-
return
|
|
1701
|
+
return v.length;
|
|
1694
1702
|
});
|
|
1695
1703
|
});
|
|
1696
1704
|
});
|
|
@@ -1734,24 +1742,24 @@ function Ma() {
|
|
|
1734
1742
|
return typeof E == "string";
|
|
1735
1743
|
})) return le(e, or);
|
|
1736
1744
|
function O(E) {
|
|
1737
|
-
s = E === "next" ? function(
|
|
1738
|
-
return
|
|
1739
|
-
} : function(
|
|
1740
|
-
return
|
|
1741
|
-
}, i = E === "next" ? function(
|
|
1742
|
-
return
|
|
1743
|
-
} : function(
|
|
1744
|
-
return
|
|
1745
|
+
s = E === "next" ? function(v) {
|
|
1746
|
+
return v.toUpperCase();
|
|
1747
|
+
} : function(v) {
|
|
1748
|
+
return v.toLowerCase();
|
|
1749
|
+
}, i = E === "next" ? function(v) {
|
|
1750
|
+
return v.toLowerCase();
|
|
1751
|
+
} : function(v) {
|
|
1752
|
+
return v.toUpperCase();
|
|
1745
1753
|
}, u = E === "next" ? ia : ca;
|
|
1746
|
-
var S = r.map(function(
|
|
1747
|
-
return { lower: i(
|
|
1748
|
-
}).sort(function(
|
|
1749
|
-
return u(
|
|
1754
|
+
var S = r.map(function(v) {
|
|
1755
|
+
return { lower: i(v), upper: s(v) };
|
|
1756
|
+
}).sort(function(v, A) {
|
|
1757
|
+
return u(v.lower, A.lower);
|
|
1750
1758
|
});
|
|
1751
|
-
d = S.map(function(
|
|
1752
|
-
return
|
|
1753
|
-
}), p = S.map(function(
|
|
1754
|
-
return
|
|
1759
|
+
d = S.map(function(v) {
|
|
1760
|
+
return v.upper;
|
|
1761
|
+
}), p = S.map(function(v) {
|
|
1762
|
+
return v.lower;
|
|
1755
1763
|
}), w = (y = E) === "next" ? "" : a;
|
|
1756
1764
|
}
|
|
1757
1765
|
O("next"), e = new e.Collection(e, function() {
|
|
@@ -1760,25 +1768,25 @@ function Ma() {
|
|
|
1760
1768
|
O(E);
|
|
1761
1769
|
};
|
|
1762
1770
|
var m = 0;
|
|
1763
|
-
return e._addAlgorithm(function(E, S,
|
|
1771
|
+
return e._addAlgorithm(function(E, S, v) {
|
|
1764
1772
|
var A = E.key;
|
|
1765
1773
|
if (typeof A != "string") return !1;
|
|
1766
1774
|
var P = i(A);
|
|
1767
1775
|
if (n(P, p, m)) return !0;
|
|
1768
1776
|
for (var D = null, I = m; I < f; ++I) {
|
|
1769
|
-
var N = function(
|
|
1770
|
-
for (var F = Math.min(
|
|
1777
|
+
var N = function(C, R, T, j, k, G) {
|
|
1778
|
+
for (var F = Math.min(C.length, j.length), U = -1, z = 0; z < F; ++z) {
|
|
1771
1779
|
var de = R[z];
|
|
1772
|
-
if (de !==
|
|
1773
|
-
|
|
1780
|
+
if (de !== j[z]) return k(C[z], T[z]) < 0 ? C.substr(0, z) + T[z] + T.substr(z + 1) : k(C[z], j[z]) < 0 ? C.substr(0, z) + j[z] + T.substr(z + 1) : 0 <= U ? C.substr(0, U) + R[U] + T.substr(U + 1) : null;
|
|
1781
|
+
k(C[z], de) < 0 && (U = z);
|
|
1774
1782
|
}
|
|
1775
|
-
return F <
|
|
1783
|
+
return F < j.length && G === "next" ? C + T.substr(C.length) : F < C.length && G === "prev" ? C.substr(0, T.length) : U < 0 ? null : C.substr(0, U) + j[U] + T.substr(U + 1);
|
|
1776
1784
|
}(A, P, d[I], p[I], u, y);
|
|
1777
1785
|
N === null && D === null ? m = I + 1 : (D === null || 0 < u(D, N)) && (D = N);
|
|
1778
1786
|
}
|
|
1779
1787
|
return S(D !== null ? function() {
|
|
1780
1788
|
E.continue(D + w);
|
|
1781
|
-
} :
|
|
1789
|
+
} : v), !1;
|
|
1782
1790
|
}), e;
|
|
1783
1791
|
}
|
|
1784
1792
|
function Re(e, n, r, a) {
|
|
@@ -1888,9 +1896,9 @@ function Ma() {
|
|
|
1888
1896
|
try {
|
|
1889
1897
|
(w = A.reduce(function(P, D) {
|
|
1890
1898
|
for (var I = 0, N = P.length; I < N; ++I) {
|
|
1891
|
-
var
|
|
1892
|
-
if (a(D[0],
|
|
1893
|
-
|
|
1899
|
+
var C = P[I];
|
|
1900
|
+
if (a(D[0], C[1]) < 0 && 0 < a(D[1], C[0])) {
|
|
1901
|
+
C[0] = u(C[0], D[0]), C[1] = d(C[1], D[1]);
|
|
1894
1902
|
break;
|
|
1895
1903
|
}
|
|
1896
1904
|
}
|
|
@@ -1907,14 +1915,14 @@ function Ma() {
|
|
|
1907
1915
|
return 0 < i(P, w[m][0]);
|
|
1908
1916
|
} : function(P) {
|
|
1909
1917
|
return 0 <= i(P, w[m][0]);
|
|
1910
|
-
},
|
|
1918
|
+
}, v = E, A = new this.Collection(this, function() {
|
|
1911
1919
|
return Re(w[0][0], w[w.length - 1][1], !p, !y);
|
|
1912
1920
|
});
|
|
1913
1921
|
return A._ondirectionchange = function(P) {
|
|
1914
|
-
f = P === "next" ? (
|
|
1922
|
+
f = P === "next" ? (v = E, s) : (v = S, i), w.sort(O);
|
|
1915
1923
|
}, A._addAlgorithm(function(P, D, I) {
|
|
1916
|
-
for (var N,
|
|
1917
|
-
return !E(N =
|
|
1924
|
+
for (var N, C = P.key; v(C); ) if (++m === w.length) return D(I), !1;
|
|
1925
|
+
return !E(N = C) && !S(N) || (r._cmp(C, w[m][1]) === 0 || r._cmp(C, w[m][0]) === 0 || D(function() {
|
|
1918
1926
|
f === s ? P.continue(w[m][0]) : P.continue(w[m][1]);
|
|
1919
1927
|
}), !1);
|
|
1920
1928
|
}), A;
|
|
@@ -2068,21 +2076,21 @@ function Ma() {
|
|
|
2068
2076
|
return e == null ? ":id" : typeof e == "string" ? e : "[".concat(e.join("+"), "]");
|
|
2069
2077
|
}
|
|
2070
2078
|
function da(e, n, p) {
|
|
2071
|
-
function a(
|
|
2072
|
-
if (
|
|
2073
|
-
if (
|
|
2074
|
-
var m =
|
|
2075
|
-
return m === void 0 ? E === void 0 ? null : n.upperBound(E, !!
|
|
2079
|
+
function a(v) {
|
|
2080
|
+
if (v.type === 3) return null;
|
|
2081
|
+
if (v.type === 4) throw new Error("Cannot convert never type to IDBKeyRange");
|
|
2082
|
+
var m = v.lower, E = v.upper, S = v.lowerOpen, v = v.upperOpen;
|
|
2083
|
+
return m === void 0 ? E === void 0 ? null : n.upperBound(E, !!v) : E === void 0 ? n.lowerBound(m, !!S) : n.bound(m, E, !!S, !!v);
|
|
2076
2084
|
}
|
|
2077
2085
|
function s(O) {
|
|
2078
2086
|
var m, E = O.name;
|
|
2079
2087
|
return { name: E, schema: O, mutate: function(S) {
|
|
2080
|
-
var
|
|
2081
|
-
return new Promise(function(N,
|
|
2088
|
+
var v = S.trans, A = S.type, P = S.keys, D = S.values, I = S.range;
|
|
2089
|
+
return new Promise(function(N, C) {
|
|
2082
2090
|
N = Z(N);
|
|
2083
|
-
var R =
|
|
2084
|
-
if (
|
|
2085
|
-
var
|
|
2091
|
+
var R = v.objectStore(E), T = R.keyPath == null, j = A === "put" || A === "add";
|
|
2092
|
+
if (!j && A !== "delete" && A !== "deleteRange") throw new Error("Invalid operation type: " + A);
|
|
2093
|
+
var k, G = (P || D || { length: 1 }).length;
|
|
2086
2094
|
if (P && D && P.length !== D.length) throw new Error("Given keys array must have same length as given values array.");
|
|
2087
2095
|
if (G === 0) return N({ numFailures: 0, failures: {}, results: [], lastResult: void 0 });
|
|
2088
2096
|
function F(ce) {
|
|
@@ -2091,11 +2099,11 @@ function Ma() {
|
|
|
2091
2099
|
var U = [], z = [], de = 0;
|
|
2092
2100
|
if (A === "deleteRange") {
|
|
2093
2101
|
if (I.type === 4) return N({ numFailures: de, failures: z, results: [], lastResult: void 0 });
|
|
2094
|
-
I.type === 3 ? U.push(
|
|
2102
|
+
I.type === 3 ? U.push(k = R.clear()) : U.push(k = R.delete(a(I)));
|
|
2095
2103
|
} else {
|
|
2096
|
-
var T =
|
|
2097
|
-
if (
|
|
2098
|
-
else for (oe = 0; oe < G; ++oe) U.push(
|
|
2104
|
+
var T = j ? T ? [D, P] : [D, null] : [P, null], W = T[0], se = T[1];
|
|
2105
|
+
if (j) for (var oe = 0; oe < G; ++oe) U.push(k = se && se[oe] !== void 0 ? R[A](W[oe], se[oe]) : R[A](W[oe])), k.onerror = F;
|
|
2106
|
+
else for (oe = 0; oe < G; ++oe) U.push(k = R[A](W[oe])), k.onerror = F;
|
|
2099
2107
|
}
|
|
2100
2108
|
function qt(ce) {
|
|
2101
2109
|
ce = ce.target.result, U.forEach(function(Ve, Wn) {
|
|
@@ -2104,52 +2112,52 @@ function Ma() {
|
|
|
2104
2112
|
return Ve.result;
|
|
2105
2113
|
}), lastResult: ce });
|
|
2106
2114
|
}
|
|
2107
|
-
|
|
2115
|
+
k.onerror = function(ce) {
|
|
2108
2116
|
F(ce), qt(ce);
|
|
2109
|
-
},
|
|
2117
|
+
}, k.onsuccess = qt;
|
|
2110
2118
|
});
|
|
2111
2119
|
}, getMany: function(S) {
|
|
2112
|
-
var
|
|
2120
|
+
var v = S.trans, A = S.keys;
|
|
2113
2121
|
return new Promise(function(P, D) {
|
|
2114
2122
|
P = Z(P);
|
|
2115
|
-
for (var I, N =
|
|
2116
|
-
U = U.target, R[U._pos] = U.result,
|
|
2117
|
-
}, G = me(D), F = 0; F <
|
|
2123
|
+
for (var I, N = v.objectStore(E), C = A.length, R = new Array(C), T = 0, j = 0, k = function(U) {
|
|
2124
|
+
U = U.target, R[U._pos] = U.result, ++j === T && P(R);
|
|
2125
|
+
}, G = me(D), F = 0; F < C; ++F) A[F] != null && ((I = N.get(A[F]))._pos = F, I.onsuccess = k, I.onerror = G, ++T);
|
|
2118
2126
|
T === 0 && P(R);
|
|
2119
2127
|
});
|
|
2120
2128
|
}, get: function(S) {
|
|
2121
|
-
var
|
|
2129
|
+
var v = S.trans, A = S.key;
|
|
2122
2130
|
return new Promise(function(P, D) {
|
|
2123
2131
|
P = Z(P);
|
|
2124
|
-
var I =
|
|
2132
|
+
var I = v.objectStore(E).get(A);
|
|
2125
2133
|
I.onsuccess = function(N) {
|
|
2126
2134
|
return P(N.target.result);
|
|
2127
2135
|
}, I.onerror = me(D);
|
|
2128
2136
|
});
|
|
2129
2137
|
}, query: (m = y, function(S) {
|
|
2130
|
-
return new Promise(function(
|
|
2131
|
-
|
|
2132
|
-
var P, D, I, T = S.trans, N = S.values,
|
|
2133
|
-
if (
|
|
2134
|
-
m ? ((R = N ?
|
|
2135
|
-
return
|
|
2136
|
-
}, R.onerror = me(A)) : (P = 0, D = !N && "openKeyCursor" in
|
|
2138
|
+
return new Promise(function(v, A) {
|
|
2139
|
+
v = Z(v);
|
|
2140
|
+
var P, D, I, T = S.trans, N = S.values, C = S.limit, k = S.query, R = C === 1 / 0 ? void 0 : C, j = k.index, k = k.range, T = T.objectStore(E), j = j.isPrimaryKey ? T : T.index(j.name), k = a(k);
|
|
2141
|
+
if (C === 0) return v({ result: [] });
|
|
2142
|
+
m ? ((R = N ? j.getAll(k, R) : j.getAllKeys(k, R)).onsuccess = function(G) {
|
|
2143
|
+
return v({ result: G.target.result });
|
|
2144
|
+
}, R.onerror = me(A)) : (P = 0, D = !N && "openKeyCursor" in j ? j.openKeyCursor(k) : j.openCursor(k), I = [], D.onsuccess = function(G) {
|
|
2137
2145
|
var F = D.result;
|
|
2138
|
-
return F ? (I.push(N ? F.value : F.primaryKey), ++P ===
|
|
2146
|
+
return F ? (I.push(N ? F.value : F.primaryKey), ++P === C ? v({ result: I }) : void F.continue()) : v({ result: I });
|
|
2139
2147
|
}, D.onerror = me(A));
|
|
2140
2148
|
});
|
|
2141
2149
|
}), openCursor: function(S) {
|
|
2142
|
-
var
|
|
2143
|
-
return new Promise(function(N,
|
|
2150
|
+
var v = S.trans, A = S.values, P = S.query, D = S.reverse, I = S.unique;
|
|
2151
|
+
return new Promise(function(N, C) {
|
|
2144
2152
|
N = Z(N);
|
|
2145
|
-
var
|
|
2146
|
-
|
|
2147
|
-
var F, U, z, de, W =
|
|
2153
|
+
var j = P.index, R = P.range, T = v.objectStore(E), T = j.isPrimaryKey ? T : T.index(j.name), j = D ? I ? "prevunique" : "prev" : I ? "nextunique" : "next", k = !A && "openKeyCursor" in T ? T.openKeyCursor(a(R), j) : T.openCursor(a(R), j);
|
|
2154
|
+
k.onerror = me(C), k.onsuccess = Z(function(G) {
|
|
2155
|
+
var F, U, z, de, W = k.result;
|
|
2148
2156
|
W ? (W.___id = ++la, W.done = !1, F = W.continue.bind(W), U = (U = W.continuePrimaryKey) && U.bind(W), z = W.advance.bind(W), de = function() {
|
|
2149
2157
|
throw new Error("Cursor not stopped");
|
|
2150
|
-
}, W.trans =
|
|
2158
|
+
}, W.trans = v, W.stop = W.continue = W.continuePrimaryKey = W.advance = function() {
|
|
2151
2159
|
throw new Error("Cursor not started");
|
|
2152
|
-
}, W.fail = Z(
|
|
2160
|
+
}, W.fail = Z(C), W.next = function() {
|
|
2153
2161
|
var se = this, oe = 1;
|
|
2154
2162
|
return this.start(function() {
|
|
2155
2163
|
return oe-- ? se.continue() : se.stop();
|
|
@@ -2158,7 +2166,7 @@ function Ma() {
|
|
|
2158
2166
|
});
|
|
2159
2167
|
}, W.start = function(se) {
|
|
2160
2168
|
function oe() {
|
|
2161
|
-
if (
|
|
2169
|
+
if (k.result) try {
|
|
2162
2170
|
se();
|
|
2163
2171
|
} catch (ce) {
|
|
2164
2172
|
W.fail(ce);
|
|
@@ -2168,20 +2176,20 @@ function Ma() {
|
|
|
2168
2176
|
}, W.stop();
|
|
2169
2177
|
}
|
|
2170
2178
|
var qt = new Promise(function(ce, Ve) {
|
|
2171
|
-
ce = Z(ce),
|
|
2179
|
+
ce = Z(ce), k.onerror = me(Ve), W.fail = Ve, W.stop = function(Wn) {
|
|
2172
2180
|
W.stop = W.continue = W.continuePrimaryKey = W.advance = de, ce(Wn);
|
|
2173
2181
|
};
|
|
2174
2182
|
});
|
|
2175
|
-
return
|
|
2176
|
-
|
|
2183
|
+
return k.onsuccess = Z(function(ce) {
|
|
2184
|
+
k.onsuccess = oe, oe();
|
|
2177
2185
|
}), W.continue = F, W.continuePrimaryKey = U, W.advance = z, oe(), qt;
|
|
2178
2186
|
}, N(W)) : N(null);
|
|
2179
|
-
},
|
|
2187
|
+
}, C);
|
|
2180
2188
|
});
|
|
2181
2189
|
}, count: function(S) {
|
|
2182
|
-
var
|
|
2190
|
+
var v = S.query, A = S.trans, P = v.index, D = v.range;
|
|
2183
2191
|
return new Promise(function(I, N) {
|
|
2184
|
-
var
|
|
2192
|
+
var C = A.objectStore(E), R = P.isPrimaryKey ? C : C.index(P.name), C = a(D), R = C ? R.count(C) : R.count();
|
|
2185
2193
|
R.onsuccess = Z(function(T) {
|
|
2186
2194
|
return I(T.target.result);
|
|
2187
2195
|
}), R.onerror = me(N);
|
|
@@ -2191,15 +2199,15 @@ function Ma() {
|
|
|
2191
2199
|
var i, u, d, w = (u = p, d = br((i = e).objectStoreNames), { schema: { name: i.name, tables: d.map(function(O) {
|
|
2192
2200
|
return u.objectStore(O);
|
|
2193
2201
|
}).map(function(O) {
|
|
2194
|
-
var m = O.keyPath,
|
|
2202
|
+
var m = O.keyPath, v = O.autoIncrement, E = $(m), S = {}, v = { name: O.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: m == null, compound: E, keyPath: m, autoIncrement: v, unique: !0, extractKey: _n(m) }, indexes: br(O.indexNames).map(function(A) {
|
|
2195
2203
|
return O.index(A);
|
|
2196
2204
|
}).map(function(I) {
|
|
2197
|
-
var P = I.name, D = I.unique, N = I.multiEntry, I = I.keyPath, N = { name: P, compound:
|
|
2205
|
+
var P = I.name, D = I.unique, N = I.multiEntry, I = I.keyPath, N = { name: P, compound: $(I), keyPath: I, unique: D, multiEntry: N, extractKey: _n(I) };
|
|
2198
2206
|
return S[vt(I)] = N;
|
|
2199
2207
|
}), getIndexByKeyPath: function(A) {
|
|
2200
2208
|
return S[vt(A)];
|
|
2201
2209
|
} };
|
|
2202
|
-
return S[":id"] =
|
|
2210
|
+
return S[":id"] = v.primaryKey, m != null && (S[vt(m)] = v.primaryKey), v;
|
|
2203
2211
|
}) }, hasGetAll: 0 < d.length && "getAll" in u.objectStore(d[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), p = w.schema, y = w.hasGetAll, w = p.tables.map(s), f = {};
|
|
2204
2212
|
return w.forEach(function(O) {
|
|
2205
2213
|
return f[O.name] = O;
|
|
@@ -2256,45 +2264,45 @@ function Ma() {
|
|
|
2256
2264
|
return B.trans = i, B.transless = d, n !== 0 ? (Lt(e, r), y = n, ((p = i).storeNames.includes("$meta") ? p.table("$meta").get("version").then(function(w) {
|
|
2257
2265
|
return w ?? y;
|
|
2258
2266
|
}) : M.resolve(y)).then(function(w) {
|
|
2259
|
-
return O = w, m = i, E = r, S = [], w = (f = e)._versions,
|
|
2267
|
+
return O = w, m = i, E = r, S = [], w = (f = e)._versions, v = f._dbSchema = Ut(0, f.idbdb, E), (w = w.filter(function(A) {
|
|
2260
2268
|
return A._cfg.version >= O;
|
|
2261
2269
|
})).length !== 0 ? (w.forEach(function(A) {
|
|
2262
2270
|
S.push(function() {
|
|
2263
|
-
var P =
|
|
2264
|
-
zt(f, P, E), zt(f, D, E),
|
|
2271
|
+
var P = v, D = A._cfg.dbschema;
|
|
2272
|
+
zt(f, P, E), zt(f, D, E), v = f._dbSchema = D;
|
|
2265
2273
|
var I = Pn(P, D);
|
|
2266
|
-
I.add.forEach(function(
|
|
2267
|
-
Dn(E,
|
|
2268
|
-
}), I.change.forEach(function(
|
|
2269
|
-
if (
|
|
2270
|
-
var
|
|
2271
|
-
|
|
2272
|
-
return Ft(
|
|
2273
|
-
}),
|
|
2274
|
-
|
|
2275
|
-
}),
|
|
2276
|
-
return
|
|
2274
|
+
I.add.forEach(function(j) {
|
|
2275
|
+
Dn(E, j[0], j[1].primKey, j[1].indexes);
|
|
2276
|
+
}), I.change.forEach(function(j) {
|
|
2277
|
+
if (j.recreate) throw new L.Upgrade("Not yet support for changing primary key");
|
|
2278
|
+
var k = E.objectStore(j.name);
|
|
2279
|
+
j.add.forEach(function(G) {
|
|
2280
|
+
return Ft(k, G);
|
|
2281
|
+
}), j.change.forEach(function(G) {
|
|
2282
|
+
k.deleteIndex(G.name), Ft(k, G);
|
|
2283
|
+
}), j.del.forEach(function(G) {
|
|
2284
|
+
return k.deleteIndex(G);
|
|
2277
2285
|
});
|
|
2278
2286
|
});
|
|
2279
2287
|
var N = A._cfg.contentUpgrade;
|
|
2280
2288
|
if (N && A._cfg.version > O) {
|
|
2281
2289
|
Lt(f, E), m._memoizedTables = {};
|
|
2282
|
-
var
|
|
2283
|
-
I.del.forEach(function(
|
|
2284
|
-
|
|
2285
|
-
}), An(f, [f.Transaction.prototype]), Wt(f, [f.Transaction.prototype], C
|
|
2290
|
+
var C = Qn(D);
|
|
2291
|
+
I.del.forEach(function(j) {
|
|
2292
|
+
C[j] = P[j];
|
|
2293
|
+
}), An(f, [f.Transaction.prototype]), Wt(f, [f.Transaction.prototype], x(C), C), m.schema = C;
|
|
2286
2294
|
var R, T = an(N);
|
|
2287
2295
|
return T && et(), I = M.follow(function() {
|
|
2288
|
-
var
|
|
2289
|
-
(R = N(m)) && T && (
|
|
2296
|
+
var j;
|
|
2297
|
+
(R = N(m)) && T && (j = Ie.bind(null, null), R.then(j, j));
|
|
2290
2298
|
}), R && typeof R.then == "function" ? M.resolve(R) : I.then(function() {
|
|
2291
2299
|
return R;
|
|
2292
2300
|
});
|
|
2293
2301
|
}
|
|
2294
2302
|
}), S.push(function(P) {
|
|
2295
2303
|
var D, I, N = A._cfg.dbschema;
|
|
2296
|
-
D = N, I = P, [].slice.call(I.db.objectStoreNames).forEach(function(
|
|
2297
|
-
return D[
|
|
2304
|
+
D = N, I = P, [].slice.call(I.db.objectStoreNames).forEach(function(C) {
|
|
2305
|
+
return D[C] == null && I.db.deleteObjectStore(C);
|
|
2298
2306
|
}), An(f, [f.Transaction.prototype]), Wt(f, [f.Transaction.prototype], f._storeNames, f._dbSchema), m.schema = f._dbSchema;
|
|
2299
2307
|
}), S.push(function(P) {
|
|
2300
2308
|
f.idbdb.objectStoreNames.contains("$meta") && (Math.ceil(f.idbdb.version / 10) === A._cfg.version ? (f.idbdb.deleteObjectStore("$meta"), delete f._dbSchema.$meta, f._storeNames = f._storeNames.filter(function(D) {
|
|
@@ -2304,10 +2312,10 @@ function Ma() {
|
|
|
2304
2312
|
}), function A() {
|
|
2305
2313
|
return S.length ? M.resolve(S.shift()(m.idbtrans)).then(A) : M.resolve();
|
|
2306
2314
|
}().then(function() {
|
|
2307
|
-
vr(
|
|
2315
|
+
vr(v, E);
|
|
2308
2316
|
})) : M.resolve();
|
|
2309
|
-
var f, O, m, E, S,
|
|
2310
|
-
}).catch(u)) : (
|
|
2317
|
+
var f, O, m, E, S, v;
|
|
2318
|
+
}).catch(u)) : (x(s).forEach(function(w) {
|
|
2311
2319
|
Dn(r, w, s[w].primKey, s[w].indexes);
|
|
2312
2320
|
}), Lt(e, r), void M.follow(function() {
|
|
2313
2321
|
return e.on.populate.fire(i);
|
|
@@ -2358,7 +2366,7 @@ function Ma() {
|
|
|
2358
2366
|
}), s;
|
|
2359
2367
|
}
|
|
2360
2368
|
function vr(e, n) {
|
|
2361
|
-
|
|
2369
|
+
x(e).forEach(function(r) {
|
|
2362
2370
|
n.db.objectStoreNames.contains(r) || (pe && console.debug("Dexie: Creating missing table", r), Dn(n, r, e[r].primKey, e[r].indexes));
|
|
2363
2371
|
});
|
|
2364
2372
|
}
|
|
@@ -2384,16 +2392,16 @@ function Ma() {
|
|
|
2384
2392
|
!n[i] || (y = n[i].idxByName[w]) && (y.name = p, delete n[i].idxByName[w], n[i].idxByName[p] = y);
|
|
2385
2393
|
}
|
|
2386
2394
|
}
|
|
2387
|
-
typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) &&
|
|
2395
|
+
typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && b.WorkerGlobalScope && b instanceof b.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (e._hasGetAll = !1);
|
|
2388
2396
|
}
|
|
2389
2397
|
function Er(e) {
|
|
2390
2398
|
return e.split(",").map(function(n, r) {
|
|
2391
2399
|
var a = (n = n.trim()).replace(/([&*]|\+\+)/g, ""), s = /^\[/.test(a) ? a.match(/^\[(.*)\]$/)[1].split("+") : a;
|
|
2392
|
-
return Sn(a, s || null, /\&/.test(n), /\*/.test(n), /\+\+/.test(n),
|
|
2400
|
+
return Sn(a, s || null, /\&/.test(n), /\*/.test(n), /\+\+/.test(n), $(s), r === 0);
|
|
2393
2401
|
});
|
|
2394
2402
|
}
|
|
2395
2403
|
var ma = (Ht.prototype._parseStoresSpec = function(e, n) {
|
|
2396
|
-
|
|
2404
|
+
x(e).forEach(function(r) {
|
|
2397
2405
|
if (e[r] !== null) {
|
|
2398
2406
|
var a = Er(e[r]), s = a.shift();
|
|
2399
2407
|
if (s.unique = !0, s.multi) throw new L.Schema("Primary key cannot be multi-valued");
|
|
@@ -2409,7 +2417,7 @@ function Ma() {
|
|
|
2409
2417
|
var r = n._versions, a = {}, s = {};
|
|
2410
2418
|
return r.forEach(function(i) {
|
|
2411
2419
|
te(a, i._cfg.storesSource), s = i._cfg.dbschema = {}, i._parseStoresSpec(a, s);
|
|
2412
|
-
}), n._dbSchema = s, An(n, [n._allTables, n, n.Transaction.prototype]), Wt(n, [n._allTables, n, n.Transaction.prototype, this._cfg.tables],
|
|
2420
|
+
}), n._dbSchema = s, An(n, [n._allTables, n, n.Transaction.prototype]), Wt(n, [n._allTables, n, n.Transaction.prototype, this._cfg.tables], x(s), s), n._storeNames = x(s), this;
|
|
2413
2421
|
}, Ht.prototype.upgrade = function(e) {
|
|
2414
2422
|
return this._cfg.contentUpgrade = on(this._cfg.contentUpgrade || Q, e), this;
|
|
2415
2423
|
}, Ht);
|
|
@@ -2492,7 +2500,7 @@ function Ma() {
|
|
|
2492
2500
|
return (n ? r ? Math.max(n.d, r.d) : n.d : r ? r.d : 0) + 1;
|
|
2493
2501
|
}
|
|
2494
2502
|
function Yt(e, n) {
|
|
2495
|
-
return
|
|
2503
|
+
return x(n).forEach(function(r) {
|
|
2496
2504
|
e[r] ? wt(e[r], n[r]) : e[r] = function a(s) {
|
|
2497
2505
|
var i, u, d = {};
|
|
2498
2506
|
for (i in s) ie(s, i) && (u = s[i], d[i] = !u || typeof u != "object" || Jn.has(u.constructor) ? u : a(u));
|
|
@@ -2542,8 +2550,8 @@ function Ma() {
|
|
|
2542
2550
|
for (var s = [], i = 0, u = Object.entries(e.queries.query); i < u.length; i++) {
|
|
2543
2551
|
for (var d = u[i], p = d[0], y = [], w = 0, f = d[1]; w < f.length; w++) {
|
|
2544
2552
|
var O = f[w];
|
|
2545
|
-
xn(n, O.obsSet) ? O.subscribers.forEach(function(
|
|
2546
|
-
return r.add(
|
|
2553
|
+
xn(n, O.obsSet) ? O.subscribers.forEach(function(v) {
|
|
2554
|
+
return r.add(v);
|
|
2547
2555
|
}) : a && y.push(O);
|
|
2548
2556
|
}
|
|
2549
2557
|
a && s.push([p, y]);
|
|
@@ -2568,17 +2576,17 @@ function Ma() {
|
|
|
2568
2576
|
if (u(), !r) throw new L.MissingAPI();
|
|
2569
2577
|
var E = e.name, S = n.autoSchema || !s ? r.open(E) : r.open(E, s);
|
|
2570
2578
|
if (!S) throw new L.MissingAPI();
|
|
2571
|
-
S.onerror = me(m), S.onblocked = Z(e._fireOnBlocked), S.onupgradeneeded = Z(function(
|
|
2579
|
+
S.onerror = me(m), S.onblocked = Z(e._fireOnBlocked), S.onupgradeneeded = Z(function(v) {
|
|
2572
2580
|
var A;
|
|
2573
2581
|
w = S.transaction, n.autoSchema && !e._options.allowEmptyDB ? (S.onerror = mt, w.abort(), S.result.close(), (A = r.deleteDatabase(E)).onsuccess = A.onerror = Z(function() {
|
|
2574
2582
|
m(new L.NoSuchDatabase("Database ".concat(E, " doesnt exist")));
|
|
2575
|
-
})) : (w.onerror = me(m),
|
|
2583
|
+
})) : (w.onerror = me(m), v = v.oldVersion > Math.pow(2, 62) ? 0 : v.oldVersion, f = v < 1, e.idbdb = S.result, i && pa(e, w), ga(e, v / 10, w, m));
|
|
2576
2584
|
}, m), S.onsuccess = Z(function() {
|
|
2577
2585
|
w = null;
|
|
2578
|
-
var
|
|
2579
|
-
if (0 <
|
|
2580
|
-
var R = N.transaction((D =
|
|
2581
|
-
if (n.autoSchema) A = N, P = R, (
|
|
2586
|
+
var v, A, P, D, I, N = e.idbdb = S.result, C = At(N.objectStoreNames);
|
|
2587
|
+
if (0 < C.length) try {
|
|
2588
|
+
var R = N.transaction((D = C).length === 1 ? D[0] : D, "readonly");
|
|
2589
|
+
if (n.autoSchema) A = N, P = R, (v = e).verno = A.version / 10, P = v._dbSchema = Ut(0, A, P), v._storeNames = At(A.objectStoreNames, 0), Wt(v, [v._allTables], x(P), P);
|
|
2582
2590
|
else if (zt(e, e._dbSchema, R), ((I = Pn(Ut(0, (I = e).idbdb, R), I._dbSchema)).add.length || I.change.some(function(T) {
|
|
2583
2591
|
return T.add.length || T.change.length;
|
|
2584
2592
|
})) && !i) return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."), N.close(), s = N.version + 1, i = !0, O(d());
|
|
@@ -2651,21 +2659,21 @@ function Ma() {
|
|
|
2651
2659
|
function s(i) {
|
|
2652
2660
|
return function(p) {
|
|
2653
2661
|
var d = i(p), p = d.value;
|
|
2654
|
-
return d.done ? p : p && typeof p.then == "function" ? p.then(r, a) :
|
|
2662
|
+
return d.done ? p : p && typeof p.then == "function" ? p.then(r, a) : $(p) ? Promise.all(p).then(r, a) : r(p);
|
|
2655
2663
|
};
|
|
2656
2664
|
}
|
|
2657
2665
|
return s(n)();
|
|
2658
2666
|
}
|
|
2659
2667
|
function Xt(e, n, r) {
|
|
2660
|
-
for (var a =
|
|
2668
|
+
for (var a = $(e) ? e.slice() : [e], s = 0; s < r; ++s) a.push(n);
|
|
2661
2669
|
return a;
|
|
2662
2670
|
}
|
|
2663
2671
|
var ba = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
|
|
2664
2672
|
return l(l({}, e), { table: function(n) {
|
|
2665
2673
|
var r = e.table(n), a = r.schema, s = {}, i = [];
|
|
2666
2674
|
function u(f, O, m) {
|
|
2667
|
-
var E = vt(f), S = s[E] = s[E] || [],
|
|
2668
|
-
return S.push(A), A.isPrimaryKey || i.push(A), 1 <
|
|
2675
|
+
var E = vt(f), S = s[E] = s[E] || [], v = f == null ? 0 : typeof f == "string" ? 1 : f.length, A = 0 < O, A = l(l({}, m), { name: A ? "".concat(E, "(virtual-from:").concat(m.name, ")") : m.name, lowLevelIndex: m, isVirtual: A, keyTail: O, keyLength: v, extractKey: _n(f), unique: !A && m.unique });
|
|
2676
|
+
return S.push(A), A.isPrimaryKey || i.push(A), 1 < v && u(v === 2 ? f[0] : f.slice(0, v - 1), O + 1, m), S.sort(function(P, D) {
|
|
2669
2677
|
return P.keyTail - D.keyTail;
|
|
2670
2678
|
}), A;
|
|
2671
2679
|
}
|
|
@@ -2687,9 +2695,9 @@ function Ma() {
|
|
|
2687
2695
|
}, openCursor: function(f) {
|
|
2688
2696
|
var O = f.query.index, m = O.keyTail, E = O.isVirtual, S = O.keyLength;
|
|
2689
2697
|
return E ? r.openCursor(w(f)).then(function(A) {
|
|
2690
|
-
return A &&
|
|
2698
|
+
return A && v(A);
|
|
2691
2699
|
}) : r.openCursor(f);
|
|
2692
|
-
function
|
|
2700
|
+
function v(A) {
|
|
2693
2701
|
return Object.create(A, { continue: { value: function(P) {
|
|
2694
2702
|
P != null ? A.continue(Xt(P, f.reverse ? e.MAX_KEY : e.MIN_KEY, m)) : f.unique ? A.continue(A.key.slice(0, S).concat(f.reverse ? e.MIN_KEY : e.MAX_KEY, m)) : A.continue();
|
|
2695
2703
|
} }, continuePrimaryKey: { value: function(P, D) {
|
|
@@ -2707,10 +2715,10 @@ function Ma() {
|
|
|
2707
2715
|
} });
|
|
2708
2716
|
} };
|
|
2709
2717
|
function Mn(e, n, r, a) {
|
|
2710
|
-
return r = r || {}, a = a || "",
|
|
2718
|
+
return r = r || {}, a = a || "", x(e).forEach(function(s) {
|
|
2711
2719
|
var i, u, d;
|
|
2712
2720
|
ie(n, s) ? (i = e[s], u = n[s], typeof i == "object" && typeof u == "object" && i && u ? (d = nn(i)) !== nn(u) ? r[a + s] = n[s] : d === "Object" ? Mn(i, u, r, a + s + ".") : i !== u && (r[a + s] = n[s]) : i !== u && (r[a + s] = n[s])) : r[a + s] = void 0;
|
|
2713
|
-
}),
|
|
2721
|
+
}), x(n).forEach(function(s) {
|
|
2714
2722
|
ie(e, s) || (r[a + s] = n[s]);
|
|
2715
2723
|
}), r;
|
|
2716
2724
|
}
|
|
@@ -2743,9 +2751,9 @@ function Ma() {
|
|
|
2743
2751
|
return i._promise("readwrite", function() {
|
|
2744
2752
|
return function f(O, m, E) {
|
|
2745
2753
|
return r.query({ trans: O, values: !1, query: { index: a, range: m }, limit: E }).then(function(S) {
|
|
2746
|
-
var
|
|
2747
|
-
return w({ type: "delete", keys:
|
|
2748
|
-
return 0 < A.numFailures ? Promise.reject(A.failures[0]) :
|
|
2754
|
+
var v = S.result;
|
|
2755
|
+
return w({ type: "delete", keys: v, trans: O }).then(function(A) {
|
|
2756
|
+
return 0 < A.numFailures ? Promise.reject(A.failures[0]) : v.length < E ? { failures: [], numFailures: 0, lastResult: void 0 } : f(O, l(l({}, m), { lower: v[v.length - 1], lowerOpen: !0 }), E);
|
|
2749
2757
|
});
|
|
2750
2758
|
});
|
|
2751
2759
|
}(s.trans, s.range, 1e4);
|
|
@@ -2753,21 +2761,21 @@ function Ma() {
|
|
|
2753
2761
|
}
|
|
2754
2762
|
return r.mutate(s);
|
|
2755
2763
|
function w(f) {
|
|
2756
|
-
var O, m, E, S = B.trans,
|
|
2757
|
-
if (!
|
|
2758
|
-
return (f = f.type === "add" || f.type === "put" ? l(l({}, f), { keys:
|
|
2759
|
-
var P =
|
|
2760
|
-
var N,
|
|
2761
|
-
return f.type === "delete" ? d.fire.call(
|
|
2762
|
-
ie(R,
|
|
2763
|
-
}))),
|
|
2764
|
+
var O, m, E, S = B.trans, v = f.keys || Gn(a, f);
|
|
2765
|
+
if (!v) throw new Error("Keys missing");
|
|
2766
|
+
return (f = f.type === "add" || f.type === "put" ? l(l({}, f), { keys: v }) : l({}, f)).type !== "delete" && (f.values = g([], f.values)), f.keys && (f.keys = g([], f.keys)), O = r, E = v, ((m = f).type === "add" ? Promise.resolve([]) : O.getMany({ trans: m.trans, keys: E, cache: "immutable" })).then(function(A) {
|
|
2767
|
+
var P = v.map(function(D, I) {
|
|
2768
|
+
var N, C, R, T = A[I], j = { onerror: null, onsuccess: null };
|
|
2769
|
+
return f.type === "delete" ? d.fire.call(j, D, T, S) : f.type === "add" || T === void 0 ? (N = p.fire.call(j, D, f.values[I], S), D == null && N != null && (f.keys[I] = D = N, a.outbound || ue(f.values[I], a.keyPath, D))) : (N = Mn(T, f.values[I]), (C = y.fire.call(j, N, D, T, S)) && (R = f.values[I], Object.keys(C).forEach(function(k) {
|
|
2770
|
+
ie(R, k) ? R[k] = C[k] : ue(R, k, C[k]);
|
|
2771
|
+
}))), j;
|
|
2764
2772
|
});
|
|
2765
2773
|
return r.mutate(f).then(function(D) {
|
|
2766
|
-
for (var I = D.failures, N = D.results,
|
|
2767
|
-
var T = (N ||
|
|
2768
|
-
T == null ?
|
|
2774
|
+
for (var I = D.failures, N = D.results, C = D.numFailures, D = D.lastResult, R = 0; R < v.length; ++R) {
|
|
2775
|
+
var T = (N || v)[R], j = P[R];
|
|
2776
|
+
T == null ? j.onerror && j.onerror(I[R]) : j.onsuccess && j.onsuccess(f.type === "put" && A[R] ? f.values[R] : T);
|
|
2769
2777
|
}
|
|
2770
|
-
return { failures: I, results: N, numFailures:
|
|
2778
|
+
return { failures: I, results: N, numFailures: C, lastResult: D };
|
|
2771
2779
|
}).catch(function(D) {
|
|
2772
2780
|
return P.forEach(function(I) {
|
|
2773
2781
|
return I.onerror && I.onerror(D);
|
|
@@ -2824,37 +2832,37 @@ function Ma() {
|
|
|
2824
2832
|
var s = e.table(a), i = s.schema, u = i.primaryKey, f = i.indexes, d = u.extractKey, p = u.outbound, y = u.autoIncrement && f.filter(function(m) {
|
|
2825
2833
|
return m.compound && m.keyPath.includes(u.keyPath);
|
|
2826
2834
|
}), w = l(l({}, s), { mutate: function(m) {
|
|
2827
|
-
function E(
|
|
2828
|
-
return
|
|
2835
|
+
function E(k) {
|
|
2836
|
+
return k = "idb://".concat(n, "/").concat(a, "/").concat(k), D[k] || (D[k] = new ae());
|
|
2829
2837
|
}
|
|
2830
|
-
var S,
|
|
2831
|
-
return
|
|
2832
|
-
}), m.values] : [], R =
|
|
2833
|
-
return
|
|
2834
|
-
var G = S(
|
|
2838
|
+
var S, v, A, P = m.trans, D = m.mutatedParts || (m.mutatedParts = {}), I = E(""), N = E(":dels"), C = m.type, j = m.type === "deleteRange" ? [m.range] : m.type === "delete" ? [m.keys] : m.values.length < 50 ? [Gn(u, m).filter(function(k) {
|
|
2839
|
+
return k;
|
|
2840
|
+
}), m.values] : [], R = j[0], T = j[1], j = m.trans._cache;
|
|
2841
|
+
return $(R) ? (I.addKeys(R), (j = C === "delete" || R.length === T.length ? Ar(R, j) : null) || N.addKeys(R), (j || T) && (S = E, v = j, A = T, i.indexes.forEach(function(k) {
|
|
2842
|
+
var G = S(k.name || "");
|
|
2835
2843
|
function F(z) {
|
|
2836
|
-
return z != null ?
|
|
2844
|
+
return z != null ? k.extractKey(z) : null;
|
|
2837
2845
|
}
|
|
2838
2846
|
function U(z) {
|
|
2839
|
-
return
|
|
2847
|
+
return k.multiEntry && $(z) ? z.forEach(function(de) {
|
|
2840
2848
|
return G.addKey(de);
|
|
2841
2849
|
}) : G.addKey(z);
|
|
2842
2850
|
}
|
|
2843
|
-
(
|
|
2844
|
-
var W =
|
|
2851
|
+
(v || A).forEach(function(z, se) {
|
|
2852
|
+
var W = v && F(v[se]), se = A && F(A[se]);
|
|
2845
2853
|
H(W, se) !== 0 && (W != null && U(W), se != null && U(se));
|
|
2846
2854
|
});
|
|
2847
|
-
}))) : R ? (T = { from: (T = R.lower) !== null && T !== void 0 ? T : e.MIN_KEY, to: (T = R.upper) !== null && T !== void 0 ? T : e.MAX_KEY }, N.add(T), I.add(T)) : (I.add(r), N.add(r), i.indexes.forEach(function(
|
|
2848
|
-
return E(
|
|
2849
|
-
})), s.mutate(m).then(function(
|
|
2850
|
-
return !R || m.type !== "add" && m.type !== "put" || (I.addKeys(
|
|
2855
|
+
}))) : R ? (T = { from: (T = R.lower) !== null && T !== void 0 ? T : e.MIN_KEY, to: (T = R.upper) !== null && T !== void 0 ? T : e.MAX_KEY }, N.add(T), I.add(T)) : (I.add(r), N.add(r), i.indexes.forEach(function(k) {
|
|
2856
|
+
return E(k.name).add(r);
|
|
2857
|
+
})), s.mutate(m).then(function(k) {
|
|
2858
|
+
return !R || m.type !== "add" && m.type !== "put" || (I.addKeys(k.results), y && y.forEach(function(G) {
|
|
2851
2859
|
for (var F = m.values.map(function(W) {
|
|
2852
2860
|
return G.extractKey(W);
|
|
2853
2861
|
}), U = G.keyPath.findIndex(function(W) {
|
|
2854
2862
|
return W === u.keyPath;
|
|
2855
|
-
}), z = 0, de =
|
|
2863
|
+
}), z = 0, de = k.results.length; z < de; ++z) F[z][U] = k.results[z];
|
|
2856
2864
|
E(G.name).addKeys(F);
|
|
2857
|
-
})), P.mutatedParts = Yt(P.mutatedParts || {}, D),
|
|
2865
|
+
})), P.mutatedParts = Yt(P.mutatedParts || {}, D), k;
|
|
2858
2866
|
});
|
|
2859
2867
|
} }), f = function(E) {
|
|
2860
2868
|
var S = E.query, E = S.index, S = S.range;
|
|
@@ -2864,14 +2872,14 @@ function Ma() {
|
|
|
2864
2872
|
}, getMany: function(m) {
|
|
2865
2873
|
return [u, new ae().addKeys(m.keys)];
|
|
2866
2874
|
}, count: f, query: f, openCursor: f };
|
|
2867
|
-
return
|
|
2875
|
+
return x(O).forEach(function(m) {
|
|
2868
2876
|
w[m] = function(E) {
|
|
2869
|
-
var S = B.subscr,
|
|
2870
|
-
if (
|
|
2877
|
+
var S = B.subscr, v = !!S, A = Pr(B, s) && Dr(m, E) ? E.obsSet = {} : S;
|
|
2878
|
+
if (v) {
|
|
2871
2879
|
var P = function(T) {
|
|
2872
2880
|
return T = "idb://".concat(n, "/").concat(a, "/").concat(T), A[T] || (A[T] = new ae());
|
|
2873
|
-
}, D = P(""), I = P(":dels"), S = O[m](E),
|
|
2874
|
-
if ((m === "query" &&
|
|
2881
|
+
}, D = P(""), I = P(":dels"), S = O[m](E), v = S[0], S = S[1];
|
|
2882
|
+
if ((m === "query" && v.isPrimaryKey && !E.values ? I : P(v.name || "")).add(S), !v.isPrimaryKey) {
|
|
2875
2883
|
if (m !== "count") {
|
|
2876
2884
|
var N = m === "query" && p && E.values && s.query(l(l({}, E), { values: !1 }));
|
|
2877
2885
|
return s[m].apply(this, arguments).then(function(T) {
|
|
@@ -2879,17 +2887,17 @@ function Ma() {
|
|
|
2879
2887
|
if (p && E.values) return N.then(function(F) {
|
|
2880
2888
|
return F = F.result, D.addKeys(F), T;
|
|
2881
2889
|
});
|
|
2882
|
-
var
|
|
2883
|
-
(E.values ? D : I).addKeys(
|
|
2890
|
+
var j = E.values ? T.result.map(d) : T.result;
|
|
2891
|
+
(E.values ? D : I).addKeys(j);
|
|
2884
2892
|
} else if (m === "openCursor") {
|
|
2885
|
-
var
|
|
2886
|
-
return
|
|
2887
|
-
return I.addKey(
|
|
2893
|
+
var k = T, G = E.values;
|
|
2894
|
+
return k && Object.create(k, { key: { get: function() {
|
|
2895
|
+
return I.addKey(k.primaryKey), k.key;
|
|
2888
2896
|
} }, primaryKey: { get: function() {
|
|
2889
|
-
var F =
|
|
2897
|
+
var F = k.primaryKey;
|
|
2890
2898
|
return I.addKey(F), F;
|
|
2891
2899
|
} }, value: { get: function() {
|
|
2892
|
-
return G && D.addKey(
|
|
2900
|
+
return G && D.addKey(k.primaryKey), k.value;
|
|
2893
2901
|
} } });
|
|
2894
2902
|
}
|
|
2895
2903
|
return T;
|
|
@@ -2907,9 +2915,9 @@ function Ma() {
|
|
|
2907
2915
|
if (r.numFailures === 0) return n;
|
|
2908
2916
|
if (n.type === "deleteRange") return null;
|
|
2909
2917
|
var a = n.keys ? n.keys.length : "values" in n && n.values ? n.values.length : 1;
|
|
2910
|
-
return r.numFailures === a ? null : (n = l({}, n),
|
|
2918
|
+
return r.numFailures === a ? null : (n = l({}, n), $(n.keys) && (n.keys = n.keys.filter(function(s, i) {
|
|
2911
2919
|
return !(i in r.failures);
|
|
2912
|
-
})), "values" in n &&
|
|
2920
|
+
})), "values" in n && $(n.values) && (n.values = n.values.filter(function(s, i) {
|
|
2913
2921
|
return !(i in r.failures);
|
|
2914
2922
|
})), n);
|
|
2915
2923
|
}
|
|
@@ -2920,23 +2928,23 @@ function Ma() {
|
|
|
2920
2928
|
function Nr(e, n, O, a, s, i) {
|
|
2921
2929
|
if (!O || O.length === 0) return e;
|
|
2922
2930
|
var u = n.query.index, d = u.multiEntry, p = n.query.range, y = a.schema.primaryKey.extractKey, w = u.extractKey, f = (u.lowLevelIndex || u).extractKey, O = O.reduce(function(m, E) {
|
|
2923
|
-
var S = m,
|
|
2931
|
+
var S = m, v = [];
|
|
2924
2932
|
if (E.type === "add" || E.type === "put") for (var A = new ae(), P = E.values.length - 1; 0 <= P; --P) {
|
|
2925
2933
|
var D, I = E.values[P], N = y(I);
|
|
2926
|
-
A.hasKey(N) || (D = w(I), (d &&
|
|
2927
|
-
return Kn(
|
|
2928
|
-
}) : Kn(D, p)) && (A.addKey(N),
|
|
2934
|
+
A.hasKey(N) || (D = w(I), (d && $(D) ? D.some(function(k) {
|
|
2935
|
+
return Kn(k, p);
|
|
2936
|
+
}) : Kn(D, p)) && (A.addKey(N), v.push(I)));
|
|
2929
2937
|
}
|
|
2930
2938
|
switch (E.type) {
|
|
2931
2939
|
case "add":
|
|
2932
|
-
var
|
|
2940
|
+
var C = new ae().addKeys(n.values ? m.map(function(G) {
|
|
2933
2941
|
return y(G);
|
|
2934
|
-
}) : m), S = m.concat(n.values ?
|
|
2935
|
-
return G = y(G), !
|
|
2936
|
-
}) :
|
|
2942
|
+
}) : m), S = m.concat(n.values ? v.filter(function(G) {
|
|
2943
|
+
return G = y(G), !C.hasKey(G) && (C.addKey(G), !0);
|
|
2944
|
+
}) : v.map(function(G) {
|
|
2937
2945
|
return y(G);
|
|
2938
2946
|
}).filter(function(G) {
|
|
2939
|
-
return !
|
|
2947
|
+
return !C.hasKey(G) && (C.addKey(G), !0);
|
|
2940
2948
|
}));
|
|
2941
2949
|
break;
|
|
2942
2950
|
case "put":
|
|
@@ -2945,7 +2953,7 @@ function Ma() {
|
|
|
2945
2953
|
}));
|
|
2946
2954
|
S = m.filter(function(G) {
|
|
2947
2955
|
return !R.hasKey(n.values ? y(G) : G);
|
|
2948
|
-
}).concat(n.values ?
|
|
2956
|
+
}).concat(n.values ? v : v.map(function(G) {
|
|
2949
2957
|
return y(G);
|
|
2950
2958
|
}));
|
|
2951
2959
|
break;
|
|
@@ -2956,9 +2964,9 @@ function Ma() {
|
|
|
2956
2964
|
});
|
|
2957
2965
|
break;
|
|
2958
2966
|
case "deleteRange":
|
|
2959
|
-
var
|
|
2967
|
+
var j = E.range;
|
|
2960
2968
|
S = m.filter(function(G) {
|
|
2961
|
-
return !Kn(y(G),
|
|
2969
|
+
return !Kn(y(G), j);
|
|
2962
2970
|
});
|
|
2963
2971
|
}
|
|
2964
2972
|
return S;
|
|
@@ -3012,16 +3020,16 @@ function Ma() {
|
|
|
3012
3020
|
var E = e.table(O), S = m.optimisticOps.filter(function(G) {
|
|
3013
3021
|
return G.trans === d;
|
|
3014
3022
|
});
|
|
3015
|
-
if (d._explicit && p && d.mutatedParts) for (var
|
|
3023
|
+
if (d._explicit && p && d.mutatedParts) for (var v = 0, A = Object.values(m.queries.query); v < A.length; v++) for (var P = 0, D = (C = A[v]).slice(); P < D.length; P++) xn((R = D[P]).obsSet, d.mutatedParts) && (je(C, R), R.subscribers.forEach(function(G) {
|
|
3016
3024
|
return y.add(G);
|
|
3017
3025
|
}));
|
|
3018
3026
|
else if (0 < S.length) {
|
|
3019
3027
|
m.optimisticOps = m.optimisticOps.filter(function(G) {
|
|
3020
3028
|
return G.trans !== d;
|
|
3021
3029
|
});
|
|
3022
|
-
for (var I = 0, N = Object.values(m.queries.query); I < N.length; I++) for (var
|
|
3030
|
+
for (var I = 0, N = Object.values(m.queries.query); I < N.length; I++) for (var C, R, T, j = 0, k = (C = N[I]).slice(); j < k.length; j++) (R = k[j]).res != null && d.mutatedParts && (p && !R.dirty ? (T = Object.isFrozen(R.res), T = Nr(R.res, R.req, S, E, R, T), R.dirty ? (je(C, R), R.subscribers.forEach(function(G) {
|
|
3023
3031
|
return y.add(G);
|
|
3024
|
-
})) : T !== R.res && (R.res = T, R.promise = M.resolve({ result: T }))) : (R.dirty && je(
|
|
3032
|
+
})) : T !== R.res && (R.res = T, R.promise = M.resolve({ result: T }))) : (R.dirty && je(C, R), R.subscribers.forEach(function(G) {
|
|
3025
3033
|
return y.add(G);
|
|
3026
3034
|
})));
|
|
3027
3035
|
}
|
|
@@ -3056,13 +3064,13 @@ function Ma() {
|
|
|
3056
3064
|
}), u) : a.mutate(i);
|
|
3057
3065
|
}, query: function(i) {
|
|
3058
3066
|
if (!Pr(B, a) || !Dr("query", i)) return a.query(i);
|
|
3059
|
-
var u = ((y = B.trans) === null || y === void 0 ? void 0 : y.db._options.cache) === "immutable", f = B, d = f.requery, p = f.signal, y = function(E, S,
|
|
3067
|
+
var u = ((y = B.trans) === null || y === void 0 ? void 0 : y.db._options.cache) === "immutable", f = B, d = f.requery, p = f.signal, y = function(E, S, v, A) {
|
|
3060
3068
|
var P = ze["idb://".concat(E, "/").concat(S)];
|
|
3061
3069
|
if (!P) return [];
|
|
3062
|
-
if (!(S = P.queries[
|
|
3070
|
+
if (!(S = P.queries[v])) return [null, !1, P, null];
|
|
3063
3071
|
var D = S[(A.query ? A.query.index.name : null) || ""];
|
|
3064
3072
|
if (!D) return [null, !1, P, null];
|
|
3065
|
-
switch (
|
|
3073
|
+
switch (v) {
|
|
3066
3074
|
case "query":
|
|
3067
3075
|
var I = D.find(function(N) {
|
|
3068
3076
|
return N.req.limit === A.limit && N.req.values === A.values && Rr(N.req.query.range, A.query.range);
|
|
@@ -3079,7 +3087,7 @@ function Ma() {
|
|
|
3079
3087
|
return w && f ? w.obsSet = i.obsSet : (f = a.query(i).then(function(E) {
|
|
3080
3088
|
var S = E.result;
|
|
3081
3089
|
if (w && (w.res = S), u) {
|
|
3082
|
-
for (var
|
|
3090
|
+
for (var v = 0, A = S.length; v < A; ++v) Object.freeze(S[v]);
|
|
3083
3091
|
Object.freeze(S);
|
|
3084
3092
|
} else E.result = $e(S);
|
|
3085
3093
|
return E;
|
|
@@ -3175,7 +3183,7 @@ function Ma() {
|
|
|
3175
3183
|
return this._state.autoSchema;
|
|
3176
3184
|
}, Object.defineProperty(ee.prototype, "tables", { get: function() {
|
|
3177
3185
|
var e = this;
|
|
3178
|
-
return
|
|
3186
|
+
return x(this._allTables).map(function(n) {
|
|
3179
3187
|
return e._allTables[n];
|
|
3180
3188
|
});
|
|
3181
3189
|
}, enumerable: !1, configurable: !0 }), ee.prototype.transaction = function() {
|
|
@@ -3219,10 +3227,10 @@ function Ma() {
|
|
|
3219
3227
|
}
|
|
3220
3228
|
var p = function y(w, f, O, m, E) {
|
|
3221
3229
|
return M.resolve().then(function() {
|
|
3222
|
-
var S = B.transless || B,
|
|
3223
|
-
if (
|
|
3230
|
+
var S = B.transless || B, v = w._createTransaction(f, O, w._dbSchema, m);
|
|
3231
|
+
if (v.explicit = !0, S = { trans: v, transless: S }, m) v.idbtrans = m.idbtrans;
|
|
3224
3232
|
else try {
|
|
3225
|
-
|
|
3233
|
+
v.create(), v.idbtrans._explicit = !0, w._state.PR1398_maxLoop = 3;
|
|
3226
3234
|
} catch (D) {
|
|
3227
3235
|
return D.name === sn.InvalidState && w.isOpen() && 0 < --w._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), w.close({ disableAutoOpen: !1 }), w.open().then(function() {
|
|
3228
3236
|
return y(w, f, O, null, E);
|
|
@@ -3231,17 +3239,17 @@ function Ma() {
|
|
|
3231
3239
|
var A, P = an(E);
|
|
3232
3240
|
return P && et(), S = M.follow(function() {
|
|
3233
3241
|
var D;
|
|
3234
|
-
(A = E.call(
|
|
3242
|
+
(A = E.call(v, v)) && (P ? (D = Ie.bind(null, null), A.then(D, D)) : typeof A.next == "function" && typeof A.throw == "function" && (A = jn(A)));
|
|
3235
3243
|
}, S), (A && typeof A.then == "function" ? M.resolve(A).then(function(D) {
|
|
3236
|
-
return
|
|
3244
|
+
return v.active ? D : q(new L.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
|
|
3237
3245
|
}) : S.then(function() {
|
|
3238
3246
|
return A;
|
|
3239
3247
|
})).then(function(D) {
|
|
3240
|
-
return m &&
|
|
3248
|
+
return m && v._resolve(), v._completion.then(function() {
|
|
3241
3249
|
return D;
|
|
3242
3250
|
});
|
|
3243
3251
|
}).catch(function(D) {
|
|
3244
|
-
return
|
|
3252
|
+
return v._reject(D), q(D);
|
|
3245
3253
|
});
|
|
3246
3254
|
});
|
|
3247
3255
|
}.bind(null, this, i, u, s, r);
|
|
@@ -3266,32 +3274,32 @@ function Ma() {
|
|
|
3266
3274
|
return function(O, m) {
|
|
3267
3275
|
ee.vip(function() {
|
|
3268
3276
|
var E, S = r._state;
|
|
3269
|
-
S.openComplete ? (S.dbOpenError || M.resolve().then(O), m && f(O)) : S.onReadyBeingFired ? (S.onReadyBeingFired.push(O), m && f(O)) : (f(O), E = r, m || f(function
|
|
3270
|
-
E.on.ready.unsubscribe(O), E.on.ready.unsubscribe(
|
|
3277
|
+
S.openComplete ? (S.dbOpenError || M.resolve().then(O), m && f(O)) : S.onReadyBeingFired ? (S.onReadyBeingFired.push(O), m && f(O)) : (f(O), E = r, m || f(function v() {
|
|
3278
|
+
E.on.ready.unsubscribe(O), E.on.ready.unsubscribe(v);
|
|
3271
3279
|
}));
|
|
3272
3280
|
});
|
|
3273
3281
|
};
|
|
3274
|
-
}), this.Collection = (s = this, gt(oa.prototype, function(A,
|
|
3282
|
+
}), this.Collection = (s = this, gt(oa.prototype, function(A, v) {
|
|
3275
3283
|
this.db = s;
|
|
3276
3284
|
var m = ir, E = null;
|
|
3277
|
-
if (
|
|
3278
|
-
m =
|
|
3285
|
+
if (v) try {
|
|
3286
|
+
m = v();
|
|
3279
3287
|
} catch (P) {
|
|
3280
3288
|
E = P;
|
|
3281
3289
|
}
|
|
3282
|
-
var S = A._ctx,
|
|
3283
|
-
this._ctx = { table:
|
|
3290
|
+
var S = A._ctx, v = S.table, A = v.hook.reading.fire;
|
|
3291
|
+
this._ctx = { table: v, index: S.index, isPrimKey: !S.index || v.schema.primKey.keyPath && S.index === v.schema.primKey.name, range: m, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: E, or: S.or, valueMapper: A !== ct ? A : null };
|
|
3284
3292
|
})), this.Table = (i = this, gt(dr.prototype, function(f, O, m) {
|
|
3285
3293
|
this.db = i, this._tx = m, this.name = f, this.schema = O, this.hook = i._allTables[f] ? i._allTables[f].hook : ht(null, { creating: [Jr, Q], reading: [Xr, ct], updating: [qr, Q], deleting: [Zr, Q] });
|
|
3286
3294
|
})), this.Transaction = (u = this, gt(ua.prototype, function(f, O, m, E, S) {
|
|
3287
|
-
var
|
|
3295
|
+
var v = this;
|
|
3288
3296
|
this.db = u, this.mode = f, this.storeNames = O, this.schema = m, this.chromeTransactionDurability = E, this.idbtrans = null, this.on = ht(this, "complete", "error", "abort"), this.parent = S || null, this.active = !0, this._reculock = 0, this._blockedFuncs = [], this._resolve = null, this._reject = null, this._waitingFor = null, this._waitingQueue = null, this._spinCount = 0, this._completion = new M(function(A, P) {
|
|
3289
|
-
|
|
3297
|
+
v._resolve = A, v._reject = P;
|
|
3290
3298
|
}), this._completion.then(function() {
|
|
3291
|
-
|
|
3299
|
+
v.active = !1, v.on.complete.fire();
|
|
3292
3300
|
}, function(A) {
|
|
3293
|
-
var P =
|
|
3294
|
-
return
|
|
3301
|
+
var P = v.active;
|
|
3302
|
+
return v.active = !1, v.on.error.fire(A), v.parent ? v.parent._reject(A) : P && v.idbtrans && v.idbtrans.abort(), q(A);
|
|
3295
3303
|
});
|
|
3296
3304
|
})), this.Version = (d = this, gt(ma.prototype, function(f) {
|
|
3297
3305
|
this.db = d, this._cfg = { version: f, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
|
|
@@ -3341,7 +3349,7 @@ function Ma() {
|
|
|
3341
3349
|
this._subscribe = e;
|
|
3342
3350
|
}
|
|
3343
3351
|
try {
|
|
3344
|
-
Zt = { indexedDB:
|
|
3352
|
+
Zt = { indexedDB: b.indexedDB || b.mozIndexedDB || b.webkitIndexedDB || b.msIndexedDB, IDBKeyRange: b.IDBKeyRange || b.webkitIDBKeyRange };
|
|
3345
3353
|
} catch {
|
|
3346
3354
|
Zt = { indexedDB: null, IDBKeyRange: null };
|
|
3347
3355
|
}
|
|
@@ -3358,7 +3366,7 @@ function Ma() {
|
|
|
3358
3366
|
}, m = function(S) {
|
|
3359
3367
|
Yt(p, S), xn(y, p) && O();
|
|
3360
3368
|
}, E = function() {
|
|
3361
|
-
var S,
|
|
3369
|
+
var S, v, A;
|
|
3362
3370
|
!d && Zt.indexedDB && (p = {}, S = {}, u && u.abort(), u = new AbortController(), A = function(P) {
|
|
3363
3371
|
var D = Ze();
|
|
3364
3372
|
try {
|
|
@@ -3368,8 +3376,8 @@ function Ma() {
|
|
|
3368
3376
|
} finally {
|
|
3369
3377
|
D && qe();
|
|
3370
3378
|
}
|
|
3371
|
-
}(
|
|
3372
|
-
r = !0, n = P, d ||
|
|
3379
|
+
}(v = { subscr: S, signal: u.signal, requery: O, querier: e, trans: null }), Promise.resolve(A).then(function(P) {
|
|
3380
|
+
r = !0, n = P, d || v.signal.aborted || (p = {}, function(D) {
|
|
3373
3381
|
for (var I in D) if (ie(D, I)) return;
|
|
3374
3382
|
return 1;
|
|
3375
3383
|
}(y = S) || f || (Te(yt, m), f = !0), pn(function() {
|
|
@@ -3603,7 +3611,7 @@ class Mr {
|
|
|
3603
3611
|
} : (o.message = `Dashboard ${t.id} retrieved from storage`, o.success = !0, o);
|
|
3604
3612
|
};
|
|
3605
3613
|
getDashboards = async (t) => {
|
|
3606
|
-
const o = (
|
|
3614
|
+
const o = (b) => t?.id === b.id, l = (b) => t?.name ? b.name.includes(t?.name) : !1, g = await this.db.table(_.DASHBOARD).toArray().then((b) => t?.id ? b.filter(o) : b).then((b) => t?.name ? b.filter(l) : b).catch(() => {
|
|
3607
3615
|
K(2, ["%cstorage", c.STORAGE, X.DASHBOARD_LOAD, t]);
|
|
3608
3616
|
});
|
|
3609
3617
|
return g !== void 0 && K(3, [
|
|
@@ -3645,21 +3653,21 @@ class Mr {
|
|
|
3645
3653
|
* Wipe Message data after expires timestamp
|
|
3646
3654
|
*/
|
|
3647
3655
|
cleanMessages = async () => {
|
|
3648
|
-
const t = Date.now() / 1e3, o = (
|
|
3649
|
-
return await this.db.table(_.TOPICS).orderBy("expires").filter(o).delete().catch((
|
|
3656
|
+
const t = Date.now() / 1e3, o = (b) => b.expires < t, l = (b) => b.expires < t;
|
|
3657
|
+
return await this.db.table(_.TOPICS).orderBy("expires").filter(o).delete().catch((b) => (console.error(
|
|
3650
3658
|
"%cstorage%c %cclean",
|
|
3651
3659
|
c.STORAGE,
|
|
3652
3660
|
c.NONE,
|
|
3653
3661
|
c.MESSAGES,
|
|
3654
|
-
|
|
3655
|
-
), 0)), await this.db.table(_.MESSAGES).orderBy("expires").filter(l).delete().catch((
|
|
3662
|
+
b.message
|
|
3663
|
+
), 0)), await this.db.table(_.MESSAGES).orderBy("expires").filter(l).delete().catch((b) => (console.error(
|
|
3656
3664
|
"%clean%c %cstorage%c %cmessages",
|
|
3657
3665
|
c.OK,
|
|
3658
3666
|
c.NONE,
|
|
3659
3667
|
c.STORAGE,
|
|
3660
3668
|
c.NONE,
|
|
3661
3669
|
c.MESSAGES,
|
|
3662
|
-
|
|
3670
|
+
b.message
|
|
3663
3671
|
), 0));
|
|
3664
3672
|
};
|
|
3665
3673
|
/**
|
|
@@ -3685,9 +3693,9 @@ class Mr {
|
|
|
3685
3693
|
};
|
|
3686
3694
|
const o = t?.order ?? "utc", l = Math.floor(Date.now() / 1e3);
|
|
3687
3695
|
o !== "utc" && (t.since = l - 60 * 60 * 24 * 30), this.options.delay != 0 ? t.before = l - (this.options.delay || 0) : t.before = l;
|
|
3688
|
-
const g = (
|
|
3696
|
+
const g = ($) => $.utc > (t?.since || 0), b = ($) => $.utc < (t?.before || l), x = ($) => $?.visible !== 0;
|
|
3689
3697
|
try {
|
|
3690
|
-
const te = await this.db.table(_.TOPICS).where("widget_id").equals(t.widget).filter(
|
|
3698
|
+
const te = await this.db.table(_.TOPICS).where("widget_id").equals(t.widget).filter(x).filter(g).filter(b).reverse().limit(t?.limit ?? 25).sortBy(o);
|
|
3691
3699
|
if (te.length === 0)
|
|
3692
3700
|
return {
|
|
3693
3701
|
data: null,
|
|
@@ -3715,7 +3723,7 @@ class Mr {
|
|
|
3715
3723
|
be
|
|
3716
3724
|
]), be;
|
|
3717
3725
|
});
|
|
3718
|
-
} catch (
|
|
3726
|
+
} catch ($) {
|
|
3719
3727
|
return K(2, [
|
|
3720
3728
|
"%cget%c %cstorage%c %cmessages",
|
|
3721
3729
|
c.OK,
|
|
@@ -3724,7 +3732,7 @@ class Mr {
|
|
|
3724
3732
|
c.NONE,
|
|
3725
3733
|
c.NO_UPDATES,
|
|
3726
3734
|
t,
|
|
3727
|
-
|
|
3735
|
+
$.message
|
|
3728
3736
|
]), { data: null, message: "Messages Data error", success: !1 };
|
|
3729
3737
|
}
|
|
3730
3738
|
};
|
|
@@ -3750,19 +3758,19 @@ class Mr {
|
|
|
3750
3758
|
return 400;
|
|
3751
3759
|
const l = o.data.title;
|
|
3752
3760
|
let g = 0;
|
|
3753
|
-
return await o.data.messages.forEach(async (
|
|
3754
|
-
|
|
3755
|
-
message_id:
|
|
3756
|
-
engagement:
|
|
3757
|
-
impressions:
|
|
3758
|
-
reach:
|
|
3759
|
-
sentiment:
|
|
3761
|
+
return await o.data.messages.forEach(async (b) => {
|
|
3762
|
+
b.id !== null && (b.topics[0] = {
|
|
3763
|
+
message_id: b.id,
|
|
3764
|
+
engagement: b.topics[0]?.engagement || b.dynamics?.engagement || 0,
|
|
3765
|
+
impressions: b.topics[0]?.impressions || b.dynamics?.semrush_visits || 0,
|
|
3766
|
+
reach: b.topics[0]?.reach || b.dynamics?.potential_reach || 0,
|
|
3767
|
+
sentiment: b.topics[0]?.sentiment || 0
|
|
3760
3768
|
}, await this.db.table(_.MESSAGES).put({
|
|
3761
|
-
id:
|
|
3762
|
-
utc:
|
|
3763
|
-
data:
|
|
3764
|
-
expires:
|
|
3765
|
-
}).catch((
|
|
3769
|
+
id: b.id,
|
|
3770
|
+
utc: b.utc,
|
|
3771
|
+
data: b,
|
|
3772
|
+
expires: b.expires
|
|
3773
|
+
}).catch((x) => {
|
|
3766
3774
|
g++, K(4, [
|
|
3767
3775
|
"%cset%c %cstorage",
|
|
3768
3776
|
c.KO,
|
|
@@ -3770,21 +3778,21 @@ class Mr {
|
|
|
3770
3778
|
c.STORAGE,
|
|
3771
3779
|
"set message",
|
|
3772
3780
|
`title: ${l}`,
|
|
3773
|
-
|
|
3774
|
-
|
|
3781
|
+
b,
|
|
3782
|
+
x.message
|
|
3775
3783
|
]);
|
|
3776
3784
|
}), await this.db.table(_.TOPICS).put({
|
|
3777
3785
|
title: l,
|
|
3778
3786
|
widget_id: t.widget,
|
|
3779
|
-
message_id:
|
|
3787
|
+
message_id: b.id,
|
|
3780
3788
|
dashboard_id: t.dashboard,
|
|
3781
|
-
engagement:
|
|
3782
|
-
impressions:
|
|
3783
|
-
reach:
|
|
3784
|
-
sentiment:
|
|
3785
|
-
utc:
|
|
3786
|
-
expires:
|
|
3787
|
-
}).catch((
|
|
3789
|
+
engagement: b.topics[0]?.engagement || b.dynamics?.engagement || 0,
|
|
3790
|
+
impressions: b.topics[0]?.impressions || b.dynamics?.semrush_visits || 0,
|
|
3791
|
+
reach: b.topics[0]?.reach || b.dynamics?.potential_reach || 0,
|
|
3792
|
+
sentiment: b.topics[0]?.sentiment || 0,
|
|
3793
|
+
utc: b.utc,
|
|
3794
|
+
expires: b.expires
|
|
3795
|
+
}).catch((x) => {
|
|
3788
3796
|
g++, K(4, [
|
|
3789
3797
|
"%cset%c %cstorage",
|
|
3790
3798
|
c.KO,
|
|
@@ -3792,12 +3800,12 @@ class Mr {
|
|
|
3792
3800
|
c.STORAGE,
|
|
3793
3801
|
"set topic",
|
|
3794
3802
|
`title: ${l}`,
|
|
3795
|
-
|
|
3796
|
-
|
|
3803
|
+
b,
|
|
3804
|
+
x.message
|
|
3797
3805
|
]);
|
|
3798
|
-
}), await o.data.topics.forEach(async (
|
|
3799
|
-
const
|
|
3800
|
-
await this.db.table(_.TOPICS).where("message_id").equals(
|
|
3806
|
+
}), await o.data.topics.forEach(async (x) => {
|
|
3807
|
+
const $ = x.message_id, te = x.visible ? 1 : 0, ge = x.title;
|
|
3808
|
+
await this.db.table(_.TOPICS).where("message_id").equals($).modify({ visible: te }).catch((Ce) => {
|
|
3801
3809
|
g++, K(4, [
|
|
3802
3810
|
"%cset%c %cstorage",
|
|
3803
3811
|
c.KO,
|
|
@@ -3805,7 +3813,7 @@ class Mr {
|
|
|
3805
3813
|
c.STORAGE,
|
|
3806
3814
|
"update message visibility",
|
|
3807
3815
|
`title: ${ge}`,
|
|
3808
|
-
`widget: ${
|
|
3816
|
+
`widget: ${x.widget_id}`,
|
|
3809
3817
|
Ce.message
|
|
3810
3818
|
]);
|
|
3811
3819
|
});
|
|
@@ -3916,10 +3924,10 @@ class Mr {
|
|
|
3916
3924
|
* @returns IResponse
|
|
3917
3925
|
*/
|
|
3918
3926
|
getWidgets = async (t) => {
|
|
3919
|
-
const o = (
|
|
3927
|
+
const o = (x) => t?.dashboard === x.dashboard_id, l = (x) => t?.type === x.type, g = (x) => t?.name ? x.name.includes(t?.name) : !1, b = await this.db.table(_.WIDGET).toArray().then((x) => t?.dashboard ? x.filter(o) : x).then((x) => t?.type ? x.filter(l) : x).then((x) => t?.name ? x.filter(g) : x).catch(() => {
|
|
3920
3928
|
K(2, ["%cstorage", c.STORAGE, X.WIDGET_LOAD, t]);
|
|
3921
3929
|
});
|
|
3922
|
-
return
|
|
3930
|
+
return b !== void 0 && K(3, [
|
|
3923
3931
|
"%cstorage%c %cwidgets",
|
|
3924
3932
|
c.STORAGE,
|
|
3925
3933
|
c.NONE,
|
|
@@ -3927,9 +3935,9 @@ class Mr {
|
|
|
3927
3935
|
t
|
|
3928
3936
|
]), {
|
|
3929
3937
|
// @ts-ignore
|
|
3930
|
-
data:
|
|
3931
|
-
message:
|
|
3932
|
-
success:
|
|
3938
|
+
data: b !== void 0 ? { data: b, query: t } : null,
|
|
3939
|
+
message: b !== void 0 ? "Widgets loaded from storage" : "Widgets load error",
|
|
3940
|
+
success: b !== void 0
|
|
3933
3941
|
};
|
|
3934
3942
|
};
|
|
3935
3943
|
/**
|
|
@@ -4006,12 +4014,12 @@ class Mr {
|
|
|
4006
4014
|
* @returns IResponse
|
|
4007
4015
|
*/
|
|
4008
4016
|
getSlides = async (t) => {
|
|
4009
|
-
const o = (
|
|
4010
|
-
return
|
|
4017
|
+
const o = ($) => t?.id ? $.id = t.id : !1, l = ($) => t?.name ? $.name.includes(t?.name) : !1, g = ($) => t?.presentation_id ? $.presentation_id = t.presentation_id : !1, x = await this.db.table(_.SLIDE).toArray().then(($) => t?.presentation_id ? $.filter(g) : $).then(($) => t?.id ? $.filter(o) : $).then(($) => t?.name ? $.filter(l) : $);
|
|
4018
|
+
return x !== void 0 && K(3, ["%cstorage%c %cslides", c.STORAGE, c.NONE, c.SLIDE, t]), {
|
|
4011
4019
|
// @ts-ignore
|
|
4012
|
-
data:
|
|
4013
|
-
message:
|
|
4014
|
-
success:
|
|
4020
|
+
data: x !== void 0 ? { slides: x, query: t } : null,
|
|
4021
|
+
message: x !== void 0 ? "Slides loaded from storage" : "Slides load error",
|
|
4022
|
+
success: x !== void 0
|
|
4015
4023
|
};
|
|
4016
4024
|
};
|
|
4017
4025
|
/**
|
|
@@ -4068,7 +4076,7 @@ class Mr {
|
|
|
4068
4076
|
* @returns IResponse
|
|
4069
4077
|
*/
|
|
4070
4078
|
getPresentations = async (t) => {
|
|
4071
|
-
const o = (
|
|
4079
|
+
const o = (b) => t?.name ? b.name.includes(t?.name) : !1, g = await this.db.table(_.PRESENTATION).toArray().then((b) => t?.name ? b.filter(o) : b);
|
|
4072
4080
|
return g !== void 0 && K(3, [
|
|
4073
4081
|
"%cstorage%c %cpresentations",
|
|
4074
4082
|
c.STORAGE,
|
|
@@ -4136,7 +4144,7 @@ class Mr {
|
|
|
4136
4144
|
* @returns IResponse
|
|
4137
4145
|
*/
|
|
4138
4146
|
getPreferences = async (t) => {
|
|
4139
|
-
const o = (
|
|
4147
|
+
const o = (b) => t?.id ? t.id = b.id : !1, g = await this.db.table(_.SLIDE).toArray().then((b) => t?.id ? b.filter(o) : b);
|
|
4140
4148
|
return g !== void 0 && K(3, [
|
|
4141
4149
|
"%cstorage%c %cpreferences",
|
|
4142
4150
|
c.STORAGE,
|
|
@@ -4180,7 +4188,7 @@ class Mr {
|
|
|
4180
4188
|
* @returns IResponse
|
|
4181
4189
|
*/
|
|
4182
4190
|
getImages = async (t) => {
|
|
4183
|
-
const o = (
|
|
4191
|
+
const o = (b) => t?.id ? b.includes(t.id) : !1, g = await this.db.table(_.IMAGES).toArray().then((b) => t?.id ? b.filter(o) : b);
|
|
4184
4192
|
return g !== void 0 && K(3, [
|
|
4185
4193
|
"%cstorage%c %cimages",
|
|
4186
4194
|
c.STORAGE,
|
|
@@ -4233,12 +4241,12 @@ function Ka(h, t) {
|
|
|
4233
4241
|
if (o)
|
|
4234
4242
|
return o;
|
|
4235
4243
|
const g = indexedDB.open(h);
|
|
4236
|
-
return g.onupgradeneeded = () => g.result.createObjectStore(t), o = Hn(g), o.then((
|
|
4237
|
-
|
|
4244
|
+
return g.onupgradeneeded = () => g.result.createObjectStore(t), o = Hn(g), o.then((b) => {
|
|
4245
|
+
b.onclose = () => o = void 0;
|
|
4238
4246
|
}, () => {
|
|
4239
4247
|
}), o;
|
|
4240
4248
|
};
|
|
4241
|
-
return (g,
|
|
4249
|
+
return (g, b) => l().then((x) => b(x.transaction(t, g).objectStore(t)));
|
|
4242
4250
|
}
|
|
4243
4251
|
let Un;
|
|
4244
4252
|
function Gr() {
|
|
@@ -5607,13 +5615,13 @@ class Ja {
|
|
|
5607
5615
|
let o, l = 400;
|
|
5608
5616
|
if (t.success === !0) {
|
|
5609
5617
|
const g = this.subscribers[t.query.widget];
|
|
5610
|
-
let
|
|
5618
|
+
let b = "";
|
|
5611
5619
|
switch (t.query.type) {
|
|
5612
5620
|
case _.MESSAGES:
|
|
5613
|
-
let
|
|
5614
|
-
|
|
5615
|
-
(
|
|
5616
|
-
), t.data.messages =
|
|
5621
|
+
let x;
|
|
5622
|
+
x = t.data.messages.filter(
|
|
5623
|
+
($) => $.id !== null
|
|
5624
|
+
), t.data.messages = x, b = t.data.messages.length > 0 ? Fn(t.data.messages[0].utc) : "none", g?.hash && g.hash === b ? (K(3, [
|
|
5617
5625
|
"%cload%c %cmessages%c %cno updates",
|
|
5618
5626
|
c.OK,
|
|
5619
5627
|
c.NONE,
|
|
@@ -5621,10 +5629,10 @@ class Ja {
|
|
|
5621
5629
|
c.NONE,
|
|
5622
5630
|
c.NO_UPDATES,
|
|
5623
5631
|
t.query.widget
|
|
5624
|
-
]), K(4, ["%cmessages", c.MESSAGES, t]), l = 204) : (o = t, g.hash =
|
|
5632
|
+
]), K(4, ["%cmessages", c.MESSAGES, t]), l = 204) : (o = t, g.hash = b, l = await this.sm?.setMessages(t.query, t).then(async ($) => ($ = 201, this.broadcastUpdate($, t))));
|
|
5625
5633
|
break;
|
|
5626
5634
|
case _.CLOUD:
|
|
5627
|
-
|
|
5635
|
+
b = Fn(t.data.cloud), g?.hash && g.hash === b ? (K(3, [
|
|
5628
5636
|
"%cload%c %ccloud%c %cno updates",
|
|
5629
5637
|
c.OK,
|
|
5630
5638
|
c.NONE,
|
|
@@ -5632,17 +5640,17 @@ class Ja {
|
|
|
5632
5640
|
c.NONE,
|
|
5633
5641
|
c.NO_UPDATES,
|
|
5634
5642
|
t.query.widget
|
|
5635
|
-
]), K(4, ["%ccloud", c.CLOUD, t.query]), l = 204) : (g.hash =
|
|
5643
|
+
]), K(4, ["%ccloud", c.CLOUD, t.query]), l = 204) : (g.hash = b, o = {
|
|
5636
5644
|
data: {
|
|
5637
5645
|
cloud: t.data
|
|
5638
5646
|
},
|
|
5639
5647
|
message: t.message,
|
|
5640
5648
|
success: t.success,
|
|
5641
5649
|
query: t.query
|
|
5642
|
-
}, l = await this.sm?.setCloud(t.query, o.data).then((
|
|
5650
|
+
}, l = await this.sm?.setCloud(t.query, o.data).then(($) => this.broadcastUpdate($, t)));
|
|
5643
5651
|
break;
|
|
5644
5652
|
case _.SERIES:
|
|
5645
|
-
|
|
5653
|
+
b = Fn(t.data.series), g?.hash && g.hash === b ? (K(3, [
|
|
5646
5654
|
"%cload%c %cseries%c %cno updates",
|
|
5647
5655
|
c.OK,
|
|
5648
5656
|
c.NONE,
|
|
@@ -5650,12 +5658,12 @@ class Ja {
|
|
|
5650
5658
|
c.NONE,
|
|
5651
5659
|
c.NO_UPDATES,
|
|
5652
5660
|
t.query.widget
|
|
5653
|
-
]), K(4, ["%cseries", c.SERIES, t]), l = 204) : (g.hash =
|
|
5661
|
+
]), K(4, ["%cseries", c.SERIES, t]), l = 204) : (g.hash = b, o = {
|
|
5654
5662
|
data: t.data,
|
|
5655
5663
|
message: t.message,
|
|
5656
5664
|
success: t.success,
|
|
5657
5665
|
query: t.query
|
|
5658
|
-
}, l = await this.sm?.setSeries(t.query, t.data).then((
|
|
5666
|
+
}, l = await this.sm?.setSeries(t.query, t.data).then(($) => this.broadcastUpdate($, t)));
|
|
5659
5667
|
break;
|
|
5660
5668
|
default:
|
|
5661
5669
|
return K(4, [
|
|
@@ -5923,8 +5931,8 @@ class Za {
|
|
|
5923
5931
|
this.element = t, this.callbacks = o, l = typeof l < "u" ? l : "buzzcasting-app";
|
|
5924
5932
|
let g;
|
|
5925
5933
|
g = { ...t.dataset }, delete g.hmr, g.presentation = window.BuzzCasting.getOptions()?.presentation ?? `${l} not found`, this.query = g, Da(t);
|
|
5926
|
-
const
|
|
5927
|
-
this.storageReader = new Ba(
|
|
5934
|
+
const b = window.BuzzCasting.getOptions();
|
|
5935
|
+
this.storageReader = new Ba(b), this.broadcastChannel = new BroadcastChannel(g.presentation), this.broadcastListener();
|
|
5928
5936
|
}
|
|
5929
5937
|
addCallbackListener(t) {
|
|
5930
5938
|
this.callbacks.push(t);
|
|
@@ -5950,8 +5958,8 @@ class Za {
|
|
|
5950
5958
|
c.NONE,
|
|
5951
5959
|
c.WIDGET,
|
|
5952
5960
|
this.query
|
|
5953
|
-
]), this.callbacks.forEach(async (
|
|
5954
|
-
|
|
5961
|
+
]), this.callbacks.forEach(async (b) => {
|
|
5962
|
+
b(g);
|
|
5955
5963
|
}));
|
|
5956
5964
|
}
|
|
5957
5965
|
} catch {
|