@fkn/lib 0.9.48 → 0.9.50
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/LICENSE +12 -0
- package/{storage-C6F9SnDM.js → account-storage-C31d68BN.js} +2 -2
- package/{storage-DmRIhg1P.cjs → account-storage-C6hcXjG0.cjs} +1 -1
- package/{storage-B_mXNAdB.d.ts → account-storage-DHl6bXdb.d.ts} +2 -2
- package/{api-Cpi-qz1j.d.ts → api-wnOQJEK6.d.ts} +34 -42
- package/api.d.ts +2 -2
- package/cloud/dns.d.ts +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/fs/promises.d.ts +1 -1
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.d.ts +3 -3
- package/cloud/fs.js +12 -12
- package/cloud/net.d.ts +1 -1
- package/{cloud-BmwojOb5.cjs → cloud-CAN_iu2o.cjs} +1 -1
- package/{cloud-DK3DtdsU.d.ts → cloud-CWHjH89l.d.ts} +3 -3
- package/{cloud-B4_qsdaE.js → cloud-JXQKSDrW.js} +1 -1
- package/cloud.cjs +1 -1
- package/cloud.d.ts +4 -4
- package/cloud.js +1 -1
- package/{contract-XlEPwc7b.d.ts → contract-DGuGXxKd.d.ts} +119 -82
- package/contract.cjs +1 -1
- package/contract.d.ts +2 -2
- package/contract.js +69 -3
- package/dgram.d.ts +2 -2
- package/dns.d.ts +1 -1
- package/{extension-hOZN6A1U.js → extension-1Je_RJ6_.js} +1 -1
- package/{extension-uAlpUogG.cjs → extension-4koB6bS6.cjs} +1 -1
- package/extension.cjs +1 -1
- package/extension.js +2 -2
- package/fs/promises.cjs +1 -1
- package/fs/promises.d.ts +1 -1
- package/fs/promises.js +1 -1
- package/{fs-lKZe5xIo.d.ts → fs-BZv2djbS.d.ts} +2 -2
- package/{fs-BY0Csn2V.js → fs-ClnOPmRF.js} +39 -39
- package/fs-zERmcLRS.cjs +1 -0
- package/fs.cjs +1 -1
- package/fs.d.ts +3 -3
- package/fs.js +2 -2
- package/http.d.ts +1 -1
- package/{index-D9x6A-Gx.d.ts → index-DawD_N1P.d.ts} +2 -2
- package/index.cjs +1 -1
- package/index.d.ts +5 -6
- package/index.js +41 -42
- package/{lib-5z-jA7ND.cjs → lib-35d-3W0p.cjs} +1 -1
- package/{lib-Dhq4W2V8.js → lib-B2cML3Tq.js} +12 -10
- package/{messages-d7pvCXPn.d.ts → messages-AdPfdoLV.d.ts} +1 -1
- package/messages.d.ts +1 -1
- package/{net-C2Yz0job.d.ts → net-C2sulnNU.d.ts} +2 -2
- package/net.d.ts +1 -1
- package/package.json +6 -5
- package/packages.d.ts +1 -1
- package/{proxy-BZ-YFeXe.d.ts → proxy-MVuD49E2.d.ts} +2 -2
- package/rooms.d.ts +1 -1
- package/storage.cjs +1 -0
- package/storage.d.ts +69 -0
- package/storage.js +137 -0
- package/fs-DnF1cQuE.cjs +0 -1
- package/links.cjs +0 -1
- package/links.d.ts +0 -65
- package/links.js +0 -187
|
@@ -3,7 +3,7 @@ import { o as t, u as n } from "./api-ySazPAwN.js";
|
|
|
3
3
|
import { i as r } from "./busy-DsMWrSzc.js";
|
|
4
4
|
import { t as i } from "./node-fs-DY2fO5zd.js";
|
|
5
5
|
import { STORAGE_ACCOUNT_CHANGED as a, STORAGE_ACCOUNT_PIN_UNSUPPORTED as o } from "./messages.js";
|
|
6
|
-
import { _ as s,
|
|
6
|
+
import { _ as s, b as c, f as l, g as u, l as d, m as ee, n as te, o as ne, p as f, s as p, t as re, u as ie, v as ae } from "./account-storage-C31d68BN.js";
|
|
7
7
|
import { onChange as oe } from "./account.js";
|
|
8
8
|
import { a as se, i as m, n as h, o as g, t as ce } from "./opfs-D0goLAQW.js";
|
|
9
9
|
//#region src/fs/hybrid.ts
|
|
@@ -22,10 +22,10 @@ var le = /* @__PURE__ */ e({
|
|
|
22
22
|
remove: () => Fe,
|
|
23
23
|
replicating: () => Ee,
|
|
24
24
|
writeFile: () => Pe
|
|
25
|
-
}), ue = p, de, _ = async () => await (de ??= ce().catch(() => !1)) ? !0 : (de = void 0, !1), v = () =>
|
|
25
|
+
}), ue = p, de, _ = async () => await (de ??= ce().catch(() => !1)) ? !0 : (de = void 0, !1), v = () => ne().catch(() => "unknown"), y = async () => await v() === "connected", fe = async () => await _() || await y(), pe = "fkn:fs:pending", me = "fkn:fs:pending-delete", he = "fkn:fs:adopt-declined", b = !0, ge = /* @__PURE__ */ new Map(), _e = null, ve = (e, t) => {
|
|
26
26
|
if (e === null) return !1;
|
|
27
27
|
if ("generation" in e && "generation" in t) return e.generation === t.generation;
|
|
28
|
-
let n = (e) => "pin" in e ? e.pin :
|
|
28
|
+
let n = (e) => "pin" in e ? e.pin : l(e), r = n(e);
|
|
29
29
|
return r !== void 0 && r === n(t);
|
|
30
30
|
}, x = (e, t) => ve(_e, t) ? ge.get(e) ?? null : null, S = (e) => e === "write" ? pe : me, C = (e) => {
|
|
31
31
|
try {
|
|
@@ -64,7 +64,7 @@ var le = /* @__PURE__ */ e({
|
|
|
64
64
|
} catch {
|
|
65
65
|
return {};
|
|
66
66
|
}
|
|
67
|
-
}, T = /* @__PURE__ */ new Map(), be = (e) => "pin" in e ? e.pin :
|
|
67
|
+
}, T = /* @__PURE__ */ new Map(), be = (e) => "pin" in e ? e.pin : l(e) ?? null, xe = (e, t, n, r) => {
|
|
68
68
|
let i = C(e), a = i[t], o = be(r);
|
|
69
69
|
a && o !== null && a.pin === o || (i[t] = {
|
|
70
70
|
base: a ? a.base : n,
|
|
@@ -101,13 +101,13 @@ var M = () => ["write", "delete"].some((e) => Object.entries(C(e)).some(([t, n])
|
|
|
101
101
|
}, je = async (e) => {
|
|
102
102
|
let t = e?.pin ?? p();
|
|
103
103
|
q();
|
|
104
|
-
let n = await v(), r = n === "connected", [i, a] = await Promise.all([_().then((e) => e ? h() : []).catch(() => []), r ?
|
|
104
|
+
let n = await v(), r = n === "connected", [i, a] = await Promise.all([_().then((e) => e ? h() : []).catch(() => []), r ? f({ pin: t }).then((e) => ({
|
|
105
105
|
ok: !0,
|
|
106
106
|
entries: e
|
|
107
107
|
}), (e) => ({
|
|
108
108
|
ok: !1,
|
|
109
109
|
entries: [],
|
|
110
|
-
changed:
|
|
110
|
+
changed: d(e) ? e : void 0
|
|
111
111
|
})) : Promise.resolve({
|
|
112
112
|
ok: n === "disconnected",
|
|
113
113
|
entries: []
|
|
@@ -134,7 +134,7 @@ var M = () => ["write", "delete"].some((e) => Object.entries(C(e)).some(([t, n])
|
|
|
134
134
|
} catch (e) {
|
|
135
135
|
if (e?.name !== "NotFoundError") throw e;
|
|
136
136
|
}
|
|
137
|
-
let r = await
|
|
137
|
+
let r = await u(e, { pin: n });
|
|
138
138
|
return await _() && g(e, r).catch(() => {}), r;
|
|
139
139
|
}, Ne = async (e, t) => {
|
|
140
140
|
let n = t?.pin ?? p();
|
|
@@ -147,7 +147,7 @@ var M = () => ["write", "delete"].some((e) => Object.entries(C(e)).some(([t, n])
|
|
|
147
147
|
} catch (e) {
|
|
148
148
|
if (e?.name !== "NotFoundError") throw e;
|
|
149
149
|
}
|
|
150
|
-
return
|
|
150
|
+
return s(e, { pin: n });
|
|
151
151
|
}, Pe = async (e, t, n) => {
|
|
152
152
|
let r = n?.pin ?? p(), i = n?.contentType, a = i ? { contentType: i } : void 0, o = t instanceof Blob ? t : new Blob([t], a ? { type: a.contentType } : void 0);
|
|
153
153
|
if (await _()) {
|
|
@@ -158,16 +158,16 @@ var M = () => ["write", "delete"].some((e) => Object.entries(C(e)).some(([t, n])
|
|
|
158
158
|
E(e, t, r), I();
|
|
159
159
|
return;
|
|
160
160
|
}
|
|
161
|
-
|
|
161
|
+
c(e, o, {
|
|
162
162
|
...a,
|
|
163
163
|
pin: r
|
|
164
164
|
}).then(() => D(e)).catch((n) => {
|
|
165
|
-
E(e, t, r),
|
|
165
|
+
E(e, t, r), d(n) || I(), console.warn("fs: cloud replicate failed, queued for adopt()", n);
|
|
166
166
|
});
|
|
167
167
|
return;
|
|
168
168
|
}
|
|
169
169
|
let s = await v();
|
|
170
|
-
if (s === "connected") return
|
|
170
|
+
if (s === "connected") return c(e, o, {
|
|
171
171
|
...a,
|
|
172
172
|
pin: r
|
|
173
173
|
});
|
|
@@ -178,12 +178,12 @@ var M = () => ["write", "delete"].some((e) => Object.entries(C(e)).some(([t, n])
|
|
|
178
178
|
let r = [];
|
|
179
179
|
await _() && r.push(se(e).catch(() => {}));
|
|
180
180
|
let i = await v();
|
|
181
|
-
if (i === "connected" ? r.push(
|
|
182
|
-
Ce(e, n),
|
|
181
|
+
if (i === "connected" ? r.push(ae(e, { pin: n }).then(() => O(e)).catch((t) => {
|
|
182
|
+
Ce(e, n), d(t) || I(), console.warn("fs: cloud delete failed, queued for retry", t);
|
|
183
183
|
})) : i === "unknown" && r.length && x(e, n) !== null && (Ce(e, n), I()), !r.length) throw Error(i === "unknown" ? "fs: cloud unreachable" : "fs: no storage backend available");
|
|
184
184
|
D(e), await Promise.all(r);
|
|
185
185
|
}, Ie = async (e) => {
|
|
186
|
-
let t = p(), n = await
|
|
186
|
+
let t = p(), n = await u(e, { pin: t });
|
|
187
187
|
return await _() && await g(e, n), n;
|
|
188
188
|
}, R = null, Le = (e) => (R = e, () => {
|
|
189
189
|
R === e && (R = null);
|
|
@@ -216,9 +216,9 @@ var M = () => ["write", "delete"].some((e) => Object.entries(C(e)).some(([t, n])
|
|
|
216
216
|
for (let [e, t] of [...T]) {
|
|
217
217
|
let n = e.startsWith("write:") ? "write" : "delete", r = e.slice(n.length + 1), i;
|
|
218
218
|
try {
|
|
219
|
-
i = await
|
|
219
|
+
i = await ee(t);
|
|
220
220
|
} catch (t) {
|
|
221
|
-
|
|
221
|
+
d(t) && T.delete(e);
|
|
222
222
|
continue;
|
|
223
223
|
}
|
|
224
224
|
if (T.get(e) !== t) continue;
|
|
@@ -230,8 +230,8 @@ var M = () => ["write", "delete"].some((e) => Object.entries(C(e)).some(([t, n])
|
|
|
230
230
|
}, w(n, a));
|
|
231
231
|
}
|
|
232
232
|
}, He = async (e, t, n, r, i, a) => {
|
|
233
|
-
let o = new Map(t.map((e) => [e.path, e])),
|
|
234
|
-
if (
|
|
233
|
+
let o = new Map(t.map((e) => [e.path, e])), s = (e) => {
|
|
234
|
+
if (d(e)) throw new z();
|
|
235
235
|
};
|
|
236
236
|
for (let [t, a] of e.deletes) {
|
|
237
237
|
let e = o.get(t);
|
|
@@ -248,25 +248,25 @@ var M = () => ["write", "delete"].some((e) => Object.entries(C(e)).some(([t, n])
|
|
|
248
248
|
continue;
|
|
249
249
|
}
|
|
250
250
|
try {
|
|
251
|
-
await
|
|
251
|
+
await ae(t, n), O(t), i.deleted.push(t);
|
|
252
252
|
} catch (e) {
|
|
253
|
-
|
|
253
|
+
s(e), i.failed.push({
|
|
254
254
|
path: t,
|
|
255
255
|
error: B(e)
|
|
256
256
|
});
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
for (let t of r) {
|
|
260
|
-
let r = o.get(t.path),
|
|
261
|
-
if (!
|
|
260
|
+
let r = o.get(t.path), l = e.writes.has(t.path);
|
|
261
|
+
if (!l) {
|
|
262
262
|
if (!a(t)) continue;
|
|
263
263
|
if (r) {
|
|
264
264
|
i.kept.push(t.path);
|
|
265
265
|
continue;
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
|
-
let
|
|
269
|
-
if (
|
|
268
|
+
let d = e.writes.get(t.path) ?? null;
|
|
269
|
+
if (l && r && r.updatedAt !== d) {
|
|
270
270
|
let e = null, a = null, o = await ze({
|
|
271
271
|
path: t.path,
|
|
272
272
|
local: {
|
|
@@ -278,7 +278,7 @@ var M = () => ["write", "delete"].some((e) => Object.entries(C(e)).some(([t, n])
|
|
|
278
278
|
updatedAt: r.updatedAt
|
|
279
279
|
},
|
|
280
280
|
readLocal: () => e ??= m(t.path),
|
|
281
|
-
readCloud: () => a ??=
|
|
281
|
+
readCloud: () => a ??= u(t.path, n)
|
|
282
282
|
});
|
|
283
283
|
if (o == null) {
|
|
284
284
|
i.unresolved.push(t.path);
|
|
@@ -286,7 +286,7 @@ var M = () => ["write", "delete"].some((e) => Object.entries(C(e)).some(([t, n])
|
|
|
286
286
|
}
|
|
287
287
|
try {
|
|
288
288
|
let r = e !== null && o === await e, s = a !== null && o === await a;
|
|
289
|
-
s || await
|
|
289
|
+
s || await c(t.path, o, t.contentType ? {
|
|
290
290
|
contentType: t.contentType,
|
|
291
291
|
...n
|
|
292
292
|
} : n), r || await g(t.path, o), D(t.path), i.resolved.push({
|
|
@@ -294,7 +294,7 @@ var M = () => ["write", "delete"].some((e) => Object.entries(C(e)).some(([t, n])
|
|
|
294
294
|
choice: r ? "local" : s ? "cloud" : "merged"
|
|
295
295
|
});
|
|
296
296
|
} catch (e) {
|
|
297
|
-
if (
|
|
297
|
+
if (s(e), e?.code === "FKN_E2E_LOCKED") throw e;
|
|
298
298
|
i.failed.push({
|
|
299
299
|
path: t.path,
|
|
300
300
|
error: B(e)
|
|
@@ -304,12 +304,12 @@ var M = () => ["write", "delete"].some((e) => Object.entries(C(e)).some(([t, n])
|
|
|
304
304
|
}
|
|
305
305
|
try {
|
|
306
306
|
let e = await m(t.path);
|
|
307
|
-
await
|
|
307
|
+
await c(t.path, e, t.contentType ? {
|
|
308
308
|
contentType: t.contentType,
|
|
309
309
|
...n
|
|
310
310
|
} : n), D(t.path), i.uploaded.push(t.path);
|
|
311
311
|
} catch (e) {
|
|
312
|
-
if (
|
|
312
|
+
if (l || E(t.path, r?.updatedAt ?? null, n.pin), s(e), e?.code === "FKN_E2E_LOCKED") throw e;
|
|
313
313
|
i.failed.push({
|
|
314
314
|
path: t.path,
|
|
315
315
|
error: B(e)
|
|
@@ -334,13 +334,13 @@ var M = () => ["write", "delete"].some((e) => Object.entries(C(e)).some(([t, n])
|
|
|
334
334
|
if (e === null || De(e)) continue;
|
|
335
335
|
let i = { pin: { pin: e } }, o;
|
|
336
336
|
try {
|
|
337
|
-
o = await
|
|
337
|
+
o = await f(i);
|
|
338
338
|
} catch (n) {
|
|
339
|
-
if (
|
|
339
|
+
if (d(n)) {
|
|
340
340
|
k.set(e, t.generation);
|
|
341
341
|
continue;
|
|
342
342
|
}
|
|
343
|
-
if (
|
|
343
|
+
if (ie(n)) {
|
|
344
344
|
We(e);
|
|
345
345
|
continue;
|
|
346
346
|
}
|
|
@@ -354,7 +354,7 @@ var M = () => ["write", "delete"].some((e) => Object.entries(C(e)).some(([t, n])
|
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
356
|
if (e) {
|
|
357
|
-
let e = { pin: t }, r = await
|
|
357
|
+
let e = { pin: t }, r = await f(e), i = C("write"), o = Be().get(null) ?? {
|
|
358
358
|
writes: /* @__PURE__ */ new Map(),
|
|
359
359
|
deletes: /* @__PURE__ */ new Map()
|
|
360
360
|
}, s = /* @__PURE__ */ new Set([
|
|
@@ -366,7 +366,7 @@ var M = () => ["write", "delete"].some((e) => Object.entries(C(e)).some(([t, n])
|
|
|
366
366
|
try {
|
|
367
367
|
await He(o, r, e, a, n, c);
|
|
368
368
|
} catch (e) {
|
|
369
|
-
throw e instanceof z ? new
|
|
369
|
+
throw e instanceof z ? new re() : e;
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
372
|
return n;
|
|
@@ -397,7 +397,7 @@ var M = () => ["write", "delete"].some((e) => Object.entries(C(e)).some(([t, n])
|
|
|
397
397
|
paths: [],
|
|
398
398
|
bytes: 0
|
|
399
399
|
};
|
|
400
|
-
let [t, n] = await Promise.all([h(),
|
|
400
|
+
let [t, n] = await Promise.all([h(), f({ pin: e })]), r = H(t, n);
|
|
401
401
|
return {
|
|
402
402
|
paths: r.map((e) => e.path),
|
|
403
403
|
bytes: r.reduce((e, t) => e + t.size, 0)
|
|
@@ -415,7 +415,7 @@ var M = () => ["write", "delete"].some((e) => Object.entries(C(e)).some(([t, n])
|
|
|
415
415
|
if (!await y()) return;
|
|
416
416
|
let r = e ?? (await _() ? {
|
|
417
417
|
local: await h(),
|
|
418
|
-
remote: await
|
|
418
|
+
remote: await f({ pin: n })
|
|
419
419
|
} : null);
|
|
420
420
|
if (!r) return;
|
|
421
421
|
let i = Ke(), a = H(r.local, r.remote).filter((e) => !i.has(e.path));
|
|
@@ -461,8 +461,8 @@ var M = () => ["write", "delete"].some((e) => Object.entries(C(e)).some(([t, n])
|
|
|
461
461
|
}, Qe = /* @__PURE__ */ e({
|
|
462
462
|
STORAGE_ACCOUNT_CHANGED: () => a,
|
|
463
463
|
STORAGE_ACCOUNT_PIN_UNSUPPORTED: () => o,
|
|
464
|
-
StorageAccountChangedError: () =>
|
|
465
|
-
StorageAccountPinUnsupportedError: () =>
|
|
464
|
+
StorageAccountChangedError: () => re,
|
|
465
|
+
StorageAccountPinUnsupportedError: () => te,
|
|
466
466
|
adopt: () => X,
|
|
467
467
|
adoptable: () => Z,
|
|
468
468
|
appendFile: () => ht,
|
|
@@ -472,7 +472,7 @@ var M = () => ["write", "delete"].some((e) => Object.entries(C(e)).some(([t, n])
|
|
|
472
472
|
exists: () => St,
|
|
473
473
|
existsSync: () => it,
|
|
474
474
|
flush: () => Tt,
|
|
475
|
-
isAccountChanged: () =>
|
|
475
|
+
isAccountChanged: () => d,
|
|
476
476
|
lstatSync: () => ot,
|
|
477
477
|
mkdir: () => vt,
|
|
478
478
|
mkdirSync: () => ct,
|
package/fs-zERmcLRS.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-DMnVye0K.cjs"),n=require("./busy-BXbVH595.cjs"),r=require("./node-fs-vsWuoMGa.cjs"),i=require("./messages.cjs"),a=require("./account-storage-C6hcXjG0.cjs"),o=require("./account.cjs"),s=require("./opfs-CXMESVLc.cjs");var c=e.t({adopt:()=>L,adoptable:()=>z,available:()=>ee,captureAccount:()=>l,list:()=>ye,onConflict:()=>Ce,pending:()=>fe,pendingDeletes:()=>pe,pull:()=>N,readFile:()=>be,readFileSealed:()=>M,remove:()=>Se,replicating:()=>me,writeFile:()=>xe}),l=a.s,u,d=async()=>await(u??=s.t().catch(()=>!1))?!0:(u=void 0,!1),f=()=>a.o().catch(()=>`unknown`),p=async()=>await f()===`connected`,ee=async()=>await d()||await p(),te=`fkn:fs:pending`,ne=`fkn:fs:pending-delete`,re=`fkn:fs:adopt-declined`,m=!0,ie=new Map,ae=null,oe=(e,t)=>{if(e===null)return!1;if(`generation`in e&&`generation`in t)return e.generation===t.generation;let n=e=>`pin`in e?e.pin:a.f(e),r=n(e);return r!==void 0&&r===n(t)},h=(e,t)=>oe(ae,t)?ie.get(e)??null:null,g=e=>e===`write`?te:ne,_=e=>{try{let t=localStorage.getItem(g(e));if(!t)return{};let n=JSON.parse(t);if(Array.isArray(n))return Object.fromEntries(n.filter(e=>typeof e==`string`).map(e=>[e,{base:null,pin:null}]));if(!n||typeof n!=`object`)return{};let r={};for(let[e,t]of Object.entries(n))if(t===null||typeof t==`string`)r[e]={base:t,pin:null};else if(typeof t==`object`){let{base:n,pin:i}=t;r[e]={base:typeof n==`string`?n:null,pin:typeof i==`string`&&i?i:null}}return r}catch{return{}}},v=(e,t)=>{try{Object.keys(t).length?localStorage.setItem(g(e),JSON.stringify(t)):localStorage.removeItem(g(e))}catch{}},se=()=>{try{let e=JSON.parse(localStorage.getItem(re)??`{}`);return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}catch{return{}}},y=new Map,ce=e=>`pin`in e?e.pin:a.f(e)??null,le=(e,t,n,r)=>{let i=_(e),a=i[t],o=ce(r);a&&o!==null&&a.pin===o||(i[t]={base:a?a.base:n,pin:o},v(e,i),o===null&&`generation`in r?y.set(`${e}:${t}`,r):y.delete(`${e}:${t}`))},ue=(e,t)=>{y.delete(`${e}:${t}`);let n=_(e);t in n&&(delete n[t],v(e,n),E()||(O=D))},b=(e,t,n)=>le(`write`,e,t,n),x=e=>ue(`write`,e),de=(e,t)=>le(`delete`,e,h(e,t),t),S=e=>ue(`delete`,e),fe=()=>Object.keys(_(`write`)),pe=()=>Object.keys(_(`delete`)),me=()=>m,C=new Map,he=e=>C.get(e)===a.s().generation,ge=(e,t,n)=>n.pin===null&&!y.has(`${e}:${t}`),w=null,T=!1;n.i(`storage replication`,()=>w!==null||B!==null);var E=()=>[`write`,`delete`].some(e=>Object.entries(_(e)).some(([t,n])=>n.pin===null?!ge(e,t,n):!he(n.pin))),D=6e4,_e=6e5,O=D,k=null,A=()=>{!k&&typeof window<`u`&&E()&&(k=setTimeout(()=>{k=null,j()},O),O=Math.min(O*2,_e))},j=()=>{if(w){T=!0;return}E()&&(w=ke(!1,a.s()).then(e=>{if(!E()){O=D;return}e.failed.length&&A()}).catch(()=>{A()}).finally(()=>{w=null,ve()}))},ve=()=>{T&&(T=!1,j())},ye=async e=>{let t=e?.pin??a.s();U();let n=await f(),r=n===`connected`,[i,o]=await Promise.all([d().then(e=>e?s.n():[]).catch(()=>[]),r?a.p({pin:t}).then(e=>({ok:!0,entries:e}),e=>({ok:!1,entries:[],changed:a.l(e)?e:void 0})):Promise.resolve({ok:n===`disconnected`,entries:[]})]);if(n!==`unknown`&&(m=o.ok),o.ok&&n!==`unknown`&&(ie=new Map(o.entries.map(e=>[e.path,e.updatedAt])),ae=t),o.changed)throw o.changed;let c=new Map,l=e=>{let t=Date.parse(e.updatedAt??``);return Number.isFinite(t)?t:0},u=e=>{let t=c.get(e.path);(!t||l(e)>=l(t))&&c.set(e.path,e)};for(let e of i)u(e);for(let e of o.entries)u(e);return o.ok&&r&&(Ie(i,o.entries).catch(()=>{}),E()?j():H({local:i,remote:o.entries,from:t}).catch(()=>{})),[...c.values()]},be=async(e,t)=>{let n=t?.pin??a.s();if(await d())try{return await s.i(e)}catch(e){if(e?.name!==`NotFoundError`)throw e}let r=await a.g(e,{pin:n});return await d()&&s.o(e,r).catch(()=>{}),r},M=async(e,t)=>{let n=t?.pin??a.s();if(await d())try{let t=await s.i(e);return{data:new Uint8Array(await t.arrayBuffer()),sealedAt:null}}catch(e){if(e?.name!==`NotFoundError`)throw e}return a._(e,{pin:n})},xe=async(e,t,n)=>{let r=n?.pin??a.s(),i=n?.contentType,o=i?{contentType:i}:void 0,c=t instanceof Blob?t:new Blob([t],o?{type:o.contentType}:void 0);if(await d()){await s.o(e,c,o),U();let t=h(e,r),n=await f();if(n===`disconnected`)return;if(n===`unknown`||!m){b(e,t,r),A();return}a.b(e,c,{...o,pin:r}).then(()=>x(e)).catch(n=>{b(e,t,r),a.l(n)||A(),console.warn(`fs: cloud replicate failed, queued for adopt()`,n)});return}let l=await f();if(l===`connected`)return a.b(e,c,{...o,pin:r});throw Error(l===`unknown`?`fs: cloud unreachable`:`fs: no storage backend available`)},Se=async(e,t)=>{let n=t?.pin??a.s();U();let r=[];await d()&&r.push(s.a(e).catch(()=>{}));let i=await f();if(i===`connected`?r.push(a.v(e,{pin:n}).then(()=>S(e)).catch(t=>{de(e,n),a.l(t)||A(),console.warn(`fs: cloud delete failed, queued for retry`,t)})):i===`unknown`&&r.length&&h(e,n)!==null&&(de(e,n),A()),!r.length)throw Error(i===`unknown`?`fs: cloud unreachable`:`fs: no storage backend available`);x(e),await Promise.all(r)},N=async e=>{let t=a.s(),n=await a.g(e,{pin:t});return await d()&&await s.o(e,n),n},P=null,Ce=e=>(P=e,()=>{P===e&&(P=null)}),we=async e=>{let n=await(await t.o).cloud.fs.promptConflict({path:e.path,local:e.local,cloud:e.cloud}).catch(()=>null);return n===`local`?e.readLocal():n===`cloud`?e.readCloud():null},Te=async e=>{if(P)try{return await P(e)}catch{return null}return we(e)},F=class extends Error{},I=e=>e instanceof Error?e.message:String(e),Ee=()=>{let e=new Map,t=t=>{let n=e.get(t);return n||e.set(t,n={writes:new Map,deletes:new Map}),n};for(let[e,n]of Object.entries(_(`write`)))t(n.pin).writes.set(e,n.base);for(let[e,n]of Object.entries(_(`delete`)))t(n.pin).deletes.set(e,n.base);return e},De=async()=>{for(let[e,t]of[...y]){let n=e.startsWith(`write:`)?`write`:`delete`,r=e.slice(n.length+1),i;try{i=await a.m(t)}catch(t){a.l(t)&&y.delete(e);continue}if(y.get(e)!==t)continue;y.delete(e);let o=_(n),s=o[r];s&&s.pin===null&&(o[r]={base:s.base,pin:i},v(n,o))}},Oe=async(e,t,n,r,i,o)=>{let c=new Map(t.map(e=>[e.path,e])),l=e=>{if(a.l(e))throw new F};for(let[t,o]of e.deletes){let e=c.get(t);if(!e){S(t);continue}if(r.some(e=>e.path===t)){S(t);continue}if(e.updatedAt!==o){S(t);continue}try{await a.v(t,n),S(t),i.deleted.push(t)}catch(e){l(e),i.failed.push({path:t,error:I(e)})}}for(let t of r){let r=c.get(t.path),u=e.writes.has(t.path);if(!u){if(!o(t))continue;if(r){i.kept.push(t.path);continue}}let d=e.writes.get(t.path)??null;if(u&&r&&r.updatedAt!==d){let e=null,o=null,c=await Te({path:t.path,local:{size:t.size,updatedAt:t.updatedAt},cloud:{size:r.size,updatedAt:r.updatedAt},readLocal:()=>e??=s.i(t.path),readCloud:()=>o??=a.g(t.path,n)});if(c==null){i.unresolved.push(t.path);continue}try{let r=e!==null&&c===await e,l=o!==null&&c===await o;l||await a.b(t.path,c,t.contentType?{contentType:t.contentType,...n}:n),r||await s.o(t.path,c),x(t.path),i.resolved.push({path:t.path,choice:r?`local`:l?`cloud`:`merged`})}catch(e){if(l(e),e?.code===`FKN_E2E_LOCKED`)throw e;i.failed.push({path:t.path,error:I(e)})}continue}try{let e=await s.i(t.path);await a.b(t.path,e,t.contentType?{contentType:t.contentType,...n}:n),x(t.path),i.uploaded.push(t.path)}catch(e){if(u||b(t.path,r?.updatedAt??null,n.pin),l(e),e?.code===`FKN_E2E_LOCKED`)throw e;i.failed.push({path:t.path,error:I(e)})}}},ke=async(e,t)=>{let n={uploaded:[],kept:[],resolved:[],unresolved:[],deleted:[],failed:[]},r=await f();if(r===`unknown`)throw Error(`fs: cloud unreachable`);if(r!==`connected`)throw Error(`fs: this needs a signed-in account`);let i=await d(),o=i?await s.n():[];if(i)for(let e of Object.keys(_(`write`)))o.some(t=>t.path===e)||x(e);await De();for(let[e,r]of Ee()){if(e===null||he(e))continue;let i={pin:{pin:e}},s;try{s=await a.p(i)}catch(n){if(a.l(n)){C.set(e,t.generation);continue}if(a.u(n)){Ae(e);continue}throw n}try{await Oe(r,s,i,o,n,()=>!1)}catch(n){if(!(n instanceof F))throw n;C.set(e,t.generation)}}if(e){let e={pin:t},r=await a.p(e),i=_(`write`),s=Ee().get(null)??{writes:new Map,deletes:new Map},c=new Set([...n.uploaded,...n.resolved.map(({path:e})=>e),...n.unresolved,...n.failed.map(({path:e})=>e)]),l=e=>!(e.path in i)&&!c.has(e.path);try{await Oe(s,r,e,o,n,l)}catch(e){throw e instanceof F?new a.t:e}}return n},Ae=e=>{for(let t of[`write`,`delete`]){let n=_(t),r=!1;for(let t of Object.values(n))t.pin===e&&(t.pin=null,r=!0);r&&v(t,n)}},je=async e=>{for(;w;)await w;let t=ke(!0,e);w=t.then(()=>{},()=>{});try{return await t}finally{w=null,ve()}},L=()=>je(a.s()),R=(e,t)=>{let n=new Set(t.map(e=>e.path)),r=_(`write`);return e.filter(e=>{let t=r[e.path];return t?ge(`write`,e.path,t):!n.has(e.path)})},z=async()=>{let e=a.s();if(!await p()||!await d())return{paths:[],bytes:0};let[t,n]=await Promise.all([s.n(),a.p({pin:e})]),r=R(t,n);return{paths:r.map(e=>e.path),bytes:r.reduce((e,t)=>e+t.size,0)}},Me=()=>new Set(Object.keys(se())),Ne=e=>{let t=se();for(let n of e)t[n]=null;try{localStorage.setItem(re,JSON.stringify(t))}catch{}},B=null,V=!1,H=e=>{if(B)return V=!0,B;let n=e?.from??a.s();return B=(async()=>{if(!await p())return;let r=e??(await d()?{local:await s.n(),remote:await a.p({pin:n})}:null);if(!r)return;let i=Me(),o=R(r.local,r.remote).filter(e=>!i.has(e.path));if(!o.length)return;let c=await t.o,l=o.reduce((e,t)=>e+t.size,0);if(!await c.cloud.fs.promptAdopt({files:o.length,bytes:l}).catch(()=>!1)){Ne(o.map(e=>e.path));return}`generation`in n&&await je(n)})().catch(()=>{}).finally(()=>{B=null,V&&(V=!1,H())}),B},Pe=null,Fe=!1,Ie=async(e,n)=>{let r=R(e,n),i=await t.o,a=async()=>{await L().catch(()=>{});let e=await z().catch(()=>({paths:[],bytes:0}));await i.cloud.fs.setAdoptSource({files:e.paths.length,bytes:e.bytes},a).catch(()=>{})},o={files:r.length,bytes:r.reduce((e,t)=>e+t.size,0)};Pe=()=>{i.cloud.fs.setAdoptSource(o,a).catch(()=>{})},Fe||(Fe=!0,t.u((e,t)=>{t>1&&Pe?.()})),await i.cloud.fs.setAdoptSource(o,a)},Le=!1,U=()=>{Le||typeof window>`u`||(Le=!0,window.addEventListener(`online`,()=>{j()}),o.onChange(()=>{H().catch(()=>{}),j()}).catch(()=>{}))},Re=e.t({STORAGE_ACCOUNT_CHANGED:()=>i.STORAGE_ACCOUNT_CHANGED,STORAGE_ACCOUNT_PIN_UNSUPPORTED:()=>i.STORAGE_ACCOUNT_PIN_UNSUPPORTED,StorageAccountChangedError:()=>a.t,StorageAccountPinUnsupportedError:()=>a.n,adopt:()=>q,adoptable:()=>J,appendFile:()=>tt,appendFileSync:()=>Ue,available:()=>Be,default:()=>$,exists:()=>ct,existsSync:()=>We,flush:()=>W,isAccountChanged:()=>a.l,lstatSync:()=>Ke,mkdir:()=>it,mkdirSync:()=>Je,mount:()=>ut,onConflict:()=>Q,pending:()=>Y,pendingDeletes:()=>X,promises:()=>lt,pull:()=>G,readFile:()=>$e,readFileSealed:()=>K,readFileSync:()=>Ve,readdir:()=>rt,readdirSync:()=>qe,remount:()=>dt,rename:()=>st,renameSync:()=>Qe,replicating:()=>Z,rm:()=>at,rmSync:()=>Ye,rmdirSync:()=>Xe,stat:()=>nt,statSync:()=>Ge,unlink:()=>ot,unlinkSync:()=>Ze,writeFile:()=>et,writeFileSync:()=>He}),ze=r.t(c,{memfs:!0}),{available:Be,readFileSync:Ve,writeFileSync:He,appendFileSync:Ue,existsSync:We,statSync:Ge,lstatSync:Ke,readdirSync:qe,mkdirSync:Je,rmSync:Ye,rmdirSync:Xe,unlinkSync:Ze,renameSync:Qe,readFile:$e,writeFile:et,appendFile:tt,stat:nt,readdir:rt,mkdir:it,rm:at,unlink:ot,rename:st,exists:ct,promises:lt,mount:ut,flush:W,remount:dt}=ze,G=N,K=M,q=L,J=z,Y=fe,X=pe,Z=me,Q=Ce,$={...ze,pull:G,readFileSealed:K,adopt:q,adoptable:J,pending:Y,pendingDeletes:X,replicating:Z,onConflict:Q};Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return st}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return et}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return He}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return it}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return at}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return We}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return G}});
|
package/fs.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./messages.cjs"),t=require("./storage-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./messages.cjs"),t=require("./account-storage-C6hcXjG0.cjs"),n=require("./fs-zERmcLRS.cjs");exports.STORAGE_ACCOUNT_CHANGED=e.STORAGE_ACCOUNT_CHANGED,exports.STORAGE_ACCOUNT_PIN_UNSUPPORTED=e.STORAGE_ACCOUNT_PIN_UNSUPPORTED,exports.StorageAccountChangedError=t.t,exports.StorageAccountPinUnsupportedError=t.n,exports.adopt=n.t,exports.adoptable=n.n,exports.appendFile=n.r,exports.appendFileSync=n.i,exports.available=n.a,exports.default=n.l,exports.exists=n.o,exports.existsSync=n.s,exports.flush=n.c,exports.isAccountChanged=t.l,exports.lstatSync=n.d,exports.mkdir=n.f,exports.mkdirSync=n.p,exports.mount=n.m,exports.onConflict=n.h,exports.pending=n.g,exports.pendingDeletes=n._,exports.promises=n.v,exports.pull=n.y,exports.readFile=n.b,exports.readFileSealed=n.x,exports.readFileSync=n.S,exports.readdir=n.C,exports.readdirSync=n.w,exports.remount=n.T,exports.rename=n.E,exports.renameSync=n.D,exports.replicating=n.O,exports.rm=n.k,exports.rmSync=n.A,exports.rmdirSync=n.j,exports.stat=n.M,exports.statSync=n.N,exports.unlink=n.P,exports.unlinkSync=n.F,exports.writeFile=n.I,exports.writeFileSync=n.L;
|
package/fs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as Stats } from "./index-BQgZVQl7.js";
|
|
2
|
-
import { a as StorageAccountChangedError, i as SealedRead,
|
|
3
|
-
import { c as STORAGE_ACCOUNT_CHANGED, l as STORAGE_ACCOUNT_PIN_UNSUPPORTED } from "./messages-
|
|
4
|
-
import { A as rmSync, B as ConflictResolver, C as readdir, D as renameSync, E as rename, F as unlinkSync, H as FileConflict, I as writeFile, L as writeFileSync, M as stat, N as statSync, O as replicating, P as unlink, R as AdoptSummary, S as readFileSync, T as remount, V as ConflictSide, _ as pendingDeletes, a as appendFileSync, b as readFile, c as existsSync, d as lstatSync, f as mkdir, g as pending, h as onConflict, i as appendFile, j as rmdirSync, k as rm, l as flush, m as mount, n as adopt, o as available, p as mkdirSync, r as adoptable, s as exists, t as _default, v as promises, w as readdirSync, x as readFileSealed, y as pull, z as ConflictResolution } from "./index-
|
|
2
|
+
import { a as StorageAccountChangedError, i as SealedRead, m as isAccountChanged, o as StorageAccountPinUnsupportedError } from "./account-storage-DHl6bXdb.js";
|
|
3
|
+
import { c as STORAGE_ACCOUNT_CHANGED, l as STORAGE_ACCOUNT_PIN_UNSUPPORTED } from "./messages-AdPfdoLV.js";
|
|
4
|
+
import { A as rmSync, B as ConflictResolver, C as readdir, D as renameSync, E as rename, F as unlinkSync, H as FileConflict, I as writeFile, L as writeFileSync, M as stat, N as statSync, O as replicating, P as unlink, R as AdoptSummary, S as readFileSync, T as remount, V as ConflictSide, _ as pendingDeletes, a as appendFileSync, b as readFile, c as existsSync, d as lstatSync, f as mkdir, g as pending, h as onConflict, i as appendFile, j as rmdirSync, k as rm, l as flush, m as mount, n as adopt, o as available, p as mkdirSync, r as adoptable, s as exists, t as _default, v as promises, w as readdirSync, x as readFileSealed, y as pull, z as ConflictResolution } from "./index-DawD_N1P.js";
|
|
5
5
|
export { type AdoptSummary, type ConflictResolution, type ConflictResolver, type ConflictSide, type FileConflict, STORAGE_ACCOUNT_CHANGED, STORAGE_ACCOUNT_PIN_UNSUPPORTED, type SealedRead, type Stats, StorageAccountChangedError, StorageAccountPinUnsupportedError, adopt, adoptable, appendFile, appendFileSync, available, _default as default, exists, existsSync, flush, isAccountChanged, lstatSync, mkdir, mkdirSync, mount, onConflict, pending, pendingDeletes, promises, pull, readFile, readFileSealed, readFileSync, readdir, readdirSync, remount, rename, renameSync, replicating, rm, rmSync, rmdirSync, stat, statSync, unlink, unlinkSync, writeFile, writeFileSync };
|
package/fs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { STORAGE_ACCOUNT_CHANGED as e, STORAGE_ACCOUNT_PIN_UNSUPPORTED as t } from "./messages.js";
|
|
2
|
-
import {
|
|
3
|
-
import { A as a, C as o, D as s, E as c, F as l, I as u, L as d, M as f, N as p, O as m, P as h, S as g, T as _, _ as v, a as y, b, c as x, d as S, f as C, g as w, h as T, i as E, j as D, k as O, l as k, m as A, n as j, o as M, p as N, r as P, s as F, t as I, v as L, w as R, x as z, y as B } from "./fs-
|
|
2
|
+
import { l as n, n as r, t as i } from "./account-storage-C31d68BN.js";
|
|
3
|
+
import { A as a, C as o, D as s, E as c, F as l, I as u, L as d, M as f, N as p, O as m, P as h, S as g, T as _, _ as v, a as y, b, c as x, d as S, f as C, g as w, h as T, i as E, j as D, k as O, l as k, m as A, n as j, o as M, p as N, r as P, s as F, t as I, v as L, w as R, x as z, y as B } from "./fs-ClnOPmRF.js";
|
|
4
4
|
export { e as STORAGE_ACCOUNT_CHANGED, t as STORAGE_ACCOUNT_PIN_UNSUPPORTED, i as StorageAccountChangedError, r as StorageAccountPinUnsupportedError, I as adopt, j as adoptable, P as appendFile, E as appendFileSync, y as available, k as default, M as exists, F as existsSync, x as flush, n as isAccountChanged, S as lstatSync, C as mkdir, N as mkdirSync, A as mount, T as onConflict, w as pending, v as pendingDeletes, L as promises, B as pull, b as readFile, z as readFileSealed, g as readFileSync, o as readdir, R as readdirSync, _ as remount, c as rename, s as renameSync, m as replicating, O as rm, a as rmSync, D as rmdirSync, f as stat, p as statSync, h as unlink, l as unlinkSync, u as writeFile, d as writeFileSync };
|
package/http.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as Socket, t as Server$1 } from "./net-
|
|
1
|
+
import { n as Socket, t as Server$1 } from "./net-C2sulnNU.js";
|
|
2
2
|
import { Buffer } from "buffer";
|
|
3
3
|
import { Stream } from "stream";
|
|
4
4
|
import { IncomingHttpHeaders, OutgoingHttpHeaders, RequestOptions } from "http";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as WriteData, i as Stats, n as MakeOptions, o as WriteOptions, r as ReadOptions, t as Callback } from "./index-BQgZVQl7.js";
|
|
2
|
-
import { a as StorageAccountChangedError, b as PinOptions,
|
|
3
|
-
import { c as STORAGE_ACCOUNT_CHANGED, l as STORAGE_ACCOUNT_PIN_UNSUPPORTED } from "./messages-
|
|
2
|
+
import { a as StorageAccountChangedError, b as PinOptions, f as captureAccount$1, i as SealedRead, m as isAccountChanged, o as StorageAccountPinUnsupportedError, u as account_storage_d_exports, v as FileEntry, x as WriteData$1, y as FileSystem } from "./account-storage-DHl6bXdb.js";
|
|
3
|
+
import { c as STORAGE_ACCOUNT_CHANGED, l as STORAGE_ACCOUNT_PIN_UNSUPPORTED } from "./messages-AdPfdoLV.js";
|
|
4
4
|
declare namespace hybrid_d_exports {
|
|
5
5
|
export { AdoptSummary, ConflictResolution, ConflictResolver, ConflictSide, FileConflict, FileEntry, FileSystem, WriteData$1 as WriteData, adopt$1 as adopt, adoptable$1 as adoptable, available$1 as available, captureAccount, list, onConflict$1 as onConflict, pending$1 as pending, pendingDeletes$1 as pendingDeletes, pull$1 as pull, readFile$1 as readFile, readFileSealed$1 as readFileSealed, remove, replicating$1 as replicating, writeFile$1 as writeFile };
|
|
6
6
|
}
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-35d-3W0p.cjs"),n=require("./extension-4koB6bS6.cjs"),r=require("./api-DMnVye0K.cjs"),i=require("./busy-BXbVH595.cjs"),a=require("./cloud-CAN_iu2o.cjs"),o=require("./dns.cjs"),s=require("./net.cjs"),c=require("./dgram.cjs"),l=require("./http.cjs"),u=require("./desktop.cjs"),d=require("./account.cjs"),f=require("./fs-zERmcLRS.cjs"),p=require("./opfs.cjs"),m=require("./packages.cjs"),h=require("./rooms.cjs"),g=require("./storage.cjs"),_=require("./connect-button-BpXDs7tw.cjs");let v=require("osra");var y=1e4,b=150,x=()=>new Promise(e=>{if(t.et())return e(!0);let n,r=setTimeout(()=>i(t.et()),y),i=t=>{clearTimeout(n),clearTimeout(r),o.disconnect(),document.removeEventListener(`readystatechange`,s),e(t)},a=()=>{clearTimeout(n),n=setTimeout(()=>i(t.et()),b)},o=new MutationObserver(()=>{t.et()&&i(!0)}),s=()=>{document.readyState===`complete`&&!t.et()&&a()};o.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-fkn-extension`]}),document.addEventListener(`readystatechange`,s),document.readyState===`complete`&&a()}),S=(async e=>{let{kind:n,cookies:r}=t.o(e);if(n===`window`){let n=e;return r===`native`?t.a(n):a.i(n)}let i=e;return r===`native`?C(i):a.i(i)}),C=async e=>(a.a(e),await x(),t.a(e)),w=`https://fkn.app`,T=async(e,t)=>{if(typeof window>`u`)throw Error(`FKN @fkn/lib: relayWorker must be called from the main thread`);let n=await r.f;if(!n)throw Error(`FKN @fkn/lib: relayWorker found no FKN transport in this realm`);r.d(),i.r(`relayed worker`,t?.unregisterSignal);let a=n.emit instanceof MessagePort?{}:{originA:t?.originA??w,originB:t?.originB??`*`};(0,v.relay)(n,e,{key:`fkn-api`,...a,unregisterSignal:t?.unregisterSignal})},E=async()=>typeof window>`u`?!1:(await r.o).connect.prompt(location.origin).catch(()=>!1),D=async()=>typeof window>`u`?null:(await r.o).relay.prompt().catch(()=>null),O=new Set,k=e=>(O.add(e),()=>{O.delete(e)}),A=()=>{if(O.size===0)return!1;for(let e of[...O])try{e()}catch{}return!0},j=(e,t)=>{if(typeof e?.onUpdateTaken==`function`)return Promise.resolve(e.onUpdateTaken(t))},M=e.t({applyUpdate:()=>G,busyReasons:()=>W,onUpdate:()=>z,onUpdateTaken:()=>B,updateReady:()=>N}),N=async()=>typeof window>`u`?!1:r.o.then(e=>e.shell?.updateReady()).then(e=>e===!0).catch(()=>!1),P=new Set,F=!1,I=()=>{F=!0;for(let e of[...P])try{e()}catch{}},L=0,R=()=>{let e=r.c();e&&P.size!==0&&L!==e.epoch&&(L=e.epoch,F=!1,Promise.resolve(e.remote.shell?.onUpdate(I)).catch(()=>{L===e.epoch&&(L=0)}))};typeof window<`u`&&r.u(R);var z=async e=>{if(typeof window>`u`)return()=>{};if(P.add(e),F)try{e()}catch{}return R(),()=>{P.delete(e)}},B=e=>typeof window>`u`?()=>{}:k(e),V=0,H=!1,U=()=>{if(!A()&&!H){H=!0;try{location.reload()}catch{}}};typeof window<`u`&&r.u(()=>{let e=r.c();if(!e||V===e.epoch)return;V=e.epoch;let t=j(e.remote.shell,U);if(!t){V=0;return}t.catch(()=>{V===e.epoch&&(V=0)})});var W=()=>i.n(),G=async()=>typeof window>`u`?!1:r.o.then(e=>e.shell?.applyUpdate()).then(e=>e===!0).catch(()=>!1);exports.ATTACH_FRAME_EVENT_KEY=t.i,exports.BACKGROUND_STOPPED=n.a,exports.CATEGORIES=t.w,exports.EXTENSION_ABI=t.it,exports.ExtensionOperationUnsupportedError=t.at,exports.ExtensionOutdatedError=t.ot,exports.FORGEABLE_HEADERS=t.Y,exports.FrameWindowBlockedError=t.g,exports.FrameWindowRefusedError=t._,exports.LOCATOR_DENIED=t.k,exports.LOCATOR_ERROR=t.P,exports.LOCATOR_INVALID=t.I,exports.LOCATOR_UNSUPPORTED=t.E,exports.PERMISSION_DENIED=t.t,exports.REQUIRED_EXTENSION_ABI=t.st,exports.TimeoutError=t.T,Object.defineProperty(exports,"account",{enumerable:!0,get:function(){return d.t}}),exports.assertAttachableFrameUrl=t.x,exports.assertFetchableUrl=t.H,exports.assertForgeableHeaders=t.X,exports.assertLockdownApplicable=t.S,exports.assertOneCookieIdentity=t.Z,exports.attachFrame=S,exports.attachFramePermission=t.v,exports.box=t.ut,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return a.n}}),exports.connect=E,exports.connectButtonUrl=_.t,exports.cookies=t.B,exports.createFrame=t.y,exports.createVideoElementHandle=t.dt,Object.defineProperty(exports,"desktop",{enumerable:!0,get:function(){return u.t}}),Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return c.t}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return o.t}}),Object.defineProperty(exports,"extension",{enumerable:!0,get:function(){return n.t}}),exports.fetch=n.n,exports.fetchCredentialedPermission=t.W,exports.fetchLocalPermission=t.G,exports.fetchPermission=t.K,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return f.u}}),exports.gotoPermission=t.b,exports.handleRevivableModules=t.lt,exports.hasForgedCookie=t.Q,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return l.t}}),exports.isBackgroundStopped=n.o,exports.isBlockedFetchUrl=t.q,exports.isBlockedFrameUrl=t.C,exports.isExtensionExposed=t.et,exports.isLocalNetworkUrl=t.J,exports.isLocatorDenied=t.F,exports.isLocatorInvalid=t.j,exports.isLocatorUnsupported=t.D,exports.isPermissionDenied=t.n,exports.isTerminalError=t.N,exports.isType=t.ft,exports.modifyRequestHeadersPermission=t.L,Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return s.t}}),Object.defineProperty(exports,"opfs",{enumerable:!0,get:function(){return p.t}}),Object.defineProperty(exports,"packages",{enumerable:!0,get:function(){return m.t}}),exports.permissions=t.r,exports.promptInstall=n.i,exports.promptRelay=D,exports.readCookiePermission=t.V,exports.readExtensionHandshake=t.tt,exports.relayWorker=T,exports.removeRequestHeaderRule=t.R,exports.revive=t.pt,Object.defineProperty(exports,"rooms",{enumerable:!0,get:function(){return h.t}}),exports.setMissingExtensionHandler=t.nt,exports.setRequestHeaderRule=t.z,Object.defineProperty(exports,"shell",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"storage",{enumerable:!0,get:function(){return g.t}}),exports.supportsOperation=t.ct,exports.type=t.mt,exports.waitForExtensionExposure=t.rt;
|
package/index.d.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { t as account_d_exports } from "./account.js";
|
|
2
2
|
import { $ as GateTools, A as attachFramePermission, B as CategoryMeta, C as FrameWindowRefusal, D as StorageState, E as Locator, F as LegacyPermissionRequest, G as VideoElementState, H as handleRevivableModules, I as PermissionGrant, J as isType, K as box, L as PermissionRequest, M as gotoPermission, N as CategoryGrant, O as StorageStateCookie, P as CategoryRequest, Q as Gate, R as permissions, S as FrameWindowOptions, T as GotoOptions, U as BoxedVideoElement, V as PermissionCategory, W as RemoteVideoElement, X as type, Y as revive, Z as Executor, _ as FrameEventMap, a as AttachCookies, b as FramePostMessageOptions, c as BlankPage, d as CookieMatchWire, et as OperationRequest, f as Frame, g as FrameEventListener, h as FrameDocumentEvent, i as AddScriptTagOptions, j as createFrame, k as WindowFrame, l as ClearCookiesOptions, m as FrameBackendEvent, o as AttachFrameOptions, p as FrameBackend, q as createVideoElementHandle, r as AttachFrameFunction, s as AttachWindowOptions, t as ATTACH_FRAME_EVENT_KEY, tt as SelectorPart, u as ClearCookiesWire, v as FrameLocator, w as FrameWindowRefusedError, x as FrameWindowBlockedError, y as FrameMessageEvent, z as CATEGORIES } from "./index-DlBWSKwV.js";
|
|
3
3
|
import { $ as isLocatorInvalid, A as CookieDetails, B as fetchPermission, C as assertLockdownApplicable, D as modifyRequestHeadersPermission, E as RequestHeaderRule, F as ProxyFetchRequest, G as assertOneCookieIdentity, H as isLocalNetworkUrl, I as assertFetchableUrl, J as LOCATOR_ERROR, K as hasForgedCookie, M as cookies, N as readCookiePermission, O as removeRequestHeaderRule, P as FetchInit, Q as isLocatorDenied, R as fetchCredentialedPermission, S as assertAttachableFrameUrl, T as HeaderOperation, U as FORGEABLE_HEADERS, V as isBlockedFetchUrl, W as assertForgeableHeaders, X as LOCATOR_UNSUPPORTED, Y as LOCATOR_INVALID, Z as TimeoutError, _ as BackgroundStoppedError, b as PermissionDeniedError, c as setMissingExtensionHandler, d as ExtensionHandshake, et as isLocatorUnsupported, f as ExtensionOperationUnsupportedError, g as BACKGROUND_STOPPED, h as supportsOperation, i as promptInstall, j as SiteCookie, k as setRequestHeaderRule, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, n as fetch, o as isExtensionExposed, p as ExtensionOutdatedError, q as LOCATOR_DENIED, s as readExtensionHandshake, t as extension_d_exports, tt as isTerminalError, u as EXTENSION_ABI, v as isBackgroundStopped, w as isBlockedFrameUrl, x as isPermissionDenied, y as PERMISSION_DENIED, z as fetchLocalPermission } from "./extension-C4Don9vi.js";
|
|
4
|
-
import {
|
|
5
|
-
import { n as cloud_d_exports } from "./cloud-DK3DtdsU.js";
|
|
4
|
+
import { n as cloud_d_exports } from "./cloud-CWHjH89l.js";
|
|
6
5
|
import { t as dns_d_exports } from "./dns.js";
|
|
7
|
-
import { s as net_d_exports } from "./net-
|
|
6
|
+
import { s as net_d_exports } from "./net-C2sulnNU.js";
|
|
8
7
|
import { t as dgram_d_exports } from "./dgram.js";
|
|
9
8
|
import { t as http_d_exports } from "./http.js";
|
|
10
9
|
import { t as desktop_d_exports } from "./desktop.js";
|
|
11
|
-
import { u as index_d_exports } from "./index-
|
|
10
|
+
import { u as index_d_exports } from "./index-DawD_N1P.js";
|
|
12
11
|
import { t as index_d_exports$1 } from "./opfs.js";
|
|
13
12
|
import { t as packages_d_exports } from "./packages.js";
|
|
14
13
|
import { t as rooms_d_exports } from "./rooms.js";
|
|
15
|
-
import { t as
|
|
14
|
+
import { t as storage_d_exports } from "./storage.js";
|
|
16
15
|
import { t as connectButtonUrl } from "./connect-button-Cp0NS95-.js";
|
|
17
16
|
//#region src/frame.d.ts
|
|
18
17
|
/**
|
|
@@ -129,4 +128,4 @@ declare const busyReasons: () => string[];
|
|
|
129
128
|
*/
|
|
130
129
|
declare const applyUpdate: () => Promise<boolean>;
|
|
131
130
|
//#endregion
|
|
132
|
-
export { ATTACH_FRAME_EVENT_KEY, AddScriptTagOptions, AttachCookies, AttachFrameOptions, AttachWindowOptions, BACKGROUND_STOPPED, type BackgroundStoppedError, BlankPage, BoxedVideoElement, CATEGORIES, CategoryGrant, type CategoryMeta, CategoryRequest, ClearCookiesOptions, ClearCookiesWire, CookieDetails, CookieMatchWire, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, FrameBackendEvent, FrameDocumentEvent, FrameEventListener, FrameEventMap, FrameLocator, FrameMessageEvent, FramePostMessageOptions, FrameWindowBlockedError, FrameWindowOptions, FrameWindowRefusal, FrameWindowRefusedError, type Gate, type GateTools, GotoOptions, HeaderOperation,
|
|
131
|
+
export { ATTACH_FRAME_EVENT_KEY, AddScriptTagOptions, AttachCookies, AttachFrameOptions, AttachWindowOptions, BACKGROUND_STOPPED, type BackgroundStoppedError, BlankPage, BoxedVideoElement, CATEGORIES, CategoryGrant, type CategoryMeta, CategoryRequest, ClearCookiesOptions, ClearCookiesWire, CookieDetails, CookieMatchWire, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, FrameBackendEvent, FrameDocumentEvent, FrameEventListener, FrameEventMap, FrameLocator, FrameMessageEvent, FramePostMessageOptions, FrameWindowBlockedError, FrameWindowOptions, FrameWindowRefusal, FrameWindowRefusedError, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_INVALID, LOCATOR_UNSUPPORTED, LegacyPermissionRequest, Locator, type OperationRequest, PERMISSION_DENIED, type PermissionCategory, type PermissionDeniedError, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RemoteVideoElement, RequestHeaderRule, type SelectorPart, SiteCookie, StorageState, StorageStateCookie, TimeoutError, VideoElementState, WindowFrame, account_d_exports as account, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFramePermission, box, cloud_d_exports as cloud, connectButtonUrl, cookies, createFrame, createVideoElementHandle, desktop_d_exports as desktop, dgram_d_exports as dgram, dns_d_exports as dns, extension_d_exports as extension, fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, index_d_exports as fs, gotoPermission, handleRevivableModules, hasForgedCookie, http_d_exports as http, isBackgroundStopped, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorInvalid, isLocatorUnsupported, isPermissionDenied, isTerminalError, isType, modifyRequestHeadersPermission, net_d_exports as net, index_d_exports$1 as opfs, packages_d_exports as packages, permissions, promptInstall, readCookiePermission, readExtensionHandshake, removeRequestHeaderRule, revive, rooms_d_exports as rooms, setMissingExtensionHandler, setRequestHeaderRule, shell_d_exports as shell, storage_d_exports as storage, supportsOperation, type, waitForExtensionExposure };
|
package/index.js
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, J as ee, K as te, L as ne, N as re, P as ie, Q as ae, R as oe, S as se, T as ce, V as le, W as ue, X as de, Y as fe, Z as l, _ as u, a as d, at as f, b as p, ct as m, dt as h, et as g, ft as _, g as v, i as y, it as b, j as x, k as S, lt as C, mt as w, n as T, nt as E, o as D, ot as O, pt as k, q as A, r as j, rt as M, st as N, t as P, tt as F, ut as I, v as L, w as R, x as z, y as B, z as V } from "./lib-
|
|
3
|
-
import { a as pe, i as me, n as he, o as ge, t as _e } from "./extension-
|
|
2
|
+
import { B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, J as ee, K as te, L as ne, N as re, P as ie, Q as ae, R as oe, S as se, T as ce, V as le, W as ue, X as de, Y as fe, Z as l, _ as u, a as d, at as f, b as p, ct as m, dt as h, et as g, ft as _, g as v, i as y, it as b, j as x, k as S, lt as C, mt as w, n as T, nt as E, o as D, ot as O, pt as k, q as A, r as j, rt as M, st as N, t as P, tt as F, ut as I, v as L, w as R, x as z, y as B, z as V } from "./lib-B2cML3Tq.js";
|
|
3
|
+
import { a as pe, i as me, n as he, o as ge, t as _e } from "./extension-1Je_RJ6_.js";
|
|
4
4
|
import { c as H, d as ve, f as ye, o as U, u as W } from "./api-ySazPAwN.js";
|
|
5
5
|
import { n as be, r as xe } from "./busy-DsMWrSzc.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as Te } from "./
|
|
9
|
-
import { t as Ee } from "./
|
|
10
|
-
import { t as De } from "./
|
|
11
|
-
import { t as Oe } from "./
|
|
12
|
-
import { t as ke } from "./
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { t as Me } from "./
|
|
16
|
-
import { t as Ne } from "./
|
|
17
|
-
import { t as Pe } from "./
|
|
18
|
-
import { t as Fe } from "./
|
|
19
|
-
import {
|
|
20
|
-
import { relay as Le } from "osra";
|
|
6
|
+
import { a as Se, i as G, n as Ce } from "./cloud-JXQKSDrW.js";
|
|
7
|
+
import { t as we } from "./dns.js";
|
|
8
|
+
import { t as Te } from "./net.js";
|
|
9
|
+
import { t as Ee } from "./dgram.js";
|
|
10
|
+
import { t as De } from "./http.js";
|
|
11
|
+
import { t as Oe } from "./desktop.js";
|
|
12
|
+
import { t as ke } from "./account.js";
|
|
13
|
+
import { u as Ae } from "./fs-ClnOPmRF.js";
|
|
14
|
+
import { t as je } from "./opfs.js";
|
|
15
|
+
import { t as Me } from "./packages.js";
|
|
16
|
+
import { t as Ne } from "./rooms.js";
|
|
17
|
+
import { t as Pe } from "./storage.js";
|
|
18
|
+
import { t as Fe } from "./connect-button-DtsN3X1J.js";
|
|
19
|
+
import { relay as Ie } from "osra";
|
|
21
20
|
//#region src/frame.ts
|
|
22
|
-
var
|
|
21
|
+
var Le = 1e4, Re = 150, ze = () => new Promise((e) => {
|
|
23
22
|
if (g()) return e(!0);
|
|
24
|
-
let t, n = setTimeout(() => r(g()),
|
|
23
|
+
let t, n = setTimeout(() => r(g()), Le), r = (r) => {
|
|
25
24
|
clearTimeout(t), clearTimeout(n), a.disconnect(), document.removeEventListener("readystatechange", o), e(r);
|
|
26
25
|
}, i = () => {
|
|
27
|
-
clearTimeout(t), t = setTimeout(() => r(g()),
|
|
26
|
+
clearTimeout(t), t = setTimeout(() => r(g()), Re);
|
|
28
27
|
}, a = new MutationObserver(() => {
|
|
29
28
|
g() && r(!0);
|
|
30
29
|
}), o = () => {
|
|
@@ -34,57 +33,57 @@ var Re = 1e4, ze = 150, Be = () => new Promise((e) => {
|
|
|
34
33
|
attributes: !0,
|
|
35
34
|
attributeFilter: ["data-fkn-extension"]
|
|
36
35
|
}), document.addEventListener("readystatechange", o), document.readyState === "complete" && i();
|
|
37
|
-
}),
|
|
36
|
+
}), Be = (async (e) => {
|
|
38
37
|
let { kind: t, cookies: n } = D(e);
|
|
39
38
|
if (t === "window") {
|
|
40
39
|
let t = e;
|
|
41
40
|
return n === "native" ? d(t) : G(t);
|
|
42
41
|
}
|
|
43
42
|
let r = e;
|
|
44
|
-
return n === "native" ?
|
|
45
|
-
}),
|
|
43
|
+
return n === "native" ? Ve(r) : G(r);
|
|
44
|
+
}), Ve = async (e) => (Se(e), await ze(), d(e)), He = "https://fkn.app", Ue = async (e, t) => {
|
|
46
45
|
if (typeof window > "u") throw Error("FKN @fkn/lib: relayWorker must be called from the main thread");
|
|
47
46
|
let n = await ye;
|
|
48
47
|
if (!n) throw Error("FKN @fkn/lib: relayWorker found no FKN transport in this realm");
|
|
49
48
|
ve(), xe("relayed worker", t?.unregisterSignal);
|
|
50
49
|
let r = n.emit instanceof MessagePort ? {} : {
|
|
51
|
-
originA: t?.originA ??
|
|
50
|
+
originA: t?.originA ?? He,
|
|
52
51
|
originB: t?.originB ?? "*"
|
|
53
52
|
};
|
|
54
|
-
|
|
53
|
+
Ie(n, e, {
|
|
55
54
|
key: "fkn-api",
|
|
56
55
|
...r,
|
|
57
56
|
unregisterSignal: t?.unregisterSignal
|
|
58
57
|
});
|
|
59
|
-
},
|
|
58
|
+
}, We = async () => typeof window > "u" ? !1 : (await U).connect.prompt(location.origin).catch(() => !1), Ge = async () => typeof window > "u" ? null : (await U).relay.prompt().catch(() => null), K = /* @__PURE__ */ new Set(), Ke = (e) => (K.add(e), () => {
|
|
60
59
|
K.delete(e);
|
|
61
|
-
}),
|
|
60
|
+
}), qe = () => {
|
|
62
61
|
if (K.size === 0) return !1;
|
|
63
62
|
for (let e of [...K]) try {
|
|
64
63
|
e();
|
|
65
64
|
} catch {}
|
|
66
65
|
return !0;
|
|
67
|
-
},
|
|
66
|
+
}, q = (e, t) => {
|
|
68
67
|
if (typeof e?.onUpdateTaken == "function") return Promise.resolve(e.onUpdateTaken(t));
|
|
69
|
-
},
|
|
70
|
-
applyUpdate: () =>
|
|
71
|
-
busyReasons: () =>
|
|
72
|
-
onUpdate: () =>
|
|
73
|
-
onUpdateTaken: () =>
|
|
74
|
-
updateReady: () =>
|
|
75
|
-
}),
|
|
68
|
+
}, Je = /* @__PURE__ */ e({
|
|
69
|
+
applyUpdate: () => tt,
|
|
70
|
+
busyReasons: () => et,
|
|
71
|
+
onUpdate: () => Ze,
|
|
72
|
+
onUpdateTaken: () => Qe,
|
|
73
|
+
updateReady: () => Ye
|
|
74
|
+
}), Ye = async () => typeof window > "u" ? !1 : U.then((e) => e.shell?.updateReady()).then((e) => e === !0).catch(() => !1), J = /* @__PURE__ */ new Set(), Y = !1, Xe = () => {
|
|
76
75
|
Y = !0;
|
|
77
76
|
for (let e of [...J]) try {
|
|
78
77
|
e();
|
|
79
78
|
} catch {}
|
|
80
79
|
}, X = 0, Z = () => {
|
|
81
80
|
let e = H();
|
|
82
|
-
e && J.size !== 0 && X !== e.epoch && (X = e.epoch, Y = !1, Promise.resolve(e.remote.shell?.onUpdate(
|
|
81
|
+
e && J.size !== 0 && X !== e.epoch && (X = e.epoch, Y = !1, Promise.resolve(e.remote.shell?.onUpdate(Xe)).catch(() => {
|
|
83
82
|
X === e.epoch && (X = 0);
|
|
84
83
|
}));
|
|
85
84
|
};
|
|
86
85
|
typeof window < "u" && W(Z);
|
|
87
|
-
var
|
|
86
|
+
var Ze = async (e) => {
|
|
88
87
|
if (typeof window > "u") return () => {};
|
|
89
88
|
if (J.add(e), Y) try {
|
|
90
89
|
e();
|
|
@@ -92,8 +91,8 @@ var Qe = async (e) => {
|
|
|
92
91
|
return Z(), () => {
|
|
93
92
|
J.delete(e);
|
|
94
93
|
};
|
|
95
|
-
},
|
|
96
|
-
if (!
|
|
94
|
+
}, Qe = (e) => typeof window > "u" ? () => {} : Ke(e), Q = 0, $ = !1, $e = () => {
|
|
95
|
+
if (!qe() && !$) {
|
|
97
96
|
$ = !0;
|
|
98
97
|
try {
|
|
99
98
|
location.reload();
|
|
@@ -104,7 +103,7 @@ typeof window < "u" && W(() => {
|
|
|
104
103
|
let e = H();
|
|
105
104
|
if (!e || Q === e.epoch) return;
|
|
106
105
|
Q = e.epoch;
|
|
107
|
-
let t =
|
|
106
|
+
let t = q(e.remote.shell, $e);
|
|
108
107
|
if (!t) {
|
|
109
108
|
Q = 0;
|
|
110
109
|
return;
|
|
@@ -113,6 +112,6 @@ typeof window < "u" && W(() => {
|
|
|
113
112
|
Q === e.epoch && (Q = 0);
|
|
114
113
|
});
|
|
115
114
|
});
|
|
116
|
-
var
|
|
115
|
+
var et = () => be(), tt = async () => typeof window > "u" ? !1 : U.then((e) => e.shell?.applyUpdate()).then((e) => e === !0).catch(() => !1);
|
|
117
116
|
//#endregion
|
|
118
|
-
export { y as ATTACH_FRAME_EVENT_KEY, pe as BACKGROUND_STOPPED, R as CATEGORIES, b as EXTENSION_ABI, f as ExtensionOperationUnsupportedError, O as ExtensionOutdatedError, fe as FORGEABLE_HEADERS, v as FrameWindowBlockedError, u as FrameWindowRefusedError,
|
|
117
|
+
export { y as ATTACH_FRAME_EVENT_KEY, pe as BACKGROUND_STOPPED, R as CATEGORIES, b as EXTENSION_ABI, f as ExtensionOperationUnsupportedError, O as ExtensionOutdatedError, fe as FORGEABLE_HEADERS, v as FrameWindowBlockedError, u as FrameWindowRefusedError, S as LOCATOR_DENIED, ie as LOCATOR_ERROR, c as LOCATOR_INVALID, i as LOCATOR_UNSUPPORTED, P as PERMISSION_DENIED, N as REQUIRED_EXTENSION_ABI, ce as TimeoutError, ke as account, z as assertAttachableFrameUrl, s as assertFetchableUrl, de as assertForgeableHeaders, se as assertLockdownApplicable, l as assertOneCookieIdentity, Be as attachFrame, L as attachFramePermission, I as box, Ce as cloud, We as connect, Fe as connectButtonUrl, t as cookies, B as createFrame, h as createVideoElementHandle, Oe as desktop, Ee as dgram, we as dns, _e as extension, he as fetch, ue as fetchCredentialedPermission, o as fetchLocalPermission, te as fetchPermission, Ae as fs, p as gotoPermission, C as handleRevivableModules, ae as hasForgedCookie, De as http, ge as isBackgroundStopped, A as isBlockedFetchUrl, n as isBlockedFrameUrl, g as isExtensionExposed, ee as isLocalNetworkUrl, a as isLocatorDenied, x as isLocatorInvalid, r as isLocatorUnsupported, T as isPermissionDenied, re as isTerminalError, _ as isType, ne as modifyRequestHeadersPermission, Te as net, je as opfs, Me as packages, j as permissions, me as promptInstall, Ge as promptRelay, le as readCookiePermission, F as readExtensionHandshake, Ue as relayWorker, oe as removeRequestHeaderRule, k as revive, Ne as rooms, E as setMissingExtensionHandler, V as setRequestHeaderRule, Je as shell, Pe as storage, m as supportsOperation, w as type, M as waitForExtensionExposure };
|