@fest-lib/lure 0.1.17 → 0.1.19
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/assets/{OPFS.uniform.worker-CDqHwWLq.js → OPFS.uniform.worker-Bzi0SwrR.js} +94 -103
- package/dist/lure.js +11497 -16685
- package/package.json +11 -2
- package/dist/index.js +0 -18825
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function() {
|
|
2
|
-
var
|
|
2
|
+
var Z = Object.defineProperty, De = (e, t, n) => () => {
|
|
3
3
|
if (n) throw n[0];
|
|
4
4
|
try {
|
|
5
5
|
return e && (t = e(e = 0)), t;
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
}
|
|
9
9
|
}, Ne = (e, t) => {
|
|
10
10
|
let n = {};
|
|
11
|
-
for (var s in e)
|
|
11
|
+
for (var s in e) Z(n, s, {
|
|
12
12
|
get: e[s],
|
|
13
13
|
enumerable: !0
|
|
14
14
|
});
|
|
15
|
-
return t ||
|
|
15
|
+
return t || Z(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
16
16
|
};
|
|
17
17
|
let h = (function(e) {
|
|
18
18
|
return e.GET = "get", e.SET = "set", e.CALL = "call", e.APPLY = "apply", e.CONSTRUCT = "construct", e.DELETE = "delete", e.DELETE_PROPERTY = "deleteProperty", e.HAS = "has", e.OWN_KEYS = "ownKeys", e.GET_OWN_PROPERTY_DESCRIPTOR = "getOwnPropertyDescriptor", e.GET_PROPERTY_DESCRIPTOR = "getPropertyDescriptor", e.GET_PROTOTYPE_OF = "getPrototypeOf", e.SET_PROTOTYPE_OF = "setPrototypeOf", e.IS_EXTENSIBLE = "isExtensible", e.PREVENT_EXTENSIONS = "preventExtensions", e.TRANSFER = "transfer", e.IMPORT = "import", e.DISPOSE = "dispose", e;
|
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
function qe(e) {
|
|
35
35
|
return typeof e == "string" ? Be(e) : typeof Worker < "u" && e instanceof Worker ? "worker" : typeof SharedWorker < "u" && e instanceof SharedWorker ? "shared-worker" : typeof MessagePort < "u" && e instanceof MessagePort ? "message-port" : typeof BroadcastChannel < "u" && e instanceof BroadcastChannel ? "broadcast" : typeof WebSocket < "u" && e instanceof WebSocket ? "websocket" : typeof RTCDataChannel < "u" && e instanceof RTCDataChannel ? "rtc-data" : typeof chrome < "u" && e && typeof e == "object" && typeof e.postMessage == "function" && e.onMessage?.addListener ? "chrome-port" : "internal";
|
|
36
36
|
}
|
|
37
|
-
const
|
|
37
|
+
const ee = Symbol.for("@fix"), C = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" || typeof e > "u" || e == null, Fe = (e, t) => C(e) ? t == "number" ? Number(e) || 0 : t == "string" ? String(e) || "" : t == "boolean" ? !!e : e : null, p = (e, t) => e?.[ee] ?? e ?? t ?? t, He = (e) => {
|
|
38
38
|
if (typeof e == "function" || e == null) return e;
|
|
39
39
|
const t = function() {};
|
|
40
|
-
return t[
|
|
40
|
+
return t[ee] = e, t;
|
|
41
41
|
}, Ge = (e) => crypto?.getRandomValues ? crypto?.getRandomValues?.(e) : (() => {
|
|
42
42
|
const t = new Uint8Array(e.length);
|
|
43
43
|
for (let n = 0; n < e.length; n++) t[n] = Math.floor(Math.random() * 256);
|
|
44
44
|
return t;
|
|
45
|
-
})(), d = () => crypto?.randomUUID ? crypto?.randomUUID?.() : "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (e) => (+e ^ Ge?.(/* @__PURE__ */ new Uint8Array(1))?.[0] & 15 >> +e / 4).toString(16)),
|
|
46
|
-
globalThis[
|
|
47
|
-
globalThis[
|
|
45
|
+
})(), d = () => crypto?.randomUUID ? crypto?.randomUUID?.() : "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (e) => (+e ^ Ge?.(/* @__PURE__ */ new Uint8Array(1))?.[0] & 15 >> +e / 4).toString(16)), te = (e) => Array.isArray(e) ? e?.flatMap?.((t) => Array.isArray(t) ? te(t) : t) : e, $ = (e) => te(e)?.every?.(x), x = (e) => C(e) || typeof SharedArrayBuffer == "function" && e instanceof SharedArrayBuffer || Ue(e) || Array.isArray(e) && $(e), Ue = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), z = (e) => C(e) || typeof ArrayBuffer == "function" && e instanceof ArrayBuffer || typeof MessagePort == "function" && e instanceof MessagePort || typeof ReadableStream == "function" && e instanceof ReadableStream || typeof WritableStream == "function" && e instanceof WritableStream || typeof TransformStream == "function" && e instanceof TransformStream || typeof ImageBitmap == "function" && e instanceof ImageBitmap || typeof VideoFrame == "function" && e instanceof VideoFrame || typeof OffscreenCanvas == "function" && e instanceof OffscreenCanvas || typeof RTCDataChannel == "function" && e instanceof RTCDataChannel || typeof AudioData == "function" && e instanceof AudioData || typeof WebTransportReceiveStream == "function" && e instanceof WebTransportReceiveStream || typeof WebTransportSendStream == "function" && e instanceof WebTransportSendStream || typeof WebTransportReceiveStream == "function" && e instanceof WebTransportReceiveStream, ne = Symbol.for("object.boundCtx");
|
|
46
|
+
globalThis[ne] ??= /* @__PURE__ */ new WeakMap();
|
|
47
|
+
globalThis[ne];
|
|
48
48
|
const k = (e, t, n) => {
|
|
49
49
|
if (Array.isArray(e)) return e.every(x) ? e.map(t) : e.map((s, r) => k(s, t, [e, r]));
|
|
50
50
|
if (e instanceof Map) {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
return s.map(([r, i]) => i).every(x) ? Object.fromEntries(s.map(([r, i]) => [r, t(i, r, e)])) : Object.fromEntries(s.map(([r, i]) => [r, k(i, t, [e, r])]));
|
|
61
61
|
}
|
|
62
62
|
return t(e, n?.[1] ?? "", n?.[0] ?? null);
|
|
63
|
-
}, S = /* @__PURE__ */ new WeakMap(),
|
|
63
|
+
}, S = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakMap(), g = (e, t) => e instanceof Promise || typeof e?.then == "function" ? S?.has?.(e) ? t(S?.get?.(e)) : Promise.try?.(async () => {
|
|
64
64
|
const n = await e;
|
|
65
65
|
return S?.set?.(e, n), n;
|
|
66
66
|
})?.then?.(t) : t(e);
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
let s;
|
|
122
|
-
return S?.has?.(e) && (s = S?.get?.(e))?.[t] != null ? s = S?.get?.(e)?.[t] : s =
|
|
122
|
+
return S?.has?.(e) && (s = S?.get?.(e))?.[t] != null ? s = S?.get?.(e)?.[t] : s = re(g(e, async (r) => {
|
|
123
123
|
if (p(r) instanceof Promise) return Reflect.get(r, t, n);
|
|
124
124
|
if (C(r)) return t == Symbol.toPrimitive || t == Symbol.toStringTag ? r : void 0;
|
|
125
125
|
let i;
|
|
@@ -146,10 +146,10 @@
|
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
|
-
function
|
|
150
|
-
return e instanceof Promise || typeof e?.then == "function" ? S?.has?.(e) ? S?.get?.(e) : (
|
|
149
|
+
function re(e, t, n) {
|
|
150
|
+
return e instanceof Promise || typeof e?.then == "function" ? S?.has?.(e) ? S?.get?.(e) : (se?.has?.(e) || e?.then?.((s) => S?.set?.(e, s)), se?.getOrInsertComputed?.(e, () => new Proxy(He(e), new We(t, n)))) : e;
|
|
151
151
|
}
|
|
152
|
-
var
|
|
152
|
+
var oe = class {
|
|
153
153
|
_unsubscribe;
|
|
154
154
|
_closed = !1;
|
|
155
155
|
constructor(e) {
|
|
@@ -190,7 +190,7 @@
|
|
|
190
190
|
} catch (c) {
|
|
191
191
|
a.error(c);
|
|
192
192
|
}
|
|
193
|
-
return new
|
|
193
|
+
return new oe(o);
|
|
194
194
|
}
|
|
195
195
|
pipe(...e) {
|
|
196
196
|
return e.reduce((t, n) => n(t), this);
|
|
@@ -225,7 +225,7 @@
|
|
|
225
225
|
} catch (s) {
|
|
226
226
|
t.error?.(s);
|
|
227
227
|
}
|
|
228
|
-
return new
|
|
228
|
+
return new oe(() => {
|
|
229
229
|
this._subs.delete(t);
|
|
230
230
|
});
|
|
231
231
|
}
|
|
@@ -247,7 +247,7 @@
|
|
|
247
247
|
});
|
|
248
248
|
return () => s.unsubscribe();
|
|
249
249
|
});
|
|
250
|
-
function
|
|
250
|
+
function ie() {
|
|
251
251
|
if (typeof globalThis.Deno < "u") return "deno";
|
|
252
252
|
if (typeof globalThis.process < "u" && globalThis.process?.versions?.node) return "node";
|
|
253
253
|
const e = globalThis.ServiceWorkerGlobalScope, t = globalThis.SharedWorkerGlobalScope, n = globalThis.DedicatedWorkerGlobalScope;
|
|
@@ -262,7 +262,7 @@
|
|
|
262
262
|
}
|
|
263
263
|
return typeof globalThis < "u" && typeof document < "u" ? "window" : "unknown";
|
|
264
264
|
}
|
|
265
|
-
function
|
|
265
|
+
function ae(e) {
|
|
266
266
|
if (typeof RTCDataChannel < "u" && e instanceof RTCDataChannel) return "rtc-data";
|
|
267
267
|
const t = qe(e);
|
|
268
268
|
return t && t !== "internal" ? t : e === self || e === globalThis || e === "self" ? "self" : "internal";
|
|
@@ -368,17 +368,17 @@
|
|
|
368
368
|
const n = function() {}, s = new je(e, t);
|
|
369
369
|
return new Proxy(n, s);
|
|
370
370
|
}
|
|
371
|
-
function
|
|
371
|
+
function ce(e, t, n) {
|
|
372
372
|
if (!e || typeof e != "object" || e.primitive) return e;
|
|
373
|
-
const s =
|
|
373
|
+
const s = _e.get(e);
|
|
374
374
|
if (s) return s;
|
|
375
375
|
const r = H(t, {
|
|
376
376
|
channel: n ?? e.channel ?? "unknown",
|
|
377
377
|
basePath: e.path ?? []
|
|
378
378
|
});
|
|
379
|
-
return
|
|
379
|
+
return _e.set(e, r), V.set(r, e), r;
|
|
380
380
|
}
|
|
381
|
-
const Ze =
|
|
381
|
+
const Ze = ce;
|
|
382
382
|
function et(e) {
|
|
383
383
|
return [
|
|
384
384
|
e.localChannel,
|
|
@@ -392,7 +392,7 @@
|
|
|
392
392
|
const n = t.includeClosed ?? !1, s = t.status ?? (n ? void 0 : "active");
|
|
393
393
|
return [...e].filter((r) => !(s && r.status !== s || t.channel && r.localChannel !== t.channel && r.remoteChannel !== t.channel || t.localChannel && r.localChannel !== t.localChannel || t.remoteChannel && r.remoteChannel !== t.remoteChannel || t.sender && r.sender !== t.sender || t.transportType && r.transportType !== t.transportType || t.direction && r.direction !== t.direction)).sort((r, i) => i.updatedAt - r.updatedAt);
|
|
394
394
|
}
|
|
395
|
-
var
|
|
395
|
+
var le = class {
|
|
396
396
|
_createId;
|
|
397
397
|
_emitEvent;
|
|
398
398
|
_connections = /* @__PURE__ */ new Map();
|
|
@@ -457,14 +457,14 @@
|
|
|
457
457
|
clear() {
|
|
458
458
|
this._connections.clear();
|
|
459
459
|
}
|
|
460
|
-
},
|
|
460
|
+
}, ue = class {
|
|
461
461
|
_name;
|
|
462
462
|
_contextType;
|
|
463
463
|
_config;
|
|
464
464
|
_transports = /* @__PURE__ */ new Map();
|
|
465
465
|
_defaultTransport = null;
|
|
466
466
|
_connectionEvents = new y({ bufferSize: 200 });
|
|
467
|
-
_connectionRegistry = new
|
|
467
|
+
_connectionRegistry = new le(() => d(), (e) => this._connectionEvents.next(e));
|
|
468
468
|
_pending = /* @__PURE__ */ new Map();
|
|
469
469
|
_subscriptions = [];
|
|
470
470
|
_inbound = new y({ bufferSize: 100 });
|
|
@@ -481,7 +481,7 @@
|
|
|
481
481
|
}
|
|
482
482
|
constructor(e) {
|
|
483
483
|
const t = typeof e == "string" ? { name: e } : e;
|
|
484
|
-
this._name = t.name, this._contextType = t.autoDetect !== !1 ?
|
|
484
|
+
this._name = t.name, this._contextType = t.autoDetect !== !1 ? ie() : "unknown", this._config = {
|
|
485
485
|
name: t.name,
|
|
486
486
|
autoDetect: t.autoDetect ?? !0,
|
|
487
487
|
timeout: t.timeout ?? 3e4,
|
|
@@ -491,7 +491,7 @@
|
|
|
491
491
|
}, this._config.autoListen && this._isWorkerContext() && this.listen(self);
|
|
492
492
|
}
|
|
493
493
|
connect(e, t = {}) {
|
|
494
|
-
const n =
|
|
494
|
+
const n = ae(e), s = t.targetChannel ?? this._inferTargetChannel(e, n), r = this._createTransportBinding(e, n, s, t);
|
|
495
495
|
this._transports.set(s, r), this._defaultTransport || (this._defaultTransport = r);
|
|
496
496
|
const i = this._registerConnection({
|
|
497
497
|
localChannel: this._name,
|
|
@@ -508,7 +508,7 @@
|
|
|
508
508
|
}), this;
|
|
509
509
|
}
|
|
510
510
|
listen(e, t = {}) {
|
|
511
|
-
const n =
|
|
511
|
+
const n = ae(e), s = t.targetChannel ?? this._inferTargetChannel(e, n), r = (o) => this._handleIncoming(o), i = this._registerConnection({
|
|
512
512
|
localChannel: this._name,
|
|
513
513
|
remoteChannel: s,
|
|
514
514
|
sender: s,
|
|
@@ -615,7 +615,7 @@
|
|
|
615
615
|
return this.proxy(t, [e]);
|
|
616
616
|
}
|
|
617
617
|
wrapDescriptor(e, t) {
|
|
618
|
-
return
|
|
618
|
+
return ce(e, (s, r, i) => {
|
|
619
619
|
const o = t ?? e?.channel ?? this._getDefaultTarget();
|
|
620
620
|
return this.invoke(o, s, r, i);
|
|
621
621
|
}, t ?? e?.channel ?? this._getDefaultTarget());
|
|
@@ -723,9 +723,7 @@
|
|
|
723
723
|
this._handleResponse(e);
|
|
724
724
|
break;
|
|
725
725
|
case "event": break;
|
|
726
|
-
case "signal":
|
|
727
|
-
this._handleSignal(e);
|
|
728
|
-
break;
|
|
726
|
+
case "signal": this._handleSignal(e);
|
|
729
727
|
}
|
|
730
728
|
}
|
|
731
729
|
_handleResponse(e) {
|
|
@@ -987,12 +985,12 @@
|
|
|
987
985
|
}
|
|
988
986
|
};
|
|
989
987
|
function Y(e) {
|
|
990
|
-
return new
|
|
988
|
+
return new ue(e);
|
|
991
989
|
}
|
|
992
990
|
let G = null;
|
|
993
991
|
function nt() {
|
|
994
992
|
if (!G) {
|
|
995
|
-
const e =
|
|
993
|
+
const e = ie();
|
|
996
994
|
[
|
|
997
995
|
"worker",
|
|
998
996
|
"shared-worker",
|
|
@@ -1032,7 +1030,7 @@
|
|
|
1032
1030
|
typeof OffscreenCanvas != m.udf ? OffscreenCanvas : null,
|
|
1033
1031
|
typeof RTCDataChannel != m.udf ? RTCDataChannel : null
|
|
1034
1032
|
].filter((e) => e != null);
|
|
1035
|
-
function
|
|
1033
|
+
function he() {
|
|
1036
1034
|
try {
|
|
1037
1035
|
const e = globalThis.location?.href;
|
|
1038
1036
|
if (typeof e == "string" && e.length > 0) return e;
|
|
@@ -1042,8 +1040,8 @@
|
|
|
1042
1040
|
} catch {}
|
|
1043
1041
|
return "";
|
|
1044
1042
|
}
|
|
1045
|
-
function
|
|
1046
|
-
const t =
|
|
1043
|
+
function de(e) {
|
|
1044
|
+
const t = he();
|
|
1047
1045
|
if (!t.length) throw new TypeError("[uniform] No base URL for worker resolution (missing location / document.baseURI)");
|
|
1048
1046
|
const n = e.startsWith("/") ? e.replace(/^\//, "./") : e;
|
|
1049
1047
|
return new URL(n, t).href;
|
|
@@ -1051,7 +1049,7 @@
|
|
|
1051
1049
|
const w = {
|
|
1052
1050
|
name: "unknown",
|
|
1053
1051
|
instance: null
|
|
1054
|
-
}, K = /* @__PURE__ */ new Map(),
|
|
1052
|
+
}, K = /* @__PURE__ */ new Map(), fe = (e) => [...Object.values(h)].includes(e);
|
|
1055
1053
|
var st = class {
|
|
1056
1054
|
channelName;
|
|
1057
1055
|
options;
|
|
@@ -1060,7 +1058,7 @@
|
|
|
1060
1058
|
this.channelName = e, this.options = t, this._channel = nt();
|
|
1061
1059
|
}
|
|
1062
1060
|
request(e, t, n, s = {}) {
|
|
1063
|
-
return typeof e == "string" && (e = [e]), Array.isArray(t) &&
|
|
1061
|
+
return typeof e == "string" && (e = [e]), Array.isArray(t) && fe(e) && (s = n, n = t, t = e, e = []), this._channel.invoke(this.channelName, t, e, n);
|
|
1064
1062
|
}
|
|
1065
1063
|
doImportModule(e, t) {
|
|
1066
1064
|
return this._channel.import(e, this.channelName);
|
|
@@ -1083,7 +1081,7 @@
|
|
|
1083
1081
|
return this.channel;
|
|
1084
1082
|
}
|
|
1085
1083
|
request(e, t, n, s = {}, r = "worker") {
|
|
1086
|
-
return typeof e == "string" && (e = [e]), Array.isArray(t) &&
|
|
1084
|
+
return typeof e == "string" && (e = [e]), Array.isArray(t) && fe(e) && (r = s, s = n, n = t, t = e, e = []), this._unified.invoke(r, t, e, n);
|
|
1087
1085
|
}
|
|
1088
1086
|
resolveResponse(e, t) {
|
|
1089
1087
|
return Promise.resolve(t);
|
|
@@ -1101,9 +1099,9 @@
|
|
|
1101
1099
|
if (K.has(e)) return K.get(e) ?? null;
|
|
1102
1100
|
const t = new rt(e);
|
|
1103
1101
|
return e === "$host$" && (w.name = e, w.instance = t), K.set(e, t), t;
|
|
1104
|
-
},
|
|
1102
|
+
}, pe = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), _e = /* @__PURE__ */ new WeakMap(), it = (e, t = w?.name, n) => typeof e == "object" && e != null || typeof e == "function" && e != null ? V.has(e) ? V.get(e) : pe.has(e) ? pe.get(e) : $(e) || n?.includes?.(e) || t == w?.name ? e : {
|
|
1105
1103
|
$isDescriptor: !0,
|
|
1106
|
-
path:
|
|
1104
|
+
path: T.get(e) ?? (() => {
|
|
1107
1105
|
const s = [d()];
|
|
1108
1106
|
return U(s, e), s;
|
|
1109
1107
|
})(),
|
|
@@ -1114,7 +1112,7 @@
|
|
|
1114
1112
|
enumerable: !0,
|
|
1115
1113
|
configurable: !0,
|
|
1116
1114
|
argumentCount: e instanceof Function ? e.length : -1
|
|
1117
|
-
} : x(e) ? e : null, at = Symbol.for("@requestHandler"), D = Symbol.for("@descriptor"), X = (e) => x(e) || e?.[D] ? e : e?.$isDescriptor ? Ze(e, async () => {}) : $(e) ? e : null, L = /* @__PURE__ */ new Map(),
|
|
1115
|
+
} : x(e) ? e : null, at = Symbol.for("@requestHandler"), D = Symbol.for("@descriptor"), X = (e) => x(e) || e?.[D] ? e : e?.$isDescriptor ? Ze(e, async () => {}) : $(e) ? e : null, L = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new WeakMap(), ye = (e, t) => {
|
|
1118
1116
|
if (t != null && !Array.isArray(t) && (t = [t]), t == null || t?.length < 1) return e;
|
|
1119
1117
|
const n = e?.[D] ?? (e?.$isDescriptor ? e : null);
|
|
1120
1118
|
if (n && n?.owner == w?.name && (e = R(n?.path) ?? e), C(e)) return e;
|
|
@@ -1123,24 +1121,21 @@
|
|
|
1123
1121
|
}, R = (e) => {
|
|
1124
1122
|
if (e != null && !Array.isArray(e) && (e = [e]), e == null || e?.length < 1) return null;
|
|
1125
1123
|
const t = L?.get?.(e?.[0]) ?? null;
|
|
1126
|
-
return t != null ?
|
|
1124
|
+
return t != null ? ye(t, e?.slice?.(1)) : null;
|
|
1127
1125
|
}, U = (e, t) => {
|
|
1128
1126
|
const n = t?.[D] ?? (t?.$isDescriptor ? t : null);
|
|
1129
1127
|
if (n && n?.owner == w?.name && (t = R(n?.path) ?? t), e != null && !Array.isArray(e) && (e = [e]), e == null || e?.length < 1) return null;
|
|
1130
1128
|
const s = L?.get?.(e?.[0]) ?? null;
|
|
1131
|
-
return e?.length > 1 ?
|
|
1132
|
-
}, ge = (e) => {
|
|
1133
|
-
if (e != null && !Array.isArray(e) && (e = [e]), e == null || e?.length < 1) return !1;
|
|
1134
|
-
return !(L?.get?.(e?.[0]) ?? null) && e?.length <= 1 ? (L?.delete?.(e?.[0]), !0) : !1;
|
|
1135
|
-
}, ct = (e) => {
|
|
1129
|
+
return e?.length > 1 ? ye(s, e?.slice?.(1, -1))[e?.[e?.length - 1]] = t : L?.set?.(e?.[0], t), (typeof t == "object" || typeof t == "function") && T?.set?.(t, e), t;
|
|
1130
|
+
}, ge = (e) => (e != null && !Array.isArray(e) && (e = [e]), e == null || e?.length < 1 ? !1 : !(L?.get?.(e?.[0]) ?? null) && e?.length <= 1 ? (L?.delete?.(e?.[0]), !0) : !1), ct = (e) => {
|
|
1136
1131
|
const t = e?.[D] ?? (e?.$isDescriptor ? e : null);
|
|
1137
1132
|
t && t?.owner == w?.name && (e = R(t?.path) ?? e);
|
|
1138
|
-
const n =
|
|
1139
|
-
return n == null || n?.length < 1 ? !1 : (ge(n), (typeof e == "object" || typeof e == "function") &&
|
|
1133
|
+
const n = T?.get?.(e) ?? t?.path;
|
|
1134
|
+
return n == null || n?.length < 1 ? !1 : (ge(n), (typeof e == "object" || typeof e == "function") && T?.delete?.(e), !0);
|
|
1140
1135
|
}, lt = (e) => {
|
|
1141
1136
|
const t = e?.[D] ?? (e?.$isDescriptor ? e : null);
|
|
1142
|
-
return (
|
|
1143
|
-
},
|
|
1137
|
+
return (T?.get?.(e) ?? t?.path) == null;
|
|
1138
|
+
}, E = (e) => (typeof e == "object" || typeof e == "function") && e != null, me = {
|
|
1144
1139
|
get: (e, t) => e?.[t],
|
|
1145
1140
|
set: (e, t, n) => (e[t] = n, !0),
|
|
1146
1141
|
has: (e, t) => t in e,
|
|
@@ -1203,38 +1198,36 @@
|
|
|
1203
1198
|
if (s.target) {
|
|
1204
1199
|
const f = t[t.length - 1];
|
|
1205
1200
|
l = o.deleteProperty?.(a, f) ?? delete a[f];
|
|
1206
|
-
} else l = t?.length > 0 ? ge(t) : ct(a), l && (_ =
|
|
1201
|
+
} else l = t?.length > 0 ? ge(t) : ct(a), l && (_ = T.get(a) ?? []);
|
|
1207
1202
|
break;
|
|
1208
1203
|
case "has":
|
|
1209
1204
|
case h.HAS:
|
|
1210
|
-
l = o.has?.(a, n?.[0]) ?? (
|
|
1205
|
+
l = o.has?.(a, n?.[0]) ?? (E(a) ? n?.[0] in a : !1);
|
|
1211
1206
|
break;
|
|
1212
1207
|
case "ownkeys":
|
|
1213
1208
|
case h.OWN_KEYS:
|
|
1214
|
-
l = o.ownKeys?.(a) ?? (
|
|
1209
|
+
l = o.ownKeys?.(a) ?? (E(a) ? Object.keys(a) : []);
|
|
1215
1210
|
break;
|
|
1216
1211
|
case "getownpropertydescriptor":
|
|
1217
1212
|
case "getpropertydescriptor":
|
|
1218
1213
|
case h.GET_OWN_PROPERTY_DESCRIPTOR:
|
|
1219
1214
|
case h.GET_PROPERTY_DESCRIPTOR:
|
|
1220
|
-
l = o.getOwnPropertyDescriptor?.(a, n?.[0] ?? t?.at(-1) ?? "") ?? (
|
|
1215
|
+
l = o.getOwnPropertyDescriptor?.(a, n?.[0] ?? t?.at(-1) ?? "") ?? (E(a) ? Object.getOwnPropertyDescriptor(a, n?.[0] ?? t?.at(-1) ?? "") : void 0);
|
|
1221
1216
|
break;
|
|
1222
1217
|
case "getprototypeof":
|
|
1223
1218
|
case h.GET_PROTOTYPE_OF:
|
|
1224
|
-
l = o.getPrototypeOf?.(a) ?? (
|
|
1219
|
+
l = o.getPrototypeOf?.(a) ?? (E(a) ? Object.getPrototypeOf(a) : null);
|
|
1225
1220
|
break;
|
|
1226
1221
|
case "setprototypeof":
|
|
1227
1222
|
case h.SET_PROTOTYPE_OF:
|
|
1228
|
-
l = o.setPrototypeOf?.(a, n?.[0]) ?? (
|
|
1223
|
+
l = o.setPrototypeOf?.(a, n?.[0]) ?? (E(a) ? Object.setPrototypeOf(a, n?.[0]) : !1);
|
|
1229
1224
|
break;
|
|
1230
1225
|
case "isextensible":
|
|
1231
1226
|
case h.IS_EXTENSIBLE:
|
|
1232
|
-
l = o.isExtensible?.(a) ?? (
|
|
1227
|
+
l = o.isExtensible?.(a) ?? (E(a) ? Object.isExtensible(a) : !0);
|
|
1233
1228
|
break;
|
|
1234
1229
|
case "preventextensions":
|
|
1235
|
-
case h.PREVENT_EXTENSIONS:
|
|
1236
|
-
l = o.preventExtensions?.(a) ?? (P(a) ? Object.preventExtensions(a) : !1);
|
|
1237
|
-
break;
|
|
1230
|
+
case h.PREVENT_EXTENSIONS: l = o.preventExtensions?.(a) ?? (E(a) ? Object.preventExtensions(a) : !1);
|
|
1238
1231
|
}
|
|
1239
1232
|
return {
|
|
1240
1233
|
result: l,
|
|
@@ -1245,7 +1238,7 @@
|
|
|
1245
1238
|
async function be(e, t, n, s, r, i, o) {
|
|
1246
1239
|
const a = await i, c = z(a) && o.includes(a) || x(a);
|
|
1247
1240
|
let l = r;
|
|
1248
|
-
!c && t !== "get" && t !== h.GET && (typeof a == "object" || typeof a == "function") && (lt(a) ? (l = [d()], U(l, a)) : l =
|
|
1241
|
+
!c && t !== "get" && t !== h.GET && (typeof a == "object" || typeof a == "function") && (lt(a) ? (l = [d()], U(l, a)) : l = T.get(a) ?? []);
|
|
1249
1242
|
const _ = R(l), f = t === "get" || t === h.GET ? l?.at(-1) : void 0, b = R(r), N = k(a, (Ot) => it(Ot, n, o)) ?? a;
|
|
1250
1243
|
return {
|
|
1251
1244
|
response: {
|
|
@@ -1269,7 +1262,7 @@
|
|
|
1269
1262
|
enumerable: !0,
|
|
1270
1263
|
configurable: !0,
|
|
1271
1264
|
argumentCount: b instanceof Function ? b.length : -1,
|
|
1272
|
-
...
|
|
1265
|
+
...E(_) && f != null ? Object.getOwnPropertyDescriptor(_, f) : {}
|
|
1273
1266
|
}
|
|
1274
1267
|
}
|
|
1275
1268
|
},
|
|
@@ -1793,17 +1786,15 @@
|
|
|
1793
1786
|
case "delete":
|
|
1794
1787
|
o.key !== void 0 && a.delete(o.key);
|
|
1795
1788
|
break;
|
|
1796
|
-
case "update":
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
c.
|
|
1800
|
-
c.result
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
}
|
|
1806
|
-
break;
|
|
1789
|
+
case "update": if (o.key !== void 0) {
|
|
1790
|
+
const c = a.get(o.key);
|
|
1791
|
+
c.onsuccess = () => {
|
|
1792
|
+
c.result && o.value && a.put({
|
|
1793
|
+
...c.result,
|
|
1794
|
+
...o.value
|
|
1795
|
+
});
|
|
1796
|
+
};
|
|
1797
|
+
}
|
|
1807
1798
|
}
|
|
1808
1799
|
}
|
|
1809
1800
|
i.oncomplete = () => s(), i.onerror = () => r(/* @__PURE__ */ new Error("Transaction failed"));
|
|
@@ -1892,11 +1883,11 @@
|
|
|
1892
1883
|
if (this._isRolledBack) throw new Error("Transaction already rolled back");
|
|
1893
1884
|
}
|
|
1894
1885
|
};
|
|
1895
|
-
const
|
|
1886
|
+
const j = /* @__PURE__ */ new Map();
|
|
1896
1887
|
function wt(e) {
|
|
1897
|
-
return
|
|
1888
|
+
return j.has(e) || j.set(e, new gt(e)), j.get(e);
|
|
1898
1889
|
}
|
|
1899
|
-
const Se =
|
|
1890
|
+
const Se = he(), bt = Se.length > 0 ? new URL("../transport/Worker.ts", Se) : "";
|
|
1900
1891
|
var xe = class {
|
|
1901
1892
|
_channel;
|
|
1902
1893
|
_context;
|
|
@@ -1933,7 +1924,7 @@
|
|
|
1933
1924
|
get context() {
|
|
1934
1925
|
return this._context;
|
|
1935
1926
|
}
|
|
1936
|
-
},
|
|
1927
|
+
}, P = class {
|
|
1937
1928
|
_channel;
|
|
1938
1929
|
_context;
|
|
1939
1930
|
_options;
|
|
@@ -1949,7 +1940,7 @@
|
|
|
1949
1940
|
return this._unified.__getPrivate("_transports");
|
|
1950
1941
|
}
|
|
1951
1942
|
constructor(e, t, n = {}) {
|
|
1952
|
-
this._channel = e, this._context = t, this._options = n, this._connection = Ce().getOrCreate(e, "internal", n), this._unified = new
|
|
1943
|
+
this._channel = e, this._context = t, this._options = n, this._connection = Ce().getOrCreate(e, "internal", n), this._unified = new ue({
|
|
1953
1944
|
name: e,
|
|
1954
1945
|
autoListen: !1,
|
|
1955
1946
|
timeout: n?.timeout
|
|
@@ -2011,7 +2002,7 @@
|
|
|
2011
2002
|
_remoteChannels = /* @__PURE__ */ new Map();
|
|
2012
2003
|
_deferredChannels = /* @__PURE__ */ new Map();
|
|
2013
2004
|
_connectionEvents = new y({ bufferSize: 200 });
|
|
2014
|
-
_connectionRegistry = new
|
|
2005
|
+
_connectionRegistry = new le(() => d(), (e) => this._emitConnectionEvent(e));
|
|
2015
2006
|
_closed = !1;
|
|
2016
2007
|
_globalSelf = null;
|
|
2017
2008
|
constructor(e = {}) {
|
|
@@ -2021,7 +2012,7 @@
|
|
|
2021
2012
|
if (this._host && !e) return this._host;
|
|
2022
2013
|
const t = e ?? this._hostName;
|
|
2023
2014
|
if (this._hostName = t, this._endpoints.has(t)) return this._host = this._endpoints.get(t).handler, this._host;
|
|
2024
|
-
this._host = new
|
|
2015
|
+
this._host = new P(t, this, this._options.defaultOptions);
|
|
2025
2016
|
const n = {
|
|
2026
2017
|
name: t,
|
|
2027
2018
|
handler: this._host,
|
|
@@ -2071,7 +2062,7 @@
|
|
|
2071
2062
|
}
|
|
2072
2063
|
createChannel(e, t = {}) {
|
|
2073
2064
|
if (this._endpoints.has(e)) return this._endpoints.get(e);
|
|
2074
|
-
const n = new
|
|
2065
|
+
const n = new P(e, this, {
|
|
2075
2066
|
...this._options.defaultOptions,
|
|
2076
2067
|
...t
|
|
2077
2068
|
}), s = {
|
|
@@ -2122,7 +2113,7 @@
|
|
|
2122
2113
|
async addWorker(e, t, n = {}) {
|
|
2123
2114
|
const s = ve(t);
|
|
2124
2115
|
if (!s) throw new Error(`Failed to create worker for channel: ${e}`);
|
|
2125
|
-
const r = new
|
|
2116
|
+
const r = new P(e, this, {
|
|
2126
2117
|
...this._options.defaultOptions,
|
|
2127
2118
|
...n
|
|
2128
2119
|
}), i = r.createRemoteChannel(e, n, s), o = {
|
|
@@ -2143,7 +2134,7 @@
|
|
|
2143
2134
|
}), o;
|
|
2144
2135
|
}
|
|
2145
2136
|
async addPort(e, t, n = {}) {
|
|
2146
|
-
const s = new
|
|
2137
|
+
const s = new P(e, this, {
|
|
2147
2138
|
...this._options.defaultOptions,
|
|
2148
2139
|
...n
|
|
2149
2140
|
});
|
|
@@ -2166,7 +2157,7 @@
|
|
|
2166
2157
|
}), i;
|
|
2167
2158
|
}
|
|
2168
2159
|
async addBroadcast(e, t, n = {}) {
|
|
2169
|
-
const s = new BroadcastChannel(t ?? e), r = new
|
|
2160
|
+
const s = new BroadcastChannel(t ?? e), r = new P(e, this, {
|
|
2170
2161
|
...this._options.defaultOptions,
|
|
2171
2162
|
...n
|
|
2172
2163
|
}), i = r.createRemoteChannel(e, n, s), o = {
|
|
@@ -2187,7 +2178,7 @@
|
|
|
2187
2178
|
}), o;
|
|
2188
2179
|
}
|
|
2189
2180
|
addSelfChannel(e, t = {}) {
|
|
2190
|
-
const n = new
|
|
2181
|
+
const n = new P(e, this, {
|
|
2191
2182
|
...this._options.defaultOptions,
|
|
2192
2183
|
...t
|
|
2193
2184
|
}), s = this._globalSelf ?? (typeof self < "u" ? self : null), r = {
|
|
@@ -2218,10 +2209,10 @@
|
|
|
2218
2209
|
}
|
|
2219
2210
|
}
|
|
2220
2211
|
createChannelPair(e, t, n = {}) {
|
|
2221
|
-
const s = new MessageChannel(), r = new
|
|
2212
|
+
const s = new MessageChannel(), r = new P(e, this, {
|
|
2222
2213
|
...this._options.defaultOptions,
|
|
2223
2214
|
...n
|
|
2224
|
-
}), i = new
|
|
2215
|
+
}), i = new P(t, this, {
|
|
2225
2216
|
...this._options.defaultOptions,
|
|
2226
2217
|
...n
|
|
2227
2218
|
});
|
|
@@ -2261,7 +2252,7 @@
|
|
|
2261
2252
|
$createOrUseExistingRemote(e, t = {}, n) {
|
|
2262
2253
|
if (e == null || n) return null;
|
|
2263
2254
|
if (this._remoteChannels.has(e)) return this._remoteChannels.get(e);
|
|
2264
|
-
const s = new MessageChannel(), r =
|
|
2255
|
+
const s = new MessageChannel(), r = re(new Promise((o) => {
|
|
2265
2256
|
const a = ve(bt);
|
|
2266
2257
|
a?.addEventListener?.("message", (c) => {
|
|
2267
2258
|
c.data.type === "channelCreated" && (s.port1?.start?.(), o(new xe(c.data.channel, this, t)));
|
|
@@ -2391,7 +2382,7 @@
|
|
|
2391
2382
|
} catch {
|
|
2392
2383
|
return e({ type: "module" });
|
|
2393
2384
|
}
|
|
2394
|
-
return typeof e == "string" ? e.startsWith("/") ? new Worker(
|
|
2385
|
+
return typeof e == "string" ? e.startsWith("/") ? new Worker(de(e.replace(/^\//, "./")), { type: "module" }) : URL.canParse(e) || e.startsWith("./") ? new Worker(de(e), { type: "module" }) : new Worker(URL.createObjectURL(new Blob([e], { type: "application/javascript" })), { type: "module" }) : e instanceof Blob || e instanceof File ? new Worker(URL.createObjectURL(e), { type: "module" }) : e ?? (typeof self < "u" ? self : null);
|
|
2395
2386
|
}
|
|
2396
2387
|
const xt = /* @__PURE__ */ new Map();
|
|
2397
2388
|
function kt(e = {}) {
|
|
@@ -2586,9 +2577,9 @@
|
|
|
2586
2577
|
this._subscriptions.forEach((e) => e.unsubscribe()), this._subscriptions = [], this._incomingConnections.complete(), this._channelCreated.complete(), this._channelClosed.complete(), this._context.close();
|
|
2587
2578
|
}
|
|
2588
2579
|
};
|
|
2589
|
-
let
|
|
2580
|
+
let J = null;
|
|
2590
2581
|
function Pt(e) {
|
|
2591
|
-
return
|
|
2582
|
+
return J || (J = new Et(e)), J;
|
|
2592
2583
|
}
|
|
2593
2584
|
Pt({ name: "worker" });
|
|
2594
2585
|
var W = class {
|
|
@@ -2710,7 +2701,7 @@
|
|
|
2710
2701
|
return this._channelName;
|
|
2711
2702
|
}
|
|
2712
2703
|
};
|
|
2713
|
-
function
|
|
2704
|
+
function Q(e, t) {
|
|
2714
2705
|
const n = new MessageChannel();
|
|
2715
2706
|
return {
|
|
2716
2707
|
local: new W(n.port1, e, t),
|
|
@@ -2731,7 +2722,7 @@
|
|
|
2731
2722
|
async connect() {
|
|
2732
2723
|
if (this._transport && this._handshakeComplete) return this._transport;
|
|
2733
2724
|
this._state.next("connecting");
|
|
2734
|
-
const { local: e, remote: t } =
|
|
2725
|
+
const { local: e, remote: t } = Q(this._channelName, this._config);
|
|
2735
2726
|
return this._target.postMessage({
|
|
2736
2727
|
type: "port-connect",
|
|
2737
2728
|
channelName: this._channelName,
|
|
@@ -2781,10 +2772,10 @@
|
|
|
2781
2772
|
var At = Ne({
|
|
2782
2773
|
getDirHandle: () => O,
|
|
2783
2774
|
getFileSystemRoot: () => A,
|
|
2784
|
-
handlers: () =>
|
|
2775
|
+
handlers: () => v,
|
|
2785
2776
|
normalizePath: () => I,
|
|
2786
2777
|
resolveFileSystemHandle: () => Ae
|
|
2787
|
-
}), B, q, A, I, Ae, O,
|
|
2778
|
+
}), B, q, A, I, Ae, O, v, Ie, M, Oe = De((() => {
|
|
2788
2779
|
B = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), A = async (e = "") => e && B.has(e) ? B.get(e) : await navigator.storage.getDirectory(), I = (e) => e?.trim?.()?.replace(/\/+/g, "/") || "/", Ae = async (e, t, n = !1) => {
|
|
2789
2780
|
const s = I(t).split("/").filter((i) => i && i !== ".");
|
|
2790
2781
|
let r = e;
|
|
@@ -2808,7 +2799,7 @@
|
|
|
2808
2799
|
let r = e;
|
|
2809
2800
|
for (const i of s) r = await r.getDirectoryHandle(i, { create: n });
|
|
2810
2801
|
return r;
|
|
2811
|
-
},
|
|
2802
|
+
}, v = {
|
|
2812
2803
|
mount: async ({ id: e, handle: t }) => (B.set(e, t), !0),
|
|
2813
2804
|
unmount: async ({ id: e }) => (B.delete(e), !0),
|
|
2814
2805
|
readDirectory: async ({ rootId: e, path: t, create: n }) => {
|
|
@@ -2904,7 +2895,7 @@
|
|
|
2904
2895
|
if (!t || typeof t != "object" || t?.type !== "opfs-sw-request") return;
|
|
2905
2896
|
const n = String(t?.requestId || ""), s = String(t?.action || ""), r = t?.payload;
|
|
2906
2897
|
if (!n || !s) return;
|
|
2907
|
-
const i =
|
|
2898
|
+
const i = v[s];
|
|
2908
2899
|
if (!i) {
|
|
2909
2900
|
M?.postMessage?.({
|
|
2910
2901
|
type: "opfs-sw-response",
|
|
@@ -2937,8 +2928,8 @@
|
|
|
2937
2928
|
self.addEventListener("message", async (e) => {
|
|
2938
2929
|
if (!e.data || typeof e.data != "object") return;
|
|
2939
2930
|
const { id: t, type: n, payload: s } = e.data;
|
|
2940
|
-
if (
|
|
2941
|
-
const r = await
|
|
2931
|
+
if (v[n]) try {
|
|
2932
|
+
const r = await v[n](s);
|
|
2942
2933
|
self.postMessage({
|
|
2943
2934
|
id: t,
|
|
2944
2935
|
result: r
|
|
@@ -2955,7 +2946,7 @@
|
|
|
2955
2946
|
});
|
|
2956
2947
|
});
|
|
2957
2948
|
}));
|
|
2958
|
-
Oe(),
|
|
2949
|
+
Oe(), v && Re(v);
|
|
2959
2950
|
const It = async (e) => {
|
|
2960
2951
|
try {
|
|
2961
2952
|
if (e.type === "batch") {
|
|
@@ -2970,7 +2961,7 @@
|
|
|
2970
2961
|
throw console.error("[OPFS Worker] Message processing error:", t), t;
|
|
2971
2962
|
}
|
|
2972
2963
|
}, Me = async (e) => {
|
|
2973
|
-
const t =
|
|
2964
|
+
const t = v[e.type];
|
|
2974
2965
|
if (!t) throw new Error(`Unknown message type: ${e.type}`);
|
|
2975
2966
|
return await t(e.payload);
|
|
2976
2967
|
};
|