@dialecte/core 0.1.0 → 0.1.1
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/{index--bGUvjR6.js → index-B8aWgmfS.js} +915 -909
- package/dist/index.js +1 -1
- package/dist/test.js +1 -1
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toRef as Ne, isRecordOf as ur, toTreeRecord as cr, toRawRecord as or, standardizeRecord as Ya, toFullAttributeArray as za, CUSTOM_RECORD_ID_ATTRIBUTE as ia } from "./helpers.js";
|
|
2
|
-
import { t as Me, a as
|
|
2
|
+
import { t as Me, a as $e } from "./index-B67NZSGJ.js";
|
|
3
3
|
async function dr(g) {
|
|
4
4
|
const { context: u, tagName: c, attributes: i } = g, h = await ua({ context: u, tagName: c }), m = [];
|
|
5
5
|
for (const y of h)
|
|
@@ -247,7 +247,7 @@ async function ua(g) {
|
|
|
247
247
|
}
|
|
248
248
|
async function ca(g) {
|
|
249
249
|
const { context: u, ref: c, options: i = {} } = g, { include: h, exclude: m, unwrap: y } = i, N = await Re({ context: u, ref: c });
|
|
250
|
-
|
|
250
|
+
$e(N, {
|
|
251
251
|
detail: "No record found for provided ref",
|
|
252
252
|
method: "getTree",
|
|
253
253
|
key: "ELEMENT_NOT_FOUND"
|
|
@@ -412,15 +412,15 @@ class fa {
|
|
|
412
412
|
function ze(g) {
|
|
413
413
|
const { context: u, status: c, record: i, oldRecord: h, newRecord: m } = g;
|
|
414
414
|
let y, N, R;
|
|
415
|
-
i && (y = or(i)), h && (N = or(h)), m && (R = or(m)), c === "created" ? (
|
|
415
|
+
i && (y = or(i)), h && (N = or(h)), m && (R = or(m)), c === "created" ? ($e(y, {
|
|
416
416
|
detail: "Record is required for created",
|
|
417
417
|
method: "stageOperation",
|
|
418
418
|
key: "ELEMENT_NOT_FOUND"
|
|
419
|
-
}), u.stagedOperations.push({ status: c, oldRecord: void 0, newRecord: y })) : c === "updated" ? (
|
|
419
|
+
}), u.stagedOperations.push({ status: c, oldRecord: void 0, newRecord: y })) : c === "updated" ? ($e(N && R, {
|
|
420
420
|
detail: "Old record and new record are required for updated",
|
|
421
421
|
method: "stageOperation",
|
|
422
422
|
key: "ELEMENT_NOT_FOUND"
|
|
423
|
-
}), u.stagedOperations.push({ status: c, oldRecord: N, newRecord: R })) : c === "deleted" && y && (
|
|
423
|
+
}), u.stagedOperations.push({ status: c, oldRecord: N, newRecord: R })) : c === "deleted" && y && ($e(y, {
|
|
424
424
|
detail: "Record is required for deleted",
|
|
425
425
|
method: "stageOperation",
|
|
426
426
|
key: "ELEMENT_NOT_FOUND"
|
|
@@ -448,7 +448,7 @@ function gi(g) {
|
|
|
448
448
|
}
|
|
449
449
|
async function da(g) {
|
|
450
450
|
const { dialecteConfig: u, context: c, parentRef: i, params: h } = g, { id: m, tagName: y, attributes: N, namespace: R, value: j } = h, X = await Re({ context: c, ref: i });
|
|
451
|
-
|
|
451
|
+
$e(X, {
|
|
452
452
|
detail: "Parent record not found",
|
|
453
453
|
method: "addChild",
|
|
454
454
|
key: "ELEMENT_NOT_FOUND",
|
|
@@ -583,18 +583,18 @@ async function bi(g) {
|
|
|
583
583
|
}
|
|
584
584
|
async function wi(g) {
|
|
585
585
|
const { context: u, ref: c } = g, i = await Re({ context: u, ref: c });
|
|
586
|
-
|
|
586
|
+
$e(i, {
|
|
587
587
|
detail: `Record not found (tagName=${c.tagName}, id=${c.id})`,
|
|
588
588
|
method: "delete",
|
|
589
589
|
key: "ELEMENT_NOT_FOUND",
|
|
590
590
|
ref: c
|
|
591
|
-
}),
|
|
591
|
+
}), $e(i.parent, {
|
|
592
592
|
detail: "Cannot delete root element",
|
|
593
593
|
method: "delete",
|
|
594
594
|
key: "PROTECTED_ROOT"
|
|
595
595
|
}), await ma({ context: u, record: i }), ze({ context: u, status: "deleted", record: i });
|
|
596
596
|
const h = Ne(i.parent), m = await Re({ context: u, ref: h });
|
|
597
|
-
|
|
597
|
+
$e(m, {
|
|
598
598
|
detail: `Parent record not found (tagName=${i.parent.tagName}, id=${i.parent.id})`,
|
|
599
599
|
method: "delete",
|
|
600
600
|
key: "ELEMENT_NOT_FOUND"
|
|
@@ -614,7 +614,7 @@ async function ma(g) {
|
|
|
614
614
|
}
|
|
615
615
|
async function _i(g) {
|
|
616
616
|
const { dialecteConfig: u, context: c, ref: i, params: h } = g, { attributes: m, value: y } = h, N = await Re({ context: c, ref: i });
|
|
617
|
-
|
|
617
|
+
$e(N, {
|
|
618
618
|
detail: `Record not found (tagName=${i.tagName}, id=${i.id})`,
|
|
619
619
|
method: "update",
|
|
620
620
|
key: "ELEMENT_NOT_FOUND",
|
|
@@ -928,7 +928,7 @@ function Ai() {
|
|
|
928
928
|
}).apply(this, arguments);
|
|
929
929
|
};
|
|
930
930
|
function h(e, t, n) {
|
|
931
|
-
for (var r, a = 0,
|
|
931
|
+
for (var r, a = 0, s = t.length; a < s; a++) !r && a in t || ((r = r || Array.prototype.slice.call(t, 0, a))[a] = t[a]);
|
|
932
932
|
return e.concat(r || Array.prototype.slice.call(t));
|
|
933
933
|
}
|
|
934
934
|
var m = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Ei, y = Object.keys, N = Array.isArray;
|
|
@@ -974,8 +974,8 @@ function Ai() {
|
|
|
974
974
|
if (!t) return e;
|
|
975
975
|
if (typeof t != "string") {
|
|
976
976
|
for (var n = [], r = 0, a = t.length; r < a; ++r) {
|
|
977
|
-
var
|
|
978
|
-
n.push(
|
|
977
|
+
var s = pe(e, t[r]);
|
|
978
|
+
n.push(s);
|
|
979
979
|
}
|
|
980
980
|
return n;
|
|
981
981
|
}
|
|
@@ -990,20 +990,20 @@ function Ai() {
|
|
|
990
990
|
Y(typeof n != "string" && "length" in n);
|
|
991
991
|
for (var r = 0, a = t.length; r < a; ++r) ne(e, t[r], n[r]);
|
|
992
992
|
} else {
|
|
993
|
-
var
|
|
994
|
-
d !== -1 ? (
|
|
993
|
+
var s, f, d = t.indexOf(".");
|
|
994
|
+
d !== -1 ? (s = t.substr(0, d), (f = t.substr(d + 1)) === "" ? n === void 0 ? N(e) && !isNaN(parseInt(s)) ? e.splice(s, 1) : delete e[s] : e[s] = n : ne(d = !(d = e[s]) || !W(e, s) ? e[s] = {} : d, f, n)) : n === void 0 ? N(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n;
|
|
995
995
|
}
|
|
996
996
|
}
|
|
997
|
-
function
|
|
997
|
+
function Ie(e) {
|
|
998
998
|
var t, n = {};
|
|
999
999
|
for (t in e) W(e, t) && (n[t] = e[t]);
|
|
1000
1000
|
return n;
|
|
1001
1001
|
}
|
|
1002
|
-
var
|
|
1003
|
-
function
|
|
1004
|
-
return
|
|
1002
|
+
var I = [].concat;
|
|
1003
|
+
function Dt(e) {
|
|
1004
|
+
return I.apply([], e);
|
|
1005
1005
|
}
|
|
1006
|
-
var ct = "BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(
|
|
1006
|
+
var ct = "BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(Dt([8, 16, 32, 64].map(function(e) {
|
|
1007
1007
|
return ["Int", "Uint", "Float"].map(function(t) {
|
|
1008
1008
|
return t + e + "Array";
|
|
1009
1009
|
});
|
|
@@ -1012,14 +1012,14 @@ function Ai() {
|
|
|
1012
1012
|
}), He = new Set(ct.map(function(e) {
|
|
1013
1013
|
return m[e];
|
|
1014
1014
|
})), de = null;
|
|
1015
|
-
function
|
|
1015
|
+
function ke(e) {
|
|
1016
1016
|
return de = /* @__PURE__ */ new WeakMap(), e = (function t(n) {
|
|
1017
1017
|
if (!n || typeof n != "object") return n;
|
|
1018
1018
|
var r = de.get(n);
|
|
1019
1019
|
if (r) return r;
|
|
1020
1020
|
if (N(n)) {
|
|
1021
1021
|
r = [], de.set(n, r);
|
|
1022
|
-
for (var a = 0,
|
|
1022
|
+
for (var a = 0, s = n.length; a < s; ++a) r.push(t(n[a]));
|
|
1023
1023
|
} else if (He.has(n.constructor)) r = n;
|
|
1024
1024
|
else {
|
|
1025
1025
|
var f, d = j(n);
|
|
@@ -1029,7 +1029,7 @@ function Ai() {
|
|
|
1029
1029
|
})(e), de = null, e;
|
|
1030
1030
|
}
|
|
1031
1031
|
var zt = {}.toString;
|
|
1032
|
-
function
|
|
1032
|
+
function Ke(e) {
|
|
1033
1033
|
return zt.call(e).slice(8, -1);
|
|
1034
1034
|
}
|
|
1035
1035
|
var bt = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", le = typeof bt == "symbol" ? function(e) {
|
|
@@ -1041,12 +1041,12 @@ function Ai() {
|
|
|
1041
1041
|
function Xe(e, t) {
|
|
1042
1042
|
return t = e.indexOf(t), 0 <= t && e.splice(t, 1), 0 <= t;
|
|
1043
1043
|
}
|
|
1044
|
-
var
|
|
1044
|
+
var Ue = {};
|
|
1045
1045
|
function Fe(e) {
|
|
1046
1046
|
var t, n, r, a;
|
|
1047
1047
|
if (arguments.length === 1) {
|
|
1048
1048
|
if (N(e)) return e.slice();
|
|
1049
|
-
if (this ===
|
|
1049
|
+
if (this === Ue && typeof e == "string") return [e];
|
|
1050
1050
|
if (a = le(e)) {
|
|
1051
1051
|
for (n = []; !(r = a.next()).done; ) n.push(r.value);
|
|
1052
1052
|
return n;
|
|
@@ -1059,11 +1059,11 @@ function Ai() {
|
|
|
1059
1059
|
for (t = arguments.length, n = new Array(t); t--; ) n[t] = arguments[t];
|
|
1060
1060
|
return n;
|
|
1061
1061
|
}
|
|
1062
|
-
var
|
|
1062
|
+
var qe = typeof Symbol < "u" ? function(e) {
|
|
1063
1063
|
return e[Symbol.toStringTag] === "AsyncFunction";
|
|
1064
1064
|
} : function() {
|
|
1065
1065
|
return !1;
|
|
1066
|
-
},
|
|
1066
|
+
}, kt = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"], je = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat(kt), It = { VersionChanged: "Database version changed by other database connection", DatabaseClosed: "Database has been closed", Abort: "Transaction aborted", TransactionInactive: "Transaction has already completed or failed", MissingAPI: "IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb" };
|
|
1067
1067
|
function Ze(e, t) {
|
|
1068
1068
|
this.name = e, this.message = t;
|
|
1069
1069
|
}
|
|
@@ -1088,19 +1088,19 @@ function Ai() {
|
|
|
1088
1088
|
} }), F(Je).from(Ze), F(et).from(Ze);
|
|
1089
1089
|
var l = je.reduce(function(e, t) {
|
|
1090
1090
|
return e[t] = t + "Error", e;
|
|
1091
|
-
}, {}),
|
|
1091
|
+
}, {}), o = Ze, C = je.reduce(function(e, t) {
|
|
1092
1092
|
var n = t + "Error";
|
|
1093
|
-
function r(a,
|
|
1094
|
-
this.name = n, a ? typeof a == "string" ? (this.message = "".concat(a).concat(
|
|
1095
|
-
` +
|
|
1093
|
+
function r(a, s) {
|
|
1094
|
+
this.name = n, a ? typeof a == "string" ? (this.message = "".concat(a).concat(s ? `
|
|
1095
|
+
` + s : ""), this.inner = s || null) : typeof a == "object" && (this.message = "".concat(a.name, " ").concat(a.message), this.inner = a) : (this.message = It[t] || n, this.inner = null);
|
|
1096
1096
|
}
|
|
1097
|
-
return F(r).from(
|
|
1097
|
+
return F(r).from(o), e[t] = r, e;
|
|
1098
1098
|
}, {});
|
|
1099
|
-
|
|
1100
|
-
var E =
|
|
1101
|
-
return e[t + "Error"] =
|
|
1099
|
+
C.Syntax = SyntaxError, C.Type = TypeError, C.Range = RangeError;
|
|
1100
|
+
var E = kt.reduce(function(e, t) {
|
|
1101
|
+
return e[t + "Error"] = C[t], e;
|
|
1102
1102
|
}, {}), ie = je.reduce(function(e, t) {
|
|
1103
|
-
return ["Syntax", "Type", "Range"].indexOf(t) === -1 && (e[t + "Error"] =
|
|
1103
|
+
return ["Syntax", "Type", "Range"].indexOf(t) === -1 && (e[t + "Error"] = C[t]), e;
|
|
1104
1104
|
}, {});
|
|
1105
1105
|
function Q() {
|
|
1106
1106
|
}
|
|
@@ -1123,8 +1123,8 @@ function Ai() {
|
|
|
1123
1123
|
n !== void 0 && (arguments[0] = n);
|
|
1124
1124
|
var r = this.onsuccess, a = this.onerror;
|
|
1125
1125
|
this.onsuccess = null, this.onerror = null;
|
|
1126
|
-
var
|
|
1127
|
-
return r && (this.onsuccess = this.onsuccess ? ye(r, this.onsuccess) : r), a && (this.onerror = this.onerror ? ye(a, this.onerror) : a),
|
|
1126
|
+
var s = t.apply(this, arguments);
|
|
1127
|
+
return r && (this.onsuccess = this.onsuccess ? ye(r, this.onsuccess) : r), a && (this.onerror = this.onerror ? ye(a, this.onerror) : a), s !== void 0 ? s : n;
|
|
1128
1128
|
};
|
|
1129
1129
|
}
|
|
1130
1130
|
function _e(e, t) {
|
|
@@ -1134,12 +1134,12 @@ function Ai() {
|
|
|
1134
1134
|
this.onsuccess = this.onerror = null, t.apply(this, arguments), n && (this.onsuccess = this.onsuccess ? ye(n, this.onsuccess) : n), r && (this.onerror = this.onerror ? ye(r, this.onerror) : r);
|
|
1135
1135
|
};
|
|
1136
1136
|
}
|
|
1137
|
-
function
|
|
1137
|
+
function Le(e, t) {
|
|
1138
1138
|
return e === Q ? t : function(n) {
|
|
1139
1139
|
var r = e.apply(this, arguments);
|
|
1140
1140
|
R(n, r);
|
|
1141
|
-
var a = this.onsuccess,
|
|
1142
|
-
return this.onsuccess = null, this.onerror = null, n = t.apply(this, arguments), a && (this.onsuccess = this.onsuccess ? ye(a, this.onsuccess) : a),
|
|
1141
|
+
var a = this.onsuccess, s = this.onerror;
|
|
1142
|
+
return this.onsuccess = null, this.onerror = null, n = t.apply(this, arguments), a && (this.onsuccess = this.onsuccess ? ye(a, this.onsuccess) : a), s && (this.onerror = this.onerror ? ye(s, this.onerror) : s), r === void 0 ? n === void 0 ? void 0 : n : R(r, n);
|
|
1143
1143
|
};
|
|
1144
1144
|
}
|
|
1145
1145
|
function Nn(e, t) {
|
|
@@ -1151,25 +1151,25 @@ function Ai() {
|
|
|
1151
1151
|
return e === Q ? t : function() {
|
|
1152
1152
|
var n = e.apply(this, arguments);
|
|
1153
1153
|
if (n && typeof n.then == "function") {
|
|
1154
|
-
for (var r = this, a = arguments.length,
|
|
1154
|
+
for (var r = this, a = arguments.length, s = new Array(a); a--; ) s[a] = arguments[a];
|
|
1155
1155
|
return n.then(function() {
|
|
1156
|
-
return t.apply(r,
|
|
1156
|
+
return t.apply(r, s);
|
|
1157
1157
|
});
|
|
1158
1158
|
}
|
|
1159
1159
|
return t.apply(this, arguments);
|
|
1160
1160
|
};
|
|
1161
1161
|
}
|
|
1162
1162
|
ie.ModifyError = Je, ie.DexieError = Ze, ie.BulkError = et;
|
|
1163
|
-
var
|
|
1163
|
+
var Pe = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
|
|
1164
1164
|
function Rt(e) {
|
|
1165
|
-
|
|
1165
|
+
Pe = e;
|
|
1166
1166
|
}
|
|
1167
|
-
var
|
|
1167
|
+
var Pt = {}, pr = 100, ct = typeof Promise > "u" ? [] : (function() {
|
|
1168
1168
|
var e = Promise.resolve();
|
|
1169
1169
|
if (typeof crypto > "u" || !crypto.subtle) return [e, j(e), e];
|
|
1170
1170
|
var t = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
|
|
1171
1171
|
return [t, j(t), e];
|
|
1172
|
-
})(),
|
|
1172
|
+
})(), kt = ct[0], je = ct[1], ct = ct[2], je = je && je.then, lt = kt && kt.constructor, An = !!ct, Ft = function(e, t) {
|
|
1173
1173
|
Bt.push([e, t]), Qt && (queueMicrotask(xa), Qt = !1);
|
|
1174
1174
|
}, On = !0, Qt = !0, ft = [], Ht = [], Cn = he, nt = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: Q, pgp: !1, env: {}, finalize: Q }, z = nt, Bt = [], dt = 0, Zt = [];
|
|
1175
1175
|
function G(e) {
|
|
@@ -1177,43 +1177,43 @@ function Ai() {
|
|
|
1177
1177
|
this._listeners = [], this._lib = !1;
|
|
1178
1178
|
var t = this._PSD = z;
|
|
1179
1179
|
if (typeof e != "function") {
|
|
1180
|
-
if (e !==
|
|
1181
|
-
return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 &&
|
|
1180
|
+
if (e !== Pt) throw new TypeError("Not a function");
|
|
1181
|
+
return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 && In(this, this._value));
|
|
1182
1182
|
}
|
|
1183
1183
|
this._state = null, this._value = null, ++t.ref, (function n(r, a) {
|
|
1184
1184
|
try {
|
|
1185
|
-
a(function(
|
|
1185
|
+
a(function(s) {
|
|
1186
1186
|
if (r._state === null) {
|
|
1187
|
-
if (
|
|
1187
|
+
if (s === r) throw new TypeError("A promise cannot be resolved with itself.");
|
|
1188
1188
|
var f = r._lib && _t();
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
}) : (r._state = !0, r._value =
|
|
1189
|
+
s && typeof s.then == "function" ? n(r, function(d, v) {
|
|
1190
|
+
s instanceof G ? s._then(d, v) : s.then(d, v);
|
|
1191
|
+
}) : (r._state = !0, r._value = s, yr(r)), f && Tt();
|
|
1192
1192
|
}
|
|
1193
|
-
},
|
|
1194
|
-
} catch (
|
|
1195
|
-
|
|
1193
|
+
}, In.bind(null, r));
|
|
1194
|
+
} catch (s) {
|
|
1195
|
+
In(r, s);
|
|
1196
1196
|
}
|
|
1197
1197
|
})(this, e);
|
|
1198
1198
|
}
|
|
1199
|
-
var
|
|
1199
|
+
var Dn = { get: function() {
|
|
1200
1200
|
var e = z, t = nn;
|
|
1201
1201
|
function n(r, a) {
|
|
1202
|
-
var
|
|
1203
|
-
Sn(
|
|
1202
|
+
var s = this, f = !e.global && (e !== z || t !== nn), d = f && !at(), v = new G(function(w, T) {
|
|
1203
|
+
Sn(s, new gr(br(r, e, f, d), br(a, e, f, d), w, T, e));
|
|
1204
1204
|
});
|
|
1205
1205
|
return this._consoleTask && (v._consoleTask = this._consoleTask), v;
|
|
1206
1206
|
}
|
|
1207
|
-
return n.prototype =
|
|
1207
|
+
return n.prototype = Pt, n;
|
|
1208
1208
|
}, set: function(e) {
|
|
1209
|
-
B(this, "then", e && e.prototype ===
|
|
1209
|
+
B(this, "then", e && e.prototype === Pt ? Dn : { get: function() {
|
|
1210
1210
|
return e;
|
|
1211
|
-
}, set:
|
|
1211
|
+
}, set: Dn.set });
|
|
1212
1212
|
} };
|
|
1213
1213
|
function gr(e, t, n, r, a) {
|
|
1214
1214
|
this.onFulfilled = typeof e == "function" ? e : null, this.onRejected = typeof t == "function" ? t : null, this.resolve = n, this.reject = r, this.psd = a;
|
|
1215
1215
|
}
|
|
1216
|
-
function
|
|
1216
|
+
function In(e, t) {
|
|
1217
1217
|
var n, r;
|
|
1218
1218
|
Ht.push(t), e._state === null && (n = e._lib && _t(), t = Cn(t), e._state = !1, e._value = t, r = e, ft.some(function(a) {
|
|
1219
1219
|
return a._value === r._value;
|
|
@@ -1238,13 +1238,13 @@ function Ai() {
|
|
|
1238
1238
|
function Ea(e, t, n) {
|
|
1239
1239
|
try {
|
|
1240
1240
|
var r, a = t._value;
|
|
1241
|
-
!t._state && Ht.length && (Ht = []), r =
|
|
1241
|
+
!t._state && Ht.length && (Ht = []), r = Pe && t._consoleTask ? t._consoleTask.run(function() {
|
|
1242
1242
|
return e(a);
|
|
1243
|
-
}) : e(a), t._state || Ht.indexOf(a) !== -1 || (function(
|
|
1244
|
-
for (var f = ft.length; f; ) if (ft[--f]._value ===
|
|
1243
|
+
}) : e(a), t._state || Ht.indexOf(a) !== -1 || (function(s) {
|
|
1244
|
+
for (var f = ft.length; f; ) if (ft[--f]._value === s._value) return ft.splice(f, 1);
|
|
1245
1245
|
})(t), n.resolve(r);
|
|
1246
|
-
} catch (
|
|
1247
|
-
n.reject(
|
|
1246
|
+
} catch (s) {
|
|
1247
|
+
n.reject(s);
|
|
1248
1248
|
} finally {
|
|
1249
1249
|
--dt == 0 && Rn(), --n.psd.ref || n.psd.finalize();
|
|
1250
1250
|
}
|
|
@@ -1276,7 +1276,7 @@ function Ai() {
|
|
|
1276
1276
|
for (var t = Zt.slice(0), n = t.length; n; ) t[--n]();
|
|
1277
1277
|
}
|
|
1278
1278
|
function Jt(e) {
|
|
1279
|
-
return new G(
|
|
1279
|
+
return new G(Pt, !1, e);
|
|
1280
1280
|
}
|
|
1281
1281
|
function ge(e, t) {
|
|
1282
1282
|
var n = z;
|
|
@@ -1284,14 +1284,14 @@ function Ai() {
|
|
|
1284
1284
|
var r = _t(), a = z;
|
|
1285
1285
|
try {
|
|
1286
1286
|
return it(n, !0), e.apply(this, arguments);
|
|
1287
|
-
} catch (
|
|
1288
|
-
t && t(
|
|
1287
|
+
} catch (s) {
|
|
1288
|
+
t && t(s);
|
|
1289
1289
|
} finally {
|
|
1290
1290
|
it(a, !1), r && Tt();
|
|
1291
1291
|
}
|
|
1292
1292
|
};
|
|
1293
1293
|
}
|
|
1294
|
-
J(G.prototype, { then:
|
|
1294
|
+
J(G.prototype, { then: Dn, _then: function(e, t) {
|
|
1295
1295
|
Sn(this, new gr(null, null, e, t, z));
|
|
1296
1296
|
}, catch: function(e) {
|
|
1297
1297
|
if (arguments.length === 1) return this.then(null, e);
|
|
@@ -1314,26 +1314,26 @@ function Ai() {
|
|
|
1314
1314
|
}, timeout: function(e, t) {
|
|
1315
1315
|
var n = this;
|
|
1316
1316
|
return e < 1 / 0 ? new G(function(r, a) {
|
|
1317
|
-
var
|
|
1318
|
-
return a(new
|
|
1317
|
+
var s = setTimeout(function() {
|
|
1318
|
+
return a(new C.Timeout(t));
|
|
1319
1319
|
}, e);
|
|
1320
|
-
n.then(r, a).finally(clearTimeout.bind(null,
|
|
1320
|
+
n.then(r, a).finally(clearTimeout.bind(null, s));
|
|
1321
1321
|
}) : this;
|
|
1322
1322
|
} }), typeof Symbol < "u" && Symbol.toStringTag && B(G.prototype, Symbol.toStringTag, "Dexie.Promise"), nt.env = vr(), J(G, { all: function() {
|
|
1323
1323
|
var e = Fe.apply(null, arguments).map(rn);
|
|
1324
1324
|
return new G(function(t, n) {
|
|
1325
1325
|
e.length === 0 && t([]);
|
|
1326
1326
|
var r = e.length;
|
|
1327
|
-
e.forEach(function(a,
|
|
1327
|
+
e.forEach(function(a, s) {
|
|
1328
1328
|
return G.resolve(a).then(function(f) {
|
|
1329
|
-
e[
|
|
1329
|
+
e[s] = f, --r || t(e);
|
|
1330
1330
|
}, n);
|
|
1331
1331
|
});
|
|
1332
1332
|
});
|
|
1333
1333
|
}, resolve: function(e) {
|
|
1334
1334
|
return e instanceof G ? e : e && typeof e.then == "function" ? new G(function(t, n) {
|
|
1335
1335
|
e.then(t, n);
|
|
1336
|
-
}) : new G(
|
|
1336
|
+
}) : new G(Pt, !0, e);
|
|
1337
1337
|
}, reject: Jt, race: function() {
|
|
1338
1338
|
var e = Fe.apply(null, arguments).map(rn);
|
|
1339
1339
|
return new G(function(t, n) {
|
|
@@ -1357,12 +1357,12 @@ function Ai() {
|
|
|
1357
1357
|
Cn = e;
|
|
1358
1358
|
} }, follow: function(e, t) {
|
|
1359
1359
|
return new G(function(n, r) {
|
|
1360
|
-
return rt(function(a,
|
|
1360
|
+
return rt(function(a, s) {
|
|
1361
1361
|
var f = z;
|
|
1362
|
-
f.unhandleds = [], f.onunhandled =
|
|
1362
|
+
f.unhandleds = [], f.onunhandled = s, f.finalize = ye(function() {
|
|
1363
1363
|
var d, v = this;
|
|
1364
1364
|
d = function() {
|
|
1365
|
-
v.unhandleds.length === 0 ? a() :
|
|
1365
|
+
v.unhandleds.length === 0 ? a() : s(v.unhandleds[0]);
|
|
1366
1366
|
}, Zt.push(function w() {
|
|
1367
1367
|
d(), Zt.splice(Zt.indexOf(w), 1);
|
|
1368
1368
|
}), ++dt, Ft(function() {
|
|
@@ -1376,11 +1376,11 @@ function Ai() {
|
|
|
1376
1376
|
return new G(function(t) {
|
|
1377
1377
|
e.length === 0 && t([]);
|
|
1378
1378
|
var n = e.length, r = new Array(n);
|
|
1379
|
-
e.forEach(function(a,
|
|
1379
|
+
e.forEach(function(a, s) {
|
|
1380
1380
|
return G.resolve(a).then(function(f) {
|
|
1381
|
-
return r[
|
|
1381
|
+
return r[s] = { status: "fulfilled", value: f };
|
|
1382
1382
|
}, function(f) {
|
|
1383
|
-
return r[
|
|
1383
|
+
return r[s] = { status: "rejected", reason: f };
|
|
1384
1384
|
}).then(function() {
|
|
1385
1385
|
return --n || t(r);
|
|
1386
1386
|
});
|
|
@@ -1391,8 +1391,8 @@ function Ai() {
|
|
|
1391
1391
|
return new G(function(t, n) {
|
|
1392
1392
|
e.length === 0 && n(new AggregateError([]));
|
|
1393
1393
|
var r = e.length, a = new Array(r);
|
|
1394
|
-
e.forEach(function(
|
|
1395
|
-
return G.resolve(
|
|
1394
|
+
e.forEach(function(s, f) {
|
|
1395
|
+
return G.resolve(s).then(function(d) {
|
|
1396
1396
|
return t(d);
|
|
1397
1397
|
}, function(d) {
|
|
1398
1398
|
a[f] = d, --r || n(new AggregateError(a));
|
|
@@ -1402,10 +1402,10 @@ function Ai() {
|
|
|
1402
1402
|
}), lt.withResolvers && (G.withResolvers = lt.withResolvers));
|
|
1403
1403
|
var Ee = { awaits: 0, echoes: 0, id: 0 }, Na = 0, en = [], tn = 0, nn = 0, Aa = 0;
|
|
1404
1404
|
function rt(e, t, n, r) {
|
|
1405
|
-
var a = z,
|
|
1406
|
-
return
|
|
1405
|
+
var a = z, s = Object.create(a);
|
|
1406
|
+
return s.parent = a, s.ref = 0, s.global = !1, s.id = ++Aa, nt.env, s.env = An ? { Promise: G, PromiseProp: { value: G, configurable: !0, writable: !0 }, all: G.all, race: G.race, allSettled: G.allSettled, any: G.any, resolve: G.resolve, reject: G.reject } : {}, t && R(s, t), ++a.ref, s.finalize = function() {
|
|
1407
1407
|
--this.parent.ref || this.parent.finalize();
|
|
1408
|
-
}, r = ht(
|
|
1408
|
+
}, r = ht(s, e, n, r), s.ref === 0 && s.finalize(), r;
|
|
1409
1409
|
}
|
|
1410
1410
|
function Et() {
|
|
1411
1411
|
return Ee.id || (Ee.id = ++Na), ++Ee.awaits, Ee.echoes += pr, Ee.id;
|
|
@@ -1435,11 +1435,11 @@ function Ai() {
|
|
|
1435
1435
|
return An ? { Promise: e, PromiseProp: Object.getOwnPropertyDescriptor(m, "Promise"), all: e.all, race: e.race, allSettled: e.allSettled, any: e.any, resolve: e.resolve, reject: e.reject } : {};
|
|
1436
1436
|
}
|
|
1437
1437
|
function ht(e, t, n, r, a) {
|
|
1438
|
-
var
|
|
1438
|
+
var s = z;
|
|
1439
1439
|
try {
|
|
1440
1440
|
return it(e, !0), t(n, r, a);
|
|
1441
1441
|
} finally {
|
|
1442
|
-
it(
|
|
1442
|
+
it(s, !1);
|
|
1443
1443
|
}
|
|
1444
1444
|
}
|
|
1445
1445
|
function br(e, t, n, r) {
|
|
@@ -1453,11 +1453,11 @@ function Ai() {
|
|
|
1453
1453
|
}
|
|
1454
1454
|
};
|
|
1455
1455
|
}
|
|
1456
|
-
function
|
|
1456
|
+
function Pn(e) {
|
|
1457
1457
|
Promise === lt && Ee.echoes === 0 ? tn === 0 ? e() : enqueueNativeMicroTask(e) : setTimeout(e, 0);
|
|
1458
1458
|
}
|
|
1459
1459
|
("" + je).indexOf("[native code]") === -1 && (Et = at = Q);
|
|
1460
|
-
var be = G.reject, mt = "", We = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", wr = "String expected.", xt = [], an = "__dbnames",
|
|
1460
|
+
var be = G.reject, mt = "", We = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", wr = "String expected.", xt = [], an = "__dbnames", kn = "readonly", Fn = "readwrite";
|
|
1461
1461
|
function pt(e, t) {
|
|
1462
1462
|
return e ? t ? function() {
|
|
1463
1463
|
return e.apply(this, arguments) && t.apply(this, arguments);
|
|
@@ -1468,11 +1468,11 @@ function Ai() {
|
|
|
1468
1468
|
return typeof e != "string" || /\./.test(e) ? function(t) {
|
|
1469
1469
|
return t;
|
|
1470
1470
|
} : function(t) {
|
|
1471
|
-
return t[e] === void 0 && e in t && delete (t =
|
|
1471
|
+
return t[e] === void 0 && e in t && delete (t = ke(t))[e], t;
|
|
1472
1472
|
};
|
|
1473
1473
|
}
|
|
1474
1474
|
function Tr() {
|
|
1475
|
-
throw
|
|
1475
|
+
throw C.Type("Entity instances must never be new:ed. Instances are generated by the framework bypassing the constructor.");
|
|
1476
1476
|
}
|
|
1477
1477
|
function re(e, t) {
|
|
1478
1478
|
try {
|
|
@@ -1484,14 +1484,14 @@ function Ai() {
|
|
|
1484
1484
|
case "string":
|
|
1485
1485
|
return t < e ? 1 : e < t ? -1 : 0;
|
|
1486
1486
|
case "binary":
|
|
1487
|
-
return (function(a,
|
|
1488
|
-
for (var f = a.length, d =
|
|
1487
|
+
return (function(a, s) {
|
|
1488
|
+
for (var f = a.length, d = s.length, v = f < d ? f : d, w = 0; w < v; ++w) if (a[w] !== s[w]) return a[w] < s[w] ? -1 : 1;
|
|
1489
1489
|
return f === d ? 0 : f < d ? -1 : 1;
|
|
1490
1490
|
})(xr(e), xr(t));
|
|
1491
1491
|
case "Array":
|
|
1492
|
-
return (function(a,
|
|
1493
|
-
for (var f = a.length, d =
|
|
1494
|
-
var T = re(a[w],
|
|
1492
|
+
return (function(a, s) {
|
|
1493
|
+
for (var f = a.length, d = s.length, v = f < d ? f : d, w = 0; w < v; ++w) {
|
|
1494
|
+
var T = re(a[w], s[w]);
|
|
1495
1495
|
if (T !== 0) return T;
|
|
1496
1496
|
}
|
|
1497
1497
|
return f === d ? 0 : f < d ? -1 : 1;
|
|
@@ -1503,15 +1503,15 @@ function Ai() {
|
|
|
1503
1503
|
}
|
|
1504
1504
|
function Er(e) {
|
|
1505
1505
|
var t = typeof e;
|
|
1506
|
-
return t != "object" ? t : ArrayBuffer.isView(e) ? "binary" : (e =
|
|
1506
|
+
return t != "object" ? t : ArrayBuffer.isView(e) ? "binary" : (e = Ke(e), e === "ArrayBuffer" ? "binary" : e);
|
|
1507
1507
|
}
|
|
1508
1508
|
function xr(e) {
|
|
1509
1509
|
return e instanceof Uint8Array ? e : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength) : new Uint8Array(e);
|
|
1510
1510
|
}
|
|
1511
1511
|
function sn(e, t, n) {
|
|
1512
1512
|
var r = e.schema.yProps;
|
|
1513
|
-
return r ? (t && 0 < n.numFailures && (t = t.filter(function(a,
|
|
1514
|
-
return !n.failures[
|
|
1513
|
+
return r ? (t && 0 < n.numFailures && (t = t.filter(function(a, s) {
|
|
1514
|
+
return !n.failures[s];
|
|
1515
1515
|
})), Promise.all(r.map(function(a) {
|
|
1516
1516
|
return a = a.updatesTable, t ? e.db.table(a).where("k").anyOf(t).delete() : e.db.table(a).clear();
|
|
1517
1517
|
})).then(function() {
|
|
@@ -1519,9 +1519,9 @@ function Ai() {
|
|
|
1519
1519
|
})) : n;
|
|
1520
1520
|
}
|
|
1521
1521
|
var Nr = (me.prototype._trans = function(e, t, n) {
|
|
1522
|
-
var r = this._tx || z.trans, a = this.name,
|
|
1522
|
+
var r = this._tx || z.trans, a = this.name, s = Pe && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(e === "readonly" ? "read" : "write", " ").concat(this.name));
|
|
1523
1523
|
function f(w, T, p) {
|
|
1524
|
-
if (!p.schema[a]) throw new
|
|
1524
|
+
if (!p.schema[a]) throw new C.NotFound("Table " + a + " not part of transaction");
|
|
1525
1525
|
return t(p.idbtrans, p);
|
|
1526
1526
|
}
|
|
1527
1527
|
var d = _t();
|
|
@@ -1552,16 +1552,16 @@ function Ai() {
|
|
|
1552
1552
|
});
|
|
1553
1553
|
});
|
|
1554
1554
|
}
|
|
1555
|
-
if (T._state.openComplete) return be(new
|
|
1555
|
+
if (T._state.openComplete) return be(new C.DatabaseClosed(T._state.dbOpenError));
|
|
1556
1556
|
if (!T._state.isBeingOpened) {
|
|
1557
|
-
if (!T._state.autoOpen) return be(new
|
|
1557
|
+
if (!T._state.autoOpen) return be(new C.DatabaseClosed());
|
|
1558
1558
|
T.open().catch(Q);
|
|
1559
1559
|
}
|
|
1560
1560
|
return T._state.dbReadyPromise.then(function() {
|
|
1561
1561
|
return w(T, p, O, b);
|
|
1562
1562
|
});
|
|
1563
1563
|
})(this.db, e, [this.name], f);
|
|
1564
|
-
return
|
|
1564
|
+
return s && (v._consoleTask = s, v = v.catch(function(w) {
|
|
1565
1565
|
return console.trace(w), be(w);
|
|
1566
1566
|
})), v;
|
|
1567
1567
|
} finally {
|
|
@@ -1569,7 +1569,7 @@ function Ai() {
|
|
|
1569
1569
|
}
|
|
1570
1570
|
}, me.prototype.get = function(e, t) {
|
|
1571
1571
|
var n = this;
|
|
1572
|
-
return e && e.constructor === Object ? this.where(e).first(t) : e == null ? be(new
|
|
1572
|
+
return e && e.constructor === Object ? this.where(e).first(t) : e == null ? be(new C.Type("Invalid argument to Table.get()")) : this._trans("readonly", function(r) {
|
|
1573
1573
|
return n.core.get({ trans: r, key: e }).then(function(a) {
|
|
1574
1574
|
return n.hook.reading.fire(a);
|
|
1575
1575
|
});
|
|
@@ -1591,12 +1591,12 @@ function Ai() {
|
|
|
1591
1591
|
return d.keyPath.length - v.keyPath.length;
|
|
1592
1592
|
})[0];
|
|
1593
1593
|
if (n && this.db._maxKey !== mt) {
|
|
1594
|
-
var
|
|
1595
|
-
return this.where(
|
|
1594
|
+
var s = n.keyPath.slice(0, t.length);
|
|
1595
|
+
return this.where(s).equals(s.map(function(v) {
|
|
1596
1596
|
return e[v];
|
|
1597
1597
|
}));
|
|
1598
1598
|
}
|
|
1599
|
-
!n &&
|
|
1599
|
+
!n && Pe && console.warn("The query ".concat(JSON.stringify(e), " on ").concat(this.name, " would benefit from a ") + "compound index [".concat(t.join("+"), "]"));
|
|
1600
1600
|
var r = this.schema.idxByName;
|
|
1601
1601
|
function a(d, v) {
|
|
1602
1602
|
return re(d, v) === 0;
|
|
@@ -1610,8 +1610,8 @@ function Ai() {
|
|
|
1610
1610
|
} : function(b) {
|
|
1611
1611
|
return a(O, pe(b, v));
|
|
1612
1612
|
}) : T];
|
|
1613
|
-
}, [null, null]),
|
|
1614
|
-
return
|
|
1613
|
+
}, [null, null]), s = f[0], f = f[1];
|
|
1614
|
+
return s ? this.where(s.name).equals(e[s.keyPath]).filter(f) : n ? this.filter(f) : this.where(t).equals("");
|
|
1615
1615
|
}, me.prototype.filter = function(e) {
|
|
1616
1616
|
return this.toCollection().and(e);
|
|
1617
1617
|
}, me.prototype.count = function(e) {
|
|
@@ -1646,13 +1646,13 @@ function Ai() {
|
|
|
1646
1646
|
}, enumerable: !1, configurable: !0 }), a.prototype.table = function() {
|
|
1647
1647
|
return r;
|
|
1648
1648
|
}, e = a);
|
|
1649
|
-
for (var
|
|
1650
|
-
return
|
|
1649
|
+
for (var s = /* @__PURE__ */ new Set(), f = e.prototype; f; f = j(f)) Object.getOwnPropertyNames(f).forEach(function(v) {
|
|
1650
|
+
return s.add(v);
|
|
1651
1651
|
});
|
|
1652
1652
|
function d(v) {
|
|
1653
1653
|
if (!v) return v;
|
|
1654
1654
|
var w, T = Object.create(e.prototype);
|
|
1655
|
-
for (w in v) if (!
|
|
1655
|
+
for (w in v) if (!s.has(w)) try {
|
|
1656
1656
|
T[w] = v[w];
|
|
1657
1657
|
} catch {
|
|
1658
1658
|
}
|
|
@@ -1664,29 +1664,29 @@ function Ai() {
|
|
|
1664
1664
|
R(this, e);
|
|
1665
1665
|
});
|
|
1666
1666
|
}, me.prototype.add = function(e, t) {
|
|
1667
|
-
var n = this, r = this.schema.primKey, a = r.auto,
|
|
1668
|
-
return
|
|
1667
|
+
var n = this, r = this.schema.primKey, a = r.auto, s = r.keyPath, f = e;
|
|
1668
|
+
return s && a && (f = on(s)(e)), this._trans("readwrite", function(d) {
|
|
1669
1669
|
return n.core.mutate({ trans: d, type: "add", keys: t != null ? [t] : null, values: [f] });
|
|
1670
1670
|
}).then(function(d) {
|
|
1671
1671
|
return d.numFailures ? G.reject(d.failures[0]) : d.lastResult;
|
|
1672
1672
|
}).then(function(d) {
|
|
1673
|
-
if (
|
|
1674
|
-
ne(e,
|
|
1673
|
+
if (s) try {
|
|
1674
|
+
ne(e, s, d);
|
|
1675
1675
|
} catch {
|
|
1676
1676
|
}
|
|
1677
1677
|
return d;
|
|
1678
1678
|
});
|
|
1679
1679
|
}, me.prototype.update = function(e, t) {
|
|
1680
|
-
return typeof e != "object" || N(e) ? this.where(":id").equals(e).modify(t) : (e = pe(e, this.schema.primKey.keyPath), e === void 0 ? be(new
|
|
1680
|
+
return typeof e != "object" || N(e) ? this.where(":id").equals(e).modify(t) : (e = pe(e, this.schema.primKey.keyPath), e === void 0 ? be(new C.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
|
|
1681
1681
|
}, me.prototype.put = function(e, t) {
|
|
1682
|
-
var n = this, r = this.schema.primKey, a = r.auto,
|
|
1683
|
-
return
|
|
1682
|
+
var n = this, r = this.schema.primKey, a = r.auto, s = r.keyPath, f = e;
|
|
1683
|
+
return s && a && (f = on(s)(e)), this._trans("readwrite", function(d) {
|
|
1684
1684
|
return n.core.mutate({ trans: d, type: "put", values: [f], keys: t != null ? [t] : null });
|
|
1685
1685
|
}).then(function(d) {
|
|
1686
1686
|
return d.numFailures ? G.reject(d.failures[0]) : d.lastResult;
|
|
1687
1687
|
}).then(function(d) {
|
|
1688
|
-
if (
|
|
1689
|
-
ne(e,
|
|
1688
|
+
if (s) try {
|
|
1689
|
+
ne(e, s, d);
|
|
1690
1690
|
} catch {
|
|
1691
1691
|
}
|
|
1692
1692
|
return d;
|
|
@@ -1719,28 +1719,28 @@ function Ai() {
|
|
|
1719
1719
|
});
|
|
1720
1720
|
});
|
|
1721
1721
|
}, me.prototype.bulkAdd = function(e, t, n) {
|
|
1722
|
-
var r = this, a = Array.isArray(t) ? t : void 0,
|
|
1722
|
+
var r = this, a = Array.isArray(t) ? t : void 0, s = (n = n || (a ? void 0 : t)) ? n.allKeys : void 0;
|
|
1723
1723
|
return this._trans("readwrite", function(f) {
|
|
1724
1724
|
var w = r.schema.primKey, d = w.auto, w = w.keyPath;
|
|
1725
|
-
if (w && a) throw new
|
|
1726
|
-
if (a && a.length !== e.length) throw new
|
|
1725
|
+
if (w && a) throw new C.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
|
|
1726
|
+
if (a && a.length !== e.length) throw new C.InvalidArgument("Arguments objects and keys must have the same length");
|
|
1727
1727
|
var v = e.length, w = w && d ? e.map(on(w)) : e;
|
|
1728
|
-
return r.core.mutate({ trans: f, type: "add", keys: a, values: w, wantResults:
|
|
1728
|
+
return r.core.mutate({ trans: f, type: "add", keys: a, values: w, wantResults: s }).then(function(_) {
|
|
1729
1729
|
var p = _.numFailures, O = _.results, b = _.lastResult, _ = _.failures;
|
|
1730
|
-
if (p === 0) return
|
|
1730
|
+
if (p === 0) return s ? O : b;
|
|
1731
1731
|
throw new et("".concat(r.name, ".bulkAdd(): ").concat(p, " of ").concat(v, " operations failed"), _);
|
|
1732
1732
|
});
|
|
1733
1733
|
});
|
|
1734
1734
|
}, me.prototype.bulkPut = function(e, t, n) {
|
|
1735
|
-
var r = this, a = Array.isArray(t) ? t : void 0,
|
|
1735
|
+
var r = this, a = Array.isArray(t) ? t : void 0, s = (n = n || (a ? void 0 : t)) ? n.allKeys : void 0;
|
|
1736
1736
|
return this._trans("readwrite", function(f) {
|
|
1737
1737
|
var w = r.schema.primKey, d = w.auto, w = w.keyPath;
|
|
1738
|
-
if (w && a) throw new
|
|
1739
|
-
if (a && a.length !== e.length) throw new
|
|
1738
|
+
if (w && a) throw new C.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
|
|
1739
|
+
if (a && a.length !== e.length) throw new C.InvalidArgument("Arguments objects and keys must have the same length");
|
|
1740
1740
|
var v = e.length, w = w && d ? e.map(on(w)) : e;
|
|
1741
|
-
return r.core.mutate({ trans: f, type: "put", keys: a, values: w, wantResults:
|
|
1741
|
+
return r.core.mutate({ trans: f, type: "put", keys: a, values: w, wantResults: s }).then(function(_) {
|
|
1742
1742
|
var p = _.numFailures, O = _.results, b = _.lastResult, _ = _.failures;
|
|
1743
|
-
if (p === 0) return
|
|
1743
|
+
if (p === 0) return s ? O : b;
|
|
1744
1744
|
throw new et("".concat(r.name, ".bulkPut(): ").concat(p, " of ").concat(v, " operations failed"), _);
|
|
1745
1745
|
});
|
|
1746
1746
|
});
|
|
@@ -1749,20 +1749,20 @@ function Ai() {
|
|
|
1749
1749
|
return f.key;
|
|
1750
1750
|
}), a = e.map(function(f) {
|
|
1751
1751
|
return f.changes;
|
|
1752
|
-
}),
|
|
1752
|
+
}), s = [];
|
|
1753
1753
|
return this._trans("readwrite", function(f) {
|
|
1754
1754
|
return n.getMany({ trans: f, keys: r, cache: "clone" }).then(function(d) {
|
|
1755
1755
|
var v = [], w = [];
|
|
1756
1756
|
e.forEach(function(p, O) {
|
|
1757
1757
|
var b = p.key, _ = p.changes, A = d[O];
|
|
1758
1758
|
if (A) {
|
|
1759
|
-
for (var x = 0,
|
|
1760
|
-
var S =
|
|
1759
|
+
for (var x = 0, D = Object.keys(_); x < D.length; x++) {
|
|
1760
|
+
var S = D[x], P = _[S];
|
|
1761
1761
|
if (S === t.schema.primKey.keyPath) {
|
|
1762
|
-
if (re(
|
|
1763
|
-
} else ne(A, S,
|
|
1762
|
+
if (re(P, b) !== 0) throw new C.Constraint("Cannot update primary key in bulkUpdate()");
|
|
1763
|
+
} else ne(A, S, P);
|
|
1764
1764
|
}
|
|
1765
|
-
|
|
1765
|
+
s.push(O), v.push(b), w.push(A);
|
|
1766
1766
|
}
|
|
1767
1767
|
});
|
|
1768
1768
|
var T = v.length;
|
|
@@ -1770,8 +1770,8 @@ function Ai() {
|
|
|
1770
1770
|
var O = p.numFailures, b = p.failures;
|
|
1771
1771
|
if (O === 0) return T;
|
|
1772
1772
|
for (var _ = 0, A = Object.keys(b); _ < A.length; _++) {
|
|
1773
|
-
var x,
|
|
1774
|
-
S != null && (x = b[
|
|
1773
|
+
var x, D = A[_], S = s[Number(D)];
|
|
1774
|
+
S != null && (x = b[D], delete b[D], b[S] = x);
|
|
1775
1775
|
}
|
|
1776
1776
|
throw new et("".concat(t.name, ".bulkUpdate(): ").concat(O, " of ").concat(T, " operations failed"), b);
|
|
1777
1777
|
});
|
|
@@ -1784,8 +1784,8 @@ function Ai() {
|
|
|
1784
1784
|
return sn(t, e, a);
|
|
1785
1785
|
});
|
|
1786
1786
|
}).then(function(f) {
|
|
1787
|
-
var a = f.numFailures,
|
|
1788
|
-
if (a === 0) return
|
|
1787
|
+
var a = f.numFailures, s = f.lastResult, f = f.failures;
|
|
1788
|
+
if (a === 0) return s;
|
|
1789
1789
|
throw new et("".concat(t.name, ".bulkDelete(): ").concat(a, " of ").concat(n, " operations failed"), f);
|
|
1790
1790
|
});
|
|
1791
1791
|
}, me);
|
|
@@ -1800,10 +1800,10 @@ function Ai() {
|
|
|
1800
1800
|
if (typeof f == "string") return n[f];
|
|
1801
1801
|
}
|
|
1802
1802
|
var n = {};
|
|
1803
|
-
t.addEventType =
|
|
1804
|
-
for (var r = 1, a = arguments.length; r < a; ++r)
|
|
1803
|
+
t.addEventType = s;
|
|
1804
|
+
for (var r = 1, a = arguments.length; r < a; ++r) s(arguments[r]);
|
|
1805
1805
|
return t;
|
|
1806
|
-
function
|
|
1806
|
+
function s(f, d, v) {
|
|
1807
1807
|
if (typeof f != "object") {
|
|
1808
1808
|
var w;
|
|
1809
1809
|
d = d || Nn;
|
|
@@ -1818,10 +1818,10 @@ function Ai() {
|
|
|
1818
1818
|
}
|
|
1819
1819
|
y(w = f).forEach(function(p) {
|
|
1820
1820
|
var O = w[p];
|
|
1821
|
-
if (N(O))
|
|
1821
|
+
if (N(O)) s(p, w[p][0], w[p][1]);
|
|
1822
1822
|
else {
|
|
1823
|
-
if (O !== "asap") throw new
|
|
1824
|
-
var b =
|
|
1823
|
+
if (O !== "asap") throw new C.InvalidArgument("Invalid event config");
|
|
1824
|
+
var b = s(p, he, function() {
|
|
1825
1825
|
for (var _ = arguments.length, A = new Array(_); _--; ) A[_] = arguments[_];
|
|
1826
1826
|
b.subscribers.forEach(function(x) {
|
|
1827
1827
|
ae(function() {
|
|
@@ -1851,7 +1851,7 @@ function Ai() {
|
|
|
1851
1851
|
function un(e, t) {
|
|
1852
1852
|
if (e.isPrimKey) return t.primaryKey;
|
|
1853
1853
|
var n = t.getIndexByKeyPath(e.index);
|
|
1854
|
-
if (!n) throw new
|
|
1854
|
+
if (!n) throw new C.Schema("KeyPath " + e.index + " on object store " + t.name + " is not indexed");
|
|
1855
1855
|
return n;
|
|
1856
1856
|
}
|
|
1857
1857
|
function Ar(e, t, n) {
|
|
@@ -1861,34 +1861,34 @@ function Ai() {
|
|
|
1861
1861
|
function cn(e, t, n, r) {
|
|
1862
1862
|
var a = e.replayFilter ? pt(e.filter, e.replayFilter()) : e.filter;
|
|
1863
1863
|
if (e.or) {
|
|
1864
|
-
var
|
|
1864
|
+
var s = {}, f = function(d, v, w) {
|
|
1865
1865
|
var T, p;
|
|
1866
1866
|
a && !a(v, w, function(O) {
|
|
1867
1867
|
return v.stop(O);
|
|
1868
1868
|
}, function(O) {
|
|
1869
1869
|
return v.fail(O);
|
|
1870
|
-
}) || ((p = "" + (T = v.primaryKey)) == "[object ArrayBuffer]" && (p = "" + new Uint8Array(T)), W(
|
|
1870
|
+
}) || ((p = "" + (T = v.primaryKey)) == "[object ArrayBuffer]" && (p = "" + new Uint8Array(T)), W(s, p) || (s[p] = !0, t(d, v, w)));
|
|
1871
1871
|
};
|
|
1872
1872
|
return Promise.all([e.or._iterate(f, n), Or(Ar(e, r, n), e.algorithm, f, !e.keysOnly && e.valueMapper)]);
|
|
1873
1873
|
}
|
|
1874
1874
|
return Or(Ar(e, r, n), pt(e.algorithm, a), t, !e.keysOnly && e.valueMapper);
|
|
1875
1875
|
}
|
|
1876
1876
|
function Or(e, t, n, r) {
|
|
1877
|
-
var a = ge(r ? function(
|
|
1878
|
-
return n(r(
|
|
1877
|
+
var a = ge(r ? function(s, f, d) {
|
|
1878
|
+
return n(r(s), f, d);
|
|
1879
1879
|
} : n);
|
|
1880
|
-
return e.then(function(
|
|
1881
|
-
if (
|
|
1880
|
+
return e.then(function(s) {
|
|
1881
|
+
if (s) return s.start(function() {
|
|
1882
1882
|
var f = function() {
|
|
1883
|
-
return
|
|
1883
|
+
return s.continue();
|
|
1884
1884
|
};
|
|
1885
|
-
t && !t(
|
|
1885
|
+
t && !t(s, function(d) {
|
|
1886
1886
|
return f = d;
|
|
1887
1887
|
}, function(d) {
|
|
1888
|
-
|
|
1888
|
+
s.stop(d), f = Q;
|
|
1889
1889
|
}, function(d) {
|
|
1890
|
-
|
|
1891
|
-
}) || a(
|
|
1890
|
+
s.fail(d), f = Q;
|
|
1891
|
+
}) || a(s.value, s, function(d) {
|
|
1892
1892
|
return f = d;
|
|
1893
1893
|
}), f();
|
|
1894
1894
|
});
|
|
@@ -1953,21 +1953,21 @@ function Ai() {
|
|
|
1953
1953
|
if (Nt(r, !0)) return a.count({ trans: n, query: { index: un(r, a.schema), range: r.range } }).then(function(f) {
|
|
1954
1954
|
return Math.min(f, r.limit);
|
|
1955
1955
|
});
|
|
1956
|
-
var
|
|
1956
|
+
var s = 0;
|
|
1957
1957
|
return cn(r, function() {
|
|
1958
|
-
return ++
|
|
1958
|
+
return ++s, !1;
|
|
1959
1959
|
}, n, a).then(function() {
|
|
1960
|
-
return
|
|
1960
|
+
return s;
|
|
1961
1961
|
});
|
|
1962
1962
|
}).then(e);
|
|
1963
1963
|
}, ue.prototype.sortBy = function(e, t) {
|
|
1964
1964
|
var n = e.split(".").reverse(), r = n[0], a = n.length - 1;
|
|
1965
|
-
function
|
|
1966
|
-
return w ?
|
|
1965
|
+
function s(v, w) {
|
|
1966
|
+
return w ? s(v[n[w]], w - 1) : v[r];
|
|
1967
1967
|
}
|
|
1968
1968
|
var f = this._ctx.dir === "next" ? 1 : -1;
|
|
1969
1969
|
function d(v, w) {
|
|
1970
|
-
return re(
|
|
1970
|
+
return re(s(v, a), s(w, a)) * f;
|
|
1971
1971
|
}
|
|
1972
1972
|
return this.toArray(function(v) {
|
|
1973
1973
|
return v.sort(d);
|
|
@@ -1977,8 +1977,8 @@ function Ai() {
|
|
|
1977
1977
|
return this._read(function(n) {
|
|
1978
1978
|
var r = t._ctx;
|
|
1979
1979
|
if (r.dir === "next" && Nt(r, !0) && 0 < r.limit) {
|
|
1980
|
-
var a = r.valueMapper,
|
|
1981
|
-
return r.table.core.query({ trans: n, limit: r.limit, values: !0, query: { index:
|
|
1980
|
+
var a = r.valueMapper, s = un(r, r.table.core.schema);
|
|
1981
|
+
return r.table.core.query({ trans: n, limit: r.limit, values: !0, query: { index: s, range: r.range } }).then(function(d) {
|
|
1982
1982
|
return d = d.result, a ? d.map(a) : d;
|
|
1983
1983
|
});
|
|
1984
1984
|
}
|
|
@@ -2089,83 +2089,83 @@ function Ai() {
|
|
|
2089
2089
|
}, ue.prototype.modify = function(e) {
|
|
2090
2090
|
var t = this, n = this._ctx;
|
|
2091
2091
|
return this._write(function(r) {
|
|
2092
|
-
var a,
|
|
2093
|
-
f = typeof e == "function" ? e : (a = y(e),
|
|
2094
|
-
for (var S = !1,
|
|
2095
|
-
var
|
|
2096
|
-
M instanceof Kt ? (ne(
|
|
2092
|
+
var a, s, f;
|
|
2093
|
+
f = typeof e == "function" ? e : (a = y(e), s = a.length, function(D) {
|
|
2094
|
+
for (var S = !1, P = 0; P < s; ++P) {
|
|
2095
|
+
var k = a[P], M = e[k], L = pe(D, k);
|
|
2096
|
+
M instanceof Kt ? (ne(D, k, M.execute(L)), S = !0) : L !== M && (ne(D, k, M), S = !0);
|
|
2097
2097
|
}
|
|
2098
2098
|
return S;
|
|
2099
2099
|
});
|
|
2100
2100
|
var d = n.table.core, p = d.schema.primaryKey, v = p.outbound, w = p.extractKey, T = 200, p = t.db._options.modifyChunkSize;
|
|
2101
2101
|
p && (T = typeof p == "object" ? p[d.name] || p["*"] || 200 : p);
|
|
2102
|
-
function O(
|
|
2103
|
-
var
|
|
2104
|
-
_ +=
|
|
2105
|
-
for (var M = 0, L = y(
|
|
2102
|
+
function O(D, k) {
|
|
2103
|
+
var P = k.failures, k = k.numFailures;
|
|
2104
|
+
_ += D - k;
|
|
2105
|
+
for (var M = 0, L = y(P); M < L.length; M++) {
|
|
2106
2106
|
var K = L[M];
|
|
2107
|
-
b.push(
|
|
2107
|
+
b.push(P[K]);
|
|
2108
2108
|
}
|
|
2109
2109
|
}
|
|
2110
|
-
var b = [], _ = 0, A = [], x = e ===
|
|
2111
|
-
return t.clone().primaryKeys().then(function(
|
|
2112
|
-
function S(
|
|
2113
|
-
var M = Math.min(T,
|
|
2110
|
+
var b = [], _ = 0, A = [], x = e === Dr;
|
|
2111
|
+
return t.clone().primaryKeys().then(function(D) {
|
|
2112
|
+
function S(k) {
|
|
2113
|
+
var M = Math.min(T, D.length - k), L = D.slice(k, k + M);
|
|
2114
2114
|
return (x ? Promise.resolve([]) : d.getMany({ trans: r, keys: L, cache: "immutable" })).then(function(K) {
|
|
2115
2115
|
var q = [], V = [], U = v ? [] : null, $ = x ? L : [];
|
|
2116
2116
|
if (!x) for (var te = 0; te < M; ++te) {
|
|
2117
|
-
var oe = K[te], Z = { value:
|
|
2118
|
-
f.call(Z, Z.value, Z) !== !1 && (Z.value == null ? $.push(
|
|
2117
|
+
var oe = K[te], Z = { value: ke(oe), primKey: D[k + te] };
|
|
2118
|
+
f.call(Z, Z.value, Z) !== !1 && (Z.value == null ? $.push(D[k + te]) : v || re(w(oe), w(Z.value)) === 0 ? (V.push(Z.value), v && U.push(D[k + te])) : ($.push(D[k + te]), q.push(Z.value)));
|
|
2119
2119
|
}
|
|
2120
2120
|
return Promise.resolve(0 < q.length && d.mutate({ trans: r, type: "add", values: q }).then(function(ve) {
|
|
2121
2121
|
for (var H in ve.failures) $.splice(parseInt(H), 1);
|
|
2122
2122
|
O(q.length, ve);
|
|
2123
2123
|
})).then(function() {
|
|
2124
|
-
return (0 < V.length ||
|
|
2124
|
+
return (0 < V.length || P && typeof e == "object") && d.mutate({ trans: r, type: "put", keys: U, values: V, criteria: P, changeSpec: typeof e != "function" && e, isAdditionalChunk: 0 < k }).then(function(ve) {
|
|
2125
2125
|
return O(V.length, ve);
|
|
2126
2126
|
});
|
|
2127
2127
|
}).then(function() {
|
|
2128
|
-
return (0 < $.length ||
|
|
2128
|
+
return (0 < $.length || P && x) && d.mutate({ trans: r, type: "delete", keys: $, criteria: P, isAdditionalChunk: 0 < k }).then(function(ve) {
|
|
2129
2129
|
return sn(n.table, $, ve);
|
|
2130
2130
|
}).then(function(ve) {
|
|
2131
2131
|
return O($.length, ve);
|
|
2132
2132
|
});
|
|
2133
2133
|
}).then(function() {
|
|
2134
|
-
return
|
|
2134
|
+
return D.length > k + M && S(k + T);
|
|
2135
2135
|
});
|
|
2136
2136
|
});
|
|
2137
2137
|
}
|
|
2138
|
-
var
|
|
2138
|
+
var P = Nt(n) && n.limit === 1 / 0 && (typeof e != "function" || x) && { index: n.index, range: n.range };
|
|
2139
2139
|
return S(0).then(function() {
|
|
2140
2140
|
if (0 < b.length) throw new Je("Error modifying one or more objects", b, _, A);
|
|
2141
|
-
return
|
|
2141
|
+
return D.length;
|
|
2142
2142
|
});
|
|
2143
2143
|
});
|
|
2144
2144
|
});
|
|
2145
2145
|
}, ue.prototype.delete = function() {
|
|
2146
2146
|
var e = this._ctx, t = e.range;
|
|
2147
|
-
return !Nt(e) || e.table.schema.yProps || !e.isPrimKey && t.type !== 3 ? this.modify(
|
|
2147
|
+
return !Nt(e) || e.table.schema.yProps || !e.isPrimKey && t.type !== 3 ? this.modify(Dr) : this._write(function(n) {
|
|
2148
2148
|
var r = e.table.core.schema.primaryKey, a = t;
|
|
2149
|
-
return e.table.core.count({ trans: n, query: { index: r, range: a } }).then(function(
|
|
2149
|
+
return e.table.core.count({ trans: n, query: { index: r, range: a } }).then(function(s) {
|
|
2150
2150
|
return e.table.core.mutate({ trans: n, type: "deleteRange", range: a }).then(function(v) {
|
|
2151
2151
|
var d = v.failures, v = v.numFailures;
|
|
2152
2152
|
if (v) throw new Je("Could not delete some values", Object.keys(d).map(function(w) {
|
|
2153
2153
|
return d[w];
|
|
2154
|
-
}),
|
|
2155
|
-
return
|
|
2154
|
+
}), s - v);
|
|
2155
|
+
return s - v;
|
|
2156
2156
|
});
|
|
2157
2157
|
});
|
|
2158
2158
|
});
|
|
2159
2159
|
}, ue);
|
|
2160
2160
|
function ue() {
|
|
2161
2161
|
}
|
|
2162
|
-
var
|
|
2162
|
+
var Dr = function(e, t) {
|
|
2163
2163
|
return t.value = null;
|
|
2164
2164
|
};
|
|
2165
|
-
function
|
|
2165
|
+
function Da(e, t) {
|
|
2166
2166
|
return e < t ? -1 : e === t ? 0 : 1;
|
|
2167
2167
|
}
|
|
2168
|
-
function
|
|
2168
|
+
function Ia(e, t) {
|
|
2169
2169
|
return t < e ? -1 : e === t ? 0 : 1;
|
|
2170
2170
|
}
|
|
2171
2171
|
function Be(e, t, n) {
|
|
@@ -2173,11 +2173,11 @@ function Ai() {
|
|
|
2173
2173
|
}
|
|
2174
2174
|
function At(e) {
|
|
2175
2175
|
return new e.Collection(e, function() {
|
|
2176
|
-
return
|
|
2176
|
+
return Ir("");
|
|
2177
2177
|
}).limit(0);
|
|
2178
2178
|
}
|
|
2179
2179
|
function ln(e, t, n, r) {
|
|
2180
|
-
var a,
|
|
2180
|
+
var a, s, f, d, v, w, T, p = n.length;
|
|
2181
2181
|
if (!n.every(function(_) {
|
|
2182
2182
|
return typeof _ == "string";
|
|
2183
2183
|
})) return Be(e, wr);
|
|
@@ -2186,15 +2186,15 @@ function Ai() {
|
|
|
2186
2186
|
return x.toUpperCase();
|
|
2187
2187
|
} : function(x) {
|
|
2188
2188
|
return x.toLowerCase();
|
|
2189
|
-
},
|
|
2189
|
+
}, s = _ === "next" ? function(x) {
|
|
2190
2190
|
return x.toLowerCase();
|
|
2191
2191
|
} : function(x) {
|
|
2192
2192
|
return x.toUpperCase();
|
|
2193
|
-
}, f = _ === "next" ?
|
|
2193
|
+
}, f = _ === "next" ? Da : Ia;
|
|
2194
2194
|
var A = n.map(function(x) {
|
|
2195
|
-
return { lower:
|
|
2196
|
-
}).sort(function(x,
|
|
2197
|
-
return f(x.lower,
|
|
2195
|
+
return { lower: s(x), upper: a(x) };
|
|
2196
|
+
}).sort(function(x, D) {
|
|
2197
|
+
return f(x.lower, D.lower);
|
|
2198
2198
|
});
|
|
2199
2199
|
d = A.map(function(x) {
|
|
2200
2200
|
return x.upper;
|
|
@@ -2209,11 +2209,11 @@ function Ai() {
|
|
|
2209
2209
|
};
|
|
2210
2210
|
var b = 0;
|
|
2211
2211
|
return e._addAlgorithm(function(_, A, x) {
|
|
2212
|
-
var
|
|
2213
|
-
if (typeof
|
|
2214
|
-
var S =
|
|
2212
|
+
var D = _.key;
|
|
2213
|
+
if (typeof D != "string") return !1;
|
|
2214
|
+
var S = s(D);
|
|
2215
2215
|
if (t(S, v, b)) return !0;
|
|
2216
|
-
for (var
|
|
2216
|
+
for (var P = null, k = b; k < p; ++k) {
|
|
2217
2217
|
var M = (function(L, K, q, V, U, $) {
|
|
2218
2218
|
for (var te = Math.min(L.length, V.length), oe = -1, Z = 0; Z < te; ++Z) {
|
|
2219
2219
|
var ve = K[Z];
|
|
@@ -2221,18 +2221,18 @@ function Ai() {
|
|
|
2221
2221
|
U(L[Z], ve) < 0 && (oe = Z);
|
|
2222
2222
|
}
|
|
2223
2223
|
return te < V.length && $ === "next" ? L + q.substr(L.length) : te < L.length && $ === "prev" ? L.substr(0, q.length) : oe < 0 ? null : L.substr(0, oe) + V[oe] + q.substr(oe + 1);
|
|
2224
|
-
})(
|
|
2225
|
-
M === null &&
|
|
2224
|
+
})(D, S, d[k], v[k], f, w);
|
|
2225
|
+
M === null && P === null ? b = k + 1 : (P === null || 0 < f(P, M)) && (P = M);
|
|
2226
2226
|
}
|
|
2227
|
-
return A(
|
|
2228
|
-
_.continue(
|
|
2227
|
+
return A(P !== null ? function() {
|
|
2228
|
+
_.continue(P + T);
|
|
2229
2229
|
} : x), !1;
|
|
2230
2230
|
}), e;
|
|
2231
2231
|
}
|
|
2232
2232
|
function ot(e, t, n, r) {
|
|
2233
2233
|
return { type: 2, lower: e, upper: t, lowerOpen: n, upperOpen: r };
|
|
2234
2234
|
}
|
|
2235
|
-
function
|
|
2235
|
+
function Ir(e) {
|
|
2236
2236
|
return { type: 1, lower: e, upper: e };
|
|
2237
2237
|
}
|
|
2238
2238
|
var Sr = (Object.defineProperty(xe.prototype, "Collection", { get: function() {
|
|
@@ -2248,7 +2248,7 @@ function Ai() {
|
|
|
2248
2248
|
}
|
|
2249
2249
|
}, xe.prototype.equals = function(e) {
|
|
2250
2250
|
return e == null ? Be(this, We) : new this.Collection(this, function() {
|
|
2251
|
-
return
|
|
2251
|
+
return Ir(e);
|
|
2252
2252
|
});
|
|
2253
2253
|
}, xe.prototype.above = function(e) {
|
|
2254
2254
|
return e == null ? Be(this, We) : new this.Collection(this, function() {
|
|
@@ -2277,19 +2277,19 @@ function Ai() {
|
|
|
2277
2277
|
return t === n[0];
|
|
2278
2278
|
}, [e], "");
|
|
2279
2279
|
}, xe.prototype.anyOfIgnoreCase = function() {
|
|
2280
|
-
var e = Fe.apply(
|
|
2280
|
+
var e = Fe.apply(Ue, arguments);
|
|
2281
2281
|
return e.length === 0 ? At(this) : ln(this, function(t, n) {
|
|
2282
2282
|
return n.indexOf(t) !== -1;
|
|
2283
2283
|
}, e, "");
|
|
2284
2284
|
}, xe.prototype.startsWithAnyOfIgnoreCase = function() {
|
|
2285
|
-
var e = Fe.apply(
|
|
2285
|
+
var e = Fe.apply(Ue, arguments);
|
|
2286
2286
|
return e.length === 0 ? At(this) : ln(this, function(t, n) {
|
|
2287
2287
|
return n.some(function(r) {
|
|
2288
2288
|
return t.indexOf(r) === 0;
|
|
2289
2289
|
});
|
|
2290
2290
|
}, e, mt);
|
|
2291
2291
|
}, xe.prototype.anyOf = function() {
|
|
2292
|
-
var e = this, t = Fe.apply(
|
|
2292
|
+
var e = this, t = Fe.apply(Ue, arguments), n = this._cmp;
|
|
2293
2293
|
try {
|
|
2294
2294
|
t.sort(n);
|
|
2295
2295
|
} catch {
|
|
@@ -2299,20 +2299,20 @@ function Ai() {
|
|
|
2299
2299
|
var r = new this.Collection(this, function() {
|
|
2300
2300
|
return ot(t[0], t[t.length - 1]);
|
|
2301
2301
|
});
|
|
2302
|
-
r._ondirectionchange = function(
|
|
2303
|
-
n =
|
|
2302
|
+
r._ondirectionchange = function(s) {
|
|
2303
|
+
n = s === "next" ? e._ascending : e._descending, t.sort(n);
|
|
2304
2304
|
};
|
|
2305
2305
|
var a = 0;
|
|
2306
|
-
return r._addAlgorithm(function(
|
|
2307
|
-
for (var v =
|
|
2306
|
+
return r._addAlgorithm(function(s, f, d) {
|
|
2307
|
+
for (var v = s.key; 0 < n(v, t[a]); ) if (++a === t.length) return f(d), !1;
|
|
2308
2308
|
return n(v, t[a]) === 0 || (f(function() {
|
|
2309
|
-
|
|
2309
|
+
s.continue(t[a]);
|
|
2310
2310
|
}), !1);
|
|
2311
2311
|
}), r;
|
|
2312
2312
|
}, xe.prototype.notEqual = function(e) {
|
|
2313
2313
|
return this.inAnyRange([[-1 / 0, e], [e, this.db._maxKey]], { includeLowers: !1, includeUppers: !1 });
|
|
2314
2314
|
}, xe.prototype.noneOf = function() {
|
|
2315
|
-
var e = Fe.apply(
|
|
2315
|
+
var e = Fe.apply(Ue, arguments);
|
|
2316
2316
|
if (e.length === 0) return new this.Collection(this);
|
|
2317
2317
|
try {
|
|
2318
2318
|
e.sort(this._ascending);
|
|
@@ -2323,26 +2323,26 @@ function Ai() {
|
|
|
2323
2323
|
return n ? n.concat([[n[n.length - 1][1], r]]) : [[-1 / 0, r]];
|
|
2324
2324
|
}, null);
|
|
2325
2325
|
return t.push([e[e.length - 1], this.db._maxKey]), this.inAnyRange(t, { includeLowers: !1, includeUppers: !1 });
|
|
2326
|
-
}, xe.prototype.inAnyRange = function(
|
|
2327
|
-
var n = this, r = this._cmp, a = this._ascending,
|
|
2328
|
-
if (
|
|
2329
|
-
if (!
|
|
2326
|
+
}, xe.prototype.inAnyRange = function(D, t) {
|
|
2327
|
+
var n = this, r = this._cmp, a = this._ascending, s = this._descending, f = this._min, d = this._max;
|
|
2328
|
+
if (D.length === 0) return At(this);
|
|
2329
|
+
if (!D.every(function(S) {
|
|
2330
2330
|
return S[0] !== void 0 && S[1] !== void 0 && a(S[0], S[1]) <= 0;
|
|
2331
|
-
})) return Be(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",
|
|
2331
|
+
})) return Be(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", C.InvalidArgument);
|
|
2332
2332
|
var v = !t || t.includeLowers !== !1, w = t && t.includeUppers === !0, T, p = a;
|
|
2333
|
-
function O(S,
|
|
2334
|
-
return p(S[0],
|
|
2333
|
+
function O(S, P) {
|
|
2334
|
+
return p(S[0], P[0]);
|
|
2335
2335
|
}
|
|
2336
2336
|
try {
|
|
2337
|
-
(T =
|
|
2338
|
-
for (var
|
|
2339
|
-
var L = S[
|
|
2340
|
-
if (r(
|
|
2341
|
-
L[0] = f(L[0],
|
|
2337
|
+
(T = D.reduce(function(S, P) {
|
|
2338
|
+
for (var k = 0, M = S.length; k < M; ++k) {
|
|
2339
|
+
var L = S[k];
|
|
2340
|
+
if (r(P[0], L[1]) < 0 && 0 < r(P[1], L[0])) {
|
|
2341
|
+
L[0] = f(L[0], P[0]), L[1] = d(L[1], P[1]);
|
|
2342
2342
|
break;
|
|
2343
2343
|
}
|
|
2344
2344
|
}
|
|
2345
|
-
return
|
|
2345
|
+
return k === M && S.push(P), S;
|
|
2346
2346
|
}, [])).sort(O);
|
|
2347
2347
|
} catch {
|
|
2348
2348
|
return Be(this, We);
|
|
@@ -2352,22 +2352,22 @@ function Ai() {
|
|
|
2352
2352
|
} : function(S) {
|
|
2353
2353
|
return 0 <= a(S, T[b][1]);
|
|
2354
2354
|
}, A = v ? function(S) {
|
|
2355
|
-
return 0 <
|
|
2355
|
+
return 0 < s(S, T[b][0]);
|
|
2356
2356
|
} : function(S) {
|
|
2357
|
-
return 0 <=
|
|
2358
|
-
}, x = _,
|
|
2357
|
+
return 0 <= s(S, T[b][0]);
|
|
2358
|
+
}, x = _, D = new this.Collection(this, function() {
|
|
2359
2359
|
return ot(T[0][0], T[T.length - 1][1], !v, !w);
|
|
2360
2360
|
});
|
|
2361
|
-
return
|
|
2362
|
-
p = S === "next" ? (x = _, a) : (x = A,
|
|
2363
|
-
},
|
|
2364
|
-
for (var M, L = S.key; x(L); ) if (++b === T.length) return k
|
|
2365
|
-
return !_(M = L) && !A(M) || (n._cmp(L, T[b][1]) === 0 || n._cmp(L, T[b][0]) === 0 ||
|
|
2361
|
+
return D._ondirectionchange = function(S) {
|
|
2362
|
+
p = S === "next" ? (x = _, a) : (x = A, s), T.sort(O);
|
|
2363
|
+
}, D._addAlgorithm(function(S, P, k) {
|
|
2364
|
+
for (var M, L = S.key; x(L); ) if (++b === T.length) return P(k), !1;
|
|
2365
|
+
return !_(M = L) && !A(M) || (n._cmp(L, T[b][1]) === 0 || n._cmp(L, T[b][0]) === 0 || P(function() {
|
|
2366
2366
|
p === a ? S.continue(T[b][0]) : S.continue(T[b][1]);
|
|
2367
2367
|
}), !1);
|
|
2368
|
-
}),
|
|
2368
|
+
}), D;
|
|
2369
2369
|
}, xe.prototype.startsWithAnyOf = function() {
|
|
2370
|
-
var e = Fe.apply(
|
|
2370
|
+
var e = Fe.apply(Ue, arguments);
|
|
2371
2371
|
return e.every(function(t) {
|
|
2372
2372
|
return typeof t == "string";
|
|
2373
2373
|
}) ? e.length === 0 ? At(this) : this.inAnyRange(e.map(function(t) {
|
|
@@ -2376,7 +2376,7 @@ function Ai() {
|
|
|
2376
2376
|
}, xe);
|
|
2377
2377
|
function xe() {
|
|
2378
2378
|
}
|
|
2379
|
-
function
|
|
2379
|
+
function Ve(e) {
|
|
2380
2380
|
return ge(function(t) {
|
|
2381
2381
|
return qt(t), e(t.target.error), !1;
|
|
2382
2382
|
});
|
|
@@ -2384,9 +2384,9 @@ function Ai() {
|
|
|
2384
2384
|
function qt(e) {
|
|
2385
2385
|
e.stopPropagation && e.stopPropagation(), e.preventDefault && e.preventDefault();
|
|
2386
2386
|
}
|
|
2387
|
-
var Lt = "storagemutated", jn = "x-storagemutated-1", st = Mt(null, Lt), Sa = (
|
|
2387
|
+
var Lt = "storagemutated", jn = "x-storagemutated-1", st = Mt(null, Lt), Sa = (Ge.prototype._lock = function() {
|
|
2388
2388
|
return Y(!z.global), ++this._reculock, this._reculock !== 1 || z.global || (z.lockOwnerFor = this), this;
|
|
2389
|
-
},
|
|
2389
|
+
}, Ge.prototype._unlock = function() {
|
|
2390
2390
|
if (Y(!z.global), --this._reculock == 0) for (z.global || (z.lockOwnerFor = null); 0 < this._blockedFuncs.length && !this._locked(); ) {
|
|
2391
2391
|
var e = this._blockedFuncs.shift();
|
|
2392
2392
|
try {
|
|
@@ -2395,85 +2395,85 @@ function Ai() {
|
|
|
2395
2395
|
}
|
|
2396
2396
|
}
|
|
2397
2397
|
return this;
|
|
2398
|
-
},
|
|
2398
|
+
}, Ge.prototype._locked = function() {
|
|
2399
2399
|
return this._reculock && z.lockOwnerFor !== this;
|
|
2400
|
-
},
|
|
2400
|
+
}, Ge.prototype.create = function(e) {
|
|
2401
2401
|
var t = this;
|
|
2402
2402
|
if (!this.mode) return this;
|
|
2403
2403
|
var n = this.db.idbdb, r = this.db._state.dbOpenError;
|
|
2404
2404
|
if (Y(!this.idbtrans), !e && !n) switch (r && r.name) {
|
|
2405
2405
|
case "DatabaseClosedError":
|
|
2406
|
-
throw new
|
|
2406
|
+
throw new C.DatabaseClosed(r);
|
|
2407
2407
|
case "MissingAPIError":
|
|
2408
|
-
throw new
|
|
2408
|
+
throw new C.MissingAPI(r.message, r);
|
|
2409
2409
|
default:
|
|
2410
|
-
throw new
|
|
2410
|
+
throw new C.OpenFailed(r);
|
|
2411
2411
|
}
|
|
2412
|
-
if (!this.active) throw new
|
|
2412
|
+
if (!this.active) throw new C.TransactionInactive();
|
|
2413
2413
|
return Y(this._completion._state === null), (e = this.idbtrans = e || (this.db.core || n).transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability })).onerror = ge(function(a) {
|
|
2414
2414
|
qt(a), t._reject(e.error);
|
|
2415
2415
|
}), e.onabort = ge(function(a) {
|
|
2416
|
-
qt(a), t.active && t._reject(new
|
|
2416
|
+
qt(a), t.active && t._reject(new C.Abort(e.error)), t.active = !1, t.on("abort").fire(a);
|
|
2417
2417
|
}), e.oncomplete = ge(function() {
|
|
2418
2418
|
t.active = !1, t._resolve(), "mutatedParts" in e && st.storagemutated.fire(e.mutatedParts);
|
|
2419
2419
|
}), this;
|
|
2420
|
-
},
|
|
2420
|
+
}, Ge.prototype._promise = function(e, t, n) {
|
|
2421
2421
|
var r = this;
|
|
2422
|
-
if (e === "readwrite" && this.mode !== "readwrite") return be(new
|
|
2423
|
-
if (!this.active) return be(new
|
|
2424
|
-
if (this._locked()) return new G(function(
|
|
2422
|
+
if (e === "readwrite" && this.mode !== "readwrite") return be(new C.ReadOnly("Transaction is readonly"));
|
|
2423
|
+
if (!this.active) return be(new C.TransactionInactive());
|
|
2424
|
+
if (this._locked()) return new G(function(s, f) {
|
|
2425
2425
|
r._blockedFuncs.push([function() {
|
|
2426
|
-
r._promise(e, t, n).then(
|
|
2426
|
+
r._promise(e, t, n).then(s, f);
|
|
2427
2427
|
}, z]);
|
|
2428
2428
|
});
|
|
2429
2429
|
if (n) return rt(function() {
|
|
2430
|
-
var
|
|
2430
|
+
var s = new G(function(f, d) {
|
|
2431
2431
|
r._lock();
|
|
2432
2432
|
var v = t(f, d, r);
|
|
2433
2433
|
v && v.then && v.then(f, d);
|
|
2434
2434
|
});
|
|
2435
|
-
return
|
|
2435
|
+
return s.finally(function() {
|
|
2436
2436
|
return r._unlock();
|
|
2437
|
-
}),
|
|
2437
|
+
}), s._lib = !0, s;
|
|
2438
2438
|
});
|
|
2439
|
-
var a = new G(function(
|
|
2440
|
-
var d = t(
|
|
2441
|
-
d && d.then && d.then(
|
|
2439
|
+
var a = new G(function(s, f) {
|
|
2440
|
+
var d = t(s, f, r);
|
|
2441
|
+
d && d.then && d.then(s, f);
|
|
2442
2442
|
});
|
|
2443
2443
|
return a._lib = !0, a;
|
|
2444
|
-
},
|
|
2444
|
+
}, Ge.prototype._root = function() {
|
|
2445
2445
|
return this.parent ? this.parent._root() : this;
|
|
2446
|
-
},
|
|
2446
|
+
}, Ge.prototype.waitFor = function(e) {
|
|
2447
2447
|
var t, n = this._root(), r = G.resolve(e);
|
|
2448
2448
|
n._waitingFor ? n._waitingFor = n._waitingFor.then(function() {
|
|
2449
2449
|
return r;
|
|
2450
|
-
}) : (n._waitingFor = r, n._waitingQueue = [], t = n.idbtrans.objectStore(n.storeNames[0]), (function
|
|
2450
|
+
}) : (n._waitingFor = r, n._waitingQueue = [], t = n.idbtrans.objectStore(n.storeNames[0]), (function s() {
|
|
2451
2451
|
for (++n._spinCount; n._waitingQueue.length; ) n._waitingQueue.shift()();
|
|
2452
|
-
n._waitingFor && (t.get(-1 / 0).onsuccess =
|
|
2452
|
+
n._waitingFor && (t.get(-1 / 0).onsuccess = s);
|
|
2453
2453
|
})());
|
|
2454
2454
|
var a = n._waitingFor;
|
|
2455
|
-
return new G(function(
|
|
2455
|
+
return new G(function(s, f) {
|
|
2456
2456
|
r.then(function(d) {
|
|
2457
|
-
return n._waitingQueue.push(ge(
|
|
2457
|
+
return n._waitingQueue.push(ge(s.bind(null, d)));
|
|
2458
2458
|
}, function(d) {
|
|
2459
2459
|
return n._waitingQueue.push(ge(f.bind(null, d)));
|
|
2460
2460
|
}).finally(function() {
|
|
2461
2461
|
n._waitingFor === a && (n._waitingFor = null);
|
|
2462
2462
|
});
|
|
2463
2463
|
});
|
|
2464
|
-
},
|
|
2465
|
-
this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new
|
|
2466
|
-
},
|
|
2464
|
+
}, Ge.prototype.abort = function() {
|
|
2465
|
+
this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new C.Abort()));
|
|
2466
|
+
}, Ge.prototype.table = function(e) {
|
|
2467
2467
|
var t = this._memoizedTables || (this._memoizedTables = {});
|
|
2468
2468
|
if (W(t, e)) return t[e];
|
|
2469
2469
|
var n = this.schema[e];
|
|
2470
|
-
if (!n) throw new
|
|
2470
|
+
if (!n) throw new C.NotFound("Table " + e + " not part of transaction");
|
|
2471
2471
|
return n = new this.db.Table(e, n, this), n.core = this.db.core.table(e), t[e] = n;
|
|
2472
|
-
},
|
|
2473
|
-
function
|
|
2472
|
+
}, Ge);
|
|
2473
|
+
function Ge() {
|
|
2474
2474
|
}
|
|
2475
|
-
function Kn(e, t, n, r, a,
|
|
2476
|
-
return { name: e, keyPath: t, unique: n, multi: r, auto: a, compound:
|
|
2475
|
+
function Kn(e, t, n, r, a, s, f, d) {
|
|
2476
|
+
return { name: e, keyPath: t, unique: n, multi: r, auto: a, compound: s, src: (n && !f ? "&" : "") + (r ? "*" : "") + (a ? "++" : "") + Rr(t), type: d };
|
|
2477
2477
|
}
|
|
2478
2478
|
function Rr(e) {
|
|
2479
2479
|
return typeof e == "string" ? e : e ? "[" + [].join.call(e, "+") + "]" : "";
|
|
@@ -2481,8 +2481,8 @@ function Ai() {
|
|
|
2481
2481
|
function qn(e, t, n) {
|
|
2482
2482
|
return { name: e, primKey: t, indexes: n, mappedClass: null, idxByName: (r = function(a) {
|
|
2483
2483
|
return [a.name, a];
|
|
2484
|
-
}, n.reduce(function(a,
|
|
2485
|
-
return f = r(
|
|
2484
|
+
}, n.reduce(function(a, s, f) {
|
|
2485
|
+
return f = r(s, f), f && (a[f[0]] = f[1]), a;
|
|
2486
2486
|
}, {})) };
|
|
2487
2487
|
var r;
|
|
2488
2488
|
}
|
|
@@ -2508,14 +2508,14 @@ function Ai() {
|
|
|
2508
2508
|
};
|
|
2509
2509
|
var t;
|
|
2510
2510
|
}
|
|
2511
|
-
function
|
|
2511
|
+
function Pr(e) {
|
|
2512
2512
|
return [].slice.call(e);
|
|
2513
2513
|
}
|
|
2514
2514
|
var Ra = 0;
|
|
2515
2515
|
function Vt(e) {
|
|
2516
2516
|
return e == null ? ":id" : typeof e == "string" ? e : "[".concat(e.join("+"), "]");
|
|
2517
2517
|
}
|
|
2518
|
-
function
|
|
2518
|
+
function Pa(e, t, v) {
|
|
2519
2519
|
function r(x) {
|
|
2520
2520
|
if (x.type === 3) return null;
|
|
2521
2521
|
if (x.type === 4) throw new Error("Cannot convert never type to IDBKeyRange");
|
|
@@ -2525,30 +2525,30 @@ function Ai() {
|
|
|
2525
2525
|
function a(O) {
|
|
2526
2526
|
var b, _ = O.name;
|
|
2527
2527
|
return { name: _, schema: O, mutate: function(A) {
|
|
2528
|
-
var x = A.trans,
|
|
2528
|
+
var x = A.trans, D = A.type, S = A.keys, P = A.values, k = A.range;
|
|
2529
2529
|
return new Promise(function(M, L) {
|
|
2530
2530
|
M = ge(M);
|
|
2531
|
-
var K = x.objectStore(_), q = K.keyPath == null, V =
|
|
2532
|
-
if (!V &&
|
|
2533
|
-
var U, $ = (S ||
|
|
2534
|
-
if (S &&
|
|
2531
|
+
var K = x.objectStore(_), q = K.keyPath == null, V = D === "put" || D === "add";
|
|
2532
|
+
if (!V && D !== "delete" && D !== "deleteRange") throw new Error("Invalid operation type: " + D);
|
|
2533
|
+
var U, $ = (S || P || { length: 1 }).length;
|
|
2534
|
+
if (S && P && S.length !== P.length) throw new Error("Given keys array must have same length as given values array.");
|
|
2535
2535
|
if ($ === 0) return M({ numFailures: 0, failures: {}, results: [], lastResult: void 0 });
|
|
2536
2536
|
function te(Se) {
|
|
2537
2537
|
++ve, qt(Se);
|
|
2538
2538
|
}
|
|
2539
2539
|
var oe = [], Z = [], ve = 0;
|
|
2540
|
-
if (
|
|
2541
|
-
if (
|
|
2542
|
-
|
|
2540
|
+
if (D === "deleteRange") {
|
|
2541
|
+
if (k.type === 4) return M({ numFailures: ve, failures: Z, results: [], lastResult: void 0 });
|
|
2542
|
+
k.type === 3 ? oe.push(U = K.clear()) : oe.push(U = K.delete(r(k)));
|
|
2543
2543
|
} else {
|
|
2544
|
-
var q = V ? q ? [
|
|
2545
|
-
if (V) for (var
|
|
2546
|
-
else for (
|
|
2544
|
+
var q = V ? q ? [P, S] : [P, null] : [S, null], H = q[0], Ce = q[1];
|
|
2545
|
+
if (V) for (var De = 0; De < $; ++De) oe.push(U = Ce && Ce[De] !== void 0 ? K[D](H[De], Ce[De]) : K[D](H[De])), U.onerror = te;
|
|
2546
|
+
else for (De = 0; De < $; ++De) oe.push(U = K[D](H[De])), U.onerror = te;
|
|
2547
2547
|
}
|
|
2548
2548
|
function Tn(Se) {
|
|
2549
2549
|
Se = Se.target.result, oe.forEach(function(vt, ir) {
|
|
2550
2550
|
return vt.error != null && (Z[ir] = vt.error);
|
|
2551
|
-
}), M({ numFailures: ve, failures: Z, results:
|
|
2551
|
+
}), M({ numFailures: ve, failures: Z, results: D === "delete" ? S : oe.map(function(vt) {
|
|
2552
2552
|
return vt.result;
|
|
2553
2553
|
}), lastResult: Se });
|
|
2554
2554
|
}
|
|
@@ -2557,55 +2557,55 @@ function Ai() {
|
|
|
2557
2557
|
}, U.onsuccess = Tn;
|
|
2558
2558
|
});
|
|
2559
2559
|
}, getMany: function(A) {
|
|
2560
|
-
var x = A.trans,
|
|
2561
|
-
return new Promise(function(S,
|
|
2560
|
+
var x = A.trans, D = A.keys;
|
|
2561
|
+
return new Promise(function(S, P) {
|
|
2562
2562
|
S = ge(S);
|
|
2563
|
-
for (var
|
|
2563
|
+
for (var k, M = x.objectStore(_), L = D.length, K = new Array(L), q = 0, V = 0, U = function(oe) {
|
|
2564
2564
|
oe = oe.target, K[oe._pos] = oe.result, ++V === q && S(K);
|
|
2565
|
-
}, $ =
|
|
2565
|
+
}, $ = Ve(P), te = 0; te < L; ++te) D[te] != null && ((k = M.get(D[te]))._pos = te, k.onsuccess = U, k.onerror = $, ++q);
|
|
2566
2566
|
q === 0 && S(K);
|
|
2567
2567
|
});
|
|
2568
2568
|
}, get: function(A) {
|
|
2569
|
-
var x = A.trans,
|
|
2570
|
-
return new Promise(function(S,
|
|
2569
|
+
var x = A.trans, D = A.key;
|
|
2570
|
+
return new Promise(function(S, P) {
|
|
2571
2571
|
S = ge(S);
|
|
2572
|
-
var
|
|
2573
|
-
|
|
2572
|
+
var k = x.objectStore(_).get(D);
|
|
2573
|
+
k.onsuccess = function(M) {
|
|
2574
2574
|
return S(M.target.result);
|
|
2575
|
-
},
|
|
2575
|
+
}, k.onerror = Ve(P);
|
|
2576
2576
|
});
|
|
2577
2577
|
}, query: (b = w, function(A) {
|
|
2578
|
-
return new Promise(function(x,
|
|
2578
|
+
return new Promise(function(x, D) {
|
|
2579
2579
|
x = ge(x);
|
|
2580
|
-
var S,
|
|
2580
|
+
var S, P, k, q = A.trans, M = A.values, L = A.limit, U = A.query, K = L === 1 / 0 ? void 0 : L, V = U.index, U = U.range, q = q.objectStore(_), V = V.isPrimaryKey ? q : q.index(V.name), U = r(U);
|
|
2581
2581
|
if (L === 0) return x({ result: [] });
|
|
2582
2582
|
b ? ((K = M ? V.getAll(U, K) : V.getAllKeys(U, K)).onsuccess = function($) {
|
|
2583
2583
|
return x({ result: $.target.result });
|
|
2584
|
-
}, K.onerror =
|
|
2585
|
-
var te =
|
|
2586
|
-
return te ? (
|
|
2587
|
-
},
|
|
2584
|
+
}, K.onerror = Ve(D)) : (S = 0, P = !M && "openKeyCursor" in V ? V.openKeyCursor(U) : V.openCursor(U), k = [], P.onsuccess = function($) {
|
|
2585
|
+
var te = P.result;
|
|
2586
|
+
return te ? (k.push(M ? te.value : te.primaryKey), ++S === L ? x({ result: k }) : void te.continue()) : x({ result: k });
|
|
2587
|
+
}, P.onerror = Ve(D));
|
|
2588
2588
|
});
|
|
2589
2589
|
}), openCursor: function(A) {
|
|
2590
|
-
var x = A.trans,
|
|
2590
|
+
var x = A.trans, D = A.values, S = A.query, P = A.reverse, k = A.unique;
|
|
2591
2591
|
return new Promise(function(M, L) {
|
|
2592
2592
|
M = ge(M);
|
|
2593
|
-
var V = S.index, K = S.range, q = x.objectStore(_), q = V.isPrimaryKey ? q : q.index(V.name), V =
|
|
2594
|
-
U.onerror =
|
|
2593
|
+
var V = S.index, K = S.range, q = x.objectStore(_), q = V.isPrimaryKey ? q : q.index(V.name), V = P ? k ? "prevunique" : "prev" : k ? "nextunique" : "next", U = !D && "openKeyCursor" in q ? q.openKeyCursor(r(K), V) : q.openCursor(r(K), V);
|
|
2594
|
+
U.onerror = Ve(L), U.onsuccess = ge(function($) {
|
|
2595
2595
|
var te, oe, Z, ve, H = U.result;
|
|
2596
2596
|
H ? (H.___id = ++Ra, H.done = !1, te = H.continue.bind(H), oe = (oe = H.continuePrimaryKey) && oe.bind(H), Z = H.advance.bind(H), ve = function() {
|
|
2597
2597
|
throw new Error("Cursor not stopped");
|
|
2598
2598
|
}, H.trans = x, H.stop = H.continue = H.continuePrimaryKey = H.advance = function() {
|
|
2599
2599
|
throw new Error("Cursor not started");
|
|
2600
2600
|
}, H.fail = ge(L), H.next = function() {
|
|
2601
|
-
var Ce = this,
|
|
2601
|
+
var Ce = this, De = 1;
|
|
2602
2602
|
return this.start(function() {
|
|
2603
|
-
return
|
|
2603
|
+
return De-- ? Ce.continue() : Ce.stop();
|
|
2604
2604
|
}).then(function() {
|
|
2605
2605
|
return Ce;
|
|
2606
2606
|
});
|
|
2607
2607
|
}, H.start = function(Ce) {
|
|
2608
|
-
function
|
|
2608
|
+
function De() {
|
|
2609
2609
|
if (U.result) try {
|
|
2610
2610
|
Ce();
|
|
2611
2611
|
} catch (Se) {
|
|
@@ -2616,36 +2616,36 @@ function Ai() {
|
|
|
2616
2616
|
}, H.stop();
|
|
2617
2617
|
}
|
|
2618
2618
|
var Tn = new Promise(function(Se, vt) {
|
|
2619
|
-
Se = ge(Se), U.onerror =
|
|
2619
|
+
Se = ge(Se), U.onerror = Ve(vt), H.fail = vt, H.stop = function(ir) {
|
|
2620
2620
|
H.stop = H.continue = H.continuePrimaryKey = H.advance = ve, Se(ir);
|
|
2621
2621
|
};
|
|
2622
2622
|
});
|
|
2623
2623
|
return U.onsuccess = ge(function(Se) {
|
|
2624
|
-
U.onsuccess =
|
|
2625
|
-
}), H.continue = te, H.continuePrimaryKey = oe, H.advance = Z,
|
|
2624
|
+
U.onsuccess = De, De();
|
|
2625
|
+
}), H.continue = te, H.continuePrimaryKey = oe, H.advance = Z, De(), Tn;
|
|
2626
2626
|
}, M(H)) : M(null);
|
|
2627
2627
|
}, L);
|
|
2628
2628
|
});
|
|
2629
2629
|
}, count: function(A) {
|
|
2630
|
-
var x = A.query,
|
|
2631
|
-
return new Promise(function(
|
|
2632
|
-
var L =
|
|
2630
|
+
var x = A.query, D = A.trans, S = x.index, P = x.range;
|
|
2631
|
+
return new Promise(function(k, M) {
|
|
2632
|
+
var L = D.objectStore(_), K = S.isPrimaryKey ? L : L.index(S.name), L = r(P), K = L ? K.count(L) : K.count();
|
|
2633
2633
|
K.onsuccess = ge(function(q) {
|
|
2634
|
-
return
|
|
2635
|
-
}), K.onerror =
|
|
2634
|
+
return k(q.target.result);
|
|
2635
|
+
}), K.onerror = Ve(M);
|
|
2636
2636
|
});
|
|
2637
2637
|
} };
|
|
2638
2638
|
}
|
|
2639
|
-
var
|
|
2639
|
+
var s, f, d, T = (f = v, d = Pr((s = e).objectStoreNames), { schema: { name: s.name, tables: d.map(function(O) {
|
|
2640
2640
|
return f.objectStore(O);
|
|
2641
2641
|
}).map(function(O) {
|
|
2642
|
-
var b = O.keyPath, x = O.autoIncrement, _ = N(b), A = {}, x = { name: O.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: b == null, compound: _, keyPath: b, autoIncrement: x, unique: !0, extractKey: Ln(b) }, indexes:
|
|
2643
|
-
return O.index(
|
|
2644
|
-
}).map(function(
|
|
2645
|
-
var S =
|
|
2646
|
-
return A[Vt(
|
|
2647
|
-
}), getIndexByKeyPath: function(
|
|
2648
|
-
return A[Vt(
|
|
2642
|
+
var b = O.keyPath, x = O.autoIncrement, _ = N(b), A = {}, x = { name: O.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: b == null, compound: _, keyPath: b, autoIncrement: x, unique: !0, extractKey: Ln(b) }, indexes: Pr(O.indexNames).map(function(D) {
|
|
2643
|
+
return O.index(D);
|
|
2644
|
+
}).map(function(k) {
|
|
2645
|
+
var S = k.name, P = k.unique, M = k.multiEntry, k = k.keyPath, M = { name: S, compound: N(k), keyPath: k, unique: P, multiEntry: M, extractKey: Ln(k) };
|
|
2646
|
+
return A[Vt(k)] = M;
|
|
2647
|
+
}), getIndexByKeyPath: function(D) {
|
|
2648
|
+
return A[Vt(D)];
|
|
2649
2649
|
} };
|
|
2650
2650
|
return A[":id"] = x.primaryKey, b != null && (A[Vt(b)] = x.primaryKey), x;
|
|
2651
2651
|
}) }, hasGetAll: 0 < d.length && "getAll" in f.objectStore(d[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), v = T.schema, w = T.hasGetAll, T = v.tables.map(a), p = {};
|
|
@@ -2656,24 +2656,24 @@ function Ai() {
|
|
|
2656
2656
|
return p[O];
|
|
2657
2657
|
}, MIN_KEY: -1 / 0, MAX_KEY: Ut(t), schema: v };
|
|
2658
2658
|
}
|
|
2659
|
-
function
|
|
2659
|
+
function ka(e, t, n, r) {
|
|
2660
2660
|
var a = n.IDBKeyRange;
|
|
2661
|
-
return n.indexedDB, { dbcore: (r =
|
|
2662
|
-
return f = f.create, i(i({},
|
|
2661
|
+
return n.indexedDB, { dbcore: (r = Pa(t, a, r), e.dbcore.reduce(function(s, f) {
|
|
2662
|
+
return f = f.create, i(i({}, s), f(s));
|
|
2663
2663
|
}, r)) };
|
|
2664
2664
|
}
|
|
2665
2665
|
function fn(e, r) {
|
|
2666
|
-
var n = r.db, r =
|
|
2666
|
+
var n = r.db, r = ka(e._middlewares, n, e._deps, r);
|
|
2667
2667
|
e.core = r.dbcore, e.tables.forEach(function(a) {
|
|
2668
|
-
var
|
|
2668
|
+
var s = a.name;
|
|
2669
2669
|
e.core.schema.tables.some(function(f) {
|
|
2670
|
-
return f.name ===
|
|
2671
|
-
}) && (a.core = e.core.table(
|
|
2670
|
+
return f.name === s;
|
|
2671
|
+
}) && (a.core = e.core.table(s), e[s] instanceof e.Table && (e[s].core = a.core));
|
|
2672
2672
|
});
|
|
2673
2673
|
}
|
|
2674
2674
|
function dn(e, t, n, r) {
|
|
2675
2675
|
n.forEach(function(a) {
|
|
2676
|
-
var
|
|
2676
|
+
var s = r[a];
|
|
2677
2677
|
t.forEach(function(f) {
|
|
2678
2678
|
var d = (function v(w, T) {
|
|
2679
2679
|
return se(w, T) || (w = j(w)) && v(w, T);
|
|
@@ -2682,7 +2682,7 @@ function Ai() {
|
|
|
2682
2682
|
return this.table(a);
|
|
2683
2683
|
}, set: function(v) {
|
|
2684
2684
|
fe(this, a, { value: v, writable: !0, configurable: !0, enumerable: !0 });
|
|
2685
|
-
} }) : f[a] = new e.Table(a,
|
|
2685
|
+
} }) : f[a] = new e.Table(a, s));
|
|
2686
2686
|
});
|
|
2687
2687
|
});
|
|
2688
2688
|
}
|
|
@@ -2697,24 +2697,24 @@ function Ai() {
|
|
|
2697
2697
|
function Ba(e, t, n, r) {
|
|
2698
2698
|
var a = e._dbSchema;
|
|
2699
2699
|
n.objectStoreNames.contains("$meta") && !a.$meta && (a.$meta = qn("$meta", Fr("")[0], []), e._storeNames.push("$meta"));
|
|
2700
|
-
var
|
|
2701
|
-
|
|
2702
|
-
var f =
|
|
2700
|
+
var s = e._createTransaction("readwrite", e._storeNames, a);
|
|
2701
|
+
s.create(n), s._completion.catch(r);
|
|
2702
|
+
var f = s._reject.bind(s), d = z.transless || z;
|
|
2703
2703
|
rt(function() {
|
|
2704
|
-
return z.trans =
|
|
2704
|
+
return z.trans = s, z.transless = d, t !== 0 ? (fn(e, n), w = t, ((v = s).storeNames.includes("$meta") ? v.table("$meta").get("version").then(function(T) {
|
|
2705
2705
|
return T ?? w;
|
|
2706
2706
|
}) : G.resolve(w)).then(function(T) {
|
|
2707
|
-
return O = T, b =
|
|
2708
|
-
return
|
|
2709
|
-
})).length !== 0 ? (T.forEach(function(
|
|
2707
|
+
return O = T, b = s, _ = n, A = [], T = (p = e)._versions, x = p._dbSchema = mn(0, p.idbdb, _), (T = T.filter(function(D) {
|
|
2708
|
+
return D._cfg.version >= O;
|
|
2709
|
+
})).length !== 0 ? (T.forEach(function(D) {
|
|
2710
2710
|
A.push(function() {
|
|
2711
|
-
var S = x,
|
|
2712
|
-
pn(p, S, _), pn(p,
|
|
2713
|
-
var
|
|
2714
|
-
|
|
2711
|
+
var S = x, P = D._cfg.dbschema;
|
|
2712
|
+
pn(p, S, _), pn(p, P, _), x = p._dbSchema = P;
|
|
2713
|
+
var k = Vn(S, P);
|
|
2714
|
+
k.add.forEach(function(V) {
|
|
2715
2715
|
Gn(_, V[0], V[1].primKey, V[1].indexes);
|
|
2716
|
-
}),
|
|
2717
|
-
if (V.recreate) throw new
|
|
2716
|
+
}), k.change.forEach(function(V) {
|
|
2717
|
+
if (V.recreate) throw new C.Upgrade("Not yet support for changing primary key");
|
|
2718
2718
|
var U = _.objectStore(V.name);
|
|
2719
2719
|
V.add.forEach(function($) {
|
|
2720
2720
|
return hn(U, $);
|
|
@@ -2724,70 +2724,70 @@ function Ai() {
|
|
|
2724
2724
|
return U.deleteIndex($);
|
|
2725
2725
|
});
|
|
2726
2726
|
});
|
|
2727
|
-
var M =
|
|
2728
|
-
if (M &&
|
|
2727
|
+
var M = D._cfg.contentUpgrade;
|
|
2728
|
+
if (M && D._cfg.version > O) {
|
|
2729
2729
|
fn(p, _), b._memoizedTables = {};
|
|
2730
|
-
var L =
|
|
2731
|
-
|
|
2730
|
+
var L = Ie(P);
|
|
2731
|
+
k.del.forEach(function(V) {
|
|
2732
2732
|
L[V] = S[V];
|
|
2733
2733
|
}), Un(p, [p.Transaction.prototype]), dn(p, [p.Transaction.prototype], y(L), L), b.schema = L;
|
|
2734
|
-
var K, q =
|
|
2735
|
-
return q && Et(),
|
|
2734
|
+
var K, q = qe(M);
|
|
2735
|
+
return q && Et(), k = G.follow(function() {
|
|
2736
2736
|
var V;
|
|
2737
2737
|
(K = M(b)) && q && (V = at.bind(null, null), K.then(V, V));
|
|
2738
|
-
}), K && typeof K.then == "function" ? G.resolve(K) :
|
|
2738
|
+
}), K && typeof K.then == "function" ? G.resolve(K) : k.then(function() {
|
|
2739
2739
|
return K;
|
|
2740
2740
|
});
|
|
2741
2741
|
}
|
|
2742
2742
|
}), A.push(function(S) {
|
|
2743
|
-
var
|
|
2744
|
-
|
|
2745
|
-
return
|
|
2743
|
+
var P, k, M = D._cfg.dbschema;
|
|
2744
|
+
P = M, k = S, [].slice.call(k.db.objectStoreNames).forEach(function(L) {
|
|
2745
|
+
return P[L] == null && k.db.deleteObjectStore(L);
|
|
2746
2746
|
}), Un(p, [p.Transaction.prototype]), dn(p, [p.Transaction.prototype], p._storeNames, p._dbSchema), b.schema = p._dbSchema;
|
|
2747
2747
|
}), A.push(function(S) {
|
|
2748
|
-
p.idbdb.objectStoreNames.contains("$meta") && (Math.ceil(p.idbdb.version / 10) ===
|
|
2749
|
-
return
|
|
2750
|
-
})) : S.objectStore("$meta").put(
|
|
2748
|
+
p.idbdb.objectStoreNames.contains("$meta") && (Math.ceil(p.idbdb.version / 10) === D._cfg.version ? (p.idbdb.deleteObjectStore("$meta"), delete p._dbSchema.$meta, p._storeNames = p._storeNames.filter(function(P) {
|
|
2749
|
+
return P !== "$meta";
|
|
2750
|
+
})) : S.objectStore("$meta").put(D._cfg.version, "version"));
|
|
2751
2751
|
});
|
|
2752
|
-
}), (function
|
|
2753
|
-
return A.length ? G.resolve(A.shift()(b.idbtrans)).then(
|
|
2752
|
+
}), (function D() {
|
|
2753
|
+
return A.length ? G.resolve(A.shift()(b.idbtrans)).then(D) : G.resolve();
|
|
2754
2754
|
})().then(function() {
|
|
2755
|
-
|
|
2755
|
+
kr(x, _);
|
|
2756
2756
|
})) : G.resolve();
|
|
2757
2757
|
var p, O, b, _, A, x;
|
|
2758
2758
|
}).catch(f)) : (y(a).forEach(function(T) {
|
|
2759
2759
|
Gn(n, T, a[T].primKey, a[T].indexes);
|
|
2760
2760
|
}), fn(e, n), void G.follow(function() {
|
|
2761
|
-
return e.on.populate.fire(
|
|
2761
|
+
return e.on.populate.fire(s);
|
|
2762
2762
|
}).catch(f));
|
|
2763
2763
|
var v, w;
|
|
2764
2764
|
});
|
|
2765
2765
|
}
|
|
2766
2766
|
function Ma(e, t) {
|
|
2767
|
-
|
|
2767
|
+
kr(e._dbSchema, t), t.db.version % 10 != 0 || t.objectStoreNames.contains("$meta") || t.db.createObjectStore("$meta").add(Math.ceil(t.db.version / 10 - 1), "version");
|
|
2768
2768
|
var n = mn(0, e.idbdb, t);
|
|
2769
2769
|
pn(e, e._dbSchema, t);
|
|
2770
2770
|
for (var r = 0, a = Vn(n, e._dbSchema).change; r < a.length; r++) {
|
|
2771
|
-
var
|
|
2771
|
+
var s = (function(f) {
|
|
2772
2772
|
if (f.change.length || f.recreate) return console.warn("Unable to patch indexes of table ".concat(f.name, " because it has changes on the type of index or primary key.")), { value: void 0 };
|
|
2773
2773
|
var d = t.objectStore(f.name);
|
|
2774
2774
|
f.add.forEach(function(v) {
|
|
2775
|
-
|
|
2775
|
+
Pe && console.debug("Dexie upgrade patch: Creating missing index ".concat(f.name, ".").concat(v.src)), hn(d, v);
|
|
2776
2776
|
});
|
|
2777
2777
|
})(a[r]);
|
|
2778
|
-
if (typeof
|
|
2778
|
+
if (typeof s == "object") return s.value;
|
|
2779
2779
|
}
|
|
2780
2780
|
}
|
|
2781
2781
|
function Vn(e, t) {
|
|
2782
2782
|
var n, r = { del: [], add: [], change: [] };
|
|
2783
2783
|
for (n in e) t[n] || r.del.push(n);
|
|
2784
2784
|
for (n in t) {
|
|
2785
|
-
var a = e[n],
|
|
2785
|
+
var a = e[n], s = t[n];
|
|
2786
2786
|
if (a) {
|
|
2787
|
-
var f = { name: n, def:
|
|
2788
|
-
if ("" + (a.primKey.keyPath || "") != "" + (
|
|
2787
|
+
var f = { name: n, def: s, recreate: !1, del: [], add: [], change: [] };
|
|
2788
|
+
if ("" + (a.primKey.keyPath || "") != "" + (s.primKey.keyPath || "") || a.primKey.auto !== s.primKey.auto) f.recreate = !0, r.change.push(f);
|
|
2789
2789
|
else {
|
|
2790
|
-
var d = a.idxByName, v =
|
|
2790
|
+
var d = a.idxByName, v = s.idxByName, w = void 0;
|
|
2791
2791
|
for (w in d) v[w] || f.del.push(w);
|
|
2792
2792
|
for (w in v) {
|
|
2793
2793
|
var T = d[w], p = v[w];
|
|
@@ -2795,19 +2795,19 @@ function Ai() {
|
|
|
2795
2795
|
}
|
|
2796
2796
|
(0 < f.del.length || 0 < f.add.length || 0 < f.change.length) && r.change.push(f);
|
|
2797
2797
|
}
|
|
2798
|
-
} else r.add.push([n,
|
|
2798
|
+
} else r.add.push([n, s]);
|
|
2799
2799
|
}
|
|
2800
2800
|
return r;
|
|
2801
2801
|
}
|
|
2802
2802
|
function Gn(e, t, n, r) {
|
|
2803
2803
|
var a = e.db.createObjectStore(t, n.keyPath ? { keyPath: n.keyPath, autoIncrement: n.auto } : { autoIncrement: n.auto });
|
|
2804
|
-
return r.forEach(function(
|
|
2805
|
-
return hn(a,
|
|
2804
|
+
return r.forEach(function(s) {
|
|
2805
|
+
return hn(a, s);
|
|
2806
2806
|
}), a;
|
|
2807
2807
|
}
|
|
2808
|
-
function
|
|
2808
|
+
function kr(e, t) {
|
|
2809
2809
|
y(e).forEach(function(n) {
|
|
2810
|
-
t.db.objectStoreNames.contains(n) || (
|
|
2810
|
+
t.db.objectStoreNames.contains(n) || (Pe && console.debug("Dexie: Creating missing table", n), Gn(t, n, e[n].primKey, e[n].indexes));
|
|
2811
2811
|
});
|
|
2812
2812
|
}
|
|
2813
2813
|
function hn(e, t) {
|
|
@@ -2816,8 +2816,8 @@ function Ai() {
|
|
|
2816
2816
|
function mn(e, t, n) {
|
|
2817
2817
|
var r = {};
|
|
2818
2818
|
return Te(t.objectStoreNames, 0).forEach(function(a) {
|
|
2819
|
-
for (var
|
|
2820
|
-
var T =
|
|
2819
|
+
for (var s = n.objectStore(a), f = Kn(Rr(w = s.keyPath), w || "", !0, !1, !!s.autoIncrement, w && typeof w != "string", !0), d = [], v = 0; v < s.indexNames.length; ++v) {
|
|
2820
|
+
var T = s.index(s.indexNames[v]), w = T.keyPath, T = Kn(T.name, w, !!T.unique, !!T.multiEntry, !1, w && typeof w != "string", !1);
|
|
2821
2821
|
d.push(T);
|
|
2822
2822
|
}
|
|
2823
2823
|
r[a] = qn(a, f, d);
|
|
@@ -2825,40 +2825,40 @@ function Ai() {
|
|
|
2825
2825
|
}
|
|
2826
2826
|
function pn(e, t, n) {
|
|
2827
2827
|
for (var r = n.db.objectStoreNames, a = 0; a < r.length; ++a) {
|
|
2828
|
-
var
|
|
2828
|
+
var s = r[a], f = n.objectStore(s);
|
|
2829
2829
|
e._hasGetAll = "getAll" in f;
|
|
2830
2830
|
for (var d = 0; d < f.indexNames.length; ++d) {
|
|
2831
2831
|
var v = f.indexNames[d], w = f.index(v).keyPath, T = typeof w == "string" ? w : "[" + Te(w).join("+") + "]";
|
|
2832
|
-
!t[
|
|
2832
|
+
!t[s] || (w = t[s].idxByName[T]) && (w.name = v, delete t[s].idxByName[T], t[s].idxByName[v] = w);
|
|
2833
2833
|
}
|
|
2834
2834
|
}
|
|
2835
2835
|
typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && m.WorkerGlobalScope && m instanceof m.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (e._hasGetAll = !1);
|
|
2836
2836
|
}
|
|
2837
2837
|
function Fr(e) {
|
|
2838
2838
|
return e.split(",").map(function(t, n) {
|
|
2839
|
-
var
|
|
2840
|
-
return Kn(a,
|
|
2839
|
+
var s = t.split(":"), r = (a = s[1]) === null || a === void 0 ? void 0 : a.trim(), a = (t = s[0].trim()).replace(/([&*]|\+\+)/g, ""), s = /^\[/.test(a) ? a.match(/^\[(.*)\]$/)[1].split("+") : a;
|
|
2840
|
+
return Kn(a, s || null, /\&/.test(t), /\*/.test(t), /\+\+/.test(t), N(s), n === 0, r);
|
|
2841
2841
|
});
|
|
2842
2842
|
}
|
|
2843
2843
|
var ja = (Ot.prototype._createTableSchema = qn, Ot.prototype._parseIndexSyntax = Fr, Ot.prototype._parseStoresSpec = function(e, t) {
|
|
2844
2844
|
var n = this;
|
|
2845
2845
|
y(e).forEach(function(r) {
|
|
2846
2846
|
if (e[r] !== null) {
|
|
2847
|
-
var a = n._parseIndexSyntax(e[r]),
|
|
2848
|
-
if (!
|
|
2849
|
-
if (
|
|
2847
|
+
var a = n._parseIndexSyntax(e[r]), s = a.shift();
|
|
2848
|
+
if (!s) throw new C.Schema("Invalid schema for table " + r + ": " + e[r]);
|
|
2849
|
+
if (s.unique = !0, s.multi) throw new C.Schema("Primary key cannot be multiEntry*");
|
|
2850
2850
|
a.forEach(function(f) {
|
|
2851
|
-
if (f.auto) throw new
|
|
2852
|
-
if (!f.keyPath) throw new
|
|
2853
|
-
}), a = n._createTableSchema(r,
|
|
2851
|
+
if (f.auto) throw new C.Schema("Only primary key can be marked as autoIncrement (++)");
|
|
2852
|
+
if (!f.keyPath) throw new C.Schema("Index must have a name and cannot be an empty string");
|
|
2853
|
+
}), a = n._createTableSchema(r, s, a), t[r] = a;
|
|
2854
2854
|
}
|
|
2855
2855
|
});
|
|
2856
2856
|
}, Ot.prototype.stores = function(n) {
|
|
2857
2857
|
var t = this.db;
|
|
2858
2858
|
this._cfg.storesSource = this._cfg.storesSource ? R(this._cfg.storesSource, n) : n;
|
|
2859
2859
|
var n = t._versions, r = {}, a = {};
|
|
2860
|
-
return n.forEach(function(
|
|
2861
|
-
R(r,
|
|
2860
|
+
return n.forEach(function(s) {
|
|
2861
|
+
R(r, s._cfg.storesSource), a = s._cfg.dbschema = {}, s._parseStoresSpec(r, a);
|
|
2862
2862
|
}), t._dbSchema = a, Un(t, [t._allTables, t, t.Transaction.prototype]), dn(t, [t._allTables, t, t.Transaction.prototype, this._cfg.tables], y(a), a), t._storeNames = y(a), this;
|
|
2863
2863
|
}, Ot.prototype.upgrade = function(e) {
|
|
2864
2864
|
return this._cfg.contentUpgrade = wt(this._cfg.contentUpgrade || Q, e), this;
|
|
@@ -2900,16 +2900,16 @@ function Ai() {
|
|
|
2900
2900
|
}
|
|
2901
2901
|
function $t(e, t) {
|
|
2902
2902
|
Yn(t) || (function n(r, v) {
|
|
2903
|
-
var
|
|
2904
|
-
Gt(r,
|
|
2903
|
+
var s = v.from, f = v.to, d = v.l, v = v.r;
|
|
2904
|
+
Gt(r, s, f), d && n(r, d), v && n(r, v);
|
|
2905
2905
|
})(e, t);
|
|
2906
2906
|
}
|
|
2907
2907
|
function Br(e, t) {
|
|
2908
2908
|
var n = gn(t), r = n.next();
|
|
2909
2909
|
if (r.done) return !1;
|
|
2910
|
-
for (var a = r.value,
|
|
2910
|
+
for (var a = r.value, s = gn(e), f = s.next(a.from), d = f.value; !r.done && !f.done; ) {
|
|
2911
2911
|
if (re(d.from, a.to) <= 0 && 0 <= re(d.to, a.from)) return !0;
|
|
2912
|
-
re(a.from, d.from) < 0 ? a = (r = n.next(d.from)).value : d = (f =
|
|
2912
|
+
re(a.from, d.from) < 0 ? a = (r = n.next(d.from)).value : d = (f = s.next(a.from)).value;
|
|
2913
2913
|
}
|
|
2914
2914
|
return !1;
|
|
2915
2915
|
}
|
|
@@ -2944,8 +2944,8 @@ function Ai() {
|
|
|
2944
2944
|
function yn(e, t) {
|
|
2945
2945
|
return y(t).forEach(function(n) {
|
|
2946
2946
|
e[n] ? $t(e[n], t[n]) : e[n] = (function r(a) {
|
|
2947
|
-
var
|
|
2948
|
-
for (
|
|
2947
|
+
var s, f, d = {};
|
|
2948
|
+
for (s in a) W(a, s) && (f = a[s], d[s] = !f || typeof f != "object" || He.has(f.constructor) ? f : r(f));
|
|
2949
2949
|
return d;
|
|
2950
2950
|
})(t[n]);
|
|
2951
2951
|
}), e;
|
|
@@ -2980,17 +2980,17 @@ function Ai() {
|
|
|
2980
2980
|
t === void 0 && (t = !1);
|
|
2981
2981
|
var n = /* @__PURE__ */ new Set();
|
|
2982
2982
|
if (e.all) for (var r = 0, a = Object.values(gt); r < a.length; r++) Kr(f = a[r], e, n, t);
|
|
2983
|
-
else for (var
|
|
2984
|
-
var f, d = /^idb\:\/\/(.*)\/(.*)\//.exec(
|
|
2985
|
-
d && (
|
|
2983
|
+
else for (var s in e) {
|
|
2984
|
+
var f, d = /^idb\:\/\/(.*)\/(.*)\//.exec(s);
|
|
2985
|
+
d && (s = d[1], d = d[2], (f = gt["idb://".concat(s, "/").concat(d)]) && Kr(f, e, n, t));
|
|
2986
2986
|
}
|
|
2987
2987
|
n.forEach(function(v) {
|
|
2988
2988
|
return v();
|
|
2989
2989
|
});
|
|
2990
2990
|
}
|
|
2991
2991
|
function Kr(e, t, n, r) {
|
|
2992
|
-
for (var a = [],
|
|
2993
|
-
for (var d = f[
|
|
2992
|
+
for (var a = [], s = 0, f = Object.entries(e.queries.query); s < f.length; s++) {
|
|
2993
|
+
for (var d = f[s], v = d[0], w = [], T = 0, p = d[1]; T < p.length; T++) {
|
|
2994
2994
|
var O = p[T];
|
|
2995
2995
|
zn(t, O.obsSet) ? O.subscribers.forEach(function(x) {
|
|
2996
2996
|
return n.add(x);
|
|
@@ -3009,29 +3009,29 @@ function Ai() {
|
|
|
3009
3009
|
return t.dbOpenError ? be(t.dbOpenError) : e;
|
|
3010
3010
|
});
|
|
3011
3011
|
t.isBeingOpened = !0, t.dbOpenError = null, t.openComplete = !1;
|
|
3012
|
-
var r = t.openCanceller, a = Math.round(10 * e.verno),
|
|
3012
|
+
var r = t.openCanceller, a = Math.round(10 * e.verno), s = !1;
|
|
3013
3013
|
function f() {
|
|
3014
|
-
if (t.openCanceller !== r) throw new
|
|
3014
|
+
if (t.openCanceller !== r) throw new C.DatabaseClosed("db.open() was cancelled");
|
|
3015
3015
|
}
|
|
3016
3016
|
function d() {
|
|
3017
3017
|
return new G(function(O, b) {
|
|
3018
|
-
if (f(), !n) throw new
|
|
3018
|
+
if (f(), !n) throw new C.MissingAPI();
|
|
3019
3019
|
var _ = e.name, A = t.autoSchema || !a ? n.open(_) : n.open(_, a);
|
|
3020
|
-
if (!A) throw new
|
|
3021
|
-
A.onerror =
|
|
3022
|
-
var
|
|
3023
|
-
T = A.transaction, t.autoSchema && !e._options.allowEmptyDB ? (A.onerror = qt, T.abort(), A.result.close(), (
|
|
3024
|
-
b(new
|
|
3025
|
-
})) : (T.onerror =
|
|
3020
|
+
if (!A) throw new C.MissingAPI();
|
|
3021
|
+
A.onerror = Ve(b), A.onblocked = ge(e._fireOnBlocked), A.onupgradeneeded = ge(function(x) {
|
|
3022
|
+
var D;
|
|
3023
|
+
T = A.transaction, t.autoSchema && !e._options.allowEmptyDB ? (A.onerror = qt, T.abort(), A.result.close(), (D = n.deleteDatabase(_)).onsuccess = D.onerror = ge(function() {
|
|
3024
|
+
b(new C.NoSuchDatabase("Database ".concat(_, " doesnt exist")));
|
|
3025
|
+
})) : (T.onerror = Ve(b), x = x.oldVersion > Math.pow(2, 62) ? 0 : x.oldVersion, p = x < 1, e.idbdb = A.result, s && Ma(e, T), Ba(e, x / 10, T, b));
|
|
3026
3026
|
}, b), A.onsuccess = ge(function() {
|
|
3027
3027
|
T = null;
|
|
3028
|
-
var x,
|
|
3028
|
+
var x, D, S, P, k, M = e.idbdb = A.result, L = Te(M.objectStoreNames);
|
|
3029
3029
|
if (0 < L.length) try {
|
|
3030
|
-
var K = M.transaction((
|
|
3031
|
-
if (t.autoSchema)
|
|
3032
|
-
else if (pn(e, e._dbSchema, K), ((
|
|
3030
|
+
var K = M.transaction((P = L).length === 1 ? P[0] : P, "readonly");
|
|
3031
|
+
if (t.autoSchema) D = M, S = K, (x = e).verno = D.version / 10, S = x._dbSchema = mn(0, D, S), x._storeNames = Te(D.objectStoreNames, 0), dn(x, [x._allTables], y(S), S);
|
|
3032
|
+
else if (pn(e, e._dbSchema, K), ((k = Vn(mn(0, (k = e).idbdb, K), k._dbSchema)).add.length || k.change.some(function(q) {
|
|
3033
3033
|
return q.add.length || q.change.length;
|
|
3034
|
-
})) && !
|
|
3034
|
+
})) && !s) 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."), M.close(), a = M.version + 1, s = !0, O(d());
|
|
3035
3035
|
fn(e, K);
|
|
3036
3036
|
} catch {
|
|
3037
3037
|
}
|
|
@@ -3039,7 +3039,7 @@ function Ai() {
|
|
|
3039
3039
|
t.vcFired = !0, e.on("versionchange").fire(q);
|
|
3040
3040
|
}), M.onclose = ge(function(q) {
|
|
3041
3041
|
e.on("close").fire(q);
|
|
3042
|
-
}), p && (
|
|
3042
|
+
}), p && (k = e._deps, K = _, M = k.indexedDB, k = k.IDBKeyRange, Xn(M) || K === an || $n(M, k).put({ name: K }).catch(Q)), O();
|
|
3043
3043
|
}, b);
|
|
3044
3044
|
}).catch(function(O) {
|
|
3045
3045
|
switch (O?.name) {
|
|
@@ -3092,15 +3092,15 @@ function Ai() {
|
|
|
3092
3092
|
});
|
|
3093
3093
|
}
|
|
3094
3094
|
function Jn(e) {
|
|
3095
|
-
function t(
|
|
3096
|
-
return e.next(
|
|
3095
|
+
function t(s) {
|
|
3096
|
+
return e.next(s);
|
|
3097
3097
|
}
|
|
3098
|
-
var n = a(t), r = a(function(
|
|
3099
|
-
return e.throw(
|
|
3098
|
+
var n = a(t), r = a(function(s) {
|
|
3099
|
+
return e.throw(s);
|
|
3100
3100
|
});
|
|
3101
|
-
function a(
|
|
3101
|
+
function a(s) {
|
|
3102
3102
|
return function(v) {
|
|
3103
|
-
var d =
|
|
3103
|
+
var d = s(v), v = d.value;
|
|
3104
3104
|
return d.done ? v : v && typeof v.then == "function" ? v.then(n, r) : N(v) ? Promise.all(v).then(n, r) : n(v);
|
|
3105
3105
|
};
|
|
3106
3106
|
}
|
|
@@ -3112,12 +3112,12 @@ function Ai() {
|
|
|
3112
3112
|
}
|
|
3113
3113
|
var qa = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
|
|
3114
3114
|
return i(i({}, e), { table: function(t) {
|
|
3115
|
-
var n = e.table(t), r = n.schema, a = {},
|
|
3115
|
+
var n = e.table(t), r = n.schema, a = {}, s = [];
|
|
3116
3116
|
function f(p, O, b) {
|
|
3117
|
-
var _ = Vt(p), A = a[_] = a[_] || [], x = p == null ? 0 : typeof p == "string" ? 1 : p.length,
|
|
3118
|
-
return A.push(
|
|
3119
|
-
return S.keyTail -
|
|
3120
|
-
}),
|
|
3117
|
+
var _ = Vt(p), A = a[_] = a[_] || [], x = p == null ? 0 : typeof p == "string" ? 1 : p.length, D = 0 < O, D = i(i({}, b), { name: D ? "".concat(_, "(virtual-from:").concat(b.name, ")") : b.name, lowLevelIndex: b, isVirtual: D, keyTail: O, keyLength: x, extractKey: Ln(p), unique: !D && b.unique });
|
|
3118
|
+
return A.push(D), D.isPrimaryKey || s.push(D), 1 < x && f(x === 2 ? p[0] : p.slice(0, x - 1), O + 1, b), A.sort(function(S, P) {
|
|
3119
|
+
return S.keyTail - P.keyTail;
|
|
3120
|
+
}), D;
|
|
3121
3121
|
}
|
|
3122
3122
|
t = f(r.primaryKey.keyPath, 0, r.primaryKey), a[":id"] = [t];
|
|
3123
3123
|
for (var d = 0, v = r.indexes; d < v.length; d++) {
|
|
@@ -3128,7 +3128,7 @@ function Ai() {
|
|
|
3128
3128
|
var O, b = p.query.index;
|
|
3129
3129
|
return b.isVirtual ? i(i({}, p), { query: { index: b.lowLevelIndex, range: (O = p.query.range, b = b.keyTail, { type: O.type === 1 ? 2 : O.type, lower: bn(O.lower, O.lowerOpen ? e.MAX_KEY : e.MIN_KEY, b), lowerOpen: !0, upper: bn(O.upper, O.upperOpen ? e.MIN_KEY : e.MAX_KEY, b), upperOpen: !0 }) } }) : p;
|
|
3130
3130
|
}
|
|
3131
|
-
return i(i({}, n), { schema: i(i({}, r), { primaryKey: t, indexes:
|
|
3131
|
+
return i(i({}, n), { schema: i(i({}, r), { primaryKey: t, indexes: s, getIndexByKeyPath: function(p) {
|
|
3132
3132
|
return (p = a[Vt(p)]) && p[0];
|
|
3133
3133
|
} }), count: function(p) {
|
|
3134
3134
|
return n.count(T(p));
|
|
@@ -3136,21 +3136,21 @@ function Ai() {
|
|
|
3136
3136
|
return n.query(T(p));
|
|
3137
3137
|
}, openCursor: function(p) {
|
|
3138
3138
|
var O = p.query.index, b = O.keyTail, _ = O.isVirtual, A = O.keyLength;
|
|
3139
|
-
return _ ? n.openCursor(T(p)).then(function(
|
|
3140
|
-
return
|
|
3139
|
+
return _ ? n.openCursor(T(p)).then(function(D) {
|
|
3140
|
+
return D && x(D);
|
|
3141
3141
|
}) : n.openCursor(p);
|
|
3142
|
-
function x(
|
|
3143
|
-
return Object.create(
|
|
3144
|
-
S != null ?
|
|
3145
|
-
} }, continuePrimaryKey: { value: function(S,
|
|
3146
|
-
|
|
3142
|
+
function x(D) {
|
|
3143
|
+
return Object.create(D, { continue: { value: function(S) {
|
|
3144
|
+
S != null ? D.continue(bn(S, p.reverse ? e.MAX_KEY : e.MIN_KEY, b)) : p.unique ? D.continue(D.key.slice(0, A).concat(p.reverse ? e.MIN_KEY : e.MAX_KEY, b)) : D.continue();
|
|
3145
|
+
} }, continuePrimaryKey: { value: function(S, P) {
|
|
3146
|
+
D.continuePrimaryKey(bn(S, e.MAX_KEY, b), P);
|
|
3147
3147
|
} }, primaryKey: { get: function() {
|
|
3148
|
-
return
|
|
3148
|
+
return D.primaryKey;
|
|
3149
3149
|
} }, key: { get: function() {
|
|
3150
|
-
var S =
|
|
3150
|
+
var S = D.key;
|
|
3151
3151
|
return A === 1 ? S[0] : S.slice(0, A);
|
|
3152
3152
|
} }, value: { get: function() {
|
|
3153
|
-
return
|
|
3153
|
+
return D.value;
|
|
3154
3154
|
} } });
|
|
3155
3155
|
}
|
|
3156
3156
|
} });
|
|
@@ -3158,8 +3158,8 @@ function Ai() {
|
|
|
3158
3158
|
} };
|
|
3159
3159
|
function er(e, t, n, r) {
|
|
3160
3160
|
return n = n || {}, r = r || "", y(e).forEach(function(a) {
|
|
3161
|
-
var
|
|
3162
|
-
W(t, a) ? (
|
|
3161
|
+
var s, f, d;
|
|
3162
|
+
W(t, a) ? (s = e[a], f = t[a], typeof s == "object" && typeof f == "object" && s && f ? (d = Ke(s)) !== Ke(f) ? n[r + a] = t[a] : d === "Object" ? er(s, f, n, r + a + ".") : s !== f && (n[r + a] = t[a]) : s !== f && (n[r + a] = t[a])) : n[r + a] = void 0;
|
|
3163
3163
|
}), y(t).forEach(function(a) {
|
|
3164
3164
|
W(e, a) || (n[r + a] = t[a]);
|
|
3165
3165
|
}), n;
|
|
@@ -3171,31 +3171,31 @@ function Ai() {
|
|
|
3171
3171
|
return i(i({}, e), { table: function(t) {
|
|
3172
3172
|
var n = e.table(t), r = n.schema.primaryKey;
|
|
3173
3173
|
return i(i({}, n), { mutate: function(a) {
|
|
3174
|
-
var
|
|
3174
|
+
var s = z.trans, f = s.table(t).hook, d = f.deleting, v = f.creating, w = f.updating;
|
|
3175
3175
|
switch (a.type) {
|
|
3176
3176
|
case "add":
|
|
3177
3177
|
if (v.fire === Q) break;
|
|
3178
|
-
return
|
|
3178
|
+
return s._promise("readwrite", function() {
|
|
3179
3179
|
return T(a);
|
|
3180
3180
|
}, !0);
|
|
3181
3181
|
case "put":
|
|
3182
3182
|
if (v.fire === Q && w.fire === Q) break;
|
|
3183
|
-
return
|
|
3183
|
+
return s._promise("readwrite", function() {
|
|
3184
3184
|
return T(a);
|
|
3185
3185
|
}, !0);
|
|
3186
3186
|
case "delete":
|
|
3187
3187
|
if (d.fire === Q) break;
|
|
3188
|
-
return
|
|
3188
|
+
return s._promise("readwrite", function() {
|
|
3189
3189
|
return T(a);
|
|
3190
3190
|
}, !0);
|
|
3191
3191
|
case "deleteRange":
|
|
3192
3192
|
if (d.fire === Q) break;
|
|
3193
|
-
return
|
|
3193
|
+
return s._promise("readwrite", function() {
|
|
3194
3194
|
return (function p(O, b, _) {
|
|
3195
3195
|
return n.query({ trans: O, values: !1, query: { index: r, range: b }, limit: _ }).then(function(A) {
|
|
3196
3196
|
var x = A.result;
|
|
3197
|
-
return T({ type: "delete", keys: x, trans: O }).then(function(
|
|
3198
|
-
return 0 <
|
|
3197
|
+
return T({ type: "delete", keys: x, trans: O }).then(function(D) {
|
|
3198
|
+
return 0 < D.numFailures ? Promise.reject(D.failures[0]) : x.length < _ ? { failures: [], numFailures: 0, lastResult: void 0 } : p(O, i(i({}, b), { lower: x[x.length - 1], lowerOpen: !0 }), _);
|
|
3199
3199
|
});
|
|
3200
3200
|
});
|
|
3201
3201
|
})(a.trans, a.range, 1e4);
|
|
@@ -3205,23 +3205,23 @@ function Ai() {
|
|
|
3205
3205
|
function T(p) {
|
|
3206
3206
|
var O, b, _, A = z.trans, x = p.keys || tr(r, p);
|
|
3207
3207
|
if (!x) throw new Error("Keys missing");
|
|
3208
|
-
return (p = p.type === "add" || p.type === "put" ? i(i({}, p), { keys: x }) : i({}, p)).type !== "delete" && (p.values = h([], p.values)), p.keys && (p.keys = h([], p.keys)), O = n, _ = x, ((b = p).type === "add" ? Promise.resolve([]) : O.getMany({ trans: b.trans, keys: _, cache: "immutable" })).then(function(
|
|
3209
|
-
var S = x.map(function(
|
|
3210
|
-
var M, L, K, q =
|
|
3211
|
-
return p.type === "delete" ? d.fire.call(V,
|
|
3208
|
+
return (p = p.type === "add" || p.type === "put" ? i(i({}, p), { keys: x }) : i({}, p)).type !== "delete" && (p.values = h([], p.values)), p.keys && (p.keys = h([], p.keys)), O = n, _ = x, ((b = p).type === "add" ? Promise.resolve([]) : O.getMany({ trans: b.trans, keys: _, cache: "immutable" })).then(function(D) {
|
|
3209
|
+
var S = x.map(function(P, k) {
|
|
3210
|
+
var M, L, K, q = D[k], V = { onerror: null, onsuccess: null };
|
|
3211
|
+
return p.type === "delete" ? d.fire.call(V, P, q, A) : p.type === "add" || q === void 0 ? (M = v.fire.call(V, P, p.values[k], A), P == null && M != null && (p.keys[k] = P = M, r.outbound || ne(p.values[k], r.keyPath, P))) : (M = er(q, p.values[k]), (L = w.fire.call(V, M, P, q, A)) && (K = p.values[k], Object.keys(L).forEach(function(U) {
|
|
3212
3212
|
W(K, U) ? K[U] = L[U] : ne(K, U, L[U]);
|
|
3213
3213
|
}))), V;
|
|
3214
3214
|
});
|
|
3215
|
-
return n.mutate(p).then(function(
|
|
3216
|
-
for (var
|
|
3215
|
+
return n.mutate(p).then(function(P) {
|
|
3216
|
+
for (var k = P.failures, M = P.results, L = P.numFailures, P = P.lastResult, K = 0; K < x.length; ++K) {
|
|
3217
3217
|
var q = (M || x)[K], V = S[K];
|
|
3218
|
-
q == null ? V.onerror && V.onerror(
|
|
3218
|
+
q == null ? V.onerror && V.onerror(k[K]) : V.onsuccess && V.onsuccess(p.type === "put" && D[K] ? p.values[K] : q);
|
|
3219
3219
|
}
|
|
3220
|
-
return { failures:
|
|
3221
|
-
}).catch(function(
|
|
3222
|
-
return S.forEach(function(
|
|
3223
|
-
return
|
|
3224
|
-
}), Promise.reject(
|
|
3220
|
+
return { failures: k, results: M, numFailures: L, lastResult: P };
|
|
3221
|
+
}).catch(function(P) {
|
|
3222
|
+
return S.forEach(function(k) {
|
|
3223
|
+
return k.onerror && k.onerror(P);
|
|
3224
|
+
}), Promise.reject(P);
|
|
3225
3225
|
});
|
|
3226
3226
|
});
|
|
3227
3227
|
}
|
|
@@ -3231,7 +3231,7 @@ function Ai() {
|
|
|
3231
3231
|
function qr(e, t, n) {
|
|
3232
3232
|
try {
|
|
3233
3233
|
if (!t || t.keys.length < e.length) return null;
|
|
3234
|
-
for (var r = [], a = 0,
|
|
3234
|
+
for (var r = [], a = 0, s = 0; a < t.keys.length && s < e.length; ++a) re(t.keys[a], e[s]) === 0 && (r.push(n ? ke(t.values[a]) : t.values[a]), ++s);
|
|
3235
3235
|
return r.length === e.length ? r : null;
|
|
3236
3236
|
} catch {
|
|
3237
3237
|
return null;
|
|
@@ -3243,8 +3243,8 @@ function Ai() {
|
|
|
3243
3243
|
return i(i({}, n), { getMany: function(r) {
|
|
3244
3244
|
if (!r.cache) return n.getMany(r);
|
|
3245
3245
|
var a = qr(r.keys, r.trans._cache, r.cache === "clone");
|
|
3246
|
-
return a ? G.resolve(a) : n.getMany(r).then(function(
|
|
3247
|
-
return r.trans._cache = { keys: r.keys, values: r.cache === "clone" ?
|
|
3246
|
+
return a ? G.resolve(a) : n.getMany(r).then(function(s) {
|
|
3247
|
+
return r.trans._cache = { keys: r.keys, values: r.cache === "clone" ? ke(s) : s }, s;
|
|
3248
3248
|
});
|
|
3249
3249
|
}, mutate: function(r) {
|
|
3250
3250
|
return r.type !== "add" && (r.trans._cache = null), n.mutate(r);
|
|
@@ -3267,20 +3267,20 @@ function Ai() {
|
|
|
3267
3267
|
}
|
|
3268
3268
|
var Va = { stack: "dbcore", level: 0, name: "Observability", create: function(e) {
|
|
3269
3269
|
var t = e.schema.name, n = new Oe(e.MIN_KEY, e.MAX_KEY);
|
|
3270
|
-
return i(i({}, e), { transaction: function(r, a,
|
|
3271
|
-
if (z.subscr && a !== "readonly") throw new
|
|
3272
|
-
return e.transaction(r, a,
|
|
3270
|
+
return i(i({}, e), { transaction: function(r, a, s) {
|
|
3271
|
+
if (z.subscr && a !== "readonly") throw new C.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(z.querier));
|
|
3272
|
+
return e.transaction(r, a, s);
|
|
3273
3273
|
}, table: function(r) {
|
|
3274
|
-
var a = e.table(r),
|
|
3274
|
+
var a = e.table(r), s = a.schema, f = s.primaryKey, p = s.indexes, d = f.extractKey, v = f.outbound, w = f.autoIncrement && p.filter(function(b) {
|
|
3275
3275
|
return b.compound && b.keyPath.includes(f.keyPath);
|
|
3276
3276
|
}), T = i(i({}, a), { mutate: function(b) {
|
|
3277
3277
|
function _(U) {
|
|
3278
|
-
return U = "idb://".concat(t, "/").concat(r, "/").concat(U),
|
|
3278
|
+
return U = "idb://".concat(t, "/").concat(r, "/").concat(U), P[U] || (P[U] = new Oe());
|
|
3279
3279
|
}
|
|
3280
|
-
var A, x,
|
|
3280
|
+
var A, x, D, S = b.trans, P = b.mutatedParts || (b.mutatedParts = {}), k = _(""), M = _(":dels"), L = b.type, V = b.type === "deleteRange" ? [b.range] : b.type === "delete" ? [b.keys] : b.values.length < 50 ? [tr(f, b).filter(function(U) {
|
|
3281
3281
|
return U;
|
|
3282
3282
|
}), b.values] : [], K = V[0], q = V[1], V = b.trans._cache;
|
|
3283
|
-
return N(K) ? (
|
|
3283
|
+
return N(K) ? (k.addKeys(K), (V = L === "delete" || K.length === q.length ? qr(K, V) : null) || M.addKeys(K), (V || q) && (A = _, x = V, D = q, s.indexes.forEach(function(U) {
|
|
3284
3284
|
var $ = A(U.name || "");
|
|
3285
3285
|
function te(Z) {
|
|
3286
3286
|
return Z != null ? U.extractKey(Z) : null;
|
|
@@ -3290,21 +3290,21 @@ function Ai() {
|
|
|
3290
3290
|
return $.addKey(ve);
|
|
3291
3291
|
}) : $.addKey(Z);
|
|
3292
3292
|
}
|
|
3293
|
-
(x ||
|
|
3294
|
-
var H = x && te(x[Ce]), Ce =
|
|
3293
|
+
(x || D).forEach(function(Z, Ce) {
|
|
3294
|
+
var H = x && te(x[Ce]), Ce = D && te(D[Ce]);
|
|
3295
3295
|
re(H, Ce) !== 0 && (H != null && oe(H), Ce != null && oe(Ce));
|
|
3296
3296
|
});
|
|
3297
|
-
}))) : K ? (q = { from: (q = K.lower) !== null && q !== void 0 ? q : e.MIN_KEY, to: (q = K.upper) !== null && q !== void 0 ? q : e.MAX_KEY }, M.add(q),
|
|
3297
|
+
}))) : K ? (q = { from: (q = K.lower) !== null && q !== void 0 ? q : e.MIN_KEY, to: (q = K.upper) !== null && q !== void 0 ? q : e.MAX_KEY }, M.add(q), k.add(q)) : (k.add(n), M.add(n), s.indexes.forEach(function(U) {
|
|
3298
3298
|
return _(U.name).add(n);
|
|
3299
3299
|
})), a.mutate(b).then(function(U) {
|
|
3300
|
-
return !K || b.type !== "add" && b.type !== "put" || (
|
|
3300
|
+
return !K || b.type !== "add" && b.type !== "put" || (k.addKeys(U.results), w && w.forEach(function($) {
|
|
3301
3301
|
for (var te = b.values.map(function(H) {
|
|
3302
3302
|
return $.extractKey(H);
|
|
3303
3303
|
}), oe = $.keyPath.findIndex(function(H) {
|
|
3304
3304
|
return H === f.keyPath;
|
|
3305
3305
|
}), Z = 0, ve = U.results.length; Z < ve; ++Z) te[Z][oe] = U.results[Z];
|
|
3306
3306
|
_($.name).addKeys(te);
|
|
3307
|
-
})), S.mutatedParts = yn(S.mutatedParts || {},
|
|
3307
|
+
})), S.mutatedParts = yn(S.mutatedParts || {}, P), U;
|
|
3308
3308
|
});
|
|
3309
3309
|
} }), p = function(_) {
|
|
3310
3310
|
var A = _.query, _ = A.index, A = A.range;
|
|
@@ -3316,36 +3316,36 @@ function Ai() {
|
|
|
3316
3316
|
}, count: p, query: p, openCursor: p };
|
|
3317
3317
|
return y(O).forEach(function(b) {
|
|
3318
3318
|
T[b] = function(_) {
|
|
3319
|
-
var A = z.subscr, x = !!A,
|
|
3319
|
+
var A = z.subscr, x = !!A, D = Lr(z, a) && Ur(b, _) ? _.obsSet = {} : A;
|
|
3320
3320
|
if (x) {
|
|
3321
3321
|
var S = function(q) {
|
|
3322
|
-
return q = "idb://".concat(t, "/").concat(r, "/").concat(q),
|
|
3323
|
-
},
|
|
3324
|
-
if ((b === "query" && x.isPrimaryKey && !_.values ?
|
|
3322
|
+
return q = "idb://".concat(t, "/").concat(r, "/").concat(q), D[q] || (D[q] = new Oe());
|
|
3323
|
+
}, P = S(""), k = S(":dels"), A = O[b](_), x = A[0], A = A[1];
|
|
3324
|
+
if ((b === "query" && x.isPrimaryKey && !_.values ? k : S(x.name || "")).add(A), !x.isPrimaryKey) {
|
|
3325
3325
|
if (b !== "count") {
|
|
3326
3326
|
var M = b === "query" && v && _.values && a.query(i(i({}, _), { values: !1 }));
|
|
3327
3327
|
return a[b].apply(this, arguments).then(function(q) {
|
|
3328
3328
|
if (b === "query") {
|
|
3329
3329
|
if (v && _.values) return M.then(function(te) {
|
|
3330
|
-
return te = te.result,
|
|
3330
|
+
return te = te.result, P.addKeys(te), q;
|
|
3331
3331
|
});
|
|
3332
3332
|
var V = _.values ? q.result.map(d) : q.result;
|
|
3333
|
-
(_.values ?
|
|
3333
|
+
(_.values ? P : k).addKeys(V);
|
|
3334
3334
|
} else if (b === "openCursor") {
|
|
3335
3335
|
var U = q, $ = _.values;
|
|
3336
3336
|
return U && Object.create(U, { key: { get: function() {
|
|
3337
|
-
return
|
|
3337
|
+
return k.addKey(U.primaryKey), U.key;
|
|
3338
3338
|
} }, primaryKey: { get: function() {
|
|
3339
3339
|
var te = U.primaryKey;
|
|
3340
|
-
return
|
|
3340
|
+
return k.addKey(te), te;
|
|
3341
3341
|
} }, value: { get: function() {
|
|
3342
|
-
return $ &&
|
|
3342
|
+
return $ && P.addKey(U.primaryKey), U.value;
|
|
3343
3343
|
} } });
|
|
3344
3344
|
}
|
|
3345
3345
|
return q;
|
|
3346
3346
|
});
|
|
3347
3347
|
}
|
|
3348
|
-
|
|
3348
|
+
k.add(n);
|
|
3349
3349
|
}
|
|
3350
3350
|
}
|
|
3351
3351
|
return a[b].apply(this, arguments);
|
|
@@ -3357,25 +3357,25 @@ function Ai() {
|
|
|
3357
3357
|
if (n.numFailures === 0) return t;
|
|
3358
3358
|
if (t.type === "deleteRange") return null;
|
|
3359
3359
|
var r = t.keys ? t.keys.length : "values" in t && t.values ? t.values.length : 1;
|
|
3360
|
-
return n.numFailures === r ? null : (t = i({}, t), N(t.keys) && (t.keys = t.keys.filter(function(a,
|
|
3361
|
-
return !(
|
|
3362
|
-
})), "values" in t && N(t.values) && (t.values = t.values.filter(function(a,
|
|
3363
|
-
return !(
|
|
3360
|
+
return n.numFailures === r ? null : (t = i({}, t), N(t.keys) && (t.keys = t.keys.filter(function(a, s) {
|
|
3361
|
+
return !(s in n.failures);
|
|
3362
|
+
})), "values" in t && N(t.values) && (t.values = t.values.filter(function(a, s) {
|
|
3363
|
+
return !(s in n.failures);
|
|
3364
3364
|
})), t);
|
|
3365
3365
|
}
|
|
3366
3366
|
function nr(e, t) {
|
|
3367
3367
|
return n = e, ((r = t).lower === void 0 || (r.lowerOpen ? 0 < re(n, r.lower) : 0 <= re(n, r.lower))) && (e = e, (t = t).upper === void 0 || (t.upperOpen ? re(e, t.upper) < 0 : re(e, t.upper) <= 0));
|
|
3368
3368
|
var n, r;
|
|
3369
3369
|
}
|
|
3370
|
-
function Gr(e, t, O, r, a,
|
|
3370
|
+
function Gr(e, t, O, r, a, s) {
|
|
3371
3371
|
if (!O || O.length === 0) return e;
|
|
3372
3372
|
var f = t.query.index, d = f.multiEntry, v = t.query.range, w = r.schema.primaryKey.extractKey, T = f.extractKey, p = (f.lowLevelIndex || f).extractKey, O = O.reduce(function(b, _) {
|
|
3373
3373
|
var A = b, x = [];
|
|
3374
|
-
if (_.type === "add" || _.type === "put") for (var
|
|
3375
|
-
var
|
|
3376
|
-
|
|
3374
|
+
if (_.type === "add" || _.type === "put") for (var D = new Oe(), S = _.values.length - 1; 0 <= S; --S) {
|
|
3375
|
+
var P, k = _.values[S], M = w(k);
|
|
3376
|
+
D.hasKey(M) || (P = T(k), (d && N(P) ? P.some(function(U) {
|
|
3377
3377
|
return nr(U, v);
|
|
3378
|
-
}) : nr(
|
|
3378
|
+
}) : nr(P, v)) && (D.addKey(M), x.push(k)));
|
|
3379
3379
|
}
|
|
3380
3380
|
switch (_.type) {
|
|
3381
3381
|
case "add":
|
|
@@ -3415,61 +3415,61 @@ function Ai() {
|
|
|
3415
3415
|
}, e);
|
|
3416
3416
|
return O === e ? e : (O.sort(function(b, _) {
|
|
3417
3417
|
return re(p(b), p(_)) || re(w(b), w(_));
|
|
3418
|
-
}), t.limit && t.limit < 1 / 0 && (O.length > t.limit ? O.length = t.limit : e.length === t.limit && O.length < t.limit && (a.dirty = !0)),
|
|
3418
|
+
}), t.limit && t.limit < 1 / 0 && (O.length > t.limit ? O.length = t.limit : e.length === t.limit && O.length < t.limit && (a.dirty = !0)), s ? Object.freeze(O) : O);
|
|
3419
3419
|
}
|
|
3420
3420
|
function $r(e, t) {
|
|
3421
3421
|
return re(e.lower, t.lower) === 0 && re(e.upper, t.upper) === 0 && !!e.lowerOpen == !!t.lowerOpen && !!e.upperOpen == !!t.upperOpen;
|
|
3422
3422
|
}
|
|
3423
3423
|
function Ga(e, t) {
|
|
3424
|
-
return (function(n, r, a,
|
|
3424
|
+
return (function(n, r, a, s) {
|
|
3425
3425
|
if (n === void 0) return r !== void 0 ? -1 : 0;
|
|
3426
3426
|
if (r === void 0) return 1;
|
|
3427
3427
|
if ((r = re(n, r)) === 0) {
|
|
3428
|
-
if (a &&
|
|
3428
|
+
if (a && s) return 0;
|
|
3429
3429
|
if (a) return 1;
|
|
3430
|
-
if (
|
|
3430
|
+
if (s) return -1;
|
|
3431
3431
|
}
|
|
3432
3432
|
return r;
|
|
3433
|
-
})(e.lower, t.lower, e.lowerOpen, t.lowerOpen) <= 0 && 0 <= (function(n, r, a,
|
|
3433
|
+
})(e.lower, t.lower, e.lowerOpen, t.lowerOpen) <= 0 && 0 <= (function(n, r, a, s) {
|
|
3434
3434
|
if (n === void 0) return r !== void 0 ? 1 : 0;
|
|
3435
3435
|
if (r === void 0) return -1;
|
|
3436
3436
|
if ((r = re(n, r)) === 0) {
|
|
3437
|
-
if (a &&
|
|
3437
|
+
if (a && s) return 0;
|
|
3438
3438
|
if (a) return -1;
|
|
3439
|
-
if (
|
|
3439
|
+
if (s) return 1;
|
|
3440
3440
|
}
|
|
3441
3441
|
return r;
|
|
3442
3442
|
})(e.upper, t.upper, e.upperOpen, t.upperOpen);
|
|
3443
3443
|
}
|
|
3444
3444
|
function $a(e, t, n, r) {
|
|
3445
3445
|
e.subscribers.add(n), r.addEventListener("abort", function() {
|
|
3446
|
-
var a,
|
|
3447
|
-
e.subscribers.delete(n), e.subscribers.size === 0 && (a = e,
|
|
3448
|
-
a.subscribers.size === 0 && Xe(
|
|
3446
|
+
var a, s;
|
|
3447
|
+
e.subscribers.delete(n), e.subscribers.size === 0 && (a = e, s = t, setTimeout(function() {
|
|
3448
|
+
a.subscribers.size === 0 && Xe(s, a);
|
|
3449
3449
|
}, 3e3));
|
|
3450
3450
|
});
|
|
3451
3451
|
}
|
|
3452
3452
|
var Xa = { stack: "dbcore", level: 0, name: "Cache", create: function(e) {
|
|
3453
3453
|
var t = e.schema.name;
|
|
3454
3454
|
return i(i({}, e), { transaction: function(n, r, a) {
|
|
3455
|
-
var
|
|
3456
|
-
return r === "readwrite" && (f = (
|
|
3455
|
+
var s, f, d = e.transaction(n, r, a);
|
|
3456
|
+
return r === "readwrite" && (f = (s = new AbortController()).signal, a = function(v) {
|
|
3457
3457
|
return function() {
|
|
3458
|
-
if (
|
|
3458
|
+
if (s.abort(), r === "readwrite") {
|
|
3459
3459
|
for (var w = /* @__PURE__ */ new Set(), T = 0, p = n; T < p.length; T++) {
|
|
3460
3460
|
var O = p[T], b = gt["idb://".concat(t, "/").concat(O)];
|
|
3461
3461
|
if (b) {
|
|
3462
3462
|
var _ = e.table(O), A = b.optimisticOps.filter(function($) {
|
|
3463
3463
|
return $.trans === d;
|
|
3464
3464
|
});
|
|
3465
|
-
if (d._explicit && v && d.mutatedParts) for (var x = 0,
|
|
3465
|
+
if (d._explicit && v && d.mutatedParts) for (var x = 0, D = Object.values(b.queries.query); x < D.length; x++) for (var S = 0, P = (L = D[x]).slice(); S < P.length; S++) zn((K = P[S]).obsSet, d.mutatedParts) && (Xe(L, K), K.subscribers.forEach(function($) {
|
|
3466
3466
|
return w.add($);
|
|
3467
3467
|
}));
|
|
3468
3468
|
else if (0 < A.length) {
|
|
3469
3469
|
b.optimisticOps = b.optimisticOps.filter(function($) {
|
|
3470
3470
|
return $.trans !== d;
|
|
3471
3471
|
});
|
|
3472
|
-
for (var
|
|
3472
|
+
for (var k = 0, M = Object.values(b.queries.query); k < M.length; k++) for (var L, K, q, V = 0, U = (L = M[k]).slice(); V < U.length; V++) (K = U[V]).res != null && d.mutatedParts && (v && !K.dirty ? (q = Object.isFrozen(K.res), q = Gr(K.res, K.req, A, _, K, q), K.dirty ? (Xe(L, K), K.subscribers.forEach(function($) {
|
|
3473
3473
|
return w.add($);
|
|
3474
3474
|
})) : q !== K.res && (K.res = q, K.promise = G.resolve({ result: q }))) : (K.dirty && Xe(L, K), K.subscribers.forEach(function($) {
|
|
3475
3475
|
return w.add($);
|
|
@@ -3485,58 +3485,58 @@ function Ai() {
|
|
|
3485
3485
|
}, d.addEventListener("abort", a(!1), { signal: f }), d.addEventListener("error", a(!1), { signal: f }), d.addEventListener("complete", a(!0), { signal: f })), d;
|
|
3486
3486
|
}, table: function(n) {
|
|
3487
3487
|
var r = e.table(n), a = r.schema.primaryKey;
|
|
3488
|
-
return i(i({}, r), { mutate: function(
|
|
3488
|
+
return i(i({}, r), { mutate: function(s) {
|
|
3489
3489
|
var f = z.trans;
|
|
3490
|
-
if (a.outbound || f.db._options.cache === "disabled" || f.explicit || f.idbtrans.mode !== "readwrite") return r.mutate(
|
|
3490
|
+
if (a.outbound || f.db._options.cache === "disabled" || f.explicit || f.idbtrans.mode !== "readwrite") return r.mutate(s);
|
|
3491
3491
|
var d = gt["idb://".concat(t, "/").concat(n)];
|
|
3492
|
-
return d ? (f = r.mutate(
|
|
3492
|
+
return d ? (f = r.mutate(s), s.type !== "add" && s.type !== "put" || !(50 <= s.values.length || tr(a, s).some(function(v) {
|
|
3493
3493
|
return v == null;
|
|
3494
|
-
})) ? (d.optimisticOps.push(
|
|
3495
|
-
0 < v.numFailures && (Xe(d.optimisticOps,
|
|
3494
|
+
})) ? (d.optimisticOps.push(s), s.mutatedParts && vn(s.mutatedParts), f.then(function(v) {
|
|
3495
|
+
0 < v.numFailures && (Xe(d.optimisticOps, s), (v = Vr(0, s, v)) && d.optimisticOps.push(v), s.mutatedParts && vn(s.mutatedParts));
|
|
3496
3496
|
}), f.catch(function() {
|
|
3497
|
-
Xe(d.optimisticOps,
|
|
3497
|
+
Xe(d.optimisticOps, s), s.mutatedParts && vn(s.mutatedParts);
|
|
3498
3498
|
})) : f.then(function(v) {
|
|
3499
|
-
var w = Vr(0, i(i({},
|
|
3499
|
+
var w = Vr(0, i(i({}, s), { values: s.values.map(function(T, p) {
|
|
3500
3500
|
var O;
|
|
3501
|
-
return v.failures[p] ? T : (T = (O = a.keyPath) !== null && O !== void 0 && O.includes(".") ?
|
|
3501
|
+
return v.failures[p] ? T : (T = (O = a.keyPath) !== null && O !== void 0 && O.includes(".") ? ke(T) : i({}, T), ne(T, a.keyPath, v.results[p]), T);
|
|
3502
3502
|
}) }), v);
|
|
3503
3503
|
d.optimisticOps.push(w), queueMicrotask(function() {
|
|
3504
|
-
return
|
|
3504
|
+
return s.mutatedParts && vn(s.mutatedParts);
|
|
3505
3505
|
});
|
|
3506
|
-
}), f) : r.mutate(
|
|
3507
|
-
}, query: function(
|
|
3508
|
-
if (!Lr(z, r) || !Ur("query",
|
|
3509
|
-
var f = ((w = z.trans) === null || w === void 0 ? void 0 : w.db._options.cache) === "immutable", p = z, d = p.requery, v = p.signal, w = (function(_, A, x,
|
|
3506
|
+
}), f) : r.mutate(s);
|
|
3507
|
+
}, query: function(s) {
|
|
3508
|
+
if (!Lr(z, r) || !Ur("query", s)) return r.query(s);
|
|
3509
|
+
var f = ((w = z.trans) === null || w === void 0 ? void 0 : w.db._options.cache) === "immutable", p = z, d = p.requery, v = p.signal, w = (function(_, A, x, D) {
|
|
3510
3510
|
var S = gt["idb://".concat(_, "/").concat(A)];
|
|
3511
3511
|
if (!S) return [];
|
|
3512
3512
|
if (!(A = S.queries[x])) return [null, !1, S, null];
|
|
3513
|
-
var
|
|
3514
|
-
if (!
|
|
3513
|
+
var P = A[(D.query ? D.query.index.name : null) || ""];
|
|
3514
|
+
if (!P) return [null, !1, S, null];
|
|
3515
3515
|
switch (x) {
|
|
3516
3516
|
case "query":
|
|
3517
|
-
var
|
|
3518
|
-
return M.req.limit ===
|
|
3517
|
+
var k = P.find(function(M) {
|
|
3518
|
+
return M.req.limit === D.limit && M.req.values === D.values && $r(M.req.query.range, D.query.range);
|
|
3519
3519
|
});
|
|
3520
|
-
return
|
|
3521
|
-
return ("limit" in M.req ? M.req.limit : 1 / 0) >=
|
|
3522
|
-
}), !1, S,
|
|
3520
|
+
return k ? [k, !0, S, P] : [P.find(function(M) {
|
|
3521
|
+
return ("limit" in M.req ? M.req.limit : 1 / 0) >= D.limit && (!D.values || M.req.values) && Ga(M.req.query.range, D.query.range);
|
|
3522
|
+
}), !1, S, P];
|
|
3523
3523
|
case "count":
|
|
3524
|
-
return
|
|
3525
|
-
return $r(M.req.query.range,
|
|
3526
|
-
}), [
|
|
3524
|
+
return k = P.find(function(M) {
|
|
3525
|
+
return $r(M.req.query.range, D.query.range);
|
|
3526
|
+
}), [k, !!k, S, P];
|
|
3527
3527
|
}
|
|
3528
|
-
})(t, n, "query",
|
|
3529
|
-
return T && p ? T.obsSet =
|
|
3528
|
+
})(t, n, "query", s), T = w[0], p = w[1], O = w[2], b = w[3];
|
|
3529
|
+
return T && p ? T.obsSet = s.obsSet : (p = r.query(s).then(function(_) {
|
|
3530
3530
|
var A = _.result;
|
|
3531
3531
|
if (T && (T.res = A), f) {
|
|
3532
|
-
for (var x = 0,
|
|
3532
|
+
for (var x = 0, D = A.length; x < D; ++x) Object.freeze(A[x]);
|
|
3533
3533
|
Object.freeze(A);
|
|
3534
|
-
} else _.result =
|
|
3534
|
+
} else _.result = ke(A);
|
|
3535
3535
|
return _;
|
|
3536
3536
|
}).catch(function(_) {
|
|
3537
3537
|
return b && T && Xe(b, T), Promise.reject(_);
|
|
3538
|
-
}), T = { obsSet:
|
|
3539
|
-
return { result: Gr(_.result,
|
|
3538
|
+
}), T = { obsSet: s.obsSet, promise: p, subscribers: /* @__PURE__ */ new Set(), type: "query", req: s, dirty: !1 }, b ? b.push(T) : (b = [T], (O = O || (gt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[s.query.index.name || ""] = b)), $a(T, b, d, v), T.promise.then(function(_) {
|
|
3539
|
+
return { result: Gr(_.result, s, O?.optimisticOps, r, T, f) };
|
|
3540
3540
|
});
|
|
3541
3541
|
} });
|
|
3542
3542
|
} });
|
|
@@ -3547,8 +3547,8 @@ function Ai() {
|
|
|
3547
3547
|
} });
|
|
3548
3548
|
}
|
|
3549
3549
|
var Ye = (we.prototype.version = function(e) {
|
|
3550
|
-
if (isNaN(e) || e < 0.1) throw new
|
|
3551
|
-
if (e = Math.round(10 * e) / 10, this.idbdb || this._state.isBeingOpened) throw new
|
|
3550
|
+
if (isNaN(e) || e < 0.1) throw new C.Type("Given version is not a positive number");
|
|
3551
|
+
if (e = Math.round(10 * e) / 10, this.idbdb || this._state.isBeingOpened) throw new C.Schema("Cannot add version when database is open");
|
|
3552
3552
|
this.verno = Math.max(this.verno, e);
|
|
3553
3553
|
var t = this._versions, n = t.filter(function(r) {
|
|
3554
3554
|
return r._cfg.version === e;
|
|
@@ -3557,17 +3557,17 @@ function Ai() {
|
|
|
3557
3557
|
}, we.prototype._whenReady = function(e) {
|
|
3558
3558
|
var t = this;
|
|
3559
3559
|
return this.idbdb && (this._state.openComplete || z.letThrough || this._vip) ? e() : new G(function(n, r) {
|
|
3560
|
-
if (t._state.openComplete) return r(new
|
|
3560
|
+
if (t._state.openComplete) return r(new C.DatabaseClosed(t._state.dbOpenError));
|
|
3561
3561
|
if (!t._state.isBeingOpened) {
|
|
3562
|
-
if (!t._state.autoOpen) return void r(new
|
|
3562
|
+
if (!t._state.autoOpen) return void r(new C.DatabaseClosed());
|
|
3563
3563
|
t.open().catch(Q);
|
|
3564
3564
|
}
|
|
3565
3565
|
t._state.dbReadyPromise.then(n, r);
|
|
3566
3566
|
}).then(e);
|
|
3567
3567
|
}, we.prototype.use = function(e) {
|
|
3568
3568
|
var t = e.stack, n = e.create, r = e.level, a = e.name;
|
|
3569
|
-
return a && this.unuse({ stack: t, name: a }), e = this._middlewares[t] || (this._middlewares[t] = []), e.push({ stack: t, create: n, level: r ?? 10, name: a }), e.sort(function(
|
|
3570
|
-
return
|
|
3569
|
+
return a && this.unuse({ stack: t, name: a }), e = this._middlewares[t] || (this._middlewares[t] = []), e.push({ stack: t, create: n, level: r ?? 10, name: a }), e.sort(function(s, f) {
|
|
3570
|
+
return s.level - f.level;
|
|
3571
3571
|
}), this;
|
|
3572
3572
|
}, we.prototype.unuse = function(e) {
|
|
3573
3573
|
var t = e.stack, n = e.name, r = e.create;
|
|
@@ -3596,21 +3596,21 @@ function Ai() {
|
|
|
3596
3596
|
}));
|
|
3597
3597
|
}, we.prototype.close = function(n) {
|
|
3598
3598
|
var t = (n === void 0 ? { disableAutoOpen: !0 } : n).disableAutoOpen, n = this._state;
|
|
3599
|
-
t ? (n.isBeingOpened && n.cancelOpen(new
|
|
3599
|
+
t ? (n.isBeingOpened && n.cancelOpen(new C.DatabaseClosed()), this._close(), n.autoOpen = !1, n.dbOpenError = new C.DatabaseClosed()) : (this._close(), n.autoOpen = this._options.autoOpen || n.isBeingOpened, n.openComplete = !1, n.dbOpenError = null);
|
|
3600
3600
|
}, we.prototype.delete = function(e) {
|
|
3601
3601
|
var t = this;
|
|
3602
3602
|
e === void 0 && (e = { disableAutoOpen: !0 });
|
|
3603
3603
|
var n = 0 < arguments.length && typeof arguments[0] != "object", r = this._state;
|
|
3604
|
-
return new G(function(a,
|
|
3604
|
+
return new G(function(a, s) {
|
|
3605
3605
|
function f() {
|
|
3606
3606
|
t.close(e);
|
|
3607
3607
|
var d = t._deps.indexedDB.deleteDatabase(t.name);
|
|
3608
3608
|
d.onsuccess = ge(function() {
|
|
3609
3609
|
var v, w, T;
|
|
3610
3610
|
v = t._deps, w = t.name, T = v.indexedDB, v = v.IDBKeyRange, Xn(T) || w === an || $n(T, v).delete(w).catch(Q), a();
|
|
3611
|
-
}), d.onerror =
|
|
3611
|
+
}), d.onerror = Ve(s), d.onblocked = t._fireOnBlocked;
|
|
3612
3612
|
}
|
|
3613
|
-
if (n) throw new
|
|
3613
|
+
if (n) throw new C.InvalidArgument("Invalid closeOptions argument to db.delete()");
|
|
3614
3614
|
r.isBeingOpened ? r.dbReadyPromise.then(f) : f();
|
|
3615
3615
|
});
|
|
3616
3616
|
}, we.prototype.backendDB = function() {
|
|
@@ -3632,33 +3632,33 @@ function Ai() {
|
|
|
3632
3632
|
}, enumerable: !1, configurable: !0 }), we.prototype.transaction = function() {
|
|
3633
3633
|
var e = (function(t, n, r) {
|
|
3634
3634
|
var a = arguments.length;
|
|
3635
|
-
if (a < 2) throw new
|
|
3636
|
-
for (var
|
|
3637
|
-
return r =
|
|
3635
|
+
if (a < 2) throw new C.InvalidArgument("Too few arguments");
|
|
3636
|
+
for (var s = new Array(a - 1); --a; ) s[a - 1] = arguments[a];
|
|
3637
|
+
return r = s.pop(), [t, Dt(s), r];
|
|
3638
3638
|
}).apply(this, arguments);
|
|
3639
3639
|
return this._transaction.apply(this, e);
|
|
3640
3640
|
}, we.prototype._transaction = function(e, t, n) {
|
|
3641
3641
|
var r = this, a = z.trans;
|
|
3642
3642
|
a && a.db === this && e.indexOf("!") === -1 || (a = null);
|
|
3643
|
-
var
|
|
3643
|
+
var s, f, d = e.indexOf("?") !== -1;
|
|
3644
3644
|
e = e.replace("!", "").replace("?", "");
|
|
3645
3645
|
try {
|
|
3646
3646
|
if (f = t.map(function(w) {
|
|
3647
3647
|
if (w = w instanceof r.Table ? w.name : w, typeof w != "string") throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");
|
|
3648
3648
|
return w;
|
|
3649
|
-
}), e == "r" || e ===
|
|
3649
|
+
}), e == "r" || e === kn) s = kn;
|
|
3650
3650
|
else {
|
|
3651
|
-
if (e != "rw" && e != Fn) throw new
|
|
3652
|
-
|
|
3651
|
+
if (e != "rw" && e != Fn) throw new C.InvalidArgument("Invalid transaction mode: " + e);
|
|
3652
|
+
s = Fn;
|
|
3653
3653
|
}
|
|
3654
3654
|
if (a) {
|
|
3655
|
-
if (a.mode ===
|
|
3656
|
-
if (!d) throw new
|
|
3655
|
+
if (a.mode === kn && s === Fn) {
|
|
3656
|
+
if (!d) throw new C.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
|
|
3657
3657
|
a = null;
|
|
3658
3658
|
}
|
|
3659
3659
|
a && f.forEach(function(w) {
|
|
3660
3660
|
if (a && a.storeNames.indexOf(w) === -1) {
|
|
3661
|
-
if (!d) throw new
|
|
3661
|
+
if (!d) throw new C.SubTransaction("Table " + w + " not included in parent transaction.");
|
|
3662
3662
|
a = null;
|
|
3663
3663
|
}
|
|
3664
3664
|
}), d && a && !a.active && (a = null);
|
|
@@ -3674,33 +3674,33 @@ function Ai() {
|
|
|
3674
3674
|
if (x.explicit = !0, A = { trans: x, transless: A }, b) x.idbtrans = b.idbtrans;
|
|
3675
3675
|
else try {
|
|
3676
3676
|
x.create(), x.idbtrans._explicit = !0, T._state.PR1398_maxLoop = 3;
|
|
3677
|
-
} catch (
|
|
3678
|
-
return
|
|
3677
|
+
} catch (P) {
|
|
3678
|
+
return P.name === l.InvalidState && T.isOpen() && 0 < --T._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), T.close({ disableAutoOpen: !1 }), T.open().then(function() {
|
|
3679
3679
|
return w(T, p, O, null, _);
|
|
3680
|
-
})) : be(
|
|
3680
|
+
})) : be(P);
|
|
3681
3681
|
}
|
|
3682
|
-
var
|
|
3682
|
+
var D, S = qe(_);
|
|
3683
3683
|
return S && Et(), A = G.follow(function() {
|
|
3684
|
-
var
|
|
3685
|
-
(
|
|
3686
|
-
}, A), (
|
|
3687
|
-
return x.active ?
|
|
3684
|
+
var P;
|
|
3685
|
+
(D = _.call(x, x)) && (S ? (P = at.bind(null, null), D.then(P, P)) : typeof D.next == "function" && typeof D.throw == "function" && (D = Jn(D)));
|
|
3686
|
+
}, A), (D && typeof D.then == "function" ? G.resolve(D).then(function(P) {
|
|
3687
|
+
return x.active ? P : be(new C.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
|
|
3688
3688
|
}) : A.then(function() {
|
|
3689
|
-
return
|
|
3690
|
-
})).then(function(
|
|
3689
|
+
return D;
|
|
3690
|
+
})).then(function(P) {
|
|
3691
3691
|
return b && x._resolve(), x._completion.then(function() {
|
|
3692
|
-
return
|
|
3692
|
+
return P;
|
|
3693
3693
|
});
|
|
3694
|
-
}).catch(function(
|
|
3695
|
-
return x._reject(
|
|
3694
|
+
}).catch(function(P) {
|
|
3695
|
+
return x._reject(P), be(P);
|
|
3696
3696
|
});
|
|
3697
3697
|
});
|
|
3698
|
-
}).bind(null, this,
|
|
3699
|
-
return a ? a._promise(
|
|
3698
|
+
}).bind(null, this, s, f, a, n);
|
|
3699
|
+
return a ? a._promise(s, v, "lock") : z.trans ? ht(z.transless, function() {
|
|
3700
3700
|
return r._whenReady(v);
|
|
3701
3701
|
}) : this._whenReady(v);
|
|
3702
3702
|
}, we.prototype.table = function(e) {
|
|
3703
|
-
if (!W(this._allTables, e)) throw new
|
|
3703
|
+
if (!W(this._allTables, e)) throw new C.InvalidTable("Table ".concat(e, " does not exist"));
|
|
3704
3704
|
return this._allTables[e];
|
|
3705
3705
|
}, we);
|
|
3706
3706
|
function we(e, t) {
|
|
@@ -3708,7 +3708,7 @@ function Ai() {
|
|
|
3708
3708
|
this._middlewares = {}, this.verno = 0;
|
|
3709
3709
|
var r = we.dependencies;
|
|
3710
3710
|
this._options = t = i({ addons: we.addons, autoOpen: !0, indexedDB: r.indexedDB, IDBKeyRange: r.IDBKeyRange, cache: "cloned" }, t), this._deps = { indexedDB: t.indexedDB, IDBKeyRange: t.IDBKeyRange }, r = t.addons, this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
|
|
3711
|
-
var a,
|
|
3711
|
+
var a, s, f, d, v, w = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: Q, dbReadyPromise: null, cancelOpen: Q, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3, autoOpen: t.autoOpen };
|
|
3712
3712
|
w.dbReadyPromise = new G(function(p) {
|
|
3713
3713
|
w.dbReadyResolve = p;
|
|
3714
3714
|
}), w.openCanceller = new G(function(p, O) {
|
|
@@ -3728,7 +3728,7 @@ function Ai() {
|
|
|
3728
3728
|
}));
|
|
3729
3729
|
});
|
|
3730
3730
|
};
|
|
3731
|
-
}), this.Collection = (a = this, jt(Ca.prototype, function(
|
|
3731
|
+
}), this.Collection = (a = this, jt(Ca.prototype, function(D, x) {
|
|
3732
3732
|
this.db = a;
|
|
3733
3733
|
var b = _r, _ = null;
|
|
3734
3734
|
if (x) try {
|
|
@@ -3736,23 +3736,23 @@ function Ai() {
|
|
|
3736
3736
|
} catch (S) {
|
|
3737
3737
|
_ = S;
|
|
3738
3738
|
}
|
|
3739
|
-
var A =
|
|
3740
|
-
this._ctx = { table: x, index: A.index, isPrimKey: !A.index || x.schema.primKey.keyPath && A.index === x.schema.primKey.name, range: b, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: _, or: A.or, valueMapper:
|
|
3741
|
-
})), this.Table = (
|
|
3742
|
-
this.db =
|
|
3739
|
+
var A = D._ctx, x = A.table, D = x.hook.reading.fire;
|
|
3740
|
+
this._ctx = { table: x, index: A.index, isPrimKey: !A.index || x.schema.primKey.keyPath && A.index === x.schema.primKey.name, range: b, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: _, or: A.or, valueMapper: D !== he ? D : null };
|
|
3741
|
+
})), this.Table = (s = this, jt(Nr.prototype, function(p, O, b) {
|
|
3742
|
+
this.db = s, this._tx = b, this.name = p, this.schema = O, this.hook = s._allTables[p] ? s._allTables[p].hook : Mt(null, { creating: [tt, Q], reading: [Ae, he], updating: [Le, Q], deleting: [_e, Q] });
|
|
3743
3743
|
})), this.Transaction = (f = this, jt(Sa.prototype, function(p, O, b, _, A) {
|
|
3744
3744
|
var x = this;
|
|
3745
|
-
p !== "readonly" && O.forEach(function(
|
|
3746
|
-
|
|
3745
|
+
p !== "readonly" && O.forEach(function(D) {
|
|
3746
|
+
D = (D = b[D]) === null || D === void 0 ? void 0 : D.yProps, D && (O = O.concat(D.map(function(S) {
|
|
3747
3747
|
return S.updatesTable;
|
|
3748
3748
|
})));
|
|
3749
|
-
}), this.db = f, this.mode = p, this.storeNames = O, this.schema = b, this.chromeTransactionDurability = _, this.idbtrans = null, this.on = Mt(this, "complete", "error", "abort"), this.parent = A || 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 G(function(
|
|
3750
|
-
x._resolve =
|
|
3749
|
+
}), this.db = f, this.mode = p, this.storeNames = O, this.schema = b, this.chromeTransactionDurability = _, this.idbtrans = null, this.on = Mt(this, "complete", "error", "abort"), this.parent = A || 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 G(function(D, S) {
|
|
3750
|
+
x._resolve = D, x._reject = S;
|
|
3751
3751
|
}), this._completion.then(function() {
|
|
3752
3752
|
x.active = !1, x.on.complete.fire();
|
|
3753
|
-
}, function(
|
|
3753
|
+
}, function(D) {
|
|
3754
3754
|
var S = x.active;
|
|
3755
|
-
return x.active = !1, x.on.error.fire(
|
|
3755
|
+
return x.active = !1, x.on.error.fire(D), x.parent ? x.parent._reject(D) : S && x.idbtrans && x.idbtrans.abort(), be(D);
|
|
3756
3756
|
});
|
|
3757
3757
|
})), this.Version = (d = this, jt(ja.prototype, function(p) {
|
|
3758
3758
|
this.db = d, this._cfg = { version: p, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
|
|
@@ -3763,7 +3763,7 @@ function Ai() {
|
|
|
3763
3763
|
return 0 < re(_, A) ? _ : A;
|
|
3764
3764
|
}, this._min = function(_, A) {
|
|
3765
3765
|
return re(_, A) < 0 ? _ : A;
|
|
3766
|
-
}, this._IDBKeyRange = v._deps.IDBKeyRange, !this._IDBKeyRange) throw new
|
|
3766
|
+
}, this._IDBKeyRange = v._deps.IDBKeyRange, !this._IDBKeyRange) throw new C.MissingAPI();
|
|
3767
3767
|
})), this.on("versionchange", function(p) {
|
|
3768
3768
|
0 < p.newVersion ? console.warn("Another connection wants to upgrade database '".concat(n.name, "'. Closing db now to resume the upgrade.")) : console.warn("Another connection wants to delete database '".concat(n.name, "'. Closing db now to resume the delete request.")), n.close({ disableAutoOpen: !1 });
|
|
3769
3769
|
}), this.on("blocked", function(p) {
|
|
@@ -3808,36 +3808,36 @@ function Ai() {
|
|
|
3808
3808
|
}
|
|
3809
3809
|
function Xr(e) {
|
|
3810
3810
|
var t, n = !1, r = new Wa(function(a) {
|
|
3811
|
-
var
|
|
3811
|
+
var s = qe(e), f, d = !1, v = {}, w = {}, T = { get closed() {
|
|
3812
3812
|
return d;
|
|
3813
3813
|
}, unsubscribe: function() {
|
|
3814
3814
|
d || (d = !0, f && f.abort(), p && st.storagemutated.unsubscribe(b));
|
|
3815
3815
|
} };
|
|
3816
3816
|
a.start && a.start(T);
|
|
3817
3817
|
var p = !1, O = function() {
|
|
3818
|
-
return
|
|
3818
|
+
return Pn(_);
|
|
3819
3819
|
}, b = function(A) {
|
|
3820
3820
|
yn(v, A), zn(w, v) && O();
|
|
3821
3821
|
}, _ = function() {
|
|
3822
|
-
var A, x,
|
|
3823
|
-
!d && _n.indexedDB && (v = {}, A = {}, f && f.abort(), f = new AbortController(),
|
|
3824
|
-
var
|
|
3822
|
+
var A, x, D;
|
|
3823
|
+
!d && _n.indexedDB && (v = {}, A = {}, f && f.abort(), f = new AbortController(), D = (function(S) {
|
|
3824
|
+
var P = _t();
|
|
3825
3825
|
try {
|
|
3826
|
-
|
|
3827
|
-
var
|
|
3828
|
-
return
|
|
3826
|
+
s && Et();
|
|
3827
|
+
var k = rt(e, S);
|
|
3828
|
+
return k = s ? k.finally(at) : k;
|
|
3829
3829
|
} finally {
|
|
3830
|
-
|
|
3830
|
+
P && Tt();
|
|
3831
3831
|
}
|
|
3832
|
-
})(x = { subscr: A, signal: f.signal, requery: O, querier: e, trans: null }), Promise.resolve(
|
|
3833
|
-
n = !0, t = S, d || x.signal.aborted || (v = {}, (function(
|
|
3834
|
-
for (var
|
|
3832
|
+
})(x = { subscr: A, signal: f.signal, requery: O, querier: e, trans: null }), Promise.resolve(D).then(function(S) {
|
|
3833
|
+
n = !0, t = S, d || x.signal.aborted || (v = {}, (function(P) {
|
|
3834
|
+
for (var k in P) if (W(P, k)) return;
|
|
3835
3835
|
return 1;
|
|
3836
|
-
})(w = A) || p || (st(Lt, b), p = !0),
|
|
3836
|
+
})(w = A) || p || (st(Lt, b), p = !0), Pn(function() {
|
|
3837
3837
|
return !d && a.next && a.next(S);
|
|
3838
3838
|
}));
|
|
3839
3839
|
}, function(S) {
|
|
3840
|
-
n = !1, ["DatabaseClosedError", "AbortError"].includes(S?.name) || d ||
|
|
3840
|
+
n = !1, ["DatabaseClosedError", "AbortError"].includes(S?.name) || d || Pn(function() {
|
|
3841
3841
|
d || a.error && a.error(S);
|
|
3842
3842
|
});
|
|
3843
3843
|
}));
|
|
@@ -3877,7 +3877,7 @@ function Ai() {
|
|
|
3877
3877
|
});
|
|
3878
3878
|
}) : $n(n, t).toCollection().primaryKeys()).then(e);
|
|
3879
3879
|
} catch {
|
|
3880
|
-
return be(new
|
|
3880
|
+
return be(new C.MissingAPI());
|
|
3881
3881
|
}
|
|
3882
3882
|
var t, n;
|
|
3883
3883
|
}, defineClass: function() {
|
|
@@ -3907,14 +3907,14 @@ function Ai() {
|
|
|
3907
3907
|
} }, waitFor: function(e, t) {
|
|
3908
3908
|
return t = G.resolve(typeof e == "function" ? yt.ignoreTransaction(e) : e).timeout(t || 6e4), z.trans ? z.trans.waitFor(t) : t;
|
|
3909
3909
|
}, Promise: G, debug: { get: function() {
|
|
3910
|
-
return
|
|
3910
|
+
return Pe;
|
|
3911
3911
|
}, set: function(e) {
|
|
3912
3912
|
Rt(e);
|
|
3913
3913
|
} }, derive: F, extend: R, props: J, override: ee, Events: Mt, on: st, liveQuery: Xr, extendObservabilitySet: yn, getByKeyPath: pe, setByKeyPath: ne, delByKeyPath: function(e, t) {
|
|
3914
3914
|
typeof t == "string" ? ne(e, t, void 0) : "length" in t && [].map.call(t, function(n) {
|
|
3915
3915
|
ne(e, n, void 0);
|
|
3916
3916
|
});
|
|
3917
|
-
}, shallowClone:
|
|
3917
|
+
}, shallowClone: Ie, deepClone: ke, getObjectDiff: er, cmp: re, asap: ae, minKey: -1 / 0, addons: [], connections: xt, errnames: l, dependencies: _n, cache: gt, semVer: "4.2.0", version: "4.2.0".split(".").map(function(e) {
|
|
3918
3918
|
return parseInt(e);
|
|
3919
3919
|
}).reduce(function(e, t, n) {
|
|
3920
3920
|
return e + t / Math.pow(10, 2 * n);
|
|
@@ -3933,16 +3933,16 @@ function Ai() {
|
|
|
3933
3933
|
ut || Ct.postMessage(e);
|
|
3934
3934
|
})), typeof addEventListener < "u" && (addEventListener("pagehide", function(e) {
|
|
3935
3935
|
if (!Ye.disableBfCache && e.persisted) {
|
|
3936
|
-
|
|
3936
|
+
Pe && console.debug("Dexie: handling persisted pagehide"), Ct?.close();
|
|
3937
3937
|
for (var t = 0, n = xt; t < n.length; t++) n[t].close({ disableAutoOpen: !1 });
|
|
3938
3938
|
}
|
|
3939
3939
|
}), addEventListener("pageshow", function(e) {
|
|
3940
|
-
!Ye.disableBfCache && e.persisted && (
|
|
3940
|
+
!Ye.disableBfCache && e.persisted && (Pe && console.debug("Dexie: handling persisted pageshow"), Wr(), ar({ all: new Oe(-1 / 0, [[]]) }));
|
|
3941
3941
|
})), G.rejectionMapper = function(e, t) {
|
|
3942
3942
|
return !e || e instanceof Ze || e instanceof TypeError || e instanceof SyntaxError || !e.name || !E[e.name] ? e : (t = new E[e.name](t || e.message, e), "stack" in e && B(t, "stack", { get: function() {
|
|
3943
3943
|
return this.inner.stack;
|
|
3944
3944
|
} }), t);
|
|
3945
|
-
}, Rt(
|
|
3945
|
+
}, Rt(Pe), i(Ye, Object.freeze({ __proto__: null, Dexie: Ye, liveQuery: Xr, Entity: Tr, cmp: re, PropModification: Kt, replacePrefix: function(e, t) {
|
|
3946
3946
|
return new Kt({ replacePrefix: [e, t] });
|
|
3947
3947
|
}, add: function(e) {
|
|
3948
3948
|
return new Kt({ add: e });
|
|
@@ -4126,7 +4126,7 @@ class Ci {
|
|
|
4126
4126
|
this.databaseInstance.isOpen() && (this.databaseInstance.close(), await new Promise((u) => setTimeout(u, 20))), await Qe.delete(this.databaseInstance.name);
|
|
4127
4127
|
}
|
|
4128
4128
|
}
|
|
4129
|
-
function
|
|
4129
|
+
function Di(g) {
|
|
4130
4130
|
const { databaseName: u, dialecteConfig: c } = g, { xmlElements: i, additionalTables: h } = c.database.tables, m = new Qe(u), y = {
|
|
4131
4131
|
[i.name]: i.schema
|
|
4132
4132
|
};
|
|
@@ -4139,7 +4139,7 @@ async function ga(g) {
|
|
|
4139
4139
|
const { databaseInstance: u, elementsTableName: c, records: i } = g, h = u.table(c);
|
|
4140
4140
|
await u.transaction("rw", h, () => h.bulkAdd(i));
|
|
4141
4141
|
}
|
|
4142
|
-
async function
|
|
4142
|
+
async function Ii(g) {
|
|
4143
4143
|
const { databaseInstance: u, elementsTableName: c, updates: i } = g;
|
|
4144
4144
|
if (i.length === 0) return;
|
|
4145
4145
|
const h = u.table(c);
|
|
@@ -4168,7 +4168,7 @@ async function Di(g) {
|
|
|
4168
4168
|
}
|
|
4169
4169
|
});
|
|
4170
4170
|
}
|
|
4171
|
-
async function
|
|
4171
|
+
async function Do(g) {
|
|
4172
4172
|
const { databaseInstance: u, elementsTableName: c, updates: i } = g;
|
|
4173
4173
|
if (i.length === 0) return;
|
|
4174
4174
|
const h = u.table(c);
|
|
@@ -4191,7 +4191,7 @@ async function Si(g) {
|
|
|
4191
4191
|
const h = u.table(c);
|
|
4192
4192
|
await u.transaction("rw", h, () => h.bulkDelete(i));
|
|
4193
4193
|
}
|
|
4194
|
-
async function
|
|
4194
|
+
async function Io(g) {
|
|
4195
4195
|
if (await Qe.exists(g))
|
|
4196
4196
|
return await Qe.delete(g);
|
|
4197
4197
|
}
|
|
@@ -4199,7 +4199,7 @@ function Ri(g) {
|
|
|
4199
4199
|
return "prefix" in g && "uri" in g && !!g.prefix && !!g.uri;
|
|
4200
4200
|
}
|
|
4201
4201
|
const Yt = {};
|
|
4202
|
-
function
|
|
4202
|
+
function Pi(g) {
|
|
4203
4203
|
const { parentId: u, child: c } = g;
|
|
4204
4204
|
Yt[u] || (Yt[u] = []);
|
|
4205
4205
|
const i = {
|
|
@@ -4208,7 +4208,7 @@ function ki(g) {
|
|
|
4208
4208
|
};
|
|
4209
4209
|
Yt[u].push(i);
|
|
4210
4210
|
}
|
|
4211
|
-
function
|
|
4211
|
+
function ki(g) {
|
|
4212
4212
|
const { currentBatch: u } = g, c = [...u];
|
|
4213
4213
|
for (const [i, h] of c.entries()) {
|
|
4214
4214
|
const m = Yt[h.id] || [];
|
|
@@ -4231,8 +4231,8 @@ var Jr;
|
|
|
4231
4231
|
function Ki() {
|
|
4232
4232
|
return Jr || (Jr = 1, (function(g) {
|
|
4233
4233
|
(function(u) {
|
|
4234
|
-
u.parser = function(l,
|
|
4235
|
-
return new i(l,
|
|
4234
|
+
u.parser = function(l, o) {
|
|
4235
|
+
return new i(l, o);
|
|
4236
4236
|
}, u.SAXParser = i, u.SAXStream = X, u.createStream = j, u.MAX_BUFFER_LENGTH = 64 * 1024;
|
|
4237
4237
|
var c = [
|
|
4238
4238
|
"comment",
|
|
@@ -4268,30 +4268,30 @@ function Ki() {
|
|
|
4268
4268
|
"opennamespace",
|
|
4269
4269
|
"closenamespace"
|
|
4270
4270
|
];
|
|
4271
|
-
function i(l,
|
|
4271
|
+
function i(l, o) {
|
|
4272
4272
|
if (!(this instanceof i))
|
|
4273
|
-
return new i(l,
|
|
4274
|
-
var
|
|
4275
|
-
m(
|
|
4273
|
+
return new i(l, o);
|
|
4274
|
+
var C = this;
|
|
4275
|
+
m(C), C.q = C.c = "", C.bufferCheckPosition = u.MAX_BUFFER_LENGTH, C.opt = o || {}, C.opt.lowercase = C.opt.lowercase || C.opt.lowercasetags, C.looseCase = C.opt.lowercase ? "toLowerCase" : "toUpperCase", C.opt.maxEntityCount = C.opt.maxEntityCount || 512, C.opt.maxEntityDepth = C.opt.maxEntityDepth || 4, C.entityCount = C.entityDepth = 0, C.tags = [], C.closed = C.closedRoot = C.sawRoot = !1, C.tag = C.error = null, C.strict = !!l, C.noscript = !!(l || C.opt.noscript), C.state = I.BEGIN, C.strictEntities = C.opt.strictEntities, C.ENTITIES = C.strictEntities ? Object.create(u.XML_ENTITIES) : Object.create(u.ENTITIES), C.attribList = [], C.opt.xmlns && (C.ns = Object.create(F)), C.opt.unquotedAttributeValues === void 0 && (C.opt.unquotedAttributeValues = !l), C.trackPosition = C.opt.position !== !1, C.trackPosition && (C.position = C.line = C.column = 0), He(C, "onready");
|
|
4276
4276
|
}
|
|
4277
4277
|
Object.create || (Object.create = function(l) {
|
|
4278
|
-
function
|
|
4278
|
+
function o() {
|
|
4279
4279
|
}
|
|
4280
|
-
|
|
4281
|
-
var
|
|
4282
|
-
return
|
|
4280
|
+
o.prototype = l;
|
|
4281
|
+
var C = new o();
|
|
4282
|
+
return C;
|
|
4283
4283
|
}), Object.keys || (Object.keys = function(l) {
|
|
4284
|
-
var
|
|
4285
|
-
for (var
|
|
4286
|
-
return
|
|
4284
|
+
var o = [];
|
|
4285
|
+
for (var C in l) l.hasOwnProperty(C) && o.push(C);
|
|
4286
|
+
return o;
|
|
4287
4287
|
});
|
|
4288
4288
|
function h(l) {
|
|
4289
|
-
for (var
|
|
4289
|
+
for (var o = Math.max(u.MAX_BUFFER_LENGTH, 10), C = 0, E = 0, ie = c.length; E < ie; E++) {
|
|
4290
4290
|
var Q = l[c[E]].length;
|
|
4291
|
-
if (Q >
|
|
4291
|
+
if (Q > o)
|
|
4292
4292
|
switch (c[E]) {
|
|
4293
4293
|
case "textNode":
|
|
4294
|
-
|
|
4294
|
+
ke(l);
|
|
4295
4295
|
break;
|
|
4296
4296
|
case "cdata":
|
|
4297
4297
|
de(l, "oncdata", l.cdata), l.cdata = "";
|
|
@@ -4300,19 +4300,19 @@ function Ki() {
|
|
|
4300
4300
|
de(l, "onscript", l.script), l.script = "";
|
|
4301
4301
|
break;
|
|
4302
4302
|
default:
|
|
4303
|
-
|
|
4303
|
+
Ke(l, "Max buffer length exceeded: " + c[E]);
|
|
4304
4304
|
}
|
|
4305
|
-
|
|
4305
|
+
C = Math.max(C, Q);
|
|
4306
4306
|
}
|
|
4307
|
-
var he = u.MAX_BUFFER_LENGTH -
|
|
4307
|
+
var he = u.MAX_BUFFER_LENGTH - C;
|
|
4308
4308
|
l.bufferCheckPosition = he + l.position;
|
|
4309
4309
|
}
|
|
4310
4310
|
function m(l) {
|
|
4311
|
-
for (var
|
|
4312
|
-
l[c[
|
|
4311
|
+
for (var o = 0, C = c.length; o < C; o++)
|
|
4312
|
+
l[c[o]] = "";
|
|
4313
4313
|
}
|
|
4314
4314
|
function y(l) {
|
|
4315
|
-
|
|
4315
|
+
ke(l), l.cdata !== "" && (de(l, "oncdata", l.cdata), l.cdata = ""), l.script !== "" && (de(l, "onscript", l.script), l.script = "");
|
|
4316
4316
|
}
|
|
4317
4317
|
i.prototype = {
|
|
4318
4318
|
end: function() {
|
|
@@ -4341,27 +4341,27 @@ function Ki() {
|
|
|
4341
4341
|
var R = u.EVENTS.filter(function(l) {
|
|
4342
4342
|
return l !== "error" && l !== "end";
|
|
4343
4343
|
});
|
|
4344
|
-
function j(l,
|
|
4345
|
-
return new X(l,
|
|
4344
|
+
function j(l, o) {
|
|
4345
|
+
return new X(l, o);
|
|
4346
4346
|
}
|
|
4347
|
-
function X(l,
|
|
4347
|
+
function X(l, o) {
|
|
4348
4348
|
if (!(this instanceof X))
|
|
4349
|
-
return new X(l,
|
|
4350
|
-
N.apply(this), this._parser = new i(l,
|
|
4351
|
-
var
|
|
4349
|
+
return new X(l, o);
|
|
4350
|
+
N.apply(this), this._parser = new i(l, o), this.writable = !0, this.readable = !0;
|
|
4351
|
+
var C = this;
|
|
4352
4352
|
this._parser.onend = function() {
|
|
4353
|
-
|
|
4353
|
+
C.emit("end");
|
|
4354
4354
|
}, this._parser.onerror = function(E) {
|
|
4355
|
-
|
|
4355
|
+
C.emit("error", E), C._parser.error = null;
|
|
4356
4356
|
}, this._decoder = null, R.forEach(function(E) {
|
|
4357
|
-
Object.defineProperty(
|
|
4357
|
+
Object.defineProperty(C, "on" + E, {
|
|
4358
4358
|
get: function() {
|
|
4359
|
-
return
|
|
4359
|
+
return C._parser["on" + E];
|
|
4360
4360
|
},
|
|
4361
4361
|
set: function(ie) {
|
|
4362
4362
|
if (!ie)
|
|
4363
|
-
return
|
|
4364
|
-
|
|
4363
|
+
return C.removeAllListeners(E), C._parser["on" + E] = ie, ie;
|
|
4364
|
+
C.on(E, ie);
|
|
4365
4365
|
},
|
|
4366
4366
|
enumerable: !0,
|
|
4367
4367
|
configurable: !1
|
|
@@ -4376,16 +4376,16 @@ function Ki() {
|
|
|
4376
4376
|
return typeof Buffer == "function" && typeof Buffer.isBuffer == "function" && Buffer.isBuffer(l) && (this._decoder || (this._decoder = new TextDecoder("utf8")), l = this._decoder.decode(l, { stream: !0 })), this._parser.write(l.toString()), this.emit("data", l), !0;
|
|
4377
4377
|
}, X.prototype.end = function(l) {
|
|
4378
4378
|
if (l && l.length && this.write(l), this._decoder) {
|
|
4379
|
-
var
|
|
4380
|
-
|
|
4379
|
+
var o = this._decoder.decode();
|
|
4380
|
+
o && (this._parser.write(o), this.emit("data", o));
|
|
4381
4381
|
}
|
|
4382
4382
|
return this._parser.end(), !0;
|
|
4383
|
-
}, X.prototype.on = function(l,
|
|
4384
|
-
var
|
|
4385
|
-
return !
|
|
4383
|
+
}, X.prototype.on = function(l, o) {
|
|
4384
|
+
var C = this;
|
|
4385
|
+
return !C._parser["on" + l] && R.indexOf(l) !== -1 && (C._parser["on" + l] = function() {
|
|
4386
4386
|
var E = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments);
|
|
4387
|
-
E.splice(0, 0, l),
|
|
4388
|
-
}), N.prototype.on.call(
|
|
4387
|
+
E.splice(0, 0, l), C.emit.apply(C, E);
|
|
4388
|
+
}), N.prototype.on.call(C, l, o);
|
|
4389
4389
|
};
|
|
4390
4390
|
var W = "[CDATA[", J = "DOCTYPE", fe = "http://www.w3.org/XML/1998/namespace", B = "http://www.w3.org/2000/xmlns/", F = { xml: fe, xmlns: B }, se = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, ce = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/, Te = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, ee = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
|
|
4391
4391
|
function Y(l) {
|
|
@@ -4398,85 +4398,85 @@ function Ki() {
|
|
|
4398
4398
|
function pe(l) {
|
|
4399
4399
|
return l === ">" || Y(l);
|
|
4400
4400
|
}
|
|
4401
|
-
function ne(l,
|
|
4402
|
-
return l.test(
|
|
4401
|
+
function ne(l, o) {
|
|
4402
|
+
return l.test(o);
|
|
4403
4403
|
}
|
|
4404
|
-
function
|
|
4405
|
-
return !ne(l,
|
|
4404
|
+
function Ie(l, o) {
|
|
4405
|
+
return !ne(l, o);
|
|
4406
4406
|
}
|
|
4407
|
-
var
|
|
4407
|
+
var I = 0;
|
|
4408
4408
|
u.STATE = {
|
|
4409
|
-
BEGIN:
|
|
4409
|
+
BEGIN: I++,
|
|
4410
4410
|
// leading byte order mark or whitespace
|
|
4411
|
-
BEGIN_WHITESPACE:
|
|
4411
|
+
BEGIN_WHITESPACE: I++,
|
|
4412
4412
|
// leading whitespace
|
|
4413
|
-
TEXT:
|
|
4413
|
+
TEXT: I++,
|
|
4414
4414
|
// general stuff
|
|
4415
|
-
TEXT_ENTITY:
|
|
4415
|
+
TEXT_ENTITY: I++,
|
|
4416
4416
|
// & and such.
|
|
4417
|
-
OPEN_WAKA:
|
|
4417
|
+
OPEN_WAKA: I++,
|
|
4418
4418
|
// <
|
|
4419
|
-
SGML_DECL:
|
|
4419
|
+
SGML_DECL: I++,
|
|
4420
4420
|
// <!BLARG
|
|
4421
|
-
SGML_DECL_QUOTED:
|
|
4421
|
+
SGML_DECL_QUOTED: I++,
|
|
4422
4422
|
// <!BLARG foo "bar
|
|
4423
|
-
DOCTYPE:
|
|
4423
|
+
DOCTYPE: I++,
|
|
4424
4424
|
// <!DOCTYPE
|
|
4425
|
-
DOCTYPE_QUOTED:
|
|
4425
|
+
DOCTYPE_QUOTED: I++,
|
|
4426
4426
|
// <!DOCTYPE "//blah
|
|
4427
|
-
DOCTYPE_DTD:
|
|
4427
|
+
DOCTYPE_DTD: I++,
|
|
4428
4428
|
// <!DOCTYPE "//blah" [ ...
|
|
4429
|
-
DOCTYPE_DTD_QUOTED:
|
|
4429
|
+
DOCTYPE_DTD_QUOTED: I++,
|
|
4430
4430
|
// <!DOCTYPE "//blah" [ "foo
|
|
4431
|
-
COMMENT_STARTING:
|
|
4431
|
+
COMMENT_STARTING: I++,
|
|
4432
4432
|
// <!-
|
|
4433
|
-
COMMENT:
|
|
4433
|
+
COMMENT: I++,
|
|
4434
4434
|
// <!--
|
|
4435
|
-
COMMENT_ENDING:
|
|
4435
|
+
COMMENT_ENDING: I++,
|
|
4436
4436
|
// <!-- blah -
|
|
4437
|
-
COMMENT_ENDED:
|
|
4437
|
+
COMMENT_ENDED: I++,
|
|
4438
4438
|
// <!-- blah --
|
|
4439
|
-
CDATA:
|
|
4439
|
+
CDATA: I++,
|
|
4440
4440
|
// <![CDATA[ something
|
|
4441
|
-
CDATA_ENDING:
|
|
4441
|
+
CDATA_ENDING: I++,
|
|
4442
4442
|
// ]
|
|
4443
|
-
CDATA_ENDING_2:
|
|
4443
|
+
CDATA_ENDING_2: I++,
|
|
4444
4444
|
// ]]
|
|
4445
|
-
PROC_INST:
|
|
4445
|
+
PROC_INST: I++,
|
|
4446
4446
|
// <?hi
|
|
4447
|
-
PROC_INST_BODY:
|
|
4447
|
+
PROC_INST_BODY: I++,
|
|
4448
4448
|
// <?hi there
|
|
4449
|
-
PROC_INST_ENDING:
|
|
4449
|
+
PROC_INST_ENDING: I++,
|
|
4450
4450
|
// <?hi "there" ?
|
|
4451
|
-
OPEN_TAG:
|
|
4451
|
+
OPEN_TAG: I++,
|
|
4452
4452
|
// <strong
|
|
4453
|
-
OPEN_TAG_SLASH:
|
|
4453
|
+
OPEN_TAG_SLASH: I++,
|
|
4454
4454
|
// <strong /
|
|
4455
|
-
ATTRIB:
|
|
4455
|
+
ATTRIB: I++,
|
|
4456
4456
|
// <a
|
|
4457
|
-
ATTRIB_NAME:
|
|
4457
|
+
ATTRIB_NAME: I++,
|
|
4458
4458
|
// <a foo
|
|
4459
|
-
ATTRIB_NAME_SAW_WHITE:
|
|
4459
|
+
ATTRIB_NAME_SAW_WHITE: I++,
|
|
4460
4460
|
// <a foo _
|
|
4461
|
-
ATTRIB_VALUE:
|
|
4461
|
+
ATTRIB_VALUE: I++,
|
|
4462
4462
|
// <a foo=
|
|
4463
|
-
ATTRIB_VALUE_QUOTED:
|
|
4463
|
+
ATTRIB_VALUE_QUOTED: I++,
|
|
4464
4464
|
// <a foo="bar
|
|
4465
|
-
ATTRIB_VALUE_CLOSED:
|
|
4465
|
+
ATTRIB_VALUE_CLOSED: I++,
|
|
4466
4466
|
// <a foo="bar"
|
|
4467
|
-
ATTRIB_VALUE_UNQUOTED:
|
|
4467
|
+
ATTRIB_VALUE_UNQUOTED: I++,
|
|
4468
4468
|
// <a foo=bar
|
|
4469
|
-
ATTRIB_VALUE_ENTITY_Q:
|
|
4469
|
+
ATTRIB_VALUE_ENTITY_Q: I++,
|
|
4470
4470
|
// <foo bar="""
|
|
4471
|
-
ATTRIB_VALUE_ENTITY_U:
|
|
4471
|
+
ATTRIB_VALUE_ENTITY_U: I++,
|
|
4472
4472
|
// <foo bar="
|
|
4473
|
-
CLOSE_TAG:
|
|
4473
|
+
CLOSE_TAG: I++,
|
|
4474
4474
|
// </a
|
|
4475
|
-
CLOSE_TAG_SAW_WHITE:
|
|
4475
|
+
CLOSE_TAG_SAW_WHITE: I++,
|
|
4476
4476
|
// </a >
|
|
4477
|
-
SCRIPT:
|
|
4477
|
+
SCRIPT: I++,
|
|
4478
4478
|
// <script> ...
|
|
4479
|
-
SCRIPT_ENDING:
|
|
4479
|
+
SCRIPT_ENDING: I++
|
|
4480
4480
|
// <script> ... <
|
|
4481
4481
|
}, u.XML_ENTITIES = {
|
|
4482
4482
|
amp: "&",
|
|
@@ -4739,46 +4739,46 @@ function Ki() {
|
|
|
4739
4739
|
hearts: 9829,
|
|
4740
4740
|
diams: 9830
|
|
4741
4741
|
}, Object.keys(u.ENTITIES).forEach(function(l) {
|
|
4742
|
-
var
|
|
4743
|
-
u.ENTITIES[l] =
|
|
4742
|
+
var o = u.ENTITIES[l], C = typeof o == "number" ? String.fromCharCode(o) : o;
|
|
4743
|
+
u.ENTITIES[l] = C;
|
|
4744
4744
|
});
|
|
4745
|
-
for (var
|
|
4746
|
-
u.STATE[u.STATE[
|
|
4747
|
-
|
|
4748
|
-
function He(l,
|
|
4749
|
-
l[
|
|
4745
|
+
for (var Dt in u.STATE)
|
|
4746
|
+
u.STATE[u.STATE[Dt]] = Dt;
|
|
4747
|
+
I = u.STATE;
|
|
4748
|
+
function He(l, o, C) {
|
|
4749
|
+
l[o] && l[o](C);
|
|
4750
4750
|
}
|
|
4751
|
-
function de(l,
|
|
4752
|
-
l.textNode &&
|
|
4751
|
+
function de(l, o, C) {
|
|
4752
|
+
l.textNode && ke(l), He(l, o, C);
|
|
4753
4753
|
}
|
|
4754
|
-
function
|
|
4754
|
+
function ke(l) {
|
|
4755
4755
|
l.textNode = zt(l.opt, l.textNode), l.textNode && He(l, "ontext", l.textNode), l.textNode = "";
|
|
4756
4756
|
}
|
|
4757
|
-
function zt(l,
|
|
4758
|
-
return l.trim && (
|
|
4757
|
+
function zt(l, o) {
|
|
4758
|
+
return l.trim && (o = o.trim()), l.normalize && (o = o.replace(/\s+/g, " ")), o;
|
|
4759
4759
|
}
|
|
4760
|
-
function
|
|
4761
|
-
return
|
|
4760
|
+
function Ke(l, o) {
|
|
4761
|
+
return ke(l), l.trackPosition && (o += `
|
|
4762
4762
|
Line: ` + l.line + `
|
|
4763
4763
|
Column: ` + l.column + `
|
|
4764
|
-
Char: ` + l.c),
|
|
4764
|
+
Char: ` + l.c), o = new Error(o), l.error = o, He(l, "onerror", o), l;
|
|
4765
4765
|
}
|
|
4766
4766
|
function bt(l) {
|
|
4767
|
-
return l.sawRoot && !l.closedRoot && le(l, "Unclosed root tag"), l.state !==
|
|
4767
|
+
return l.sawRoot && !l.closedRoot && le(l, "Unclosed root tag"), l.state !== I.BEGIN && l.state !== I.BEGIN_WHITESPACE && l.state !== I.TEXT && Ke(l, "Unexpected end"), ke(l), l.c = "", l.closed = !0, He(l, "onend"), i.call(l, l.strict, l.opt), l;
|
|
4768
4768
|
}
|
|
4769
|
-
function le(l,
|
|
4769
|
+
function le(l, o) {
|
|
4770
4770
|
if (typeof l != "object" || !(l instanceof i))
|
|
4771
4771
|
throw new Error("bad call to strictFail");
|
|
4772
|
-
l.strict &&
|
|
4772
|
+
l.strict && Ke(l, o);
|
|
4773
4773
|
}
|
|
4774
4774
|
function Xe(l) {
|
|
4775
4775
|
l.strict || (l.tagName = l.tagName[l.looseCase]());
|
|
4776
|
-
var
|
|
4777
|
-
l.opt.xmlns && (
|
|
4776
|
+
var o = l.tags[l.tags.length - 1] || l, C = l.tag = { name: l.tagName, attributes: {} };
|
|
4777
|
+
l.opt.xmlns && (C.ns = o.ns), l.attribList.length = 0, de(l, "onopentagstart", C);
|
|
4778
4778
|
}
|
|
4779
|
-
function
|
|
4780
|
-
var
|
|
4781
|
-
return
|
|
4779
|
+
function Ue(l, o) {
|
|
4780
|
+
var C = l.indexOf(":"), E = C < 0 ? ["", l] : l.split(":"), ie = E[0], Q = E[1];
|
|
4781
|
+
return o && l === "xmlns" && (ie = "xmlns", Q = ""), { prefix: ie, local: Q };
|
|
4782
4782
|
}
|
|
4783
4783
|
function Fe(l) {
|
|
4784
4784
|
if (l.strict || (l.attribName = l.attribName[l.looseCase]()), l.attribList.indexOf(l.attribName) !== -1 || l.tag.attributes.hasOwnProperty(l.attribName)) {
|
|
@@ -4786,8 +4786,8 @@ Char: ` + l.c), s = new Error(s), l.error = s, He(l, "onerror", s), l;
|
|
|
4786
4786
|
return;
|
|
4787
4787
|
}
|
|
4788
4788
|
if (l.opt.xmlns) {
|
|
4789
|
-
var
|
|
4790
|
-
if (
|
|
4789
|
+
var o = Ue(l.attribName, !0), C = o.prefix, E = o.local;
|
|
4790
|
+
if (C === "xmlns")
|
|
4791
4791
|
if (E === "xml" && l.attribValue !== fe)
|
|
4792
4792
|
le(
|
|
4793
4793
|
l,
|
|
@@ -4812,64 +4812,64 @@ Actual: ` + l.attribValue
|
|
|
4812
4812
|
});
|
|
4813
4813
|
l.attribName = l.attribValue = "";
|
|
4814
4814
|
}
|
|
4815
|
-
function
|
|
4815
|
+
function qe(l, o) {
|
|
4816
4816
|
if (l.opt.xmlns) {
|
|
4817
|
-
var
|
|
4818
|
-
|
|
4817
|
+
var C = l.tag, E = Ue(l.tagName);
|
|
4818
|
+
C.prefix = E.prefix, C.local = E.local, C.uri = C.ns[E.prefix] || "", C.prefix && !C.uri && (le(
|
|
4819
4819
|
l,
|
|
4820
4820
|
"Unbound namespace prefix: " + JSON.stringify(l.tagName)
|
|
4821
|
-
),
|
|
4821
|
+
), C.uri = E.prefix);
|
|
4822
4822
|
var ie = l.tags[l.tags.length - 1] || l;
|
|
4823
|
-
|
|
4823
|
+
C.ns && ie.ns !== C.ns && Object.keys(C.ns).forEach(function(Rt) {
|
|
4824
4824
|
de(l, "onopennamespace", {
|
|
4825
4825
|
prefix: Rt,
|
|
4826
|
-
uri:
|
|
4826
|
+
uri: C.ns[Rt]
|
|
4827
4827
|
});
|
|
4828
4828
|
});
|
|
4829
4829
|
for (var Q = 0, he = l.attribList.length; Q < he; Q++) {
|
|
4830
|
-
var Ae = l.attribList[Q], ye = Ae[0], tt = Ae[1], _e =
|
|
4830
|
+
var Ae = l.attribList[Q], ye = Ae[0], tt = Ae[1], _e = Ue(ye, !0), Le = _e.prefix, Nn = _e.local, wt = Le === "" ? "" : C.ns[Le] || "", Pe = {
|
|
4831
4831
|
name: ye,
|
|
4832
4832
|
value: tt,
|
|
4833
|
-
prefix:
|
|
4833
|
+
prefix: Le,
|
|
4834
4834
|
local: Nn,
|
|
4835
4835
|
uri: wt
|
|
4836
4836
|
};
|
|
4837
|
-
|
|
4837
|
+
Le && Le !== "xmlns" && !wt && (le(
|
|
4838
4838
|
l,
|
|
4839
|
-
"Unbound namespace prefix: " + JSON.stringify(
|
|
4840
|
-
),
|
|
4839
|
+
"Unbound namespace prefix: " + JSON.stringify(Le)
|
|
4840
|
+
), Pe.uri = Le), l.tag.attributes[ye] = Pe, de(l, "onattribute", Pe);
|
|
4841
4841
|
}
|
|
4842
4842
|
l.attribList.length = 0;
|
|
4843
4843
|
}
|
|
4844
|
-
l.tag.isSelfClosing = !!
|
|
4844
|
+
l.tag.isSelfClosing = !!o, l.sawRoot = !0, l.tags.push(l.tag), de(l, "onopentag", l.tag), o || (!l.noscript && l.tagName.toLowerCase() === "script" ? l.state = I.SCRIPT : l.state = I.TEXT, l.tag = null, l.tagName = ""), l.attribName = l.attribValue = "", l.attribList.length = 0;
|
|
4845
4845
|
}
|
|
4846
|
-
function
|
|
4846
|
+
function It(l) {
|
|
4847
4847
|
if (!l.tagName) {
|
|
4848
|
-
le(l, "Weird empty close tag."), l.textNode += "</>", l.state =
|
|
4848
|
+
le(l, "Weird empty close tag."), l.textNode += "</>", l.state = I.TEXT;
|
|
4849
4849
|
return;
|
|
4850
4850
|
}
|
|
4851
4851
|
if (l.script) {
|
|
4852
4852
|
if (l.tagName !== "script") {
|
|
4853
|
-
l.script += "</" + l.tagName + ">", l.tagName = "", l.state =
|
|
4853
|
+
l.script += "</" + l.tagName + ">", l.tagName = "", l.state = I.SCRIPT;
|
|
4854
4854
|
return;
|
|
4855
4855
|
}
|
|
4856
4856
|
de(l, "onscript", l.script), l.script = "";
|
|
4857
4857
|
}
|
|
4858
|
-
var
|
|
4859
|
-
l.strict || (
|
|
4860
|
-
for (var E =
|
|
4861
|
-
var ie = l.tags[
|
|
4858
|
+
var o = l.tags.length, C = l.tagName;
|
|
4859
|
+
l.strict || (C = C[l.looseCase]());
|
|
4860
|
+
for (var E = C; o--; ) {
|
|
4861
|
+
var ie = l.tags[o];
|
|
4862
4862
|
if (ie.name !== E)
|
|
4863
4863
|
le(l, "Unexpected close tag");
|
|
4864
4864
|
else
|
|
4865
4865
|
break;
|
|
4866
4866
|
}
|
|
4867
|
-
if (
|
|
4868
|
-
le(l, "Unmatched closing tag: " + l.tagName), l.textNode += "</" + l.tagName + ">", l.state =
|
|
4867
|
+
if (o < 0) {
|
|
4868
|
+
le(l, "Unmatched closing tag: " + l.tagName), l.textNode += "</" + l.tagName + ">", l.state = I.TEXT;
|
|
4869
4869
|
return;
|
|
4870
4870
|
}
|
|
4871
|
-
l.tagName =
|
|
4872
|
-
for (var Q = l.tags.length; Q-- >
|
|
4871
|
+
l.tagName = C;
|
|
4872
|
+
for (var Q = l.tags.length; Q-- > o; ) {
|
|
4873
4873
|
var he = l.tag = l.tags.pop();
|
|
4874
4874
|
l.tagName = l.tag.name, de(l, "onclosetag", l.tagName);
|
|
4875
4875
|
var Ae = {};
|
|
@@ -4877,230 +4877,236 @@ Actual: ` + l.attribValue
|
|
|
4877
4877
|
Ae[ye] = he.ns[ye];
|
|
4878
4878
|
var tt = l.tags[l.tags.length - 1] || l;
|
|
4879
4879
|
l.opt.xmlns && he.ns !== tt.ns && Object.keys(he.ns).forEach(function(_e) {
|
|
4880
|
-
var
|
|
4881
|
-
de(l, "onclosenamespace", { prefix: _e, uri:
|
|
4880
|
+
var Le = he.ns[_e];
|
|
4881
|
+
de(l, "onclosenamespace", { prefix: _e, uri: Le });
|
|
4882
4882
|
});
|
|
4883
4883
|
}
|
|
4884
|
-
|
|
4884
|
+
o === 0 && (l.closedRoot = !0), l.tagName = l.attribValue = l.attribName = "", l.attribList.length = 0, l.state = I.TEXT;
|
|
4885
4885
|
}
|
|
4886
4886
|
function Ze(l) {
|
|
4887
|
-
var
|
|
4888
|
-
return l.ENTITIES[
|
|
4887
|
+
var o = l.entity, C = o.toLowerCase(), E, ie = "";
|
|
4888
|
+
return l.ENTITIES[o] ? l.ENTITIES[o] : l.ENTITIES[C] ? l.ENTITIES[C] : (o = C, o.charAt(0) === "#" && (o.charAt(1) === "x" ? (o = o.slice(2), E = parseInt(o, 16), ie = E.toString(16)) : (o = o.slice(1), E = parseInt(o, 10), ie = E.toString(10))), o = o.replace(/^0+/, ""), isNaN(E) || ie.toLowerCase() !== o || E < 0 || E > 1114111 ? (le(l, "Invalid character entity"), "&" + l.entity + ";") : String.fromCodePoint(E));
|
|
4889
4889
|
}
|
|
4890
|
-
function St(l,
|
|
4891
|
-
|
|
4890
|
+
function St(l, o) {
|
|
4891
|
+
o === "<" ? (l.state = I.OPEN_WAKA, l.startTagPosition = l.position) : Y(o) || (le(l, "Non-whitespace before first tag."), l.textNode = o, l.state = I.TEXT);
|
|
4892
4892
|
}
|
|
4893
|
-
function Je(l,
|
|
4894
|
-
var
|
|
4895
|
-
return
|
|
4893
|
+
function Je(l, o) {
|
|
4894
|
+
var C = "";
|
|
4895
|
+
return o < l.length && (C = l.charAt(o)), C;
|
|
4896
4896
|
}
|
|
4897
4897
|
function et(l) {
|
|
4898
|
-
var
|
|
4898
|
+
var o = this;
|
|
4899
4899
|
if (this.error)
|
|
4900
4900
|
throw this.error;
|
|
4901
|
-
if (
|
|
4902
|
-
return
|
|
4903
|
-
|
|
4901
|
+
if (o.closed)
|
|
4902
|
+
return Ke(
|
|
4903
|
+
o,
|
|
4904
4904
|
"Cannot write after close. Assign an onready handler."
|
|
4905
4905
|
);
|
|
4906
4906
|
if (l === null)
|
|
4907
|
-
return bt(
|
|
4907
|
+
return bt(o);
|
|
4908
4908
|
typeof l == "object" && (l = l.toString());
|
|
4909
|
-
for (var
|
|
4910
|
-
switch (
|
|
4911
|
-
` ? (
|
|
4912
|
-
case
|
|
4913
|
-
if (
|
|
4909
|
+
for (var C = 0, E = ""; E = Je(l, C++), o.c = E, !!E; )
|
|
4910
|
+
switch (o.trackPosition && (o.position++, E === `
|
|
4911
|
+
` ? (o.line++, o.column = 0) : o.column++), o.state) {
|
|
4912
|
+
case I.BEGIN:
|
|
4913
|
+
if (o.state = I.BEGIN_WHITESPACE, E === "\uFEFF")
|
|
4914
4914
|
continue;
|
|
4915
|
-
St(
|
|
4915
|
+
St(o, E);
|
|
4916
4916
|
continue;
|
|
4917
|
-
case
|
|
4918
|
-
St(
|
|
4917
|
+
case I.BEGIN_WHITESPACE:
|
|
4918
|
+
St(o, E);
|
|
4919
4919
|
continue;
|
|
4920
|
-
case
|
|
4921
|
-
if (
|
|
4922
|
-
for (var Q =
|
|
4923
|
-
E = Je(l,
|
|
4924
|
-
` ? (
|
|
4925
|
-
|
|
4920
|
+
case I.TEXT:
|
|
4921
|
+
if (o.sawRoot && !o.closedRoot) {
|
|
4922
|
+
for (var Q = C - 1; E && E !== "<" && E !== "&"; )
|
|
4923
|
+
E = Je(l, C++), E && o.trackPosition && (o.position++, E === `
|
|
4924
|
+
` ? (o.line++, o.column = 0) : o.column++);
|
|
4925
|
+
o.textNode += l.substring(Q, C - 1);
|
|
4926
4926
|
}
|
|
4927
|
-
E === "<" && !(
|
|
4927
|
+
E === "<" && !(o.sawRoot && o.closedRoot && !o.strict) ? (o.state = I.OPEN_WAKA, o.startTagPosition = o.position) : (!Y(E) && (!o.sawRoot || o.closedRoot) && le(o, "Text data outside of root node."), E === "&" ? o.state = I.TEXT_ENTITY : o.textNode += E);
|
|
4928
4928
|
continue;
|
|
4929
|
-
case
|
|
4930
|
-
E === "<" ?
|
|
4929
|
+
case I.SCRIPT:
|
|
4930
|
+
E === "<" ? o.state = I.SCRIPT_ENDING : o.script += E;
|
|
4931
4931
|
continue;
|
|
4932
|
-
case
|
|
4933
|
-
E === "/" ?
|
|
4932
|
+
case I.SCRIPT_ENDING:
|
|
4933
|
+
E === "/" ? o.state = I.CLOSE_TAG : (o.script += "<" + E, o.state = I.SCRIPT);
|
|
4934
4934
|
continue;
|
|
4935
|
-
case
|
|
4935
|
+
case I.OPEN_WAKA:
|
|
4936
4936
|
if (E === "!")
|
|
4937
|
-
|
|
4937
|
+
o.state = I.SGML_DECL, o.sgmlDecl = "";
|
|
4938
4938
|
else if (!Y(E)) if (ne(se, E))
|
|
4939
|
-
|
|
4939
|
+
o.state = I.OPEN_TAG, o.tagName = E;
|
|
4940
4940
|
else if (E === "/")
|
|
4941
|
-
|
|
4941
|
+
o.state = I.CLOSE_TAG, o.tagName = "";
|
|
4942
4942
|
else if (E === "?")
|
|
4943
|
-
|
|
4943
|
+
o.state = I.PROC_INST, o.procInstName = o.procInstBody = "";
|
|
4944
4944
|
else {
|
|
4945
|
-
if (le(
|
|
4946
|
-
var ie =
|
|
4945
|
+
if (le(o, "Unencoded <"), o.startTagPosition + 1 < o.position) {
|
|
4946
|
+
var ie = o.position - o.startTagPosition;
|
|
4947
4947
|
E = new Array(ie).join(" ") + E;
|
|
4948
4948
|
}
|
|
4949
|
-
|
|
4949
|
+
o.textNode += "<" + E, o.state = I.TEXT;
|
|
4950
4950
|
}
|
|
4951
4951
|
continue;
|
|
4952
|
-
case
|
|
4953
|
-
if (
|
|
4954
|
-
|
|
4952
|
+
case I.SGML_DECL:
|
|
4953
|
+
if (o.sgmlDecl + E === "--") {
|
|
4954
|
+
o.state = I.COMMENT, o.comment = "", o.sgmlDecl = "";
|
|
4955
4955
|
continue;
|
|
4956
4956
|
}
|
|
4957
|
-
|
|
4958
|
-
|
|
4957
|
+
o.doctype && o.doctype !== !0 && o.sgmlDecl ? (o.state = I.DOCTYPE_DTD, o.doctype += "<!" + o.sgmlDecl + E, o.sgmlDecl = "") : (o.sgmlDecl + E).toUpperCase() === W ? (de(o, "onopencdata"), o.state = I.CDATA, o.sgmlDecl = "", o.cdata = "") : (o.sgmlDecl + E).toUpperCase() === J ? (o.state = I.DOCTYPE, (o.doctype || o.sawRoot) && le(
|
|
4958
|
+
o,
|
|
4959
4959
|
"Inappropriately located doctype declaration"
|
|
4960
|
-
),
|
|
4960
|
+
), o.doctype = "", o.sgmlDecl = "") : E === ">" ? (de(o, "onsgmldeclaration", o.sgmlDecl), o.sgmlDecl = "", o.state = I.TEXT) : (ae(E) && (o.state = I.SGML_DECL_QUOTED), o.sgmlDecl += E);
|
|
4961
4961
|
continue;
|
|
4962
|
-
case
|
|
4963
|
-
E ===
|
|
4962
|
+
case I.SGML_DECL_QUOTED:
|
|
4963
|
+
E === o.q && (o.state = I.SGML_DECL, o.q = ""), o.sgmlDecl += E;
|
|
4964
4964
|
continue;
|
|
4965
|
-
case
|
|
4966
|
-
E === ">" ? (
|
|
4965
|
+
case I.DOCTYPE:
|
|
4966
|
+
E === ">" ? (o.state = I.TEXT, de(o, "ondoctype", o.doctype), o.doctype = !0) : (o.doctype += E, E === "[" ? o.state = I.DOCTYPE_DTD : ae(E) && (o.state = I.DOCTYPE_QUOTED, o.q = E));
|
|
4967
4967
|
continue;
|
|
4968
|
-
case
|
|
4969
|
-
|
|
4968
|
+
case I.DOCTYPE_QUOTED:
|
|
4969
|
+
o.doctype += E, E === o.q && (o.q = "", o.state = I.DOCTYPE);
|
|
4970
4970
|
continue;
|
|
4971
|
-
case
|
|
4972
|
-
E === "]" ? (
|
|
4971
|
+
case I.DOCTYPE_DTD:
|
|
4972
|
+
E === "]" ? (o.doctype += E, o.state = I.DOCTYPE) : E === "<" ? (o.state = I.OPEN_WAKA, o.startTagPosition = o.position) : ae(E) ? (o.doctype += E, o.state = I.DOCTYPE_DTD_QUOTED, o.q = E) : o.doctype += E;
|
|
4973
4973
|
continue;
|
|
4974
|
-
case
|
|
4975
|
-
|
|
4974
|
+
case I.DOCTYPE_DTD_QUOTED:
|
|
4975
|
+
o.doctype += E, E === o.q && (o.state = I.DOCTYPE_DTD, o.q = "");
|
|
4976
4976
|
continue;
|
|
4977
|
-
case
|
|
4978
|
-
E === "-" ?
|
|
4977
|
+
case I.COMMENT:
|
|
4978
|
+
E === "-" ? o.state = I.COMMENT_ENDING : o.comment += E;
|
|
4979
4979
|
continue;
|
|
4980
|
-
case
|
|
4981
|
-
E === "-" ? (
|
|
4980
|
+
case I.COMMENT_ENDING:
|
|
4981
|
+
E === "-" ? (o.state = I.COMMENT_ENDED, o.comment = zt(o.opt, o.comment), o.comment && de(o, "oncomment", o.comment), o.comment = "") : (o.comment += "-" + E, o.state = I.COMMENT);
|
|
4982
4982
|
continue;
|
|
4983
|
-
case
|
|
4984
|
-
E !== ">" ? (le(
|
|
4983
|
+
case I.COMMENT_ENDED:
|
|
4984
|
+
E !== ">" ? (le(o, "Malformed comment"), o.comment += "--" + E, o.state = I.COMMENT) : o.doctype && o.doctype !== !0 ? o.state = I.DOCTYPE_DTD : o.state = I.TEXT;
|
|
4985
4985
|
continue;
|
|
4986
|
-
case
|
|
4987
|
-
for (var Q =
|
|
4988
|
-
E = Je(l,
|
|
4989
|
-
` ? (
|
|
4990
|
-
|
|
4986
|
+
case I.CDATA:
|
|
4987
|
+
for (var Q = C - 1; E && E !== "]"; )
|
|
4988
|
+
E = Je(l, C++), E && o.trackPosition && (o.position++, E === `
|
|
4989
|
+
` ? (o.line++, o.column = 0) : o.column++);
|
|
4990
|
+
o.cdata += l.substring(Q, C - 1), E === "]" && (o.state = I.CDATA_ENDING);
|
|
4991
4991
|
continue;
|
|
4992
|
-
case
|
|
4993
|
-
E === "]" ?
|
|
4992
|
+
case I.CDATA_ENDING:
|
|
4993
|
+
E === "]" ? o.state = I.CDATA_ENDING_2 : (o.cdata += "]" + E, o.state = I.CDATA);
|
|
4994
4994
|
continue;
|
|
4995
|
-
case
|
|
4996
|
-
E === ">" ? (
|
|
4995
|
+
case I.CDATA_ENDING_2:
|
|
4996
|
+
E === ">" ? (o.cdata && de(o, "oncdata", o.cdata), de(o, "onclosecdata"), o.cdata = "", o.state = I.TEXT) : E === "]" ? o.cdata += "]" : (o.cdata += "]]" + E, o.state = I.CDATA);
|
|
4997
4997
|
continue;
|
|
4998
|
-
case
|
|
4999
|
-
E === "?" ?
|
|
4998
|
+
case I.PROC_INST:
|
|
4999
|
+
E === "?" ? o.state = I.PROC_INST_ENDING : Y(E) ? o.state = I.PROC_INST_BODY : o.procInstName += E;
|
|
5000
5000
|
continue;
|
|
5001
|
-
case
|
|
5002
|
-
if (!
|
|
5001
|
+
case I.PROC_INST_BODY:
|
|
5002
|
+
if (!o.procInstBody && Y(E))
|
|
5003
5003
|
continue;
|
|
5004
|
-
E === "?" ?
|
|
5004
|
+
E === "?" ? o.state = I.PROC_INST_ENDING : o.procInstBody += E;
|
|
5005
5005
|
continue;
|
|
5006
|
-
case
|
|
5007
|
-
E === ">" ? (de(
|
|
5008
|
-
name:
|
|
5009
|
-
body:
|
|
5010
|
-
}),
|
|
5006
|
+
case I.PROC_INST_ENDING:
|
|
5007
|
+
E === ">" ? (de(o, "onprocessinginstruction", {
|
|
5008
|
+
name: o.procInstName,
|
|
5009
|
+
body: o.procInstBody
|
|
5010
|
+
}), o.procInstName = o.procInstBody = "", o.state = I.TEXT) : (o.procInstBody += "?" + E, o.state = I.PROC_INST_BODY);
|
|
5011
5011
|
continue;
|
|
5012
|
-
case
|
|
5013
|
-
ne(ce, E) ?
|
|
5012
|
+
case I.OPEN_TAG:
|
|
5013
|
+
ne(ce, E) ? o.tagName += E : (Xe(o), E === ">" ? qe(o) : E === "/" ? o.state = I.OPEN_TAG_SLASH : (Y(E) || le(o, "Invalid character in tag name"), o.state = I.ATTRIB));
|
|
5014
5014
|
continue;
|
|
5015
|
-
case
|
|
5016
|
-
E === ">" ? (
|
|
5017
|
-
|
|
5015
|
+
case I.OPEN_TAG_SLASH:
|
|
5016
|
+
E === ">" ? (qe(o, !0), It(o)) : (le(
|
|
5017
|
+
o,
|
|
5018
5018
|
"Forward-slash in opening tag not followed by >"
|
|
5019
|
-
),
|
|
5019
|
+
), o.state = I.ATTRIB);
|
|
5020
5020
|
continue;
|
|
5021
|
-
case
|
|
5021
|
+
case I.ATTRIB:
|
|
5022
5022
|
if (Y(E))
|
|
5023
5023
|
continue;
|
|
5024
|
-
E === ">" ?
|
|
5024
|
+
E === ">" ? qe(o) : E === "/" ? o.state = I.OPEN_TAG_SLASH : ne(se, E) ? (o.attribName = E, o.attribValue = "", o.state = I.ATTRIB_NAME) : le(o, "Invalid attribute name");
|
|
5025
5025
|
continue;
|
|
5026
|
-
case
|
|
5027
|
-
E === "=" ?
|
|
5026
|
+
case I.ATTRIB_NAME:
|
|
5027
|
+
E === "=" ? o.state = I.ATTRIB_VALUE : E === ">" ? (le(o, "Attribute without value"), o.attribValue = o.attribName, Fe(o), qe(o)) : Y(E) ? o.state = I.ATTRIB_NAME_SAW_WHITE : ne(ce, E) ? o.attribName += E : le(o, "Invalid attribute name");
|
|
5028
5028
|
continue;
|
|
5029
|
-
case
|
|
5029
|
+
case I.ATTRIB_NAME_SAW_WHITE:
|
|
5030
5030
|
if (E === "=")
|
|
5031
|
-
|
|
5031
|
+
o.state = I.ATTRIB_VALUE;
|
|
5032
5032
|
else {
|
|
5033
5033
|
if (Y(E))
|
|
5034
5034
|
continue;
|
|
5035
|
-
le(
|
|
5036
|
-
name:
|
|
5035
|
+
le(o, "Attribute without value"), o.tag.attributes[o.attribName] = "", o.attribValue = "", de(o, "onattribute", {
|
|
5036
|
+
name: o.attribName,
|
|
5037
5037
|
value: ""
|
|
5038
|
-
}),
|
|
5038
|
+
}), o.attribName = "", E === ">" ? qe(o) : ne(se, E) ? (o.attribName = E, o.state = I.ATTRIB_NAME) : (le(o, "Invalid attribute name"), o.state = I.ATTRIB);
|
|
5039
5039
|
}
|
|
5040
5040
|
continue;
|
|
5041
|
-
case
|
|
5041
|
+
case I.ATTRIB_VALUE:
|
|
5042
5042
|
if (Y(E))
|
|
5043
5043
|
continue;
|
|
5044
|
-
ae(E) ? (
|
|
5044
|
+
ae(E) ? (o.q = E, o.state = I.ATTRIB_VALUE_QUOTED) : (o.opt.unquotedAttributeValues || Ke(o, "Unquoted attribute value"), o.state = I.ATTRIB_VALUE_UNQUOTED, o.attribValue = E);
|
|
5045
5045
|
continue;
|
|
5046
|
-
case
|
|
5047
|
-
if (E !==
|
|
5048
|
-
E === "&" ?
|
|
5046
|
+
case I.ATTRIB_VALUE_QUOTED:
|
|
5047
|
+
if (E !== o.q) {
|
|
5048
|
+
E === "&" ? o.state = I.ATTRIB_VALUE_ENTITY_Q : o.attribValue += E;
|
|
5049
5049
|
continue;
|
|
5050
5050
|
}
|
|
5051
|
-
Fe(
|
|
5051
|
+
Fe(o), o.q = "", o.state = I.ATTRIB_VALUE_CLOSED;
|
|
5052
5052
|
continue;
|
|
5053
|
-
case
|
|
5054
|
-
Y(E) ?
|
|
5053
|
+
case I.ATTRIB_VALUE_CLOSED:
|
|
5054
|
+
Y(E) ? o.state = I.ATTRIB : E === ">" ? qe(o) : E === "/" ? o.state = I.OPEN_TAG_SLASH : ne(se, E) ? (le(o, "No whitespace between attributes"), o.attribName = E, o.attribValue = "", o.state = I.ATTRIB_NAME) : le(o, "Invalid attribute name");
|
|
5055
5055
|
continue;
|
|
5056
|
-
case
|
|
5056
|
+
case I.ATTRIB_VALUE_UNQUOTED:
|
|
5057
5057
|
if (!pe(E)) {
|
|
5058
|
-
E === "&" ?
|
|
5058
|
+
E === "&" ? o.state = I.ATTRIB_VALUE_ENTITY_U : o.attribValue += E;
|
|
5059
5059
|
continue;
|
|
5060
5060
|
}
|
|
5061
|
-
Fe(
|
|
5061
|
+
Fe(o), E === ">" ? qe(o) : o.state = I.ATTRIB;
|
|
5062
5062
|
continue;
|
|
5063
|
-
case
|
|
5064
|
-
if (
|
|
5065
|
-
E === ">" ?
|
|
5063
|
+
case I.CLOSE_TAG:
|
|
5064
|
+
if (o.tagName)
|
|
5065
|
+
E === ">" ? It(o) : ne(ce, E) ? o.tagName += E : o.script ? (o.script += "</" + o.tagName + E, o.tagName = "", o.state = I.SCRIPT) : (Y(E) || le(o, "Invalid tagname in closing tag"), o.state = I.CLOSE_TAG_SAW_WHITE);
|
|
5066
5066
|
else {
|
|
5067
5067
|
if (Y(E))
|
|
5068
5068
|
continue;
|
|
5069
|
-
|
|
5069
|
+
Ie(se, E) ? o.script ? (o.script += "</" + E, o.state = I.SCRIPT) : le(o, "Invalid tagname in closing tag.") : o.tagName = E;
|
|
5070
5070
|
}
|
|
5071
5071
|
continue;
|
|
5072
|
-
case
|
|
5072
|
+
case I.CLOSE_TAG_SAW_WHITE:
|
|
5073
5073
|
if (Y(E))
|
|
5074
5074
|
continue;
|
|
5075
|
-
E === ">" ?
|
|
5075
|
+
E === ">" ? It(o) : le(o, "Invalid characters in closing tag");
|
|
5076
5076
|
continue;
|
|
5077
|
-
case
|
|
5078
|
-
case
|
|
5079
|
-
case
|
|
5077
|
+
case I.TEXT_ENTITY:
|
|
5078
|
+
case I.ATTRIB_VALUE_ENTITY_Q:
|
|
5079
|
+
case I.ATTRIB_VALUE_ENTITY_U:
|
|
5080
5080
|
var he, Ae;
|
|
5081
|
-
switch (
|
|
5082
|
-
case
|
|
5083
|
-
he =
|
|
5081
|
+
switch (o.state) {
|
|
5082
|
+
case I.TEXT_ENTITY:
|
|
5083
|
+
he = I.TEXT, Ae = "textNode";
|
|
5084
5084
|
break;
|
|
5085
|
-
case
|
|
5086
|
-
he =
|
|
5085
|
+
case I.ATTRIB_VALUE_ENTITY_Q:
|
|
5086
|
+
he = I.ATTRIB_VALUE_QUOTED, Ae = "attribValue";
|
|
5087
5087
|
break;
|
|
5088
|
-
case
|
|
5089
|
-
he =
|
|
5088
|
+
case I.ATTRIB_VALUE_ENTITY_U:
|
|
5089
|
+
he = I.ATTRIB_VALUE_UNQUOTED, Ae = "attribValue";
|
|
5090
5090
|
break;
|
|
5091
5091
|
}
|
|
5092
5092
|
if (E === ";") {
|
|
5093
|
-
var ye = Ze(
|
|
5094
|
-
|
|
5095
|
-
|
|
5093
|
+
var ye = Ze(o);
|
|
5094
|
+
o.opt.unparsedEntities && !Object.values(u.XML_ENTITIES).includes(ye) ? ((o.entityCount += 1) > o.opt.maxEntityCount && Ke(
|
|
5095
|
+
o,
|
|
5096
|
+
"Parsed entity count exceeds max entity count"
|
|
5097
|
+
), (o.entityDepth += 1) > o.opt.maxEntityDepth && Ke(
|
|
5098
|
+
o,
|
|
5099
|
+
"Parsed entity depth exceeds max entity depth"
|
|
5100
|
+
), o.entity = "", o.state = he, o.write(ye), o.entityDepth -= 1) : (o[Ae] += ye, o.entity = "", o.state = he);
|
|
5101
|
+
} else ne(o.entity.length ? ee : Te, E) ? o.entity += E : (le(o, "Invalid character in entity name"), o[Ae] += "&" + o.entity + E, o.entity = "", o.state = he);
|
|
5096
5102
|
continue;
|
|
5097
5103
|
default:
|
|
5098
|
-
throw new Error(
|
|
5104
|
+
throw new Error(o, "Unknown state: " + o.state);
|
|
5099
5105
|
}
|
|
5100
|
-
return
|
|
5106
|
+
return o.position >= o.bufferCheckPosition && h(o), o;
|
|
5101
5107
|
}
|
|
5102
5108
|
String.fromCodePoint || (function() {
|
|
5103
|
-
var l = String.fromCharCode,
|
|
5109
|
+
var l = String.fromCharCode, o = Math.floor, C = function() {
|
|
5104
5110
|
var E = 16384, ie = [], Q, he, Ae = -1, ye = arguments.length;
|
|
5105
5111
|
if (!ye)
|
|
5106
5112
|
return "";
|
|
@@ -5109,17 +5115,17 @@ Actual: ` + l.attribValue
|
|
|
5109
5115
|
if (!isFinite(_e) || // `NaN`, `+Infinity`, or `-Infinity`
|
|
5110
5116
|
_e < 0 || // not a valid Unicode code point
|
|
5111
5117
|
_e > 1114111 || // not a valid Unicode code point
|
|
5112
|
-
|
|
5118
|
+
o(_e) !== _e)
|
|
5113
5119
|
throw RangeError("Invalid code point: " + _e);
|
|
5114
5120
|
_e <= 65535 ? ie.push(_e) : (_e -= 65536, Q = (_e >> 10) + 55296, he = _e % 1024 + 56320, ie.push(Q, he)), (Ae + 1 === ye || ie.length > E) && (tt += l.apply(null, ie), ie.length = 0);
|
|
5115
5121
|
}
|
|
5116
5122
|
return tt;
|
|
5117
5123
|
};
|
|
5118
5124
|
Object.defineProperty ? Object.defineProperty(String, "fromCodePoint", {
|
|
5119
|
-
value:
|
|
5125
|
+
value: C,
|
|
5120
5126
|
configurable: !0,
|
|
5121
5127
|
writable: !0
|
|
5122
|
-
}) : String.fromCodePoint =
|
|
5128
|
+
}) : String.fromCodePoint = C;
|
|
5123
5129
|
})();
|
|
5124
5130
|
})(g);
|
|
5125
5131
|
})(sr)), sr;
|
|
@@ -5214,7 +5220,7 @@ function Gi(g) {
|
|
|
5214
5220
|
]
|
|
5215
5221
|
} : N
|
|
5216
5222
|
);
|
|
5217
|
-
} else i.parent &&
|
|
5223
|
+
} else i.parent && Pi({
|
|
5218
5224
|
parentId: i.parent.id,
|
|
5219
5225
|
child: { id: i.id, tagName: i.tagName }
|
|
5220
5226
|
});
|
|
@@ -5236,7 +5242,7 @@ function Xi(g) {
|
|
|
5236
5242
|
}
|
|
5237
5243
|
function Wi(g) {
|
|
5238
5244
|
const { element: u, defaultNamespace: c, rootElementName: i } = g;
|
|
5239
|
-
return
|
|
5245
|
+
return $e(u.name === i, {
|
|
5240
5246
|
detail: `Expected root element <${i}>, got <${u.name}>`,
|
|
5241
5247
|
method: "import::getDefaultNamespace"
|
|
5242
5248
|
}), u.attributes?.xmlns?.value ? {
|
|
@@ -5313,7 +5319,7 @@ function eo(g) {
|
|
|
5313
5319
|
return g.name.replace(/\.[^.]+$/, "");
|
|
5314
5320
|
}
|
|
5315
5321
|
async function to(g) {
|
|
5316
|
-
const { file: u, dialecteConfig: c, options: i, useCustomRecordsIds: h } = g, m = eo(u), y = await
|
|
5322
|
+
const { file: u, dialecteConfig: c, options: i, useCustomRecordsIds: h } = g, m = eo(u), y = await Di({ databaseName: m, dialecteConfig: c });
|
|
5317
5323
|
try {
|
|
5318
5324
|
const N = c.database.tables.xmlElements.name;
|
|
5319
5325
|
if (await y.table(N).clear(), i.useBrowserApi && u.size !== 0 && await no({
|
|
@@ -5328,7 +5334,7 @@ async function to(g) {
|
|
|
5328
5334
|
}
|
|
5329
5335
|
}), c.io.hooks?.afterImport) {
|
|
5330
5336
|
const { creates: R, updates: j, deletes: X } = await c.io.hooks.afterImport();
|
|
5331
|
-
R?.length && await ga({ databaseInstance: y, elementsTableName: N, records: R }), j?.length && await
|
|
5337
|
+
R?.length && await ga({ databaseInstance: y, elementsTableName: N, records: R }), j?.length && await Ii({ databaseInstance: y, elementsTableName: N, updates: j }), X?.length && await Si({ databaseInstance: y, elementsTableName: N, ids: X });
|
|
5332
5338
|
}
|
|
5333
5339
|
return m;
|
|
5334
5340
|
} catch (N) {
|
|
@@ -5385,7 +5391,7 @@ async function fr(g) {
|
|
|
5385
5391
|
async function ta(g) {
|
|
5386
5392
|
const { databaseInstance: u, elementsTableName: c, sax: i, batchSize: h } = g;
|
|
5387
5393
|
if (i.getSize() >= h) {
|
|
5388
|
-
const y = i.drainBatch(), N =
|
|
5394
|
+
const y = i.drainBatch(), N = ki({
|
|
5389
5395
|
currentBatch: y
|
|
5390
5396
|
});
|
|
5391
5397
|
await ga({
|
|
@@ -5463,9 +5469,9 @@ function ro() {
|
|
|
5463
5469
|
children: []
|
|
5464
5470
|
}, pe = ee ? !1 : i.options.filter(ae) === !1;
|
|
5465
5471
|
for (; !(se() || ce(">") || ce("?>") || ce("/>")); ) {
|
|
5466
|
-
const
|
|
5467
|
-
if (
|
|
5468
|
-
ae.attributes[
|
|
5472
|
+
const Ie = fe();
|
|
5473
|
+
if (Ie)
|
|
5474
|
+
ae.attributes[Ie.name] = Ie.value;
|
|
5469
5475
|
else
|
|
5470
5476
|
return;
|
|
5471
5477
|
}
|
|
@@ -5479,11 +5485,11 @@ function ro() {
|
|
|
5479
5485
|
for (; ne; )
|
|
5480
5486
|
ne.excluded || ae.children.push(ne.node), ne = h();
|
|
5481
5487
|
if (i.options.strictMode) {
|
|
5482
|
-
const
|
|
5483
|
-
if (i.xml.startsWith(
|
|
5484
|
-
i.xml = i.xml.slice(
|
|
5488
|
+
const Ie = `</${ae.name}>`;
|
|
5489
|
+
if (i.xml.startsWith(Ie))
|
|
5490
|
+
i.xml = i.xml.slice(Ie.length);
|
|
5485
5491
|
else
|
|
5486
|
-
throw new c("Failed to parse XML", `Closing tag not matching "${
|
|
5492
|
+
throw new c("Failed to parse XML", `Closing tag not matching "${Ie}"`);
|
|
5487
5493
|
} else
|
|
5488
5494
|
F(/^<\/[\w-:.\u00C0-\u00FF]+\s*>/);
|
|
5489
5495
|
return {
|
|
@@ -5636,9 +5642,9 @@ function ao() {
|
|
|
5636
5642
|
let Te = B.attributes["xml:space"] === "preserve" || se, ee = !1;
|
|
5637
5643
|
if (!Te && F.options.ignoredPaths && (ee = j(F.path, F.options.ignoredPaths), Te = ee), !Te && F.options.collapseContent) {
|
|
5638
5644
|
let Y = !1, ae = !1, pe = !1;
|
|
5639
|
-
ce.forEach(function(ne,
|
|
5645
|
+
ce.forEach(function(ne, Ie) {
|
|
5640
5646
|
ne.type === "Text" ? (ne.content.includes(`
|
|
5641
|
-
`) ? (ae = !0, ne.content = ne.content.trim()) : (
|
|
5647
|
+
`) ? (ae = !0, ne.content = ne.content.trim()) : (Ie === 0 || Ie === ce.length - 1) && !se && ne.content.trim().length === 0 && (ne.content = ""), (ne.content.trim().length > 0 || ce.length === 1) && (Y = !0)) : ne.type === "CDATA" ? Y = !0 : pe = !0;
|
|
5642
5648
|
}), Y && (!pe || !ae) && (Te = !0);
|
|
5643
5649
|
}
|
|
5644
5650
|
ce.forEach(function(Y) {
|
|
@@ -5902,7 +5908,7 @@ function Ta(g) {
|
|
|
5902
5908
|
function po(g) {
|
|
5903
5909
|
return !!(g.name === "xmlns" || g.name.startsWith("xmlns:") || Ta(g) && g.namespace?.prefix === "xmlns");
|
|
5904
5910
|
}
|
|
5905
|
-
function
|
|
5911
|
+
function Po(g) {
|
|
5906
5912
|
const { config: u, storage: c } = g;
|
|
5907
5913
|
return c.type === "local" ? new Yr(new Ci(c.databaseName, u), u) : new Yr(c.store, u);
|
|
5908
5914
|
}
|
|
@@ -5916,16 +5922,16 @@ export {
|
|
|
5916
5922
|
ga as c,
|
|
5917
5923
|
Si as d,
|
|
5918
5924
|
Ro as e,
|
|
5919
|
-
|
|
5925
|
+
Do as f,
|
|
5920
5926
|
pa as g,
|
|
5921
|
-
|
|
5927
|
+
Ii as h,
|
|
5922
5928
|
So as i,
|
|
5923
|
-
|
|
5929
|
+
Io as j,
|
|
5924
5930
|
dr as k,
|
|
5925
5931
|
Qa as l,
|
|
5926
5932
|
so as m,
|
|
5927
5933
|
ai as n,
|
|
5928
|
-
|
|
5934
|
+
Po as o,
|
|
5929
5935
|
ii as p,
|
|
5930
5936
|
oi as q,
|
|
5931
5937
|
si as r,
|