@fest-lib/uniform 0.1.6 → 0.1.8
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/{cbor-x-DhdMOAu4.js → cbor-x-CR9Hs652.js} +413 -388
- package/dist/uniform.js +1149 -1268
- package/package.json +3 -3
- package/dist/index.js +0 -8417
package/dist/uniform.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { Promised as rn, UUIDv4 as h, deepOperateAndClone as he, isCanJustReturn as Me, isCanTransfer as Ie, isNotComplexArray as ot, isPrimitive as Ae } from "@fest-lib/core";
|
|
2
|
+
var Qs = /* @__PURE__ */ (function(e) {
|
|
2
3
|
return e.SUCCESS = "success", e.ERROR = "error", e;
|
|
3
|
-
})({}),
|
|
4
|
+
})({}), Vs = /* @__PURE__ */ (function(e) {
|
|
4
5
|
return e.PRIMITIVE = "primitive", e.NUMBER = "number", e.STRING = "string", e.BOOLEAN = "boolean", e.BIGINT = "bigint", e.UNDEFINED = "undefined", e.NULL = "null", e.OBJECT = "object", e.FUNCTION = "function", e.ARRAY = "array", e.MAP = "map", e.SET = "set", e.SYMBOL = "symbol", e.WEAK_REF = "weakRef", e.PROMISE = "promise", e.UNKNOWN = "unknown", e;
|
|
5
6
|
})({}), d = /* @__PURE__ */ (function(e) {
|
|
6
7
|
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;
|
|
7
|
-
})({}),
|
|
8
|
+
})({}), on = {
|
|
8
9
|
ws: "websocket",
|
|
9
10
|
socket: "websocket",
|
|
10
11
|
socketio: "socket-io",
|
|
@@ -14,15 +15,15 @@ var sr = /* @__PURE__ */ (function(e) {
|
|
|
14
15
|
"service-worker-host": "service-worker",
|
|
15
16
|
"ring-buffer": "atomics"
|
|
16
17
|
};
|
|
17
|
-
function
|
|
18
|
+
function an(e) {
|
|
18
19
|
const t = String(e ?? "").trim().toLowerCase();
|
|
19
|
-
return t ?
|
|
20
|
+
return t ? on[t] ?? t : "internal";
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
-
return typeof e == "string" ?
|
|
22
|
+
function Z(e) {
|
|
23
|
+
return typeof e == "string" ? an(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";
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
-
const t =
|
|
25
|
+
function at(e) {
|
|
26
|
+
const t = Z(e);
|
|
26
27
|
return {
|
|
27
28
|
type: t,
|
|
28
29
|
supports: {
|
|
@@ -134,7 +135,7 @@ function dt(e) {
|
|
|
134
135
|
}[t]
|
|
135
136
|
};
|
|
136
137
|
}
|
|
137
|
-
function
|
|
138
|
+
function g(e, t) {
|
|
138
139
|
return (n, s) => {
|
|
139
140
|
const r = s ?? n?.transferable ?? [], { transferable: i, ...o } = n;
|
|
140
141
|
if (e instanceof Worker) {
|
|
@@ -243,8 +244,8 @@ function m(e, t, n, s, r) {
|
|
|
243
244
|
}
|
|
244
245
|
if (e === "chrome-tabs" && typeof chrome < "u" && chrome.runtime) {
|
|
245
246
|
const c = r?.tabId;
|
|
246
|
-
if (c != null) return
|
|
247
|
-
const l = (
|
|
247
|
+
if (c != null) return ct(c, (u) => t(u));
|
|
248
|
+
const l = (u) => (t(u), !1);
|
|
248
249
|
return chrome.runtime.onMessage.addListener(l), () => chrome.runtime.onMessage.removeListener(l);
|
|
249
250
|
}
|
|
250
251
|
if (e === "chrome-port" && typeof chrome < "u" && chrome.runtime) {
|
|
@@ -262,10 +263,10 @@ function m(e, t, n, s, r) {
|
|
|
262
263
|
return navigator.serviceWorker.addEventListener("message", i), () => navigator.serviceWorker.removeEventListener("message", i);
|
|
263
264
|
if (e === "service-worker-host" || e === "self") {
|
|
264
265
|
const c = (l) => {
|
|
265
|
-
const
|
|
266
|
-
t(
|
|
266
|
+
const u = e === "service-worker-host" ? l.source?.id : void 0;
|
|
267
|
+
t(u ? {
|
|
267
268
|
...l.data,
|
|
268
|
-
_clientId:
|
|
269
|
+
_clientId: u
|
|
269
270
|
} : l.data);
|
|
270
271
|
};
|
|
271
272
|
return self.addEventListener("message", c), () => self.removeEventListener("message", c);
|
|
@@ -273,13 +274,13 @@ function m(e, t, n, s, r) {
|
|
|
273
274
|
return () => {
|
|
274
275
|
};
|
|
275
276
|
}
|
|
276
|
-
function
|
|
277
|
+
function cn(e, t) {
|
|
277
278
|
if (typeof chrome > "u" || !chrome.runtime) return () => {
|
|
278
279
|
};
|
|
279
280
|
const n = (s, r, i) => e(s, i, r);
|
|
280
281
|
return t?.external && chrome.runtime.onMessageExternal ? (chrome.runtime.onMessageExternal.addListener(n), () => chrome.runtime.onMessageExternal.removeListener(n)) : (chrome.runtime.onMessage.addListener(n), () => chrome.runtime.onMessage.removeListener(n));
|
|
281
282
|
}
|
|
282
|
-
function
|
|
283
|
+
function ct(e, t) {
|
|
283
284
|
if (typeof chrome > "u" || !chrome.runtime) return () => {
|
|
284
285
|
};
|
|
285
286
|
const n = (s, r) => {
|
|
@@ -287,7 +288,7 @@ function ft(e, t) {
|
|
|
287
288
|
};
|
|
288
289
|
return chrome.runtime.onMessage.addListener(n), () => chrome.runtime.onMessage.removeListener(n);
|
|
289
290
|
}
|
|
290
|
-
function
|
|
291
|
+
function lt(e, t = {}) {
|
|
291
292
|
let n = new WebSocket(e, t.protocols);
|
|
292
293
|
t.binaryType && (n.binaryType = t.binaryType);
|
|
293
294
|
let s = 0, r = null;
|
|
@@ -304,12 +305,12 @@ function pt(e, t = {}) {
|
|
|
304
305
|
socket: n,
|
|
305
306
|
send: i,
|
|
306
307
|
listen: (c) => {
|
|
307
|
-
const l = (
|
|
308
|
-
if (typeof
|
|
309
|
-
c(JSON.parse(
|
|
308
|
+
const l = (u) => {
|
|
309
|
+
if (typeof u.data == "string") try {
|
|
310
|
+
c(JSON.parse(u.data));
|
|
310
311
|
} catch {
|
|
311
312
|
}
|
|
312
|
-
else c(
|
|
313
|
+
else c(u.data);
|
|
313
314
|
};
|
|
314
315
|
return n.addEventListener("message", l), () => n.removeEventListener("message", l);
|
|
315
316
|
},
|
|
@@ -317,7 +318,7 @@ function pt(e, t = {}) {
|
|
|
317
318
|
close: a
|
|
318
319
|
};
|
|
319
320
|
}
|
|
320
|
-
function
|
|
321
|
+
function ht(e) {
|
|
321
322
|
const t = new BroadcastChannel(e);
|
|
322
323
|
return {
|
|
323
324
|
channel: t,
|
|
@@ -329,132 +330,18 @@ function _t(e) {
|
|
|
329
330
|
close: () => t.close()
|
|
330
331
|
};
|
|
331
332
|
}
|
|
332
|
-
var
|
|
333
|
-
createSender:
|
|
333
|
+
var Ks = {
|
|
334
|
+
createSender: g,
|
|
334
335
|
createListener: m,
|
|
335
|
-
detectType:
|
|
336
|
-
getMeta:
|
|
336
|
+
detectType: Z,
|
|
337
|
+
getMeta: at,
|
|
337
338
|
chrome: {
|
|
338
|
-
createListener:
|
|
339
|
-
createTabsListener:
|
|
339
|
+
createListener: cn,
|
|
340
|
+
createTabsListener: ct
|
|
340
341
|
},
|
|
341
|
-
websocket:
|
|
342
|
-
broadcast:
|
|
343
|
-
},
|
|
344
|
-
if (typeof e == "function" || e == null) return e;
|
|
345
|
-
const t = function() {
|
|
346
|
-
};
|
|
347
|
-
return t[mt] = e, t;
|
|
348
|
-
}, gn = (e) => crypto?.getRandomValues ? crypto?.getRandomValues?.(e) : (() => {
|
|
349
|
-
const t = new Uint8Array(e.length);
|
|
350
|
-
for (let n = 0; n < e.length; n++) t[n] = Math.floor(Math.random() * 256);
|
|
351
|
-
return t;
|
|
352
|
-
})(), u = () => crypto?.randomUUID ? crypto?.randomUUID?.() : "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (e) => (+e ^ gn?.(/* @__PURE__ */ new Uint8Array(1))?.[0] & 15 >> +e / 4).toString(16)), gt = (e) => Array.isArray(e) ? e?.flatMap?.((t) => Array.isArray(t) ? gt(t) : t) : e, Oe = (e) => gt(e)?.every?.(L), L = (e) => A(e) || typeof SharedArrayBuffer == "function" && e instanceof SharedArrayBuffer || yn(e) || Array.isArray(e) && Oe(e), yn = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), Re = (e) => A(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, B = (e, t, n) => {
|
|
353
|
-
if (Array.isArray(e))
|
|
354
|
-
return e.every(L) ? e.map(t) : e.map((s, r) => B(s, t, [e, r]));
|
|
355
|
-
if (e instanceof Map) {
|
|
356
|
-
const s = Array.from(e.entries());
|
|
357
|
-
return s.map(([r, i]) => i).every(L) ? new Map(s.map(([r, i]) => [r, t(i, r, e)])) : new Map(s.map(([r, i]) => [r, B(i, t, [e, r])]));
|
|
358
|
-
}
|
|
359
|
-
if (e instanceof Set) {
|
|
360
|
-
const s = Array.from(e.entries()), r = s.map(([i, o]) => o);
|
|
361
|
-
return s.every(L) ? new Set(r.map(t)) : new Set(r.map((i) => B(i, t, [e, i])));
|
|
362
|
-
}
|
|
363
|
-
if (typeof e == "object" && e?.constructor == Object && Object.prototype.toString.call(e) == "[object Object]") {
|
|
364
|
-
const s = Array.from(Object.entries(e));
|
|
365
|
-
return s.map(([r, i]) => i).every(L) ? Object.fromEntries(s.map(([r, i]) => [r, t(i, r, e)])) : Object.fromEntries(s.map(([r, i]) => [r, B(i, t, [e, r])]));
|
|
366
|
-
}
|
|
367
|
-
return t(e, n?.[1] ?? "", n?.[0] ?? null);
|
|
368
|
-
}, R = /* @__PURE__ */ new WeakMap(), Ze = /* @__PURE__ */ new WeakMap(), x = (e, t) => e instanceof Promise || typeof e?.then == "function" ? R?.has?.(e) ? t(R?.get?.(e)) : Promise.try?.(async () => {
|
|
369
|
-
const n = await e;
|
|
370
|
-
return R?.set?.(e, n), n;
|
|
371
|
-
})?.then?.(t) : t(e), bn = class {
|
|
372
|
-
#e;
|
|
373
|
-
#t;
|
|
374
|
-
constructor(e, t) {
|
|
375
|
-
this.#e = e, this.#t = t;
|
|
376
|
-
}
|
|
377
|
-
defineProperty(e, t, n) {
|
|
378
|
-
return g(e) instanceof Promise ? Reflect.defineProperty(e, t, n) : x(g(e), (s) => Reflect.defineProperty(s, t, n));
|
|
379
|
-
}
|
|
380
|
-
deleteProperty(e, t) {
|
|
381
|
-
return g(e) instanceof Promise ? Reflect.deleteProperty(e, t) : x(g(e), (n) => Reflect.deleteProperty(n, t));
|
|
382
|
-
}
|
|
383
|
-
getPrototypeOf(e) {
|
|
384
|
-
return g(e) instanceof Promise ? Reflect.getPrototypeOf(e) : x(g(e), (t) => Reflect.getPrototypeOf(t));
|
|
385
|
-
}
|
|
386
|
-
setPrototypeOf(e, t) {
|
|
387
|
-
return g(e) instanceof Promise ? Reflect.setPrototypeOf(e, t) : x(g(e), (n) => Reflect.setPrototypeOf(n, t));
|
|
388
|
-
}
|
|
389
|
-
isExtensible(e) {
|
|
390
|
-
return g(e) instanceof Promise ? Reflect.isExtensible(e) : x(g(e), (t) => Reflect.isExtensible(t));
|
|
391
|
-
}
|
|
392
|
-
preventExtensions(e) {
|
|
393
|
-
return g(e) instanceof Promise ? Reflect.ownKeys(e) : x(g(e), (t) => Reflect.preventExtensions(t));
|
|
394
|
-
}
|
|
395
|
-
ownKeys(e) {
|
|
396
|
-
const t = g(e);
|
|
397
|
-
return t instanceof Promise ? Object.keys(t) : x(t, (n) => (typeof n == "object" || typeof n == "function") && n != null ? Object.keys(n) : []) ?? [];
|
|
398
|
-
}
|
|
399
|
-
getOwnPropertyDescriptor(e, t) {
|
|
400
|
-
return g(e) instanceof Promise ? Reflect.getOwnPropertyDescriptor(e, t) : x(g(e), (n) => Reflect.getOwnPropertyDescriptor(n, t));
|
|
401
|
-
}
|
|
402
|
-
construct(e, t, n) {
|
|
403
|
-
return x(g(e), (s) => Reflect.construct(s, t, n));
|
|
404
|
-
}
|
|
405
|
-
has(e, t) {
|
|
406
|
-
return g(e) instanceof Promise ? Reflect.has(e, t) : x(g(e), (n) => Reflect.has(n, t));
|
|
407
|
-
}
|
|
408
|
-
get(e, t, n) {
|
|
409
|
-
if (e = g(e), t == "promise") return e;
|
|
410
|
-
if (t == "resolve" && this.#e) return (...r) => {
|
|
411
|
-
const i = this.#e?.(...r);
|
|
412
|
-
return this.#e = null, i;
|
|
413
|
-
};
|
|
414
|
-
if (t == "reject" && this.#t) return (...r) => {
|
|
415
|
-
const i = this.#t?.(...r);
|
|
416
|
-
return this.#t = null, i;
|
|
417
|
-
};
|
|
418
|
-
if (t == "then" || t == "catch" || t == "finally") {
|
|
419
|
-
if (e instanceof Promise) return e?.[t]?.bind?.(e);
|
|
420
|
-
{
|
|
421
|
-
const r = Promise.try(() => e);
|
|
422
|
-
return r?.[t]?.bind?.(r);
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
let s;
|
|
426
|
-
return R?.has?.(e) && (s = R?.get?.(e))?.[t] != null ? s = R?.get?.(e)?.[t] : s = yt(x(e, async (r) => {
|
|
427
|
-
if (g(r) instanceof Promise) return Reflect.get(r, t, n);
|
|
428
|
-
if (A(r)) return t == Symbol.toPrimitive || t == Symbol.toStringTag ? r : void 0;
|
|
429
|
-
let i;
|
|
430
|
-
try {
|
|
431
|
-
i = Reflect.get(r, t, n);
|
|
432
|
-
} catch {
|
|
433
|
-
i = e?.[t];
|
|
434
|
-
}
|
|
435
|
-
return typeof i == "function" ? i?.bind?.(r) : i;
|
|
436
|
-
})), t == Symbol.toStringTag ? A(s) ? String(s ?? "") || "" : s?.[Symbol.toStringTag]?.() || String(s ?? "") || "" : t == Symbol.toPrimitive ? (r) => {
|
|
437
|
-
if (A(s)) return _n(s, r);
|
|
438
|
-
} : s;
|
|
439
|
-
}
|
|
440
|
-
set(e, t, n) {
|
|
441
|
-
return x(g(e), (s) => Reflect.set(s, t, n));
|
|
442
|
-
}
|
|
443
|
-
apply(e, t, n) {
|
|
444
|
-
if (this.#e) {
|
|
445
|
-
const s = this.#e?.(...n);
|
|
446
|
-
return this.#e = null, s;
|
|
447
|
-
}
|
|
448
|
-
return x(g(e, this.#e), (s) => {
|
|
449
|
-
if (typeof s == "function")
|
|
450
|
-
return g(s) instanceof Promise, Reflect.apply(s, t, n);
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
};
|
|
454
|
-
function yt(e, t, n) {
|
|
455
|
-
return e instanceof Promise || typeof e?.then == "function" ? R?.has?.(e) ? R?.get?.(e) : (Ze?.has?.(e) || e?.then?.((s) => R?.set?.(e, s)), Ze?.getOrInsertComputed?.(e, () => new Proxy(mn(e), new bn(t, n)))) : e;
|
|
456
|
-
}
|
|
457
|
-
var De = class {
|
|
342
|
+
websocket: lt,
|
|
343
|
+
broadcast: ht
|
|
344
|
+
}, Re = class {
|
|
458
345
|
_unsubscribe;
|
|
459
346
|
_closed = !1;
|
|
460
347
|
constructor(e) {
|
|
@@ -466,7 +353,7 @@ var De = class {
|
|
|
466
353
|
unsubscribe() {
|
|
467
354
|
this._closed || (this._closed = !0, this._unsubscribe());
|
|
468
355
|
}
|
|
469
|
-
},
|
|
356
|
+
}, v = class {
|
|
470
357
|
_producer;
|
|
471
358
|
constructor(e) {
|
|
472
359
|
this._producer = e;
|
|
@@ -495,7 +382,7 @@ var De = class {
|
|
|
495
382
|
} catch (c) {
|
|
496
383
|
a.error(c);
|
|
497
384
|
}
|
|
498
|
-
return new
|
|
385
|
+
return new Re(o);
|
|
499
386
|
}
|
|
500
387
|
pipe(...e) {
|
|
501
388
|
return e.reduce((t, n) => n(t), this);
|
|
@@ -530,7 +417,7 @@ var De = class {
|
|
|
530
417
|
} catch (s) {
|
|
531
418
|
t.error?.(s);
|
|
532
419
|
}
|
|
533
|
-
return new
|
|
420
|
+
return new Re(() => {
|
|
534
421
|
this._subs.delete(t);
|
|
535
422
|
});
|
|
536
423
|
}
|
|
@@ -543,14 +430,14 @@ var De = class {
|
|
|
543
430
|
get subscriberCount() {
|
|
544
431
|
return this._subs.size;
|
|
545
432
|
}
|
|
546
|
-
},
|
|
433
|
+
}, Ys = class extends _ {
|
|
547
434
|
constructor(e = 1) {
|
|
548
435
|
super({
|
|
549
436
|
bufferSize: e,
|
|
550
437
|
replayOnSubscribe: !0
|
|
551
438
|
});
|
|
552
439
|
}
|
|
553
|
-
},
|
|
440
|
+
}, ln = class {
|
|
554
441
|
_transport;
|
|
555
442
|
_channelName;
|
|
556
443
|
_send;
|
|
@@ -559,19 +446,19 @@ var De = class {
|
|
|
559
446
|
_cleanup = null;
|
|
560
447
|
_listening = !1;
|
|
561
448
|
constructor(e, t) {
|
|
562
|
-
this._transport = e, this._channelName = t, this._send =
|
|
449
|
+
this._transport = e, this._channelName = t, this._send = g(e);
|
|
563
450
|
}
|
|
564
451
|
next(e, t) {
|
|
565
452
|
this._send(e, t);
|
|
566
453
|
}
|
|
567
454
|
subscribe(e) {
|
|
568
455
|
const t = typeof e == "function" ? { next: e } : e;
|
|
569
|
-
return this._subs.add(t), this._listening || this._activate(), new
|
|
456
|
+
return this._subs.add(t), this._listening || this._activate(), new Re(() => {
|
|
570
457
|
this._subs.delete(t), this._subs.size === 0 && this._deactivate();
|
|
571
458
|
});
|
|
572
459
|
}
|
|
573
460
|
request(e) {
|
|
574
|
-
const t = e.reqId ??
|
|
461
|
+
const t = e.reqId ?? h();
|
|
575
462
|
return new Promise((n, s) => {
|
|
576
463
|
this._pending.set(t, {
|
|
577
464
|
resolve: n,
|
|
@@ -610,9 +497,9 @@ var De = class {
|
|
|
610
497
|
return this._listening;
|
|
611
498
|
}
|
|
612
499
|
};
|
|
613
|
-
function
|
|
614
|
-
const s =
|
|
615
|
-
return new
|
|
500
|
+
function Ve(e, t, n) {
|
|
501
|
+
const s = g(e);
|
|
502
|
+
return new v((r) => m(e, (o) => {
|
|
616
503
|
if (!r.active) return;
|
|
617
504
|
n ? n(o, (c, l) => {
|
|
618
505
|
s({
|
|
@@ -625,17 +512,17 @@ function et(e, t, n) {
|
|
|
625
512
|
}, r) : r.next(o);
|
|
626
513
|
}, (o) => r.error(o), () => r.complete()));
|
|
627
514
|
}
|
|
628
|
-
function
|
|
515
|
+
function hn(e) {
|
|
629
516
|
return async (t, n, s) => {
|
|
630
517
|
if (t.type !== "request") {
|
|
631
518
|
s.next(t);
|
|
632
519
|
return;
|
|
633
520
|
}
|
|
634
|
-
const r = await
|
|
521
|
+
const r = await De(t.payload, t.reqId, e);
|
|
635
522
|
r && n(r.response, r.transfer), s.next(t);
|
|
636
523
|
};
|
|
637
524
|
}
|
|
638
|
-
var
|
|
525
|
+
var Js = class extends _ {
|
|
639
526
|
constructor(e, t) {
|
|
640
527
|
super(), e.subscribe({
|
|
641
528
|
next: (n) => {
|
|
@@ -645,21 +532,21 @@ var ar = class extends _ {
|
|
|
645
532
|
complete: () => this.complete()
|
|
646
533
|
});
|
|
647
534
|
}
|
|
648
|
-
},
|
|
535
|
+
}, ut = (e) => (t) => new v((n) => {
|
|
649
536
|
const s = t.subscribe({
|
|
650
537
|
next: (r) => e(r) && n.next(r),
|
|
651
538
|
error: (r) => n.error(r),
|
|
652
539
|
complete: () => n.complete()
|
|
653
540
|
});
|
|
654
541
|
return () => s.unsubscribe();
|
|
655
|
-
}),
|
|
542
|
+
}), Xs = (e) => (t) => new v((n) => {
|
|
656
543
|
const s = t.subscribe({
|
|
657
544
|
next: (r) => n.next(e(r)),
|
|
658
545
|
error: (r) => n.error(r),
|
|
659
546
|
complete: () => n.complete()
|
|
660
547
|
});
|
|
661
548
|
return () => s.unsubscribe();
|
|
662
|
-
}),
|
|
549
|
+
}), Zs = (e) => (t) => new v((n) => {
|
|
663
550
|
let s = 0;
|
|
664
551
|
const r = t.subscribe({
|
|
665
552
|
next: (i) => {
|
|
@@ -669,7 +556,7 @@ var ar = class extends _ {
|
|
|
669
556
|
complete: () => n.complete()
|
|
670
557
|
});
|
|
671
558
|
return () => r.unsubscribe();
|
|
672
|
-
}),
|
|
559
|
+
}), er = (e) => (t) => new v((n) => {
|
|
673
560
|
const s = t.subscribe({
|
|
674
561
|
next: (i) => n.next(i),
|
|
675
562
|
error: (i) => n.error(i),
|
|
@@ -678,7 +565,7 @@ var ar = class extends _ {
|
|
|
678
565
|
return () => {
|
|
679
566
|
s.unsubscribe(), r.unsubscribe();
|
|
680
567
|
};
|
|
681
|
-
}),
|
|
568
|
+
}), tr = (e) => (t) => new v((n) => {
|
|
682
569
|
let s;
|
|
683
570
|
const r = t.subscribe({
|
|
684
571
|
next: (i) => {
|
|
@@ -690,7 +577,7 @@ var ar = class extends _ {
|
|
|
690
577
|
return () => {
|
|
691
578
|
clearTimeout(s), r.unsubscribe();
|
|
692
579
|
};
|
|
693
|
-
}),
|
|
580
|
+
}), nr = (e) => (t) => new v((n) => {
|
|
694
581
|
let s = 0;
|
|
695
582
|
const r = t.subscribe({
|
|
696
583
|
next: (i) => {
|
|
@@ -701,36 +588,36 @@ var ar = class extends _ {
|
|
|
701
588
|
complete: () => n.complete()
|
|
702
589
|
});
|
|
703
590
|
return () => r.unsubscribe();
|
|
704
|
-
}),
|
|
591
|
+
}), un = (e, t) => new v((n) => {
|
|
705
592
|
const s = (r) => n.active && n.next(r);
|
|
706
593
|
return e.addEventListener(t, s), () => e.removeEventListener(t, s);
|
|
707
|
-
}),
|
|
594
|
+
}), dn = (e) => new v((t) => {
|
|
708
595
|
e.then((n) => {
|
|
709
596
|
t.next(n), t.complete();
|
|
710
597
|
}).catch((n) => t.error(n));
|
|
711
|
-
}),
|
|
598
|
+
}), fn = (e, t) => new v((n) => {
|
|
712
599
|
const s = setTimeout(() => {
|
|
713
600
|
n.next(e), n.complete();
|
|
714
601
|
}, t);
|
|
715
602
|
return () => clearTimeout(s);
|
|
716
|
-
}),
|
|
603
|
+
}), pn = (e) => new v((t) => {
|
|
717
604
|
let n = 0;
|
|
718
605
|
const s = setInterval(() => t.next(n++), e);
|
|
719
606
|
return () => clearInterval(s);
|
|
720
|
-
}),
|
|
607
|
+
}), _n = (...e) => new v((t) => {
|
|
721
608
|
const n = e.map((s) => s.subscribe({
|
|
722
609
|
next: (r) => t.next(r),
|
|
723
610
|
error: (r) => t.error(r)
|
|
724
611
|
}));
|
|
725
612
|
return () => n.forEach((s) => s.unsubscribe());
|
|
726
|
-
}),
|
|
727
|
-
const s =
|
|
613
|
+
}), sr = () => h(), M = (e, t) => (n) => {
|
|
614
|
+
const s = g(e), r = (i, o) => s(i, o);
|
|
728
615
|
return m(e, (i) => {
|
|
729
616
|
n.active && (t ? t(i, r, n) : n.next(i));
|
|
730
617
|
}, (i) => n.error(i), () => n.complete());
|
|
731
|
-
},
|
|
732
|
-
function
|
|
733
|
-
const s =
|
|
618
|
+
}, rr = (e, t) => M(e, t), ir = (e, t) => M(e, t), or = (e, t) => M(new BroadcastChannel(e), t), ar = (e, t, n) => M(new WebSocket(typeof e == "string" ? e : e.href, t), n), cr = (e) => M("chrome-runtime", e), lr = (e) => M("service-worker-client", e), hr = (e) => M("service-worker-host", e), ur = (e) => M("self", e);
|
|
619
|
+
function mn(e, t, n) {
|
|
620
|
+
const s = g(e), r = new v((i) => M(e, n)(i));
|
|
734
621
|
return {
|
|
735
622
|
inbound: r,
|
|
736
623
|
outbound: { next: s },
|
|
@@ -738,25 +625,25 @@ function In(e, t, n) {
|
|
|
738
625
|
send: (i, o) => s(i, o)
|
|
739
626
|
};
|
|
740
627
|
}
|
|
741
|
-
function
|
|
742
|
-
return new
|
|
628
|
+
function gn(e, t) {
|
|
629
|
+
return new v((n) => {
|
|
743
630
|
const s = (r) => n.active && n.next(r);
|
|
744
631
|
return e.addEventListener(t, s), () => e.removeEventListener(t, s);
|
|
745
632
|
});
|
|
746
633
|
}
|
|
747
|
-
var
|
|
748
|
-
channel: (e, t) => new
|
|
749
|
-
invoker: (e, t, n) =>
|
|
750
|
-
handler: (e, t) =>
|
|
751
|
-
bidirectional:
|
|
752
|
-
fromEvent:
|
|
753
|
-
fromPromise:
|
|
754
|
-
delay:
|
|
755
|
-
interval:
|
|
756
|
-
merge:
|
|
757
|
-
when:
|
|
634
|
+
var dr = {
|
|
635
|
+
channel: (e, t) => new ln(e, t),
|
|
636
|
+
invoker: (e, t, n) => Ve(e, t, n),
|
|
637
|
+
handler: (e, t) => Ve(e, t, hn(t)),
|
|
638
|
+
bidirectional: mn,
|
|
639
|
+
fromEvent: un,
|
|
640
|
+
fromPromise: dn,
|
|
641
|
+
delay: fn,
|
|
642
|
+
interval: pn,
|
|
643
|
+
merge: _n,
|
|
644
|
+
when: gn
|
|
758
645
|
};
|
|
759
|
-
function
|
|
646
|
+
function H() {
|
|
760
647
|
if (typeof globalThis.Deno < "u") return "deno";
|
|
761
648
|
if (typeof globalThis.process < "u" && globalThis.process?.versions?.node) return "node";
|
|
762
649
|
const e = globalThis.ServiceWorkerGlobalScope, t = globalThis.SharedWorkerGlobalScope, n = globalThis.DedicatedWorkerGlobalScope;
|
|
@@ -772,18 +659,18 @@ function J() {
|
|
|
772
659
|
}
|
|
773
660
|
return typeof globalThis < "u" && typeof document < "u" ? "window" : "unknown";
|
|
774
661
|
}
|
|
775
|
-
function
|
|
662
|
+
function Ke(e) {
|
|
776
663
|
if (typeof RTCDataChannel < "u" && e instanceof RTCDataChannel) return "rtc-data";
|
|
777
|
-
const t =
|
|
664
|
+
const t = Z(e);
|
|
778
665
|
return t && t !== "internal" ? t : e === self || e === globalThis || e === "self" ? "self" : "internal";
|
|
779
666
|
}
|
|
780
|
-
function
|
|
667
|
+
function bn(e) {
|
|
781
668
|
if (!e) return "unknown";
|
|
782
669
|
if (e.contextType) return e.contextType;
|
|
783
670
|
const t = e.sender ?? "";
|
|
784
671
|
return t.includes("worker") ? "worker" : t.includes("sw") || t.includes("service") ? "service-worker" : t.includes("chrome") || t.includes("crx") ? "chrome-content" : t.includes("background") ? "chrome-background" : "unknown";
|
|
785
672
|
}
|
|
786
|
-
var
|
|
673
|
+
var yn = {
|
|
787
674
|
get: (e, t) => Reflect.get(e, t),
|
|
788
675
|
set: (e, t, n) => Reflect.set(e, t, n),
|
|
789
676
|
has: (e, t) => Reflect.has(e, t),
|
|
@@ -796,11 +683,11 @@ var Mn = {
|
|
|
796
683
|
setPrototypeOf: (e, t) => Reflect.setPrototypeOf(e, t),
|
|
797
684
|
isExtensible: (e) => Reflect.isExtensible(e),
|
|
798
685
|
preventExtensions: (e) => Reflect.preventExtensions(e)
|
|
799
|
-
},
|
|
686
|
+
}, dt = class {
|
|
800
687
|
_channel;
|
|
801
688
|
_contextType;
|
|
802
689
|
constructor(e) {
|
|
803
|
-
this._contextType = e.autoDetect !== !1 ?
|
|
690
|
+
this._contextType = e.autoDetect !== !1 ? H() : "unknown", this._channel = S({
|
|
804
691
|
name: e.channel,
|
|
805
692
|
timeout: e.timeout,
|
|
806
693
|
autoListen: !1
|
|
@@ -839,11 +726,11 @@ var Mn = {
|
|
|
839
726
|
close() {
|
|
840
727
|
this._channel.close();
|
|
841
728
|
}
|
|
842
|
-
},
|
|
729
|
+
}, ft = class {
|
|
843
730
|
_channel;
|
|
844
731
|
_contextType;
|
|
845
732
|
constructor(e) {
|
|
846
|
-
this._contextType = e.autoDetect !== !1 ?
|
|
733
|
+
this._contextType = e.autoDetect !== !1 ? H() : "unknown", this._channel = S({
|
|
847
734
|
name: e.channel,
|
|
848
735
|
timeout: e.timeout,
|
|
849
736
|
autoListen: !1
|
|
@@ -867,12 +754,12 @@ var Mn = {
|
|
|
867
754
|
close() {
|
|
868
755
|
this._channel.close();
|
|
869
756
|
}
|
|
870
|
-
},
|
|
757
|
+
}, wn = class {
|
|
871
758
|
requestor;
|
|
872
759
|
responder;
|
|
873
760
|
_contextType;
|
|
874
761
|
constructor(e) {
|
|
875
|
-
this._contextType = e.autoDetect !== !1 ?
|
|
762
|
+
this._contextType = e.autoDetect !== !1 ? H() : "unknown", this.requestor = new dt(e), this.responder = new ft(e);
|
|
876
763
|
}
|
|
877
764
|
connect(e) {
|
|
878
765
|
return this.requestor.connect(e), this.responder.listen(e), this;
|
|
@@ -893,33 +780,33 @@ var Mn = {
|
|
|
893
780
|
this.requestor.close(), this.responder.close();
|
|
894
781
|
}
|
|
895
782
|
};
|
|
896
|
-
function
|
|
897
|
-
return new
|
|
783
|
+
function fr(e, t) {
|
|
784
|
+
return new dt({
|
|
898
785
|
channel: e,
|
|
899
786
|
...t
|
|
900
787
|
});
|
|
901
788
|
}
|
|
902
|
-
function
|
|
903
|
-
return new
|
|
789
|
+
function vn(e, t) {
|
|
790
|
+
return new ft({
|
|
904
791
|
channel: e,
|
|
905
792
|
...t
|
|
906
793
|
});
|
|
907
794
|
}
|
|
908
|
-
function
|
|
909
|
-
return new
|
|
795
|
+
function qe(e, t) {
|
|
796
|
+
return new wn({
|
|
910
797
|
channel: e,
|
|
911
798
|
...t
|
|
912
799
|
});
|
|
913
800
|
}
|
|
914
|
-
function
|
|
915
|
-
return
|
|
801
|
+
function pr(e, t, n) {
|
|
802
|
+
return qe(e, n).connect(t);
|
|
916
803
|
}
|
|
917
|
-
function
|
|
918
|
-
const n =
|
|
804
|
+
function _r(e, t) {
|
|
805
|
+
const n = qe(e, {
|
|
919
806
|
autoDetect: !0,
|
|
920
807
|
...t
|
|
921
808
|
});
|
|
922
|
-
switch (
|
|
809
|
+
switch (H()) {
|
|
923
810
|
case "worker":
|
|
924
811
|
case "service-worker":
|
|
925
812
|
case "shared-worker":
|
|
@@ -929,11 +816,10 @@ function Sr(e, t) {
|
|
|
929
816
|
case "chrome-background":
|
|
930
817
|
case "chrome-popup":
|
|
931
818
|
n.connect("chrome-runtime");
|
|
932
|
-
break;
|
|
933
819
|
}
|
|
934
820
|
return n;
|
|
935
821
|
}
|
|
936
|
-
var
|
|
822
|
+
var pt = /* @__PURE__ */ Symbol.for("uniform.proxy"), _t = /* @__PURE__ */ Symbol.for("uniform.proxy.internals"), Cn = class {
|
|
937
823
|
_invoker;
|
|
938
824
|
_config;
|
|
939
825
|
_childCache = /* @__PURE__ */ new Map();
|
|
@@ -948,10 +834,10 @@ var Ct = /* @__PURE__ */ Symbol.for("uniform.proxy"), xt = /* @__PURE__ */ Symbo
|
|
|
948
834
|
}
|
|
949
835
|
get(e, t, n) {
|
|
950
836
|
const s = String(t);
|
|
951
|
-
if (t ===
|
|
952
|
-
if (t ===
|
|
953
|
-
if (t ===
|
|
954
|
-
if (t ===
|
|
837
|
+
if (t === pt) return !0;
|
|
838
|
+
if (t === _t) return this._config;
|
|
839
|
+
if (t === qn) return !0;
|
|
840
|
+
if (t === Q) return this._getDescriptor();
|
|
955
841
|
if (t === "then" || t === "catch" || t === "finally" || typeof t == "symbol") return;
|
|
956
842
|
if (t === "$path") return this._config.basePath;
|
|
957
843
|
if (t === "$channel") return this._config.channel;
|
|
@@ -959,7 +845,7 @@ var Ct = /* @__PURE__ */ Symbol.for("uniform.proxy"), xt = /* @__PURE__ */ Symbo
|
|
|
959
845
|
if (t === "$invoke") return this._invoker;
|
|
960
846
|
const r = [...this._config.basePath, s];
|
|
961
847
|
if (this._config.cache && this._childCache.has(s)) return this._childCache.get(s);
|
|
962
|
-
const i =
|
|
848
|
+
const i = ee(this._invoker, {
|
|
963
849
|
...this._config,
|
|
964
850
|
basePath: r
|
|
965
851
|
});
|
|
@@ -1009,7 +895,7 @@ var Ct = /* @__PURE__ */ Symbol.for("uniform.proxy"), xt = /* @__PURE__ */ Symbo
|
|
|
1009
895
|
primitive: !1
|
|
1010
896
|
};
|
|
1011
897
|
}
|
|
1012
|
-
},
|
|
898
|
+
}, mr = class {
|
|
1013
899
|
_dispatch;
|
|
1014
900
|
constructor(e) {
|
|
1015
901
|
this._dispatch = e;
|
|
@@ -1051,47 +937,47 @@ var Ct = /* @__PURE__ */ Symbol.for("uniform.proxy"), xt = /* @__PURE__ */ Symbo
|
|
|
1051
937
|
return this._dispatch(d.CONSTRUCT, e);
|
|
1052
938
|
}
|
|
1053
939
|
};
|
|
1054
|
-
function
|
|
940
|
+
function ee(e, t) {
|
|
1055
941
|
const n = function() {
|
|
1056
|
-
}, s = new
|
|
942
|
+
}, s = new Cn(e, t);
|
|
1057
943
|
return new Proxy(n, s);
|
|
1058
944
|
}
|
|
1059
|
-
function
|
|
945
|
+
function mt(e, t, n) {
|
|
1060
946
|
if (!e || typeof e != "object" || e.primitive) return e;
|
|
1061
|
-
const s =
|
|
947
|
+
const s = Ye.get(e);
|
|
1062
948
|
if (s) return s;
|
|
1063
|
-
const r =
|
|
949
|
+
const r = ee(t, {
|
|
1064
950
|
channel: n ?? e.channel ?? "unknown",
|
|
1065
951
|
basePath: e.path ?? []
|
|
1066
952
|
});
|
|
1067
|
-
return
|
|
953
|
+
return Ye.set(e, r), de.set(r, e), r;
|
|
1068
954
|
}
|
|
1069
|
-
function
|
|
955
|
+
function gt(e) {
|
|
1070
956
|
if (!e || typeof e != "object" && typeof e != "function") return !1;
|
|
1071
957
|
try {
|
|
1072
|
-
return Reflect.get(e,
|
|
958
|
+
return Reflect.get(e, pt) === !0;
|
|
1073
959
|
} catch {
|
|
1074
960
|
return !1;
|
|
1075
961
|
}
|
|
1076
962
|
}
|
|
1077
|
-
function
|
|
1078
|
-
return
|
|
963
|
+
function gr(e) {
|
|
964
|
+
return gt(e) ? e.$descriptor ?? null : null;
|
|
1079
965
|
}
|
|
1080
|
-
function
|
|
1081
|
-
if (!
|
|
966
|
+
function br(e) {
|
|
967
|
+
if (!gt(e)) return null;
|
|
1082
968
|
try {
|
|
1083
|
-
const t = Reflect.get(e,
|
|
969
|
+
const t = Reflect.get(e, _t);
|
|
1084
970
|
return !t || typeof t != "object" ? null : t;
|
|
1085
971
|
} catch {
|
|
1086
972
|
return null;
|
|
1087
973
|
}
|
|
1088
974
|
}
|
|
1089
|
-
function
|
|
1090
|
-
return
|
|
975
|
+
function xn(e, t) {
|
|
976
|
+
return Ln(e, t);
|
|
1091
977
|
}
|
|
1092
|
-
function
|
|
1093
|
-
return
|
|
1094
|
-
id:
|
|
978
|
+
function kn(e, t = []) {
|
|
979
|
+
return ee((s, r, i) => e.request({
|
|
980
|
+
id: h(),
|
|
1095
981
|
channel: e.channelName,
|
|
1096
982
|
sender: e.senderId ?? "proxy",
|
|
1097
983
|
type: "request",
|
|
@@ -1105,7 +991,7 @@ function On(e, t = []) {
|
|
|
1105
991
|
basePath: t
|
|
1106
992
|
});
|
|
1107
993
|
}
|
|
1108
|
-
var
|
|
994
|
+
var Sn = class {
|
|
1109
995
|
_config = {};
|
|
1110
996
|
_invoker = null;
|
|
1111
997
|
channel(e) {
|
|
@@ -1126,14 +1012,14 @@ var Dn = class {
|
|
|
1126
1012
|
build() {
|
|
1127
1013
|
if (!this._invoker) throw new Error("Invoker is required. Call .invoker() before .build()");
|
|
1128
1014
|
if (!this._config.channel) throw new Error("Channel is required. Call .channel() before .build()");
|
|
1129
|
-
return
|
|
1015
|
+
return ee(this._invoker, this._config);
|
|
1130
1016
|
}
|
|
1131
1017
|
};
|
|
1132
|
-
function
|
|
1133
|
-
return new
|
|
1018
|
+
function yr() {
|
|
1019
|
+
return new Sn();
|
|
1134
1020
|
}
|
|
1135
|
-
var
|
|
1136
|
-
function
|
|
1021
|
+
var En = mt;
|
|
1022
|
+
function In(e) {
|
|
1137
1023
|
return [
|
|
1138
1024
|
e.localChannel,
|
|
1139
1025
|
e.remoteChannel,
|
|
@@ -1142,11 +1028,11 @@ function Bn(e) {
|
|
|
1142
1028
|
e.direction
|
|
1143
1029
|
].join("::");
|
|
1144
1030
|
}
|
|
1145
|
-
function
|
|
1031
|
+
function Tn(e, t = {}) {
|
|
1146
1032
|
const n = t.includeClosed ?? !1, s = t.status ?? (n ? void 0 : "active");
|
|
1147
1033
|
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);
|
|
1148
1034
|
}
|
|
1149
|
-
var
|
|
1035
|
+
var bt = class {
|
|
1150
1036
|
_createId;
|
|
1151
1037
|
_emitEvent;
|
|
1152
1038
|
_connections = /* @__PURE__ */ new Map();
|
|
@@ -1154,7 +1040,7 @@ var Et = class {
|
|
|
1154
1040
|
this._createId = e, this._emitEvent = t;
|
|
1155
1041
|
}
|
|
1156
1042
|
register(e) {
|
|
1157
|
-
const t =
|
|
1043
|
+
const t = In(e), n = Date.now(), s = this._connections.get(t);
|
|
1158
1044
|
if (s)
|
|
1159
1045
|
return s.updatedAt = n, s.status = "active", s.metadata = {
|
|
1160
1046
|
...s.metadata,
|
|
@@ -1206,7 +1092,7 @@ var Et = class {
|
|
|
1206
1092
|
}));
|
|
1207
1093
|
}
|
|
1208
1094
|
query(e = {}) {
|
|
1209
|
-
return
|
|
1095
|
+
return Tn(this._connections.values(), e);
|
|
1210
1096
|
}
|
|
1211
1097
|
values() {
|
|
1212
1098
|
return [...this._connections.values()];
|
|
@@ -1214,14 +1100,14 @@ var Et = class {
|
|
|
1214
1100
|
clear() {
|
|
1215
1101
|
this._connections.clear();
|
|
1216
1102
|
}
|
|
1217
|
-
},
|
|
1103
|
+
}, yt = class {
|
|
1218
1104
|
_name;
|
|
1219
1105
|
_contextType;
|
|
1220
1106
|
_config;
|
|
1221
1107
|
_transports = /* @__PURE__ */ new Map();
|
|
1222
1108
|
_defaultTransport = null;
|
|
1223
1109
|
_connectionEvents = new _({ bufferSize: 200 });
|
|
1224
|
-
_connectionRegistry = new
|
|
1110
|
+
_connectionRegistry = new bt(() => h(), (e) => this._connectionEvents.next(e));
|
|
1225
1111
|
_pending = /* @__PURE__ */ new Map();
|
|
1226
1112
|
_subscriptions = [];
|
|
1227
1113
|
_inbound = new _({ bufferSize: 100 });
|
|
@@ -1238,17 +1124,17 @@ var Et = class {
|
|
|
1238
1124
|
}
|
|
1239
1125
|
constructor(e) {
|
|
1240
1126
|
const t = typeof e == "string" ? { name: e } : e;
|
|
1241
|
-
this._name = t.name, this._contextType = t.autoDetect !== !1 ?
|
|
1127
|
+
this._name = t.name, this._contextType = t.autoDetect !== !1 ? H() : "unknown", this._config = {
|
|
1242
1128
|
name: t.name,
|
|
1243
1129
|
autoDetect: t.autoDetect ?? !0,
|
|
1244
1130
|
timeout: t.timeout ?? 3e4,
|
|
1245
|
-
reflect: t.reflect ??
|
|
1131
|
+
reflect: t.reflect ?? yn,
|
|
1246
1132
|
bufferSize: t.bufferSize ?? 100,
|
|
1247
1133
|
autoListen: t.autoListen ?? !0
|
|
1248
1134
|
}, this._config.autoListen && this._isWorkerContext() && this.listen(self);
|
|
1249
1135
|
}
|
|
1250
1136
|
connect(e, t = {}) {
|
|
1251
|
-
const n =
|
|
1137
|
+
const n = Ke(e), s = t.targetChannel ?? this._inferTargetChannel(e, n), r = this._createTransportBinding(e, n, s, t);
|
|
1252
1138
|
this._transports.set(s, r), this._defaultTransport || (this._defaultTransport = r);
|
|
1253
1139
|
const i = this._registerConnection({
|
|
1254
1140
|
localChannel: this._name,
|
|
@@ -1265,7 +1151,7 @@ var Et = class {
|
|
|
1265
1151
|
}), this;
|
|
1266
1152
|
}
|
|
1267
1153
|
listen(e, t = {}) {
|
|
1268
|
-
const n =
|
|
1154
|
+
const n = Ke(e), s = t.targetChannel ?? this._inferTargetChannel(e, n), r = (o) => this._handleIncoming(o), i = this._registerConnection({
|
|
1269
1155
|
localChannel: this._name,
|
|
1270
1156
|
remoteChannel: s,
|
|
1271
1157
|
sender: s,
|
|
@@ -1320,7 +1206,7 @@ var Et = class {
|
|
|
1320
1206
|
}
|
|
1321
1207
|
expose(e, t) {
|
|
1322
1208
|
const n = [e];
|
|
1323
|
-
return
|
|
1209
|
+
return fe(n, t), this._exposed.set(e, {
|
|
1324
1210
|
name: e,
|
|
1325
1211
|
obj: t,
|
|
1326
1212
|
path: n
|
|
@@ -1334,7 +1220,7 @@ var Et = class {
|
|
|
1334
1220
|
return this.invoke(t ?? this._getDefaultTarget(), d.IMPORT, [], [e]);
|
|
1335
1221
|
}
|
|
1336
1222
|
invoke(e, t, n, s = []) {
|
|
1337
|
-
const r =
|
|
1223
|
+
const r = h(), i = Promise.withResolvers();
|
|
1338
1224
|
this._pending.set(r, i);
|
|
1339
1225
|
const o = setTimeout(() => {
|
|
1340
1226
|
this._pending.has(r) && (this._pending.delete(r), i.reject(/* @__PURE__ */ new Error(`Request timeout: ${t} on ${n.join(".")}`)));
|
|
@@ -1374,7 +1260,7 @@ var Et = class {
|
|
|
1374
1260
|
return this.proxy(t, [e]);
|
|
1375
1261
|
}
|
|
1376
1262
|
wrapDescriptor(e, t) {
|
|
1377
|
-
return
|
|
1263
|
+
return mt(e, (s, r, i) => {
|
|
1378
1264
|
const o = t ?? e?.channel ?? this._getDefaultTarget();
|
|
1379
1265
|
return this.invoke(o, s, r, i);
|
|
1380
1266
|
}, t ?? e?.channel ?? this._getDefaultTarget());
|
|
@@ -1387,7 +1273,7 @@ var Et = class {
|
|
|
1387
1273
|
}
|
|
1388
1274
|
emit(e, t, n) {
|
|
1389
1275
|
const s = {
|
|
1390
|
-
id:
|
|
1276
|
+
id: h(),
|
|
1391
1277
|
channel: e,
|
|
1392
1278
|
sender: this._name,
|
|
1393
1279
|
type: "event",
|
|
@@ -1488,7 +1374,6 @@ var Et = class {
|
|
|
1488
1374
|
break;
|
|
1489
1375
|
case "signal":
|
|
1490
1376
|
this._handleSignal(e);
|
|
1491
|
-
break;
|
|
1492
1377
|
}
|
|
1493
1378
|
}
|
|
1494
1379
|
_handleResponse(e) {
|
|
@@ -1521,13 +1406,13 @@ var Et = class {
|
|
|
1521
1406
|
path: s,
|
|
1522
1407
|
args: r ?? [],
|
|
1523
1408
|
timestamp: Date.now(),
|
|
1524
|
-
contextType:
|
|
1409
|
+
contextType: bn(e)
|
|
1525
1410
|
});
|
|
1526
1411
|
const { result: a, toTransfer: c, newPath: l } = await this._executeAction(n, s, r ?? [], i);
|
|
1527
1412
|
await this._sendResponse(o, n, i, l, a, c);
|
|
1528
1413
|
}
|
|
1529
1414
|
async _executeAction(e, t, n, s) {
|
|
1530
|
-
const { result: r, toTransfer: i, path: o } =
|
|
1415
|
+
const { result: r, toTransfer: i, path: o } = Pt(e, t, n, {
|
|
1531
1416
|
channel: this._name,
|
|
1532
1417
|
sender: s,
|
|
1533
1418
|
reflect: this._config.reflect
|
|
@@ -1539,7 +1424,7 @@ var Et = class {
|
|
|
1539
1424
|
};
|
|
1540
1425
|
}
|
|
1541
1426
|
async _sendResponse(e, t, n, s, r, i) {
|
|
1542
|
-
const { response: o, transfer: a } = await
|
|
1427
|
+
const { response: o, transfer: a } = await Mt(e, t, this._name, n, s, r, i), c = {
|
|
1543
1428
|
id: e,
|
|
1544
1429
|
...o,
|
|
1545
1430
|
timestamp: Date.now(),
|
|
@@ -1565,7 +1450,7 @@ var Et = class {
|
|
|
1565
1450
|
}
|
|
1566
1451
|
_emitConnectionSignal(e, t, n = {}) {
|
|
1567
1452
|
const s = {
|
|
1568
|
-
id:
|
|
1453
|
+
id: h(),
|
|
1569
1454
|
type: "signal",
|
|
1570
1455
|
channel: e.targetChannel,
|
|
1571
1456
|
sender: this._name,
|
|
@@ -1590,7 +1475,7 @@ var Et = class {
|
|
|
1590
1475
|
}
|
|
1591
1476
|
_sendSignalToTarget(e, t, n, s) {
|
|
1592
1477
|
const r = {
|
|
1593
|
-
id:
|
|
1478
|
+
id: h(),
|
|
1594
1479
|
type: "signal",
|
|
1595
1480
|
channel: n.to ?? this._name,
|
|
1596
1481
|
sender: this._name,
|
|
@@ -1738,10 +1623,10 @@ var Et = class {
|
|
|
1738
1623
|
return this._defaultTransport ? this._defaultTransport.targetChannel : "worker";
|
|
1739
1624
|
}
|
|
1740
1625
|
_inferTargetChannel(e, t) {
|
|
1741
|
-
return t === "worker" ? "worker" : t === "broadcast" && e.name ? e.name : t === "self" ? "self" : `${t}-${
|
|
1626
|
+
return t === "worker" ? "worker" : t === "broadcast" && e.name ? e.name : t === "self" ? "self" : `${t}-${h().slice(0, 8)}`;
|
|
1742
1627
|
}
|
|
1743
1628
|
_createProxy(e, t) {
|
|
1744
|
-
return
|
|
1629
|
+
return ee((s, r, i) => this.invoke(e, s, r, i), {
|
|
1745
1630
|
channel: e,
|
|
1746
1631
|
basePath: t,
|
|
1747
1632
|
cache: !0,
|
|
@@ -1756,24 +1641,24 @@ var Et = class {
|
|
|
1756
1641
|
].includes(this._contextType);
|
|
1757
1642
|
}
|
|
1758
1643
|
};
|
|
1759
|
-
function
|
|
1760
|
-
return new
|
|
1644
|
+
function S(e) {
|
|
1645
|
+
return new yt(e);
|
|
1761
1646
|
}
|
|
1762
|
-
function
|
|
1763
|
-
return
|
|
1647
|
+
function wr(e, t, n) {
|
|
1648
|
+
return S({
|
|
1764
1649
|
name: e,
|
|
1765
1650
|
...n
|
|
1766
1651
|
}).attach(t, n);
|
|
1767
1652
|
}
|
|
1768
|
-
function
|
|
1653
|
+
function vr(e, t, n) {
|
|
1769
1654
|
const s = new MessageChannel();
|
|
1770
1655
|
return s.port1.start(), s.port2.start(), {
|
|
1771
|
-
channel1:
|
|
1656
|
+
channel1: S({
|
|
1772
1657
|
name: e,
|
|
1773
1658
|
autoListen: !1,
|
|
1774
1659
|
...n
|
|
1775
1660
|
}).attach(s.port1, { targetChannel: t }),
|
|
1776
|
-
channel2:
|
|
1661
|
+
channel2: S({
|
|
1777
1662
|
name: t,
|
|
1778
1663
|
autoListen: !1,
|
|
1779
1664
|
...n
|
|
@@ -1781,47 +1666,47 @@ function Ar(e, t, n) {
|
|
|
1781
1666
|
messageChannel: s
|
|
1782
1667
|
};
|
|
1783
1668
|
}
|
|
1784
|
-
var
|
|
1785
|
-
function
|
|
1786
|
-
return
|
|
1669
|
+
var U = /* @__PURE__ */ new Map();
|
|
1670
|
+
function Cr(e, t) {
|
|
1671
|
+
return U.has(e) || U.set(e, S({
|
|
1787
1672
|
name: e,
|
|
1788
1673
|
...t
|
|
1789
|
-
})),
|
|
1674
|
+
})), U.get(e);
|
|
1790
1675
|
}
|
|
1791
|
-
function
|
|
1792
|
-
return [...
|
|
1676
|
+
function xr() {
|
|
1677
|
+
return [...U.keys()];
|
|
1793
1678
|
}
|
|
1794
|
-
function
|
|
1795
|
-
const t =
|
|
1796
|
-
return t ? (t.close(),
|
|
1679
|
+
function kr(e) {
|
|
1680
|
+
const t = U.get(e);
|
|
1681
|
+
return t ? (t.close(), U.delete(e)) : !1;
|
|
1797
1682
|
}
|
|
1798
|
-
var
|
|
1799
|
-
function
|
|
1800
|
-
if (!
|
|
1801
|
-
const e =
|
|
1683
|
+
var re = null;
|
|
1684
|
+
function te() {
|
|
1685
|
+
if (!re) {
|
|
1686
|
+
const e = H();
|
|
1802
1687
|
[
|
|
1803
1688
|
"worker",
|
|
1804
1689
|
"shared-worker",
|
|
1805
1690
|
"service-worker"
|
|
1806
|
-
].includes(e) ?
|
|
1691
|
+
].includes(e) ? re = S({
|
|
1807
1692
|
name: "worker",
|
|
1808
1693
|
autoListen: !0
|
|
1809
|
-
}) :
|
|
1694
|
+
}) : re = S({
|
|
1810
1695
|
name: "host",
|
|
1811
1696
|
autoListen: !1
|
|
1812
1697
|
});
|
|
1813
1698
|
}
|
|
1814
|
-
return
|
|
1699
|
+
return re;
|
|
1815
1700
|
}
|
|
1816
|
-
function
|
|
1817
|
-
|
|
1701
|
+
function Sr(e, t) {
|
|
1702
|
+
te().expose(e, t);
|
|
1818
1703
|
}
|
|
1819
|
-
function
|
|
1820
|
-
return
|
|
1704
|
+
function Er(e, t) {
|
|
1705
|
+
return te().remote(e, t);
|
|
1821
1706
|
}
|
|
1822
|
-
var
|
|
1823
|
-
function
|
|
1824
|
-
const n =
|
|
1707
|
+
var wt = (e, t = null) => te().proxy(e), Ir = (e, t, n = {}) => wt(t, null), Tr = (e, t, n = {}) => te().wrapDescriptor(e, e?.channel ?? n?.connectChannel);
|
|
1708
|
+
function Pr(e, t) {
|
|
1709
|
+
const n = S({
|
|
1825
1710
|
name: t,
|
|
1826
1711
|
autoListen: !1
|
|
1827
1712
|
});
|
|
@@ -1833,7 +1718,7 @@ function Wr(e, t) {
|
|
|
1833
1718
|
request: (s) => n.invoke(t, d.CALL, [], [s])
|
|
1834
1719
|
};
|
|
1835
1720
|
}
|
|
1836
|
-
var
|
|
1721
|
+
var C = {
|
|
1837
1722
|
rjb: "rejectBy",
|
|
1838
1723
|
rvb: "resolveBy",
|
|
1839
1724
|
rj: "reject",
|
|
@@ -1843,49 +1728,49 @@ var k = {
|
|
|
1843
1728
|
a: "array",
|
|
1844
1729
|
ta: "typedarray",
|
|
1845
1730
|
udf: "undefined"
|
|
1846
|
-
},
|
|
1847
|
-
typeof ArrayBuffer !=
|
|
1848
|
-
typeof MessagePort !=
|
|
1849
|
-
typeof ReadableStream !=
|
|
1850
|
-
typeof WritableStream !=
|
|
1851
|
-
typeof TransformStream !=
|
|
1852
|
-
typeof WebTransportReceiveStream !=
|
|
1853
|
-
typeof WebTransportSendStream !=
|
|
1854
|
-
typeof AudioData !=
|
|
1855
|
-
typeof ImageBitmap !=
|
|
1856
|
-
typeof VideoFrame !=
|
|
1857
|
-
typeof OffscreenCanvas !=
|
|
1858
|
-
typeof RTCDataChannel !=
|
|
1859
|
-
].filter((e) => e != null),
|
|
1731
|
+
}, Mr = [
|
|
1732
|
+
typeof ArrayBuffer != C.udf ? ArrayBuffer : null,
|
|
1733
|
+
typeof MessagePort != C.udf ? MessagePort : null,
|
|
1734
|
+
typeof ReadableStream != C.udf ? ReadableStream : null,
|
|
1735
|
+
typeof WritableStream != C.udf ? WritableStream : null,
|
|
1736
|
+
typeof TransformStream != C.udf ? TransformStream : null,
|
|
1737
|
+
typeof WebTransportReceiveStream != C.udf ? WebTransportReceiveStream : null,
|
|
1738
|
+
typeof WebTransportSendStream != C.udf ? WebTransportSendStream : null,
|
|
1739
|
+
typeof AudioData != C.udf ? AudioData : null,
|
|
1740
|
+
typeof ImageBitmap != C.udf ? ImageBitmap : null,
|
|
1741
|
+
typeof VideoFrame != C.udf ? VideoFrame : null,
|
|
1742
|
+
typeof OffscreenCanvas != C.udf ? OffscreenCanvas : null,
|
|
1743
|
+
typeof RTCDataChannel != C.udf ? RTCDataChannel : null
|
|
1744
|
+
].filter((e) => e != null), vt = () => {
|
|
1860
1745
|
try {
|
|
1861
1746
|
const e = globalThis?.ServiceWorkerGlobalScope;
|
|
1862
1747
|
return typeof e < "u" && globalThis instanceof e;
|
|
1863
1748
|
} catch {
|
|
1864
1749
|
return !1;
|
|
1865
1750
|
}
|
|
1866
|
-
},
|
|
1751
|
+
}, Pn = () => {
|
|
1867
1752
|
try {
|
|
1868
1753
|
return typeof chrome < "u" && !!chrome?.runtime?.id;
|
|
1869
1754
|
} catch {
|
|
1870
1755
|
return !1;
|
|
1871
1756
|
}
|
|
1872
|
-
},
|
|
1873
|
-
if (
|
|
1874
|
-
if (
|
|
1757
|
+
}, Ne = () => {
|
|
1758
|
+
if (Pn()) return "chrome-extension";
|
|
1759
|
+
if (vt()) return "service-worker";
|
|
1875
1760
|
try {
|
|
1876
1761
|
if (typeof document < "u") return "main";
|
|
1877
1762
|
} catch {
|
|
1878
1763
|
}
|
|
1879
1764
|
return "unknown";
|
|
1880
|
-
},
|
|
1881
|
-
if (
|
|
1765
|
+
}, Mn = () => {
|
|
1766
|
+
if (vt()) return !1;
|
|
1882
1767
|
try {
|
|
1883
1768
|
return typeof Worker < "u";
|
|
1884
1769
|
} catch {
|
|
1885
1770
|
return !1;
|
|
1886
1771
|
}
|
|
1887
1772
|
};
|
|
1888
|
-
function
|
|
1773
|
+
function Ct() {
|
|
1889
1774
|
try {
|
|
1890
1775
|
const e = globalThis.location?.href;
|
|
1891
1776
|
if (typeof e == "string" && e.length > 0) return e;
|
|
@@ -1897,16 +1782,16 @@ function Mt() {
|
|
|
1897
1782
|
}
|
|
1898
1783
|
return "";
|
|
1899
1784
|
}
|
|
1900
|
-
function
|
|
1901
|
-
const t =
|
|
1785
|
+
function P(e) {
|
|
1786
|
+
const t = Ct();
|
|
1902
1787
|
if (!t.length) throw new TypeError("[uniform] No base URL for worker resolution (missing location / document.baseURI)");
|
|
1903
1788
|
const n = e.startsWith("/") ? e.replace(/^\//, "./") : e;
|
|
1904
1789
|
return new URL(n, t).href;
|
|
1905
1790
|
}
|
|
1906
|
-
var
|
|
1791
|
+
var ye = /* @__PURE__ */ new Map(), w = {
|
|
1907
1792
|
name: "unknown",
|
|
1908
1793
|
instance: null
|
|
1909
|
-
},
|
|
1794
|
+
}, we = /* @__PURE__ */ new Map(), xt = (e) => [...Object.values(d)].includes(e), Ar = (e) => {
|
|
1910
1795
|
if (e instanceof Worker) return e;
|
|
1911
1796
|
if (e instanceof URL) return new Worker(e.href, { type: "module" });
|
|
1912
1797
|
if (typeof e == "function") try {
|
|
@@ -1914,117 +1799,113 @@ var ke = /* @__PURE__ */ new Map(), v = {
|
|
|
1914
1799
|
} catch {
|
|
1915
1800
|
return e({ type: "module" });
|
|
1916
1801
|
}
|
|
1917
|
-
return typeof e == "string" ? e.startsWith("/") ? new Worker(
|
|
1918
|
-
},
|
|
1802
|
+
return typeof e == "string" ? e.startsWith("/") ? new Worker(P(e.replace(/^\//, "./")), { type: "module" }) : URL.canParse(e) || e.startsWith("./") ? new Worker(P(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);
|
|
1803
|
+
}, kt = class {
|
|
1919
1804
|
channelName;
|
|
1920
1805
|
options;
|
|
1921
1806
|
_channel;
|
|
1922
1807
|
constructor(e, t = {}) {
|
|
1923
|
-
this.channelName = e, this.options = t, this._channel =
|
|
1808
|
+
this.channelName = e, this.options = t, this._channel = te();
|
|
1924
1809
|
}
|
|
1925
1810
|
request(e, t, n, s = {}) {
|
|
1926
|
-
return typeof e == "string" && (e = [e]), Array.isArray(t) &&
|
|
1811
|
+
return typeof e == "string" && (e = [e]), Array.isArray(t) && xt(e) && (s = n, n = t, t = e, e = []), this._channel.invoke(this.channelName, t, e, n);
|
|
1927
1812
|
}
|
|
1928
1813
|
doImportModule(e, t) {
|
|
1929
1814
|
return this._channel.import(e, this.channelName);
|
|
1930
1815
|
}
|
|
1931
|
-
},
|
|
1816
|
+
}, An = class {
|
|
1932
1817
|
channel;
|
|
1933
1818
|
options;
|
|
1934
1819
|
_unified;
|
|
1935
1820
|
broadcasts = {};
|
|
1936
1821
|
constructor(e, t = {}) {
|
|
1937
|
-
this.channel = e, this.options = t, this._unified =
|
|
1822
|
+
this.channel = e, this.options = t, this._unified = S({
|
|
1938
1823
|
name: e,
|
|
1939
1824
|
autoListen: !1
|
|
1940
|
-
}),
|
|
1825
|
+
}), w.name = e, w.instance = this;
|
|
1941
1826
|
}
|
|
1942
1827
|
createRemoteChannel(e, t = {}, n) {
|
|
1943
|
-
return n && (this._unified.attach(n, { targetChannel: e }), this.broadcasts[e] = n), Promise.resolve(new
|
|
1828
|
+
return n && (this._unified.attach(n, { targetChannel: e }), this.broadcasts[e] = n), Promise.resolve(new kt(e, t));
|
|
1944
1829
|
}
|
|
1945
1830
|
getChannel() {
|
|
1946
1831
|
return this.channel;
|
|
1947
1832
|
}
|
|
1948
1833
|
request(e, t, n, s = {}, r = "worker") {
|
|
1949
|
-
return typeof e == "string" && (e = [e]), Array.isArray(t) &&
|
|
1834
|
+
return typeof e == "string" && (e = [e]), Array.isArray(t) && xt(e) && (r = s, s = n, n = t, t = e, e = []), this._unified.invoke(r, t, e, n);
|
|
1950
1835
|
}
|
|
1951
1836
|
resolveResponse(e, t) {
|
|
1952
1837
|
return Promise.resolve(t);
|
|
1953
1838
|
}
|
|
1954
1839
|
async handleAndResponse(e, t, n) {
|
|
1955
|
-
const s = await
|
|
1840
|
+
const s = await De(e, t, this.channel);
|
|
1956
1841
|
s && n?.(s.response, s.transfer);
|
|
1957
1842
|
}
|
|
1958
1843
|
close() {
|
|
1959
1844
|
this._unified.close();
|
|
1960
1845
|
}
|
|
1961
|
-
},
|
|
1962
|
-
if (
|
|
1963
|
-
if (
|
|
1964
|
-
const t = new
|
|
1965
|
-
return e === "$host$" && (
|
|
1966
|
-
},
|
|
1967
|
-
const s =
|
|
1846
|
+
}, Oe = (e = "$host$") => {
|
|
1847
|
+
if (w?.instance && e === "$host$") return w.instance;
|
|
1848
|
+
if (we.has(e)) return we.get(e) ?? null;
|
|
1849
|
+
const t = new An(e);
|
|
1850
|
+
return e === "$host$" && (w.name = e, w.instance = t), we.set(e, t), t;
|
|
1851
|
+
}, St = (e = "$host$") => Oe(e), G = (e, t = {}, n = typeof self < "u" ? self : null) => {
|
|
1852
|
+
const s = St(e ?? "$host$");
|
|
1968
1853
|
return s?.createRemoteChannel?.(e, t, n) ?? s;
|
|
1969
|
-
},
|
|
1854
|
+
}, Rr = (e, t = {}, n) => {
|
|
1970
1855
|
if (e == null || n) return;
|
|
1971
|
-
if (
|
|
1856
|
+
if (ye.has(e)) return ye.get(e);
|
|
1972
1857
|
const s = {
|
|
1973
1858
|
channel: e,
|
|
1974
|
-
instance:
|
|
1975
|
-
remote: Promise.resolve(new
|
|
1859
|
+
instance: w.instance,
|
|
1860
|
+
remote: Promise.resolve(new kt(e, t))
|
|
1976
1861
|
};
|
|
1977
|
-
return
|
|
1978
|
-
},
|
|
1862
|
+
return ye.set(e, s), s;
|
|
1863
|
+
}, ue = /* @__PURE__ */ new WeakMap(), de = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap(), qr = (e, t) => ue.get(e)?.[t], Rn = (e, t = w?.name, n) => typeof e == "object" && e != null || typeof e == "function" && e != null ? de.has(e) ? de.get(e) : ue.has(e) ? ue.get(e) : ot(e) || n?.includes?.(e) || t == w?.name ? e : {
|
|
1979
1864
|
$isDescriptor: !0,
|
|
1980
|
-
path:
|
|
1981
|
-
const s = [
|
|
1982
|
-
return
|
|
1865
|
+
path: D.get(e) ?? (() => {
|
|
1866
|
+
const s = [h()];
|
|
1867
|
+
return fe(s, e), s;
|
|
1983
1868
|
})(),
|
|
1984
|
-
owner:
|
|
1869
|
+
owner: w?.name,
|
|
1985
1870
|
channel: t,
|
|
1986
|
-
primitive:
|
|
1871
|
+
primitive: Ae(e),
|
|
1987
1872
|
writable: !0,
|
|
1988
1873
|
enumerable: !0,
|
|
1989
1874
|
configurable: !0,
|
|
1990
1875
|
argumentCount: e instanceof Function ? e.length : -1
|
|
1991
|
-
} :
|
|
1992
|
-
}) :
|
|
1993
|
-
if (typeof e != "object" && typeof e != "function" || e == null || (e =
|
|
1994
|
-
if (Array.isArray(e)) return e.map(
|
|
1995
|
-
if (e instanceof Map) return new Map(Array.from(e.entries()).map(([t, n]) => [t,
|
|
1996
|
-
if (e instanceof Set) return new Set(Array.from(e.values()).map(
|
|
1997
|
-
if (typeof e == "object") for (const t of Object.keys(e)) e[t] =
|
|
1876
|
+
} : Me(e) ? e : null, qn = /* @__PURE__ */ Symbol.for("@requestHandler"), Q = /* @__PURE__ */ Symbol.for("@descriptor"), ve = (e) => Me(e) || e?.[Q] ? e : e?.$isDescriptor ? En(e, async () => {
|
|
1877
|
+
}) : ot(e) ? e : null, Nn = (e) => typeof e != "function" && typeof e != "object" || e == null ? e : de.get(e) ?? ue.get(e) ?? e, ie = (e) => {
|
|
1878
|
+
if (typeof e != "object" && typeof e != "function" || e == null || (e = Nn(e), typeof e != "object" && typeof e != "function" || e == null)) return e;
|
|
1879
|
+
if (Array.isArray(e)) return e.map(ie);
|
|
1880
|
+
if (e instanceof Map) return new Map(Array.from(e.entries()).map(([t, n]) => [t, ie(n)]));
|
|
1881
|
+
if (e instanceof Set) return new Set(Array.from(e.values()).map(ie));
|
|
1882
|
+
if (typeof e == "object") for (const t of Object.keys(e)) e[t] = ie(e[t]);
|
|
1998
1883
|
return e;
|
|
1999
|
-
},
|
|
1884
|
+
}, X = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new WeakMap(), Et = (e, t) => {
|
|
2000
1885
|
if (t != null && !Array.isArray(t) && (t = [t]), t == null || t?.length < 1) return e;
|
|
2001
|
-
const n = e?.[
|
|
2002
|
-
if (n && n?.owner ==
|
|
1886
|
+
const n = e?.[Q] ?? (e?.$isDescriptor ? e : null);
|
|
1887
|
+
if (n && n?.owner == w?.name && (e = L(n?.path) ?? e), Ae(e)) return e;
|
|
2003
1888
|
for (const s of t)
|
|
2004
1889
|
if (e = e?.[s], e == null) return e;
|
|
2005
1890
|
return e;
|
|
2006
|
-
},
|
|
1891
|
+
}, L = (e) => {
|
|
2007
1892
|
if (e != null && !Array.isArray(e) && (e = [e]), e == null || e?.length < 1) return null;
|
|
2008
|
-
const t =
|
|
2009
|
-
return t != null ?
|
|
2010
|
-
},
|
|
2011
|
-
const n = t?.[
|
|
2012
|
-
if (n && n?.owner ==
|
|
2013
|
-
const s =
|
|
2014
|
-
return e?.length > 1 ?
|
|
2015
|
-
},
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
}, Vn = (e) => {
|
|
2025
|
-
const t = e?.[Z] ?? (e?.$isDescriptor ? e : null);
|
|
2026
|
-
return (W?.get?.(e) ?? t?.path) == null;
|
|
2027
|
-
}, D = (e) => (typeof e == "object" || typeof e == "function") && e != null, Ot = {
|
|
1893
|
+
const t = X?.get?.(e?.[0]) ?? null;
|
|
1894
|
+
return t != null ? Et(t, e?.slice?.(1)) : null;
|
|
1895
|
+
}, fe = (e, t) => {
|
|
1896
|
+
const n = t?.[Q] ?? (t?.$isDescriptor ? t : null);
|
|
1897
|
+
if (n && n?.owner == w?.name && (t = L(n?.path) ?? t), e != null && !Array.isArray(e) && (e = [e]), e == null || e?.length < 1) return null;
|
|
1898
|
+
const s = X?.get?.(e?.[0]) ?? null;
|
|
1899
|
+
return e?.length > 1 ? Et(s, e?.slice?.(1, -1))[e?.[e?.length - 1]] = t : X?.set?.(e?.[0], t), (typeof t == "object" || typeof t == "function") && D?.set?.(t, e), t;
|
|
1900
|
+
}, It = (e) => (e != null && !Array.isArray(e) && (e = [e]), e == null || e?.length < 1 ? !1 : !(X?.get?.(e?.[0]) ?? null) && e?.length <= 1 ? (X?.delete?.(e?.[0]), !0) : !1), On = (e) => {
|
|
1901
|
+
const t = e?.[Q] ?? (e?.$isDescriptor ? e : null);
|
|
1902
|
+
t && t?.owner == w?.name && (e = L(t?.path) ?? e);
|
|
1903
|
+
const n = D?.get?.(e) ?? t?.path;
|
|
1904
|
+
return n == null || n?.length < 1 ? !1 : (It(n), (typeof e == "object" || typeof e == "function") && D?.delete?.(e), !0);
|
|
1905
|
+
}, Dn = (e) => {
|
|
1906
|
+
const t = e?.[Q] ?? (e?.$isDescriptor ? e : null);
|
|
1907
|
+
return (D?.get?.(e) ?? t?.path) == null;
|
|
1908
|
+
}, R = (e) => (typeof e == "object" || typeof e == "function") && e != null, Tt = {
|
|
2028
1909
|
get: (e, t) => e?.[t],
|
|
2029
1910
|
set: (e, t, n) => (e[t] = n, !0),
|
|
2030
1911
|
has: (e, t) => t in e,
|
|
@@ -2038,9 +1919,9 @@ var ke = /* @__PURE__ */ new Map(), v = {
|
|
|
2038
1919
|
isExtensible: (e) => Object.isExtensible(e),
|
|
2039
1920
|
preventExtensions: (e) => Object.preventExtensions(e)
|
|
2040
1921
|
};
|
|
2041
|
-
function
|
|
2042
|
-
const { channel: r = "", sender: i = "", reflect: o =
|
|
2043
|
-
let l = null,
|
|
1922
|
+
function Pt(e, t, n, s = {}) {
|
|
1923
|
+
const { channel: r = "", sender: i = "", reflect: o = Tt } = s, a = s.target ?? L(t), c = [];
|
|
1924
|
+
let l = null, u = t;
|
|
2044
1925
|
switch (String(e).toLowerCase()) {
|
|
2045
1926
|
case "import":
|
|
2046
1927
|
case d.IMPORT:
|
|
@@ -2051,18 +1932,18 @@ function Dt(e, t, n, s = {}) {
|
|
|
2051
1932
|
break;
|
|
2052
1933
|
case "transfer":
|
|
2053
1934
|
case d.TRANSFER:
|
|
2054
|
-
|
|
1935
|
+
Ie(a) && r !== i && c.push(a), l = a;
|
|
2055
1936
|
break;
|
|
2056
1937
|
case "get":
|
|
2057
1938
|
case d.GET: {
|
|
2058
|
-
const p = n?.[0],
|
|
2059
|
-
l = typeof
|
|
1939
|
+
const p = n?.[0], y = o.get?.(a, p) ?? a?.[p];
|
|
1940
|
+
l = typeof y == "function" && a != null ? y.bind(a) : y, u = [...t, String(p)];
|
|
2060
1941
|
break;
|
|
2061
1942
|
}
|
|
2062
1943
|
case "set":
|
|
2063
1944
|
case d.SET: {
|
|
2064
|
-
const [p,
|
|
2065
|
-
s.target ? l = o.set?.(a, p,
|
|
1945
|
+
const [p, y] = n, x = he(y, ve);
|
|
1946
|
+
s.target ? l = o.set?.(a, p, x) ?? (a[p] = x, !0) : l = o.set?.(a, p, x) ?? fe([...t, String(p)], x);
|
|
2066
1947
|
break;
|
|
2067
1948
|
}
|
|
2068
1949
|
case "apply":
|
|
@@ -2070,14 +1951,14 @@ function Dt(e, t, n, s = {}) {
|
|
|
2070
1951
|
case d.APPLY:
|
|
2071
1952
|
case d.CALL:
|
|
2072
1953
|
if (typeof a == "function") {
|
|
2073
|
-
const p = s.context ?? (s.target ? void 0 :
|
|
2074
|
-
l = o.apply?.(a, p,
|
|
1954
|
+
const p = s.context ?? (s.target ? void 0 : L(t.slice(0, -1))), y = he(n?.[0] ?? n ?? [], ve);
|
|
1955
|
+
l = o.apply?.(a, p, y) ?? a.apply(p, y), Ie(l) && t?.at(-1) === "transfer" && r !== i && c.push(l);
|
|
2075
1956
|
}
|
|
2076
1957
|
break;
|
|
2077
1958
|
case "construct":
|
|
2078
1959
|
case d.CONSTRUCT:
|
|
2079
1960
|
if (typeof a == "function") {
|
|
2080
|
-
const p =
|
|
1961
|
+
const p = he(n?.[0] ?? n ?? [], ve);
|
|
2081
1962
|
l = o.construct?.(a, p) ?? new a(...p);
|
|
2082
1963
|
}
|
|
2083
1964
|
break;
|
|
@@ -2091,50 +1972,49 @@ function Dt(e, t, n, s = {}) {
|
|
|
2091
1972
|
const p = t[t.length - 1];
|
|
2092
1973
|
l = o.deleteProperty?.(a, p) ?? delete a[p];
|
|
2093
1974
|
} else
|
|
2094
|
-
l = t?.length > 0 ?
|
|
1975
|
+
l = t?.length > 0 ? It(t) : On(a), l && (u = D.get(a) ?? []);
|
|
2095
1976
|
break;
|
|
2096
1977
|
case "has":
|
|
2097
1978
|
case d.HAS:
|
|
2098
|
-
l = o.has?.(a, n?.[0]) ?? (
|
|
1979
|
+
l = o.has?.(a, n?.[0]) ?? (R(a) ? n?.[0] in a : !1);
|
|
2099
1980
|
break;
|
|
2100
1981
|
case "ownkeys":
|
|
2101
1982
|
case d.OWN_KEYS:
|
|
2102
|
-
l = o.ownKeys?.(a) ?? (
|
|
1983
|
+
l = o.ownKeys?.(a) ?? (R(a) ? Object.keys(a) : []);
|
|
2103
1984
|
break;
|
|
2104
1985
|
case "getownpropertydescriptor":
|
|
2105
1986
|
case "getpropertydescriptor":
|
|
2106
1987
|
case d.GET_OWN_PROPERTY_DESCRIPTOR:
|
|
2107
1988
|
case d.GET_PROPERTY_DESCRIPTOR:
|
|
2108
|
-
l = o.getOwnPropertyDescriptor?.(a, n?.[0] ?? t?.at(-1) ?? "") ?? (
|
|
1989
|
+
l = o.getOwnPropertyDescriptor?.(a, n?.[0] ?? t?.at(-1) ?? "") ?? (R(a) ? Object.getOwnPropertyDescriptor(a, n?.[0] ?? t?.at(-1) ?? "") : void 0);
|
|
2109
1990
|
break;
|
|
2110
1991
|
case "getprototypeof":
|
|
2111
1992
|
case d.GET_PROTOTYPE_OF:
|
|
2112
|
-
l = o.getPrototypeOf?.(a) ?? (
|
|
1993
|
+
l = o.getPrototypeOf?.(a) ?? (R(a) ? Object.getPrototypeOf(a) : null);
|
|
2113
1994
|
break;
|
|
2114
1995
|
case "setprototypeof":
|
|
2115
1996
|
case d.SET_PROTOTYPE_OF:
|
|
2116
|
-
l = o.setPrototypeOf?.(a, n?.[0]) ?? (
|
|
1997
|
+
l = o.setPrototypeOf?.(a, n?.[0]) ?? (R(a) ? Object.setPrototypeOf(a, n?.[0]) : !1);
|
|
2117
1998
|
break;
|
|
2118
1999
|
case "isextensible":
|
|
2119
2000
|
case d.IS_EXTENSIBLE:
|
|
2120
|
-
l = o.isExtensible?.(a) ?? (
|
|
2001
|
+
l = o.isExtensible?.(a) ?? (R(a) ? Object.isExtensible(a) : !0);
|
|
2121
2002
|
break;
|
|
2122
2003
|
case "preventextensions":
|
|
2123
2004
|
case d.PREVENT_EXTENSIONS:
|
|
2124
|
-
l = o.preventExtensions?.(a) ?? (
|
|
2125
|
-
break;
|
|
2005
|
+
l = o.preventExtensions?.(a) ?? (R(a) ? Object.preventExtensions(a) : !1);
|
|
2126
2006
|
}
|
|
2127
2007
|
return {
|
|
2128
2008
|
result: l,
|
|
2129
2009
|
toTransfer: c,
|
|
2130
|
-
path:
|
|
2010
|
+
path: u
|
|
2131
2011
|
};
|
|
2132
2012
|
}
|
|
2133
|
-
async function
|
|
2134
|
-
const a = await i, c =
|
|
2013
|
+
async function Mt(e, t, n, s, r, i, o) {
|
|
2014
|
+
const a = await i, c = Ie(a) && o.includes(a) || Me(a);
|
|
2135
2015
|
let l = r;
|
|
2136
|
-
!c && t !== "get" && t !== d.GET && (typeof a == "object" || typeof a == "function") && (
|
|
2137
|
-
const
|
|
2016
|
+
!c && t !== "get" && t !== d.GET && (typeof a == "object" || typeof a == "function") && (Dn(a) ? (l = [h()], fe(l, a)) : l = D.get(a) ?? []);
|
|
2017
|
+
const u = L(l), p = t === "get" || t === d.GET ? l?.at(-1) : void 0, y = L(r), x = he(a, (sn) => Rn(sn, n, o)) ?? a;
|
|
2138
2018
|
return {
|
|
2139
2019
|
response: {
|
|
2140
2020
|
channel: s,
|
|
@@ -2143,7 +2023,7 @@ async function Lt(e, t, n, s, r, i, o) {
|
|
|
2143
2023
|
action: t,
|
|
2144
2024
|
type: "response",
|
|
2145
2025
|
payload: {
|
|
2146
|
-
result: c ?
|
|
2026
|
+
result: c ? x : null,
|
|
2147
2027
|
type: typeof a,
|
|
2148
2028
|
channel: s,
|
|
2149
2029
|
sender: n,
|
|
@@ -2152,29 +2032,29 @@ async function Lt(e, t, n, s, r, i, o) {
|
|
|
2152
2032
|
path: l,
|
|
2153
2033
|
owner: n,
|
|
2154
2034
|
channel: n,
|
|
2155
|
-
primitive:
|
|
2035
|
+
primitive: Ae(a),
|
|
2156
2036
|
writable: !0,
|
|
2157
2037
|
enumerable: !0,
|
|
2158
2038
|
configurable: !0,
|
|
2159
|
-
argumentCount:
|
|
2160
|
-
...
|
|
2039
|
+
argumentCount: y instanceof Function ? y.length : -1,
|
|
2040
|
+
...R(u) && p != null ? Object.getOwnPropertyDescriptor(u, p) : {}
|
|
2161
2041
|
}
|
|
2162
2042
|
}
|
|
2163
2043
|
},
|
|
2164
2044
|
transfer: o
|
|
2165
2045
|
};
|
|
2166
2046
|
}
|
|
2167
|
-
async function
|
|
2047
|
+
async function De(e, t, n, s) {
|
|
2168
2048
|
const { channel: r, sender: i, path: o, action: a, args: c } = e;
|
|
2169
2049
|
if (r !== n) return null;
|
|
2170
|
-
const { result: l, toTransfer:
|
|
2050
|
+
const { result: l, toTransfer: u, path: p } = Pt(a, o, c, {
|
|
2171
2051
|
channel: r,
|
|
2172
2052
|
sender: i,
|
|
2173
2053
|
...s
|
|
2174
2054
|
});
|
|
2175
|
-
return
|
|
2055
|
+
return Mt(t, a, n, i, p, l, u);
|
|
2176
2056
|
}
|
|
2177
|
-
function
|
|
2057
|
+
function Ln(e, t = Tt) {
|
|
2178
2058
|
return async (n, s, r) => {
|
|
2179
2059
|
let i = e, o = e;
|
|
2180
2060
|
for (let c = 0; c < s.length; c++)
|
|
@@ -2218,10 +2098,10 @@ function Qn(e, t = Ot) {
|
|
|
2218
2098
|
}
|
|
2219
2099
|
};
|
|
2220
2100
|
}
|
|
2221
|
-
var
|
|
2101
|
+
var Bn = class {
|
|
2222
2102
|
_name;
|
|
2223
2103
|
_transportType;
|
|
2224
|
-
_id =
|
|
2104
|
+
_id = h();
|
|
2225
2105
|
_state = "disconnected";
|
|
2226
2106
|
_inbound = new _({ bufferSize: 1e3 });
|
|
2227
2107
|
_outbound = new _({ bufferSize: 1e3 });
|
|
@@ -2253,7 +2133,7 @@ var Kn = class {
|
|
|
2253
2133
|
}, this._setupSubscriptions();
|
|
2254
2134
|
}
|
|
2255
2135
|
subscribe(e, t) {
|
|
2256
|
-
return (t ?
|
|
2136
|
+
return (t ? ut((n) => n.sender === t)(this._inbound) : this._inbound).subscribe(typeof e == "function" ? { next: e } : e);
|
|
2257
2137
|
}
|
|
2258
2138
|
next(e) {
|
|
2259
2139
|
if (this._state !== "connected") {
|
|
@@ -2263,13 +2143,13 @@ var Kn = class {
|
|
|
2263
2143
|
this._outbound.next(e), this._stats.messagesSent++;
|
|
2264
2144
|
}
|
|
2265
2145
|
async request(e, t, n = {}) {
|
|
2266
|
-
const s =
|
|
2146
|
+
const s = h(), r = Promise.withResolvers();
|
|
2267
2147
|
this._pending.set(s, r);
|
|
2268
2148
|
const i = setTimeout(() => {
|
|
2269
2149
|
this._pending.has(s) && (this._pending.delete(s), r.reject(/* @__PURE__ */ new Error("Request timeout")));
|
|
2270
2150
|
}, n.timeout ?? this._opts.timeout);
|
|
2271
2151
|
return this.next({
|
|
2272
|
-
id:
|
|
2152
|
+
id: h(),
|
|
2273
2153
|
channel: e,
|
|
2274
2154
|
sender: this._name,
|
|
2275
2155
|
type: "request",
|
|
@@ -2284,7 +2164,7 @@ var Kn = class {
|
|
|
2284
2164
|
}
|
|
2285
2165
|
respond(e, t) {
|
|
2286
2166
|
this.next({
|
|
2287
|
-
id:
|
|
2167
|
+
id: h(),
|
|
2288
2168
|
channel: e.sender,
|
|
2289
2169
|
sender: this._name,
|
|
2290
2170
|
type: "response",
|
|
@@ -2295,7 +2175,7 @@ var Kn = class {
|
|
|
2295
2175
|
}
|
|
2296
2176
|
emit(e, t, n) {
|
|
2297
2177
|
this.next({
|
|
2298
|
-
id:
|
|
2178
|
+
id: h(),
|
|
2299
2179
|
channel: e,
|
|
2300
2180
|
sender: this._name,
|
|
2301
2181
|
type: "event",
|
|
@@ -2383,14 +2263,14 @@ var Kn = class {
|
|
|
2383
2263
|
connectedChannels: new Set(this._connectedPeers.keys())
|
|
2384
2264
|
};
|
|
2385
2265
|
}
|
|
2386
|
-
},
|
|
2266
|
+
}, Wn = class Y {
|
|
2387
2267
|
_connections = /* @__PURE__ */ new Map();
|
|
2388
2268
|
static _instance = null;
|
|
2389
2269
|
static getInstance() {
|
|
2390
|
-
return
|
|
2270
|
+
return Y._instance || (Y._instance = new Y()), Y._instance;
|
|
2391
2271
|
}
|
|
2392
2272
|
getOrCreate(t, n = "internal", s = {}) {
|
|
2393
|
-
return this._connections.has(t) || this._connections.set(t, new
|
|
2273
|
+
return this._connections.has(t) || this._connections.set(t, new Bn(t, n, s)), this._connections.get(t);
|
|
2394
2274
|
}
|
|
2395
2275
|
get(t) {
|
|
2396
2276
|
return this._connections.get(t);
|
|
@@ -2410,13 +2290,13 @@ var Kn = class {
|
|
|
2410
2290
|
get names() {
|
|
2411
2291
|
return [...this._connections.keys()];
|
|
2412
2292
|
}
|
|
2413
|
-
},
|
|
2293
|
+
}, Le = () => Wn.getInstance(), At = (e, t, n) => Le().getOrCreate(e, t, n), Nr = (e = "$host$", t) => At(e, "internal", {
|
|
2414
2294
|
...t,
|
|
2415
2295
|
metadata: {
|
|
2416
2296
|
...t?.metadata,
|
|
2417
2297
|
isHost: !0
|
|
2418
2298
|
}
|
|
2419
|
-
}),
|
|
2299
|
+
}), E = class {
|
|
2420
2300
|
_channelName;
|
|
2421
2301
|
_transportType;
|
|
2422
2302
|
_options;
|
|
@@ -2468,7 +2348,7 @@ var Kn = class {
|
|
|
2468
2348
|
get outbound() {
|
|
2469
2349
|
return this._outbound;
|
|
2470
2350
|
}
|
|
2471
|
-
},
|
|
2351
|
+
}, $n = class extends E {
|
|
2472
2352
|
_workerSource;
|
|
2473
2353
|
_worker = null;
|
|
2474
2354
|
_cleanup = null;
|
|
@@ -2479,7 +2359,7 @@ var Kn = class {
|
|
|
2479
2359
|
attach() {
|
|
2480
2360
|
if (this._isAttached) return;
|
|
2481
2361
|
this._worker = this._resolveWorker();
|
|
2482
|
-
const e =
|
|
2362
|
+
const e = g(this._worker);
|
|
2483
2363
|
this._cleanup = m(this._worker, (t) => this._handleIncoming(t), (t) => this._inbound.error(t)), this._subscriptions.push(this._outbound.subscribe((t) => e(t, t.transferable))), this._isAttached = !0;
|
|
2484
2364
|
}
|
|
2485
2365
|
detach() {
|
|
@@ -2493,7 +2373,7 @@ var Kn = class {
|
|
|
2493
2373
|
sender: t,
|
|
2494
2374
|
options: n,
|
|
2495
2375
|
messagePort: s,
|
|
2496
|
-
reqId:
|
|
2376
|
+
reqId: h()
|
|
2497
2377
|
}, { transfer: r });
|
|
2498
2378
|
}
|
|
2499
2379
|
connectChannel(e, t, n, s) {
|
|
@@ -2504,12 +2384,12 @@ var Kn = class {
|
|
|
2504
2384
|
sender: t,
|
|
2505
2385
|
port: n,
|
|
2506
2386
|
options: s,
|
|
2507
|
-
reqId:
|
|
2387
|
+
reqId: h()
|
|
2508
2388
|
}, { transfer: r });
|
|
2509
2389
|
}
|
|
2510
2390
|
listChannels() {
|
|
2511
2391
|
return new Promise((e) => {
|
|
2512
|
-
const t =
|
|
2392
|
+
const t = h(), n = (r) => {
|
|
2513
2393
|
const i = r;
|
|
2514
2394
|
i.type === "channelList" && i.reqId === t && (s.unsubscribe(), e(i.channels ?? []));
|
|
2515
2395
|
}, s = this._inbound.subscribe(n);
|
|
@@ -2523,7 +2403,7 @@ var Kn = class {
|
|
|
2523
2403
|
}
|
|
2524
2404
|
_handleIncoming(e) {
|
|
2525
2405
|
(e?.type === "channelCreated" || e?.type === "channelConnected") && this._emitIncomingConnection({
|
|
2526
|
-
id: e.reqId ??
|
|
2406
|
+
id: e.reqId ?? h(),
|
|
2527
2407
|
channel: e.channel,
|
|
2528
2408
|
sender: e.sender ?? "worker",
|
|
2529
2409
|
transportType: "worker",
|
|
@@ -2536,13 +2416,13 @@ var Kn = class {
|
|
|
2536
2416
|
if (this._ownWorker = !0, typeof this._workerSource == "function") return this._workerSource();
|
|
2537
2417
|
if (this._workerSource instanceof URL) return new Worker(this._workerSource.href, { type: "module" });
|
|
2538
2418
|
if (typeof this._workerSource == "string")
|
|
2539
|
-
return this._workerSource.startsWith("/") ? new Worker(
|
|
2419
|
+
return this._workerSource.startsWith("/") ? new Worker(P(this._workerSource.replace(/^\//, "./")), { type: "module" }) : URL.canParse(this._workerSource) || this._workerSource.startsWith("./") ? new Worker(P(this._workerSource), { type: "module" }) : new Worker(URL.createObjectURL(new Blob([this._workerSource], { type: "application/javascript" })), { type: "module" });
|
|
2540
2420
|
throw new Error("Invalid worker source");
|
|
2541
2421
|
}
|
|
2542
2422
|
get worker() {
|
|
2543
2423
|
return this._worker;
|
|
2544
2424
|
}
|
|
2545
|
-
},
|
|
2425
|
+
}, Fn = class extends E {
|
|
2546
2426
|
_port;
|
|
2547
2427
|
_cleanup = null;
|
|
2548
2428
|
constructor(e, t, n = {}) {
|
|
@@ -2550,7 +2430,7 @@ var Kn = class {
|
|
|
2550
2430
|
}
|
|
2551
2431
|
attach() {
|
|
2552
2432
|
if (this._isAttached) return;
|
|
2553
|
-
const e =
|
|
2433
|
+
const e = g(this._port);
|
|
2554
2434
|
this._cleanup = m(this._port, (t) => this._inbound.next(t)), this._subscriptions.push(this._outbound.subscribe((t) => e(t, t.transferable))), this._isAttached = !0;
|
|
2555
2435
|
}
|
|
2556
2436
|
detach() {
|
|
@@ -2559,7 +2439,7 @@ var Kn = class {
|
|
|
2559
2439
|
get port() {
|
|
2560
2440
|
return this._port;
|
|
2561
2441
|
}
|
|
2562
|
-
},
|
|
2442
|
+
}, Un = class extends E {
|
|
2563
2443
|
_bcName;
|
|
2564
2444
|
_channel = null;
|
|
2565
2445
|
_cleanup = null;
|
|
@@ -2570,7 +2450,7 @@ var Kn = class {
|
|
|
2570
2450
|
attach() {
|
|
2571
2451
|
if (this._isAttached) return;
|
|
2572
2452
|
this._channel = new BroadcastChannel(this._bcName ?? this._channelName);
|
|
2573
|
-
const e =
|
|
2453
|
+
const e = g(this._channel);
|
|
2574
2454
|
this._cleanup = m(this._channel, (t) => {
|
|
2575
2455
|
t?.sender !== this._channelName && this._handleIncoming(t);
|
|
2576
2456
|
}), this._subscriptions.push(this._outbound.subscribe((t) => e(t))), this._isAttached = !0, this._announcePresence();
|
|
@@ -2579,7 +2459,7 @@ var Kn = class {
|
|
|
2579
2459
|
if (e?.type === "announce" || e?.type === "connect") {
|
|
2580
2460
|
const t = e.sender ?? "unknown", n = !this._connectedPeers.has(t);
|
|
2581
2461
|
this._connectedPeers.add(t), n && (this._emitIncomingConnection({
|
|
2582
|
-
id: e.reqId ??
|
|
2462
|
+
id: e.reqId ?? h(),
|
|
2583
2463
|
channel: e.channel ?? this._channelName,
|
|
2584
2464
|
sender: t,
|
|
2585
2465
|
transportType: "broadcast",
|
|
@@ -2607,7 +2487,7 @@ var Kn = class {
|
|
|
2607
2487
|
detach() {
|
|
2608
2488
|
this._cleanup?.(), this._channel?.close(), this._channel = null, this._connectedPeers.clear(), super.detach();
|
|
2609
2489
|
}
|
|
2610
|
-
},
|
|
2490
|
+
}, jn = class extends E {
|
|
2611
2491
|
_url;
|
|
2612
2492
|
_protocols;
|
|
2613
2493
|
_ws = null;
|
|
@@ -2630,7 +2510,7 @@ var Kn = class {
|
|
|
2630
2510
|
};
|
|
2631
2511
|
this._ws.addEventListener("open", () => {
|
|
2632
2512
|
this._state.next("open"), this._pending.forEach((n) => t(n)), this._pending = [], this._emitIncomingConnection({
|
|
2633
|
-
id:
|
|
2513
|
+
id: h(),
|
|
2634
2514
|
channel: this._channelName,
|
|
2635
2515
|
sender: "server",
|
|
2636
2516
|
transportType: "websocket",
|
|
@@ -2644,7 +2524,7 @@ var Kn = class {
|
|
|
2644
2524
|
if (e?.type === "channel-connect" || e?.type === "peer-connect" || e?.type === "join") {
|
|
2645
2525
|
const t = e.channel ?? e.room ?? this._channelName;
|
|
2646
2526
|
this._connectedChannels.has(t) || (this._connectedChannels.add(t), this._emitIncomingConnection({
|
|
2647
|
-
id: e.id ??
|
|
2527
|
+
id: e.id ?? h(),
|
|
2648
2528
|
channel: t,
|
|
2649
2529
|
sender: e.sender ?? e.peerId ?? "remote",
|
|
2650
2530
|
transportType: "websocket",
|
|
@@ -2656,7 +2536,7 @@ var Kn = class {
|
|
|
2656
2536
|
}
|
|
2657
2537
|
joinChannel(e) {
|
|
2658
2538
|
this.send({
|
|
2659
|
-
id:
|
|
2539
|
+
id: h(),
|
|
2660
2540
|
type: "join",
|
|
2661
2541
|
channel: e,
|
|
2662
2542
|
sender: this._channelName,
|
|
@@ -2665,7 +2545,7 @@ var Kn = class {
|
|
|
2665
2545
|
}
|
|
2666
2546
|
leaveChannel(e) {
|
|
2667
2547
|
this._connectedChannels.delete(e), this.send({
|
|
2668
|
-
id:
|
|
2548
|
+
id: h(),
|
|
2669
2549
|
type: "leave",
|
|
2670
2550
|
channel: e,
|
|
2671
2551
|
sender: this._channelName,
|
|
@@ -2684,20 +2564,20 @@ var Kn = class {
|
|
|
2684
2564
|
get state() {
|
|
2685
2565
|
return this._state;
|
|
2686
2566
|
}
|
|
2687
|
-
},
|
|
2567
|
+
}, zn = class extends E {
|
|
2688
2568
|
_cleanup = null;
|
|
2689
2569
|
constructor(e, t = {}) {
|
|
2690
2570
|
super(e, "chrome-runtime", t);
|
|
2691
2571
|
}
|
|
2692
2572
|
attach() {
|
|
2693
2573
|
if (this._isAttached || typeof chrome > "u" || !chrome.runtime) return;
|
|
2694
|
-
const e =
|
|
2574
|
+
const e = g("chrome-runtime");
|
|
2695
2575
|
this._cleanup = m("chrome-runtime", (t) => this._inbound.next(t), void 0), this._subscriptions.push(this._outbound.subscribe((t) => e(t))), this._isAttached = !0;
|
|
2696
2576
|
}
|
|
2697
2577
|
detach() {
|
|
2698
2578
|
this._cleanup?.(), super.detach();
|
|
2699
2579
|
}
|
|
2700
|
-
},
|
|
2580
|
+
}, Hn = class extends E {
|
|
2701
2581
|
_tabId;
|
|
2702
2582
|
_cleanup = null;
|
|
2703
2583
|
constructor(e, t, n = {}) {
|
|
@@ -2719,7 +2599,7 @@ var Kn = class {
|
|
|
2719
2599
|
setTabId(e) {
|
|
2720
2600
|
this._tabId = e;
|
|
2721
2601
|
}
|
|
2722
|
-
},
|
|
2602
|
+
}, Gn = class extends E {
|
|
2723
2603
|
_portName;
|
|
2724
2604
|
_tabId;
|
|
2725
2605
|
_cleanup = null;
|
|
@@ -2746,7 +2626,7 @@ var Kn = class {
|
|
|
2746
2626
|
detach() {
|
|
2747
2627
|
this._cleanup?.(), super.detach();
|
|
2748
2628
|
}
|
|
2749
|
-
},
|
|
2629
|
+
}, Qn = class extends E {
|
|
2750
2630
|
_externalId;
|
|
2751
2631
|
_cleanup = null;
|
|
2752
2632
|
constructor(e, t, n = {}) {
|
|
@@ -2760,7 +2640,7 @@ var Kn = class {
|
|
|
2760
2640
|
detach() {
|
|
2761
2641
|
this._cleanup?.(), super.detach();
|
|
2762
2642
|
}
|
|
2763
|
-
},
|
|
2643
|
+
}, Vn = class extends E {
|
|
2764
2644
|
_isHost;
|
|
2765
2645
|
_cleanup = null;
|
|
2766
2646
|
constructor(e, t = !1, n = {}) {
|
|
@@ -2768,25 +2648,25 @@ var Kn = class {
|
|
|
2768
2648
|
}
|
|
2769
2649
|
attach() {
|
|
2770
2650
|
if (this._isAttached) return;
|
|
2771
|
-
const e = this._isHost ? "service-worker-host" : "service-worker-client", t =
|
|
2651
|
+
const e = this._isHost ? "service-worker-host" : "service-worker-client", t = g(e);
|
|
2772
2652
|
this._cleanup = m(e, (n) => this._inbound.next(n)), this._subscriptions.push(this._outbound.subscribe((n) => t(n, n.transferable))), this._isAttached = !0;
|
|
2773
2653
|
}
|
|
2774
2654
|
detach() {
|
|
2775
2655
|
this._cleanup?.(), super.detach();
|
|
2776
2656
|
}
|
|
2777
|
-
},
|
|
2657
|
+
}, Kn = class extends E {
|
|
2778
2658
|
_cleanup = null;
|
|
2779
2659
|
constructor(e, t = {}) {
|
|
2780
2660
|
super(e, "self", t);
|
|
2781
2661
|
}
|
|
2782
2662
|
attach() {
|
|
2783
2663
|
if (this._isAttached) return;
|
|
2784
|
-
const e =
|
|
2664
|
+
const e = g("self");
|
|
2785
2665
|
this._cleanup = m("self", (t) => this._handleIncoming(t)), this._subscriptions.push(this._outbound.subscribe((t) => e(t, t.transferable))), this._isAttached = !0;
|
|
2786
2666
|
}
|
|
2787
2667
|
_handleIncoming(e) {
|
|
2788
2668
|
(e?.type === "createChannel" || e?.type === "connectChannel") && this._emitIncomingConnection({
|
|
2789
|
-
id: e.reqId ??
|
|
2669
|
+
id: e.reqId ?? h(),
|
|
2790
2670
|
channel: e.channel,
|
|
2791
2671
|
sender: e.sender ?? "unknown",
|
|
2792
2672
|
transportType: "self",
|
|
@@ -2807,19 +2687,19 @@ var Kn = class {
|
|
|
2807
2687
|
detach() {
|
|
2808
2688
|
this._cleanup?.(), super.detach();
|
|
2809
2689
|
}
|
|
2810
|
-
},
|
|
2811
|
-
worker: (e, t, n) => new
|
|
2812
|
-
messagePort: (e, t, n) => new
|
|
2813
|
-
broadcast: (e, t, n) => new
|
|
2814
|
-
websocket: (e, t, n, s) => new
|
|
2815
|
-
chromeRuntime: (e, t) => new
|
|
2816
|
-
chromeTabs: (e, t, n) => new
|
|
2817
|
-
chromePort: (e, t, n, s) => new
|
|
2818
|
-
chromeExternal: (e, t, n) => new
|
|
2819
|
-
serviceWorker: (e, t, n) => new
|
|
2820
|
-
self: (e, t) => new
|
|
2690
|
+
}, Or = {
|
|
2691
|
+
worker: (e, t, n) => new $n(e, t, n),
|
|
2692
|
+
messagePort: (e, t, n) => new Fn(e, t, n),
|
|
2693
|
+
broadcast: (e, t, n) => new Un(e, t, n),
|
|
2694
|
+
websocket: (e, t, n, s) => new jn(e, t, n, s),
|
|
2695
|
+
chromeRuntime: (e, t) => new zn(e, t),
|
|
2696
|
+
chromeTabs: (e, t, n) => new Hn(e, t, n),
|
|
2697
|
+
chromePort: (e, t, n, s) => new Gn(e, t, n, s),
|
|
2698
|
+
chromeExternal: (e, t, n) => new Qn(e, t, n),
|
|
2699
|
+
serviceWorker: (e, t, n) => new Vn(e, t, n),
|
|
2700
|
+
self: (e, t) => new Kn(e, t)
|
|
2821
2701
|
};
|
|
2822
|
-
function
|
|
2702
|
+
function Dr(e) {
|
|
2823
2703
|
const t = [], n = new _({ bufferSize: 100 });
|
|
2824
2704
|
for (const s of e) s.subscribeIncoming((r) => {
|
|
2825
2705
|
t.push(r), n.next(r);
|
|
@@ -2829,13 +2709,13 @@ function jr(e) {
|
|
|
2829
2709
|
getConnections: () => [...t]
|
|
2830
2710
|
};
|
|
2831
2711
|
}
|
|
2832
|
-
var
|
|
2712
|
+
var Yn = "uniform_channels", Jn = 1, f = {
|
|
2833
2713
|
MESSAGES: "messages",
|
|
2834
2714
|
MAILBOX: "mailbox",
|
|
2835
2715
|
PENDING: "pending",
|
|
2836
2716
|
EXCHANGE: "exchange",
|
|
2837
2717
|
TRANSACTIONS: "transactions"
|
|
2838
|
-
},
|
|
2718
|
+
}, Xn = class {
|
|
2839
2719
|
_db = null;
|
|
2840
2720
|
_isOpen = !1;
|
|
2841
2721
|
_openPromise = null;
|
|
@@ -2847,7 +2727,7 @@ var as = "uniform_channels", cs = 1, f = {
|
|
|
2847
2727
|
}
|
|
2848
2728
|
async open() {
|
|
2849
2729
|
return this._db && this._isOpen ? this._db : this._openPromise ? this._openPromise : (this._openPromise = new Promise((e, t) => {
|
|
2850
|
-
const n = indexedDB.open(
|
|
2730
|
+
const n = indexedDB.open(Yn, Jn);
|
|
2851
2731
|
n.onerror = () => {
|
|
2852
2732
|
this._openPromise = null, t(/* @__PURE__ */ new Error("Failed to open IndexedDB"));
|
|
2853
2733
|
}, n.onsuccess = () => {
|
|
@@ -2882,7 +2762,7 @@ var as = "uniform_channels", cs = 1, f = {
|
|
|
2882
2762
|
}
|
|
2883
2763
|
async defer(e, t = {}) {
|
|
2884
2764
|
const n = await this.open(), s = {
|
|
2885
|
-
id:
|
|
2765
|
+
id: h(),
|
|
2886
2766
|
channel: e.channel,
|
|
2887
2767
|
sender: e.sender ?? this._channelName,
|
|
2888
2768
|
recipient: e.channel,
|
|
@@ -2990,7 +2870,7 @@ var as = "uniform_channels", cs = 1, f = {
|
|
|
2990
2870
|
}
|
|
2991
2871
|
async registerPending(e) {
|
|
2992
2872
|
const t = await this.open(), n = {
|
|
2993
|
-
id:
|
|
2873
|
+
id: h(),
|
|
2994
2874
|
channel: this._channelName,
|
|
2995
2875
|
type: e.type,
|
|
2996
2876
|
data: e.data,
|
|
@@ -3037,7 +2917,7 @@ var as = "uniform_channels", cs = 1, f = {
|
|
|
3037
2917
|
}
|
|
3038
2918
|
async exchangePut(e, t, n = {}) {
|
|
3039
2919
|
const s = await this.open(), r = {
|
|
3040
|
-
id:
|
|
2920
|
+
id: h(),
|
|
3041
2921
|
key: e,
|
|
3042
2922
|
value: t,
|
|
3043
2923
|
owner: this._channelName,
|
|
@@ -3049,8 +2929,8 @@ var as = "uniform_channels", cs = 1, f = {
|
|
|
3049
2929
|
return new Promise((i, o) => {
|
|
3050
2930
|
const a = s.transaction(f.EXCHANGE, "readwrite"), c = a.objectStore(f.EXCHANGE), l = c.index("key").get(e);
|
|
3051
2931
|
l.onsuccess = () => {
|
|
3052
|
-
const
|
|
3053
|
-
|
|
2932
|
+
const u = l.result;
|
|
2933
|
+
u && (r.id = u.id, r.version = u.version + 1, r.createdAt = u.createdAt), c.put(r);
|
|
3054
2934
|
}, a.oncomplete = () => {
|
|
3055
2935
|
this._exchangeUpdates.next(r), i(r.id);
|
|
3056
2936
|
}, a.onerror = () => o(/* @__PURE__ */ new Error("Failed to put exchange data"));
|
|
@@ -3128,7 +3008,7 @@ var as = "uniform_channels", cs = 1, f = {
|
|
|
3128
3008
|
return e.owner === this._channelName || e.sharedWith.includes("*") ? !0 : e.sharedWith.includes(this._channelName);
|
|
3129
3009
|
}
|
|
3130
3010
|
async beginTransaction() {
|
|
3131
|
-
return new
|
|
3011
|
+
return new Zn(this);
|
|
3132
3012
|
}
|
|
3133
3013
|
async executeTransaction(e) {
|
|
3134
3014
|
const t = await this.open(), n = new Set(e.map((s) => s.store));
|
|
@@ -3153,7 +3033,6 @@ var as = "uniform_channels", cs = 1, f = {
|
|
|
3153
3033
|
});
|
|
3154
3034
|
};
|
|
3155
3035
|
}
|
|
3156
|
-
break;
|
|
3157
3036
|
}
|
|
3158
3037
|
}
|
|
3159
3038
|
i.oncomplete = () => s(), i.onerror = () => r(/* @__PURE__ */ new Error("Transaction failed"));
|
|
@@ -3172,23 +3051,23 @@ var as = "uniform_channels", cs = 1, f = {
|
|
|
3172
3051
|
let a = 0;
|
|
3173
3052
|
const c = i.openCursor();
|
|
3174
3053
|
c.onsuccess = () => {
|
|
3175
|
-
const
|
|
3176
|
-
if (
|
|
3177
|
-
const p =
|
|
3178
|
-
p.expiresAt && p.expiresAt < t && (
|
|
3054
|
+
const u = c.result;
|
|
3055
|
+
if (u) {
|
|
3056
|
+
const p = u.value;
|
|
3057
|
+
p.expiresAt && p.expiresAt < t && (u.delete(), a++), u.continue();
|
|
3179
3058
|
}
|
|
3180
3059
|
};
|
|
3181
3060
|
const l = o.openCursor();
|
|
3182
3061
|
l.onsuccess = () => {
|
|
3183
|
-
const
|
|
3184
|
-
if (
|
|
3185
|
-
const p =
|
|
3186
|
-
p.expiresAt && p.expiresAt < t && (
|
|
3062
|
+
const u = l.result;
|
|
3063
|
+
if (u) {
|
|
3064
|
+
const p = u.value;
|
|
3065
|
+
p.expiresAt && p.expiresAt < t && (u.delete(), a++), u.continue();
|
|
3187
3066
|
}
|
|
3188
3067
|
}, r.oncomplete = () => n(a), r.onerror = () => s(/* @__PURE__ */ new Error("Failed to cleanup expired"));
|
|
3189
3068
|
});
|
|
3190
3069
|
}
|
|
3191
|
-
},
|
|
3070
|
+
}, Zn = class {
|
|
3192
3071
|
_storage;
|
|
3193
3072
|
_operations = [];
|
|
3194
3073
|
_isCommitted = !1;
|
|
@@ -3198,7 +3077,7 @@ var as = "uniform_channels", cs = 1, f = {
|
|
|
3198
3077
|
}
|
|
3199
3078
|
put(e, t) {
|
|
3200
3079
|
return this._checkState(), this._operations.push({
|
|
3201
|
-
id:
|
|
3080
|
+
id: h(),
|
|
3202
3081
|
type: "put",
|
|
3203
3082
|
store: e,
|
|
3204
3083
|
value: t,
|
|
@@ -3207,7 +3086,7 @@ var as = "uniform_channels", cs = 1, f = {
|
|
|
3207
3086
|
}
|
|
3208
3087
|
delete(e, t) {
|
|
3209
3088
|
return this._checkState(), this._operations.push({
|
|
3210
|
-
id:
|
|
3089
|
+
id: h(),
|
|
3211
3090
|
type: "delete",
|
|
3212
3091
|
store: e,
|
|
3213
3092
|
key: t,
|
|
@@ -3216,7 +3095,7 @@ var as = "uniform_channels", cs = 1, f = {
|
|
|
3216
3095
|
}
|
|
3217
3096
|
update(e, t, n) {
|
|
3218
3097
|
return this._checkState(), this._operations.push({
|
|
3219
|
-
id:
|
|
3098
|
+
id: h(),
|
|
3220
3099
|
type: "update",
|
|
3221
3100
|
store: e,
|
|
3222
3101
|
key: t,
|
|
@@ -3241,26 +3120,26 @@ var as = "uniform_channels", cs = 1, f = {
|
|
|
3241
3120
|
if (this._isCommitted) throw new Error("Transaction already committed");
|
|
3242
3121
|
if (this._isRolledBack) throw new Error("Transaction already rolled back");
|
|
3243
3122
|
}
|
|
3244
|
-
},
|
|
3245
|
-
function
|
|
3246
|
-
return
|
|
3123
|
+
}, J = /* @__PURE__ */ new Map();
|
|
3124
|
+
function Rt(e) {
|
|
3125
|
+
return J.has(e) || J.set(e, new Xn(e)), J.get(e);
|
|
3247
3126
|
}
|
|
3248
|
-
function
|
|
3249
|
-
for (const e of
|
|
3250
|
-
|
|
3127
|
+
function Lr() {
|
|
3128
|
+
for (const e of J.values()) e.close();
|
|
3129
|
+
J.clear();
|
|
3251
3130
|
}
|
|
3252
|
-
var
|
|
3131
|
+
var Je = Ct(), es = Je.length > 0 ? new URL("../transport/Worker.ts", Je) : "", qt = class {
|
|
3253
3132
|
_channel;
|
|
3254
3133
|
_context;
|
|
3255
3134
|
_options;
|
|
3256
3135
|
_connection;
|
|
3257
3136
|
_storage;
|
|
3258
3137
|
constructor(e, t, n = {}) {
|
|
3259
|
-
this._channel = e, this._context = t, this._options = n, this._connection =
|
|
3138
|
+
this._channel = e, this._context = t, this._options = n, this._connection = At(e), this._storage = Rt(e);
|
|
3260
3139
|
}
|
|
3261
3140
|
async request(e, t, n, s = {}) {
|
|
3262
3141
|
let r = typeof e == "string" ? [e] : e, i = t, o = n;
|
|
3263
|
-
return Array.isArray(t) &&
|
|
3142
|
+
return Array.isArray(t) && Ot(e) && (s = n, o = t, i = e, r = []), this._context.getHost()?.request(r, i, o, s, this._channel);
|
|
3264
3143
|
}
|
|
3265
3144
|
async doImportModule(e, t = {}) {
|
|
3266
3145
|
return this.request([], d.IMPORT, [e], t);
|
|
@@ -3285,7 +3164,7 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3285
3164
|
get context() {
|
|
3286
3165
|
return this._context;
|
|
3287
3166
|
}
|
|
3288
|
-
},
|
|
3167
|
+
}, A = class {
|
|
3289
3168
|
_channel;
|
|
3290
3169
|
_context;
|
|
3291
3170
|
_options;
|
|
@@ -3301,14 +3180,14 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3301
3180
|
return this._unified.__getPrivate("_transports");
|
|
3302
3181
|
}
|
|
3303
3182
|
constructor(e, t, n = {}) {
|
|
3304
|
-
this._channel = e, this._context = t, this._options = n, this._connection =
|
|
3183
|
+
this._channel = e, this._context = t, this._options = n, this._connection = Le().getOrCreate(e, "internal", n), this._unified = new yt({
|
|
3305
3184
|
name: e,
|
|
3306
3185
|
autoListen: !1,
|
|
3307
3186
|
timeout: n?.timeout
|
|
3308
3187
|
});
|
|
3309
3188
|
}
|
|
3310
3189
|
createRemoteChannel(e, t = {}, n) {
|
|
3311
|
-
const s =
|
|
3190
|
+
const s = ts(n ?? this._context.$createOrUseExistingRemote(e, t, n ?? null)?.messageChannel?.port1), r = Lt(s?.target ?? s);
|
|
3312
3191
|
return this._unified.listen(s?.target, { targetChannel: e }), s && (this._broadcasts?.set?.(e, s), r === "self" && typeof postMessage > "u" || this._unified.connect(s, { targetChannel: e }), this._context.$registerConnection({
|
|
3313
3192
|
localChannel: this._channel,
|
|
3314
3193
|
remoteChannel: e,
|
|
@@ -3318,7 +3197,7 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3318
3197
|
}), this.notifyChannel(e, {
|
|
3319
3198
|
contextId: this._context.id,
|
|
3320
3199
|
contextName: this._context.hostName
|
|
3321
|
-
}, "connect")), new
|
|
3200
|
+
}, "connect")), new qt(e, this._context, t);
|
|
3322
3201
|
}
|
|
3323
3202
|
getChannel() {
|
|
3324
3203
|
return this._channel;
|
|
@@ -3328,7 +3207,7 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3328
3207
|
}
|
|
3329
3208
|
request(e, t, n, s = {}, r = "worker") {
|
|
3330
3209
|
let i = typeof e == "string" ? [e] : e, o = n;
|
|
3331
|
-
return Array.isArray(t) &&
|
|
3210
|
+
return Array.isArray(t) && Ot(e) && (r = s, s = n, o = t, t = e, i = []), this._unified.invoke(r, t, i ?? [], Array.isArray(o) ? o : [o]);
|
|
3332
3211
|
}
|
|
3333
3212
|
resolveResponse(e, t) {
|
|
3334
3213
|
this._forResolves.get(e)?.resolve?.(t);
|
|
@@ -3353,9 +3232,9 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3353
3232
|
get unified() {
|
|
3354
3233
|
return this._unified;
|
|
3355
3234
|
}
|
|
3356
|
-
},
|
|
3235
|
+
}, Nt = class {
|
|
3357
3236
|
_options;
|
|
3358
|
-
_id =
|
|
3237
|
+
_id = h();
|
|
3359
3238
|
_hostName;
|
|
3360
3239
|
_host = null;
|
|
3361
3240
|
_endpoints = /* @__PURE__ */ new Map();
|
|
@@ -3364,7 +3243,7 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3364
3243
|
_remoteChannels = /* @__PURE__ */ new Map();
|
|
3365
3244
|
_deferredChannels = /* @__PURE__ */ new Map();
|
|
3366
3245
|
_connectionEvents = new _({ bufferSize: 200 });
|
|
3367
|
-
_connectionRegistry = new
|
|
3246
|
+
_connectionRegistry = new bt(() => h(), (e) => this._emitConnectionEvent(e));
|
|
3368
3247
|
_closed = !1;
|
|
3369
3248
|
_globalSelf = null;
|
|
3370
3249
|
constructor(e = {}) {
|
|
@@ -3375,7 +3254,7 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3375
3254
|
const t = e ?? this._hostName;
|
|
3376
3255
|
if (this._hostName = t, this._endpoints.has(t))
|
|
3377
3256
|
return this._host = this._endpoints.get(t).handler, this._host;
|
|
3378
|
-
this._host = new
|
|
3257
|
+
this._host = new A(t, this, this._options.defaultOptions);
|
|
3379
3258
|
const n = {
|
|
3380
3259
|
name: t,
|
|
3381
3260
|
handler: this._host,
|
|
@@ -3425,7 +3304,7 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3425
3304
|
}
|
|
3426
3305
|
createChannel(e, t = {}) {
|
|
3427
3306
|
if (this._endpoints.has(e)) return this._endpoints.get(e);
|
|
3428
|
-
const n = new
|
|
3307
|
+
const n = new A(e, this, {
|
|
3429
3308
|
...this._options.defaultOptions,
|
|
3430
3309
|
...t
|
|
3431
3310
|
}), s = {
|
|
@@ -3474,9 +3353,9 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3474
3353
|
return this._endpoints.has(e) ? this._endpoints.get(e) : this._deferredChannels.has(e) ? this.initDeferred(e) : null;
|
|
3475
3354
|
}
|
|
3476
3355
|
async addWorker(e, t, n = {}) {
|
|
3477
|
-
const s =
|
|
3356
|
+
const s = Xe(t);
|
|
3478
3357
|
if (!s) throw new Error(`Failed to create worker for channel: ${e}`);
|
|
3479
|
-
const r = new
|
|
3358
|
+
const r = new A(e, this, {
|
|
3480
3359
|
...this._options.defaultOptions,
|
|
3481
3360
|
...n
|
|
3482
3361
|
}), i = r.createRemoteChannel(e, n, s), o = {
|
|
@@ -3497,7 +3376,7 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3497
3376
|
}), o;
|
|
3498
3377
|
}
|
|
3499
3378
|
async addPort(e, t, n = {}) {
|
|
3500
|
-
const s = new
|
|
3379
|
+
const s = new A(e, this, {
|
|
3501
3380
|
...this._options.defaultOptions,
|
|
3502
3381
|
...n
|
|
3503
3382
|
});
|
|
@@ -3520,7 +3399,7 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3520
3399
|
}), i;
|
|
3521
3400
|
}
|
|
3522
3401
|
async addBroadcast(e, t, n = {}) {
|
|
3523
|
-
const s = new BroadcastChannel(t ?? e), r = new
|
|
3402
|
+
const s = new BroadcastChannel(t ?? e), r = new A(e, this, {
|
|
3524
3403
|
...this._options.defaultOptions,
|
|
3525
3404
|
...n
|
|
3526
3405
|
}), i = r.createRemoteChannel(e, n, s), o = {
|
|
@@ -3541,7 +3420,7 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3541
3420
|
}), o;
|
|
3542
3421
|
}
|
|
3543
3422
|
addSelfChannel(e, t = {}) {
|
|
3544
|
-
const n = new
|
|
3423
|
+
const n = new A(e, this, {
|
|
3545
3424
|
...this._options.defaultOptions,
|
|
3546
3425
|
...t
|
|
3547
3426
|
}), s = this._globalSelf ?? (typeof self < "u" ? self : null), r = {
|
|
@@ -3574,10 +3453,10 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3574
3453
|
}
|
|
3575
3454
|
}
|
|
3576
3455
|
createChannelPair(e, t, n = {}) {
|
|
3577
|
-
const s = new MessageChannel(), r = new
|
|
3456
|
+
const s = new MessageChannel(), r = new A(e, this, {
|
|
3578
3457
|
...this._options.defaultOptions,
|
|
3579
3458
|
...n
|
|
3580
|
-
}), i = new
|
|
3459
|
+
}), i = new A(t, this, {
|
|
3581
3460
|
...this._options.defaultOptions,
|
|
3582
3461
|
...n
|
|
3583
3462
|
});
|
|
@@ -3617,10 +3496,10 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3617
3496
|
$createOrUseExistingRemote(e, t = {}, n) {
|
|
3618
3497
|
if (e == null || n) return null;
|
|
3619
3498
|
if (this._remoteChannels.has(e)) return this._remoteChannels.get(e);
|
|
3620
|
-
const s = new MessageChannel(), r =
|
|
3621
|
-
const a =
|
|
3499
|
+
const s = new MessageChannel(), r = rn(new Promise((o) => {
|
|
3500
|
+
const a = Xe(es);
|
|
3622
3501
|
a?.addEventListener?.("message", (c) => {
|
|
3623
|
-
c.data.type === "channelCreated" && (s.port1?.start?.(), o(new
|
|
3502
|
+
c.data.type === "channelCreated" && (s.port1?.start?.(), o(new qt(c.data.channel, this, t)));
|
|
3624
3503
|
}), a?.postMessage?.({
|
|
3625
3504
|
type: "createChannel",
|
|
3626
3505
|
channel: e,
|
|
@@ -3705,13 +3584,13 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3705
3584
|
});
|
|
3706
3585
|
}
|
|
3707
3586
|
};
|
|
3708
|
-
function
|
|
3587
|
+
function Ot(e) {
|
|
3709
3588
|
return [...Object.values(d)].includes(e);
|
|
3710
3589
|
}
|
|
3711
|
-
function
|
|
3590
|
+
function ts(e) {
|
|
3712
3591
|
if (!e) return null;
|
|
3713
|
-
if (
|
|
3714
|
-
const t = e, n =
|
|
3592
|
+
if (Dt(e)) return e;
|
|
3593
|
+
const t = e, n = Lt(t);
|
|
3715
3594
|
return {
|
|
3716
3595
|
target: t,
|
|
3717
3596
|
targetChannel: "unknown",
|
|
@@ -3732,14 +3611,14 @@ function ds(e) {
|
|
|
3732
3611
|
close: t.close?.bind(t)
|
|
3733
3612
|
};
|
|
3734
3613
|
}
|
|
3735
|
-
function
|
|
3614
|
+
function Dt(e) {
|
|
3736
3615
|
return !!e && typeof e == "object" && "target" in e && typeof e.postMessage == "function";
|
|
3737
3616
|
}
|
|
3738
|
-
function
|
|
3739
|
-
const t =
|
|
3617
|
+
function Lt(e) {
|
|
3618
|
+
const t = Dt(e) ? e.target : e;
|
|
3740
3619
|
return t ? t === "chrome-runtime" ? "chrome-runtime" : t === "chrome-tabs" ? "chrome-tabs" : t === "chrome-port" ? "chrome-port" : t === "chrome-external" ? "chrome-external" : typeof MessagePort < "u" && t instanceof MessagePort ? "message-port" : typeof BroadcastChannel < "u" && t instanceof BroadcastChannel ? "broadcast" : typeof Worker < "u" && t instanceof Worker ? "worker" : typeof WebSocket < "u" && t instanceof WebSocket ? "websocket" : typeof chrome < "u" && typeof t == "object" && t && typeof t.postMessage == "function" && t.onMessage?.addListener ? "chrome-port" : typeof self < "u" && t === self ? "self" : "internal" : "internal";
|
|
3741
3620
|
}
|
|
3742
|
-
function
|
|
3621
|
+
function Xe(e) {
|
|
3743
3622
|
if (e instanceof Worker) return e;
|
|
3744
3623
|
if (e instanceof URL) return new Worker(e.href, { type: "module" });
|
|
3745
3624
|
if (typeof e == "function") try {
|
|
@@ -3747,44 +3626,44 @@ function rt(e) {
|
|
|
3747
3626
|
} catch {
|
|
3748
3627
|
return e({ type: "module" });
|
|
3749
3628
|
}
|
|
3750
|
-
return typeof e == "string" ? e.startsWith("/") ? new Worker(
|
|
3629
|
+
return typeof e == "string" ? e.startsWith("/") ? new Worker(P(e.replace(/^\//, "./")), { type: "module" }) : URL.canParse(e) || e.startsWith("./") ? new Worker(P(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);
|
|
3751
3630
|
}
|
|
3752
|
-
var
|
|
3753
|
-
function
|
|
3754
|
-
return
|
|
3631
|
+
var q = /* @__PURE__ */ new Map(), oe = null;
|
|
3632
|
+
function N() {
|
|
3633
|
+
return oe || (oe = new Nt({
|
|
3755
3634
|
name: "$default$",
|
|
3756
3635
|
useGlobalSelf: !0
|
|
3757
|
-
}),
|
|
3636
|
+
}), q.set("$default$", oe)), oe;
|
|
3758
3637
|
}
|
|
3759
|
-
function
|
|
3760
|
-
const t = new
|
|
3761
|
-
return e.name &&
|
|
3638
|
+
function ne(e = {}) {
|
|
3639
|
+
const t = new Nt(e);
|
|
3640
|
+
return e.name && q.set(e.name, t), t;
|
|
3762
3641
|
}
|
|
3763
|
-
function
|
|
3764
|
-
return
|
|
3642
|
+
function ns(e, t = {}) {
|
|
3643
|
+
return q.has(e) ? q.get(e) : ne({
|
|
3765
3644
|
...t,
|
|
3766
3645
|
name: e
|
|
3767
3646
|
});
|
|
3768
3647
|
}
|
|
3769
|
-
function
|
|
3770
|
-
return
|
|
3648
|
+
function Br(e) {
|
|
3649
|
+
return q.get(e);
|
|
3771
3650
|
}
|
|
3772
|
-
function
|
|
3773
|
-
const t =
|
|
3774
|
-
return t ? (t.close(),
|
|
3651
|
+
function Wr(e) {
|
|
3652
|
+
const t = q.get(e);
|
|
3653
|
+
return t ? (t.close(), q.delete(e)) : !1;
|
|
3775
3654
|
}
|
|
3776
|
-
function
|
|
3777
|
-
return [
|
|
3655
|
+
function $r() {
|
|
3656
|
+
return [...q.keys()];
|
|
3778
3657
|
}
|
|
3779
|
-
function
|
|
3780
|
-
const n =
|
|
3658
|
+
function ss(e, t = {}) {
|
|
3659
|
+
const n = ne(t);
|
|
3781
3660
|
return {
|
|
3782
3661
|
context: n,
|
|
3783
3662
|
channels: n.createChannels(e)
|
|
3784
3663
|
};
|
|
3785
3664
|
}
|
|
3786
|
-
async function
|
|
3787
|
-
const s =
|
|
3665
|
+
async function rs(e, t, n = {}) {
|
|
3666
|
+
const s = ne(n.contextOptions);
|
|
3788
3667
|
return {
|
|
3789
3668
|
context: s,
|
|
3790
3669
|
module: await s.importModuleInChannel(e, t, {
|
|
@@ -3793,31 +3672,31 @@ async function _s(e, t, n = {}) {
|
|
|
3793
3672
|
})
|
|
3794
3673
|
};
|
|
3795
3674
|
}
|
|
3796
|
-
async function
|
|
3797
|
-
return
|
|
3675
|
+
async function Fr(e, t, n = {}) {
|
|
3676
|
+
return N().addWorker(e, t, n);
|
|
3798
3677
|
}
|
|
3799
|
-
async function
|
|
3800
|
-
return
|
|
3678
|
+
async function Ur(e, t, n = {}) {
|
|
3679
|
+
return N().addPort(e, t, n);
|
|
3801
3680
|
}
|
|
3802
|
-
async function
|
|
3803
|
-
return
|
|
3681
|
+
async function jr(e, t, n = {}) {
|
|
3682
|
+
return N().addBroadcast(e, t, n);
|
|
3804
3683
|
}
|
|
3805
|
-
function
|
|
3806
|
-
return
|
|
3684
|
+
function zr(e, t = {}) {
|
|
3685
|
+
return N().addSelfChannel(e, t);
|
|
3807
3686
|
}
|
|
3808
|
-
function
|
|
3809
|
-
|
|
3687
|
+
function Hr(e, t) {
|
|
3688
|
+
N().defer(e, t);
|
|
3810
3689
|
}
|
|
3811
|
-
async function
|
|
3812
|
-
return
|
|
3690
|
+
async function Gr(e) {
|
|
3691
|
+
return N().initDeferred(e);
|
|
3813
3692
|
}
|
|
3814
|
-
async function
|
|
3815
|
-
return
|
|
3693
|
+
async function Qr(e) {
|
|
3694
|
+
return N().getChannelAsync(e);
|
|
3816
3695
|
}
|
|
3817
|
-
function
|
|
3818
|
-
return
|
|
3696
|
+
function Vr(e, t, n = {}) {
|
|
3697
|
+
return N().createChannelPair(e, t, n);
|
|
3819
3698
|
}
|
|
3820
|
-
var
|
|
3699
|
+
var I = class {
|
|
3821
3700
|
_subs = /* @__PURE__ */ new Set();
|
|
3822
3701
|
_listening = !1;
|
|
3823
3702
|
_cleanup = null;
|
|
@@ -3856,11 +3735,11 @@ var P = class {
|
|
|
3856
3735
|
get isListening() {
|
|
3857
3736
|
return this._listening;
|
|
3858
3737
|
}
|
|
3859
|
-
},
|
|
3738
|
+
}, Ze = class extends I {
|
|
3860
3739
|
_worker;
|
|
3861
3740
|
_send;
|
|
3862
3741
|
constructor(e) {
|
|
3863
|
-
super(), this._worker = e, this._send =
|
|
3742
|
+
super(), this._worker = e, this._send = g(this._worker);
|
|
3864
3743
|
}
|
|
3865
3744
|
next(e, t) {
|
|
3866
3745
|
this._send(e, t);
|
|
@@ -3874,11 +3753,11 @@ var P = class {
|
|
|
3874
3753
|
get worker() {
|
|
3875
3754
|
return this._worker;
|
|
3876
3755
|
}
|
|
3877
|
-
},
|
|
3756
|
+
}, Ce = class extends I {
|
|
3878
3757
|
_port;
|
|
3879
3758
|
_send;
|
|
3880
3759
|
constructor(e) {
|
|
3881
|
-
super(), this._port = e, this._send =
|
|
3760
|
+
super(), this._port = e, this._send = g(this._port);
|
|
3882
3761
|
}
|
|
3883
3762
|
next(e, t) {
|
|
3884
3763
|
this._send(e, t);
|
|
@@ -3889,12 +3768,12 @@ var P = class {
|
|
|
3889
3768
|
get port() {
|
|
3890
3769
|
return this._port;
|
|
3891
3770
|
}
|
|
3892
|
-
},
|
|
3771
|
+
}, is = class extends I {
|
|
3893
3772
|
_name;
|
|
3894
3773
|
_channel;
|
|
3895
3774
|
_send;
|
|
3896
3775
|
constructor(e) {
|
|
3897
|
-
super(), this._name = e, this._channel = new BroadcastChannel(e), this._send =
|
|
3776
|
+
super(), this._name = e, this._channel = new BroadcastChannel(e), this._send = g(this._channel);
|
|
3898
3777
|
}
|
|
3899
3778
|
next(e) {
|
|
3900
3779
|
this._send(e);
|
|
@@ -3907,7 +3786,7 @@ var P = class {
|
|
|
3907
3786
|
close() {
|
|
3908
3787
|
this._channel.close(), super.close();
|
|
3909
3788
|
}
|
|
3910
|
-
},
|
|
3789
|
+
}, os = class extends I {
|
|
3911
3790
|
_url;
|
|
3912
3791
|
_protocols;
|
|
3913
3792
|
_ws = null;
|
|
@@ -3945,15 +3824,15 @@ var P = class {
|
|
|
3945
3824
|
get isOpen() {
|
|
3946
3825
|
return this._ws?.readyState === WebSocket.OPEN;
|
|
3947
3826
|
}
|
|
3948
|
-
},
|
|
3949
|
-
_send =
|
|
3827
|
+
}, as = class extends I {
|
|
3828
|
+
_send = g("chrome-runtime");
|
|
3950
3829
|
next(e) {
|
|
3951
3830
|
this._send(e);
|
|
3952
3831
|
}
|
|
3953
3832
|
_activate() {
|
|
3954
3833
|
this._listening || (this._cleanup = m("chrome-runtime", (e) => this._dispatch(e)), this._listening = !0);
|
|
3955
3834
|
}
|
|
3956
|
-
},
|
|
3835
|
+
}, cs = class extends I {
|
|
3957
3836
|
_tabId;
|
|
3958
3837
|
constructor(e) {
|
|
3959
3838
|
super(), this._tabId = e;
|
|
@@ -3969,12 +3848,12 @@ var P = class {
|
|
|
3969
3848
|
_activate() {
|
|
3970
3849
|
this._listening || (this._cleanup = m("chrome-tabs", (e) => this._dispatch(e), void 0, void 0, { tabId: this._tabId }), this._listening = !0);
|
|
3971
3850
|
}
|
|
3972
|
-
},
|
|
3851
|
+
}, ls = class extends I {
|
|
3973
3852
|
_portName;
|
|
3974
3853
|
_tabId;
|
|
3975
3854
|
_send;
|
|
3976
3855
|
constructor(e, t) {
|
|
3977
|
-
super(), this._portName = e, this._tabId = t, this._send =
|
|
3856
|
+
super(), this._portName = e, this._tabId = t, this._send = g("chrome-port", {
|
|
3978
3857
|
portName: e,
|
|
3979
3858
|
tabId: t
|
|
3980
3859
|
});
|
|
@@ -3988,54 +3867,54 @@ var P = class {
|
|
|
3988
3867
|
tabId: this._tabId
|
|
3989
3868
|
}), this._listening = !0);
|
|
3990
3869
|
}
|
|
3991
|
-
},
|
|
3992
|
-
_send =
|
|
3870
|
+
}, hs = class extends I {
|
|
3871
|
+
_send = g("service-worker-client");
|
|
3993
3872
|
next(e, t) {
|
|
3994
3873
|
this._send(e, t);
|
|
3995
3874
|
}
|
|
3996
3875
|
_activate() {
|
|
3997
3876
|
this._listening || (this._cleanup = m("service-worker-client", (e) => this._dispatch(e)), this._listening = !0);
|
|
3998
3877
|
}
|
|
3999
|
-
},
|
|
4000
|
-
_send =
|
|
3878
|
+
}, us = class extends I {
|
|
3879
|
+
_send = g("service-worker-host");
|
|
4001
3880
|
next(e, t) {
|
|
4002
3881
|
this._send(e, t);
|
|
4003
3882
|
}
|
|
4004
3883
|
_activate() {
|
|
4005
3884
|
this._listening || (this._cleanup = m("service-worker-host", (e) => this._dispatch(e)), this._listening = !0);
|
|
4006
3885
|
}
|
|
4007
|
-
},
|
|
4008
|
-
_send =
|
|
3886
|
+
}, ds = class extends I {
|
|
3887
|
+
_send = g("self");
|
|
4009
3888
|
next(e, t) {
|
|
4010
3889
|
this._send(e, t);
|
|
4011
3890
|
}
|
|
4012
3891
|
_activate() {
|
|
4013
3892
|
this._listening || (this._cleanup = m("self", (e) => this._dispatch(e)), this._listening = !0);
|
|
4014
3893
|
}
|
|
4015
|
-
},
|
|
4016
|
-
worker: (e) => new
|
|
4017
|
-
workerFromUrl: (e, t) => new
|
|
3894
|
+
}, Kr = {
|
|
3895
|
+
worker: (e) => new Ze(e),
|
|
3896
|
+
workerFromUrl: (e, t) => new Ze(new Worker(typeof e == "string" ? e : e.href, {
|
|
4018
3897
|
type: "module",
|
|
4019
3898
|
...t
|
|
4020
3899
|
})),
|
|
4021
|
-
messagePort: (e) => new
|
|
3900
|
+
messagePort: (e) => new Ce(e),
|
|
4022
3901
|
messageChannel: () => {
|
|
4023
3902
|
const e = new MessageChannel();
|
|
4024
3903
|
return {
|
|
4025
|
-
port1: new
|
|
4026
|
-
port2: new
|
|
3904
|
+
port1: new Ce(e.port1),
|
|
3905
|
+
port2: new Ce(e.port2)
|
|
4027
3906
|
};
|
|
4028
3907
|
},
|
|
4029
|
-
broadcast: (e) => new
|
|
4030
|
-
websocket: (e, t) => new
|
|
4031
|
-
chromeRuntime: () => new
|
|
4032
|
-
chromeTabs: (e) => new
|
|
4033
|
-
chromePort: (e, t) => new
|
|
4034
|
-
serviceWorkerClient: () => new
|
|
4035
|
-
serviceWorkerHost: () => new
|
|
4036
|
-
self: () => new
|
|
3908
|
+
broadcast: (e) => new is(e),
|
|
3909
|
+
websocket: (e, t) => new os(e, t),
|
|
3910
|
+
chromeRuntime: () => new as(),
|
|
3911
|
+
chromeTabs: (e) => new cs(e),
|
|
3912
|
+
chromePort: (e, t) => new ls(e, t),
|
|
3913
|
+
serviceWorkerClient: () => new hs(),
|
|
3914
|
+
serviceWorkerHost: () => new us(),
|
|
3915
|
+
self: () => new ds()
|
|
4037
3916
|
};
|
|
4038
|
-
function
|
|
3917
|
+
function Yr(e, t) {
|
|
4039
3918
|
return {
|
|
4040
3919
|
send: (n, s) => e.next(n, s),
|
|
4041
3920
|
subscribe: (n) => t.subscribe({ next: n }),
|
|
@@ -4044,7 +3923,7 @@ function oi(e, t) {
|
|
|
4044
3923
|
}
|
|
4045
3924
|
};
|
|
4046
3925
|
}
|
|
4047
|
-
var
|
|
3926
|
+
var Bt = class {
|
|
4048
3927
|
_context;
|
|
4049
3928
|
_config;
|
|
4050
3929
|
_subscriptions = [];
|
|
@@ -4054,7 +3933,7 @@ var Gt = class {
|
|
|
4054
3933
|
constructor(e = {}) {
|
|
4055
3934
|
this._config = {
|
|
4056
3935
|
name: e.name ?? "worker",
|
|
4057
|
-
workerName: e.workerName ?? `worker-${
|
|
3936
|
+
workerName: e.workerName ?? `worker-${h().slice(0, 8)}`,
|
|
4058
3937
|
autoAcceptChannels: e.autoAcceptChannels ?? !0,
|
|
4059
3938
|
allowedChannels: e.allowedChannels ?? [],
|
|
4060
3939
|
maxChannels: e.maxChannels ?? 100,
|
|
@@ -4063,7 +3942,7 @@ var Gt = class {
|
|
|
4063
3942
|
defaultOptions: e.defaultOptions ?? {},
|
|
4064
3943
|
isolatedStorage: e.isolatedStorage ?? !1,
|
|
4065
3944
|
...e
|
|
4066
|
-
}, this._context =
|
|
3945
|
+
}, this._context = ne({
|
|
4067
3946
|
name: this._config.name,
|
|
4068
3947
|
useGlobalSelf: !0,
|
|
4069
3948
|
defaultOptions: e.defaultOptions
|
|
@@ -4162,7 +4041,7 @@ var Gt = class {
|
|
|
4162
4041
|
}
|
|
4163
4042
|
_handleCreateChannel(e) {
|
|
4164
4043
|
const t = {
|
|
4165
|
-
id: e.reqId ??
|
|
4044
|
+
id: e.reqId ?? h(),
|
|
4166
4045
|
channel: e.channel,
|
|
4167
4046
|
sender: e.sender ?? "unknown",
|
|
4168
4047
|
type: "channel",
|
|
@@ -4174,7 +4053,7 @@ var Gt = class {
|
|
|
4174
4053
|
}
|
|
4175
4054
|
_handleConnectChannel(e) {
|
|
4176
4055
|
const t = {
|
|
4177
|
-
id: e.reqId ??
|
|
4056
|
+
id: e.reqId ?? h(),
|
|
4178
4057
|
channel: e.channel,
|
|
4179
4058
|
sender: e.sender ?? "unknown",
|
|
4180
4059
|
type: e.portType ?? "channel",
|
|
@@ -4194,7 +4073,7 @@ var Gt = class {
|
|
|
4194
4073
|
_handleAddPort(e) {
|
|
4195
4074
|
if (!e.port || !e.channel) return;
|
|
4196
4075
|
const t = {
|
|
4197
|
-
id: e.reqId ??
|
|
4076
|
+
id: e.reqId ?? h(),
|
|
4198
4077
|
channel: e.channel,
|
|
4199
4078
|
sender: e.sender ?? "unknown",
|
|
4200
4079
|
type: "port",
|
|
@@ -4233,39 +4112,39 @@ var Gt = class {
|
|
|
4233
4112
|
close() {
|
|
4234
4113
|
this._subscriptions.forEach((e) => e.unsubscribe()), this._subscriptions = [], this._incomingConnections.complete(), this._channelCreated.complete(), this._channelClosed.complete(), this._context.close();
|
|
4235
4114
|
}
|
|
4236
|
-
},
|
|
4237
|
-
function
|
|
4238
|
-
return
|
|
4115
|
+
}, j = null;
|
|
4116
|
+
function Be(e) {
|
|
4117
|
+
return j || (j = new Bt(e)), j;
|
|
4239
4118
|
}
|
|
4240
|
-
function
|
|
4241
|
-
return
|
|
4119
|
+
function Jr(e) {
|
|
4120
|
+
return j?.close(), j = new Bt(e), j;
|
|
4242
4121
|
}
|
|
4243
|
-
function
|
|
4244
|
-
return
|
|
4122
|
+
function Xr(e) {
|
|
4123
|
+
return Be().subscribeConnections(e);
|
|
4245
4124
|
}
|
|
4246
|
-
function
|
|
4247
|
-
return
|
|
4125
|
+
function Zr(e) {
|
|
4126
|
+
return Be().subscribeChannelCreated(e);
|
|
4248
4127
|
}
|
|
4249
|
-
var
|
|
4250
|
-
function
|
|
4251
|
-
return
|
|
4128
|
+
var ae = null, ce = null;
|
|
4129
|
+
function Wt(e) {
|
|
4130
|
+
return ae || (ae = vn(e ?? "worker"), ae.listen(self)), ae;
|
|
4252
4131
|
}
|
|
4253
|
-
function
|
|
4254
|
-
return
|
|
4132
|
+
function $t(e) {
|
|
4133
|
+
return ce || (ce = qe(e ?? "worker"), ce.connect(self)), ce;
|
|
4255
4134
|
}
|
|
4256
|
-
function
|
|
4257
|
-
|
|
4135
|
+
function ei(e, t) {
|
|
4136
|
+
Wt().expose(e, t);
|
|
4258
4137
|
}
|
|
4259
|
-
function
|
|
4260
|
-
return
|
|
4138
|
+
function ti(e) {
|
|
4139
|
+
return Wt().subscribeInvocations(e);
|
|
4261
4140
|
}
|
|
4262
|
-
function
|
|
4263
|
-
return
|
|
4141
|
+
function ni(e = "host", t = []) {
|
|
4142
|
+
return $t().createProxy(e, t);
|
|
4264
4143
|
}
|
|
4265
|
-
function
|
|
4266
|
-
return
|
|
4144
|
+
function si(e, t = "host") {
|
|
4145
|
+
return $t().importModule(t, e);
|
|
4267
4146
|
}
|
|
4268
|
-
var
|
|
4147
|
+
var ri = Be({ name: "worker" }), pe = class {
|
|
4269
4148
|
_subs = /* @__PURE__ */ new Set();
|
|
4270
4149
|
_listening = !1;
|
|
4271
4150
|
_cleanup = null;
|
|
@@ -4291,7 +4170,7 @@ var pi = ze({ name: "worker" }), be = class {
|
|
|
4291
4170
|
close() {
|
|
4292
4171
|
this._subs.forEach((e) => e.complete?.()), this._subs.clear(), this._deactivate();
|
|
4293
4172
|
}
|
|
4294
|
-
},
|
|
4173
|
+
}, We = class extends pe {
|
|
4295
4174
|
_handler;
|
|
4296
4175
|
_options;
|
|
4297
4176
|
_pending = /* @__PURE__ */ new Map();
|
|
@@ -4304,7 +4183,7 @@ var pi = ze({ name: "worker" }), be = class {
|
|
|
4304
4183
|
chrome.runtime.sendMessage(i);
|
|
4305
4184
|
}
|
|
4306
4185
|
request(e) {
|
|
4307
|
-
const t = e.reqId ??
|
|
4186
|
+
const t = e.reqId ?? h();
|
|
4308
4187
|
return new Promise((n, s) => {
|
|
4309
4188
|
this._pending.set(t, {
|
|
4310
4189
|
resolve: n,
|
|
@@ -4326,7 +4205,7 @@ var pi = ze({ name: "worker" }), be = class {
|
|
|
4326
4205
|
if (this._options.filterSender && !this._options.filterSender(n) || this._options.filterMessage && !this._options.filterMessage(t)) return !1;
|
|
4327
4206
|
const r = {
|
|
4328
4207
|
...t,
|
|
4329
|
-
id: t.id ??
|
|
4208
|
+
id: t.id ?? h(),
|
|
4330
4209
|
_sender: n,
|
|
4331
4210
|
_tabId: n.tab?.id,
|
|
4332
4211
|
_frameId: n.frameId
|
|
@@ -4351,7 +4230,7 @@ var pi = ze({ name: "worker" }), be = class {
|
|
|
4351
4230
|
};
|
|
4352
4231
|
chrome.runtime.onMessage.addListener(e), this._cleanup = () => chrome.runtime.onMessage.removeListener(e), this._listening = !0;
|
|
4353
4232
|
}
|
|
4354
|
-
},
|
|
4233
|
+
}, $e = class extends pe {
|
|
4355
4234
|
_tabId;
|
|
4356
4235
|
_options;
|
|
4357
4236
|
constructor(e, t = {}) {
|
|
@@ -4371,7 +4250,7 @@ var pi = ze({ name: "worker" }), be = class {
|
|
|
4371
4250
|
if (this._tabId != null && n.tab?.id !== this._tabId || this._options.filterSender && !this._options.filterSender(n)) return;
|
|
4372
4251
|
const s = {
|
|
4373
4252
|
...t,
|
|
4374
|
-
id: t.id ??
|
|
4253
|
+
id: t.id ?? h(),
|
|
4375
4254
|
_sender: n,
|
|
4376
4255
|
_tabId: n.tab?.id,
|
|
4377
4256
|
_frameId: n.frameId
|
|
@@ -4380,7 +4259,7 @@ var pi = ze({ name: "worker" }), be = class {
|
|
|
4380
4259
|
};
|
|
4381
4260
|
chrome.runtime.onMessage.addListener(e), this._cleanup = () => chrome.runtime.onMessage.removeListener(e), this._listening = !0;
|
|
4382
4261
|
}
|
|
4383
|
-
},
|
|
4262
|
+
}, Fe = class extends pe {
|
|
4384
4263
|
_portName;
|
|
4385
4264
|
_tabId;
|
|
4386
4265
|
_port = null;
|
|
@@ -4402,7 +4281,7 @@ var pi = ze({ name: "worker" }), be = class {
|
|
|
4402
4281
|
_setupListeners() {
|
|
4403
4282
|
this._port && (this._port.onMessage.addListener((e) => this._dispatch({
|
|
4404
4283
|
...e,
|
|
4405
|
-
id: e.id ??
|
|
4284
|
+
id: e.id ?? h()
|
|
4406
4285
|
})), this._port.onDisconnect.addListener(() => {
|
|
4407
4286
|
this._subs.forEach((e) => e.complete?.()), this._port = null;
|
|
4408
4287
|
}));
|
|
@@ -4419,7 +4298,7 @@ var pi = ze({ name: "worker" }), be = class {
|
|
|
4419
4298
|
get isConnected() {
|
|
4420
4299
|
return this._port != null;
|
|
4421
4300
|
}
|
|
4422
|
-
},
|
|
4301
|
+
}, Ft = class extends pe {
|
|
4423
4302
|
_extensionId;
|
|
4424
4303
|
constructor(e) {
|
|
4425
4304
|
super(), this._extensionId = e;
|
|
@@ -4434,14 +4313,14 @@ var pi = ze({ name: "worker" }), be = class {
|
|
|
4434
4313
|
const e = (t, n) => {
|
|
4435
4314
|
this._dispatch({
|
|
4436
4315
|
...t,
|
|
4437
|
-
id: t.id ??
|
|
4316
|
+
id: t.id ?? h(),
|
|
4438
4317
|
_sender: n
|
|
4439
4318
|
});
|
|
4440
4319
|
};
|
|
4441
4320
|
chrome.runtime.onMessageExternal.addListener(e), this._cleanup = () => chrome.runtime.onMessageExternal.removeListener(e), this._listening = !0;
|
|
4442
4321
|
}
|
|
4443
4322
|
};
|
|
4444
|
-
function
|
|
4323
|
+
function ii(e, t) {
|
|
4445
4324
|
return async (n, s, r) => {
|
|
4446
4325
|
if (n.type !== "request") {
|
|
4447
4326
|
r.next(n);
|
|
@@ -4451,7 +4330,7 @@ function _i(e, t) {
|
|
|
4451
4330
|
if (i && t[i]) try {
|
|
4452
4331
|
const o = await t[i](n.payload?.args ?? [], n);
|
|
4453
4332
|
s({
|
|
4454
|
-
id:
|
|
4333
|
+
id: h(),
|
|
4455
4334
|
channel: n.sender,
|
|
4456
4335
|
sender: e,
|
|
4457
4336
|
reqId: n.reqId,
|
|
@@ -4461,7 +4340,7 @@ function _i(e, t) {
|
|
|
4461
4340
|
});
|
|
4462
4341
|
} catch (o) {
|
|
4463
4342
|
s({
|
|
4464
|
-
id:
|
|
4343
|
+
id: h(),
|
|
4465
4344
|
channel: n.sender,
|
|
4466
4345
|
sender: e,
|
|
4467
4346
|
reqId: n.reqId,
|
|
@@ -4473,12 +4352,12 @@ function _i(e, t) {
|
|
|
4473
4352
|
else r.next(n);
|
|
4474
4353
|
};
|
|
4475
4354
|
}
|
|
4476
|
-
var
|
|
4477
|
-
runtime: (e, t) => new
|
|
4478
|
-
tabs: (e, t) => new
|
|
4479
|
-
port: (e, t) => new
|
|
4480
|
-
external: (e) => new
|
|
4481
|
-
},
|
|
4355
|
+
var oi = {
|
|
4356
|
+
runtime: (e, t) => new We(e, t),
|
|
4357
|
+
tabs: (e, t) => new $e(e, t),
|
|
4358
|
+
port: (e, t) => new Fe(e, t),
|
|
4359
|
+
external: (e) => new Ft(e)
|
|
4360
|
+
}, _e = class {
|
|
4482
4361
|
_socket;
|
|
4483
4362
|
_channelName;
|
|
4484
4363
|
_options;
|
|
@@ -4500,7 +4379,7 @@ var mi = {
|
|
|
4500
4379
|
this._socket.emit(e, t);
|
|
4501
4380
|
}
|
|
4502
4381
|
request(e, t) {
|
|
4503
|
-
const n = e.reqId ??
|
|
4382
|
+
const n = e.reqId ?? h();
|
|
4504
4383
|
return new Promise((s, r) => {
|
|
4505
4384
|
this._pending.set(n, {
|
|
4506
4385
|
resolve: s,
|
|
@@ -4533,7 +4412,7 @@ var mi = {
|
|
|
4533
4412
|
const r = (i, o) => {
|
|
4534
4413
|
const a = {
|
|
4535
4414
|
...typeof i == "object" ? i : { payload: i },
|
|
4536
|
-
id: i?.id ??
|
|
4415
|
+
id: i?.id ?? h(),
|
|
4537
4416
|
event: s,
|
|
4538
4417
|
ack: o
|
|
4539
4418
|
};
|
|
@@ -4573,7 +4452,7 @@ var mi = {
|
|
|
4573
4452
|
get state() {
|
|
4574
4453
|
return this._state;
|
|
4575
4454
|
}
|
|
4576
|
-
},
|
|
4455
|
+
}, fs = class {
|
|
4577
4456
|
_parent;
|
|
4578
4457
|
_roomName;
|
|
4579
4458
|
_subs = /* @__PURE__ */ new Set();
|
|
@@ -4614,14 +4493,14 @@ var mi = {
|
|
|
4614
4493
|
return this._roomName;
|
|
4615
4494
|
}
|
|
4616
4495
|
};
|
|
4617
|
-
function
|
|
4496
|
+
function ai(e, t) {
|
|
4618
4497
|
return async (n) => {
|
|
4619
4498
|
if (n.type !== "request" || !n.ack) return;
|
|
4620
4499
|
const s = n.payload?.action;
|
|
4621
4500
|
if (s && t[s]) try {
|
|
4622
4501
|
const r = await t[s](n.payload?.args ?? [], n);
|
|
4623
4502
|
n.ack({
|
|
4624
|
-
id:
|
|
4503
|
+
id: h(),
|
|
4625
4504
|
channel: n.sender,
|
|
4626
4505
|
sender: e,
|
|
4627
4506
|
reqId: n.reqId,
|
|
@@ -4631,7 +4510,7 @@ function gi(e, t) {
|
|
|
4631
4510
|
});
|
|
4632
4511
|
} catch (r) {
|
|
4633
4512
|
n.ack({
|
|
4634
|
-
id:
|
|
4513
|
+
id: h(),
|
|
4635
4514
|
channel: n.sender,
|
|
4636
4515
|
sender: e,
|
|
4637
4516
|
reqId: n.reqId,
|
|
@@ -4642,14 +4521,14 @@ function gi(e, t) {
|
|
|
4642
4521
|
}
|
|
4643
4522
|
};
|
|
4644
4523
|
}
|
|
4645
|
-
var
|
|
4646
|
-
create: (e, t, n) => new
|
|
4647
|
-
room: (e, t) => new
|
|
4524
|
+
var ci = {
|
|
4525
|
+
create: (e, t, n) => new _e(e, t, n),
|
|
4526
|
+
room: (e, t) => new fs(e, t)
|
|
4648
4527
|
};
|
|
4649
|
-
function
|
|
4650
|
-
return new
|
|
4528
|
+
function li(e, t, n) {
|
|
4529
|
+
return new _e(e, t, n);
|
|
4651
4530
|
}
|
|
4652
|
-
var
|
|
4531
|
+
var me = class {
|
|
4653
4532
|
_scriptUrl;
|
|
4654
4533
|
_channelName;
|
|
4655
4534
|
_options;
|
|
@@ -4659,7 +4538,7 @@ var ve = class {
|
|
|
4659
4538
|
_pending = /* @__PURE__ */ new Map();
|
|
4660
4539
|
_listening = !1;
|
|
4661
4540
|
_cleanup = null;
|
|
4662
|
-
_portId =
|
|
4541
|
+
_portId = h();
|
|
4663
4542
|
_state = new _();
|
|
4664
4543
|
constructor(e, t, n = {}) {
|
|
4665
4544
|
this._scriptUrl = e, this._channelName = t, this._options = n, n.autoConnect !== !1 && this.connect();
|
|
@@ -4672,7 +4551,7 @@ var ve = class {
|
|
|
4672
4551
|
credentials: this._options.credentials,
|
|
4673
4552
|
type: this._options.type
|
|
4674
4553
|
}), this._port = this._worker.port, this._setupListeners(), this._port.start(), this._state.next("connecting"), this.send({
|
|
4675
|
-
id:
|
|
4554
|
+
id: h(),
|
|
4676
4555
|
channel: this._channelName,
|
|
4677
4556
|
sender: this._portId,
|
|
4678
4557
|
type: "signal",
|
|
@@ -4694,7 +4573,7 @@ var ve = class {
|
|
|
4694
4573
|
}, t ?? []);
|
|
4695
4574
|
}
|
|
4696
4575
|
request(e) {
|
|
4697
|
-
const t = e.reqId ??
|
|
4576
|
+
const t = e.reqId ?? h();
|
|
4698
4577
|
return new Promise((n, s) => {
|
|
4699
4578
|
const r = setTimeout(() => {
|
|
4700
4579
|
this._pending.has(t) && (this._pending.delete(t), s(/* @__PURE__ */ new Error("Request timeout")));
|
|
@@ -4759,7 +4638,7 @@ var ve = class {
|
|
|
4759
4638
|
}
|
|
4760
4639
|
disconnect() {
|
|
4761
4640
|
this.send({
|
|
4762
|
-
id:
|
|
4641
|
+
id: h(),
|
|
4763
4642
|
channel: this._channelName,
|
|
4764
4643
|
sender: this._portId,
|
|
4765
4644
|
type: "signal",
|
|
@@ -4787,7 +4666,7 @@ var ve = class {
|
|
|
4787
4666
|
get channelName() {
|
|
4788
4667
|
return this._channelName;
|
|
4789
4668
|
}
|
|
4790
|
-
},
|
|
4669
|
+
}, Ue = class {
|
|
4791
4670
|
_channelName;
|
|
4792
4671
|
_ports = /* @__PURE__ */ new Map();
|
|
4793
4672
|
_subs = /* @__PURE__ */ new Set();
|
|
@@ -4797,7 +4676,7 @@ var ve = class {
|
|
|
4797
4676
|
}
|
|
4798
4677
|
_setupGlobalHandler() {
|
|
4799
4678
|
typeof self < "u" && "onconnect" in self && (self.onconnect = (e) => {
|
|
4800
|
-
const t = e.ports[0], n =
|
|
4679
|
+
const t = e.ports[0], n = h();
|
|
4801
4680
|
this._registerPort(n, t);
|
|
4802
4681
|
}, this._state.next("ready"));
|
|
4803
4682
|
}
|
|
@@ -4816,7 +4695,7 @@ var ve = class {
|
|
|
4816
4695
|
port: t,
|
|
4817
4696
|
info: n
|
|
4818
4697
|
}), t.postMessage({
|
|
4819
|
-
id:
|
|
4698
|
+
id: h(),
|
|
4820
4699
|
channel: this._channelName,
|
|
4821
4700
|
sender: "host",
|
|
4822
4701
|
type: "signal",
|
|
@@ -4868,7 +4747,7 @@ var ve = class {
|
|
|
4868
4747
|
}
|
|
4869
4748
|
respond(e, t, n) {
|
|
4870
4749
|
!e.portId || !e.reqId || this.send(e.portId, {
|
|
4871
|
-
id:
|
|
4750
|
+
id: h(),
|
|
4872
4751
|
channel: e.sender,
|
|
4873
4752
|
sender: this._channelName,
|
|
4874
4753
|
type: "response",
|
|
@@ -4900,33 +4779,33 @@ var ve = class {
|
|
|
4900
4779
|
return this._channelName;
|
|
4901
4780
|
}
|
|
4902
4781
|
};
|
|
4903
|
-
function
|
|
4904
|
-
return new
|
|
4782
|
+
function hi(e, t, n) {
|
|
4783
|
+
return new me(e, t, n);
|
|
4905
4784
|
}
|
|
4906
|
-
function
|
|
4907
|
-
return new
|
|
4785
|
+
function ui(e) {
|
|
4786
|
+
return new Ue(e);
|
|
4908
4787
|
}
|
|
4909
|
-
var
|
|
4910
|
-
client: (e, t, n) => new
|
|
4911
|
-
host: (e) => new
|
|
4912
|
-
},
|
|
4913
|
-
async function
|
|
4914
|
-
if (
|
|
4788
|
+
var di = {
|
|
4789
|
+
client: (e, t, n) => new me(e, t, n),
|
|
4790
|
+
host: (e) => new Ue(e)
|
|
4791
|
+
}, V = null;
|
|
4792
|
+
async function Ut() {
|
|
4793
|
+
if (V) return V;
|
|
4915
4794
|
try {
|
|
4916
|
-
const e = await import("./cbor-x-
|
|
4917
|
-
|
|
4795
|
+
const e = await import("./cbor-x-CR9Hs652.js");
|
|
4796
|
+
V = {
|
|
4918
4797
|
encode: (t) => e.encode(t),
|
|
4919
4798
|
decode: (t) => e.decode(t)
|
|
4920
4799
|
};
|
|
4921
4800
|
} catch {
|
|
4922
|
-
|
|
4923
|
-
encode: (e) => new TextEncoder().encode(JSON.stringify(e,
|
|
4924
|
-
decode: (e) => JSON.parse(new TextDecoder().decode(e),
|
|
4801
|
+
V = {
|
|
4802
|
+
encode: (e) => new TextEncoder().encode(JSON.stringify(e, ps)),
|
|
4803
|
+
decode: (e) => JSON.parse(new TextDecoder().decode(e), _s)
|
|
4925
4804
|
};
|
|
4926
4805
|
}
|
|
4927
|
-
return
|
|
4806
|
+
return V;
|
|
4928
4807
|
}
|
|
4929
|
-
function
|
|
4808
|
+
function ps(e, t) {
|
|
4930
4809
|
return ArrayBuffer.isView(t) && !(t instanceof DataView) ? {
|
|
4931
4810
|
__typedArray: !0,
|
|
4932
4811
|
type: t.constructor.name,
|
|
@@ -4936,38 +4815,38 @@ function Ss(e, t) {
|
|
|
4936
4815
|
data: Array.from(new Uint8Array(t))
|
|
4937
4816
|
} : t;
|
|
4938
4817
|
}
|
|
4939
|
-
function
|
|
4818
|
+
function _s(e, t) {
|
|
4940
4819
|
if (t?.__typedArray) {
|
|
4941
4820
|
const n = globalThis[t.type];
|
|
4942
4821
|
return n ? new n(t.data) : t.data;
|
|
4943
4822
|
}
|
|
4944
4823
|
return t?.__arrayBuffer ? new Uint8Array(t.data).buffer : t;
|
|
4945
4824
|
}
|
|
4946
|
-
var
|
|
4825
|
+
var jt = 32, K = 0, xe = 4, et = 8, tt = 12, W = 16, le = 20, ke = jt, ms = 1, gs = 2, bs = 4, F = class {
|
|
4947
4826
|
_config;
|
|
4948
4827
|
_sharedBuffer;
|
|
4949
4828
|
_int32View;
|
|
4950
4829
|
_uint8View;
|
|
4951
4830
|
_maxDataSize;
|
|
4952
4831
|
constructor(e = 65536, t = {}) {
|
|
4953
|
-
this._config = t, typeof e == "number" ? this._sharedBuffer = new SharedArrayBuffer(e) : this._sharedBuffer = e, this._int32View = new Int32Array(this._sharedBuffer), this._uint8View = new Uint8Array(this._sharedBuffer), this._maxDataSize = this._config.maxMessageSize ?? this._sharedBuffer.byteLength -
|
|
4832
|
+
this._config = t, typeof e == "number" ? this._sharedBuffer = new SharedArrayBuffer(e) : this._sharedBuffer = e, this._int32View = new Int32Array(this._sharedBuffer), this._uint8View = new Uint8Array(this._sharedBuffer), this._maxDataSize = this._config.maxMessageSize ?? this._sharedBuffer.byteLength - jt;
|
|
4954
4833
|
}
|
|
4955
4834
|
async write(e, t = 0) {
|
|
4956
4835
|
if (e.byteLength > this._maxDataSize) throw new Error(`Message too large: ${e.byteLength} > ${this._maxDataSize}`);
|
|
4957
|
-
for (; Atomics.compareExchange(this._int32View,
|
|
4836
|
+
for (; Atomics.compareExchange(this._int32View, K / 4, 0, 1) !== 0; ) this._config.useAsyncWait && "waitAsync" in Atomics ? await Atomics.waitAsync(this._int32View, K / 4, 1, this._config.waitTimeout ?? 100).value : Atomics.wait(this._int32View, K / 4, 1, this._config.waitTimeout ?? 100);
|
|
4958
4837
|
try {
|
|
4959
|
-
return Atomics.store(this._int32View,
|
|
4838
|
+
return Atomics.store(this._int32View, et / 4, e.byteLength), Atomics.store(this._int32View, tt / 4, t), this._uint8View.set(e, ke), Atomics.add(this._int32View, xe / 4, 1), Atomics.store(this._int32View, W / 4, 1), Atomics.notify(this._int32View, W / 4), !0;
|
|
4960
4839
|
} finally {
|
|
4961
|
-
Atomics.store(this._int32View,
|
|
4840
|
+
Atomics.store(this._int32View, K / 4, 0), Atomics.notify(this._int32View, K / 4);
|
|
4962
4841
|
}
|
|
4963
4842
|
}
|
|
4964
4843
|
async read() {
|
|
4965
|
-
if (Atomics.load(this._int32View,
|
|
4844
|
+
if (Atomics.load(this._int32View, W / 4) === 0 && (this._config.useAsyncWait && "waitAsync" in Atomics ? await Atomics.waitAsync(this._int32View, W / 4, 0, this._config.waitTimeout ?? 1e3).value : Atomics.wait(this._int32View, W / 4, 0, this._config.waitTimeout ?? 1e3)) === "timed-out")
|
|
4966
4845
|
return null;
|
|
4967
|
-
const e = Atomics.load(this._int32View,
|
|
4846
|
+
const e = Atomics.load(this._int32View, et / 4), t = Atomics.load(this._int32View, tt / 4), n = Atomics.load(this._int32View, xe / 4);
|
|
4968
4847
|
if (e <= 0 || e > this._maxDataSize) return null;
|
|
4969
4848
|
const s = new Uint8Array(e);
|
|
4970
|
-
return s.set(this._uint8View.subarray(
|
|
4849
|
+
return s.set(this._uint8View.subarray(ke, ke + e)), Atomics.store(this._int32View, W / 4, 0), Atomics.add(this._int32View, le / 4, 1), Atomics.notify(this._int32View, le / 4), {
|
|
4971
4850
|
data: s,
|
|
4972
4851
|
flags: t,
|
|
4973
4852
|
seq: n
|
|
@@ -4976,9 +4855,9 @@ var Yt = 32, te = 0, Te = 4, ot = 8, at = 12, G = 16, _e = 20, Pe = Yt, Is = 1,
|
|
|
4976
4855
|
async waitAck(e) {
|
|
4977
4856
|
const t = this._config.waitTimeout ?? 5e3, n = Date.now();
|
|
4978
4857
|
for (; Date.now() - n < t; ) {
|
|
4979
|
-
const s = Atomics.load(this._int32View,
|
|
4858
|
+
const s = Atomics.load(this._int32View, le / 4);
|
|
4980
4859
|
if (s >= e) return !0;
|
|
4981
|
-
this._config.useAsyncWait && "waitAsync" in Atomics ? await Atomics.waitAsync(this._int32View,
|
|
4860
|
+
this._config.useAsyncWait && "waitAsync" in Atomics ? await Atomics.waitAsync(this._int32View, le / 4, s, 100).value : await new Promise((r) => setTimeout(r, 10));
|
|
4982
4861
|
}
|
|
4983
4862
|
return !1;
|
|
4984
4863
|
}
|
|
@@ -4986,9 +4865,9 @@ var Yt = 32, te = 0, Te = 4, ot = 8, at = 12, G = 16, _e = 20, Pe = Yt, Is = 1,
|
|
|
4986
4865
|
return this._sharedBuffer;
|
|
4987
4866
|
}
|
|
4988
4867
|
get currentSeq() {
|
|
4989
|
-
return Atomics.load(this._int32View,
|
|
4868
|
+
return Atomics.load(this._int32View, xe / 4);
|
|
4990
4869
|
}
|
|
4991
|
-
},
|
|
4870
|
+
}, se = class {
|
|
4992
4871
|
_channelName;
|
|
4993
4872
|
_config;
|
|
4994
4873
|
_sendBuffer;
|
|
@@ -4998,29 +4877,29 @@ var Yt = 32, te = 0, Te = 4, ot = 8, at = 12, G = 16, _e = 20, Pe = Yt, Is = 1,
|
|
|
4998
4877
|
_pending = /* @__PURE__ */ new Map();
|
|
4999
4878
|
_polling = !1;
|
|
5000
4879
|
_pollAbort = null;
|
|
5001
|
-
_workerId =
|
|
4880
|
+
_workerId = h();
|
|
5002
4881
|
_lastSeq = 0;
|
|
5003
4882
|
_state = new _();
|
|
5004
4883
|
constructor(e, t, n, s = {}) {
|
|
5005
|
-
this._channelName = e, this._config = s, this._sendBuffer = t instanceof
|
|
4884
|
+
this._channelName = e, this._config = s, this._sendBuffer = t instanceof F ? t : new F(t, s), this._recvBuffer = n instanceof F ? n : new F(n, s), this._init();
|
|
5006
4885
|
}
|
|
5007
4886
|
async _init() {
|
|
5008
|
-
this._encoder = await
|
|
4887
|
+
this._encoder = await Ut(), this._state.next("ready");
|
|
5009
4888
|
}
|
|
5010
4889
|
async send(e, t) {
|
|
5011
4890
|
this._encoder || await this._init();
|
|
5012
4891
|
const { transferable: n, ...s } = e;
|
|
5013
4892
|
let r = 0;
|
|
5014
|
-
t?.length && (r |=
|
|
4893
|
+
t?.length && (r |= ms, s._transferMeta = t.map((o, a) => ({
|
|
5015
4894
|
index: a,
|
|
5016
4895
|
type: o.constructor.name,
|
|
5017
4896
|
transferred: o instanceof ArrayBuffer && "transfer" in o
|
|
5018
4897
|
})));
|
|
5019
4898
|
const i = this._encoder.encode(s);
|
|
5020
|
-
this._config.compression && i.length > 1024 && (r |=
|
|
4899
|
+
this._config.compression && i.length > 1024 && (r |= gs), await this._sendBuffer.write(i, r);
|
|
5021
4900
|
}
|
|
5022
4901
|
async request(e) {
|
|
5023
|
-
const t = e.reqId ??
|
|
4902
|
+
const t = e.reqId ?? h();
|
|
5024
4903
|
return new Promise((n, s) => {
|
|
5025
4904
|
const r = setTimeout(() => {
|
|
5026
4905
|
this._pending.delete(t), s(/* @__PURE__ */ new Error("Request timeout"));
|
|
@@ -5056,7 +4935,7 @@ var Yt = 32, te = 0, Te = 4, ot = 8, at = 12, G = 16, _e = 20, Pe = Yt, Is = 1,
|
|
|
5056
4935
|
if (!e || e.seq <= this._lastSeq) continue;
|
|
5057
4936
|
this._lastSeq = e.seq;
|
|
5058
4937
|
const t = this._encoder.decode(e.data);
|
|
5059
|
-
if (t.seq = e.seq, t.workerId = t.workerId ?? this._workerId, (e.flags &
|
|
4938
|
+
if (t.seq = e.seq, t.workerId = t.workerId ?? this._workerId, (e.flags & bs || t.type === "response") && t.reqId) {
|
|
5060
4939
|
const n = this._pending.get(t.reqId);
|
|
5061
4940
|
if (n) {
|
|
5062
4941
|
this._pending.delete(t.reqId), t.payload?.error ? n.reject(new Error(t.payload.error)) : n.resolve(t.payload?.result ?? t.payload);
|
|
@@ -5094,20 +4973,20 @@ var Yt = 32, te = 0, Te = 4, ot = 8, at = 12, G = 16, _e = 20, Pe = Yt, Is = 1,
|
|
|
5094
4973
|
return this._channelName;
|
|
5095
4974
|
}
|
|
5096
4975
|
};
|
|
5097
|
-
function
|
|
4976
|
+
function zt(e, t = {}) {
|
|
5098
4977
|
const n = t.bufferSize ?? 65536, s = new SharedArrayBuffer(n), r = new SharedArrayBuffer(n);
|
|
5099
4978
|
return {
|
|
5100
|
-
main: new
|
|
4979
|
+
main: new se(e, s, r, t),
|
|
5101
4980
|
worker: {
|
|
5102
4981
|
sendBuffer: r,
|
|
5103
4982
|
recvBuffer: s
|
|
5104
4983
|
}
|
|
5105
4984
|
};
|
|
5106
4985
|
}
|
|
5107
|
-
function
|
|
5108
|
-
return new
|
|
4986
|
+
function fi(e, t, n, s = {}) {
|
|
4987
|
+
return new se(e, t, n, s);
|
|
5109
4988
|
}
|
|
5110
|
-
var
|
|
4989
|
+
var Ht = class b {
|
|
5111
4990
|
_buffer;
|
|
5112
4991
|
_meta;
|
|
5113
4992
|
_data;
|
|
@@ -5162,31 +5041,31 @@ var Xt = class b {
|
|
|
5162
5041
|
get overflow() {
|
|
5163
5042
|
return Atomics.load(this._meta, b.OVERFLOW);
|
|
5164
5043
|
}
|
|
5165
|
-
},
|
|
5166
|
-
create: (e, t, n, s) => new
|
|
5167
|
-
createPair: (e, t) =>
|
|
5168
|
-
createBuffer: (e, t) => new
|
|
5169
|
-
createRingBuffer: (e) => new
|
|
5170
|
-
getCBOR:
|
|
5171
|
-
},
|
|
5044
|
+
}, pi = {
|
|
5045
|
+
create: (e, t, n, s) => new se(e, t, n, s),
|
|
5046
|
+
createPair: (e, t) => zt(e, t),
|
|
5047
|
+
createBuffer: (e, t) => new F(e, t),
|
|
5048
|
+
createRingBuffer: (e) => new Ht(e),
|
|
5049
|
+
getCBOR: Ut
|
|
5050
|
+
}, ys = [
|
|
5172
5051
|
{ urls: "stun:stun.l.google.com:19302" },
|
|
5173
5052
|
{ urls: "stun:stun1.l.google.com:19302" },
|
|
5174
5053
|
{ urls: "stun:stun2.l.google.com:19302" }
|
|
5175
|
-
],
|
|
5054
|
+
], ge = class {
|
|
5176
5055
|
_channelName;
|
|
5177
5056
|
_config;
|
|
5178
5057
|
_pc;
|
|
5179
5058
|
_channel = null;
|
|
5180
5059
|
_subs = /* @__PURE__ */ new Set();
|
|
5181
5060
|
_pending = /* @__PURE__ */ new Map();
|
|
5182
|
-
_localId =
|
|
5061
|
+
_localId = h();
|
|
5183
5062
|
_remoteId = null;
|
|
5184
5063
|
_state = new _();
|
|
5185
5064
|
_channelState = new _();
|
|
5186
5065
|
_iceCandidates = [];
|
|
5187
5066
|
_iceGatheringComplete = !1;
|
|
5188
5067
|
constructor(e, t = {}) {
|
|
5189
|
-
this._channelName = e, this._config = t, this._pc = new RTCPeerConnection({ iceServers: t.iceServers ??
|
|
5068
|
+
this._channelName = e, this._config = t, this._pc = new RTCPeerConnection({ iceServers: t.iceServers ?? ys }), this._setupPeerConnection();
|
|
5190
5069
|
}
|
|
5191
5070
|
_setupPeerConnection() {
|
|
5192
5071
|
this._pc.onicecandidate = (e) => {
|
|
@@ -5269,7 +5148,7 @@ var Xt = class b {
|
|
|
5269
5148
|
t || e.binary ? this._channel.send(this._encodeBinary(i)) : this._channel.send(JSON.stringify(i));
|
|
5270
5149
|
}
|
|
5271
5150
|
request(e) {
|
|
5272
|
-
const t = e.reqId ??
|
|
5151
|
+
const t = e.reqId ?? h();
|
|
5273
5152
|
return new Promise((n, s) => {
|
|
5274
5153
|
const r = setTimeout(() => {
|
|
5275
5154
|
this._pending.delete(t), s(/* @__PURE__ */ new Error("Request timeout"));
|
|
@@ -5337,11 +5216,11 @@ var Xt = class b {
|
|
|
5337
5216
|
get channelName() {
|
|
5338
5217
|
return this._channelName;
|
|
5339
5218
|
}
|
|
5340
|
-
},
|
|
5219
|
+
}, je = class {
|
|
5341
5220
|
_channelName;
|
|
5342
5221
|
_config;
|
|
5343
5222
|
_peers = /* @__PURE__ */ new Map();
|
|
5344
|
-
_localId =
|
|
5223
|
+
_localId = h();
|
|
5345
5224
|
_subs = /* @__PURE__ */ new Set();
|
|
5346
5225
|
_signalingCleanup = null;
|
|
5347
5226
|
_peerEvents = new _();
|
|
@@ -5370,14 +5249,13 @@ var Xt = class b {
|
|
|
5370
5249
|
}
|
|
5371
5250
|
case "disconnect":
|
|
5372
5251
|
this._removePeer(t.fromPeerId);
|
|
5373
|
-
break;
|
|
5374
5252
|
}
|
|
5375
5253
|
});
|
|
5376
5254
|
typeof e == "function" ? this._signalingCleanup = e : e && "unsubscribe" in e && (this._signalingCleanup = () => e.unsubscribe());
|
|
5377
5255
|
}
|
|
5378
5256
|
_getOrCreatePeer(e) {
|
|
5379
5257
|
let t = this._peers.get(e);
|
|
5380
|
-
return t || (t = new
|
|
5258
|
+
return t || (t = new ge(this._channelName, this._config), this._peers.set(e, t), t.state.subscribe({ next: (n) => {
|
|
5381
5259
|
n === "connected" ? this._peerEvents.next({
|
|
5382
5260
|
type: "connected",
|
|
5383
5261
|
peerId: e,
|
|
@@ -5460,7 +5338,7 @@ var Xt = class b {
|
|
|
5460
5338
|
return this._channelName;
|
|
5461
5339
|
}
|
|
5462
5340
|
};
|
|
5463
|
-
function
|
|
5341
|
+
function Gt(e) {
|
|
5464
5342
|
const t = new BroadcastChannel(`rtc-signaling:${e}`), n = /* @__PURE__ */ new Set();
|
|
5465
5343
|
return t.onmessage = (s) => {
|
|
5466
5344
|
for (const r of n) r(s.data);
|
|
@@ -5479,11 +5357,11 @@ function Zt(e) {
|
|
|
5479
5357
|
}
|
|
5480
5358
|
};
|
|
5481
5359
|
}
|
|
5482
|
-
var
|
|
5483
|
-
createPeer: (e, t) => new
|
|
5484
|
-
createManager: (e, t) => new
|
|
5485
|
-
createSignaling: (e) =>
|
|
5486
|
-
},
|
|
5360
|
+
var _i = {
|
|
5361
|
+
createPeer: (e, t) => new ge(e, t),
|
|
5362
|
+
createManager: (e, t) => new je(e, t),
|
|
5363
|
+
createSignaling: (e) => Gt(e)
|
|
5364
|
+
}, B = class {
|
|
5487
5365
|
_channelName;
|
|
5488
5366
|
_config;
|
|
5489
5367
|
_port;
|
|
@@ -5491,7 +5369,7 @@ var Si = {
|
|
|
5491
5369
|
_pending = /* @__PURE__ */ new Map();
|
|
5492
5370
|
_listening = !1;
|
|
5493
5371
|
_cleanup = null;
|
|
5494
|
-
_portId =
|
|
5372
|
+
_portId = h();
|
|
5495
5373
|
_state = new _();
|
|
5496
5374
|
_keepAliveTimer = null;
|
|
5497
5375
|
constructor(e, t, n = {}) {
|
|
@@ -5509,7 +5387,7 @@ var Si = {
|
|
|
5509
5387
|
}
|
|
5510
5388
|
if (s.type === "signal" && s.payload?.action === "ping") {
|
|
5511
5389
|
this.send({
|
|
5512
|
-
id:
|
|
5390
|
+
id: h(),
|
|
5513
5391
|
channel: this._channelName,
|
|
5514
5392
|
sender: this._portId,
|
|
5515
5393
|
type: "signal",
|
|
@@ -5543,7 +5421,7 @@ var Si = {
|
|
|
5543
5421
|
}, t ?? []);
|
|
5544
5422
|
}
|
|
5545
5423
|
request(e) {
|
|
5546
|
-
const t = e.reqId ??
|
|
5424
|
+
const t = e.reqId ?? h();
|
|
5547
5425
|
return new Promise((n, s) => {
|
|
5548
5426
|
const r = setTimeout(() => {
|
|
5549
5427
|
this._pending.delete(t), s(/* @__PURE__ */ new Error("Request timeout"));
|
|
@@ -5575,7 +5453,7 @@ var Si = {
|
|
|
5575
5453
|
_startKeepAlive() {
|
|
5576
5454
|
this._keepAliveTimer = setInterval(() => {
|
|
5577
5455
|
this.send({
|
|
5578
|
-
id:
|
|
5456
|
+
id: h(),
|
|
5579
5457
|
channel: this._channelName,
|
|
5580
5458
|
sender: this._portId,
|
|
5581
5459
|
type: "signal",
|
|
@@ -5602,18 +5480,18 @@ var Si = {
|
|
|
5602
5480
|
return this._channelName;
|
|
5603
5481
|
}
|
|
5604
5482
|
};
|
|
5605
|
-
function
|
|
5483
|
+
function be(e, t) {
|
|
5606
5484
|
const n = new MessageChannel();
|
|
5607
5485
|
return {
|
|
5608
|
-
local: new
|
|
5486
|
+
local: new B(n.port1, e, t),
|
|
5609
5487
|
remote: n.port2,
|
|
5610
5488
|
transfer: () => n.port2
|
|
5611
5489
|
};
|
|
5612
5490
|
}
|
|
5613
|
-
function
|
|
5614
|
-
return new
|
|
5491
|
+
function mi(e, t, n) {
|
|
5492
|
+
return new B(e, t, n);
|
|
5615
5493
|
}
|
|
5616
|
-
var
|
|
5494
|
+
var Qt = class {
|
|
5617
5495
|
_defaultConfig;
|
|
5618
5496
|
_channels = /* @__PURE__ */ new Map();
|
|
5619
5497
|
_mainPort = null;
|
|
@@ -5622,7 +5500,7 @@ var en = class {
|
|
|
5622
5500
|
this._defaultConfig = e;
|
|
5623
5501
|
}
|
|
5624
5502
|
create(e, t) {
|
|
5625
|
-
const n =
|
|
5503
|
+
const n = be(e, {
|
|
5626
5504
|
...this._defaultConfig,
|
|
5627
5505
|
...t
|
|
5628
5506
|
});
|
|
@@ -5635,7 +5513,7 @@ var en = class {
|
|
|
5635
5513
|
} }), this._channels.set(e, n.local), n;
|
|
5636
5514
|
}
|
|
5637
5515
|
add(e, t, n) {
|
|
5638
|
-
const s = new
|
|
5516
|
+
const s = new B(t, e, {
|
|
5639
5517
|
...this._defaultConfig,
|
|
5640
5518
|
...n
|
|
5641
5519
|
});
|
|
@@ -5684,7 +5562,7 @@ var en = class {
|
|
|
5684
5562
|
get size() {
|
|
5685
5563
|
return this._channels.size;
|
|
5686
5564
|
}
|
|
5687
|
-
},
|
|
5565
|
+
}, Te = class {
|
|
5688
5566
|
_target;
|
|
5689
5567
|
_channelName;
|
|
5690
5568
|
_config;
|
|
@@ -5697,7 +5575,7 @@ var en = class {
|
|
|
5697
5575
|
async connect() {
|
|
5698
5576
|
if (this._transport && this._handshakeComplete) return this._transport;
|
|
5699
5577
|
this._state.next("connecting");
|
|
5700
|
-
const { local: e, remote: t } =
|
|
5578
|
+
const { local: e, remote: t } = be(this._channelName, this._config);
|
|
5701
5579
|
return this._target.postMessage({
|
|
5702
5580
|
type: "port-connect",
|
|
5703
5581
|
channelName: this._channelName,
|
|
@@ -5713,9 +5591,9 @@ var en = class {
|
|
|
5713
5591
|
static listen(e, t, n) {
|
|
5714
5592
|
const s = (r) => {
|
|
5715
5593
|
if (r.data?.type !== "port-connect" || r.data?.channelName !== e || !r.ports[0]) return;
|
|
5716
|
-
const i = new
|
|
5594
|
+
const i = new B(r.ports[0], e, n);
|
|
5717
5595
|
i.send({
|
|
5718
|
-
id:
|
|
5596
|
+
id: h(),
|
|
5719
5597
|
channel: e,
|
|
5720
5598
|
sender: i.portId,
|
|
5721
5599
|
type: "signal",
|
|
@@ -5737,15 +5615,15 @@ var en = class {
|
|
|
5737
5615
|
return this._transport;
|
|
5738
5616
|
}
|
|
5739
5617
|
};
|
|
5740
|
-
function
|
|
5741
|
-
return
|
|
5618
|
+
function ws(e, t = []) {
|
|
5619
|
+
return kn({
|
|
5742
5620
|
request: (n) => e.request(n),
|
|
5743
5621
|
channelName: e.channelName,
|
|
5744
5622
|
senderId: e.portId
|
|
5745
5623
|
}, t);
|
|
5746
5624
|
}
|
|
5747
|
-
function
|
|
5748
|
-
const n =
|
|
5625
|
+
function vs(e, t) {
|
|
5626
|
+
const n = xn(t);
|
|
5749
5627
|
return e.subscribe({ next: async (s) => {
|
|
5750
5628
|
if (s.type !== "request" || !s.payload?.path) return;
|
|
5751
5629
|
const { action: r, path: i, args: o } = s.payload;
|
|
@@ -5756,7 +5634,7 @@ function Rs(e, t) {
|
|
|
5756
5634
|
c = l instanceof Error ? l.message : String(l);
|
|
5757
5635
|
}
|
|
5758
5636
|
e.send({
|
|
5759
|
-
id:
|
|
5637
|
+
id: h(),
|
|
5760
5638
|
channel: s.sender,
|
|
5761
5639
|
sender: e.portId,
|
|
5762
5640
|
type: "response",
|
|
@@ -5765,15 +5643,15 @@ function Rs(e, t) {
|
|
|
5765
5643
|
});
|
|
5766
5644
|
} });
|
|
5767
5645
|
}
|
|
5768
|
-
var
|
|
5769
|
-
create: (e, t, n) => new
|
|
5770
|
-
createPair: (e, t) =>
|
|
5771
|
-
createPool: (e) => new
|
|
5772
|
-
createWindowConnector: (e, t, n) => new
|
|
5773
|
-
listen:
|
|
5774
|
-
createProxy:
|
|
5775
|
-
expose:
|
|
5776
|
-
},
|
|
5646
|
+
var gi = {
|
|
5647
|
+
create: (e, t, n) => new B(e, t, n),
|
|
5648
|
+
createPair: (e, t) => be(e, t),
|
|
5649
|
+
createPool: (e) => new Qt(e),
|
|
5650
|
+
createWindowConnector: (e, t, n) => new Te(e, t, n),
|
|
5651
|
+
listen: Te.listen,
|
|
5652
|
+
createProxy: ws,
|
|
5653
|
+
expose: vs
|
|
5654
|
+
}, ze = class {
|
|
5777
5655
|
_db = null;
|
|
5778
5656
|
_config;
|
|
5779
5657
|
_changes = new _();
|
|
@@ -5895,25 +5773,25 @@ var Ii = {
|
|
|
5895
5773
|
let o = 0;
|
|
5896
5774
|
const a = e.offset ?? 0, c = e.limit ?? 1 / 0, l = r.openCursor(e.range, e.direction);
|
|
5897
5775
|
l.onsuccess = () => {
|
|
5898
|
-
const
|
|
5899
|
-
if (!
|
|
5776
|
+
const u = l.result;
|
|
5777
|
+
if (!u || i.length >= c) {
|
|
5900
5778
|
t(i);
|
|
5901
5779
|
return;
|
|
5902
5780
|
}
|
|
5903
|
-
const p =
|
|
5781
|
+
const p = u.value;
|
|
5904
5782
|
if (p.expiresAt && p.expiresAt < Date.now()) {
|
|
5905
|
-
|
|
5783
|
+
u.continue();
|
|
5906
5784
|
return;
|
|
5907
5785
|
}
|
|
5908
5786
|
if (e.filter && !e.filter(p)) {
|
|
5909
|
-
|
|
5787
|
+
u.continue();
|
|
5910
5788
|
return;
|
|
5911
5789
|
}
|
|
5912
5790
|
if (o < a) {
|
|
5913
|
-
o++,
|
|
5791
|
+
o++, u.continue();
|
|
5914
5792
|
return;
|
|
5915
5793
|
}
|
|
5916
|
-
i.push(p),
|
|
5794
|
+
i.push(p), u.continue();
|
|
5917
5795
|
}, l.onerror = () => n(/* @__PURE__ */ new Error(`Query failed: ${l.error?.message}`));
|
|
5918
5796
|
});
|
|
5919
5797
|
}
|
|
@@ -5984,7 +5862,7 @@ var Ii = {
|
|
|
5984
5862
|
get changes() {
|
|
5985
5863
|
return this._changes;
|
|
5986
5864
|
}
|
|
5987
|
-
},
|
|
5865
|
+
}, Vt = class extends ze {
|
|
5988
5866
|
constructor(e = "uniform-message-queue") {
|
|
5989
5867
|
super({
|
|
5990
5868
|
dbName: e,
|
|
@@ -6014,7 +5892,7 @@ var Ii = {
|
|
|
6014
5892
|
});
|
|
6015
5893
|
}
|
|
6016
5894
|
async enqueue(e) {
|
|
6017
|
-
const t = Date.now(), n =
|
|
5895
|
+
const t = Date.now(), n = h(), s = {
|
|
6018
5896
|
id: n,
|
|
6019
5897
|
channel: e.channel,
|
|
6020
5898
|
sender: e.sender,
|
|
@@ -6050,10 +5928,10 @@ var Ii = {
|
|
|
6050
5928
|
async getPendingCount(e) {
|
|
6051
5929
|
return (await this.query({ filter: (t) => t.data.channel === e && t.data.status === "pending" })).length;
|
|
6052
5930
|
}
|
|
6053
|
-
},
|
|
6054
|
-
create: (e) => new
|
|
6055
|
-
createMessageQueue: (e) => new
|
|
6056
|
-
},
|
|
5931
|
+
}, bi = {
|
|
5932
|
+
create: (e) => new ze(e),
|
|
5933
|
+
createMessageQueue: (e) => new Vt(e)
|
|
5934
|
+
}, He = class {
|
|
6057
5935
|
_connection;
|
|
6058
5936
|
_storage;
|
|
6059
5937
|
_clients = /* @__PURE__ */ new Map();
|
|
@@ -6066,11 +5944,11 @@ var Ii = {
|
|
|
6066
5944
|
this._config = {
|
|
6067
5945
|
enableOfflineQueue: !0,
|
|
6068
5946
|
maxOfflineQueueSize: 100,
|
|
6069
|
-
messageTTL:
|
|
5947
|
+
messageTTL: 864e5,
|
|
6070
5948
|
autoCleanup: !0,
|
|
6071
|
-
cleanupInterval:
|
|
5949
|
+
cleanupInterval: 6e4,
|
|
6072
5950
|
...e
|
|
6073
|
-
}, this._connection =
|
|
5951
|
+
}, this._connection = Le().getOrCreate(this._config.channelName, "service-worker", { metadata: { isHost: !0 } }), this._storage = Rt(this._config.channelName), this._setupMessageHandlers(), this._config.autoCleanup && this._startCleanupInterval();
|
|
6074
5952
|
}
|
|
6075
5953
|
async registerClient(e, t = {}) {
|
|
6076
5954
|
const n = {
|
|
@@ -6220,7 +6098,7 @@ var Ii = {
|
|
|
6220
6098
|
}
|
|
6221
6099
|
async _handleRequest(e) {
|
|
6222
6100
|
const t = {
|
|
6223
|
-
id:
|
|
6101
|
+
id: h(),
|
|
6224
6102
|
channel: e.sender,
|
|
6225
6103
|
sender: this._config.channelName,
|
|
6226
6104
|
type: "response",
|
|
@@ -6278,7 +6156,7 @@ var Ii = {
|
|
|
6278
6156
|
const e = await clients.matchAll({ includeUncontrolled: !0 }), t = new Set(e.map((n) => n.id));
|
|
6279
6157
|
for (const n of this._clients.keys()) t.has(n) || this.unregisterClient(n);
|
|
6280
6158
|
}
|
|
6281
|
-
},
|
|
6159
|
+
}, Ge = class {
|
|
6282
6160
|
_channelName;
|
|
6283
6161
|
_registration = null;
|
|
6284
6162
|
_messageHandler = null;
|
|
@@ -6333,9 +6211,9 @@ var Ii = {
|
|
|
6333
6211
|
});
|
|
6334
6212
|
}
|
|
6335
6213
|
async request(e, t = {}) {
|
|
6336
|
-
const n =
|
|
6214
|
+
const n = h(), s = Promise.withResolvers();
|
|
6337
6215
|
return this._pendingRequests.set(n, s), this._sendToSW({
|
|
6338
|
-
id:
|
|
6216
|
+
id: h(),
|
|
6339
6217
|
type: "request",
|
|
6340
6218
|
channel: this._channelName,
|
|
6341
6219
|
sender: "client",
|
|
@@ -6351,7 +6229,7 @@ var Ii = {
|
|
|
6351
6229
|
}
|
|
6352
6230
|
emit(e, t, n) {
|
|
6353
6231
|
this._sendToSW({
|
|
6354
|
-
id:
|
|
6232
|
+
id: h(),
|
|
6355
6233
|
type: "event",
|
|
6356
6234
|
channel: n ?? this._channelName,
|
|
6357
6235
|
sender: "client",
|
|
@@ -6366,7 +6244,7 @@ var Ii = {
|
|
|
6366
6244
|
return this._subject.subscribe({ next: e });
|
|
6367
6245
|
}
|
|
6368
6246
|
on(e, t) {
|
|
6369
|
-
return
|
|
6247
|
+
return ut((n) => n.type === "event" && n.payload?.type === e)(this._subject).subscribe({ next: (n) => t(n.payload?.data) });
|
|
6370
6248
|
}
|
|
6371
6249
|
get isConnected() {
|
|
6372
6250
|
return this._isConnected;
|
|
@@ -6388,13 +6266,13 @@ var Ii = {
|
|
|
6388
6266
|
});
|
|
6389
6267
|
};
|
|
6390
6268
|
};
|
|
6391
|
-
function
|
|
6392
|
-
return new
|
|
6269
|
+
function yi(e) {
|
|
6270
|
+
return new He(e);
|
|
6393
6271
|
}
|
|
6394
|
-
function
|
|
6395
|
-
return new
|
|
6272
|
+
function wi(e) {
|
|
6273
|
+
return new Ge(e);
|
|
6396
6274
|
}
|
|
6397
|
-
function
|
|
6275
|
+
function Cs(e, t = self) {
|
|
6398
6276
|
const n = (s) => {
|
|
6399
6277
|
const r = String(s.source?.id || "").trim();
|
|
6400
6278
|
r && e.handleClientMessage(r, s.data);
|
|
@@ -6405,7 +6283,7 @@ function qs(e, t = self) {
|
|
|
6405
6283
|
t.removeEventListener("message", n), e.stop();
|
|
6406
6284
|
} };
|
|
6407
6285
|
}
|
|
6408
|
-
var
|
|
6286
|
+
var xs = class {
|
|
6409
6287
|
_type;
|
|
6410
6288
|
_channelName;
|
|
6411
6289
|
_config;
|
|
@@ -6417,7 +6295,7 @@ var Ns = class {
|
|
|
6417
6295
|
this._type = e, this._channelName = t, this._config = n;
|
|
6418
6296
|
}
|
|
6419
6297
|
request(e) {
|
|
6420
|
-
const t = e.reqId ??
|
|
6298
|
+
const t = e.reqId ?? h();
|
|
6421
6299
|
return new Promise((n, s) => {
|
|
6422
6300
|
const r = setTimeout(() => {
|
|
6423
6301
|
this._pending.delete(t), s(/* @__PURE__ */ new Error("Request timeout"));
|
|
@@ -6475,12 +6353,12 @@ var Ns = class {
|
|
|
6475
6353
|
get state() {
|
|
6476
6354
|
return this._state;
|
|
6477
6355
|
}
|
|
6478
|
-
},
|
|
6356
|
+
}, nt = class extends xs {
|
|
6479
6357
|
_target;
|
|
6480
6358
|
_sendFn;
|
|
6481
6359
|
_cleanup = null;
|
|
6482
6360
|
constructor(e, t) {
|
|
6483
|
-
super(
|
|
6361
|
+
super(Z(e), t.channelName, t), this._target = e, this._sendFn = g(e), this._setupListener();
|
|
6484
6362
|
}
|
|
6485
6363
|
_setupListener() {
|
|
6486
6364
|
this._cleanup = m(this._target, (e) => this._handleMessage(e), (e) => this._subs.forEach((t) => t.error?.(e)), () => this._subs.forEach((e) => e.complete?.())), this._ready = !0, this._state.next("connected");
|
|
@@ -6492,7 +6370,7 @@ var Ns = class {
|
|
|
6492
6370
|
this._cleanup?.(), super.close();
|
|
6493
6371
|
}
|
|
6494
6372
|
};
|
|
6495
|
-
function
|
|
6373
|
+
function $(e, t = {}, n = {}) {
|
|
6496
6374
|
const s = {
|
|
6497
6375
|
channelName: e,
|
|
6498
6376
|
timeout: 3e4,
|
|
@@ -6501,10 +6379,10 @@ function j(e, t = {}, n = {}) {
|
|
|
6501
6379
|
};
|
|
6502
6380
|
if (t.worker) {
|
|
6503
6381
|
const i = t.worker.existing ?? new Worker(t.worker.scriptUrl, t.worker.options);
|
|
6504
|
-
return new
|
|
6382
|
+
return new nt(i, s);
|
|
6505
6383
|
}
|
|
6506
6384
|
if (t.sharedWorker) {
|
|
6507
|
-
const i = new
|
|
6385
|
+
const i = new me(t.sharedWorker.scriptUrl, e, t.sharedWorker.options);
|
|
6508
6386
|
return {
|
|
6509
6387
|
send: (o, a) => i.send(o, a),
|
|
6510
6388
|
request: (o) => i.request(o),
|
|
@@ -6516,7 +6394,7 @@ function j(e, t = {}, n = {}) {
|
|
|
6516
6394
|
};
|
|
6517
6395
|
}
|
|
6518
6396
|
if (t.websocket) {
|
|
6519
|
-
const i =
|
|
6397
|
+
const i = lt(t.websocket.url, {
|
|
6520
6398
|
protocols: t.websocket.protocols,
|
|
6521
6399
|
reconnect: t.websocket.reconnect
|
|
6522
6400
|
}), o = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
|
|
@@ -6534,16 +6412,16 @@ function j(e, t = {}, n = {}) {
|
|
|
6534
6412
|
}
|
|
6535
6413
|
}), {
|
|
6536
6414
|
send: (c, l) => i.send(c, l),
|
|
6537
|
-
request: (c) => new Promise((l,
|
|
6538
|
-
const p = c.reqId ??
|
|
6539
|
-
a.delete(p),
|
|
6415
|
+
request: (c) => new Promise((l, u) => {
|
|
6416
|
+
const p = c.reqId ?? h(), y = setTimeout(() => {
|
|
6417
|
+
a.delete(p), u(/* @__PURE__ */ new Error("Request timeout"));
|
|
6540
6418
|
}, s.timeout);
|
|
6541
6419
|
a.set(p, {
|
|
6542
|
-
resolve: (
|
|
6543
|
-
clearTimeout(
|
|
6420
|
+
resolve: (x) => {
|
|
6421
|
+
clearTimeout(y), l(x);
|
|
6544
6422
|
},
|
|
6545
|
-
reject: (
|
|
6546
|
-
clearTimeout(
|
|
6423
|
+
reject: (x) => {
|
|
6424
|
+
clearTimeout(y), u(x);
|
|
6547
6425
|
},
|
|
6548
6426
|
timestamp: Date.now()
|
|
6549
6427
|
}), i.send({
|
|
@@ -6568,11 +6446,11 @@ function j(e, t = {}, n = {}) {
|
|
|
6568
6446
|
};
|
|
6569
6447
|
}
|
|
6570
6448
|
if (t.broadcast) {
|
|
6571
|
-
const i =
|
|
6572
|
-
return new
|
|
6449
|
+
const i = ht(t.broadcast.name ?? e);
|
|
6450
|
+
return new nt(i.channel, s);
|
|
6573
6451
|
}
|
|
6574
6452
|
if (t.port?.port) {
|
|
6575
|
-
const i = new
|
|
6453
|
+
const i = new B(t.port.port, e, t.port.config);
|
|
6576
6454
|
return {
|
|
6577
6455
|
send: (o, a) => i.send(o, a),
|
|
6578
6456
|
request: (o) => i.request(o),
|
|
@@ -6585,7 +6463,7 @@ function j(e, t = {}, n = {}) {
|
|
|
6585
6463
|
}
|
|
6586
6464
|
if (t.chrome) {
|
|
6587
6465
|
if (t.chrome.mode === "runtime") {
|
|
6588
|
-
const i = new
|
|
6466
|
+
const i = new We(void 0, t.chrome.options);
|
|
6589
6467
|
return {
|
|
6590
6468
|
send: (o) => i.send(o),
|
|
6591
6469
|
request: (o) => i.request(o),
|
|
@@ -6597,7 +6475,7 @@ function j(e, t = {}, n = {}) {
|
|
|
6597
6475
|
};
|
|
6598
6476
|
}
|
|
6599
6477
|
if (t.chrome.mode === "tabs") {
|
|
6600
|
-
const i = new
|
|
6478
|
+
const i = new $e(t.chrome.tabId, t.chrome.options);
|
|
6601
6479
|
return {
|
|
6602
6480
|
send: (o) => i.send(o),
|
|
6603
6481
|
request: () => Promise.reject("Not supported"),
|
|
@@ -6609,7 +6487,7 @@ function j(e, t = {}, n = {}) {
|
|
|
6609
6487
|
};
|
|
6610
6488
|
}
|
|
6611
6489
|
if (t.chrome.mode === "port") {
|
|
6612
|
-
const i = new
|
|
6490
|
+
const i = new Fe(t.chrome.portName ?? e, t.chrome.tabId);
|
|
6613
6491
|
return {
|
|
6614
6492
|
send: (o) => i.send(o),
|
|
6615
6493
|
request: () => Promise.reject("Not supported"),
|
|
@@ -6621,7 +6499,7 @@ function j(e, t = {}, n = {}) {
|
|
|
6621
6499
|
};
|
|
6622
6500
|
}
|
|
6623
6501
|
if (t.chrome.mode === "external") {
|
|
6624
|
-
const i = new
|
|
6502
|
+
const i = new Ft(t.chrome.options?.extensionId);
|
|
6625
6503
|
return {
|
|
6626
6504
|
send: (o) => i.send(o),
|
|
6627
6505
|
request: () => Promise.reject("Not supported"),
|
|
@@ -6634,7 +6512,7 @@ function j(e, t = {}, n = {}) {
|
|
|
6634
6512
|
}
|
|
6635
6513
|
}
|
|
6636
6514
|
if (t.socketio) {
|
|
6637
|
-
const i = new
|
|
6515
|
+
const i = new _e(t.socketio.socket, e, t.socketio.options);
|
|
6638
6516
|
return {
|
|
6639
6517
|
send: (o) => i.send(o),
|
|
6640
6518
|
request: (o) => i.request(o),
|
|
@@ -6647,10 +6525,10 @@ function j(e, t = {}, n = {}) {
|
|
|
6647
6525
|
}
|
|
6648
6526
|
if (t.serviceWorker) {
|
|
6649
6527
|
if (t.serviceWorker.mode === "host") {
|
|
6650
|
-
const i = new
|
|
6528
|
+
const i = new He({
|
|
6651
6529
|
channelName: e,
|
|
6652
6530
|
...t.serviceWorker.config ?? {}
|
|
6653
|
-
}), o =
|
|
6531
|
+
}), o = Cs(i);
|
|
6654
6532
|
return {
|
|
6655
6533
|
send: (a) => {
|
|
6656
6534
|
i.broadcastToAll(a);
|
|
@@ -6664,7 +6542,7 @@ function j(e, t = {}, n = {}) {
|
|
|
6664
6542
|
};
|
|
6665
6543
|
}
|
|
6666
6544
|
if (t.serviceWorker.mode === "client") {
|
|
6667
|
-
const i = new
|
|
6545
|
+
const i = new Ge(e);
|
|
6668
6546
|
return i.connect(), {
|
|
6669
6547
|
send: (o) => i.emit(o.type, o.payload, o.channel),
|
|
6670
6548
|
request: (o) => i.request(o.payload?.action ?? "unknown", o.payload),
|
|
@@ -6677,7 +6555,7 @@ function j(e, t = {}, n = {}) {
|
|
|
6677
6555
|
}
|
|
6678
6556
|
}
|
|
6679
6557
|
if (t.atomics) {
|
|
6680
|
-
const i = new
|
|
6558
|
+
const i = new se(e, t.atomics.sendBuffer, t.atomics.recvBuffer, t.atomics.config);
|
|
6681
6559
|
return {
|
|
6682
6560
|
send: (o, a) => i.send(o),
|
|
6683
6561
|
request: (o) => i.request(o),
|
|
@@ -6690,7 +6568,7 @@ function j(e, t = {}, n = {}) {
|
|
|
6690
6568
|
}
|
|
6691
6569
|
if (t.rtc) {
|
|
6692
6570
|
if (t.rtc.mode === "peer") {
|
|
6693
|
-
const i = new
|
|
6571
|
+
const i = new ge(e, t.rtc.config);
|
|
6694
6572
|
return {
|
|
6695
6573
|
send: (o) => i.send(o),
|
|
6696
6574
|
request: (o) => i.request(o),
|
|
@@ -6702,7 +6580,7 @@ function j(e, t = {}, n = {}) {
|
|
|
6702
6580
|
};
|
|
6703
6581
|
}
|
|
6704
6582
|
if (t.rtc.mode === "manager") {
|
|
6705
|
-
const i = new
|
|
6583
|
+
const i = new je(e, t.rtc.config);
|
|
6706
6584
|
return {
|
|
6707
6585
|
send: (o) => i.broadcast(o),
|
|
6708
6586
|
request: () => Promise.reject("Use manager.request(peerId, msg) directly"),
|
|
@@ -6725,7 +6603,7 @@ function j(e, t = {}, n = {}) {
|
|
|
6725
6603
|
isReady: !0
|
|
6726
6604
|
};
|
|
6727
6605
|
}
|
|
6728
|
-
var
|
|
6606
|
+
var ks = class {
|
|
6729
6607
|
_transports = /* @__PURE__ */ new Map();
|
|
6730
6608
|
register(e, t) {
|
|
6731
6609
|
this._transports.set(e, t);
|
|
@@ -6735,7 +6613,7 @@ var Os = class {
|
|
|
6735
6613
|
}
|
|
6736
6614
|
getOrCreate(e, t = {}, n = {}) {
|
|
6737
6615
|
let s = this._transports.get(e);
|
|
6738
|
-
return s || (s =
|
|
6616
|
+
return s || (s = $(e, t, n), this._transports.set(e, s)), s;
|
|
6739
6617
|
}
|
|
6740
6618
|
remove(e) {
|
|
6741
6619
|
const t = this._transports.get(e);
|
|
@@ -6751,55 +6629,55 @@ var Os = class {
|
|
|
6751
6629
|
get size() {
|
|
6752
6630
|
return this._transports.size;
|
|
6753
6631
|
}
|
|
6754
|
-
},
|
|
6755
|
-
function
|
|
6756
|
-
return
|
|
6632
|
+
}, Se = null;
|
|
6633
|
+
function Ss() {
|
|
6634
|
+
return Se || (Se = new ks()), Se;
|
|
6757
6635
|
}
|
|
6758
|
-
var
|
|
6759
|
-
create:
|
|
6760
|
-
registry:
|
|
6761
|
-
fromWorker: (e, t, n) =>
|
|
6762
|
-
fromPort: (e, t, n) =>
|
|
6763
|
-
fromWebSocket: (e, t, n) =>
|
|
6764
|
-
fromBroadcast: (e, t) =>
|
|
6636
|
+
var vi = {
|
|
6637
|
+
create: $,
|
|
6638
|
+
registry: Ss,
|
|
6639
|
+
fromWorker: (e, t, n) => $(t, { worker: { existing: e } }, n),
|
|
6640
|
+
fromPort: (e, t, n) => $(t, { port: { port: e } }, n),
|
|
6641
|
+
fromWebSocket: (e, t, n) => $(t, { websocket: { url: e } }, n),
|
|
6642
|
+
fromBroadcast: (e, t) => $(e, { broadcast: {} }, t),
|
|
6765
6643
|
sharedWorker: {
|
|
6766
|
-
client: (e, t, n) => new
|
|
6767
|
-
host: (e) => new
|
|
6644
|
+
client: (e, t, n) => new me(e, t, n),
|
|
6645
|
+
host: (e) => new Ue(e)
|
|
6768
6646
|
},
|
|
6769
6647
|
atomics: {
|
|
6770
|
-
create: (e, t, n, s) => new
|
|
6771
|
-
createPair:
|
|
6772
|
-
buffer: (e) => new
|
|
6773
|
-
ringBuffer: () => new
|
|
6648
|
+
create: (e, t, n, s) => new se(e, t, n, s),
|
|
6649
|
+
createPair: zt,
|
|
6650
|
+
buffer: (e) => new F(e),
|
|
6651
|
+
ringBuffer: () => new Ht()
|
|
6774
6652
|
},
|
|
6775
6653
|
rtc: {
|
|
6776
|
-
peer: (e, t) => new
|
|
6777
|
-
manager: (e, t) => new
|
|
6778
|
-
signaling:
|
|
6654
|
+
peer: (e, t) => new ge(e, t),
|
|
6655
|
+
manager: (e, t) => new je(e, t),
|
|
6656
|
+
signaling: Gt
|
|
6779
6657
|
},
|
|
6780
6658
|
port: {
|
|
6781
|
-
create: (e, t, n) => new
|
|
6782
|
-
createPair:
|
|
6783
|
-
pool: (e) => new
|
|
6784
|
-
windowConnector: (e, t) => new
|
|
6659
|
+
create: (e, t, n) => new B(e, t, n),
|
|
6660
|
+
createPair: be,
|
|
6661
|
+
pool: (e) => new Qt(e),
|
|
6662
|
+
windowConnector: (e, t) => new Te(e, t)
|
|
6785
6663
|
},
|
|
6786
6664
|
storage: {
|
|
6787
|
-
create: (e) => new
|
|
6788
|
-
messageQueue: (e) => new
|
|
6665
|
+
create: (e) => new ze(e),
|
|
6666
|
+
messageQueue: (e) => new Vt(e)
|
|
6789
6667
|
},
|
|
6790
6668
|
serviceWorker: {
|
|
6791
|
-
host: (e) => new
|
|
6792
|
-
client: (e) => new
|
|
6669
|
+
host: (e) => new He(e),
|
|
6670
|
+
client: (e) => new Ge(e)
|
|
6793
6671
|
},
|
|
6794
|
-
socketio: (e, t, n) => new
|
|
6672
|
+
socketio: (e, t, n) => new _e(e, t, n),
|
|
6795
6673
|
chrome: {
|
|
6796
|
-
runtime: (e) => new
|
|
6797
|
-
tabs: (e, t) => new
|
|
6798
|
-
port: (e, t) => new
|
|
6674
|
+
runtime: (e) => new We(void 0, e),
|
|
6675
|
+
tabs: (e, t) => new $e(e, t),
|
|
6676
|
+
port: (e, t) => new Fe(e, t)
|
|
6799
6677
|
},
|
|
6800
|
-
detect:
|
|
6801
|
-
meta:
|
|
6802
|
-
},
|
|
6678
|
+
detect: Z,
|
|
6679
|
+
meta: at
|
|
6680
|
+
}, Es = class {
|
|
6803
6681
|
config;
|
|
6804
6682
|
onChannelReady;
|
|
6805
6683
|
underlyingChannel = null;
|
|
@@ -6817,7 +6695,7 @@ var Ai = {
|
|
|
6817
6695
|
async request(e, t = []) {
|
|
6818
6696
|
return this.isConnected && this.underlyingChannel ? this.underlyingChannel.request(e, t) : new Promise((n, s) => {
|
|
6819
6697
|
const r = {
|
|
6820
|
-
id:
|
|
6698
|
+
id: h(),
|
|
6821
6699
|
method: e,
|
|
6822
6700
|
args: t,
|
|
6823
6701
|
resolve: n,
|
|
@@ -6855,7 +6733,7 @@ var Ai = {
|
|
|
6855
6733
|
close() {
|
|
6856
6734
|
this.rejectAllQueued(/* @__PURE__ */ new Error("Channel closed")), this.underlyingChannel?.close(), this.underlyingChannel = null, this.isConnected = !1, this.connectionPromise = null;
|
|
6857
6735
|
}
|
|
6858
|
-
},
|
|
6736
|
+
}, Is = async () => {
|
|
6859
6737
|
const e = await chrome.tabs.query({
|
|
6860
6738
|
active: !0,
|
|
6861
6739
|
currentWindow: !0
|
|
@@ -6863,20 +6741,20 @@ var Ai = {
|
|
|
6863
6741
|
if (e.length === 0) throw new Error("No active tab found");
|
|
6864
6742
|
if (!e[0].id) throw new Error("Active tab has no ID");
|
|
6865
6743
|
return e[0].id;
|
|
6866
|
-
},
|
|
6744
|
+
}, Ci = async () => {
|
|
6867
6745
|
try {
|
|
6868
|
-
return await
|
|
6746
|
+
return await Is();
|
|
6869
6747
|
} catch {
|
|
6870
6748
|
const e = (await chrome.tabs.query({ currentWindow: !0 })).find((t) => t.active);
|
|
6871
6749
|
if (!e?.id) throw new Error("No visible tab found");
|
|
6872
6750
|
return e.id;
|
|
6873
6751
|
}
|
|
6874
|
-
},
|
|
6875
|
-
const n =
|
|
6752
|
+
}, xi = (e, t = "worker") => {
|
|
6753
|
+
const n = Oe(t ?? "worker");
|
|
6876
6754
|
return Object.keys(e).forEach((s) => {
|
|
6877
6755
|
e[s];
|
|
6878
6756
|
}), n;
|
|
6879
|
-
},
|
|
6757
|
+
}, Kt = class {
|
|
6880
6758
|
channel = null;
|
|
6881
6759
|
isChannelReady = !1;
|
|
6882
6760
|
pendingRequests = /* @__PURE__ */ new Map();
|
|
@@ -6900,7 +6778,7 @@ var Ai = {
|
|
|
6900
6778
|
async request(e, t, n) {
|
|
6901
6779
|
if (!this.isChannelReady || !this.channel) return new Promise((i, o) => {
|
|
6902
6780
|
const a = {
|
|
6903
|
-
id:
|
|
6781
|
+
id: h(),
|
|
6904
6782
|
method: e,
|
|
6905
6783
|
args: [t],
|
|
6906
6784
|
resolve: i,
|
|
@@ -6912,7 +6790,7 @@ var Ai = {
|
|
|
6912
6790
|
const s = {
|
|
6913
6791
|
...this.options,
|
|
6914
6792
|
...n
|
|
6915
|
-
}, r =
|
|
6793
|
+
}, r = h();
|
|
6916
6794
|
return new Promise((i, o) => {
|
|
6917
6795
|
const a = setTimeout(() => {
|
|
6918
6796
|
this.pendingRequests.delete(r), o(/* @__PURE__ */ new Error(`Request timeout: ${e}`));
|
|
@@ -6944,7 +6822,7 @@ var Ai = {
|
|
|
6944
6822
|
}
|
|
6945
6823
|
notify(e, t) {
|
|
6946
6824
|
const n = {
|
|
6947
|
-
id:
|
|
6825
|
+
id: h(),
|
|
6948
6826
|
type: e,
|
|
6949
6827
|
payload: t,
|
|
6950
6828
|
timestamp: Date.now()
|
|
@@ -6962,7 +6840,7 @@ var Ai = {
|
|
|
6962
6840
|
flushBatch() {
|
|
6963
6841
|
if (this.messageQueue.length === 0) return;
|
|
6964
6842
|
const e = {
|
|
6965
|
-
id:
|
|
6843
|
+
id: h(),
|
|
6966
6844
|
type: "batch",
|
|
6967
6845
|
payload: this.messageQueue,
|
|
6968
6846
|
timestamp: Date.now()
|
|
@@ -6989,7 +6867,7 @@ var Ai = {
|
|
|
6989
6867
|
clearTimeout(n), t(/* @__PURE__ */ new Error("Channel closed"));
|
|
6990
6868
|
this.pendingRequests.clear(), this.channel?.close?.();
|
|
6991
6869
|
}
|
|
6992
|
-
},
|
|
6870
|
+
}, Yt = class Jt {
|
|
6993
6871
|
db = null;
|
|
6994
6872
|
dbPromise = null;
|
|
6995
6873
|
options;
|
|
@@ -6998,14 +6876,14 @@ var Ai = {
|
|
|
6998
6876
|
dbName: t.dbName ?? "UniformMessageQueue",
|
|
6999
6877
|
storeName: t.storeName ?? "messages",
|
|
7000
6878
|
maxRetries: t.maxRetries ?? 3,
|
|
7001
|
-
defaultExpirationMs: t.defaultExpirationMs ??
|
|
6879
|
+
defaultExpirationMs: t.defaultExpirationMs ?? 864e5,
|
|
7002
6880
|
fallbackStorageKey: t.fallbackStorageKey ?? "uniform_message_queue"
|
|
7003
6881
|
};
|
|
7004
6882
|
}
|
|
7005
6883
|
async initDB() {
|
|
7006
6884
|
if (this.db) return this.db;
|
|
7007
6885
|
if (this.dbPromise) return this.dbPromise;
|
|
7008
|
-
if (!
|
|
6886
|
+
if (!Jt.isIndexedDBAvailable())
|
|
7009
6887
|
return console.warn("[MessageQueue] IndexedDB not available, using sessionStorage fallback"), null;
|
|
7010
6888
|
this.dbPromise = new Promise((t, n) => {
|
|
7011
6889
|
const s = indexedDB.open(this.options.dbName, 1);
|
|
@@ -7171,19 +7049,19 @@ var Ai = {
|
|
|
7171
7049
|
return !1;
|
|
7172
7050
|
}
|
|
7173
7051
|
}
|
|
7174
|
-
},
|
|
7175
|
-
function
|
|
7052
|
+
}, Ee = /* @__PURE__ */ new Map();
|
|
7053
|
+
function Ts(e) {
|
|
7176
7054
|
const t = e?.dbName ?? "default";
|
|
7177
|
-
return
|
|
7055
|
+
return Ee.has(t) || Ee.set(t, new Yt(e)), Ee.get(t);
|
|
7178
7056
|
}
|
|
7179
|
-
function
|
|
7180
|
-
return new
|
|
7057
|
+
function ki(e) {
|
|
7058
|
+
return new Yt(e);
|
|
7181
7059
|
}
|
|
7182
|
-
var
|
|
7183
|
-
|
|
7060
|
+
var T = /* @__PURE__ */ new Map(), st = !1, Xt = () => {
|
|
7061
|
+
st || (st = !0, chrome?.runtime?.onMessage?.addListener?.((e, t, n) => {
|
|
7184
7062
|
const s = e?.channelName ?? e?.target;
|
|
7185
7063
|
if (!s) return;
|
|
7186
|
-
const r =
|
|
7064
|
+
const r = T.get(s);
|
|
7187
7065
|
if (!r || r.size === 0) return;
|
|
7188
7066
|
const i = {
|
|
7189
7067
|
data: e,
|
|
@@ -7198,20 +7076,20 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7198
7076
|
}
|
|
7199
7077
|
return !0;
|
|
7200
7078
|
}));
|
|
7201
|
-
},
|
|
7079
|
+
}, Zt = class {
|
|
7202
7080
|
channelName;
|
|
7203
7081
|
listeners = /* @__PURE__ */ new Set();
|
|
7204
7082
|
constructor(e) {
|
|
7205
|
-
this.channelName = e,
|
|
7083
|
+
this.channelName = e, Xt();
|
|
7206
7084
|
}
|
|
7207
7085
|
addEventListener(e, t) {
|
|
7208
7086
|
if (e !== "message") return;
|
|
7209
7087
|
this.listeners.add(t);
|
|
7210
|
-
let n =
|
|
7211
|
-
n || (n = /* @__PURE__ */ new Set(),
|
|
7088
|
+
let n = T.get(this.channelName);
|
|
7089
|
+
n || (n = /* @__PURE__ */ new Set(), T.set(this.channelName, n)), n.add(t);
|
|
7212
7090
|
}
|
|
7213
7091
|
removeEventListener(e, t) {
|
|
7214
|
-
e === "message" && (this.listeners.delete(t),
|
|
7092
|
+
e === "message" && (this.listeners.delete(t), T.get(this.channelName)?.delete(t));
|
|
7215
7093
|
}
|
|
7216
7094
|
postMessage(e) {
|
|
7217
7095
|
const t = {
|
|
@@ -7223,10 +7101,10 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7223
7101
|
});
|
|
7224
7102
|
}
|
|
7225
7103
|
close() {
|
|
7226
|
-
for (const e of this.listeners)
|
|
7104
|
+
for (const e of this.listeners) T.get(this.channelName)?.delete(e);
|
|
7227
7105
|
this.listeners.clear();
|
|
7228
7106
|
}
|
|
7229
|
-
},
|
|
7107
|
+
}, Ps = class {
|
|
7230
7108
|
wrappedByOriginal = /* @__PURE__ */ new Map();
|
|
7231
7109
|
wrappedListeners = /* @__PURE__ */ new Set();
|
|
7232
7110
|
channelName;
|
|
@@ -7237,7 +7115,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7237
7115
|
this.channelName = e, this.mode = t?.mode || "broadcast", this.tabFilter = t?.tabFilter, this.tabIdGetter = t?.tabIdGetter || this.getCurrentTabId, this.startListening();
|
|
7238
7116
|
}
|
|
7239
7117
|
startListening() {
|
|
7240
|
-
|
|
7118
|
+
Xt();
|
|
7241
7119
|
}
|
|
7242
7120
|
addEventListener(e, t) {
|
|
7243
7121
|
if (e !== "message" || this.wrappedByOriginal.get(t)) return;
|
|
@@ -7256,13 +7134,13 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7256
7134
|
}
|
|
7257
7135
|
};
|
|
7258
7136
|
this.wrappedByOriginal.set(t, n), this.wrappedListeners.add(n);
|
|
7259
|
-
let s =
|
|
7260
|
-
s || (s = /* @__PURE__ */ new Set(),
|
|
7137
|
+
let s = T.get(this.channelName);
|
|
7138
|
+
s || (s = /* @__PURE__ */ new Set(), T.set(this.channelName, s)), s.add(n);
|
|
7261
7139
|
}
|
|
7262
7140
|
removeEventListener(e, t) {
|
|
7263
7141
|
if (e !== "message") return;
|
|
7264
7142
|
const n = this.wrappedByOriginal.get(t);
|
|
7265
|
-
n && (this.wrappedByOriginal.delete(t), this.wrappedListeners.delete(n),
|
|
7143
|
+
n && (this.wrappedByOriginal.delete(t), this.wrappedListeners.delete(n), T.get(this.channelName)?.delete(n));
|
|
7266
7144
|
}
|
|
7267
7145
|
sendToTab(e, t) {
|
|
7268
7146
|
const n = {
|
|
@@ -7328,10 +7206,10 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7328
7206
|
return this.tabIdGetter ? await this.tabIdGetter() : 0;
|
|
7329
7207
|
}
|
|
7330
7208
|
close() {
|
|
7331
|
-
for (const e of this.wrappedListeners)
|
|
7209
|
+
for (const e of this.wrappedListeners) T.get(this.channelName)?.delete(e);
|
|
7332
7210
|
this.wrappedListeners.clear(), this.wrappedByOriginal.clear();
|
|
7333
7211
|
}
|
|
7334
|
-
},
|
|
7212
|
+
}, Si = class {
|
|
7335
7213
|
port;
|
|
7336
7214
|
channelName;
|
|
7337
7215
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -7366,31 +7244,31 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7366
7244
|
close() {
|
|
7367
7245
|
this.listeners.clear(), this.port?.disconnect?.();
|
|
7368
7246
|
}
|
|
7369
|
-
},
|
|
7247
|
+
}, Ei = async (e) => {
|
|
7370
7248
|
let t;
|
|
7371
7249
|
try {
|
|
7372
7250
|
if (typeof e.script != "string") throw new Error("Chrome extension worker channel requires config.script to be a string path");
|
|
7373
7251
|
t = new Worker(chrome.runtime.getURL(e.script), e.options);
|
|
7374
7252
|
} catch {
|
|
7375
|
-
typeof e.script == "string" ? t = new Worker(
|
|
7253
|
+
typeof e.script == "string" ? t = new Worker(P(e.script), e.options) : typeof e.script == "function" ? t = e.script() : t = e.script;
|
|
7376
7254
|
}
|
|
7377
|
-
const n = await
|
|
7255
|
+
const n = await G(e.name, {}, t);
|
|
7378
7256
|
return n?.remote ?? n;
|
|
7379
|
-
},
|
|
7380
|
-
const t =
|
|
7381
|
-
return t?.remote ?? t;
|
|
7382
|
-
}, Fs = (e, t) => {
|
|
7383
|
-
const n = X(e, {}, new $s(e, t));
|
|
7257
|
+
}, Ii = (e) => new Zt(e), Ti = (e) => {
|
|
7258
|
+
const t = new Zt(e), n = G(e, {}, t);
|
|
7384
7259
|
return n?.remote ?? n;
|
|
7385
|
-
},
|
|
7260
|
+
}, Ms = (e, t) => {
|
|
7261
|
+
const n = new Ps(e, t), s = G(e, {}, n);
|
|
7262
|
+
return s?.remote ?? s;
|
|
7263
|
+
}, Pi = (e, t) => Ms(e, t), Mi = (e = "$host$") => Oe(e ?? "$host$"), Ai = (e, t) => new Es(e, t), As = async (e) => ({
|
|
7386
7264
|
async request(t, n = []) {
|
|
7387
7265
|
return new Promise((s, r) => {
|
|
7388
|
-
const i = new BroadcastChannel(`${e.name}-sw-channel`), o =
|
|
7266
|
+
const i = new BroadcastChannel(`${e.name}-sw-channel`), o = h(), a = setTimeout(() => {
|
|
7389
7267
|
i.close(), r(/* @__PURE__ */ new Error(`Service worker request timeout: ${t}`));
|
|
7390
7268
|
}, 1e4);
|
|
7391
7269
|
i.onmessage = (c) => {
|
|
7392
|
-
const { id: l, result:
|
|
7393
|
-
l === o && (clearTimeout(a), i.close(), p ? r(new Error(p)) : s(
|
|
7270
|
+
const { id: l, result: u, error: p } = c.data;
|
|
7271
|
+
l === o && (clearTimeout(a), i.close(), p ? r(new Error(p)) : s(u));
|
|
7394
7272
|
}, i.postMessage({
|
|
7395
7273
|
id: o,
|
|
7396
7274
|
type: "request",
|
|
@@ -7401,80 +7279,83 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7401
7279
|
},
|
|
7402
7280
|
close() {
|
|
7403
7281
|
}
|
|
7404
|
-
}),
|
|
7282
|
+
}), en = async (e) => {
|
|
7405
7283
|
const t = e.context;
|
|
7406
|
-
if (t === "service-worker") return
|
|
7284
|
+
if (t === "service-worker") return As(e);
|
|
7407
7285
|
let n;
|
|
7408
7286
|
if (typeof e.script == "function") n = e.script();
|
|
7409
7287
|
else if (e.script instanceof Worker) n = e.script;
|
|
7410
7288
|
else if (t === "chrome-extension") try {
|
|
7411
7289
|
n = new Worker(chrome.runtime.getURL(e.script), e.options);
|
|
7412
7290
|
} catch {
|
|
7413
|
-
n = new Worker(
|
|
7414
|
-
}
|
|
7415
|
-
else n = new Worker(
|
|
7416
|
-
return await
|
|
7417
|
-
},
|
|
7418
|
-
const
|
|
7419
|
-
return
|
|
7291
|
+
n = new Worker(P(e.script), e.options);
|
|
7292
|
+
}
|
|
7293
|
+
else n = new Worker(P(e.script), e.options);
|
|
7294
|
+
return await G(e.name, {}, n);
|
|
7295
|
+
}, Ri = async (e, t) => {
|
|
7296
|
+
const n = await en(e);
|
|
7297
|
+
return new Kt(n, t);
|
|
7298
|
+
}, Rs = (e, t, n) => {
|
|
7299
|
+
const s = new Kt(null, t, n);
|
|
7300
|
+
return en(e).then((r) => {
|
|
7420
7301
|
s.setChannel(r);
|
|
7421
7302
|
}).catch((r) => {
|
|
7422
7303
|
console.error("[createQueuedOptimizedWorkerChannel] Failed to create base channel:", r), s.close();
|
|
7423
7304
|
}), s;
|
|
7424
|
-
},
|
|
7305
|
+
}, qs = /* @__PURE__ */ new Set([
|
|
7425
7306
|
"invoke",
|
|
7426
7307
|
"mail",
|
|
7427
7308
|
"attach",
|
|
7428
7309
|
"deliver",
|
|
7429
7310
|
"defer"
|
|
7430
|
-
]),
|
|
7311
|
+
]), Ns = /* @__PURE__ */ new Set([
|
|
7431
7312
|
"request",
|
|
7432
7313
|
"response",
|
|
7433
7314
|
"invoke",
|
|
7434
7315
|
"ack",
|
|
7435
7316
|
"act",
|
|
7436
7317
|
"ask"
|
|
7437
|
-
]),
|
|
7318
|
+
]), rt = "mail", k = (e) => String(e ?? "").trim(), Os = (e) => {
|
|
7438
7319
|
if (!e) return;
|
|
7439
|
-
const t = (Array.isArray(e) ? e : [e]).map(
|
|
7320
|
+
const t = (Array.isArray(e) ? e : [e]).map(k).filter(Boolean);
|
|
7440
7321
|
return t.length > 0 ? t : void 0;
|
|
7441
|
-
},
|
|
7322
|
+
}, Ds = (e) => {
|
|
7442
7323
|
if (e != null)
|
|
7443
7324
|
return Array.isArray(e) ? e : [e];
|
|
7444
|
-
},
|
|
7325
|
+
}, Ls = (e) => {
|
|
7445
7326
|
if (e != null)
|
|
7446
7327
|
return Array.isArray(e) ? e : [e];
|
|
7447
|
-
},
|
|
7448
|
-
const t = Array.isArray(e) ? e : e ? [e] : [
|
|
7449
|
-
for (const s of t)
|
|
7450
|
-
return n.length > 0 ? n : [
|
|
7451
|
-
},
|
|
7452
|
-
const t =
|
|
7453
|
-
if (
|
|
7454
|
-
const n =
|
|
7328
|
+
}, Bs = (e) => {
|
|
7329
|
+
const t = Array.isArray(e) ? e : e ? [e] : [rt], n = [];
|
|
7330
|
+
for (const s of t) qs.has(s) && !n.includes(s) && n.push(s);
|
|
7331
|
+
return n.length > 0 ? n : [rt];
|
|
7332
|
+
}, Ws = (e) => {
|
|
7333
|
+
const t = k(e.type);
|
|
7334
|
+
if (Ns.has(t)) return t;
|
|
7335
|
+
const n = k(e.op);
|
|
7455
7336
|
return n === "get" || n === "set" || n === "apply" || n === "import" ? "invoke" : e.error ? "response" : "request";
|
|
7456
|
-
},
|
|
7457
|
-
const t =
|
|
7337
|
+
}, $s = (e, t) => e.op ? e.op : t === "invoke" ? "invoke" : t === "act" ? "deliver" : "mail", Fs = (e) => {
|
|
7338
|
+
const t = k(e).toLowerCase();
|
|
7458
7339
|
return t || "unknown";
|
|
7459
|
-
},
|
|
7460
|
-
const t = Number.isFinite(e.timestamp) ? Number(e.timestamp) : Date.now(), n =
|
|
7340
|
+
}, Us = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `uniform_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`, Pe = (e) => {
|
|
7341
|
+
const t = Number.isFinite(e.timestamp) ? Number(e.timestamp) : Date.now(), n = k(e.srcChannel ?? e.source) || "uniform", s = k(e.destination), r = e.dstChannel ?? (s || void 0), i = k(e.uuid ?? e.id) || Us(), o = Ws(e), a = e.payload ?? e.data, c = { ...e.metadata ?? {} };
|
|
7461
7342
|
return {
|
|
7462
|
-
purpose:
|
|
7463
|
-
protocol:
|
|
7343
|
+
purpose: Bs(e.purpose),
|
|
7344
|
+
protocol: Fs(e.protocol),
|
|
7464
7345
|
redirect: !!e.redirect,
|
|
7465
7346
|
flags: { ...e.flags ?? {} },
|
|
7466
7347
|
type: o,
|
|
7467
|
-
path:
|
|
7348
|
+
path: Os(e.path),
|
|
7468
7349
|
result: e.result,
|
|
7469
|
-
args:
|
|
7470
|
-
op:
|
|
7350
|
+
args: Ds(e.args),
|
|
7351
|
+
op: $s(e, o),
|
|
7471
7352
|
error: e.error ? String(e.error) : void 0,
|
|
7472
7353
|
timestamp: t,
|
|
7473
|
-
where:
|
|
7354
|
+
where: k(e.where) || void 0,
|
|
7474
7355
|
uuid: i,
|
|
7475
|
-
bridges: Array.isArray(e.bridges) ? e.bridges.map(
|
|
7356
|
+
bridges: Array.isArray(e.bridges) ? e.bridges.map(k).filter(Boolean) : [],
|
|
7476
7357
|
payload: a,
|
|
7477
|
-
transfer:
|
|
7358
|
+
transfer: Ls(e.transfer),
|
|
7478
7359
|
extension: e.extension,
|
|
7479
7360
|
defer: e.defer,
|
|
7480
7361
|
srcChannel: n,
|
|
@@ -7483,14 +7364,14 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7483
7364
|
source: n,
|
|
7484
7365
|
destination: s || void 0,
|
|
7485
7366
|
data: a,
|
|
7486
|
-
contentType:
|
|
7367
|
+
contentType: k(e.contentType) || void 0,
|
|
7487
7368
|
metadata: c
|
|
7488
7369
|
};
|
|
7489
|
-
},
|
|
7370
|
+
}, js = (e) => {
|
|
7490
7371
|
if (!e || typeof e != "object") return !1;
|
|
7491
7372
|
const t = e;
|
|
7492
7373
|
return typeof t.uuid == "string" && typeof t.srcChannel == "string" && Array.isArray(t.purpose) && typeof t.type == "string";
|
|
7493
|
-
},
|
|
7374
|
+
}, it = (e) => (js(e), Pe(e)), zs = class {
|
|
7494
7375
|
seen = /* @__PURE__ */ new Map();
|
|
7495
7376
|
windowMs;
|
|
7496
7377
|
constructor(e = 300) {
|
|
@@ -7503,12 +7384,12 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7503
7384
|
prune(e) {
|
|
7504
7385
|
for (const [t, n] of this.seen.entries()) e - n > this.windowMs && this.seen.delete(t);
|
|
7505
7386
|
}
|
|
7506
|
-
},
|
|
7387
|
+
}, Hs = class {
|
|
7507
7388
|
storageKey;
|
|
7508
7389
|
maxMessages;
|
|
7509
7390
|
defaultTTLMs;
|
|
7510
7391
|
constructor(e) {
|
|
7511
|
-
this.storageKey = e?.storageKey ?? "uniform-messaging-pending", this.maxMessages = e?.maxMessages ?? 200, this.defaultTTLMs = e?.defaultTTLMs ??
|
|
7392
|
+
this.storageKey = e?.storageKey ?? "uniform-messaging-pending", this.maxMessages = e?.maxMessages ?? 200, this.defaultTTLMs = e?.defaultTTLMs ?? 864e5;
|
|
7512
7393
|
}
|
|
7513
7394
|
read() {
|
|
7514
7395
|
if (typeof window > "u" || typeof localStorage > "u") return [];
|
|
@@ -7554,7 +7435,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7554
7435
|
clear() {
|
|
7555
7436
|
this.write([]);
|
|
7556
7437
|
}
|
|
7557
|
-
},
|
|
7438
|
+
}, tn = class {
|
|
7558
7439
|
handlers = /* @__PURE__ */ new Map();
|
|
7559
7440
|
channels = /* @__PURE__ */ new Map();
|
|
7560
7441
|
workerChannels = /* @__PURE__ */ new Map();
|
|
@@ -7567,10 +7448,10 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7567
7448
|
executionContext;
|
|
7568
7449
|
channelMappings;
|
|
7569
7450
|
componentRegistry = /* @__PURE__ */ new Map();
|
|
7570
|
-
replayGuard = new
|
|
7451
|
+
replayGuard = new zs(300);
|
|
7571
7452
|
localChannelId = "";
|
|
7572
7453
|
constructor(e = {}) {
|
|
7573
|
-
this.executionContext =
|
|
7454
|
+
this.executionContext = Ne(), this.localChannelId = `${this.executionContext}:${Math.random().toString(36).slice(2, 10)}`, this.channelMappings = e.channelMappings ?? {}, this.messageQueue = Ts(e.queueOptions), this.pendingStore = new Hs(e.pendingStoreOptions), this.setupGlobalListeners();
|
|
7574
7455
|
}
|
|
7575
7456
|
registerHandler(e, t) {
|
|
7576
7457
|
this.handlers.has(e) || this.handlers.set(e, []), this.handlers.get(e).push(t);
|
|
@@ -7591,7 +7472,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7591
7472
|
})), !1);
|
|
7592
7473
|
}
|
|
7593
7474
|
async processMessage(e) {
|
|
7594
|
-
const t =
|
|
7475
|
+
const t = it(e);
|
|
7595
7476
|
if (!this.replayGuard.accept(t)) return;
|
|
7596
7477
|
const n = t.destination ?? "general", s = this.handlers.get(n) ?? [];
|
|
7597
7478
|
for (const r of s) if (r.canHandle(t)) try {
|
|
@@ -7601,7 +7482,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7601
7482
|
}
|
|
7602
7483
|
}
|
|
7603
7484
|
async tryDeliverMessage(e) {
|
|
7604
|
-
const t =
|
|
7485
|
+
const t = it(e);
|
|
7605
7486
|
if (t.destination && this.handlers.has(t.destination))
|
|
7606
7487
|
return await this.processMessage(t), !0;
|
|
7607
7488
|
const n = this.getChannelForDestination(t.destination);
|
|
@@ -7627,7 +7508,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7627
7508
|
console.log(`[UnifiedMessaging] Skipping worker '${s.name}' in ${this.executionContext} context`);
|
|
7628
7509
|
continue;
|
|
7629
7510
|
}
|
|
7630
|
-
const r =
|
|
7511
|
+
const r = Rs({
|
|
7631
7512
|
name: s.name,
|
|
7632
7513
|
script: s.script,
|
|
7633
7514
|
options: s.options,
|
|
@@ -7700,7 +7581,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7700
7581
|
for (const i of n.stages) {
|
|
7701
7582
|
const o = i.timeout ?? r, a = i.retries ?? 0;
|
|
7702
7583
|
for (let c = 0; c <= a; c++) try {
|
|
7703
|
-
s = await Promise.race([i.handler(s), new Promise((l,
|
|
7584
|
+
s = await Promise.race([i.handler(s), new Promise((l, u) => setTimeout(() => u(/* @__PURE__ */ new Error(`Stage '${i.name}' timeout`)), o))]);
|
|
7704
7585
|
break;
|
|
7705
7586
|
} catch (l) {
|
|
7706
7587
|
if (c === a)
|
|
@@ -7768,7 +7649,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7768
7649
|
if (this.executionContext === "chrome-extension") return "chrome-extension";
|
|
7769
7650
|
}
|
|
7770
7651
|
toProtocolMessage(e, t) {
|
|
7771
|
-
return
|
|
7652
|
+
return Pe({
|
|
7772
7653
|
...e,
|
|
7773
7654
|
id: e.id,
|
|
7774
7655
|
type: e.type ?? "unknown",
|
|
@@ -7786,7 +7667,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7786
7667
|
});
|
|
7787
7668
|
}
|
|
7788
7669
|
isWorkerSupported(e) {
|
|
7789
|
-
return this.executionContext === "service-worker" ? !0 : this.executionContext === "chrome-extension" ?
|
|
7670
|
+
return this.executionContext === "service-worker" ? !0 : this.executionContext === "chrome-extension" ? Mn() : !0;
|
|
7790
7671
|
}
|
|
7791
7672
|
setupGlobalListeners() {
|
|
7792
7673
|
typeof window < "u" && globalThis.addEventListener("message", (e) => {
|
|
@@ -7811,26 +7692,26 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7811
7692
|
for (const e of this.channels.values()) (e instanceof BroadcastChannel || e && "close" in e) && e.close();
|
|
7812
7693
|
this.channels.clear(), this.workerChannels.clear(), this.handlers.clear(), this.pipelines.clear();
|
|
7813
7694
|
}
|
|
7814
|
-
},
|
|
7815
|
-
function
|
|
7816
|
-
return
|
|
7695
|
+
}, z = null;
|
|
7696
|
+
function Qe(e) {
|
|
7697
|
+
return z || (z = new tn(e)), z;
|
|
7817
7698
|
}
|
|
7818
|
-
function
|
|
7819
|
-
return new
|
|
7699
|
+
function qi(e) {
|
|
7700
|
+
return new tn(e);
|
|
7820
7701
|
}
|
|
7821
|
-
function
|
|
7822
|
-
|
|
7702
|
+
function Ni() {
|
|
7703
|
+
z && (z.destroy(), z = null);
|
|
7823
7704
|
}
|
|
7824
|
-
function
|
|
7825
|
-
return
|
|
7705
|
+
function Oi(e) {
|
|
7706
|
+
return Qe().sendMessage(e);
|
|
7826
7707
|
}
|
|
7827
|
-
function
|
|
7828
|
-
|
|
7708
|
+
function Di(e, t) {
|
|
7709
|
+
Qe().registerHandler(e, t);
|
|
7829
7710
|
}
|
|
7830
|
-
function
|
|
7831
|
-
return
|
|
7711
|
+
function Li(e) {
|
|
7712
|
+
return Qe().getBroadcastChannel(e);
|
|
7832
7713
|
}
|
|
7833
|
-
var
|
|
7714
|
+
var nn = class {
|
|
7834
7715
|
channels = /* @__PURE__ */ new Map();
|
|
7835
7716
|
readyPromises = /* @__PURE__ */ new Map();
|
|
7836
7717
|
messageHandlers = /* @__PURE__ */ new Map();
|
|
@@ -7838,7 +7719,7 @@ var un = class {
|
|
|
7838
7719
|
executionContext;
|
|
7839
7720
|
logPrefix;
|
|
7840
7721
|
constructor(e = {}) {
|
|
7841
|
-
this.channelConfigs = e.channels ?? {}, this.logPrefix = e.logPrefix ?? "[ServiceChannels]", this.executionContext =
|
|
7722
|
+
this.channelConfigs = e.channels ?? {}, this.logPrefix = e.logPrefix ?? "[ServiceChannels]", this.executionContext = Ne(), console.log(`${this.logPrefix} Initialized in ${this.executionContext} context`);
|
|
7842
7723
|
}
|
|
7843
7724
|
registerConfigs(e) {
|
|
7844
7725
|
this.channelConfigs = {
|
|
@@ -7946,24 +7827,24 @@ var un = class {
|
|
|
7946
7827
|
return this.executionContext;
|
|
7947
7828
|
}
|
|
7948
7829
|
};
|
|
7949
|
-
function
|
|
7950
|
-
return new
|
|
7830
|
+
function Bi(e) {
|
|
7831
|
+
return new nn(e);
|
|
7951
7832
|
}
|
|
7952
|
-
var
|
|
7953
|
-
function
|
|
7954
|
-
return
|
|
7833
|
+
var O = null;
|
|
7834
|
+
function Wi(e) {
|
|
7835
|
+
return O ? e?.channels && O.registerConfigs(e.channels) : O = new nn(e), O;
|
|
7955
7836
|
}
|
|
7956
|
-
function
|
|
7957
|
-
|
|
7837
|
+
function $i() {
|
|
7838
|
+
O && (O.closeAll(), O = null);
|
|
7958
7839
|
}
|
|
7959
|
-
function
|
|
7960
|
-
const s = /* @__PURE__ */ new Map(), r =
|
|
7840
|
+
function Fi(e, t, n) {
|
|
7841
|
+
const s = /* @__PURE__ */ new Map(), r = g(e);
|
|
7961
7842
|
return (i) => {
|
|
7962
|
-
const o = (l) => l.type === "response" && l.reqId ? (
|
|
7843
|
+
const o = (l) => l.type === "response" && l.reqId ? (u) => {
|
|
7963
7844
|
const p = s.get(l.reqId);
|
|
7964
|
-
p && (p.resolve(
|
|
7965
|
-
} : l.type === "request" ? (
|
|
7966
|
-
...
|
|
7845
|
+
p && (p.resolve(u), s.delete(l.reqId));
|
|
7846
|
+
} : l.type === "request" ? (u, p) => r({
|
|
7847
|
+
...u,
|
|
7967
7848
|
channel: l.sender,
|
|
7968
7849
|
sender: t,
|
|
7969
7850
|
type: "response",
|
|
@@ -7971,25 +7852,25 @@ function Ji(e, t, n) {
|
|
|
7971
7852
|
}, p) : r, c = m(e, (l) => {
|
|
7972
7853
|
if (i.active) {
|
|
7973
7854
|
if (l.type === "response" && l.reqId) {
|
|
7974
|
-
const
|
|
7975
|
-
|
|
7855
|
+
const u = s.get(l.reqId);
|
|
7856
|
+
u && (u.resolve(l.payload), s.delete(l.reqId));
|
|
7976
7857
|
}
|
|
7977
7858
|
n ? n(l, o(l)) : i.next(l);
|
|
7978
7859
|
}
|
|
7979
7860
|
}, (l) => i.error(l), () => i.complete());
|
|
7980
7861
|
return i.request = (l) => {
|
|
7981
|
-
const
|
|
7982
|
-
return l.reqId =
|
|
7983
|
-
s.set(
|
|
7862
|
+
const u = l.reqId ?? h();
|
|
7863
|
+
return l.reqId = u, new Promise((p, y) => {
|
|
7864
|
+
s.set(u, {
|
|
7984
7865
|
resolve: p,
|
|
7985
|
-
reject:
|
|
7866
|
+
reject: y,
|
|
7986
7867
|
timestamp: Date.now()
|
|
7987
7868
|
}), r(l);
|
|
7988
7869
|
});
|
|
7989
7870
|
}, c;
|
|
7990
7871
|
};
|
|
7991
7872
|
}
|
|
7992
|
-
var
|
|
7873
|
+
var Ui = class {
|
|
7993
7874
|
_transport;
|
|
7994
7875
|
_channelName;
|
|
7995
7876
|
_pending = /* @__PURE__ */ new Map();
|
|
@@ -7998,7 +7879,7 @@ var Xi = class {
|
|
|
7998
7879
|
_send;
|
|
7999
7880
|
_active = !1;
|
|
8000
7881
|
constructor(e, t) {
|
|
8001
|
-
this._transport = e, this._channelName = t, this._send =
|
|
7882
|
+
this._transport = e, this._channelName = t, this._send = g(e);
|
|
8002
7883
|
}
|
|
8003
7884
|
subscribe(e) {
|
|
8004
7885
|
return this._subs.add(e), this._active || this._activate(), { unsubscribe: () => {
|
|
@@ -8009,7 +7890,7 @@ var Xi = class {
|
|
|
8009
7890
|
this._send(e, t);
|
|
8010
7891
|
}
|
|
8011
7892
|
request(e) {
|
|
8012
|
-
const t = e.reqId ??
|
|
7893
|
+
const t = e.reqId ?? h();
|
|
8013
7894
|
return new Promise((n, s) => {
|
|
8014
7895
|
this._pending.set(t, {
|
|
8015
7896
|
resolve: n,
|
|
@@ -8038,19 +7919,19 @@ var Xi = class {
|
|
|
8038
7919
|
this._cleanup?.(), this._cleanup = null, this._active = !1;
|
|
8039
7920
|
}
|
|
8040
7921
|
};
|
|
8041
|
-
function
|
|
7922
|
+
function ji(e, t = {}) {
|
|
8042
7923
|
return async (n, s) => {
|
|
8043
7924
|
if (n.type !== "request" || n.channel !== e) return;
|
|
8044
7925
|
t.onRequest?.(n.payload);
|
|
8045
|
-
const r = await
|
|
7926
|
+
const r = await De(n.payload, n.reqId, e);
|
|
8046
7927
|
r && (t.onResponse?.(r.response), s({
|
|
8047
7928
|
...r.response,
|
|
8048
|
-
id:
|
|
7929
|
+
id: h(),
|
|
8049
7930
|
timestamp: Date.now()
|
|
8050
7931
|
}, r.transfer));
|
|
8051
7932
|
};
|
|
8052
7933
|
}
|
|
8053
|
-
var
|
|
7934
|
+
var zi = class {
|
|
8054
7935
|
_channelName;
|
|
8055
7936
|
_targetChannel;
|
|
8056
7937
|
_pending = /* @__PURE__ */ new Map();
|
|
@@ -8073,8 +7954,8 @@ var eo = class {
|
|
|
8073
7954
|
}
|
|
8074
7955
|
dispatch(e, t, n) {
|
|
8075
7956
|
if (!this._subscriber?.active) return Promise.reject(/* @__PURE__ */ new Error("Not connected"));
|
|
8076
|
-
const s =
|
|
8077
|
-
id:
|
|
7957
|
+
const s = h(), r = {
|
|
7958
|
+
id: h(),
|
|
8078
7959
|
channel: this._targetChannel,
|
|
8079
7960
|
sender: this._channelName,
|
|
8080
7961
|
type: "request",
|
|
@@ -8094,11 +7975,11 @@ var eo = class {
|
|
|
8094
7975
|
}));
|
|
8095
7976
|
return this._subscriber.next(r), i;
|
|
8096
7977
|
}
|
|
8097
|
-
},
|
|
8098
|
-
const r =
|
|
8099
|
-
return await r?.createRemoteChannel(e, t, n),
|
|
8100
|
-
},
|
|
8101
|
-
const n =
|
|
7978
|
+
}, Hi = async (e, t = {}, n = null) => G(e, t, n ?? (typeof self < "u" ? self : null)), Gi = async (e, t, n = {}, s = typeof self < "u" ? self : null) => (await G(e, n?.channelOptions, s))?.doImportModule?.(t, n?.importOptions), Qi = ne, Vi = ns, Ki = ss, Yi = rs, Ji = async (e, t = {}, n = typeof self < "u" ? self : null, s = "$host$") => {
|
|
7979
|
+
const r = St(s ?? "$host$");
|
|
7980
|
+
return await r?.createRemoteChannel(e, t, n), wt(e, r ?? w?.instance);
|
|
7981
|
+
}, Xi = (e, t = {}) => {
|
|
7982
|
+
const n = Ne();
|
|
8102
7983
|
return n !== "chrome-extension" ? {
|
|
8103
7984
|
async request(s) {
|
|
8104
7985
|
throw new Error(`Chrome extension messaging not available in ${n}`);
|
|
@@ -8132,286 +8013,286 @@ var eo = class {
|
|
|
8132
8013
|
};
|
|
8133
8014
|
};
|
|
8134
8015
|
export {
|
|
8135
|
-
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8148
|
-
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8016
|
+
Rr as $createOrUseExistingChannel,
|
|
8017
|
+
Q as $descriptor,
|
|
8018
|
+
qn as $requestHandler,
|
|
8019
|
+
xs as AbstractTransport,
|
|
8020
|
+
F as AtomicsBuffer,
|
|
8021
|
+
Ht as AtomicsRingBuffer,
|
|
8022
|
+
se as AtomicsTransport,
|
|
8023
|
+
pi as AtomicsTransportFactory,
|
|
8024
|
+
wn as BidirectionalInvoker,
|
|
8025
|
+
is as BroadcastChannelObservable,
|
|
8026
|
+
Un as BroadcastChannelTransport,
|
|
8027
|
+
we as CHANNEL_MAP,
|
|
8028
|
+
Bn as ChannelConnection,
|
|
8029
|
+
Nt as ChannelContext,
|
|
8030
|
+
An as ChannelHandler,
|
|
8031
|
+
Ui as ChannelMessageObservable,
|
|
8032
|
+
v as ChannelNativeObservable,
|
|
8033
|
+
ln as ChannelObservable,
|
|
8034
|
+
Xn as ChannelStorage,
|
|
8154
8035
|
_ as ChannelSubject,
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
|
|
8215
|
-
|
|
8216
|
-
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8036
|
+
Zn as ChannelTransaction,
|
|
8037
|
+
Zt as ChromeExtensionBroadcastChannel,
|
|
8038
|
+
Si as ChromeExtensionPortChannel,
|
|
8039
|
+
Ps as ChromeExtensionTabsChannel,
|
|
8040
|
+
Ft as ChromeExternalObservable,
|
|
8041
|
+
Qn as ChromeExternalTransport,
|
|
8042
|
+
oi as ChromeObservableFactory,
|
|
8043
|
+
Fe as ChromePortObservable,
|
|
8044
|
+
Gn as ChromePortTransport,
|
|
8045
|
+
We as ChromeRuntimeObservable,
|
|
8046
|
+
zn as ChromeRuntimeTransport,
|
|
8047
|
+
$e as ChromeTabsObservable,
|
|
8048
|
+
Hn as ChromeTabsTransport,
|
|
8049
|
+
Wn as ConnectionPool,
|
|
8050
|
+
yn as DefaultReflect,
|
|
8051
|
+
mr as DispatchHandler,
|
|
8052
|
+
mr as DispatchProxyHandler,
|
|
8053
|
+
Js as MessageObservable,
|
|
8054
|
+
Ce as MessagePortObservable,
|
|
8055
|
+
Fn as MessagePortTransport,
|
|
8056
|
+
Yt as MessageQueue,
|
|
8057
|
+
Vt as MessageQueueStorage,
|
|
8058
|
+
v as Observable,
|
|
8059
|
+
An as ObservableChannelHandler,
|
|
8060
|
+
dr as ObservableFactory,
|
|
8061
|
+
zi as ObservableRequestDispatcher,
|
|
8062
|
+
Kt as OptimizedWorkerChannel,
|
|
8063
|
+
_t as PROXY_INTERNALS,
|
|
8064
|
+
pt as PROXY_MARKER,
|
|
8065
|
+
Hs as PendingMessageStore,
|
|
8066
|
+
Qt as PortPool,
|
|
8067
|
+
B as PortTransport,
|
|
8068
|
+
gi as PortTransportFactory,
|
|
8069
|
+
zs as ProtocolReplayGuard,
|
|
8070
|
+
Sn as ProxyBuilder,
|
|
8071
|
+
Es as QueuedWorkerChannel,
|
|
8072
|
+
qr as READ,
|
|
8073
|
+
je as RTCPeerManager,
|
|
8074
|
+
ge as RTCPeerTransport,
|
|
8075
|
+
_i as RTCTransportFactory,
|
|
8076
|
+
kt as RemoteChannelHelper,
|
|
8077
|
+
ye as RemoteChannels,
|
|
8078
|
+
Cn as RemoteProxyHandler,
|
|
8079
|
+
Ys as ReplayChannelSubject,
|
|
8080
|
+
dt as Requestor,
|
|
8081
|
+
ft as Responder,
|
|
8082
|
+
w as SELF_CHANNEL,
|
|
8083
|
+
ds as SelfObservable,
|
|
8084
|
+
Kn as SelfTransport,
|
|
8085
|
+
nn as ServiceChannelManager,
|
|
8086
|
+
Ge as ServiceWorkerClient,
|
|
8087
|
+
hs as ServiceWorkerClientObservable,
|
|
8088
|
+
He as ServiceWorkerHost,
|
|
8089
|
+
us as ServiceWorkerHostObservable,
|
|
8090
|
+
Vn as ServiceWorkerTransport,
|
|
8091
|
+
me as SharedWorkerClient,
|
|
8092
|
+
Ue as SharedWorkerHost,
|
|
8093
|
+
di as SharedWorkerObservableFactory,
|
|
8094
|
+
_e as SocketIOObservable,
|
|
8095
|
+
ci as SocketIOObservableFactory,
|
|
8096
|
+
fs as SocketIORoomObservable,
|
|
8097
|
+
ze as TransferableStorage,
|
|
8098
|
+
bi as TransferableStorageFactory,
|
|
8099
|
+
E as TransportAdapter,
|
|
8100
|
+
ls as TransportChromePortObservable,
|
|
8101
|
+
as as TransportChromeRuntimeObservable,
|
|
8102
|
+
cs as TransportChromeTabsObservable,
|
|
8103
|
+
Ks as TransportCoreFactory,
|
|
8104
|
+
Or as TransportFactory,
|
|
8105
|
+
I as TransportObservable,
|
|
8106
|
+
Kr as TransportObservableFactory,
|
|
8107
|
+
yt as UnifiedChannel,
|
|
8108
|
+
tn as UnifiedMessagingManager,
|
|
8109
|
+
vi as UnifiedTransportFactory,
|
|
8229
8110
|
d as WReflectAction,
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
|
|
8233
|
-
|
|
8234
|
-
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8240
|
-
|
|
8241
|
-
|
|
8242
|
-
|
|
8243
|
-
|
|
8244
|
-
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
|
|
8287
|
-
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
|
|
8292
|
-
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
|
|
8296
|
-
|
|
8297
|
-
|
|
8298
|
-
|
|
8111
|
+
Qs as WStatus,
|
|
8112
|
+
Vs as WType,
|
|
8113
|
+
os as WebSocketObservable,
|
|
8114
|
+
jn as WebSocketTransport,
|
|
8115
|
+
Te as WindowPortConnector,
|
|
8116
|
+
Bt as WorkerContext,
|
|
8117
|
+
Ze as WorkerObservable,
|
|
8118
|
+
$n as WorkerTransport,
|
|
8119
|
+
jr as addBroadcastChannel,
|
|
8120
|
+
Ur as addPortChannel,
|
|
8121
|
+
zr as addSelfChannelToDefault,
|
|
8122
|
+
Fr as addWorkerChannel,
|
|
8123
|
+
_r as autoInvoker,
|
|
8124
|
+
Cs as bindServiceWorkerHostBridge,
|
|
8125
|
+
Mt as buildResponse,
|
|
8126
|
+
Lr as closeAllStorage,
|
|
8127
|
+
kr as closeUnifiedChannel,
|
|
8128
|
+
Ji as connectToChannelAsModule,
|
|
8129
|
+
zt as createAtomicsChannelPair,
|
|
8130
|
+
mn as createBidirectionalChannel,
|
|
8131
|
+
Yr as createBidirectionalTransport,
|
|
8132
|
+
Gt as createBroadcastSignaling,
|
|
8133
|
+
ht as createBroadcastTransport,
|
|
8134
|
+
ne as createChannelContext,
|
|
8135
|
+
be as createChannelPair,
|
|
8136
|
+
ji as createChannelRequestHandler,
|
|
8137
|
+
ss as createChannelsInContext,
|
|
8138
|
+
Ii as createChromeExtensionBroadcast,
|
|
8139
|
+
Ti as createChromeExtensionBroadcastChannel,
|
|
8140
|
+
Ei as createChromeExtensionChannel,
|
|
8141
|
+
Xi as createChromeExtensionRuntimeChannel,
|
|
8142
|
+
Ms as createChromeExtensionTabsChannel,
|
|
8143
|
+
Pi as createChromeExtensionTabsMessagingChannel,
|
|
8144
|
+
cn as createChromeListener,
|
|
8145
|
+
ii as createChromeRequestHandler,
|
|
8146
|
+
ct as createChromeTabsListener,
|
|
8147
|
+
Dr as createConnectionObserver,
|
|
8148
|
+
Qi as createContext,
|
|
8149
|
+
Vr as createDefaultChannelPair,
|
|
8150
|
+
xn as createExposeHandler,
|
|
8151
|
+
mi as createFromPort,
|
|
8152
|
+
St as createHostChannel,
|
|
8153
|
+
ni as createHostProxy,
|
|
8154
|
+
qe as createInvoker,
|
|
8155
|
+
Ve as createInvokerObservable,
|
|
8156
|
+
sr as createMessageId,
|
|
8157
|
+
ki as createMessageQueue,
|
|
8158
|
+
Ki as createMultiChannel,
|
|
8159
|
+
Pr as createObservableChannel,
|
|
8160
|
+
Ri as createOptimizedWorkerChannel,
|
|
8161
|
+
G as createOrUseExistingChannel,
|
|
8162
|
+
ws as createPortProxy,
|
|
8163
|
+
Pe as createProtocolEnvelope,
|
|
8164
|
+
Rs as createQueuedOptimizedWorkerChannel,
|
|
8165
|
+
Ai as createQueuedWorkerChannel,
|
|
8166
|
+
hn as createReflectHandler,
|
|
8167
|
+
ee as createRemoteProxy,
|
|
8168
|
+
fr as createRequestor,
|
|
8169
|
+
vn as createResponder,
|
|
8170
|
+
kn as createSenderProxy,
|
|
8171
|
+
Bi as createServiceChannelManager,
|
|
8172
|
+
As as createServiceWorkerChannel,
|
|
8173
|
+
wi as createServiceWorkerClient,
|
|
8174
|
+
yi as createServiceWorkerHost,
|
|
8175
|
+
ui as createSharedWorkerHostObservable,
|
|
8176
|
+
hi as createSharedWorkerObservable,
|
|
8177
|
+
li as createSocketObservable,
|
|
8178
|
+
ai as createSocketRequestHandler,
|
|
8179
|
+
$ as createTransport,
|
|
8299
8180
|
m as createTransportListener,
|
|
8300
|
-
|
|
8301
|
-
|
|
8302
|
-
|
|
8303
|
-
|
|
8304
|
-
|
|
8305
|
-
|
|
8306
|
-
|
|
8307
|
-
|
|
8308
|
-
|
|
8309
|
-
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
|
|
8314
|
-
|
|
8315
|
-
|
|
8316
|
-
|
|
8317
|
-
|
|
8318
|
-
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
|
|
8323
|
-
|
|
8324
|
-
|
|
8325
|
-
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
|
|
8329
|
-
|
|
8330
|
-
|
|
8331
|
-
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
|
|
8338
|
-
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
|
|
8348
|
-
|
|
8349
|
-
|
|
8350
|
-
|
|
8351
|
-
|
|
8352
|
-
|
|
8353
|
-
|
|
8354
|
-
|
|
8355
|
-
|
|
8356
|
-
|
|
8357
|
-
|
|
8358
|
-
|
|
8359
|
-
|
|
8360
|
-
|
|
8361
|
-
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
-
|
|
8374
|
-
|
|
8375
|
-
|
|
8376
|
-
|
|
8377
|
-
|
|
8378
|
-
|
|
8379
|
-
|
|
8380
|
-
|
|
8381
|
-
|
|
8382
|
-
|
|
8383
|
-
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
|
|
8389
|
-
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
|
|
8181
|
+
g as createTransportSender,
|
|
8182
|
+
S as createUnifiedChannel,
|
|
8183
|
+
vr as createUnifiedChannelPair,
|
|
8184
|
+
qi as createUnifiedMessaging,
|
|
8185
|
+
lt as createWebSocketTransport,
|
|
8186
|
+
fi as createWorkerAtomicsTransport,
|
|
8187
|
+
en as createWorkerChannel,
|
|
8188
|
+
tr as debounce,
|
|
8189
|
+
Hr as deferChannel,
|
|
8190
|
+
fn as delay,
|
|
8191
|
+
Wr as deleteContext,
|
|
8192
|
+
Ye as descMap,
|
|
8193
|
+
H as detectContextType,
|
|
8194
|
+
Ne as detectExecutionContext,
|
|
8195
|
+
bn as detectIncomingContextType,
|
|
8196
|
+
Ke as detectTransport,
|
|
8197
|
+
Z as detectTransportType,
|
|
8198
|
+
Pt as executeAction,
|
|
8199
|
+
Sr as exposeFromUnified,
|
|
8200
|
+
ei as exposeFromWorker,
|
|
8201
|
+
vs as exposeOverPort,
|
|
8202
|
+
ut as filter,
|
|
8203
|
+
un as fromEvent,
|
|
8204
|
+
dn as fromPromise,
|
|
8205
|
+
Li as getBroadcastChannel,
|
|
8206
|
+
Qr as getChannelFromDefault,
|
|
8207
|
+
Rt as getChannelStorage,
|
|
8208
|
+
At as getConnection,
|
|
8209
|
+
Le as getConnectionPool,
|
|
8210
|
+
Br as getContext,
|
|
8211
|
+
$r as getContextNames,
|
|
8212
|
+
Is as getCurrentTabId,
|
|
8213
|
+
N as getDefaultContext,
|
|
8214
|
+
Nr as getHostConnection,
|
|
8215
|
+
Ts as getMessageQueue,
|
|
8216
|
+
ns as getOrCreateContext,
|
|
8217
|
+
gr as getProxyDescriptor,
|
|
8218
|
+
br as getProxyInternals,
|
|
8219
|
+
Wi as getServiceChannelManager,
|
|
8220
|
+
Vi as getSharedContext,
|
|
8221
|
+
at as getTransportMeta,
|
|
8222
|
+
Ss as getTransportRegistry,
|
|
8223
|
+
Cr as getUnifiedChannel,
|
|
8224
|
+
xr as getUnifiedChannelNames,
|
|
8225
|
+
Qe as getUnifiedMessaging,
|
|
8226
|
+
Ci as getVisibleTabId,
|
|
8227
|
+
te as getWorkerChannel,
|
|
8228
|
+
Be as getWorkerContext,
|
|
8229
|
+
$t as getWorkerInvoker,
|
|
8230
|
+
Ct as getWorkerResolveBaseUrl,
|
|
8231
|
+
Wt as getWorkerResponder,
|
|
8232
|
+
ue as handMap,
|
|
8233
|
+
De as handleRequest,
|
|
8234
|
+
Dn as hasNoPath,
|
|
8235
|
+
si as importInHost,
|
|
8236
|
+
Yi as importIsolatedModule,
|
|
8237
|
+
Gi as importModuleInChannel,
|
|
8238
|
+
rs as importModuleInContext,
|
|
8239
|
+
Oe as initChannelHandler,
|
|
8240
|
+
Gr as initDeferredChannel,
|
|
8241
|
+
Mi as initMainChannel,
|
|
8242
|
+
Jr as initWorkerContext,
|
|
8243
|
+
pn as interval,
|
|
8244
|
+
Pn as isChromeExtensionContext,
|
|
8245
|
+
js as isProtocolEnvelope,
|
|
8246
|
+
gt as isRemoteProxy,
|
|
8247
|
+
vt as isServiceWorkerContext,
|
|
8248
|
+
Ar as loadWorker,
|
|
8249
|
+
or as makeBroadcastInvoker,
|
|
8250
|
+
Fi as makeChannelMessageHandler,
|
|
8251
|
+
cr as makeChromeRuntimeInvoker,
|
|
8252
|
+
ir as makeMessagePortInvoker,
|
|
8253
|
+
Tr as makeObservableRequestProxy,
|
|
8254
|
+
En as makeRequestProxy,
|
|
8255
|
+
ur as makeSelfInvoker,
|
|
8256
|
+
lr as makeServiceWorkerClientInvoker,
|
|
8257
|
+
hr as makeServiceWorkerHostInvoker,
|
|
8258
|
+
ar as makeWebSocketInvoker,
|
|
8259
|
+
rr as makeWorkerInvoker,
|
|
8260
|
+
Xs as map,
|
|
8261
|
+
_n as merge,
|
|
8262
|
+
it as normalizeProtocolEnvelope,
|
|
8263
|
+
ve as normalizeRef,
|
|
8264
|
+
Rn as objectToRef,
|
|
8265
|
+
Zr as onWorkerChannelCreated,
|
|
8266
|
+
Xr as onWorkerConnection,
|
|
8267
|
+
ti as onWorkerInvocation,
|
|
8268
|
+
yr as proxyBuilder,
|
|
8269
|
+
L as readByPath,
|
|
8270
|
+
Di as registerHandler,
|
|
8271
|
+
xi as registerWorkerAPI,
|
|
8272
|
+
D as registeredInPath,
|
|
8273
|
+
Er as remoteFromUnified,
|
|
8274
|
+
On as removeByData,
|
|
8275
|
+
It as removeByPath,
|
|
8276
|
+
$i as resetServiceChannelManager,
|
|
8277
|
+
Ni as resetUnifiedMessaging,
|
|
8278
|
+
P as resolveWorkerSpecifierHref,
|
|
8279
|
+
Oi as sendMessage,
|
|
8280
|
+
pr as setupInvoker,
|
|
8281
|
+
wr as setupUnifiedChannel,
|
|
8282
|
+
X as storedData,
|
|
8283
|
+
Mn as supportsDedicatedWorkers,
|
|
8284
|
+
Hi as sync,
|
|
8285
|
+
Zs as take,
|
|
8286
|
+
er as takeUntil,
|
|
8287
|
+
nr as throttle,
|
|
8288
|
+
Et as traverseByPath,
|
|
8289
|
+
Nn as unwrapDescriptorFromProxy,
|
|
8290
|
+
ie as unwrapDescriptorFromProxyRecursive,
|
|
8291
|
+
gn as when,
|
|
8292
|
+
ri as workerContext,
|
|
8293
|
+
wt as wrapChannel,
|
|
8294
|
+
mt as wrapDescriptor,
|
|
8295
|
+
de as wrapMap,
|
|
8296
|
+
Ir as wrapObservableChannel,
|
|
8297
|
+
fe as writeByPath
|
|
8417
8298
|
};
|