@delta-comic/db 2.2.0 → 3.0.0-next.5
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.d.mts +516 -0
- package/dist/index.mjs +705 -0
- package/dist/index.mjs.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/web-Bv0LYYK_.mjs +91 -0
- package/dist/web-Bv0LYYK_.mjs.map +1 -0
- package/package.json +22 -25
- package/README.md +0 -42
- package/dist/esm-DHmh9Ibw.js +0 -2
- package/dist/esm-DrkZJn8m.js +0 -7902
- package/dist/esm-DrkZJn8m.js.map +0 -1
- package/dist/index.js +0 -968
- package/dist/index.js.map +0 -1
- package/dist/lib/favourite.d.ts +0 -100
- package/dist/lib/history.d.ts +0 -60
- package/dist/lib/index.d.ts +0 -25
- package/dist/lib/itemStore.d.ts +0 -37
- package/dist/lib/migrations/1_initial.d.ts +0 -8
- package/dist/lib/migrations/2_fix-display_name.d.ts +0 -8
- package/dist/lib/migrations/3_fix_fvi_foreign_key.d.ts +0 -8
- package/dist/lib/nativeStore/index.d.ts +0 -2
- package/dist/lib/plugin.d.ts +0 -109
- package/dist/lib/recentView.d.ts +0 -59
- package/dist/lib/subscribe.d.ts +0 -75
- package/dist/lib/utils.d.ts +0 -7
- package/dist/pack.tgz +0 -0
package/dist/index.js
DELETED
|
@@ -1,968 +0,0 @@
|
|
|
1
|
-
import { Pn as e, Wr as t, c as n, lr as r, n as i, r as a, s as o, sn as s, t as c, u as l, y as u } from "./esm-DrkZJn8m.js";
|
|
2
|
-
import { useGlobalVar as d } from "@delta-comic/utils";
|
|
3
|
-
import { defineMutation as f, useMutation as p, useQuery as m, useQueryCache as h } from "@pinia/colada";
|
|
4
|
-
import { SourcedValue as g, Struct as _, uni as v } from "@delta-comic/model";
|
|
5
|
-
import { computed as y, customRef as b, getCurrentInstance as x, nextTick as S, onMounted as C, readonly as w, ref as T, shallowRef as ee, toRef as E, toValue as D, unref as O, watch as k } from "vue";
|
|
6
|
-
//#region \0rolldown/runtime.js
|
|
7
|
-
var A = Object.defineProperty, j = (e, t) => {
|
|
8
|
-
let n = {};
|
|
9
|
-
for (var r in e) A(n, r, {
|
|
10
|
-
get: e[r],
|
|
11
|
-
enumerable: !0
|
|
12
|
-
});
|
|
13
|
-
return t || A(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
14
|
-
};
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region lib/migrations/1_initial.ts
|
|
17
|
-
async function te(e) {
|
|
18
|
-
await e.schema.createTable("itemStore").addColumn("key", "text", (e) => e.primaryKey().notNull()).addColumn("item", "text", (e) => e.notNull()).execute(), await e.schema.createIndex("item_store_key").on("itemStore").column("key").execute(), await e.schema.createTable("history").addColumn("ep", "text", (e) => e.notNull()).addColumn("timestamp", "datetime", (e) => e.notNull().primaryKey()).addColumn("itemKey", "text", (e) => e.notNull().unique()).addForeignKeyConstraint("itemKeyForeign", ["itemKey"], "itemStore", ["key"], (e) => e.onDelete("cascade")).execute(), await e.schema.createIndex("history_timestamp").on("history").column("timestamp desc").execute(), await e.schema.createTable("recentView").addColumn("timestamp", "datetime", (e) => e.notNull().primaryKey()).addColumn("itemKey", "text", (e) => e.notNull().unique()).addForeignKeyConstraint("itemKeyForeign", ["itemKey"], "itemStore", ["key"], (e) => e.onDelete("cascade")).addColumn("isViewed", "boolean", (e) => e.notNull()).execute(), await e.schema.createIndex("recent_timestamp").on("recentView").column("timestamp desc").execute(), await e.schema.createTable("favouriteCard").addColumn("createAt", "datetime", (e) => e.notNull().primaryKey()).addColumn("title", "text", (e) => e.notNull()).addColumn("private", "boolean", (e) => e.notNull()).addColumn("description", "text", (e) => e.notNull()).execute(), await e.insertInto("favouriteCard").values({
|
|
19
|
-
createAt: 0,
|
|
20
|
-
title: "默认收藏夹",
|
|
21
|
-
private: !1,
|
|
22
|
-
description: ""
|
|
23
|
-
}).execute(), await e.schema.createIndex("favourite_card_title_createAt").on("favouriteCard").column("createAt desc").column("title").execute(), await e.schema.createTable("favouriteItem").addColumn("addTime", "datetime", (e) => e.notNull()).addColumn("belongTo", "integer", (e) => e.notNull()).addColumn("itemKey", "text", (e) => e.notNull()).addPrimaryKeyConstraint("primary_key", [
|
|
24
|
-
"addTime",
|
|
25
|
-
"belongTo",
|
|
26
|
-
"itemKey"
|
|
27
|
-
]).addUniqueConstraint("uniqueKey", ["belongTo", "itemKey"]).addForeignKeyConstraint("itemKeyForeign", ["itemKey"], "itemStore", ["createAt"], (e) => e.onDelete("cascade")).addForeignKeyConstraint("belongToForeign", ["belongTo"], "favouriteCard", ["key"], (e) => e.onDelete("cascade")).execute(), await e.schema.createIndex("favourite_item_belongTo_addTime").on("favouriteItem").column("addTime desc").column("belongTo").execute(), await e.schema.createTable("subscribe").addColumn("itemKey", "text").addForeignKeyConstraint("itemKeyForeign", ["itemKey"], "itemStore", ["key"], (e) => e.onDelete("cascade")).addColumn("author", "text").addColumn("type", "text", (e) => e.notNull()).addColumn("key", "text", (e) => e.notNull()).addColumn("plugin", "text", (e) => e.notNull()).addPrimaryKeyConstraint("primary_key", ["plugin", "key"]).execute(), await e.schema.createIndex("subscribe_key_plugin").on("subscribe").column("key").column("plugin").execute(), await e.schema.createTable("plugin").addColumn("installerName", "text", (e) => e.notNull()).addColumn("loaderName", "text", (e) => e.notNull()).addColumn("pluginName", "text", (e) => e.notNull().primaryKey()).addColumn("meta", "json", (e) => e.notNull()).addColumn("enable", "text", (e) => e.notNull()).addColumn("installInput", "text", (e) => e.notNull()).execute(), await e.schema.createIndex("plugin_enable").on("plugin").column("enable").execute(), await e.schema.createIndex("plugin_pluginName").on("plugin").column("pluginName").execute();
|
|
28
|
-
}
|
|
29
|
-
async function ne(e) {
|
|
30
|
-
await e.schema.dropTable("itemStore").ifExists().execute(), await e.schema.dropTable("history").ifExists().execute(), await e.schema.dropTable("recentView").ifExists().execute(), await e.schema.dropTable("favouriteCard").ifExists().execute(), await e.schema.dropTable("favouriteItem").ifExists().execute(), await e.schema.dropTable("subscribe").ifExists().execute(), await e.schema.dropTable("plugin").ifExists().execute();
|
|
31
|
-
}
|
|
32
|
-
var re = {
|
|
33
|
-
up: te,
|
|
34
|
-
down: ne
|
|
35
|
-
};
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region lib/migrations/2_fix-display_name.ts
|
|
38
|
-
async function ie(e) {
|
|
39
|
-
await e.schema.alterTable("plugin").addColumn("displayName", "text").execute();
|
|
40
|
-
}
|
|
41
|
-
async function ae(e) {
|
|
42
|
-
await e.schema.alterTable("plugin").dropColumn("displayName").execute();
|
|
43
|
-
}
|
|
44
|
-
var oe = {
|
|
45
|
-
up: ie,
|
|
46
|
-
down: ae
|
|
47
|
-
};
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region lib/migrations/3_fix_fvi_foreign_key.ts
|
|
50
|
-
async function se(e) {
|
|
51
|
-
await e.schema.alterTable("favouriteItem").renameTo("favouriteItem_old").execute(), await e.schema.createTable("favouriteItem").addColumn("addTime", "datetime", (e) => e.notNull()).addColumn("belongTo", "integer", (e) => e.notNull()).addColumn("itemKey", "text", (e) => e.notNull()).addPrimaryKeyConstraint("primary_key", [
|
|
52
|
-
"addTime",
|
|
53
|
-
"belongTo",
|
|
54
|
-
"itemKey"
|
|
55
|
-
]).addUniqueConstraint("uniqueKey", ["belongTo", "itemKey"]).addForeignKeyConstraint("itemKeyForeign", ["itemKey"], "itemStore", ["key"], (e) => e.onDelete("cascade")).addForeignKeyConstraint("belongToForeign", ["belongTo"], "favouriteCard", ["createAt"], (e) => e.onDelete("cascade")).execute(), await e.insertInto("favouriteItem").columns([
|
|
56
|
-
"addTime",
|
|
57
|
-
"belongTo",
|
|
58
|
-
"itemKey"
|
|
59
|
-
]).expression((e) => e.selectFrom("favouriteItem_old").select([
|
|
60
|
-
"addTime",
|
|
61
|
-
"belongTo",
|
|
62
|
-
"itemKey"
|
|
63
|
-
])).execute(), await e.schema.dropTable("favouriteItem_old").execute(), await e.schema.createIndex("favourite_item_belongTo_addTime").on("favouriteItem").column("addTime desc").column("belongTo").execute();
|
|
64
|
-
}
|
|
65
|
-
async function ce(e) {
|
|
66
|
-
await e.schema.alterTable("favouriteItem").renameTo("favouriteItem_new").execute(), await e.schema.createTable("favouriteItem").addColumn("addTime", "datetime", (e) => e.notNull()).addColumn("belongTo", "integer", (e) => e.notNull()).addColumn("itemKey", "text", (e) => e.notNull()).addPrimaryKeyConstraint("primary_key", [
|
|
67
|
-
"addTime",
|
|
68
|
-
"belongTo",
|
|
69
|
-
"itemKey"
|
|
70
|
-
]).addUniqueConstraint("uniqueKey", ["belongTo", "itemKey"]).addForeignKeyConstraint("itemKeyForeign", ["itemKey"], "itemStore", ["createAt"], (e) => e.onDelete("cascade")).addForeignKeyConstraint("belongToForeign", ["belongTo"], "favouriteCard", ["key"], (e) => e.onDelete("cascade")).execute(), await e.insertInto("favouriteItem").columns([
|
|
71
|
-
"addTime",
|
|
72
|
-
"belongTo",
|
|
73
|
-
"itemKey"
|
|
74
|
-
]).expression((e) => e.selectFrom("favouriteItem_new").select([
|
|
75
|
-
"addTime",
|
|
76
|
-
"belongTo",
|
|
77
|
-
"itemKey"
|
|
78
|
-
])).execute(), await e.schema.dropTable("favouriteItem_new").execute(), await e.schema.createIndex("favourite_item_belongTo_addTime").on("favouriteItem").column("addTime desc").column("belongTo").execute();
|
|
79
|
-
}
|
|
80
|
-
var le = {
|
|
81
|
-
up: se,
|
|
82
|
-
down: ce
|
|
83
|
-
};
|
|
84
|
-
async function M(e, t = {}, n) {
|
|
85
|
-
return window.__TAURI_INTERNALS__.invoke(e, t, n);
|
|
86
|
-
}
|
|
87
|
-
//#endregion
|
|
88
|
-
//#region ../../node_modules/.pnpm/@tauri-apps+plugin-sql@2.4.0/node_modules/@tauri-apps/plugin-sql/dist-js/index.js
|
|
89
|
-
var ue = class e {
|
|
90
|
-
constructor(e) {
|
|
91
|
-
this.path = e;
|
|
92
|
-
}
|
|
93
|
-
static async load(t) {
|
|
94
|
-
return new e(await M("plugin:sql|load", { db: t }));
|
|
95
|
-
}
|
|
96
|
-
static get(t) {
|
|
97
|
-
return new e(t);
|
|
98
|
-
}
|
|
99
|
-
async execute(e, t) {
|
|
100
|
-
let [n, r] = await M("plugin:sql|execute", {
|
|
101
|
-
db: this.path,
|
|
102
|
-
query: e,
|
|
103
|
-
values: t ?? []
|
|
104
|
-
});
|
|
105
|
-
return {
|
|
106
|
-
lastInsertId: r,
|
|
107
|
-
rowsAffected: n
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
async select(e, t) {
|
|
111
|
-
return await M("plugin:sql|select", {
|
|
112
|
-
db: this.path,
|
|
113
|
-
query: e,
|
|
114
|
-
values: t ?? []
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
async close(e) {
|
|
118
|
-
return await M("plugin:sql|close", { db: e });
|
|
119
|
-
}
|
|
120
|
-
}, de = class {
|
|
121
|
-
constructor(e) {
|
|
122
|
-
this.createDriver = e;
|
|
123
|
-
}
|
|
124
|
-
createDriver;
|
|
125
|
-
createQueryCompiler() {
|
|
126
|
-
return new n();
|
|
127
|
-
}
|
|
128
|
-
createAdapter() {
|
|
129
|
-
return new i();
|
|
130
|
-
}
|
|
131
|
-
createIntrospector(e) {
|
|
132
|
-
return new a(e);
|
|
133
|
-
}
|
|
134
|
-
}, fe = class {
|
|
135
|
-
promise;
|
|
136
|
-
resolve;
|
|
137
|
-
async lock() {
|
|
138
|
-
for (; this.promise;) await this.promise;
|
|
139
|
-
this.promise = new Promise((e) => {
|
|
140
|
-
this.resolve = e;
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
unlock() {
|
|
144
|
-
let e = this.resolve;
|
|
145
|
-
this.promise = void 0, this.resolve = void 0, e?.();
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
async function N(e, n, i, a, o) {
|
|
149
|
-
await i.executeQuery(o(r.createWithChildren([r.createWithSql(`${e} `), t.create(a)]), n()));
|
|
150
|
-
}
|
|
151
|
-
var pe = class {
|
|
152
|
-
mutex = new fe();
|
|
153
|
-
conn;
|
|
154
|
-
savepoint;
|
|
155
|
-
releaseSavepoint;
|
|
156
|
-
rollbackToSavepoint;
|
|
157
|
-
init;
|
|
158
|
-
constructor(e) {
|
|
159
|
-
this.init = () => import("./esm-DHmh9Ibw.js").then(({ createQueryId: e }) => {
|
|
160
|
-
e && (this.savepoint = N.bind(null, "savepoint", e), this.releaseSavepoint = N.bind(null, "release", e), this.rollbackToSavepoint = N.bind(null, "rollback to", e));
|
|
161
|
-
}).then(e);
|
|
162
|
-
}
|
|
163
|
-
async acquireConnection() {
|
|
164
|
-
return await this.mutex.lock(), this.conn;
|
|
165
|
-
}
|
|
166
|
-
async beginTransaction(e) {
|
|
167
|
-
await e.executeQuery(l.raw("begin"));
|
|
168
|
-
}
|
|
169
|
-
async commitTransaction(e) {
|
|
170
|
-
await e.executeQuery(l.raw("commit"));
|
|
171
|
-
}
|
|
172
|
-
async rollbackTransaction(e) {
|
|
173
|
-
await e.executeQuery(l.raw("rollback"));
|
|
174
|
-
}
|
|
175
|
-
async releaseConnection() {
|
|
176
|
-
this.mutex.unlock();
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
function me(e) {
|
|
180
|
-
return async (t, n, r) => {
|
|
181
|
-
let i = await e.all(n, r);
|
|
182
|
-
return t || i.length ? { rows: i } : {
|
|
183
|
-
rows: [],
|
|
184
|
-
...await e.run("select 1")
|
|
185
|
-
};
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
function P(e) {
|
|
189
|
-
return e == null ? void 0 : BigInt(e);
|
|
190
|
-
}
|
|
191
|
-
//#endregion
|
|
192
|
-
//#region ../../node_modules/.pnpm/kysely-generic-sqlite@1.2.1_kysely@0.28.13/node_modules/kysely-generic-sqlite/dist/index.js
|
|
193
|
-
var he = class extends pe {
|
|
194
|
-
db;
|
|
195
|
-
constructor(e, t) {
|
|
196
|
-
super(async () => {
|
|
197
|
-
this.db = await e(), this.conn = new ge(this.db), await t?.(this.conn);
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
async destroy() {
|
|
201
|
-
await this.db?.close();
|
|
202
|
-
}
|
|
203
|
-
}, ge = class {
|
|
204
|
-
constructor(e) {
|
|
205
|
-
this.db = e;
|
|
206
|
-
}
|
|
207
|
-
async *streamQuery({ parameters: t, query: n, sql: r }) {
|
|
208
|
-
if (!this.db.iterator) throw Error("streamQuery() is not supported.");
|
|
209
|
-
let i = this.db.iterator(e.is(n), r, t);
|
|
210
|
-
for await (let e of i) yield { rows: [e] };
|
|
211
|
-
}
|
|
212
|
-
async executeQuery({ parameters: t, query: n, sql: r }) {
|
|
213
|
-
return await this.db.query(e.is(n), r, t);
|
|
214
|
-
}
|
|
215
|
-
}, _e = class extends de {
|
|
216
|
-
constructor(e, t) {
|
|
217
|
-
super(() => new he(e, t));
|
|
218
|
-
}
|
|
219
|
-
}, ve = class extends _e {
|
|
220
|
-
constructor(e) {
|
|
221
|
-
let { database: t, onCreateConnection: n } = e;
|
|
222
|
-
super(async () => {
|
|
223
|
-
let e = typeof t == "function" ? await t("sqlite:") : t;
|
|
224
|
-
return {
|
|
225
|
-
db: e,
|
|
226
|
-
query: me({
|
|
227
|
-
all: async (t, n) => await e.select(t, n),
|
|
228
|
-
run: async (t, n) => {
|
|
229
|
-
let { rowsAffected: r, lastInsertId: i } = await e.execute(t, n);
|
|
230
|
-
return {
|
|
231
|
-
numAffectedRows: P(r),
|
|
232
|
-
insertId: P(i)
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
}),
|
|
236
|
-
close: async () => await e.close()
|
|
237
|
-
};
|
|
238
|
-
}, n);
|
|
239
|
-
}
|
|
240
|
-
}, ye = class extends s {
|
|
241
|
-
serializer;
|
|
242
|
-
constructor(e) {
|
|
243
|
-
super(), this.serializer = e;
|
|
244
|
-
}
|
|
245
|
-
transformPrimitiveValueList(e) {
|
|
246
|
-
return {
|
|
247
|
-
...e,
|
|
248
|
-
values: e.values.map(this.serializer)
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
transformColumnUpdate(e) {
|
|
252
|
-
let { value: t } = e;
|
|
253
|
-
if (t.kind !== "ValueNode") return super.transformColumnUpdate(e);
|
|
254
|
-
let { value: n, ...r } = t, i = this.serializer(n);
|
|
255
|
-
return n === i ? super.transformColumnUpdate(e) : super.transformColumnUpdate({
|
|
256
|
-
...e,
|
|
257
|
-
value: {
|
|
258
|
-
...r,
|
|
259
|
-
value: i
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
transformValue(e) {
|
|
264
|
-
return {
|
|
265
|
-
...e,
|
|
266
|
-
value: this.serializer(e.value)
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
}, be = (e) => {
|
|
270
|
-
if (F(e) || typeof e == "string") return e;
|
|
271
|
-
if (typeof e == "boolean") return "" + e;
|
|
272
|
-
if (e instanceof Date) return e.toISOString();
|
|
273
|
-
try {
|
|
274
|
-
return JSON.stringify(e);
|
|
275
|
-
} catch {
|
|
276
|
-
return e;
|
|
277
|
-
}
|
|
278
|
-
}, xe = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?Z?$/, Se = (e) => {
|
|
279
|
-
if (F(e)) return e;
|
|
280
|
-
if (typeof e == "string") {
|
|
281
|
-
if (e === "true") return !0;
|
|
282
|
-
if (e === "false") return !1;
|
|
283
|
-
if (xe.test(e)) return new Date(e);
|
|
284
|
-
if (Ce(e)) try {
|
|
285
|
-
return JSON.parse(e);
|
|
286
|
-
} catch {}
|
|
287
|
-
return e;
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
function Ce(e) {
|
|
291
|
-
return e.startsWith("{") && e.endsWith("}") || e.startsWith("[") && e.endsWith("]");
|
|
292
|
-
}
|
|
293
|
-
function F(e) {
|
|
294
|
-
return e == null || typeof e == "bigint" || typeof e == "number" || typeof e == "object" && "buffer" in e;
|
|
295
|
-
}
|
|
296
|
-
var we = class {
|
|
297
|
-
transformer;
|
|
298
|
-
deserializer;
|
|
299
|
-
skipNodeSet;
|
|
300
|
-
ctx;
|
|
301
|
-
constructor(e, t, n) {
|
|
302
|
-
this.transformer = new ye(e), this.deserializer = t, n.length && (this.skipNodeSet = new Set(n), this.ctx = /* @__PURE__ */ new WeakSet());
|
|
303
|
-
}
|
|
304
|
-
transformQuery({ node: e, queryId: t }) {
|
|
305
|
-
return this.skipNodeSet?.has(e.kind) ? (this.ctx?.add(t), e) : this.transformer.transformNode(e);
|
|
306
|
-
}
|
|
307
|
-
async transformResult({ result: e, queryId: t }) {
|
|
308
|
-
return this.ctx?.has(t) ? e : {
|
|
309
|
-
...e,
|
|
310
|
-
rows: this.parseRows(e.rows)
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
parseRows(e) {
|
|
314
|
-
let t = [];
|
|
315
|
-
for (let n of e) {
|
|
316
|
-
if (!n) continue;
|
|
317
|
-
let e = {};
|
|
318
|
-
for (let [t, r] of Object.entries(n)) e[t] = this.deserializer(r);
|
|
319
|
-
t.push(e);
|
|
320
|
-
}
|
|
321
|
-
return t;
|
|
322
|
-
}
|
|
323
|
-
}, Te = class extends we {
|
|
324
|
-
constructor(e = {}) {
|
|
325
|
-
let { deserializer: t = Se, serializer: n = be, skipNodeKind: r = [] } = e;
|
|
326
|
-
super(n, t, r);
|
|
327
|
-
}
|
|
328
|
-
}, Ee = /* @__PURE__ */ j({
|
|
329
|
-
CommonQueryKey: () => L,
|
|
330
|
-
countDb: () => De,
|
|
331
|
-
withTransition: () => I
|
|
332
|
-
}), I = async (e, t) => {
|
|
333
|
-
if (t) return await e(t);
|
|
334
|
-
{
|
|
335
|
-
let { db: t } = await import("./index.js");
|
|
336
|
-
return await t.transaction().setAccessMode("read write").setIsolationLevel("read committed").execute(e);
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
async function De(e) {
|
|
340
|
-
return (await e.select((e) => e.fn.countAll().as("count")).executeTakeFirstOrThrow()).count;
|
|
341
|
-
}
|
|
342
|
-
var L = /* @__PURE__ */ function(e) {
|
|
343
|
-
return e.common = "db", e;
|
|
344
|
-
}({}), Oe = /* @__PURE__ */ j({
|
|
345
|
-
QueryKey: () => R,
|
|
346
|
-
useQuery: () => Me,
|
|
347
|
-
useRemove: () => Ae,
|
|
348
|
-
useToggleEnable: () => je,
|
|
349
|
-
useUpsert: () => ke
|
|
350
|
-
}), R = /* @__PURE__ */ function(e) {
|
|
351
|
-
return e.item = "db:plugin:", e;
|
|
352
|
-
}({}), ke = f(() => {
|
|
353
|
-
let e = h(), t = [L.common, R.item], { mutateAsync: n, ...r } = p({
|
|
354
|
-
mutation: async ({ archives: e, trx: t }) => I(async (t) => {
|
|
355
|
-
await t.replaceInto("plugin").values(e.map((e) => ({
|
|
356
|
-
...e,
|
|
357
|
-
meta: JSON.stringify(e.meta)
|
|
358
|
-
}))).execute();
|
|
359
|
-
}, t),
|
|
360
|
-
onSettled: () => {
|
|
361
|
-
e.invalidateQueries({ key: t });
|
|
362
|
-
},
|
|
363
|
-
key: t
|
|
364
|
-
});
|
|
365
|
-
return {
|
|
366
|
-
...r,
|
|
367
|
-
upsert: n,
|
|
368
|
-
key: t
|
|
369
|
-
};
|
|
370
|
-
}), Ae = f(() => {
|
|
371
|
-
let e = h(), t = [L.common, R.item], { mutateAsync: n, ...r } = p({
|
|
372
|
-
mutation: async ({ keys: e, trx: t }) => I(async (t) => {
|
|
373
|
-
await t.deleteFrom("plugin").where("plugin.pluginName", "is", e).execute();
|
|
374
|
-
}, t),
|
|
375
|
-
onSettled: () => {
|
|
376
|
-
e.invalidateQueries({ key: t });
|
|
377
|
-
},
|
|
378
|
-
key: t
|
|
379
|
-
});
|
|
380
|
-
return {
|
|
381
|
-
...r,
|
|
382
|
-
remove: n,
|
|
383
|
-
key: t
|
|
384
|
-
};
|
|
385
|
-
}), je = f(() => {
|
|
386
|
-
let e = h(), t = [L.common, R.item], { mutateAsync: n, ...r } = p({
|
|
387
|
-
mutation: async ({ keys: e, trx: t }) => I(async (t) => {
|
|
388
|
-
for (let n of e) {
|
|
389
|
-
let e = await t.selectFrom("plugin").where("pluginName", "=", n).select("enable").executeTakeFirstOrThrow();
|
|
390
|
-
return t.updateTable("plugin").where("pluginName", "=", n).set({ enable: !e.enable }).execute();
|
|
391
|
-
}
|
|
392
|
-
}, t),
|
|
393
|
-
onSettled: () => {
|
|
394
|
-
e.invalidateQueries({ key: t });
|
|
395
|
-
},
|
|
396
|
-
key: t
|
|
397
|
-
});
|
|
398
|
-
return {
|
|
399
|
-
...r,
|
|
400
|
-
toggle: n,
|
|
401
|
-
key: t
|
|
402
|
-
};
|
|
403
|
-
}), Me = (e, t = [], n) => m({
|
|
404
|
-
query: async () => {
|
|
405
|
-
let { db: t } = await import("./index.js");
|
|
406
|
-
return await e(t.selectFrom("plugin"));
|
|
407
|
-
},
|
|
408
|
-
key: () => [
|
|
409
|
-
L.common,
|
|
410
|
-
R.item,
|
|
411
|
-
e
|
|
412
|
-
].concat(t),
|
|
413
|
-
staleTime: 15e3,
|
|
414
|
-
refetchOnMount: "always",
|
|
415
|
-
initialData: n,
|
|
416
|
-
initialDataUpdatedAt: 0
|
|
417
|
-
}), Ne = /* @__PURE__ */ j({
|
|
418
|
-
QueryKey: () => B,
|
|
419
|
-
itemKey: () => z,
|
|
420
|
-
useUpsert: () => V
|
|
421
|
-
}), z = new g("*"), B = /* @__PURE__ */ function(e) {
|
|
422
|
-
return e.item = "db:itemStore:", e;
|
|
423
|
-
}({}), V = f(() => {
|
|
424
|
-
let e = h(), t = [L.common, B.item], { mutateAsync: n, ...r } = p({
|
|
425
|
-
mutation: async ({ item: e, trx: t }) => I(async (t) => {
|
|
426
|
-
let n = z.toString([v.content.ContentPage.contentPages.key.toString(e.contentType), e.id]);
|
|
427
|
-
return await t.replaceInto("itemStore").values({
|
|
428
|
-
item: _.toRaw(e),
|
|
429
|
-
key: n
|
|
430
|
-
}).execute(), n;
|
|
431
|
-
}, t),
|
|
432
|
-
onSettled: () => {
|
|
433
|
-
e.invalidateQueries({ key: t });
|
|
434
|
-
},
|
|
435
|
-
key: t
|
|
436
|
-
});
|
|
437
|
-
return {
|
|
438
|
-
...r,
|
|
439
|
-
upsert: n,
|
|
440
|
-
key: t
|
|
441
|
-
};
|
|
442
|
-
}), Pe = /* @__PURE__ */ j({
|
|
443
|
-
QueryKey: () => H,
|
|
444
|
-
useCreateCard: () => Le,
|
|
445
|
-
useMoveItem: () => Ie,
|
|
446
|
-
useQueryCard: () => ze,
|
|
447
|
-
useQueryItem: () => Re,
|
|
448
|
-
useUpsertItem: () => Fe
|
|
449
|
-
}), H = /* @__PURE__ */ function(e) {
|
|
450
|
-
return e.item = "db:favouriteItem:", e.card = "db:favouriteCard:", e;
|
|
451
|
-
}({}), Fe = f(() => {
|
|
452
|
-
let e = h(), { key: t, upsert: n } = V(), r = [
|
|
453
|
-
L.common,
|
|
454
|
-
H.item,
|
|
455
|
-
...t
|
|
456
|
-
], { mutateAsync: i, ...a } = p({
|
|
457
|
-
mutation: async ({ item: e, belongTos: t, trx: r }) => I(async (r) => {
|
|
458
|
-
let i = await n({
|
|
459
|
-
item: e,
|
|
460
|
-
trx: r
|
|
461
|
-
});
|
|
462
|
-
await r.replaceInto("favouriteItem").values(t.map((e) => ({
|
|
463
|
-
addTime: Date.now(),
|
|
464
|
-
itemKey: i,
|
|
465
|
-
belongTo: e
|
|
466
|
-
}))).execute();
|
|
467
|
-
}, r),
|
|
468
|
-
onSettled: () => {
|
|
469
|
-
e.invalidateQueries({ key: r });
|
|
470
|
-
},
|
|
471
|
-
key: r
|
|
472
|
-
});
|
|
473
|
-
return {
|
|
474
|
-
...a,
|
|
475
|
-
upsert: i,
|
|
476
|
-
key: r
|
|
477
|
-
};
|
|
478
|
-
}), Ie = f(() => {
|
|
479
|
-
let e = h(), t = [H.item], { mutateAsync: n, ...r } = p({
|
|
480
|
-
mutation: async ({ item: e, from: t, aims: n, trx: r }) => I(async (r) => {
|
|
481
|
-
await r.deleteFrom("favouriteItem").where("itemKey", "=", e.id).where("belongTo", "=", t).execute(), await r.replaceInto("favouriteItem").values(n.map((t) => ({
|
|
482
|
-
addTime: Date.now(),
|
|
483
|
-
itemKey: e.id,
|
|
484
|
-
belongTo: t
|
|
485
|
-
}))).execute();
|
|
486
|
-
}, r),
|
|
487
|
-
onSettled: () => {
|
|
488
|
-
e.invalidateQueries({ key: t });
|
|
489
|
-
},
|
|
490
|
-
key: t
|
|
491
|
-
});
|
|
492
|
-
return {
|
|
493
|
-
...r,
|
|
494
|
-
move: n,
|
|
495
|
-
key: t
|
|
496
|
-
};
|
|
497
|
-
}), Le = f(() => {
|
|
498
|
-
let e = h(), t = [H.card, H.item], { mutateAsync: n, ...r } = p({
|
|
499
|
-
mutation: async ({ card: e, trx: t }) => I(async (t) => {
|
|
500
|
-
await t.replaceInto("favouriteCard").values(e).execute();
|
|
501
|
-
}, t),
|
|
502
|
-
onSettled: () => {
|
|
503
|
-
e.invalidateQueries({ key: t });
|
|
504
|
-
},
|
|
505
|
-
key: t
|
|
506
|
-
});
|
|
507
|
-
return {
|
|
508
|
-
...r,
|
|
509
|
-
createCard: n,
|
|
510
|
-
key: t
|
|
511
|
-
};
|
|
512
|
-
}), Re = (e, t = [], n) => m({
|
|
513
|
-
query: async () => {
|
|
514
|
-
let { db: t } = await import("./index.js");
|
|
515
|
-
return await e(t.selectFrom("favouriteItem"));
|
|
516
|
-
},
|
|
517
|
-
key: () => [
|
|
518
|
-
H.item,
|
|
519
|
-
H.card,
|
|
520
|
-
e
|
|
521
|
-
].concat(t),
|
|
522
|
-
staleTime: 15e3,
|
|
523
|
-
initialData: n,
|
|
524
|
-
initialDataUpdatedAt: 0
|
|
525
|
-
}), ze = (e, t = [], n) => m({
|
|
526
|
-
query: async () => {
|
|
527
|
-
let { db: t } = await import("./index.js");
|
|
528
|
-
return await e(t.selectFrom("favouriteCard"));
|
|
529
|
-
},
|
|
530
|
-
key: () => [H.card, e].concat(t),
|
|
531
|
-
staleTime: 15e3,
|
|
532
|
-
refetchOnMount: "always",
|
|
533
|
-
initialData: n,
|
|
534
|
-
initialDataUpdatedAt: 0
|
|
535
|
-
}), Be = /* @__PURE__ */ j({
|
|
536
|
-
QueryKey: () => U,
|
|
537
|
-
useQuery: () => Ue,
|
|
538
|
-
useRemove: () => He,
|
|
539
|
-
useUpsert: () => Ve
|
|
540
|
-
}), U = /* @__PURE__ */ function(e) {
|
|
541
|
-
return e.item = "db:history:", e;
|
|
542
|
-
}({}), Ve = f(() => {
|
|
543
|
-
let e = h(), { key: t, upsert: n } = V(), r = [
|
|
544
|
-
L.common,
|
|
545
|
-
U.item,
|
|
546
|
-
...t
|
|
547
|
-
], { mutateAsync: i, ...a } = p({
|
|
548
|
-
mutation: async ({ item: e, trx: t }) => I(async (t) => {
|
|
549
|
-
let r = await n({
|
|
550
|
-
item: e,
|
|
551
|
-
trx: t
|
|
552
|
-
});
|
|
553
|
-
await t.replaceInto("history").values({
|
|
554
|
-
itemKey: r,
|
|
555
|
-
timestamp: Date.now(),
|
|
556
|
-
ep: _.toRaw(e)
|
|
557
|
-
}).execute();
|
|
558
|
-
}, t),
|
|
559
|
-
onSettled: () => {
|
|
560
|
-
e.invalidateQueries({ key: r });
|
|
561
|
-
},
|
|
562
|
-
key: r
|
|
563
|
-
});
|
|
564
|
-
return {
|
|
565
|
-
...a,
|
|
566
|
-
upsert: i,
|
|
567
|
-
key: r
|
|
568
|
-
};
|
|
569
|
-
}), He = f(() => {
|
|
570
|
-
let e = h(), t = [L.common, U.item], { mutateAsync: n, ...r } = p({
|
|
571
|
-
mutation: ({ keys: e, trx: t }) => I(async (t) => {
|
|
572
|
-
await t.deleteFrom("history").where("history.timestamp", "is", e).execute();
|
|
573
|
-
}, t),
|
|
574
|
-
onSettled: () => {
|
|
575
|
-
e.invalidateQueries({ key: t });
|
|
576
|
-
},
|
|
577
|
-
key: t
|
|
578
|
-
});
|
|
579
|
-
return {
|
|
580
|
-
...r,
|
|
581
|
-
remove: n,
|
|
582
|
-
key: t
|
|
583
|
-
};
|
|
584
|
-
}), Ue = (e, t = [], n) => m({
|
|
585
|
-
query: async () => {
|
|
586
|
-
let { db: t } = await import("./index.js");
|
|
587
|
-
return await e(t.selectFrom("history"));
|
|
588
|
-
},
|
|
589
|
-
key: () => [
|
|
590
|
-
L.common,
|
|
591
|
-
U.item,
|
|
592
|
-
e
|
|
593
|
-
].concat(t),
|
|
594
|
-
staleTime: 15e3,
|
|
595
|
-
refetchOnMount: "always",
|
|
596
|
-
initialData: n,
|
|
597
|
-
initialDataUpdatedAt: 0
|
|
598
|
-
}), We = /* @__PURE__ */ j({
|
|
599
|
-
QueryKey: () => W,
|
|
600
|
-
key: () => Ge,
|
|
601
|
-
useQuery: () => Je,
|
|
602
|
-
useRemove: () => qe,
|
|
603
|
-
useUpsert: () => Ke
|
|
604
|
-
}), Ge = new g(), W = /* @__PURE__ */ function(e) {
|
|
605
|
-
return e.item = "db:subscribe:", e;
|
|
606
|
-
}({}), Ke = f(() => {
|
|
607
|
-
let e = h(), t = [L.common, W.item], { mutateAsync: n, ...r } = p({
|
|
608
|
-
mutation: async ({ items: e, trx: t }) => I(async (t) => {
|
|
609
|
-
await t.replaceInto("subscribe").values(e.map((e) => ({
|
|
610
|
-
...e,
|
|
611
|
-
author: JSON.stringify(e.author)
|
|
612
|
-
}))).execute();
|
|
613
|
-
}, t),
|
|
614
|
-
onSettled: () => {
|
|
615
|
-
e.invalidateQueries({ key: t });
|
|
616
|
-
},
|
|
617
|
-
key: t
|
|
618
|
-
});
|
|
619
|
-
return {
|
|
620
|
-
...r,
|
|
621
|
-
upsert: n,
|
|
622
|
-
key: t
|
|
623
|
-
};
|
|
624
|
-
}), qe = f(() => {
|
|
625
|
-
let e = h(), t = [L.common, W.item], { mutateAsync: n, ...r } = p({
|
|
626
|
-
mutation: async ({ keys: e, trx: t }) => I(async (t) => {
|
|
627
|
-
await t.deleteFrom("subscribe").where("subscribe.key", "is", e).execute();
|
|
628
|
-
}, t),
|
|
629
|
-
onSettled: () => {
|
|
630
|
-
e.invalidateQueries({ key: t });
|
|
631
|
-
},
|
|
632
|
-
key: t
|
|
633
|
-
});
|
|
634
|
-
return {
|
|
635
|
-
...r,
|
|
636
|
-
remove: n,
|
|
637
|
-
key: t
|
|
638
|
-
};
|
|
639
|
-
}), Je = (e, t = [], n) => m({
|
|
640
|
-
query: async () => {
|
|
641
|
-
let { db: t } = await import("./index.js");
|
|
642
|
-
return await e(t.selectFrom("subscribe"));
|
|
643
|
-
},
|
|
644
|
-
key: () => [
|
|
645
|
-
L.common,
|
|
646
|
-
W.item,
|
|
647
|
-
e
|
|
648
|
-
].concat(t),
|
|
649
|
-
staleTime: 15e3,
|
|
650
|
-
refetchOnMount: "always",
|
|
651
|
-
initialData: n,
|
|
652
|
-
initialDataUpdatedAt: 0
|
|
653
|
-
}), Ye = /* @__PURE__ */ j({
|
|
654
|
-
QueryKey: () => G,
|
|
655
|
-
useQuery: () => Qe,
|
|
656
|
-
useRemove: () => Ze,
|
|
657
|
-
useUpsert: () => Xe
|
|
658
|
-
}), G = /* @__PURE__ */ function(e) {
|
|
659
|
-
return e.item = "db:recentView:", e;
|
|
660
|
-
}({}), Xe = f(() => {
|
|
661
|
-
let e = h(), { key: t, upsert: n } = V(), r = [
|
|
662
|
-
L.common,
|
|
663
|
-
G.item,
|
|
664
|
-
...t
|
|
665
|
-
], { mutateAsync: i, ...a } = p({
|
|
666
|
-
mutation: async ({ item: e, trx: t }) => I(async (t) => {
|
|
667
|
-
let r = await n({
|
|
668
|
-
item: e,
|
|
669
|
-
trx: t
|
|
670
|
-
});
|
|
671
|
-
await t.replaceInto("recentView").values({
|
|
672
|
-
isViewed: !1,
|
|
673
|
-
itemKey: r,
|
|
674
|
-
timestamp: Date.now()
|
|
675
|
-
}).execute();
|
|
676
|
-
}, t),
|
|
677
|
-
onSettled: () => {
|
|
678
|
-
e.invalidateQueries({ key: r });
|
|
679
|
-
},
|
|
680
|
-
key: r
|
|
681
|
-
});
|
|
682
|
-
return {
|
|
683
|
-
...a,
|
|
684
|
-
upsert: i,
|
|
685
|
-
key: r
|
|
686
|
-
};
|
|
687
|
-
}), Ze = f(() => {
|
|
688
|
-
let e = h(), t = [L.common, G.item], { mutateAsync: n, ...r } = p({
|
|
689
|
-
mutation: async ({ items: e, trx: t }) => I(async (t) => {
|
|
690
|
-
await t.deleteFrom("recentView").where("recentView.timestamp", "is", e).execute();
|
|
691
|
-
}, t),
|
|
692
|
-
onSettled: () => {
|
|
693
|
-
e.invalidateQueries({ key: t });
|
|
694
|
-
},
|
|
695
|
-
key: t
|
|
696
|
-
});
|
|
697
|
-
return {
|
|
698
|
-
...r,
|
|
699
|
-
remove: n,
|
|
700
|
-
key: t
|
|
701
|
-
};
|
|
702
|
-
}), Qe = (e, t = [], n) => m({
|
|
703
|
-
query: async () => {
|
|
704
|
-
let { db: t } = await import("./index.js");
|
|
705
|
-
return await e(t.selectFrom("recentView"));
|
|
706
|
-
},
|
|
707
|
-
key: () => [
|
|
708
|
-
L.common,
|
|
709
|
-
G.item,
|
|
710
|
-
e
|
|
711
|
-
].concat(t),
|
|
712
|
-
staleTime: 15e3,
|
|
713
|
-
refetchOnMount: "always",
|
|
714
|
-
initialData: n,
|
|
715
|
-
initialDataUpdatedAt: 0
|
|
716
|
-
}), K = typeof window < "u" && typeof document < "u";
|
|
717
|
-
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
718
|
-
var $e = Object.prototype.toString, et = (e) => $e.call(e) === "[object Object]", tt = () => {};
|
|
719
|
-
function nt(...e) {
|
|
720
|
-
if (e.length !== 1) return E(...e);
|
|
721
|
-
let t = e[0];
|
|
722
|
-
return typeof t == "function" ? w(b(() => ({
|
|
723
|
-
get: t,
|
|
724
|
-
set: tt
|
|
725
|
-
}))) : T(t);
|
|
726
|
-
}
|
|
727
|
-
function rt(e, t) {
|
|
728
|
-
function n(...n) {
|
|
729
|
-
return new Promise((r, i) => {
|
|
730
|
-
Promise.resolve(e(() => t.apply(this, n), {
|
|
731
|
-
fn: t,
|
|
732
|
-
thisArg: this,
|
|
733
|
-
args: n
|
|
734
|
-
})).then(r).catch(i);
|
|
735
|
-
});
|
|
736
|
-
}
|
|
737
|
-
return n;
|
|
738
|
-
}
|
|
739
|
-
var q = (e) => e();
|
|
740
|
-
function it(e = q, t = {}) {
|
|
741
|
-
let { initialState: n = "active" } = t, r = nt(n === "active");
|
|
742
|
-
function i() {
|
|
743
|
-
r.value = !1;
|
|
744
|
-
}
|
|
745
|
-
function a() {
|
|
746
|
-
r.value = !0;
|
|
747
|
-
}
|
|
748
|
-
return {
|
|
749
|
-
isActive: w(r),
|
|
750
|
-
pause: i,
|
|
751
|
-
resume: a,
|
|
752
|
-
eventFilter: (...t) => {
|
|
753
|
-
r.value && e(...t);
|
|
754
|
-
}
|
|
755
|
-
};
|
|
756
|
-
}
|
|
757
|
-
function J(e) {
|
|
758
|
-
return Array.isArray(e) ? e : [e];
|
|
759
|
-
}
|
|
760
|
-
function at(e) {
|
|
761
|
-
return e || x();
|
|
762
|
-
}
|
|
763
|
-
function ot(e, t, n = {}) {
|
|
764
|
-
let { eventFilter: r = q, ...i } = n;
|
|
765
|
-
return k(e, rt(r, t), i);
|
|
766
|
-
}
|
|
767
|
-
function st(e, t, n = {}) {
|
|
768
|
-
let { eventFilter: r, initialState: i = "active", ...a } = n, { eventFilter: o, pause: s, resume: c, isActive: l } = it(r, { initialState: i });
|
|
769
|
-
return {
|
|
770
|
-
stop: ot(e, t, {
|
|
771
|
-
...a,
|
|
772
|
-
eventFilter: o
|
|
773
|
-
}),
|
|
774
|
-
pause: s,
|
|
775
|
-
resume: c,
|
|
776
|
-
isActive: l
|
|
777
|
-
};
|
|
778
|
-
}
|
|
779
|
-
function ct(e, t = !0, n) {
|
|
780
|
-
at(n) ? C(e, n) : t ? e() : S(e);
|
|
781
|
-
}
|
|
782
|
-
function lt(e, t, n) {
|
|
783
|
-
return k(e, t, {
|
|
784
|
-
...n,
|
|
785
|
-
immediate: !0
|
|
786
|
-
});
|
|
787
|
-
}
|
|
788
|
-
//#endregion
|
|
789
|
-
//#region ../../node_modules/.pnpm/@vueuse+core@14.2.1_vue@3.5.30_typescript@5.9.3_/node_modules/@vueuse/core/dist/index.js
|
|
790
|
-
var Y = K ? window : void 0;
|
|
791
|
-
K && window.document, K && window.navigator, K && window.location;
|
|
792
|
-
function ut(e) {
|
|
793
|
-
let t = D(e);
|
|
794
|
-
return t?.$el ?? t;
|
|
795
|
-
}
|
|
796
|
-
function X(...e) {
|
|
797
|
-
let t = (e, t, n, r) => (e.addEventListener(t, n, r), () => e.removeEventListener(t, n, r)), n = y(() => {
|
|
798
|
-
let t = J(D(e[0])).filter((e) => e != null);
|
|
799
|
-
return t.every((e) => typeof e != "string") ? t : void 0;
|
|
800
|
-
});
|
|
801
|
-
return lt(() => [
|
|
802
|
-
n.value?.map((e) => ut(e)) ?? [Y].filter((e) => e != null),
|
|
803
|
-
J(D(n.value ? e[1] : e[0])),
|
|
804
|
-
J(O(n.value ? e[2] : e[1])),
|
|
805
|
-
D(n.value ? e[3] : e[2])
|
|
806
|
-
], ([e, n, r, i], a, o) => {
|
|
807
|
-
if (!e?.length || !n?.length || !r?.length) return;
|
|
808
|
-
let s = et(i) ? { ...i } : i, c = e.flatMap((e) => n.flatMap((n) => r.map((r) => t(e, n, r, s))));
|
|
809
|
-
o(() => {
|
|
810
|
-
c.forEach((e) => e());
|
|
811
|
-
});
|
|
812
|
-
}, { flush: "post" });
|
|
813
|
-
}
|
|
814
|
-
var Z = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Q = "__vueuse_ssr_handlers__", dt = /* @__PURE__ */ ft();
|
|
815
|
-
function ft() {
|
|
816
|
-
return Q in Z || (Z[Q] = Z[Q] || {}), Z[Q];
|
|
817
|
-
}
|
|
818
|
-
function pt(e, t) {
|
|
819
|
-
return dt[e] || t;
|
|
820
|
-
}
|
|
821
|
-
function mt(e) {
|
|
822
|
-
return e == null ? "any" : e instanceof Set ? "set" : e instanceof Map ? "map" : e instanceof Date ? "date" : typeof e == "boolean" ? "boolean" : typeof e == "string" ? "string" : typeof e == "object" ? "object" : Number.isNaN(e) ? "any" : "number";
|
|
823
|
-
}
|
|
824
|
-
var ht = {
|
|
825
|
-
boolean: {
|
|
826
|
-
read: (e) => e === "true",
|
|
827
|
-
write: (e) => String(e)
|
|
828
|
-
},
|
|
829
|
-
object: {
|
|
830
|
-
read: (e) => JSON.parse(e),
|
|
831
|
-
write: (e) => JSON.stringify(e)
|
|
832
|
-
},
|
|
833
|
-
number: {
|
|
834
|
-
read: (e) => Number.parseFloat(e),
|
|
835
|
-
write: (e) => String(e)
|
|
836
|
-
},
|
|
837
|
-
any: {
|
|
838
|
-
read: (e) => e,
|
|
839
|
-
write: (e) => String(e)
|
|
840
|
-
},
|
|
841
|
-
string: {
|
|
842
|
-
read: (e) => e,
|
|
843
|
-
write: (e) => String(e)
|
|
844
|
-
},
|
|
845
|
-
map: {
|
|
846
|
-
read: (e) => new Map(JSON.parse(e)),
|
|
847
|
-
write: (e) => JSON.stringify(Array.from(e.entries()))
|
|
848
|
-
},
|
|
849
|
-
set: {
|
|
850
|
-
read: (e) => new Set(JSON.parse(e)),
|
|
851
|
-
write: (e) => JSON.stringify(Array.from(e))
|
|
852
|
-
},
|
|
853
|
-
date: {
|
|
854
|
-
read: (e) => new Date(e),
|
|
855
|
-
write: (e) => e.toISOString()
|
|
856
|
-
}
|
|
857
|
-
}, $ = "vueuse-storage";
|
|
858
|
-
function gt(e, t, n, r = {}) {
|
|
859
|
-
let { flush: i = "pre", deep: a = !0, listenToStorageChanges: o = !0, writeDefaults: s = !0, mergeDefaults: c = !1, shallow: l, window: u = Y, eventFilter: d, onError: f = (e) => {
|
|
860
|
-
console.error(e);
|
|
861
|
-
}, initOnMounted: p } = r, m = (l ? ee : T)(typeof t == "function" ? t() : t), h = y(() => D(e));
|
|
862
|
-
if (!n) try {
|
|
863
|
-
n = pt("getDefaultStorage", () => Y?.localStorage)();
|
|
864
|
-
} catch (e) {
|
|
865
|
-
f(e);
|
|
866
|
-
}
|
|
867
|
-
if (!n) return m;
|
|
868
|
-
let g = D(t), _ = mt(g), v = r.serializer ?? ht[_], { pause: b, resume: x } = st(m, (e) => E(e), {
|
|
869
|
-
flush: i,
|
|
870
|
-
deep: a,
|
|
871
|
-
eventFilter: d
|
|
872
|
-
});
|
|
873
|
-
k(h, () => A(), { flush: i });
|
|
874
|
-
let C = !1;
|
|
875
|
-
u && o && (n instanceof Storage ? X(u, "storage", (e) => {
|
|
876
|
-
p && !C || A(e);
|
|
877
|
-
}, { passive: !0 }) : X(u, $, (e) => {
|
|
878
|
-
p && !C || j(e);
|
|
879
|
-
})), p ? ct(() => {
|
|
880
|
-
C = !0, A();
|
|
881
|
-
}) : A();
|
|
882
|
-
function w(e, t) {
|
|
883
|
-
if (u) {
|
|
884
|
-
let r = {
|
|
885
|
-
key: h.value,
|
|
886
|
-
oldValue: e,
|
|
887
|
-
newValue: t,
|
|
888
|
-
storageArea: n
|
|
889
|
-
};
|
|
890
|
-
u.dispatchEvent(n instanceof Storage ? new StorageEvent("storage", r) : new CustomEvent($, { detail: r }));
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
function E(e) {
|
|
894
|
-
try {
|
|
895
|
-
let t = n.getItem(h.value);
|
|
896
|
-
if (e == null) w(t, null), n.removeItem(h.value);
|
|
897
|
-
else {
|
|
898
|
-
let r = v.write(e);
|
|
899
|
-
t !== r && (n.setItem(h.value, r), w(t, r));
|
|
900
|
-
}
|
|
901
|
-
} catch (e) {
|
|
902
|
-
f(e);
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
function O(e) {
|
|
906
|
-
let t = e ? e.newValue : n.getItem(h.value);
|
|
907
|
-
if (t == null) return s && g != null && n.setItem(h.value, v.write(g)), g;
|
|
908
|
-
if (!e && c) {
|
|
909
|
-
let e = v.read(t);
|
|
910
|
-
return typeof c == "function" ? c(e, g) : _ === "object" && !Array.isArray(e) ? {
|
|
911
|
-
...g,
|
|
912
|
-
...e
|
|
913
|
-
} : e;
|
|
914
|
-
} else if (typeof t != "string") return t;
|
|
915
|
-
else return v.read(t);
|
|
916
|
-
}
|
|
917
|
-
function A(e) {
|
|
918
|
-
if (!(e && e.storageArea !== n)) {
|
|
919
|
-
if (e && e.key == null) {
|
|
920
|
-
m.value = g;
|
|
921
|
-
return;
|
|
922
|
-
}
|
|
923
|
-
if (!(e && e.key !== h.value)) {
|
|
924
|
-
b();
|
|
925
|
-
try {
|
|
926
|
-
let t = v.write(m.value);
|
|
927
|
-
(e === void 0 || e?.newValue !== t) && (m.value = O(e));
|
|
928
|
-
} catch (e) {
|
|
929
|
-
f(e);
|
|
930
|
-
} finally {
|
|
931
|
-
e ? S(x) : x();
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
function j(e) {
|
|
937
|
-
A(e.detail);
|
|
938
|
-
}
|
|
939
|
-
return m;
|
|
940
|
-
}
|
|
941
|
-
function _t(e, t, n = {}) {
|
|
942
|
-
let { window: r = Y } = n;
|
|
943
|
-
return gt(e, t, r?.localStorage, n);
|
|
944
|
-
}
|
|
945
|
-
//#endregion
|
|
946
|
-
//#region lib/nativeStore/index.ts
|
|
947
|
-
var vt = new g(), yt = (e, t, n) => _t(vt.toString([e, D(t)]), n), bt = /* @__PURE__ */ Object.assign({
|
|
948
|
-
"./migrations/1_initial.ts": re,
|
|
949
|
-
"./migrations/2_fix-display_name.ts": oe,
|
|
950
|
-
"./migrations/3_fix_fvi_foreign_key.ts": le
|
|
951
|
-
});
|
|
952
|
-
console.log("[db] loading");
|
|
953
|
-
var xt = d(await ue.load("sqlite:app.db"), "core/db/raw"), St = d(await (async () => {
|
|
954
|
-
let e = new u({
|
|
955
|
-
dialect: new ve({ database: xt }),
|
|
956
|
-
plugins: [new c(), new Te()]
|
|
957
|
-
});
|
|
958
|
-
return await new o({
|
|
959
|
-
db: e,
|
|
960
|
-
provider: { async getMigrations() {
|
|
961
|
-
return bt;
|
|
962
|
-
} }
|
|
963
|
-
}).migrateToLatest(), e;
|
|
964
|
-
})(), "core/db/ins");
|
|
965
|
-
//#endregion
|
|
966
|
-
export { Ee as DBUtils, Pe as FavouriteDB, Be as HistoryDB, Ne as ItemStoreDB, Oe as PluginArchiveDB, Ye as RecentDB, We as SubscribeDB, St as db, yt as useNativeStore };
|
|
967
|
-
|
|
968
|
-
//# sourceMappingURL=index.js.map
|