Your Name 1912bcd25b
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
chore: sync all remaining local workspace changes
2026-05-08 11:26:57 +08:00

2050 lines
78 KiB
JavaScript

/*
* Extracted from browser-delivered Turbopack chunk: 9791d1c834ee18fb.a3b8628b5c.js
* Module id: 220924
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e, t, n) => {
t.exports = (function t(n, r, o) {
function a(l, s) {
if (!r[l]) {
if (!n[l]) {
var c = e.t;
return !s && c ? c(l, !0) : i(l, !0);
}
var d = (r[l] = { exports: {} });
n[l][0].call(
d.exports,
function (e) {
return a(n[l][1][e] || e);
},
d,
d.exports,
t,
n,
r,
o,
);
}
return r[l].exports;
}
for (var i = e.t, l = 0; l < o.length; l++) a(o[l]);
return a;
})(
{
1: [
function (t, n, r) {
(function (e) {
"use strict";
var t,
r,
o = e.MutationObserver || e.WebKitMutationObserver;
if (o) {
var a = 0,
i = new o(d),
l = e.document.createTextNode("");
i.observe(l, { characterData: !0 }),
(t = function () {
l.data = a = ++a % 2;
});
} else if (e.setImmediate || void 0 === e.MessageChannel)
t =
"document" in e &&
"onreadystatechange" in e.document.createElement("script")
? function () {
var t = e.document.createElement("script");
(t.onreadystatechange = function () {
d(),
(t.onreadystatechange = null),
t.parentNode.removeChild(t),
(t = null);
}),
e.document.documentElement.appendChild(t);
}
: function () {
setTimeout(d, 0);
};
else {
var s = new e.MessageChannel();
(s.port1.onmessage = d),
(t = function () {
s.port2.postMessage(0);
});
}
var c = [];
function d() {
r = !0;
for (var e, t, n = c.length; n; ) {
for (t = c, c = [], e = -1; ++e < n; ) t[e]();
n = c.length;
}
r = !1;
}
n.exports = function (e) {
1 !== c.push(e) || r || t();
};
}).call(this, e.g);
},
{},
],
2: [
function (e, t, n) {
"use strict";
var r = e(1);
function o() {}
var a = {},
i = ["REJECTED"],
l = ["FULFILLED"],
s = ["PENDING"];
function c(e) {
if ("function" != typeof e)
throw TypeError("resolver must be a function");
(this.state = s),
(this.queue = []),
(this.outcome = void 0),
e !== o && m(this, e);
}
function d(e, t, n) {
(this.promise = e),
"function" == typeof t &&
((this.onFulfilled = t),
(this.callFulfilled = this.otherCallFulfilled)),
"function" == typeof n &&
((this.onRejected = n),
(this.callRejected = this.otherCallRejected));
}
function u(e, t, n) {
r(function () {
var r;
try {
r = t(n);
} catch (t) {
return a.reject(e, t);
}
r === e
? a.reject(e, TypeError("Cannot resolve promise with itself"))
: a.resolve(e, r);
});
}
function f(e) {
var t = e && e.then;
if (
e &&
("object" == typeof e || "function" == typeof e) &&
"function" == typeof t
)
return function () {
t.apply(e, arguments);
};
}
function m(e, t) {
var n = !1;
function r(t) {
n || ((n = !0), a.reject(e, t));
}
function o(t) {
n || ((n = !0), a.resolve(e, t));
}
var i = p(function () {
t(o, r);
});
"error" === i.status && r(i.value);
}
function p(e, t) {
var n = {};
try {
(n.value = e(t)), (n.status = "success");
} catch (e) {
(n.status = "error"), (n.value = e);
}
return n;
}
(t.exports = c),
(c.prototype.catch = function (e) {
return this.then(null, e);
}),
(c.prototype.then = function (e, t) {
if (
("function" != typeof e && this.state === l) ||
("function" != typeof t && this.state === i)
)
return this;
var n = new this.constructor(o);
return (
this.state !== s
? u(n, this.state === l ? e : t, this.outcome)
: this.queue.push(new d(n, e, t)),
n
);
}),
(d.prototype.callFulfilled = function (e) {
a.resolve(this.promise, e);
}),
(d.prototype.otherCallFulfilled = function (e) {
u(this.promise, this.onFulfilled, e);
}),
(d.prototype.callRejected = function (e) {
a.reject(this.promise, e);
}),
(d.prototype.otherCallRejected = function (e) {
u(this.promise, this.onRejected, e);
}),
(a.resolve = function (e, t) {
var n = p(f, t);
if ("error" === n.status) return a.reject(e, n.value);
var r = n.value;
if (r) m(e, r);
else {
(e.state = l), (e.outcome = t);
for (var o = -1, i = e.queue.length; ++o < i; )
e.queue[o].callFulfilled(t);
}
return e;
}),
(a.reject = function (e, t) {
(e.state = i), (e.outcome = t);
for (var n = -1, r = e.queue.length; ++n < r; )
e.queue[n].callRejected(t);
return e;
}),
(c.resolve = function (e) {
return e instanceof this ? e : a.resolve(new this(o), e);
}),
(c.reject = function (e) {
var t = new this(o);
return a.reject(t, e);
}),
(c.all = function (e) {
var t = this;
if ("[object Array]" !== Object.prototype.toString.call(e))
return this.reject(TypeError("must be an array"));
var n = e.length,
r = !1;
if (!n) return this.resolve([]);
for (
var i = Array(n), l = 0, s = -1, c = new this(o);
++s < n;
)
!(function (e, o) {
t.resolve(e).then(
function (e) {
(i[o] = e),
++l !== n || r || ((r = !0), a.resolve(c, i));
},
function (e) {
r || ((r = !0), a.reject(c, e));
},
);
})(e[s], s);
return c;
}),
(c.race = function (e) {
var t,
n = this;
if ("[object Array]" !== Object.prototype.toString.call(e))
return this.reject(TypeError("must be an array"));
var r = e.length,
i = !1;
if (!r) return this.resolve([]);
for (var l = -1, s = new this(o); ++l < r; ) {
(t = e[l]),
n.resolve(t).then(
function (e) {
i || ((i = !0), a.resolve(s, e));
},
function (e) {
i || ((i = !0), a.reject(s, e));
},
);
}
return s;
});
},
{ 1: 1 },
],
3: [
function (t, n, r) {
(function (e) {
"use strict";
"function" != typeof e.Promise && (e.Promise = t(2));
}).call(this, e.g);
},
{ 2: 2 },
],
4: [
function (e, t, n) {
"use strict";
var r =
"function" == typeof Symbol &&
"symbol" == typeof Symbol.iterator
? function (e) {
return typeof e;
}
: function (e) {
return e &&
"function" == typeof Symbol &&
e.constructor === Symbol &&
e !== Symbol.prototype
? "symbol"
: typeof e;
},
o = (function () {
try {
if ("u" > typeof indexedDB) return indexedDB;
if ("u" > typeof webkitIndexedDB) return webkitIndexedDB;
if ("u" > typeof mozIndexedDB) return mozIndexedDB;
if ("u" > typeof OIndexedDB) return OIndexedDB;
if ("u" > typeof msIndexedDB) return msIndexedDB;
} catch (e) {
return;
}
})();
function a(e, t) {
(e = e || []), (t = t || {});
try {
return new Blob(e, t);
} catch (o) {
if ("TypeError" !== o.name) throw o;
for (
var n = new (
"u" > typeof BlobBuilder
? BlobBuilder
: "u" > typeof MSBlobBuilder
? MSBlobBuilder
: "u" > typeof MozBlobBuilder
? MozBlobBuilder
: WebKitBlobBuilder
)(),
r = 0;
r < e.length;
r += 1
)
n.append(e[r]);
return n.getBlob(t.type);
}
}
"u" < typeof Promise && e(3);
var i = Promise;
function l(e, t) {
t &&
e.then(
function (e) {
t(null, e);
},
function (e) {
t(e);
},
);
}
function s(e, t, n) {
"function" == typeof t && e.then(t),
"function" == typeof n && e.catch(n);
}
function c(e) {
return (
"string" != typeof e &&
(console.warn(e + " used as a key, but it is not a string."),
(e = String(e))),
e
);
}
function d() {
if (
arguments.length &&
"function" == typeof arguments[arguments.length - 1]
)
return arguments[arguments.length - 1];
}
var u = "local-forage-detect-blob-support",
f = void 0,
m = {},
p = Object.prototype.toString,
g = "readonly",
h = "readwrite";
function b(e) {
var t = m[e.name],
n = {};
(n.promise = new i(function (e, t) {
(n.resolve = e), (n.reject = t);
})),
t.deferredOperations.push(n),
t.dbReady
? (t.dbReady = t.dbReady.then(function () {
return n.promise;
}))
: (t.dbReady = n.promise);
}
function v(e) {
var t = m[e.name].deferredOperations.pop();
if (t) return t.resolve(), t.promise;
}
function x(e, t) {
var n = m[e.name].deferredOperations.pop();
if (n) return n.reject(t), n.promise;
}
function _(e, t) {
return new i(function (n, r) {
if (((m[e.name] = m[e.name] || N()), e.db))
if (!t) return n(e.db);
else b(e), e.db.close();
var a = [e.name];
t && a.push(e.version);
var i = o.open.apply(o, a);
t &&
(i.onupgradeneeded = function (t) {
var n = i.result;
try {
n.createObjectStore(e.storeName),
t.oldVersion <= 1 && n.createObjectStore(u);
} catch (n) {
if ("ConstraintError" === n.name)
console.warn(
'The database "' +
e.name +
'" has been upgraded from version ' +
t.oldVersion +
" to version " +
t.newVersion +
', but the storage "' +
e.storeName +
'" already exists.',
);
else throw n;
}
}),
(i.onerror = function (e) {
e.preventDefault(), r(i.error);
}),
(i.onsuccess = function () {
var t = i.result;
(t.onversionchange = function (e) {
e.target.close();
}),
n(t),
v(e);
});
});
}
function y(e, t) {
if (!e.db) return !0;
var n = !e.db.objectStoreNames.contains(e.storeName),
r = e.version < e.db.version,
o = e.version > e.db.version;
if (
(r &&
(e.version !== t &&
console.warn(
'The database "' +
e.name +
"\" can't be downgraded from version " +
e.db.version +
" to version " +
e.version +
".",
),
(e.version = e.db.version)),
o || n)
) {
if (n) {
var a = e.db.version + 1;
a > e.version && (e.version = a);
}
return !0;
}
return !1;
}
function w(e) {
return a(
[
(function (e) {
for (
var t = e.length,
n = new ArrayBuffer(t),
r = new Uint8Array(n),
o = 0;
o < t;
o++
)
r[o] = e.charCodeAt(o);
return n;
})(atob(e.data)),
],
{ type: e.type },
);
}
function S(e) {
return e && e.__local_forage_encoded_blob;
}
function C(e) {
var t = this,
n = t._initReady().then(function () {
var e = m[t._dbInfo.name];
if (e && e.dbReady) return e.dbReady;
});
return s(n, e, e), n;
}
function k(e, t, n, r) {
void 0 === r && (r = 1);
try {
var o = e.db.transaction(e.storeName, t);
n(null, o);
} catch (o) {
if (
r > 0 &&
(!e.db ||
"InvalidStateError" === o.name ||
"NotFoundError" === o.name)
)
return i
.resolve()
.then(function () {
if (
!e.db ||
("NotFoundError" === o.name &&
!e.db.objectStoreNames.contains(e.storeName) &&
e.version <= e.db.version)
)
return e.db && (e.version = e.db.version + 1), _(e, !0);
})
.then(function () {
return (function (e) {
b(e);
for (
var t = m[e.name], n = t.forages, r = 0;
r < n.length;
r++
) {
var o = n[r];
o._dbInfo.db &&
(o._dbInfo.db.close(), (o._dbInfo.db = null));
}
return (
(e.db = null),
_(e, !1)
.then(function (t) {
return ((e.db = t), y(e)) ? _(e, !0) : t;
})
.then(function (r) {
e.db = t.db = r;
for (var o = 0; o < n.length; o++)
n[o]._dbInfo.db = r;
})
.catch(function (t) {
throw (x(e, t), t);
})
);
})(e).then(function () {
k(e, t, n, r - 1);
});
})
.catch(n);
n(o);
}
}
function N() {
return {
forages: [],
db: null,
dbReady: null,
deferredOperations: [],
};
}
var I = {
_driver: "asyncStorage",
_initStorage: function (e) {
var t = this,
n = { db: null };
if (e) for (var r in e) n[r] = e[r];
var o = m[n.name];
o || ((o = N()), (m[n.name] = o)),
o.forages.push(t),
t._initReady || ((t._initReady = t.ready), (t.ready = C));
var a = [];
function l() {
return i.resolve();
}
for (var s = 0; s < o.forages.length; s++) {
var c = o.forages[s];
c !== t && a.push(c._initReady().catch(l));
}
var d = o.forages.slice(0);
return i
.all(a)
.then(function () {
return (n.db = o.db), _(n, !1);
})
.then(function (e) {
return ((n.db = e), y(n, t._defaultConfig.version))
? _(n, !0)
: e;
})
.then(function (e) {
(n.db = o.db = e), (t._dbInfo = n);
for (var r = 0; r < d.length; r++) {
var a = d[r];
a !== t &&
((a._dbInfo.db = n.db),
(a._dbInfo.version = n.version));
}
});
},
_support: (function () {
try {
if (!o || !o.open) return !1;
var e =
"u" > typeof openDatabase &&
/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent) &&
!/Chrome/.test(navigator.userAgent) &&
!/BlackBerry/.test(navigator.platform),
t =
"function" == typeof fetch &&
-1 !== fetch.toString().indexOf("[native code");
return (
(!e || t) &&
"u" > typeof indexedDB &&
"u" > typeof IDBKeyRange
);
} catch (e) {
return !1;
}
})(),
iterate: function (e, t) {
var n = this,
r = new i(function (t, r) {
n.ready()
.then(function () {
k(n._dbInfo, g, function (o, a) {
if (o) return r(o);
try {
var i = a
.objectStore(n._dbInfo.storeName)
.openCursor(),
l = 1;
(i.onsuccess = function () {
var n = i.result;
if (n) {
var r = n.value;
S(r) && (r = w(r));
var o = e(r, n.key, l++);
void 0 !== o ? t(o) : n.continue();
} else t();
}),
(i.onerror = function () {
r(i.error);
});
} catch (e) {
r(e);
}
});
})
.catch(r);
});
return l(r, t), r;
},
getItem: function (e, t) {
var n = this;
e = c(e);
var r = new i(function (t, r) {
n.ready()
.then(function () {
k(n._dbInfo, g, function (o, a) {
if (o) return r(o);
try {
var i = a.objectStore(n._dbInfo.storeName).get(e);
(i.onsuccess = function () {
var e = i.result;
void 0 === e && (e = null),
S(e) && (e = w(e)),
t(e);
}),
(i.onerror = function () {
r(i.error);
});
} catch (e) {
r(e);
}
});
})
.catch(r);
});
return l(r, t), r;
},
setItem: function (e, t, n) {
var r = this;
e = c(e);
var o = new i(function (n, o) {
var l;
r.ready()
.then(function () {
return ((l = r._dbInfo), "[object Blob]" === p.call(t))
? (function (e) {
return "boolean" == typeof f
? i.resolve(f)
: new i(function (t) {
var n = e.transaction(u, h),
r = a([""]);
n.objectStore(u).put(r, "key"),
(n.onabort = function (e) {
e.preventDefault(),
e.stopPropagation(),
t(!1);
}),
(n.oncomplete = function () {
var e =
navigator.userAgent.match(
/Chrome\/(\d+)/,
);
t(
navigator.userAgent.match(/Edge\//) ||
!e ||
parseInt(e[1], 10) >= 43,
);
});
})
.catch(function () {
return !1;
})
.then(function (e) {
return (f = e);
});
})(l.db).then(function (e) {
return e
? t
: new i(function (e, n) {
var r = new FileReader();
(r.onerror = n),
(r.onloadend = function (n) {
e({
__local_forage_encoded_blob: !0,
data: btoa(n.target.result || ""),
type: t.type,
});
}),
r.readAsBinaryString(t);
});
})
: t;
})
.then(function (t) {
k(r._dbInfo, h, function (a, i) {
if (a) return o(a);
try {
var l = i.objectStore(r._dbInfo.storeName);
null === t && (t = void 0);
var s = l.put(t, e);
(i.oncomplete = function () {
void 0 === t && (t = null), n(t);
}),
(i.onabort = i.onerror =
function () {
var e = s.error
? s.error
: s.transaction.error;
o(e);
});
} catch (e) {
o(e);
}
});
})
.catch(o);
});
return l(o, n), o;
},
removeItem: function (e, t) {
var n = this;
e = c(e);
var r = new i(function (t, r) {
n.ready()
.then(function () {
k(n._dbInfo, h, function (o, a) {
if (o) return r(o);
try {
var i = a
.objectStore(n._dbInfo.storeName)
.delete(e);
(a.oncomplete = function () {
t();
}),
(a.onerror = function () {
r(i.error);
}),
(a.onabort = function () {
var e = i.error ? i.error : i.transaction.error;
r(e);
});
} catch (e) {
r(e);
}
});
})
.catch(r);
});
return l(r, t), r;
},
clear: function (e) {
var t = this,
n = new i(function (e, n) {
t.ready()
.then(function () {
k(t._dbInfo, h, function (r, o) {
if (r) return n(r);
try {
var a = o
.objectStore(t._dbInfo.storeName)
.clear();
(o.oncomplete = function () {
e();
}),
(o.onabort = o.onerror =
function () {
var e = a.error
? a.error
: a.transaction.error;
n(e);
});
} catch (e) {
n(e);
}
});
})
.catch(n);
});
return l(n, e), n;
},
length: function (e) {
var t = this,
n = new i(function (e, n) {
t.ready()
.then(function () {
k(t._dbInfo, g, function (r, o) {
if (r) return n(r);
try {
var a = o
.objectStore(t._dbInfo.storeName)
.count();
(a.onsuccess = function () {
e(a.result);
}),
(a.onerror = function () {
n(a.error);
});
} catch (e) {
n(e);
}
});
})
.catch(n);
});
return l(n, e), n;
},
key: function (e, t) {
var n = this,
r = new i(function (t, r) {
e < 0
? t(null)
: n
.ready()
.then(function () {
k(n._dbInfo, g, function (o, a) {
if (o) return r(o);
try {
var i = a.objectStore(n._dbInfo.storeName),
l = !1,
s = i.openKeyCursor();
(s.onsuccess = function () {
var n = s.result;
n
? 0 === e || l
? t(n.key)
: ((l = !0), n.advance(e))
: t(null);
}),
(s.onerror = function () {
r(s.error);
});
} catch (e) {
r(e);
}
});
})
.catch(r);
});
return l(r, t), r;
},
keys: function (e) {
var t = this,
n = new i(function (e, n) {
t.ready()
.then(function () {
k(t._dbInfo, g, function (r, o) {
if (r) return n(r);
try {
var a = o
.objectStore(t._dbInfo.storeName)
.openKeyCursor(),
i = [];
(a.onsuccess = function () {
var t = a.result;
t ? (i.push(t.key), t.continue()) : e(i);
}),
(a.onerror = function () {
n(a.error);
});
} catch (e) {
n(e);
}
});
})
.catch(n);
});
return l(n, e), n;
},
dropInstance: function (e, t) {
t = d.apply(this, arguments);
var n,
r = this.config();
if (
((e = ("function" != typeof e && e) || {}).name ||
((e.name = e.name || r.name),
(e.storeName = e.storeName || r.storeName)),
e.name)
) {
var a =
e.name === r.name && this._dbInfo.db
? i.resolve(this._dbInfo.db)
: _(e, !1).then(function (t) {
var n = m[e.name],
r = n.forages;
n.db = t;
for (var o = 0; o < r.length; o++)
r[o]._dbInfo.db = t;
return t;
});
n = e.storeName
? a.then(function (t) {
if (t.objectStoreNames.contains(e.storeName)) {
var n = t.version + 1;
b(e);
var r = m[e.name],
a = r.forages;
t.close();
for (var l = 0; l < a.length; l++) {
var s = a[l];
(s._dbInfo.db = null), (s._dbInfo.version = n);
}
return new i(function (t, r) {
var a = o.open(e.name, n);
(a.onerror = function (e) {
a.result.close(), r(e);
}),
(a.onupgradeneeded = function () {
a.result.deleteObjectStore(e.storeName);
}),
(a.onsuccess = function () {
var e = a.result;
e.close(), t(e);
});
})
.then(function (e) {
r.db = e;
for (var t = 0; t < a.length; t++) {
var n = a[t];
(n._dbInfo.db = e), v(n._dbInfo);
}
})
.catch(function (t) {
throw (
((x(e, t) || i.resolve()).catch(
function () {},
),
t)
);
});
}
})
: a.then(function (t) {
b(e);
var n = m[e.name],
r = n.forages;
t.close();
for (var a = 0; a < r.length; a++)
r[a]._dbInfo.db = null;
return new i(function (t, n) {
var r = o.deleteDatabase(e.name);
(r.onerror = function () {
var e = r.result;
e && e.close(), n(r.error);
}),
(r.onblocked = function () {
console.warn(
'dropInstance blocked for database "' +
e.name +
'" until all open connections are closed',
);
}),
(r.onsuccess = function () {
var e = r.result;
e && e.close(), t(e);
});
})
.then(function (e) {
n.db = e;
for (var t = 0; t < r.length; t++)
v(r[t]._dbInfo);
})
.catch(function (t) {
throw (
((x(e, t) || i.resolve()).catch(function () {}),
t)
);
});
});
} else n = i.reject("Invalid arguments");
return l(n, t), n;
},
},
E =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
j = /^~~local_forage_type~([^~]+)~/,
$ = "__lfsc__:",
T = $.length,
R = "arbf",
M = "blob",
P = "si08",
O = "ui08",
L = "uic8",
q = "si16",
A = "si32",
B = "ur16",
D = "ui32",
H = "fl32",
F = "fl64",
z = T + R.length,
U = Object.prototype.toString;
function W(e) {
var t,
n,
r,
o,
a,
i = 0.75 * e.length,
l = e.length,
s = 0;
"=" === e[e.length - 1] && (i--, "=" === e[e.length - 2] && i--);
var c = new ArrayBuffer(i),
d = new Uint8Array(c);
for (t = 0; t < l; t += 4)
(n = E.indexOf(e[t])),
(r = E.indexOf(e[t + 1])),
(o = E.indexOf(e[t + 2])),
(a = E.indexOf(e[t + 3])),
(d[s++] = (n << 2) | (r >> 4)),
(d[s++] = ((15 & r) << 4) | (o >> 2)),
(d[s++] = ((3 & o) << 6) | (63 & a));
return c;
}
function V(e) {
var t,
n = new Uint8Array(e),
r = "";
for (t = 0; t < n.length; t += 3)
(r += E[n[t] >> 2]),
(r += E[((3 & n[t]) << 4) | (n[t + 1] >> 4)]),
(r += E[((15 & n[t + 1]) << 2) | (n[t + 2] >> 6)]),
(r += E[63 & n[t + 2]]);
return (
n.length % 3 == 2
? (r = r.substring(0, r.length - 1) + "=")
: n.length % 3 == 1 &&
(r = r.substring(0, r.length - 2) + "=="),
r
);
}
var G = {
serialize: function (e, t) {
var n = "";
if (
(e && (n = U.call(e)),
e &&
("[object ArrayBuffer]" === n ||
(e.buffer &&
"[object ArrayBuffer]" === U.call(e.buffer))))
) {
var r,
o = $;
e instanceof ArrayBuffer
? ((r = e), (o += R))
: ((r = e.buffer),
"[object Int8Array]" === n
? (o += P)
: "[object Uint8Array]" === n
? (o += O)
: "[object Uint8ClampedArray]" === n
? (o += L)
: "[object Int16Array]" === n
? (o += q)
: "[object Uint16Array]" === n
? (o += B)
: "[object Int32Array]" === n
? (o += A)
: "[object Uint32Array]" === n
? (o += D)
: "[object Float32Array]" === n
? (o += H)
: "[object Float64Array]" === n
? (o += F)
: t(
Error(
"Failed to get type for BinaryArray",
),
)),
t(o + V(r));
} else if ("[object Blob]" === n) {
var a = new FileReader();
(a.onload = function () {
t(
$ +
M +
("~~local_forage_type~" + e.type + "~") +
V(this.result),
);
}),
a.readAsArrayBuffer(e);
} else
try {
t(JSON.stringify(e));
} catch (n) {
console.error(
"Couldn't convert value into a JSON string: ",
e,
),
t(null, n);
}
},
deserialize: function (e) {
if (e.substring(0, T) !== $) return JSON.parse(e);
var t,
n = e.substring(z),
r = e.substring(T, z);
if (r === M && j.test(n)) {
var o = n.match(j);
(t = o[1]), (n = n.substring(o[0].length));
}
var i = W(n);
switch (r) {
case R:
return i;
case M:
return a([i], { type: t });
case P:
return new Int8Array(i);
case O:
return new Uint8Array(i);
case L:
return new Uint8ClampedArray(i);
case q:
return new Int16Array(i);
case B:
return new Uint16Array(i);
case A:
return new Int32Array(i);
case D:
return new Uint32Array(i);
case H:
return new Float32Array(i);
case F:
return new Float64Array(i);
default:
throw Error("Unkown type: " + r);
}
},
stringToBuffer: W,
bufferToString: V,
};
function K(e, t, n, r) {
e.executeSql(
"CREATE TABLE IF NOT EXISTS " +
t.storeName +
" (id INTEGER PRIMARY KEY, key unique, value)",
[],
n,
r,
);
}
function X(e, t, n, r, o, a) {
e.executeSql(
n,
r,
o,
function (e, i) {
i.code === i.SYNTAX_ERR
? e.executeSql(
"SELECT name FROM sqlite_master WHERE type='table' AND name = ?",
[t.storeName],
function (e, l) {
l.rows.length
? a(e, i)
: K(
e,
t,
function () {
e.executeSql(n, r, o, a);
},
a,
);
},
a,
)
: a(e, i);
},
a,
);
}
function Y(e, t, n, r) {
var o = this;
e = c(e);
var a = new i(function (a, i) {
o.ready()
.then(function () {
void 0 === t && (t = null);
var l = t,
s = o._dbInfo;
s.serializer.serialize(t, function (t, c) {
c
? i(c)
: s.db.transaction(
function (n) {
X(
n,
s,
"INSERT OR REPLACE INTO " +
s.storeName +
" (key, value) VALUES (?, ?)",
[e, t],
function () {
a(l);
},
function (e, t) {
i(t);
},
);
},
function (t) {
if (t.code === t.QUOTA_ERR) {
if (r > 0)
return void a(Y.apply(o, [e, l, n, r - 1]));
i(t);
}
},
);
});
})
.catch(i);
});
return l(a, n), a;
}
var J = {
_driver: "webSQLStorage",
_initStorage: function (e) {
var t = this,
n = { db: null };
if (e)
for (var r in e)
n[r] = "string" != typeof e[r] ? e[r].toString() : e[r];
var o = new i(function (e, r) {
try {
n.db = openDatabase(
n.name,
String(n.version),
n.description,
n.size,
);
} catch (e) {
return r(e);
}
n.db.transaction(function (o) {
K(
o,
n,
function () {
(t._dbInfo = n), e();
},
function (e, t) {
r(t);
},
);
}, r);
});
return (n.serializer = G), o;
},
_support: "function" == typeof openDatabase,
iterate: function (e, t) {
var n = this,
r = new i(function (t, r) {
n.ready()
.then(function () {
var o = n._dbInfo;
o.db.transaction(function (n) {
X(
n,
o,
"SELECT * FROM " + o.storeName,
[],
function (n, r) {
for (
var a = r.rows, i = a.length, l = 0;
l < i;
l++
) {
var s = a.item(l),
c = s.value;
if (
(c && (c = o.serializer.deserialize(c)),
void 0 !== (c = e(c, s.key, l + 1)))
)
return void t(c);
}
t();
},
function (e, t) {
r(t);
},
);
});
})
.catch(r);
});
return l(r, t), r;
},
getItem: function (e, t) {
var n = this;
e = c(e);
var r = new i(function (t, r) {
n.ready()
.then(function () {
var o = n._dbInfo;
o.db.transaction(function (n) {
X(
n,
o,
"SELECT * FROM " +
o.storeName +
" WHERE key = ? LIMIT 1",
[e],
function (e, n) {
var r = n.rows.length ? n.rows.item(0).value : null;
r && (r = o.serializer.deserialize(r)), t(r);
},
function (e, t) {
r(t);
},
);
});
})
.catch(r);
});
return l(r, t), r;
},
setItem: function (e, t, n) {
return Y.apply(this, [e, t, n, 1]);
},
removeItem: function (e, t) {
var n = this;
e = c(e);
var r = new i(function (t, r) {
n.ready()
.then(function () {
var o = n._dbInfo;
o.db.transaction(function (n) {
X(
n,
o,
"DELETE FROM " + o.storeName + " WHERE key = ?",
[e],
function () {
t();
},
function (e, t) {
r(t);
},
);
});
})
.catch(r);
});
return l(r, t), r;
},
clear: function (e) {
var t = this,
n = new i(function (e, n) {
t.ready()
.then(function () {
var r = t._dbInfo;
r.db.transaction(function (t) {
X(
t,
r,
"DELETE FROM " + r.storeName,
[],
function () {
e();
},
function (e, t) {
n(t);
},
);
});
})
.catch(n);
});
return l(n, e), n;
},
length: function (e) {
var t = this,
n = new i(function (e, n) {
t.ready()
.then(function () {
var r = t._dbInfo;
r.db.transaction(function (t) {
X(
t,
r,
"SELECT COUNT(key) as c FROM " + r.storeName,
[],
function (t, n) {
e(n.rows.item(0).c);
},
function (e, t) {
n(t);
},
);
});
})
.catch(n);
});
return l(n, e), n;
},
key: function (e, t) {
var n = this,
r = new i(function (t, r) {
n.ready()
.then(function () {
var o = n._dbInfo;
o.db.transaction(function (n) {
X(
n,
o,
"SELECT key FROM " +
o.storeName +
" WHERE id = ? LIMIT 1",
[e + 1],
function (e, n) {
t(n.rows.length ? n.rows.item(0).key : null);
},
function (e, t) {
r(t);
},
);
});
})
.catch(r);
});
return l(r, t), r;
},
keys: function (e) {
var t = this,
n = new i(function (e, n) {
t.ready()
.then(function () {
var r = t._dbInfo;
r.db.transaction(function (t) {
X(
t,
r,
"SELECT key FROM " + r.storeName,
[],
function (t, n) {
for (var r = [], o = 0; o < n.rows.length; o++)
r.push(n.rows.item(o).key);
e(r);
},
function (e, t) {
n(t);
},
);
});
})
.catch(n);
});
return l(n, e), n;
},
dropInstance: function (e, t) {
t = d.apply(this, arguments);
var n,
r = this.config();
(e = ("function" != typeof e && e) || {}).name ||
((e.name = e.name || r.name),
(e.storeName = e.storeName || r.storeName));
var o = this;
return (
l(
(n = e.name
? new i(function (t) {
var n;
((n =
e.name === r.name
? o._dbInfo.db
: openDatabase(e.name, "", "", 0)),
e.storeName)
? t({ db: n, storeNames: [e.storeName] })
: t(
new i(function (e, t) {
n.transaction(
function (r) {
r.executeSql(
"SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",
[],
function (t, r) {
for (
var o = [], a = 0;
a < r.rows.length;
a++
)
o.push(r.rows.item(a).name);
e({ db: n, storeNames: o });
},
function (e, n) {
t(n);
},
);
},
function (e) {
t(e);
},
);
}),
);
}).then(function (e) {
return new i(function (t, n) {
e.db.transaction(
function (r) {
for (
var o = [], a = 0, l = e.storeNames.length;
a < l;
a++
)
o.push(
(function (e) {
return new i(function (t, n) {
r.executeSql(
"DROP TABLE IF EXISTS " + e,
[],
function () {
t();
},
function (e, t) {
n(t);
},
);
});
})(e.storeNames[a]),
);
i.all(o)
.then(function () {
t();
})
.catch(function (e) {
n(e);
});
},
function (e) {
n(e);
},
);
});
})
: i.reject("Invalid arguments")),
t,
),
n
);
},
};
function Q(e, t) {
var n = e.name + "/";
return e.storeName !== t.storeName && (n += e.storeName + "/"), n;
}
var Z = {
_driver: "localStorageWrapper",
_initStorage: function (e) {
var t = {};
if (e) for (var n in e) t[n] = e[n];
return ((t.keyPrefix = Q(e, this._defaultConfig)),
!(function () {
var e = "_localforage_support_test";
try {
return (
localStorage.setItem(e, !0),
localStorage.removeItem(e),
!1
);
} catch (e) {
return !0;
}
})() || localStorage.length > 0)
? ((this._dbInfo = t), (t.serializer = G), i.resolve())
: i.reject();
},
_support: (function () {
try {
return (
"u" > typeof localStorage &&
"setItem" in localStorage &&
!!localStorage.setItem
);
} catch (e) {
return !1;
}
})(),
iterate: function (e, t) {
var n = this,
r = n.ready().then(function () {
for (
var t = n._dbInfo,
r = t.keyPrefix,
o = r.length,
a = localStorage.length,
i = 1,
l = 0;
l < a;
l++
) {
var s = localStorage.key(l);
if (0 === s.indexOf(r)) {
var c = localStorage.getItem(s);
if (
(c && (c = t.serializer.deserialize(c)),
void 0 !== (c = e(c, s.substring(o), i++)))
)
return c;
}
}
});
return l(r, t), r;
},
getItem: function (e, t) {
var n = this;
e = c(e);
var r = n.ready().then(function () {
var t = n._dbInfo,
r = localStorage.getItem(t.keyPrefix + e);
return r && (r = t.serializer.deserialize(r)), r;
});
return l(r, t), r;
},
setItem: function (e, t, n) {
var r = this;
e = c(e);
var o = r.ready().then(function () {
void 0 === t && (t = null);
var n = t;
return new i(function (o, a) {
var i = r._dbInfo;
i.serializer.serialize(t, function (t, r) {
if (r) a(r);
else
try {
localStorage.setItem(i.keyPrefix + e, t), o(n);
} catch (e) {
("QuotaExceededError" === e.name ||
"NS_ERROR_DOM_QUOTA_REACHED" === e.name) &&
a(e),
a(e);
}
});
});
});
return l(o, n), o;
},
removeItem: function (e, t) {
var n = this;
e = c(e);
var r = n.ready().then(function () {
var t = n._dbInfo;
localStorage.removeItem(t.keyPrefix + e);
});
return l(r, t), r;
},
clear: function (e) {
var t = this,
n = t.ready().then(function () {
for (
var e = t._dbInfo.keyPrefix,
n = localStorage.length - 1;
n >= 0;
n--
) {
var r = localStorage.key(n);
0 === r.indexOf(e) && localStorage.removeItem(r);
}
});
return l(n, e), n;
},
length: function (e) {
var t = this.keys().then(function (e) {
return e.length;
});
return l(t, e), t;
},
key: function (e, t) {
var n = this,
r = n.ready().then(function () {
var t,
r = n._dbInfo;
try {
t = localStorage.key(e);
} catch (e) {
t = null;
}
return t && (t = t.substring(r.keyPrefix.length)), t;
});
return l(r, t), r;
},
keys: function (e) {
var t = this,
n = t.ready().then(function () {
for (
var e = t._dbInfo,
n = localStorage.length,
r = [],
o = 0;
o < n;
o++
) {
var a = localStorage.key(o);
0 === a.indexOf(e.keyPrefix) &&
r.push(a.substring(e.keyPrefix.length));
}
return r;
});
return l(n, e), n;
},
dropInstance: function (e, t) {
if (
((t = d.apply(this, arguments)),
!(e = ("function" != typeof e && e) || {}).name)
) {
var n,
r = this.config();
(e.name = e.name || r.name),
(e.storeName = e.storeName || r.storeName);
}
var o = this;
return (
l(
(n = e.name
? new i(function (t) {
t(
e.storeName
? Q(e, o._defaultConfig)
: e.name + "/",
);
}).then(function (e) {
for (var t = localStorage.length - 1; t >= 0; t--) {
var n = localStorage.key(t);
0 === n.indexOf(e) && localStorage.removeItem(n);
}
})
: i.reject("Invalid arguments")),
t,
),
n
);
},
},
ee = function (e, t) {
for (var n, r = e.length, o = 0; o < r; ) {
if (
(n = e[o]) === t ||
("number" == typeof n &&
"number" == typeof t &&
isNaN(n) &&
isNaN(t))
)
return !0;
o++;
}
return !1;
},
et =
Array.isArray ||
function (e) {
return "[object Array]" === Object.prototype.toString.call(e);
},
en = {},
er = {},
eo = { INDEXEDDB: I, WEBSQL: J, LOCALSTORAGE: Z },
ea = [
eo.INDEXEDDB._driver,
eo.WEBSQL._driver,
eo.LOCALSTORAGE._driver,
],
ei = ["dropInstance"],
el = [
"clear",
"getItem",
"iterate",
"key",
"keys",
"length",
"removeItem",
"setItem",
].concat(ei),
es = {
description: "",
driver: ea.slice(),
name: "localforage",
size: 4980736,
storeName: "keyvaluepairs",
version: 1,
};
function ec() {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e];
if (t)
for (var n in t)
t.hasOwnProperty(n) &&
(et(t[n])
? (arguments[0][n] = t[n].slice())
: (arguments[0][n] = t[n]));
}
return arguments[0];
}
t.exports = new ((function () {
function e(t) {
if (!(this instanceof e))
throw TypeError("Cannot call a class as a function");
for (var n in eo)
if (eo.hasOwnProperty(n)) {
var r = eo[n],
o = r._driver;
(this[n] = o), en[o] || this.defineDriver(r);
}
(this._defaultConfig = ec({}, es)),
(this._config = ec({}, this._defaultConfig, t)),
(this._driverSet = null),
(this._initDriver = null),
(this._ready = !1),
(this._dbInfo = null),
this._wrapLibraryMethodsWithReady(),
this.setDriver(this._config.driver).catch(function () {});
}
return (
(e.prototype.config = function (e) {
if ((void 0 === e ? "undefined" : r(e)) === "object") {
if (this._ready)
return Error(
"Can't call config() after localforage has been used.",
);
for (var t in e) {
if (
("storeName" === t && (e[t] = e[t].replace(/\W/g, "_")),
"version" === t && "number" != typeof e[t])
)
return Error("Database version must be a number.");
this._config[t] = e[t];
}
return (
!("driver" in e) ||
!e.driver ||
this.setDriver(this._config.driver)
);
}
return "string" == typeof e ? this._config[e] : this._config;
}),
(e.prototype.defineDriver = function (e, t, n) {
var r = new i(function (t, n) {
try {
var r = e._driver,
o = Error(
"Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver",
);
if (!e._driver) return void n(o);
for (
var a = el.concat("_initStorage"), s = 0, c = a.length;
s < c;
s++
) {
var d = a[s];
if ((!ee(ei, d) || e[d]) && "function" != typeof e[d])
return void n(o);
}
for (
var u = function (e) {
return function () {
var t = Error(
"Method " +
e +
" is not implemented by the current driver",
),
n = i.reject(t);
return l(n, arguments[arguments.length - 1]), n;
};
},
f = 0,
m = ei.length;
f < m;
f++
) {
var p = ei[f];
e[p] || (e[p] = u(p));
}
var g = function (n) {
en[r] &&
console.info("Redefining LocalForage driver: " + r),
(en[r] = e),
(er[r] = n),
t();
};
"_support" in e
? e._support && "function" == typeof e._support
? e._support().then(g, n)
: g(!!e._support)
: g(!0);
} catch (e) {
n(e);
}
});
return s(r, t, n), r;
}),
(e.prototype.driver = function () {
return this._driver || null;
}),
(e.prototype.getDriver = function (e, t, n) {
var r = en[e]
? i.resolve(en[e])
: i.reject(Error("Driver not found."));
return s(r, t, n), r;
}),
(e.prototype.getSerializer = function (e) {
var t = i.resolve(G);
return s(t, e), t;
}),
(e.prototype.ready = function (e) {
var t = this,
n = t._driverSet.then(function () {
return (
null === t._ready && (t._ready = t._initDriver()),
t._ready
);
});
return s(n, e, e), n;
}),
(e.prototype.setDriver = function (e, t, n) {
var r = this;
et(e) || (e = [e]);
var o = this._getSupportedDrivers(e);
function a() {
r._config.driver = r.driver();
}
function l(e) {
return (
r._extend(e),
a(),
(r._ready = r._initStorage(r._config)),
r._ready
);
}
var c =
null !== this._driverSet
? this._driverSet.catch(function () {
return i.resolve();
})
: i.resolve();
return (
(this._driverSet = c
.then(function () {
var e = o[0];
return (
(r._dbInfo = null),
(r._ready = null),
r.getDriver(e).then(function (e) {
(r._driver = e._driver),
a(),
r._wrapLibraryMethodsWithReady(),
(r._initDriver = function () {
var e = 0;
return (function t() {
for (; e < o.length; ) {
var n = o[e];
return (
e++,
(r._dbInfo = null),
(r._ready = null),
r.getDriver(n).then(l).catch(t)
);
}
a();
var s = Error(
"No available storage method found.",
);
return (
(r._driverSet = i.reject(s)), r._driverSet
);
})();
});
})
);
})
.catch(function () {
a();
var e = Error("No available storage method found.");
return (r._driverSet = i.reject(e)), r._driverSet;
})),
s(this._driverSet, t, n),
this._driverSet
);
}),
(e.prototype.supports = function (e) {
return !!er[e];
}),
(e.prototype._extend = function (e) {
ec(this, e);
}),
(e.prototype._getSupportedDrivers = function (e) {
for (var t = [], n = 0, r = e.length; n < r; n++) {
var o = e[n];
this.supports(o) && t.push(o);
}
return t;
}),
(e.prototype._wrapLibraryMethodsWithReady = function () {
for (var e = 0, t = el.length; e < t; e++)
!(function (e, t) {
e[t] = function () {
var n = arguments;
return e.ready().then(function () {
return e[t].apply(e, n);
});
};
})(this, el[e]);
}),
(e.prototype.createInstance = function (t) {
return new e(t);
}),
e
);
})())();
},
{ 3: 3 },
],
},
{},
[4],
)(4);
};
export default moduleFactory;