@fest-lib/uniform 0.1.1 → 0.1.3
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/uniform.js +752 -861
- package/package.json +6 -3
package/dist/uniform.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
1
|
+
var sr = /* @__PURE__ */ (function(e) {
|
|
2
2
|
return e.SUCCESS = "success", e.ERROR = "error", e;
|
|
3
|
-
})({}),
|
|
3
|
+
})({}), rr = /* @__PURE__ */ (function(e) {
|
|
4
4
|
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
5
|
})({}), d = /* @__PURE__ */ (function(e) {
|
|
6
6
|
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;
|
|
@@ -134,7 +134,7 @@ function dt(e) {
|
|
|
134
134
|
}[t]
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function y(e, t) {
|
|
138
138
|
return (n, s) => {
|
|
139
139
|
const r = s ?? n?.transferable ?? [], { transferable: i, ...o } = n;
|
|
140
140
|
if (e instanceof Worker) {
|
|
@@ -243,8 +243,8 @@ function m(e, t, n, s, r) {
|
|
|
243
243
|
}
|
|
244
244
|
if (e === "chrome-tabs" && typeof chrome < "u" && chrome.runtime) {
|
|
245
245
|
const c = r?.tabId;
|
|
246
|
-
if (c != null) return ft(c, (
|
|
247
|
-
const l = (
|
|
246
|
+
if (c != null) return ft(c, (h) => t(h));
|
|
247
|
+
const l = (h) => (t(h), !1);
|
|
248
248
|
return chrome.runtime.onMessage.addListener(l), () => chrome.runtime.onMessage.removeListener(l);
|
|
249
249
|
}
|
|
250
250
|
if (e === "chrome-port" && typeof chrome < "u" && chrome.runtime) {
|
|
@@ -262,10 +262,10 @@ function m(e, t, n, s, r) {
|
|
|
262
262
|
return navigator.serviceWorker.addEventListener("message", i), () => navigator.serviceWorker.removeEventListener("message", i);
|
|
263
263
|
if (e === "service-worker-host" || e === "self") {
|
|
264
264
|
const c = (l) => {
|
|
265
|
-
const
|
|
266
|
-
t(
|
|
265
|
+
const h = e === "service-worker-host" ? l.source?.id : void 0;
|
|
266
|
+
t(h ? {
|
|
267
267
|
...l.data,
|
|
268
|
-
_clientId:
|
|
268
|
+
_clientId: h
|
|
269
269
|
} : l.data);
|
|
270
270
|
};
|
|
271
271
|
return self.addEventListener("message", c), () => self.removeEventListener("message", c);
|
|
@@ -304,12 +304,12 @@ function pt(e, t = {}) {
|
|
|
304
304
|
socket: n,
|
|
305
305
|
send: i,
|
|
306
306
|
listen: (c) => {
|
|
307
|
-
const l = (
|
|
308
|
-
if (typeof
|
|
309
|
-
c(JSON.parse(
|
|
307
|
+
const l = (h) => {
|
|
308
|
+
if (typeof h.data == "string") try {
|
|
309
|
+
c(JSON.parse(h.data));
|
|
310
310
|
} catch {
|
|
311
311
|
}
|
|
312
|
-
else c(
|
|
312
|
+
else c(h.data);
|
|
313
313
|
};
|
|
314
314
|
return n.addEventListener("message", l), () => n.removeEventListener("message", l);
|
|
315
315
|
},
|
|
@@ -329,8 +329,8 @@ function _t(e) {
|
|
|
329
329
|
close: () => t.close()
|
|
330
330
|
};
|
|
331
331
|
}
|
|
332
|
-
var
|
|
333
|
-
createSender:
|
|
332
|
+
var ir = {
|
|
333
|
+
createSender: y,
|
|
334
334
|
createListener: m,
|
|
335
335
|
detectType: ie,
|
|
336
336
|
getMeta: dt,
|
|
@@ -340,127 +340,18 @@ var cr = {
|
|
|
340
340
|
},
|
|
341
341
|
websocket: pt,
|
|
342
342
|
broadcast: _t
|
|
343
|
-
}
|
|
344
|
-
function _n() {
|
|
345
|
-
const e = globalThis;
|
|
346
|
-
if (typeof e.HTMLElement == "function") return;
|
|
347
|
-
const t = class {
|
|
348
|
-
}, n = (s) => {
|
|
349
|
-
typeof e[s] != "function" && (e[s] = t);
|
|
350
|
-
};
|
|
351
|
-
n("EventTarget"), n("Node"), n("Element"), n("HTMLElement"), n("SVGElement"), n("Text"), n("Comment"), n("DocumentFragment"), n("ShadowRoot"), n("HTMLDocument"), n("Document"), n("HTMLBodyElement"), n("HTMLHeadElement"), n("HTMLCanvasElement"), n("HTMLInputElement"), n("HTMLLinkElement"), n("HTMLStyleElement"), n("HTMLPreElement"), n("HTMLDivElement"), n("CSSStyleRule"), n("CSSLayerBlockRule");
|
|
352
|
-
}
|
|
353
|
-
var mn = class {
|
|
354
|
-
channels = /* @__PURE__ */ new Map();
|
|
355
|
-
listeners = /* @__PURE__ */ new Map();
|
|
356
|
-
register(e, t) {
|
|
357
|
-
this.channels.set(e, t);
|
|
358
|
-
const n = this.listeners.get(e);
|
|
359
|
-
if (n) for (const s of n) try {
|
|
360
|
-
s(t);
|
|
361
|
-
} catch (r) {
|
|
362
|
-
console.error(`[ChannelRegistry] Listener error for ${e}:`, r);
|
|
363
|
-
}
|
|
364
|
-
return t;
|
|
365
|
-
}
|
|
366
|
-
get(e) {
|
|
367
|
-
return this.channels.get(e);
|
|
368
|
-
}
|
|
369
|
-
has(e) {
|
|
370
|
-
return this.channels.has(e);
|
|
371
|
-
}
|
|
372
|
-
unregister(e) {
|
|
373
|
-
const t = this.channels.delete(e);
|
|
374
|
-
if (t) {
|
|
375
|
-
const n = this.listeners.get(e);
|
|
376
|
-
if (n) for (const s of n) try {
|
|
377
|
-
s(null);
|
|
378
|
-
} catch (r) {
|
|
379
|
-
console.error(`[ChannelRegistry] Unregister listener error for ${e}:`, r);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
return t;
|
|
383
|
-
}
|
|
384
|
-
onChannelChange(e, t) {
|
|
385
|
-
this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set());
|
|
386
|
-
const n = this.listeners.get(e);
|
|
387
|
-
if (n.add(t), this.channels.has(e)) try {
|
|
388
|
-
t(this.channels.get(e));
|
|
389
|
-
} catch (s) {
|
|
390
|
-
console.error(`[ChannelRegistry] Initial listener error for ${e}:`, s);
|
|
391
|
-
}
|
|
392
|
-
return () => {
|
|
393
|
-
n.delete(t), n.size === 0 && this.listeners.delete(e);
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
getChannelNames() {
|
|
397
|
-
return Array.from(this.channels.keys());
|
|
398
|
-
}
|
|
399
|
-
clear() {
|
|
400
|
-
this.channels.clear(), this.listeners.clear();
|
|
401
|
-
}
|
|
402
|
-
}, lr = new mn(), gn = class {
|
|
403
|
-
healthChecks = /* @__PURE__ */ new Map();
|
|
404
|
-
intervals = /* @__PURE__ */ new Map();
|
|
405
|
-
healthStatus = /* @__PURE__ */ new Map();
|
|
406
|
-
registerHealthCheck(e, t, n = 3e4) {
|
|
407
|
-
this.healthChecks.set(e, t);
|
|
408
|
-
const s = this.intervals.get(e);
|
|
409
|
-
s && clearInterval(s);
|
|
410
|
-
const r = setInterval(async () => {
|
|
411
|
-
try {
|
|
412
|
-
const i = await t();
|
|
413
|
-
this.healthStatus.set(e, i), i || console.warn(`[ChannelHealth] Channel '${e}' is unhealthy`);
|
|
414
|
-
} catch (i) {
|
|
415
|
-
console.error(`[ChannelHealth] Health check failed for '${e}':`, i), this.healthStatus.set(e, !1);
|
|
416
|
-
}
|
|
417
|
-
}, n);
|
|
418
|
-
this.intervals.set(e, r), t().then((i) => {
|
|
419
|
-
this.healthStatus.set(e, i);
|
|
420
|
-
}).catch(() => {
|
|
421
|
-
this.healthStatus.set(e, !1);
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
isHealthy(e) {
|
|
425
|
-
return this.healthStatus.get(e) ?? !1;
|
|
426
|
-
}
|
|
427
|
-
getAllHealthStatuses() {
|
|
428
|
-
const e = {};
|
|
429
|
-
for (const [t, n] of this.healthStatus) e[t] = n;
|
|
430
|
-
return e;
|
|
431
|
-
}
|
|
432
|
-
stopMonitoring(e) {
|
|
433
|
-
const t = this.intervals.get(e);
|
|
434
|
-
t && (clearInterval(t), this.intervals.delete(e)), this.healthChecks.delete(e), this.healthStatus.delete(e);
|
|
435
|
-
}
|
|
436
|
-
stopAllMonitoring() {
|
|
437
|
-
for (const e of this.intervals.values()) clearInterval(e);
|
|
438
|
-
this.intervals.clear(), this.healthChecks.clear(), this.healthStatus.clear();
|
|
439
|
-
}
|
|
440
|
-
}, hr = new gn();
|
|
441
|
-
WeakMap.prototype.getOrInsert ??= function(e, t) {
|
|
442
|
-
return this.has(e) || this.set(e, t), this.get(e);
|
|
443
|
-
};
|
|
444
|
-
WeakMap.prototype.getOrInsertComputed ??= function(e, t) {
|
|
445
|
-
return this.has(e) || this.set(e, t(e)), this.get(e);
|
|
446
|
-
};
|
|
447
|
-
Map.prototype.getOrInsert ??= function(e, t) {
|
|
448
|
-
return this.has(e) || this.set(e, t), this.get(e);
|
|
449
|
-
};
|
|
450
|
-
Map.prototype.getOrInsertComputed ??= function(e, t) {
|
|
451
|
-
return this.has(e) || this.set(e, t(e)), this.get(e);
|
|
452
|
-
};
|
|
453
|
-
var mt = /* @__PURE__ */ Symbol.for("@fix"), A = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" || typeof e > "u" || e == null, bn = (e, t) => A(e) ? t == "number" ? Number(e) || 0 : t == "string" ? String(e) || "" : t == "boolean" ? !!e : e : null, g = (e, t) => e?.[mt] ?? e ?? t ?? t, yn = (e) => {
|
|
343
|
+
}, mt = /* @__PURE__ */ Symbol.for("@fix"), A = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" || typeof e > "u" || e == null, _n = (e, t) => A(e) ? t == "number" ? Number(e) || 0 : t == "string" ? String(e) || "" : t == "boolean" ? !!e : e : null, g = (e, t) => e?.[mt] ?? e ?? t ?? t, mn = (e) => {
|
|
454
344
|
if (typeof e == "function" || e == null) return e;
|
|
455
345
|
const t = function() {
|
|
456
346
|
};
|
|
457
347
|
return t[mt] = e, t;
|
|
458
|
-
},
|
|
348
|
+
}, gn = (e) => crypto?.getRandomValues ? crypto?.getRandomValues?.(e) : (() => {
|
|
459
349
|
const t = new Uint8Array(e.length);
|
|
460
350
|
for (let n = 0; n < e.length; n++) t[n] = Math.floor(Math.random() * 256);
|
|
461
351
|
return t;
|
|
462
|
-
})(),
|
|
463
|
-
if (Array.isArray(e))
|
|
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]));
|
|
464
355
|
if (e instanceof Map) {
|
|
465
356
|
const s = Array.from(e.entries());
|
|
466
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])]));
|
|
@@ -477,7 +368,7 @@ var mt = /* @__PURE__ */ Symbol.for("@fix"), A = (e) => typeof e == "string" ||
|
|
|
477
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 () => {
|
|
478
369
|
const n = await e;
|
|
479
370
|
return R?.set?.(e, n), n;
|
|
480
|
-
})?.then?.(t) : t(e),
|
|
371
|
+
})?.then?.(t) : t(e), bn = class {
|
|
481
372
|
#e;
|
|
482
373
|
#t;
|
|
483
374
|
constructor(e, t) {
|
|
@@ -532,7 +423,7 @@ var mt = /* @__PURE__ */ Symbol.for("@fix"), A = (e) => typeof e == "string" ||
|
|
|
532
423
|
}
|
|
533
424
|
}
|
|
534
425
|
let s;
|
|
535
|
-
return R?.has?.(e) && (s = R?.get?.(e))?.[t] != null ? s = R?.get?.(e)?.[t] : s =
|
|
426
|
+
return R?.has?.(e) && (s = R?.get?.(e))?.[t] != null ? s = R?.get?.(e)?.[t] : s = yt(x(e, async (r) => {
|
|
536
427
|
if (g(r) instanceof Promise) return Reflect.get(r, t, n);
|
|
537
428
|
if (A(r)) return t == Symbol.toPrimitive || t == Symbol.toStringTag ? r : void 0;
|
|
538
429
|
let i;
|
|
@@ -543,7 +434,7 @@ var mt = /* @__PURE__ */ Symbol.for("@fix"), A = (e) => typeof e == "string" ||
|
|
|
543
434
|
}
|
|
544
435
|
return typeof i == "function" ? i?.bind?.(r) : i;
|
|
545
436
|
})), t == Symbol.toStringTag ? A(s) ? String(s ?? "") || "" : s?.[Symbol.toStringTag]?.() || String(s ?? "") || "" : t == Symbol.toPrimitive ? (r) => {
|
|
546
|
-
if (A(s)) return
|
|
437
|
+
if (A(s)) return _n(s, r);
|
|
547
438
|
} : s;
|
|
548
439
|
}
|
|
549
440
|
set(e, t, n) {
|
|
@@ -555,14 +446,14 @@ var mt = /* @__PURE__ */ Symbol.for("@fix"), A = (e) => typeof e == "string" ||
|
|
|
555
446
|
return this.#e = null, s;
|
|
556
447
|
}
|
|
557
448
|
return x(g(e, this.#e), (s) => {
|
|
558
|
-
if (typeof s == "function")
|
|
449
|
+
if (typeof s == "function")
|
|
450
|
+
return g(s) instanceof Promise, Reflect.apply(s, t, n);
|
|
559
451
|
});
|
|
560
452
|
}
|
|
561
453
|
};
|
|
562
|
-
function
|
|
563
|
-
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(
|
|
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;
|
|
564
456
|
}
|
|
565
|
-
_n();
|
|
566
457
|
var De = class {
|
|
567
458
|
_unsubscribe;
|
|
568
459
|
_closed = !1;
|
|
@@ -652,14 +543,14 @@ var De = class {
|
|
|
652
543
|
get subscriberCount() {
|
|
653
544
|
return this._subs.size;
|
|
654
545
|
}
|
|
655
|
-
},
|
|
546
|
+
}, or = class extends _ {
|
|
656
547
|
constructor(e = 1) {
|
|
657
548
|
super({
|
|
658
549
|
bufferSize: e,
|
|
659
550
|
replayOnSubscribe: !0
|
|
660
551
|
});
|
|
661
552
|
}
|
|
662
|
-
},
|
|
553
|
+
}, wn = class {
|
|
663
554
|
_transport;
|
|
664
555
|
_channelName;
|
|
665
556
|
_send;
|
|
@@ -668,7 +559,7 @@ var De = class {
|
|
|
668
559
|
_cleanup = null;
|
|
669
560
|
_listening = !1;
|
|
670
561
|
constructor(e, t) {
|
|
671
|
-
this._transport = e, this._channelName = t, this._send =
|
|
562
|
+
this._transport = e, this._channelName = t, this._send = y(e);
|
|
672
563
|
}
|
|
673
564
|
next(e, t) {
|
|
674
565
|
this._send(e, t);
|
|
@@ -680,7 +571,7 @@ var De = class {
|
|
|
680
571
|
});
|
|
681
572
|
}
|
|
682
573
|
request(e) {
|
|
683
|
-
const t = e.reqId ??
|
|
574
|
+
const t = e.reqId ?? u();
|
|
684
575
|
return new Promise((n, s) => {
|
|
685
576
|
this._pending.set(t, {
|
|
686
577
|
resolve: n,
|
|
@@ -720,7 +611,7 @@ var De = class {
|
|
|
720
611
|
}
|
|
721
612
|
};
|
|
722
613
|
function et(e, t, n) {
|
|
723
|
-
const s =
|
|
614
|
+
const s = y(e);
|
|
724
615
|
return new C((r) => m(e, (o) => {
|
|
725
616
|
if (!r.active) return;
|
|
726
617
|
n ? n(o, (c, l) => {
|
|
@@ -734,7 +625,7 @@ function et(e, t, n) {
|
|
|
734
625
|
}, r) : r.next(o);
|
|
735
626
|
}, (o) => r.error(o), () => r.complete()));
|
|
736
627
|
}
|
|
737
|
-
function
|
|
628
|
+
function vn(e) {
|
|
738
629
|
return async (t, n, s) => {
|
|
739
630
|
if (t.type !== "request") {
|
|
740
631
|
s.next(t);
|
|
@@ -744,7 +635,7 @@ function Sn(e) {
|
|
|
744
635
|
r && n(r.response, r.transfer), s.next(t);
|
|
745
636
|
};
|
|
746
637
|
}
|
|
747
|
-
var
|
|
638
|
+
var ar = class extends _ {
|
|
748
639
|
constructor(e, t) {
|
|
749
640
|
super(), e.subscribe({
|
|
750
641
|
next: (n) => {
|
|
@@ -754,21 +645,21 @@ var dr = class extends _ {
|
|
|
754
645
|
complete: () => this.complete()
|
|
755
646
|
});
|
|
756
647
|
}
|
|
757
|
-
},
|
|
648
|
+
}, bt = (e) => (t) => new C((n) => {
|
|
758
649
|
const s = t.subscribe({
|
|
759
650
|
next: (r) => e(r) && n.next(r),
|
|
760
651
|
error: (r) => n.error(r),
|
|
761
652
|
complete: () => n.complete()
|
|
762
653
|
});
|
|
763
654
|
return () => s.unsubscribe();
|
|
764
|
-
}),
|
|
655
|
+
}), cr = (e) => (t) => new C((n) => {
|
|
765
656
|
const s = t.subscribe({
|
|
766
657
|
next: (r) => n.next(e(r)),
|
|
767
658
|
error: (r) => n.error(r),
|
|
768
659
|
complete: () => n.complete()
|
|
769
660
|
});
|
|
770
661
|
return () => s.unsubscribe();
|
|
771
|
-
}),
|
|
662
|
+
}), lr = (e) => (t) => new C((n) => {
|
|
772
663
|
let s = 0;
|
|
773
664
|
const r = t.subscribe({
|
|
774
665
|
next: (i) => {
|
|
@@ -778,7 +669,7 @@ var dr = class extends _ {
|
|
|
778
669
|
complete: () => n.complete()
|
|
779
670
|
});
|
|
780
671
|
return () => r.unsubscribe();
|
|
781
|
-
}),
|
|
672
|
+
}), ur = (e) => (t) => new C((n) => {
|
|
782
673
|
const s = t.subscribe({
|
|
783
674
|
next: (i) => n.next(i),
|
|
784
675
|
error: (i) => n.error(i),
|
|
@@ -787,7 +678,7 @@ var dr = class extends _ {
|
|
|
787
678
|
return () => {
|
|
788
679
|
s.unsubscribe(), r.unsubscribe();
|
|
789
680
|
};
|
|
790
|
-
}),
|
|
681
|
+
}), hr = (e) => (t) => new C((n) => {
|
|
791
682
|
let s;
|
|
792
683
|
const r = t.subscribe({
|
|
793
684
|
next: (i) => {
|
|
@@ -799,7 +690,7 @@ var dr = class extends _ {
|
|
|
799
690
|
return () => {
|
|
800
691
|
clearTimeout(s), r.unsubscribe();
|
|
801
692
|
};
|
|
802
|
-
}),
|
|
693
|
+
}), dr = (e) => (t) => new C((n) => {
|
|
803
694
|
let s = 0;
|
|
804
695
|
const r = t.subscribe({
|
|
805
696
|
next: (i) => {
|
|
@@ -810,36 +701,36 @@ var dr = class extends _ {
|
|
|
810
701
|
complete: () => n.complete()
|
|
811
702
|
});
|
|
812
703
|
return () => r.unsubscribe();
|
|
813
|
-
}),
|
|
704
|
+
}), Cn = (e, t) => new C((n) => {
|
|
814
705
|
const s = (r) => n.active && n.next(r);
|
|
815
706
|
return e.addEventListener(t, s), () => e.removeEventListener(t, s);
|
|
816
|
-
}),
|
|
707
|
+
}), xn = (e) => new C((t) => {
|
|
817
708
|
e.then((n) => {
|
|
818
709
|
t.next(n), t.complete();
|
|
819
710
|
}).catch((n) => t.error(n));
|
|
820
|
-
}),
|
|
711
|
+
}), kn = (e, t) => new C((n) => {
|
|
821
712
|
const s = setTimeout(() => {
|
|
822
713
|
n.next(e), n.complete();
|
|
823
714
|
}, t);
|
|
824
715
|
return () => clearTimeout(s);
|
|
825
|
-
}),
|
|
716
|
+
}), Sn = (e) => new C((t) => {
|
|
826
717
|
let n = 0;
|
|
827
718
|
const s = setInterval(() => t.next(n++), e);
|
|
828
719
|
return () => clearInterval(s);
|
|
829
|
-
}),
|
|
720
|
+
}), En = (...e) => new C((t) => {
|
|
830
721
|
const n = e.map((s) => s.subscribe({
|
|
831
722
|
next: (r) => t.next(r),
|
|
832
723
|
error: (r) => t.error(r)
|
|
833
724
|
}));
|
|
834
725
|
return () => n.forEach((s) => s.unsubscribe());
|
|
835
|
-
}),
|
|
836
|
-
const s =
|
|
726
|
+
}), fr = () => u(), N = (e, t) => (n) => {
|
|
727
|
+
const s = y(e), r = (i, o) => s(i, o);
|
|
837
728
|
return m(e, (i) => {
|
|
838
729
|
n.active && (t ? t(i, r, n) : n.next(i));
|
|
839
730
|
}, (i) => n.error(i), () => n.complete());
|
|
840
|
-
},
|
|
841
|
-
function
|
|
842
|
-
const s =
|
|
731
|
+
}, pr = (e, t) => N(e, t), _r = (e, t) => N(e, t), mr = (e, t) => N(new BroadcastChannel(e), t), gr = (e, t, n) => N(new WebSocket(typeof e == "string" ? e : e.href, t), n), yr = (e) => N("chrome-runtime", e), br = (e) => N("service-worker-client", e), wr = (e) => N("service-worker-host", e), vr = (e) => N("self", e);
|
|
732
|
+
function In(e, t, n) {
|
|
733
|
+
const s = y(e), r = new C((i) => N(e, n)(i));
|
|
843
734
|
return {
|
|
844
735
|
inbound: r,
|
|
845
736
|
outbound: { next: s },
|
|
@@ -847,23 +738,23 @@ function Mn(e, t, n) {
|
|
|
847
738
|
send: (i, o) => s(i, o)
|
|
848
739
|
};
|
|
849
740
|
}
|
|
850
|
-
function
|
|
741
|
+
function Tn(e, t) {
|
|
851
742
|
return new C((n) => {
|
|
852
743
|
const s = (r) => n.active && n.next(r);
|
|
853
744
|
return e.addEventListener(t, s), () => e.removeEventListener(t, s);
|
|
854
745
|
});
|
|
855
746
|
}
|
|
856
|
-
var
|
|
857
|
-
channel: (e, t) => new
|
|
747
|
+
var Cr = {
|
|
748
|
+
channel: (e, t) => new wn(e, t),
|
|
858
749
|
invoker: (e, t, n) => et(e, t, n),
|
|
859
|
-
handler: (e, t) => et(e, t,
|
|
860
|
-
bidirectional:
|
|
861
|
-
fromEvent:
|
|
862
|
-
fromPromise:
|
|
863
|
-
delay:
|
|
864
|
-
interval:
|
|
865
|
-
merge:
|
|
866
|
-
when:
|
|
750
|
+
handler: (e, t) => et(e, t, vn(t)),
|
|
751
|
+
bidirectional: In,
|
|
752
|
+
fromEvent: Cn,
|
|
753
|
+
fromPromise: xn,
|
|
754
|
+
delay: kn,
|
|
755
|
+
interval: Sn,
|
|
756
|
+
merge: En,
|
|
757
|
+
when: Tn
|
|
867
758
|
};
|
|
868
759
|
function J() {
|
|
869
760
|
if (typeof globalThis.Deno < "u") return "deno";
|
|
@@ -886,13 +777,13 @@ function tt(e) {
|
|
|
886
777
|
const t = ie(e);
|
|
887
778
|
return t && t !== "internal" ? t : e === self || e === globalThis || e === "self" ? "self" : "internal";
|
|
888
779
|
}
|
|
889
|
-
function
|
|
780
|
+
function Pn(e) {
|
|
890
781
|
if (!e) return "unknown";
|
|
891
782
|
if (e.contextType) return e.contextType;
|
|
892
783
|
const t = e.sender ?? "";
|
|
893
784
|
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";
|
|
894
785
|
}
|
|
895
|
-
var
|
|
786
|
+
var Mn = {
|
|
896
787
|
get: (e, t) => Reflect.get(e, t),
|
|
897
788
|
set: (e, t, n) => Reflect.set(e, t, n),
|
|
898
789
|
has: (e, t) => Reflect.has(e, t),
|
|
@@ -976,7 +867,7 @@ var qn = {
|
|
|
976
867
|
close() {
|
|
977
868
|
this._channel.close();
|
|
978
869
|
}
|
|
979
|
-
},
|
|
870
|
+
}, An = class {
|
|
980
871
|
requestor;
|
|
981
872
|
responder;
|
|
982
873
|
_contextType;
|
|
@@ -1002,28 +893,28 @@ var qn = {
|
|
|
1002
893
|
this.requestor.close(), this.responder.close();
|
|
1003
894
|
}
|
|
1004
895
|
};
|
|
1005
|
-
function
|
|
896
|
+
function xr(e, t) {
|
|
1006
897
|
return new wt({
|
|
1007
898
|
channel: e,
|
|
1008
899
|
...t
|
|
1009
900
|
});
|
|
1010
901
|
}
|
|
1011
|
-
function
|
|
902
|
+
function Rn(e, t) {
|
|
1012
903
|
return new vt({
|
|
1013
904
|
channel: e,
|
|
1014
905
|
...t
|
|
1015
906
|
});
|
|
1016
907
|
}
|
|
1017
908
|
function Le(e, t) {
|
|
1018
|
-
return new
|
|
909
|
+
return new An({
|
|
1019
910
|
channel: e,
|
|
1020
911
|
...t
|
|
1021
912
|
});
|
|
1022
913
|
}
|
|
1023
|
-
function
|
|
914
|
+
function kr(e, t, n) {
|
|
1024
915
|
return Le(e, n).connect(t);
|
|
1025
916
|
}
|
|
1026
|
-
function
|
|
917
|
+
function Sr(e, t) {
|
|
1027
918
|
const n = Le(e, {
|
|
1028
919
|
autoDetect: !0,
|
|
1029
920
|
...t
|
|
@@ -1042,7 +933,7 @@ function Mr(e, t) {
|
|
|
1042
933
|
}
|
|
1043
934
|
return n;
|
|
1044
935
|
}
|
|
1045
|
-
var Ct = /* @__PURE__ */ Symbol.for("uniform.proxy"), xt = /* @__PURE__ */ Symbol.for("uniform.proxy.internals"),
|
|
936
|
+
var Ct = /* @__PURE__ */ Symbol.for("uniform.proxy"), xt = /* @__PURE__ */ Symbol.for("uniform.proxy.internals"), qn = class {
|
|
1046
937
|
_invoker;
|
|
1047
938
|
_config;
|
|
1048
939
|
_childCache = /* @__PURE__ */ new Map();
|
|
@@ -1059,7 +950,7 @@ var Ct = /* @__PURE__ */ Symbol.for("uniform.proxy"), xt = /* @__PURE__ */ Symbo
|
|
|
1059
950
|
const s = String(t);
|
|
1060
951
|
if (t === Ct) return !0;
|
|
1061
952
|
if (t === xt) return this._config;
|
|
1062
|
-
if (t ===
|
|
953
|
+
if (t === Hn) return !0;
|
|
1063
954
|
if (t === Z) return this._getDescriptor();
|
|
1064
955
|
if (t === "then" || t === "catch" || t === "finally" || typeof t == "symbol") return;
|
|
1065
956
|
if (t === "$path") return this._config.basePath;
|
|
@@ -1118,7 +1009,7 @@ var Ct = /* @__PURE__ */ Symbol.for("uniform.proxy"), xt = /* @__PURE__ */ Symbo
|
|
|
1118
1009
|
primitive: !1
|
|
1119
1010
|
};
|
|
1120
1011
|
}
|
|
1121
|
-
},
|
|
1012
|
+
}, Er = class {
|
|
1122
1013
|
_dispatch;
|
|
1123
1014
|
constructor(e) {
|
|
1124
1015
|
this._dispatch = e;
|
|
@@ -1162,10 +1053,10 @@ var Ct = /* @__PURE__ */ Symbol.for("uniform.proxy"), xt = /* @__PURE__ */ Symbo
|
|
|
1162
1053
|
};
|
|
1163
1054
|
function oe(e, t) {
|
|
1164
1055
|
const n = function() {
|
|
1165
|
-
}, s = new
|
|
1056
|
+
}, s = new qn(e, t);
|
|
1166
1057
|
return new Proxy(n, s);
|
|
1167
1058
|
}
|
|
1168
|
-
function
|
|
1059
|
+
function kt(e, t, n) {
|
|
1169
1060
|
if (!e || typeof e != "object" || e.primitive) return e;
|
|
1170
1061
|
const s = nt.get(e);
|
|
1171
1062
|
if (s) return s;
|
|
@@ -1175,7 +1066,7 @@ function St(e, t, n) {
|
|
|
1175
1066
|
});
|
|
1176
1067
|
return nt.set(e, r), ge.set(r, e), r;
|
|
1177
1068
|
}
|
|
1178
|
-
function
|
|
1069
|
+
function St(e) {
|
|
1179
1070
|
if (!e || typeof e != "object" && typeof e != "function") return !1;
|
|
1180
1071
|
try {
|
|
1181
1072
|
return Reflect.get(e, Ct) === !0;
|
|
@@ -1183,11 +1074,11 @@ function kt(e) {
|
|
|
1183
1074
|
return !1;
|
|
1184
1075
|
}
|
|
1185
1076
|
}
|
|
1186
|
-
function
|
|
1187
|
-
return
|
|
1077
|
+
function Ir(e) {
|
|
1078
|
+
return St(e) ? e.$descriptor ?? null : null;
|
|
1188
1079
|
}
|
|
1189
|
-
function
|
|
1190
|
-
if (!
|
|
1080
|
+
function Tr(e) {
|
|
1081
|
+
if (!St(e)) return null;
|
|
1191
1082
|
try {
|
|
1192
1083
|
const t = Reflect.get(e, xt);
|
|
1193
1084
|
return !t || typeof t != "object" ? null : t;
|
|
@@ -1195,12 +1086,12 @@ function qr(e) {
|
|
|
1195
1086
|
return null;
|
|
1196
1087
|
}
|
|
1197
1088
|
}
|
|
1198
|
-
function
|
|
1199
|
-
return
|
|
1089
|
+
function Nn(e, t) {
|
|
1090
|
+
return Qn(e, t);
|
|
1200
1091
|
}
|
|
1201
|
-
function
|
|
1092
|
+
function On(e, t = []) {
|
|
1202
1093
|
return oe((s, r, i) => e.request({
|
|
1203
|
-
id:
|
|
1094
|
+
id: u(),
|
|
1204
1095
|
channel: e.channelName,
|
|
1205
1096
|
sender: e.senderId ?? "proxy",
|
|
1206
1097
|
type: "request",
|
|
@@ -1214,7 +1105,7 @@ function Bn(e, t = []) {
|
|
|
1214
1105
|
basePath: t
|
|
1215
1106
|
});
|
|
1216
1107
|
}
|
|
1217
|
-
var
|
|
1108
|
+
var Dn = class {
|
|
1218
1109
|
_config = {};
|
|
1219
1110
|
_invoker = null;
|
|
1220
1111
|
channel(e) {
|
|
@@ -1238,11 +1129,11 @@ var Wn = class {
|
|
|
1238
1129
|
return oe(this._invoker, this._config);
|
|
1239
1130
|
}
|
|
1240
1131
|
};
|
|
1241
|
-
function
|
|
1242
|
-
return new
|
|
1132
|
+
function Pr() {
|
|
1133
|
+
return new Dn();
|
|
1243
1134
|
}
|
|
1244
|
-
var
|
|
1245
|
-
function
|
|
1135
|
+
var Ln = kt;
|
|
1136
|
+
function Bn(e) {
|
|
1246
1137
|
return [
|
|
1247
1138
|
e.localChannel,
|
|
1248
1139
|
e.remoteChannel,
|
|
@@ -1251,7 +1142,7 @@ function Fn(e) {
|
|
|
1251
1142
|
e.direction
|
|
1252
1143
|
].join("::");
|
|
1253
1144
|
}
|
|
1254
|
-
function
|
|
1145
|
+
function Wn(e, t = {}) {
|
|
1255
1146
|
const n = t.includeClosed ?? !1, s = t.status ?? (n ? void 0 : "active");
|
|
1256
1147
|
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);
|
|
1257
1148
|
}
|
|
@@ -1263,7 +1154,7 @@ var Et = class {
|
|
|
1263
1154
|
this._createId = e, this._emitEvent = t;
|
|
1264
1155
|
}
|
|
1265
1156
|
register(e) {
|
|
1266
|
-
const t =
|
|
1157
|
+
const t = Bn(e), n = Date.now(), s = this._connections.get(t);
|
|
1267
1158
|
if (s)
|
|
1268
1159
|
return s.updatedAt = n, s.status = "active", s.metadata = {
|
|
1269
1160
|
...s.metadata,
|
|
@@ -1315,7 +1206,7 @@ var Et = class {
|
|
|
1315
1206
|
}));
|
|
1316
1207
|
}
|
|
1317
1208
|
query(e = {}) {
|
|
1318
|
-
return
|
|
1209
|
+
return Wn(this._connections.values(), e);
|
|
1319
1210
|
}
|
|
1320
1211
|
values() {
|
|
1321
1212
|
return [...this._connections.values()];
|
|
@@ -1330,7 +1221,7 @@ var Et = class {
|
|
|
1330
1221
|
_transports = /* @__PURE__ */ new Map();
|
|
1331
1222
|
_defaultTransport = null;
|
|
1332
1223
|
_connectionEvents = new _({ bufferSize: 200 });
|
|
1333
|
-
_connectionRegistry = new Et(() =>
|
|
1224
|
+
_connectionRegistry = new Et(() => u(), (e) => this._connectionEvents.next(e));
|
|
1334
1225
|
_pending = /* @__PURE__ */ new Map();
|
|
1335
1226
|
_subscriptions = [];
|
|
1336
1227
|
_inbound = new _({ bufferSize: 100 });
|
|
@@ -1351,7 +1242,7 @@ var Et = class {
|
|
|
1351
1242
|
name: t.name,
|
|
1352
1243
|
autoDetect: t.autoDetect ?? !0,
|
|
1353
1244
|
timeout: t.timeout ?? 3e4,
|
|
1354
|
-
reflect: t.reflect ??
|
|
1245
|
+
reflect: t.reflect ?? Mn,
|
|
1355
1246
|
bufferSize: t.bufferSize ?? 100,
|
|
1356
1247
|
autoListen: t.autoListen ?? !0
|
|
1357
1248
|
}, this._config.autoListen && this._isWorkerContext() && this.listen(self);
|
|
@@ -1429,7 +1320,7 @@ var Et = class {
|
|
|
1429
1320
|
}
|
|
1430
1321
|
expose(e, t) {
|
|
1431
1322
|
const n = [e];
|
|
1432
|
-
return
|
|
1323
|
+
return ye(n, t), this._exposed.set(e, {
|
|
1433
1324
|
name: e,
|
|
1434
1325
|
obj: t,
|
|
1435
1326
|
path: n
|
|
@@ -1443,7 +1334,7 @@ var Et = class {
|
|
|
1443
1334
|
return this.invoke(t ?? this._getDefaultTarget(), d.IMPORT, [], [e]);
|
|
1444
1335
|
}
|
|
1445
1336
|
invoke(e, t, n, s = []) {
|
|
1446
|
-
const r =
|
|
1337
|
+
const r = u(), i = Promise.withResolvers();
|
|
1447
1338
|
this._pending.set(r, i);
|
|
1448
1339
|
const o = setTimeout(() => {
|
|
1449
1340
|
this._pending.has(r) && (this._pending.delete(r), i.reject(/* @__PURE__ */ new Error(`Request timeout: ${t} on ${n.join(".")}`)));
|
|
@@ -1483,7 +1374,7 @@ var Et = class {
|
|
|
1483
1374
|
return this.proxy(t, [e]);
|
|
1484
1375
|
}
|
|
1485
1376
|
wrapDescriptor(e, t) {
|
|
1486
|
-
return
|
|
1377
|
+
return kt(e, (s, r, i) => {
|
|
1487
1378
|
const o = t ?? e?.channel ?? this._getDefaultTarget();
|
|
1488
1379
|
return this.invoke(o, s, r, i);
|
|
1489
1380
|
}, t ?? e?.channel ?? this._getDefaultTarget());
|
|
@@ -1496,7 +1387,7 @@ var Et = class {
|
|
|
1496
1387
|
}
|
|
1497
1388
|
emit(e, t, n) {
|
|
1498
1389
|
const s = {
|
|
1499
|
-
id:
|
|
1390
|
+
id: u(),
|
|
1500
1391
|
channel: e,
|
|
1501
1392
|
sender: this._name,
|
|
1502
1393
|
type: "event",
|
|
@@ -1630,7 +1521,7 @@ var Et = class {
|
|
|
1630
1521
|
path: s,
|
|
1631
1522
|
args: r ?? [],
|
|
1632
1523
|
timestamp: Date.now(),
|
|
1633
|
-
contextType:
|
|
1524
|
+
contextType: Pn(e)
|
|
1634
1525
|
});
|
|
1635
1526
|
const { result: a, toTransfer: c, newPath: l } = await this._executeAction(n, s, r ?? [], i);
|
|
1636
1527
|
await this._sendResponse(o, n, i, l, a, c);
|
|
@@ -1674,7 +1565,7 @@ var Et = class {
|
|
|
1674
1565
|
}
|
|
1675
1566
|
_emitConnectionSignal(e, t, n = {}) {
|
|
1676
1567
|
const s = {
|
|
1677
|
-
id:
|
|
1568
|
+
id: u(),
|
|
1678
1569
|
type: "signal",
|
|
1679
1570
|
channel: e.targetChannel,
|
|
1680
1571
|
sender: this._name,
|
|
@@ -1699,7 +1590,7 @@ var Et = class {
|
|
|
1699
1590
|
}
|
|
1700
1591
|
_sendSignalToTarget(e, t, n, s) {
|
|
1701
1592
|
const r = {
|
|
1702
|
-
id:
|
|
1593
|
+
id: u(),
|
|
1703
1594
|
type: "signal",
|
|
1704
1595
|
channel: n.to ?? this._name,
|
|
1705
1596
|
sender: this._name,
|
|
@@ -1847,7 +1738,7 @@ var Et = class {
|
|
|
1847
1738
|
return this._defaultTransport ? this._defaultTransport.targetChannel : "worker";
|
|
1848
1739
|
}
|
|
1849
1740
|
_inferTargetChannel(e, t) {
|
|
1850
|
-
return t === "worker" ? "worker" : t === "broadcast" && e.name ? e.name : t === "self" ? "self" : `${t}-${
|
|
1741
|
+
return t === "worker" ? "worker" : t === "broadcast" && e.name ? e.name : t === "self" ? "self" : `${t}-${u().slice(0, 8)}`;
|
|
1851
1742
|
}
|
|
1852
1743
|
_createProxy(e, t) {
|
|
1853
1744
|
return oe((s, r, i) => this.invoke(e, s, r, i), {
|
|
@@ -1868,13 +1759,13 @@ var Et = class {
|
|
|
1868
1759
|
function I(e) {
|
|
1869
1760
|
return new It(e);
|
|
1870
1761
|
}
|
|
1871
|
-
function
|
|
1762
|
+
function Mr(e, t, n) {
|
|
1872
1763
|
return I({
|
|
1873
1764
|
name: e,
|
|
1874
1765
|
...n
|
|
1875
1766
|
}).attach(t, n);
|
|
1876
1767
|
}
|
|
1877
|
-
function
|
|
1768
|
+
function Ar(e, t, n) {
|
|
1878
1769
|
const s = new MessageChannel();
|
|
1879
1770
|
return s.port1.start(), s.port2.start(), {
|
|
1880
1771
|
channel1: I({
|
|
@@ -1891,45 +1782,45 @@ function Dr(e, t, n) {
|
|
|
1891
1782
|
};
|
|
1892
1783
|
}
|
|
1893
1784
|
var Q = /* @__PURE__ */ new Map();
|
|
1894
|
-
function
|
|
1785
|
+
function Rr(e, t) {
|
|
1895
1786
|
return Q.has(e) || Q.set(e, I({
|
|
1896
1787
|
name: e,
|
|
1897
1788
|
...t
|
|
1898
1789
|
})), Q.get(e);
|
|
1899
1790
|
}
|
|
1900
|
-
function
|
|
1791
|
+
function qr() {
|
|
1901
1792
|
return [...Q.keys()];
|
|
1902
1793
|
}
|
|
1903
|
-
function
|
|
1794
|
+
function Nr(e) {
|
|
1904
1795
|
const t = Q.get(e);
|
|
1905
1796
|
return t ? (t.close(), Q.delete(e)) : !1;
|
|
1906
1797
|
}
|
|
1907
|
-
var
|
|
1798
|
+
var ue = null;
|
|
1908
1799
|
function ae() {
|
|
1909
|
-
if (!
|
|
1800
|
+
if (!ue) {
|
|
1910
1801
|
const e = J();
|
|
1911
1802
|
[
|
|
1912
1803
|
"worker",
|
|
1913
1804
|
"shared-worker",
|
|
1914
1805
|
"service-worker"
|
|
1915
|
-
].includes(e) ?
|
|
1806
|
+
].includes(e) ? ue = I({
|
|
1916
1807
|
name: "worker",
|
|
1917
1808
|
autoListen: !0
|
|
1918
|
-
}) :
|
|
1809
|
+
}) : ue = I({
|
|
1919
1810
|
name: "host",
|
|
1920
1811
|
autoListen: !1
|
|
1921
1812
|
});
|
|
1922
1813
|
}
|
|
1923
|
-
return
|
|
1814
|
+
return ue;
|
|
1924
1815
|
}
|
|
1925
|
-
function
|
|
1816
|
+
function Or(e, t) {
|
|
1926
1817
|
ae().expose(e, t);
|
|
1927
1818
|
}
|
|
1928
|
-
function
|
|
1819
|
+
function Dr(e, t) {
|
|
1929
1820
|
return ae().remote(e, t);
|
|
1930
1821
|
}
|
|
1931
|
-
var Tt = (e, t = null) => ae().proxy(e),
|
|
1932
|
-
function
|
|
1822
|
+
var Tt = (e, t = null) => ae().proxy(e), Lr = (e, t, n = {}) => Tt(t, null), Br = (e, t, n = {}) => ae().wrapDescriptor(e, e?.channel ?? n?.connectChannel);
|
|
1823
|
+
function Wr(e, t) {
|
|
1933
1824
|
const n = I({
|
|
1934
1825
|
name: t,
|
|
1935
1826
|
autoListen: !1
|
|
@@ -1942,7 +1833,7 @@ function Hr(e, t) {
|
|
|
1942
1833
|
request: (s) => n.invoke(t, d.CALL, [], [s])
|
|
1943
1834
|
};
|
|
1944
1835
|
}
|
|
1945
|
-
var
|
|
1836
|
+
var k = {
|
|
1946
1837
|
rjb: "rejectBy",
|
|
1947
1838
|
rvb: "resolveBy",
|
|
1948
1839
|
rj: "reject",
|
|
@@ -1952,19 +1843,19 @@ var S = {
|
|
|
1952
1843
|
a: "array",
|
|
1953
1844
|
ta: "typedarray",
|
|
1954
1845
|
udf: "undefined"
|
|
1955
|
-
},
|
|
1956
|
-
typeof ArrayBuffer !=
|
|
1957
|
-
typeof MessagePort !=
|
|
1958
|
-
typeof ReadableStream !=
|
|
1959
|
-
typeof WritableStream !=
|
|
1960
|
-
typeof TransformStream !=
|
|
1961
|
-
typeof WebTransportReceiveStream !=
|
|
1962
|
-
typeof WebTransportSendStream !=
|
|
1963
|
-
typeof AudioData !=
|
|
1964
|
-
typeof ImageBitmap !=
|
|
1965
|
-
typeof VideoFrame !=
|
|
1966
|
-
typeof OffscreenCanvas !=
|
|
1967
|
-
typeof RTCDataChannel !=
|
|
1846
|
+
}, $r = [
|
|
1847
|
+
typeof ArrayBuffer != k.udf ? ArrayBuffer : null,
|
|
1848
|
+
typeof MessagePort != k.udf ? MessagePort : null,
|
|
1849
|
+
typeof ReadableStream != k.udf ? ReadableStream : null,
|
|
1850
|
+
typeof WritableStream != k.udf ? WritableStream : null,
|
|
1851
|
+
typeof TransformStream != k.udf ? TransformStream : null,
|
|
1852
|
+
typeof WebTransportReceiveStream != k.udf ? WebTransportReceiveStream : null,
|
|
1853
|
+
typeof WebTransportSendStream != k.udf ? WebTransportSendStream : null,
|
|
1854
|
+
typeof AudioData != k.udf ? AudioData : null,
|
|
1855
|
+
typeof ImageBitmap != k.udf ? ImageBitmap : null,
|
|
1856
|
+
typeof VideoFrame != k.udf ? VideoFrame : null,
|
|
1857
|
+
typeof OffscreenCanvas != k.udf ? OffscreenCanvas : null,
|
|
1858
|
+
typeof RTCDataChannel != k.udf ? RTCDataChannel : null
|
|
1968
1859
|
].filter((e) => e != null), Pt = () => {
|
|
1969
1860
|
try {
|
|
1970
1861
|
const e = globalThis?.ServiceWorkerGlobalScope;
|
|
@@ -1972,21 +1863,21 @@ var S = {
|
|
|
1972
1863
|
} catch {
|
|
1973
1864
|
return !1;
|
|
1974
1865
|
}
|
|
1975
|
-
},
|
|
1866
|
+
}, $n = () => {
|
|
1976
1867
|
try {
|
|
1977
1868
|
return typeof chrome < "u" && !!chrome?.runtime?.id;
|
|
1978
1869
|
} catch {
|
|
1979
1870
|
return !1;
|
|
1980
1871
|
}
|
|
1981
1872
|
}, Be = () => {
|
|
1982
|
-
if (
|
|
1873
|
+
if ($n()) return "chrome-extension";
|
|
1983
1874
|
if (Pt()) return "service-worker";
|
|
1984
1875
|
try {
|
|
1985
1876
|
if (typeof document < "u") return "main";
|
|
1986
1877
|
} catch {
|
|
1987
1878
|
}
|
|
1988
1879
|
return "unknown";
|
|
1989
|
-
},
|
|
1880
|
+
}, Fn = () => {
|
|
1990
1881
|
if (Pt()) return !1;
|
|
1991
1882
|
try {
|
|
1992
1883
|
return typeof Worker < "u";
|
|
@@ -2012,10 +1903,10 @@ function q(e) {
|
|
|
2012
1903
|
const n = e.startsWith("/") ? e.replace(/^\//, "./") : e;
|
|
2013
1904
|
return new URL(n, t).href;
|
|
2014
1905
|
}
|
|
2015
|
-
var
|
|
1906
|
+
var ke = /* @__PURE__ */ new Map(), v = {
|
|
2016
1907
|
name: "unknown",
|
|
2017
1908
|
instance: null
|
|
2018
|
-
},
|
|
1909
|
+
}, Se = /* @__PURE__ */ new Map(), At = (e) => [...Object.values(d)].includes(e), Fr = (e) => {
|
|
2019
1910
|
if (e instanceof Worker) return e;
|
|
2020
1911
|
if (e instanceof URL) return new Worker(e.href, { type: "module" });
|
|
2021
1912
|
if (typeof e == "function") try {
|
|
@@ -2037,7 +1928,7 @@ var Se = /* @__PURE__ */ new Map(), v = {
|
|
|
2037
1928
|
doImportModule(e, t) {
|
|
2038
1929
|
return this._channel.import(e, this.channelName);
|
|
2039
1930
|
}
|
|
2040
|
-
},
|
|
1931
|
+
}, Un = class {
|
|
2041
1932
|
channel;
|
|
2042
1933
|
options;
|
|
2043
1934
|
_unified;
|
|
@@ -2069,26 +1960,26 @@ var Se = /* @__PURE__ */ new Map(), v = {
|
|
|
2069
1960
|
}
|
|
2070
1961
|
}, We = (e = "$host$") => {
|
|
2071
1962
|
if (v?.instance && e === "$host$") return v.instance;
|
|
2072
|
-
if (
|
|
2073
|
-
const t = new
|
|
2074
|
-
return e === "$host$" && (v.name = e, v.instance = t),
|
|
1963
|
+
if (Se.has(e)) return Se.get(e) ?? null;
|
|
1964
|
+
const t = new Un(e);
|
|
1965
|
+
return e === "$host$" && (v.name = e, v.instance = t), Se.set(e, t), t;
|
|
2075
1966
|
}, qt = (e = "$host$") => We(e), X = (e, t = {}, n = typeof self < "u" ? self : null) => {
|
|
2076
1967
|
const s = qt(e ?? "$host$");
|
|
2077
1968
|
return s?.createRemoteChannel?.(e, t, n) ?? s;
|
|
2078
|
-
},
|
|
1969
|
+
}, Ur = (e, t = {}, n) => {
|
|
2079
1970
|
if (e == null || n) return;
|
|
2080
|
-
if (
|
|
1971
|
+
if (ke.has(e)) return ke.get(e);
|
|
2081
1972
|
const s = {
|
|
2082
1973
|
channel: e,
|
|
2083
1974
|
instance: v.instance,
|
|
2084
1975
|
remote: Promise.resolve(new Rt(e, t))
|
|
2085
1976
|
};
|
|
2086
|
-
return
|
|
2087
|
-
}, me = /* @__PURE__ */ new WeakMap(), ge = /* @__PURE__ */ new WeakMap(), nt = /* @__PURE__ */ new WeakMap(),
|
|
1977
|
+
return ke.set(e, s), s;
|
|
1978
|
+
}, me = /* @__PURE__ */ new WeakMap(), ge = /* @__PURE__ */ new WeakMap(), nt = /* @__PURE__ */ new WeakMap(), zr = (e, t) => me.get(e)?.[t], zn = (e, t = v?.name, n) => typeof e == "object" && e != null || typeof e == "function" && e != null ? ge.has(e) ? ge.get(e) : me.has(e) ? me.get(e) : Oe(e) || n?.includes?.(e) || t == v?.name ? e : {
|
|
2088
1979
|
$isDescriptor: !0,
|
|
2089
1980
|
path: W.get(e) ?? (() => {
|
|
2090
|
-
const s = [
|
|
2091
|
-
return
|
|
1981
|
+
const s = [u()];
|
|
1982
|
+
return ye(s, e), s;
|
|
2092
1983
|
})(),
|
|
2093
1984
|
owner: v?.name,
|
|
2094
1985
|
channel: t,
|
|
@@ -2097,43 +1988,43 @@ var Se = /* @__PURE__ */ new Map(), v = {
|
|
|
2097
1988
|
enumerable: !0,
|
|
2098
1989
|
configurable: !0,
|
|
2099
1990
|
argumentCount: e instanceof Function ? e.length : -1
|
|
2100
|
-
} : L(e) ? e : null,
|
|
2101
|
-
}) :
|
|
2102
|
-
if (typeof e != "object" && typeof e != "function" || e == null || (e =
|
|
2103
|
-
if (Array.isArray(e)) return e.map(
|
|
2104
|
-
if (e instanceof Map) return new Map(Array.from(e.entries()).map(([t, n]) => [t,
|
|
2105
|
-
if (e instanceof Set) return new Set(Array.from(e.values()).map(
|
|
2106
|
-
if (typeof e == "object") for (const t of Object.keys(e)) e[t] =
|
|
1991
|
+
} : L(e) ? e : null, Hn = /* @__PURE__ */ Symbol.for("@requestHandler"), Z = /* @__PURE__ */ Symbol.for("@descriptor"), Ee = (e) => L(e) || e?.[Z] ? e : e?.$isDescriptor ? Ln(e, async () => {
|
|
1992
|
+
}) : Oe(e) ? e : null, Gn = (e) => typeof e != "function" && typeof e != "object" || e == null ? e : ge.get(e) ?? me.get(e) ?? e, he = (e) => {
|
|
1993
|
+
if (typeof e != "object" && typeof e != "function" || e == null || (e = Gn(e), typeof e != "object" && typeof e != "function" || e == null)) return e;
|
|
1994
|
+
if (Array.isArray(e)) return e.map(he);
|
|
1995
|
+
if (e instanceof Map) return new Map(Array.from(e.entries()).map(([t, n]) => [t, he(n)]));
|
|
1996
|
+
if (e instanceof Set) return new Set(Array.from(e.values()).map(he));
|
|
1997
|
+
if (typeof e == "object") for (const t of Object.keys(e)) e[t] = he(e[t]);
|
|
2107
1998
|
return e;
|
|
2108
1999
|
}, re = /* @__PURE__ */ new Map(), W = /* @__PURE__ */ new WeakMap(), $e = (e, t) => {
|
|
2109
2000
|
if (t != null && !Array.isArray(t) && (t = [t]), t == null || t?.length < 1) return e;
|
|
2110
2001
|
const n = e?.[Z] ?? (e?.$isDescriptor ? e : null);
|
|
2111
|
-
if (n && n?.owner == v?.name && (e =
|
|
2002
|
+
if (n && n?.owner == v?.name && (e = z(n?.path) ?? e), A(e)) return e;
|
|
2112
2003
|
for (const s of t)
|
|
2113
2004
|
if (e = e?.[s], e == null) return e;
|
|
2114
2005
|
return e;
|
|
2115
|
-
},
|
|
2006
|
+
}, z = (e) => {
|
|
2116
2007
|
if (e != null && !Array.isArray(e) && (e = [e]), e == null || e?.length < 1) return null;
|
|
2117
2008
|
const t = re?.get?.(e?.[0]) ?? null;
|
|
2118
2009
|
return t != null ? $e(t, e?.slice?.(1)) : null;
|
|
2119
|
-
},
|
|
2010
|
+
}, ye = (e, t) => {
|
|
2120
2011
|
const n = t?.[Z] ?? (t?.$isDescriptor ? t : null);
|
|
2121
|
-
if (n && n?.owner == v?.name && (t =
|
|
2012
|
+
if (n && n?.owner == v?.name && (t = z(n?.path) ?? t), e != null && !Array.isArray(e) && (e = [e]), e == null || e?.length < 1) return null;
|
|
2122
2013
|
const s = re?.get?.(e?.[0]) ?? null;
|
|
2123
2014
|
return e?.length > 1 ? $e(s, e?.slice?.(1, -1))[e?.[e?.length - 1]] = t : re?.set?.(e?.[0], t), (typeof t == "object" || typeof t == "function") && W?.set?.(t, e), t;
|
|
2124
|
-
},
|
|
2015
|
+
}, Nt = (e) => {
|
|
2125
2016
|
if (e != null && !Array.isArray(e) && (e = [e]), e == null || e?.length < 1) return !1;
|
|
2126
2017
|
const t = re?.get?.(e?.[0]) ?? null;
|
|
2127
2018
|
return !t && e?.length <= 1 ? (re?.delete?.(e?.[0]), !0) : !1;
|
|
2128
|
-
},
|
|
2019
|
+
}, jn = (e) => {
|
|
2129
2020
|
const t = e?.[Z] ?? (e?.$isDescriptor ? e : null);
|
|
2130
|
-
t && t?.owner == v?.name && (e =
|
|
2021
|
+
t && t?.owner == v?.name && (e = z(t?.path) ?? e);
|
|
2131
2022
|
const n = W?.get?.(e) ?? t?.path;
|
|
2132
|
-
return n == null || n?.length < 1 ? !1 : (
|
|
2133
|
-
},
|
|
2023
|
+
return n == null || n?.length < 1 ? !1 : (Nt(n), (typeof e == "object" || typeof e == "function") && W?.delete?.(e), !0);
|
|
2024
|
+
}, Vn = (e) => {
|
|
2134
2025
|
const t = e?.[Z] ?? (e?.$isDescriptor ? e : null);
|
|
2135
2026
|
return (W?.get?.(e) ?? t?.path) == null;
|
|
2136
|
-
}, D = (e) => (typeof e == "object" || typeof e == "function") && e != null,
|
|
2027
|
+
}, D = (e) => (typeof e == "object" || typeof e == "function") && e != null, Ot = {
|
|
2137
2028
|
get: (e, t) => e?.[t],
|
|
2138
2029
|
set: (e, t, n) => (e[t] = n, !0),
|
|
2139
2030
|
has: (e, t) => t in e,
|
|
@@ -2148,8 +2039,8 @@ var Se = /* @__PURE__ */ new Map(), v = {
|
|
|
2148
2039
|
preventExtensions: (e) => Object.preventExtensions(e)
|
|
2149
2040
|
};
|
|
2150
2041
|
function Dt(e, t, n, s = {}) {
|
|
2151
|
-
const { channel: r = "", sender: i = "", reflect: o =
|
|
2152
|
-
let l = null,
|
|
2042
|
+
const { channel: r = "", sender: i = "", reflect: o = Ot } = s, a = s.target ?? z(t), c = [];
|
|
2043
|
+
let l = null, h = t;
|
|
2153
2044
|
switch (String(e).toLowerCase()) {
|
|
2154
2045
|
case "import":
|
|
2155
2046
|
case d.IMPORT:
|
|
@@ -2165,13 +2056,13 @@ function Dt(e, t, n, s = {}) {
|
|
|
2165
2056
|
case "get":
|
|
2166
2057
|
case d.GET: {
|
|
2167
2058
|
const p = n?.[0], w = o.get?.(a, p) ?? a?.[p];
|
|
2168
|
-
l = typeof w == "function" && a != null ? w.bind(a) : w,
|
|
2059
|
+
l = typeof w == "function" && a != null ? w.bind(a) : w, h = [...t, String(p)];
|
|
2169
2060
|
break;
|
|
2170
2061
|
}
|
|
2171
2062
|
case "set":
|
|
2172
2063
|
case d.SET: {
|
|
2173
|
-
const [p, w] = n,
|
|
2174
|
-
s.target ? l = o.set?.(a, p,
|
|
2064
|
+
const [p, w] = n, S = B(w, Ee);
|
|
2065
|
+
s.target ? l = o.set?.(a, p, S) ?? (a[p] = S, !0) : l = o.set?.(a, p, S) ?? ye([...t, String(p)], S);
|
|
2175
2066
|
break;
|
|
2176
2067
|
}
|
|
2177
2068
|
case "apply":
|
|
@@ -2179,7 +2070,7 @@ function Dt(e, t, n, s = {}) {
|
|
|
2179
2070
|
case d.APPLY:
|
|
2180
2071
|
case d.CALL:
|
|
2181
2072
|
if (typeof a == "function") {
|
|
2182
|
-
const p = s.context ?? (s.target ? void 0 :
|
|
2073
|
+
const p = s.context ?? (s.target ? void 0 : z(t.slice(0, -1))), w = B(n?.[0] ?? n ?? [], Ee);
|
|
2183
2074
|
l = o.apply?.(a, p, w) ?? a.apply(p, w), Re(l) && t?.at(-1) === "transfer" && r !== i && c.push(l);
|
|
2184
2075
|
}
|
|
2185
2076
|
break;
|
|
@@ -2200,7 +2091,7 @@ function Dt(e, t, n, s = {}) {
|
|
|
2200
2091
|
const p = t[t.length - 1];
|
|
2201
2092
|
l = o.deleteProperty?.(a, p) ?? delete a[p];
|
|
2202
2093
|
} else
|
|
2203
|
-
l = t?.length > 0 ?
|
|
2094
|
+
l = t?.length > 0 ? Nt(t) : jn(a), l && (h = W.get(a) ?? []);
|
|
2204
2095
|
break;
|
|
2205
2096
|
case "has":
|
|
2206
2097
|
case d.HAS:
|
|
@@ -2236,14 +2127,14 @@ function Dt(e, t, n, s = {}) {
|
|
|
2236
2127
|
return {
|
|
2237
2128
|
result: l,
|
|
2238
2129
|
toTransfer: c,
|
|
2239
|
-
path:
|
|
2130
|
+
path: h
|
|
2240
2131
|
};
|
|
2241
2132
|
}
|
|
2242
2133
|
async function Lt(e, t, n, s, r, i, o) {
|
|
2243
2134
|
const a = await i, c = Re(a) && o.includes(a) || L(a);
|
|
2244
2135
|
let l = r;
|
|
2245
|
-
!c && t !== "get" && t !== d.GET && (typeof a == "object" || typeof a == "function") && (
|
|
2246
|
-
const
|
|
2136
|
+
!c && t !== "get" && t !== d.GET && (typeof a == "object" || typeof a == "function") && (Vn(a) ? (l = [u()], ye(l, a)) : l = W.get(a) ?? []);
|
|
2137
|
+
const h = z(l), p = t === "get" || t === d.GET ? l?.at(-1) : void 0, w = z(r), S = B(a, (hn) => zn(hn, n, o)) ?? a;
|
|
2247
2138
|
return {
|
|
2248
2139
|
response: {
|
|
2249
2140
|
channel: s,
|
|
@@ -2252,7 +2143,7 @@ async function Lt(e, t, n, s, r, i, o) {
|
|
|
2252
2143
|
action: t,
|
|
2253
2144
|
type: "response",
|
|
2254
2145
|
payload: {
|
|
2255
|
-
result: c ?
|
|
2146
|
+
result: c ? S : null,
|
|
2256
2147
|
type: typeof a,
|
|
2257
2148
|
channel: s,
|
|
2258
2149
|
sender: n,
|
|
@@ -2266,7 +2157,7 @@ async function Lt(e, t, n, s, r, i, o) {
|
|
|
2266
2157
|
enumerable: !0,
|
|
2267
2158
|
configurable: !0,
|
|
2268
2159
|
argumentCount: w instanceof Function ? w.length : -1,
|
|
2269
|
-
...D(
|
|
2160
|
+
...D(h) && p != null ? Object.getOwnPropertyDescriptor(h, p) : {}
|
|
2270
2161
|
}
|
|
2271
2162
|
}
|
|
2272
2163
|
},
|
|
@@ -2276,14 +2167,14 @@ async function Lt(e, t, n, s, r, i, o) {
|
|
|
2276
2167
|
async function Fe(e, t, n, s) {
|
|
2277
2168
|
const { channel: r, sender: i, path: o, action: a, args: c } = e;
|
|
2278
2169
|
if (r !== n) return null;
|
|
2279
|
-
const { result: l, toTransfer:
|
|
2170
|
+
const { result: l, toTransfer: h, path: p } = Dt(a, o, c, {
|
|
2280
2171
|
channel: r,
|
|
2281
2172
|
sender: i,
|
|
2282
2173
|
...s
|
|
2283
2174
|
});
|
|
2284
|
-
return Lt(t, a, n, i, p, l,
|
|
2175
|
+
return Lt(t, a, n, i, p, l, h);
|
|
2285
2176
|
}
|
|
2286
|
-
function
|
|
2177
|
+
function Qn(e, t = Ot) {
|
|
2287
2178
|
return async (n, s, r) => {
|
|
2288
2179
|
let i = e, o = e;
|
|
2289
2180
|
for (let c = 0; c < s.length; c++)
|
|
@@ -2327,10 +2218,10 @@ function Jn(e, t = Nt) {
|
|
|
2327
2218
|
}
|
|
2328
2219
|
};
|
|
2329
2220
|
}
|
|
2330
|
-
var
|
|
2221
|
+
var Kn = class {
|
|
2331
2222
|
_name;
|
|
2332
2223
|
_transportType;
|
|
2333
|
-
_id =
|
|
2224
|
+
_id = u();
|
|
2334
2225
|
_state = "disconnected";
|
|
2335
2226
|
_inbound = new _({ bufferSize: 1e3 });
|
|
2336
2227
|
_outbound = new _({ bufferSize: 1e3 });
|
|
@@ -2362,7 +2253,7 @@ var Xn = class {
|
|
|
2362
2253
|
}, this._setupSubscriptions();
|
|
2363
2254
|
}
|
|
2364
2255
|
subscribe(e, t) {
|
|
2365
|
-
return (t ?
|
|
2256
|
+
return (t ? bt((n) => n.sender === t)(this._inbound) : this._inbound).subscribe(typeof e == "function" ? { next: e } : e);
|
|
2366
2257
|
}
|
|
2367
2258
|
next(e) {
|
|
2368
2259
|
if (this._state !== "connected") {
|
|
@@ -2372,13 +2263,13 @@ var Xn = class {
|
|
|
2372
2263
|
this._outbound.next(e), this._stats.messagesSent++;
|
|
2373
2264
|
}
|
|
2374
2265
|
async request(e, t, n = {}) {
|
|
2375
|
-
const s =
|
|
2266
|
+
const s = u(), r = Promise.withResolvers();
|
|
2376
2267
|
this._pending.set(s, r);
|
|
2377
2268
|
const i = setTimeout(() => {
|
|
2378
2269
|
this._pending.has(s) && (this._pending.delete(s), r.reject(/* @__PURE__ */ new Error("Request timeout")));
|
|
2379
2270
|
}, n.timeout ?? this._opts.timeout);
|
|
2380
2271
|
return this.next({
|
|
2381
|
-
id:
|
|
2272
|
+
id: u(),
|
|
2382
2273
|
channel: e,
|
|
2383
2274
|
sender: this._name,
|
|
2384
2275
|
type: "request",
|
|
@@ -2393,7 +2284,7 @@ var Xn = class {
|
|
|
2393
2284
|
}
|
|
2394
2285
|
respond(e, t) {
|
|
2395
2286
|
this.next({
|
|
2396
|
-
id:
|
|
2287
|
+
id: u(),
|
|
2397
2288
|
channel: e.sender,
|
|
2398
2289
|
sender: this._name,
|
|
2399
2290
|
type: "response",
|
|
@@ -2404,7 +2295,7 @@ var Xn = class {
|
|
|
2404
2295
|
}
|
|
2405
2296
|
emit(e, t, n) {
|
|
2406
2297
|
this.next({
|
|
2407
|
-
id:
|
|
2298
|
+
id: u(),
|
|
2408
2299
|
channel: e,
|
|
2409
2300
|
sender: this._name,
|
|
2410
2301
|
type: "event",
|
|
@@ -2492,14 +2383,14 @@ var Xn = class {
|
|
|
2492
2383
|
connectedChannels: new Set(this._connectedPeers.keys())
|
|
2493
2384
|
};
|
|
2494
2385
|
}
|
|
2495
|
-
},
|
|
2386
|
+
}, Yn = class ne {
|
|
2496
2387
|
_connections = /* @__PURE__ */ new Map();
|
|
2497
2388
|
static _instance = null;
|
|
2498
2389
|
static getInstance() {
|
|
2499
2390
|
return ne._instance || (ne._instance = new ne()), ne._instance;
|
|
2500
2391
|
}
|
|
2501
2392
|
getOrCreate(t, n = "internal", s = {}) {
|
|
2502
|
-
return this._connections.has(t) || this._connections.set(t, new
|
|
2393
|
+
return this._connections.has(t) || this._connections.set(t, new Kn(t, n, s)), this._connections.get(t);
|
|
2503
2394
|
}
|
|
2504
2395
|
get(t) {
|
|
2505
2396
|
return this._connections.get(t);
|
|
@@ -2519,7 +2410,7 @@ var Xn = class {
|
|
|
2519
2410
|
get names() {
|
|
2520
2411
|
return [...this._connections.keys()];
|
|
2521
2412
|
}
|
|
2522
|
-
},
|
|
2413
|
+
}, Ue = () => Yn.getInstance(), Bt = (e, t, n) => Ue().getOrCreate(e, t, n), Hr = (e = "$host$", t) => Bt(e, "internal", {
|
|
2523
2414
|
...t,
|
|
2524
2415
|
metadata: {
|
|
2525
2416
|
...t?.metadata,
|
|
@@ -2577,7 +2468,7 @@ var Xn = class {
|
|
|
2577
2468
|
get outbound() {
|
|
2578
2469
|
return this._outbound;
|
|
2579
2470
|
}
|
|
2580
|
-
},
|
|
2471
|
+
}, Jn = class extends T {
|
|
2581
2472
|
_workerSource;
|
|
2582
2473
|
_worker = null;
|
|
2583
2474
|
_cleanup = null;
|
|
@@ -2588,7 +2479,7 @@ var Xn = class {
|
|
|
2588
2479
|
attach() {
|
|
2589
2480
|
if (this._isAttached) return;
|
|
2590
2481
|
this._worker = this._resolveWorker();
|
|
2591
|
-
const e =
|
|
2482
|
+
const e = y(this._worker);
|
|
2592
2483
|
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;
|
|
2593
2484
|
}
|
|
2594
2485
|
detach() {
|
|
@@ -2602,7 +2493,7 @@ var Xn = class {
|
|
|
2602
2493
|
sender: t,
|
|
2603
2494
|
options: n,
|
|
2604
2495
|
messagePort: s,
|
|
2605
|
-
reqId:
|
|
2496
|
+
reqId: u()
|
|
2606
2497
|
}, { transfer: r });
|
|
2607
2498
|
}
|
|
2608
2499
|
connectChannel(e, t, n, s) {
|
|
@@ -2613,12 +2504,12 @@ var Xn = class {
|
|
|
2613
2504
|
sender: t,
|
|
2614
2505
|
port: n,
|
|
2615
2506
|
options: s,
|
|
2616
|
-
reqId:
|
|
2507
|
+
reqId: u()
|
|
2617
2508
|
}, { transfer: r });
|
|
2618
2509
|
}
|
|
2619
2510
|
listChannels() {
|
|
2620
2511
|
return new Promise((e) => {
|
|
2621
|
-
const t =
|
|
2512
|
+
const t = u(), n = (r) => {
|
|
2622
2513
|
const i = r;
|
|
2623
2514
|
i.type === "channelList" && i.reqId === t && (s.unsubscribe(), e(i.channels ?? []));
|
|
2624
2515
|
}, s = this._inbound.subscribe(n);
|
|
@@ -2632,7 +2523,7 @@ var Xn = class {
|
|
|
2632
2523
|
}
|
|
2633
2524
|
_handleIncoming(e) {
|
|
2634
2525
|
(e?.type === "channelCreated" || e?.type === "channelConnected") && this._emitIncomingConnection({
|
|
2635
|
-
id: e.reqId ??
|
|
2526
|
+
id: e.reqId ?? u(),
|
|
2636
2527
|
channel: e.channel,
|
|
2637
2528
|
sender: e.sender ?? "worker",
|
|
2638
2529
|
transportType: "worker",
|
|
@@ -2651,7 +2542,7 @@ var Xn = class {
|
|
|
2651
2542
|
get worker() {
|
|
2652
2543
|
return this._worker;
|
|
2653
2544
|
}
|
|
2654
|
-
},
|
|
2545
|
+
}, Xn = class extends T {
|
|
2655
2546
|
_port;
|
|
2656
2547
|
_cleanup = null;
|
|
2657
2548
|
constructor(e, t, n = {}) {
|
|
@@ -2659,7 +2550,7 @@ var Xn = class {
|
|
|
2659
2550
|
}
|
|
2660
2551
|
attach() {
|
|
2661
2552
|
if (this._isAttached) return;
|
|
2662
|
-
const e =
|
|
2553
|
+
const e = y(this._port);
|
|
2663
2554
|
this._cleanup = m(this._port, (t) => this._inbound.next(t)), this._subscriptions.push(this._outbound.subscribe((t) => e(t, t.transferable))), this._isAttached = !0;
|
|
2664
2555
|
}
|
|
2665
2556
|
detach() {
|
|
@@ -2668,7 +2559,7 @@ var Xn = class {
|
|
|
2668
2559
|
get port() {
|
|
2669
2560
|
return this._port;
|
|
2670
2561
|
}
|
|
2671
|
-
},
|
|
2562
|
+
}, Zn = class extends T {
|
|
2672
2563
|
_bcName;
|
|
2673
2564
|
_channel = null;
|
|
2674
2565
|
_cleanup = null;
|
|
@@ -2679,7 +2570,7 @@ var Xn = class {
|
|
|
2679
2570
|
attach() {
|
|
2680
2571
|
if (this._isAttached) return;
|
|
2681
2572
|
this._channel = new BroadcastChannel(this._bcName ?? this._channelName);
|
|
2682
|
-
const e =
|
|
2573
|
+
const e = y(this._channel);
|
|
2683
2574
|
this._cleanup = m(this._channel, (t) => {
|
|
2684
2575
|
t?.sender !== this._channelName && this._handleIncoming(t);
|
|
2685
2576
|
}), this._subscriptions.push(this._outbound.subscribe((t) => e(t))), this._isAttached = !0, this._announcePresence();
|
|
@@ -2688,7 +2579,7 @@ var Xn = class {
|
|
|
2688
2579
|
if (e?.type === "announce" || e?.type === "connect") {
|
|
2689
2580
|
const t = e.sender ?? "unknown", n = !this._connectedPeers.has(t);
|
|
2690
2581
|
this._connectedPeers.add(t), n && (this._emitIncomingConnection({
|
|
2691
|
-
id: e.reqId ??
|
|
2582
|
+
id: e.reqId ?? u(),
|
|
2692
2583
|
channel: e.channel ?? this._channelName,
|
|
2693
2584
|
sender: t,
|
|
2694
2585
|
transportType: "broadcast",
|
|
@@ -2716,7 +2607,7 @@ var Xn = class {
|
|
|
2716
2607
|
detach() {
|
|
2717
2608
|
this._cleanup?.(), this._channel?.close(), this._channel = null, this._connectedPeers.clear(), super.detach();
|
|
2718
2609
|
}
|
|
2719
|
-
},
|
|
2610
|
+
}, es = class extends T {
|
|
2720
2611
|
_url;
|
|
2721
2612
|
_protocols;
|
|
2722
2613
|
_ws = null;
|
|
@@ -2739,7 +2630,7 @@ var Xn = class {
|
|
|
2739
2630
|
};
|
|
2740
2631
|
this._ws.addEventListener("open", () => {
|
|
2741
2632
|
this._state.next("open"), this._pending.forEach((n) => t(n)), this._pending = [], this._emitIncomingConnection({
|
|
2742
|
-
id:
|
|
2633
|
+
id: u(),
|
|
2743
2634
|
channel: this._channelName,
|
|
2744
2635
|
sender: "server",
|
|
2745
2636
|
transportType: "websocket",
|
|
@@ -2753,7 +2644,7 @@ var Xn = class {
|
|
|
2753
2644
|
if (e?.type === "channel-connect" || e?.type === "peer-connect" || e?.type === "join") {
|
|
2754
2645
|
const t = e.channel ?? e.room ?? this._channelName;
|
|
2755
2646
|
this._connectedChannels.has(t) || (this._connectedChannels.add(t), this._emitIncomingConnection({
|
|
2756
|
-
id: e.id ??
|
|
2647
|
+
id: e.id ?? u(),
|
|
2757
2648
|
channel: t,
|
|
2758
2649
|
sender: e.sender ?? e.peerId ?? "remote",
|
|
2759
2650
|
transportType: "websocket",
|
|
@@ -2765,7 +2656,7 @@ var Xn = class {
|
|
|
2765
2656
|
}
|
|
2766
2657
|
joinChannel(e) {
|
|
2767
2658
|
this.send({
|
|
2768
|
-
id:
|
|
2659
|
+
id: u(),
|
|
2769
2660
|
type: "join",
|
|
2770
2661
|
channel: e,
|
|
2771
2662
|
sender: this._channelName,
|
|
@@ -2774,7 +2665,7 @@ var Xn = class {
|
|
|
2774
2665
|
}
|
|
2775
2666
|
leaveChannel(e) {
|
|
2776
2667
|
this._connectedChannels.delete(e), this.send({
|
|
2777
|
-
id:
|
|
2668
|
+
id: u(),
|
|
2778
2669
|
type: "leave",
|
|
2779
2670
|
channel: e,
|
|
2780
2671
|
sender: this._channelName,
|
|
@@ -2793,20 +2684,20 @@ var Xn = class {
|
|
|
2793
2684
|
get state() {
|
|
2794
2685
|
return this._state;
|
|
2795
2686
|
}
|
|
2796
|
-
},
|
|
2687
|
+
}, ts = class extends T {
|
|
2797
2688
|
_cleanup = null;
|
|
2798
2689
|
constructor(e, t = {}) {
|
|
2799
2690
|
super(e, "chrome-runtime", t);
|
|
2800
2691
|
}
|
|
2801
2692
|
attach() {
|
|
2802
2693
|
if (this._isAttached || typeof chrome > "u" || !chrome.runtime) return;
|
|
2803
|
-
const e =
|
|
2694
|
+
const e = y("chrome-runtime");
|
|
2804
2695
|
this._cleanup = m("chrome-runtime", (t) => this._inbound.next(t), void 0), this._subscriptions.push(this._outbound.subscribe((t) => e(t))), this._isAttached = !0;
|
|
2805
2696
|
}
|
|
2806
2697
|
detach() {
|
|
2807
2698
|
this._cleanup?.(), super.detach();
|
|
2808
2699
|
}
|
|
2809
|
-
},
|
|
2700
|
+
}, ns = class extends T {
|
|
2810
2701
|
_tabId;
|
|
2811
2702
|
_cleanup = null;
|
|
2812
2703
|
constructor(e, t, n = {}) {
|
|
@@ -2828,7 +2719,7 @@ var Xn = class {
|
|
|
2828
2719
|
setTabId(e) {
|
|
2829
2720
|
this._tabId = e;
|
|
2830
2721
|
}
|
|
2831
|
-
},
|
|
2722
|
+
}, ss = class extends T {
|
|
2832
2723
|
_portName;
|
|
2833
2724
|
_tabId;
|
|
2834
2725
|
_cleanup = null;
|
|
@@ -2855,7 +2746,7 @@ var Xn = class {
|
|
|
2855
2746
|
detach() {
|
|
2856
2747
|
this._cleanup?.(), super.detach();
|
|
2857
2748
|
}
|
|
2858
|
-
},
|
|
2749
|
+
}, rs = class extends T {
|
|
2859
2750
|
_externalId;
|
|
2860
2751
|
_cleanup = null;
|
|
2861
2752
|
constructor(e, t, n = {}) {
|
|
@@ -2869,7 +2760,7 @@ var Xn = class {
|
|
|
2869
2760
|
detach() {
|
|
2870
2761
|
this._cleanup?.(), super.detach();
|
|
2871
2762
|
}
|
|
2872
|
-
},
|
|
2763
|
+
}, is = class extends T {
|
|
2873
2764
|
_isHost;
|
|
2874
2765
|
_cleanup = null;
|
|
2875
2766
|
constructor(e, t = !1, n = {}) {
|
|
@@ -2877,25 +2768,25 @@ var Xn = class {
|
|
|
2877
2768
|
}
|
|
2878
2769
|
attach() {
|
|
2879
2770
|
if (this._isAttached) return;
|
|
2880
|
-
const e = this._isHost ? "service-worker-host" : "service-worker-client", t =
|
|
2771
|
+
const e = this._isHost ? "service-worker-host" : "service-worker-client", t = y(e);
|
|
2881
2772
|
this._cleanup = m(e, (n) => this._inbound.next(n)), this._subscriptions.push(this._outbound.subscribe((n) => t(n, n.transferable))), this._isAttached = !0;
|
|
2882
2773
|
}
|
|
2883
2774
|
detach() {
|
|
2884
2775
|
this._cleanup?.(), super.detach();
|
|
2885
2776
|
}
|
|
2886
|
-
},
|
|
2777
|
+
}, os = class extends T {
|
|
2887
2778
|
_cleanup = null;
|
|
2888
2779
|
constructor(e, t = {}) {
|
|
2889
2780
|
super(e, "self", t);
|
|
2890
2781
|
}
|
|
2891
2782
|
attach() {
|
|
2892
2783
|
if (this._isAttached) return;
|
|
2893
|
-
const e =
|
|
2784
|
+
const e = y("self");
|
|
2894
2785
|
this._cleanup = m("self", (t) => this._handleIncoming(t)), this._subscriptions.push(this._outbound.subscribe((t) => e(t, t.transferable))), this._isAttached = !0;
|
|
2895
2786
|
}
|
|
2896
2787
|
_handleIncoming(e) {
|
|
2897
2788
|
(e?.type === "createChannel" || e?.type === "connectChannel") && this._emitIncomingConnection({
|
|
2898
|
-
id: e.reqId ??
|
|
2789
|
+
id: e.reqId ?? u(),
|
|
2899
2790
|
channel: e.channel,
|
|
2900
2791
|
sender: e.sender ?? "unknown",
|
|
2901
2792
|
transportType: "self",
|
|
@@ -2916,19 +2807,19 @@ var Xn = class {
|
|
|
2916
2807
|
detach() {
|
|
2917
2808
|
this._cleanup?.(), super.detach();
|
|
2918
2809
|
}
|
|
2919
|
-
},
|
|
2920
|
-
worker: (e, t, n) => new
|
|
2921
|
-
messagePort: (e, t, n) => new
|
|
2922
|
-
broadcast: (e, t, n) => new
|
|
2923
|
-
websocket: (e, t, n, s) => new
|
|
2924
|
-
chromeRuntime: (e, t) => new
|
|
2925
|
-
chromeTabs: (e, t, n) => new
|
|
2926
|
-
chromePort: (e, t, n, s) => new
|
|
2927
|
-
chromeExternal: (e, t, n) => new
|
|
2928
|
-
serviceWorker: (e, t, n) => new
|
|
2929
|
-
self: (e, t) => new
|
|
2810
|
+
}, Gr = {
|
|
2811
|
+
worker: (e, t, n) => new Jn(e, t, n),
|
|
2812
|
+
messagePort: (e, t, n) => new Xn(e, t, n),
|
|
2813
|
+
broadcast: (e, t, n) => new Zn(e, t, n),
|
|
2814
|
+
websocket: (e, t, n, s) => new es(e, t, n, s),
|
|
2815
|
+
chromeRuntime: (e, t) => new ts(e, t),
|
|
2816
|
+
chromeTabs: (e, t, n) => new ns(e, t, n),
|
|
2817
|
+
chromePort: (e, t, n, s) => new ss(e, t, n, s),
|
|
2818
|
+
chromeExternal: (e, t, n) => new rs(e, t, n),
|
|
2819
|
+
serviceWorker: (e, t, n) => new is(e, t, n),
|
|
2820
|
+
self: (e, t) => new os(e, t)
|
|
2930
2821
|
};
|
|
2931
|
-
function
|
|
2822
|
+
function jr(e) {
|
|
2932
2823
|
const t = [], n = new _({ bufferSize: 100 });
|
|
2933
2824
|
for (const s of e) s.subscribeIncoming((r) => {
|
|
2934
2825
|
t.push(r), n.next(r);
|
|
@@ -2938,13 +2829,13 @@ function Jr(e) {
|
|
|
2938
2829
|
getConnections: () => [...t]
|
|
2939
2830
|
};
|
|
2940
2831
|
}
|
|
2941
|
-
var
|
|
2832
|
+
var as = "uniform_channels", cs = 1, f = {
|
|
2942
2833
|
MESSAGES: "messages",
|
|
2943
2834
|
MAILBOX: "mailbox",
|
|
2944
2835
|
PENDING: "pending",
|
|
2945
2836
|
EXCHANGE: "exchange",
|
|
2946
2837
|
TRANSACTIONS: "transactions"
|
|
2947
|
-
},
|
|
2838
|
+
}, ls = class {
|
|
2948
2839
|
_db = null;
|
|
2949
2840
|
_isOpen = !1;
|
|
2950
2841
|
_openPromise = null;
|
|
@@ -2956,7 +2847,7 @@ var hs = "uniform_channels", us = 1, f = {
|
|
|
2956
2847
|
}
|
|
2957
2848
|
async open() {
|
|
2958
2849
|
return this._db && this._isOpen ? this._db : this._openPromise ? this._openPromise : (this._openPromise = new Promise((e, t) => {
|
|
2959
|
-
const n = indexedDB.open(
|
|
2850
|
+
const n = indexedDB.open(as, cs);
|
|
2960
2851
|
n.onerror = () => {
|
|
2961
2852
|
this._openPromise = null, t(/* @__PURE__ */ new Error("Failed to open IndexedDB"));
|
|
2962
2853
|
}, n.onsuccess = () => {
|
|
@@ -2991,7 +2882,7 @@ var hs = "uniform_channels", us = 1, f = {
|
|
|
2991
2882
|
}
|
|
2992
2883
|
async defer(e, t = {}) {
|
|
2993
2884
|
const n = await this.open(), s = {
|
|
2994
|
-
id:
|
|
2885
|
+
id: u(),
|
|
2995
2886
|
channel: e.channel,
|
|
2996
2887
|
sender: e.sender ?? this._channelName,
|
|
2997
2888
|
recipient: e.channel,
|
|
@@ -3099,7 +2990,7 @@ var hs = "uniform_channels", us = 1, f = {
|
|
|
3099
2990
|
}
|
|
3100
2991
|
async registerPending(e) {
|
|
3101
2992
|
const t = await this.open(), n = {
|
|
3102
|
-
id:
|
|
2993
|
+
id: u(),
|
|
3103
2994
|
channel: this._channelName,
|
|
3104
2995
|
type: e.type,
|
|
3105
2996
|
data: e.data,
|
|
@@ -3146,7 +3037,7 @@ var hs = "uniform_channels", us = 1, f = {
|
|
|
3146
3037
|
}
|
|
3147
3038
|
async exchangePut(e, t, n = {}) {
|
|
3148
3039
|
const s = await this.open(), r = {
|
|
3149
|
-
id:
|
|
3040
|
+
id: u(),
|
|
3150
3041
|
key: e,
|
|
3151
3042
|
value: t,
|
|
3152
3043
|
owner: this._channelName,
|
|
@@ -3158,8 +3049,8 @@ var hs = "uniform_channels", us = 1, f = {
|
|
|
3158
3049
|
return new Promise((i, o) => {
|
|
3159
3050
|
const a = s.transaction(f.EXCHANGE, "readwrite"), c = a.objectStore(f.EXCHANGE), l = c.index("key").get(e);
|
|
3160
3051
|
l.onsuccess = () => {
|
|
3161
|
-
const
|
|
3162
|
-
|
|
3052
|
+
const h = l.result;
|
|
3053
|
+
h && (r.id = h.id, r.version = h.version + 1, r.createdAt = h.createdAt), c.put(r);
|
|
3163
3054
|
}, a.oncomplete = () => {
|
|
3164
3055
|
this._exchangeUpdates.next(r), i(r.id);
|
|
3165
3056
|
}, a.onerror = () => o(/* @__PURE__ */ new Error("Failed to put exchange data"));
|
|
@@ -3237,7 +3128,7 @@ var hs = "uniform_channels", us = 1, f = {
|
|
|
3237
3128
|
return e.owner === this._channelName || e.sharedWith.includes("*") ? !0 : e.sharedWith.includes(this._channelName);
|
|
3238
3129
|
}
|
|
3239
3130
|
async beginTransaction() {
|
|
3240
|
-
return new
|
|
3131
|
+
return new us(this);
|
|
3241
3132
|
}
|
|
3242
3133
|
async executeTransaction(e) {
|
|
3243
3134
|
const t = await this.open(), n = new Set(e.map((s) => s.store));
|
|
@@ -3281,23 +3172,23 @@ var hs = "uniform_channels", us = 1, f = {
|
|
|
3281
3172
|
let a = 0;
|
|
3282
3173
|
const c = i.openCursor();
|
|
3283
3174
|
c.onsuccess = () => {
|
|
3284
|
-
const
|
|
3285
|
-
if (
|
|
3286
|
-
const p =
|
|
3287
|
-
p.expiresAt && p.expiresAt < t && (
|
|
3175
|
+
const h = c.result;
|
|
3176
|
+
if (h) {
|
|
3177
|
+
const p = h.value;
|
|
3178
|
+
p.expiresAt && p.expiresAt < t && (h.delete(), a++), h.continue();
|
|
3288
3179
|
}
|
|
3289
3180
|
};
|
|
3290
3181
|
const l = o.openCursor();
|
|
3291
3182
|
l.onsuccess = () => {
|
|
3292
|
-
const
|
|
3293
|
-
if (
|
|
3294
|
-
const p =
|
|
3295
|
-
p.expiresAt && p.expiresAt < t && (
|
|
3183
|
+
const h = l.result;
|
|
3184
|
+
if (h) {
|
|
3185
|
+
const p = h.value;
|
|
3186
|
+
p.expiresAt && p.expiresAt < t && (h.delete(), a++), h.continue();
|
|
3296
3187
|
}
|
|
3297
3188
|
}, r.oncomplete = () => n(a), r.onerror = () => s(/* @__PURE__ */ new Error("Failed to cleanup expired"));
|
|
3298
3189
|
});
|
|
3299
3190
|
}
|
|
3300
|
-
},
|
|
3191
|
+
}, us = class {
|
|
3301
3192
|
_storage;
|
|
3302
3193
|
_operations = [];
|
|
3303
3194
|
_isCommitted = !1;
|
|
@@ -3307,7 +3198,7 @@ var hs = "uniform_channels", us = 1, f = {
|
|
|
3307
3198
|
}
|
|
3308
3199
|
put(e, t) {
|
|
3309
3200
|
return this._checkState(), this._operations.push({
|
|
3310
|
-
id:
|
|
3201
|
+
id: u(),
|
|
3311
3202
|
type: "put",
|
|
3312
3203
|
store: e,
|
|
3313
3204
|
value: t,
|
|
@@ -3316,7 +3207,7 @@ var hs = "uniform_channels", us = 1, f = {
|
|
|
3316
3207
|
}
|
|
3317
3208
|
delete(e, t) {
|
|
3318
3209
|
return this._checkState(), this._operations.push({
|
|
3319
|
-
id:
|
|
3210
|
+
id: u(),
|
|
3320
3211
|
type: "delete",
|
|
3321
3212
|
store: e,
|
|
3322
3213
|
key: t,
|
|
@@ -3325,7 +3216,7 @@ var hs = "uniform_channels", us = 1, f = {
|
|
|
3325
3216
|
}
|
|
3326
3217
|
update(e, t, n) {
|
|
3327
3218
|
return this._checkState(), this._operations.push({
|
|
3328
|
-
id:
|
|
3219
|
+
id: u(),
|
|
3329
3220
|
type: "update",
|
|
3330
3221
|
store: e,
|
|
3331
3222
|
key: t,
|
|
@@ -3352,13 +3243,13 @@ var hs = "uniform_channels", us = 1, f = {
|
|
|
3352
3243
|
}
|
|
3353
3244
|
}, se = /* @__PURE__ */ new Map();
|
|
3354
3245
|
function Wt(e) {
|
|
3355
|
-
return se.has(e) || se.set(e, new
|
|
3246
|
+
return se.has(e) || se.set(e, new ls(e)), se.get(e);
|
|
3356
3247
|
}
|
|
3357
|
-
function
|
|
3248
|
+
function Vr() {
|
|
3358
3249
|
for (const e of se.values()) e.close();
|
|
3359
3250
|
se.clear();
|
|
3360
3251
|
}
|
|
3361
|
-
var st = Mt(),
|
|
3252
|
+
var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "", $t = class {
|
|
3362
3253
|
_channel;
|
|
3363
3254
|
_context;
|
|
3364
3255
|
_options;
|
|
@@ -3369,7 +3260,7 @@ var st = Mt(), ps = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3369
3260
|
}
|
|
3370
3261
|
async request(e, t, n, s = {}) {
|
|
3371
3262
|
let r = typeof e == "string" ? [e] : e, i = t, o = n;
|
|
3372
|
-
return Array.isArray(t) &&
|
|
3263
|
+
return Array.isArray(t) && Ut(e) && (s = n, o = t, i = e, r = []), this._context.getHost()?.request(r, i, o, s, this._channel);
|
|
3373
3264
|
}
|
|
3374
3265
|
async doImportModule(e, t = {}) {
|
|
3375
3266
|
return this.request([], d.IMPORT, [e], t);
|
|
@@ -3394,7 +3285,7 @@ var st = Mt(), ps = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3394
3285
|
get context() {
|
|
3395
3286
|
return this._context;
|
|
3396
3287
|
}
|
|
3397
|
-
},
|
|
3288
|
+
}, O = class {
|
|
3398
3289
|
_channel;
|
|
3399
3290
|
_context;
|
|
3400
3291
|
_options;
|
|
@@ -3410,14 +3301,14 @@ var st = Mt(), ps = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3410
3301
|
return this._unified.__getPrivate("_transports");
|
|
3411
3302
|
}
|
|
3412
3303
|
constructor(e, t, n = {}) {
|
|
3413
|
-
this._channel = e, this._context = t, this._options = n, this._connection =
|
|
3304
|
+
this._channel = e, this._context = t, this._options = n, this._connection = Ue().getOrCreate(e, "internal", n), this._unified = new It({
|
|
3414
3305
|
name: e,
|
|
3415
3306
|
autoListen: !1,
|
|
3416
3307
|
timeout: n?.timeout
|
|
3417
3308
|
});
|
|
3418
3309
|
}
|
|
3419
3310
|
createRemoteChannel(e, t = {}, n) {
|
|
3420
|
-
const s =
|
|
3311
|
+
const s = ds(n ?? this._context.$createOrUseExistingRemote(e, t, n ?? null)?.messageChannel?.port1), r = Ht(s?.target ?? s);
|
|
3421
3312
|
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({
|
|
3422
3313
|
localChannel: this._channel,
|
|
3423
3314
|
remoteChannel: e,
|
|
@@ -3437,7 +3328,7 @@ var st = Mt(), ps = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3437
3328
|
}
|
|
3438
3329
|
request(e, t, n, s = {}, r = "worker") {
|
|
3439
3330
|
let i = typeof e == "string" ? [e] : e, o = n;
|
|
3440
|
-
return Array.isArray(t) &&
|
|
3331
|
+
return Array.isArray(t) && Ut(e) && (r = s, s = n, o = t, t = e, i = []), this._unified.invoke(r, t, i ?? [], Array.isArray(o) ? o : [o]);
|
|
3441
3332
|
}
|
|
3442
3333
|
resolveResponse(e, t) {
|
|
3443
3334
|
this._forResolves.get(e)?.resolve?.(t);
|
|
@@ -3464,7 +3355,7 @@ var st = Mt(), ps = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3464
3355
|
}
|
|
3465
3356
|
}, Ft = class {
|
|
3466
3357
|
_options;
|
|
3467
|
-
_id =
|
|
3358
|
+
_id = u();
|
|
3468
3359
|
_hostName;
|
|
3469
3360
|
_host = null;
|
|
3470
3361
|
_endpoints = /* @__PURE__ */ new Map();
|
|
@@ -3473,7 +3364,7 @@ var st = Mt(), ps = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3473
3364
|
_remoteChannels = /* @__PURE__ */ new Map();
|
|
3474
3365
|
_deferredChannels = /* @__PURE__ */ new Map();
|
|
3475
3366
|
_connectionEvents = new _({ bufferSize: 200 });
|
|
3476
|
-
_connectionRegistry = new Et(() =>
|
|
3367
|
+
_connectionRegistry = new Et(() => u(), (e) => this._emitConnectionEvent(e));
|
|
3477
3368
|
_closed = !1;
|
|
3478
3369
|
_globalSelf = null;
|
|
3479
3370
|
constructor(e = {}) {
|
|
@@ -3484,7 +3375,7 @@ var st = Mt(), ps = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3484
3375
|
const t = e ?? this._hostName;
|
|
3485
3376
|
if (this._hostName = t, this._endpoints.has(t))
|
|
3486
3377
|
return this._host = this._endpoints.get(t).handler, this._host;
|
|
3487
|
-
this._host = new
|
|
3378
|
+
this._host = new O(t, this, this._options.defaultOptions);
|
|
3488
3379
|
const n = {
|
|
3489
3380
|
name: t,
|
|
3490
3381
|
handler: this._host,
|
|
@@ -3534,7 +3425,7 @@ var st = Mt(), ps = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3534
3425
|
}
|
|
3535
3426
|
createChannel(e, t = {}) {
|
|
3536
3427
|
if (this._endpoints.has(e)) return this._endpoints.get(e);
|
|
3537
|
-
const n = new
|
|
3428
|
+
const n = new O(e, this, {
|
|
3538
3429
|
...this._options.defaultOptions,
|
|
3539
3430
|
...t
|
|
3540
3431
|
}), s = {
|
|
@@ -3585,7 +3476,7 @@ var st = Mt(), ps = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3585
3476
|
async addWorker(e, t, n = {}) {
|
|
3586
3477
|
const s = rt(t);
|
|
3587
3478
|
if (!s) throw new Error(`Failed to create worker for channel: ${e}`);
|
|
3588
|
-
const r = new
|
|
3479
|
+
const r = new O(e, this, {
|
|
3589
3480
|
...this._options.defaultOptions,
|
|
3590
3481
|
...n
|
|
3591
3482
|
}), i = r.createRemoteChannel(e, n, s), o = {
|
|
@@ -3606,7 +3497,7 @@ var st = Mt(), ps = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3606
3497
|
}), o;
|
|
3607
3498
|
}
|
|
3608
3499
|
async addPort(e, t, n = {}) {
|
|
3609
|
-
const s = new
|
|
3500
|
+
const s = new O(e, this, {
|
|
3610
3501
|
...this._options.defaultOptions,
|
|
3611
3502
|
...n
|
|
3612
3503
|
});
|
|
@@ -3629,7 +3520,7 @@ var st = Mt(), ps = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3629
3520
|
}), i;
|
|
3630
3521
|
}
|
|
3631
3522
|
async addBroadcast(e, t, n = {}) {
|
|
3632
|
-
const s = new BroadcastChannel(t ?? e), r = new
|
|
3523
|
+
const s = new BroadcastChannel(t ?? e), r = new O(e, this, {
|
|
3633
3524
|
...this._options.defaultOptions,
|
|
3634
3525
|
...n
|
|
3635
3526
|
}), i = r.createRemoteChannel(e, n, s), o = {
|
|
@@ -3650,7 +3541,7 @@ var st = Mt(), ps = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3650
3541
|
}), o;
|
|
3651
3542
|
}
|
|
3652
3543
|
addSelfChannel(e, t = {}) {
|
|
3653
|
-
const n = new
|
|
3544
|
+
const n = new O(e, this, {
|
|
3654
3545
|
...this._options.defaultOptions,
|
|
3655
3546
|
...t
|
|
3656
3547
|
}), s = this._globalSelf ?? (typeof self < "u" ? self : null), r = {
|
|
@@ -3683,10 +3574,10 @@ var st = Mt(), ps = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3683
3574
|
}
|
|
3684
3575
|
}
|
|
3685
3576
|
createChannelPair(e, t, n = {}) {
|
|
3686
|
-
const s = new MessageChannel(), r = new
|
|
3577
|
+
const s = new MessageChannel(), r = new O(e, this, {
|
|
3687
3578
|
...this._options.defaultOptions,
|
|
3688
3579
|
...n
|
|
3689
|
-
}), i = new
|
|
3580
|
+
}), i = new O(t, this, {
|
|
3690
3581
|
...this._options.defaultOptions,
|
|
3691
3582
|
...n
|
|
3692
3583
|
});
|
|
@@ -3726,8 +3617,8 @@ var st = Mt(), ps = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3726
3617
|
$createOrUseExistingRemote(e, t = {}, n) {
|
|
3727
3618
|
if (e == null || n) return null;
|
|
3728
3619
|
if (this._remoteChannels.has(e)) return this._remoteChannels.get(e);
|
|
3729
|
-
const s = new MessageChannel(), r =
|
|
3730
|
-
const a = rt(
|
|
3620
|
+
const s = new MessageChannel(), r = yt(new Promise((o) => {
|
|
3621
|
+
const a = rt(hs);
|
|
3731
3622
|
a?.addEventListener?.("message", (c) => {
|
|
3732
3623
|
c.data.type === "channelCreated" && (s.port1?.start?.(), o(new $t(c.data.channel, this, t)));
|
|
3733
3624
|
}), a?.postMessage?.({
|
|
@@ -3814,12 +3705,12 @@ var st = Mt(), ps = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
|
|
|
3814
3705
|
});
|
|
3815
3706
|
}
|
|
3816
3707
|
};
|
|
3817
|
-
function
|
|
3708
|
+
function Ut(e) {
|
|
3818
3709
|
return [...Object.values(d)].includes(e);
|
|
3819
3710
|
}
|
|
3820
|
-
function
|
|
3711
|
+
function ds(e) {
|
|
3821
3712
|
if (!e) return null;
|
|
3822
|
-
if (
|
|
3713
|
+
if (zt(e)) return e;
|
|
3823
3714
|
const t = e, n = Ht(t);
|
|
3824
3715
|
return {
|
|
3825
3716
|
target: t,
|
|
@@ -3841,11 +3732,11 @@ function _s(e) {
|
|
|
3841
3732
|
close: t.close?.bind(t)
|
|
3842
3733
|
};
|
|
3843
3734
|
}
|
|
3844
|
-
function
|
|
3735
|
+
function zt(e) {
|
|
3845
3736
|
return !!e && typeof e == "object" && "target" in e && typeof e.postMessage == "function";
|
|
3846
3737
|
}
|
|
3847
3738
|
function Ht(e) {
|
|
3848
|
-
const t =
|
|
3739
|
+
const t = zt(e) ? e.target : e;
|
|
3849
3740
|
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";
|
|
3850
3741
|
}
|
|
3851
3742
|
function rt(e) {
|
|
@@ -3869,30 +3760,30 @@ function ce(e = {}) {
|
|
|
3869
3760
|
const t = new Ft(e);
|
|
3870
3761
|
return e.name && $.set(e.name, t), t;
|
|
3871
3762
|
}
|
|
3872
|
-
function
|
|
3763
|
+
function fs(e, t = {}) {
|
|
3873
3764
|
return $.has(e) ? $.get(e) : ce({
|
|
3874
3765
|
...t,
|
|
3875
3766
|
name: e
|
|
3876
3767
|
});
|
|
3877
3768
|
}
|
|
3878
|
-
function
|
|
3769
|
+
function Qr(e) {
|
|
3879
3770
|
return $.get(e);
|
|
3880
3771
|
}
|
|
3881
|
-
function
|
|
3772
|
+
function Kr(e) {
|
|
3882
3773
|
const t = $.get(e);
|
|
3883
3774
|
return t ? (t.close(), $.delete(e)) : !1;
|
|
3884
3775
|
}
|
|
3885
|
-
function
|
|
3776
|
+
function Yr() {
|
|
3886
3777
|
return [...$.keys()];
|
|
3887
3778
|
}
|
|
3888
|
-
function
|
|
3779
|
+
function ps(e, t = {}) {
|
|
3889
3780
|
const n = ce(t);
|
|
3890
3781
|
return {
|
|
3891
3782
|
context: n,
|
|
3892
3783
|
channels: n.createChannels(e)
|
|
3893
3784
|
};
|
|
3894
3785
|
}
|
|
3895
|
-
async function
|
|
3786
|
+
async function _s(e, t, n = {}) {
|
|
3896
3787
|
const s = ce(n.contextOptions);
|
|
3897
3788
|
return {
|
|
3898
3789
|
context: s,
|
|
@@ -3902,28 +3793,28 @@ async function bs(e, t, n = {}) {
|
|
|
3902
3793
|
})
|
|
3903
3794
|
};
|
|
3904
3795
|
}
|
|
3905
|
-
async function
|
|
3796
|
+
async function Jr(e, t, n = {}) {
|
|
3906
3797
|
return F().addWorker(e, t, n);
|
|
3907
3798
|
}
|
|
3908
|
-
async function
|
|
3799
|
+
async function Xr(e, t, n = {}) {
|
|
3909
3800
|
return F().addPort(e, t, n);
|
|
3910
3801
|
}
|
|
3911
|
-
async function
|
|
3802
|
+
async function Zr(e, t, n = {}) {
|
|
3912
3803
|
return F().addBroadcast(e, t, n);
|
|
3913
3804
|
}
|
|
3914
|
-
function
|
|
3805
|
+
function ei(e, t = {}) {
|
|
3915
3806
|
return F().addSelfChannel(e, t);
|
|
3916
3807
|
}
|
|
3917
|
-
function
|
|
3808
|
+
function ti(e, t) {
|
|
3918
3809
|
F().defer(e, t);
|
|
3919
3810
|
}
|
|
3920
|
-
async function
|
|
3811
|
+
async function ni(e) {
|
|
3921
3812
|
return F().initDeferred(e);
|
|
3922
3813
|
}
|
|
3923
|
-
async function
|
|
3814
|
+
async function si(e) {
|
|
3924
3815
|
return F().getChannelAsync(e);
|
|
3925
3816
|
}
|
|
3926
|
-
function
|
|
3817
|
+
function ri(e, t, n = {}) {
|
|
3927
3818
|
return F().createChannelPair(e, t, n);
|
|
3928
3819
|
}
|
|
3929
3820
|
var P = class {
|
|
@@ -3969,7 +3860,7 @@ var P = class {
|
|
|
3969
3860
|
_worker;
|
|
3970
3861
|
_send;
|
|
3971
3862
|
constructor(e) {
|
|
3972
|
-
super(), this._worker = e, this._send =
|
|
3863
|
+
super(), this._worker = e, this._send = y(this._worker);
|
|
3973
3864
|
}
|
|
3974
3865
|
next(e, t) {
|
|
3975
3866
|
this._send(e, t);
|
|
@@ -3987,7 +3878,7 @@ var P = class {
|
|
|
3987
3878
|
_port;
|
|
3988
3879
|
_send;
|
|
3989
3880
|
constructor(e) {
|
|
3990
|
-
super(), this._port = e, this._send =
|
|
3881
|
+
super(), this._port = e, this._send = y(this._port);
|
|
3991
3882
|
}
|
|
3992
3883
|
next(e, t) {
|
|
3993
3884
|
this._send(e, t);
|
|
@@ -3998,12 +3889,12 @@ var P = class {
|
|
|
3998
3889
|
get port() {
|
|
3999
3890
|
return this._port;
|
|
4000
3891
|
}
|
|
4001
|
-
},
|
|
3892
|
+
}, ms = class extends P {
|
|
4002
3893
|
_name;
|
|
4003
3894
|
_channel;
|
|
4004
3895
|
_send;
|
|
4005
3896
|
constructor(e) {
|
|
4006
|
-
super(), this._name = e, this._channel = new BroadcastChannel(e), this._send =
|
|
3897
|
+
super(), this._name = e, this._channel = new BroadcastChannel(e), this._send = y(this._channel);
|
|
4007
3898
|
}
|
|
4008
3899
|
next(e) {
|
|
4009
3900
|
this._send(e);
|
|
@@ -4016,7 +3907,7 @@ var P = class {
|
|
|
4016
3907
|
close() {
|
|
4017
3908
|
this._channel.close(), super.close();
|
|
4018
3909
|
}
|
|
4019
|
-
},
|
|
3910
|
+
}, gs = class extends P {
|
|
4020
3911
|
_url;
|
|
4021
3912
|
_protocols;
|
|
4022
3913
|
_ws = null;
|
|
@@ -4054,15 +3945,15 @@ var P = class {
|
|
|
4054
3945
|
get isOpen() {
|
|
4055
3946
|
return this._ws?.readyState === WebSocket.OPEN;
|
|
4056
3947
|
}
|
|
4057
|
-
},
|
|
4058
|
-
_send =
|
|
3948
|
+
}, ys = class extends P {
|
|
3949
|
+
_send = y("chrome-runtime");
|
|
4059
3950
|
next(e) {
|
|
4060
3951
|
this._send(e);
|
|
4061
3952
|
}
|
|
4062
3953
|
_activate() {
|
|
4063
3954
|
this._listening || (this._cleanup = m("chrome-runtime", (e) => this._dispatch(e)), this._listening = !0);
|
|
4064
3955
|
}
|
|
4065
|
-
},
|
|
3956
|
+
}, bs = class extends P {
|
|
4066
3957
|
_tabId;
|
|
4067
3958
|
constructor(e) {
|
|
4068
3959
|
super(), this._tabId = e;
|
|
@@ -4078,12 +3969,12 @@ var P = class {
|
|
|
4078
3969
|
_activate() {
|
|
4079
3970
|
this._listening || (this._cleanup = m("chrome-tabs", (e) => this._dispatch(e), void 0, void 0, { tabId: this._tabId }), this._listening = !0);
|
|
4080
3971
|
}
|
|
4081
|
-
},
|
|
3972
|
+
}, ws = class extends P {
|
|
4082
3973
|
_portName;
|
|
4083
3974
|
_tabId;
|
|
4084
3975
|
_send;
|
|
4085
3976
|
constructor(e, t) {
|
|
4086
|
-
super(), this._portName = e, this._tabId = t, this._send =
|
|
3977
|
+
super(), this._portName = e, this._tabId = t, this._send = y("chrome-port", {
|
|
4087
3978
|
portName: e,
|
|
4088
3979
|
tabId: t
|
|
4089
3980
|
});
|
|
@@ -4097,31 +3988,31 @@ var P = class {
|
|
|
4097
3988
|
tabId: this._tabId
|
|
4098
3989
|
}), this._listening = !0);
|
|
4099
3990
|
}
|
|
4100
|
-
},
|
|
4101
|
-
_send =
|
|
3991
|
+
}, vs = class extends P {
|
|
3992
|
+
_send = y("service-worker-client");
|
|
4102
3993
|
next(e, t) {
|
|
4103
3994
|
this._send(e, t);
|
|
4104
3995
|
}
|
|
4105
3996
|
_activate() {
|
|
4106
3997
|
this._listening || (this._cleanup = m("service-worker-client", (e) => this._dispatch(e)), this._listening = !0);
|
|
4107
3998
|
}
|
|
4108
|
-
},
|
|
4109
|
-
_send =
|
|
3999
|
+
}, Cs = class extends P {
|
|
4000
|
+
_send = y("service-worker-host");
|
|
4110
4001
|
next(e, t) {
|
|
4111
4002
|
this._send(e, t);
|
|
4112
4003
|
}
|
|
4113
4004
|
_activate() {
|
|
4114
4005
|
this._listening || (this._cleanup = m("service-worker-host", (e) => this._dispatch(e)), this._listening = !0);
|
|
4115
4006
|
}
|
|
4116
|
-
},
|
|
4117
|
-
_send =
|
|
4007
|
+
}, xs = class extends P {
|
|
4008
|
+
_send = y("self");
|
|
4118
4009
|
next(e, t) {
|
|
4119
4010
|
this._send(e, t);
|
|
4120
4011
|
}
|
|
4121
4012
|
_activate() {
|
|
4122
4013
|
this._listening || (this._cleanup = m("self", (e) => this._dispatch(e)), this._listening = !0);
|
|
4123
4014
|
}
|
|
4124
|
-
},
|
|
4015
|
+
}, ii = {
|
|
4125
4016
|
worker: (e) => new it(e),
|
|
4126
4017
|
workerFromUrl: (e, t) => new it(new Worker(typeof e == "string" ? e : e.href, {
|
|
4127
4018
|
type: "module",
|
|
@@ -4135,16 +4026,16 @@ var P = class {
|
|
|
4135
4026
|
port2: new Ie(e.port2)
|
|
4136
4027
|
};
|
|
4137
4028
|
},
|
|
4138
|
-
broadcast: (e) => new
|
|
4139
|
-
websocket: (e, t) => new
|
|
4140
|
-
chromeRuntime: () => new
|
|
4141
|
-
chromeTabs: (e) => new
|
|
4142
|
-
chromePort: (e, t) => new
|
|
4143
|
-
serviceWorkerClient: () => new
|
|
4144
|
-
serviceWorkerHost: () => new
|
|
4145
|
-
self: () => new
|
|
4029
|
+
broadcast: (e) => new ms(e),
|
|
4030
|
+
websocket: (e, t) => new gs(e, t),
|
|
4031
|
+
chromeRuntime: () => new ys(),
|
|
4032
|
+
chromeTabs: (e) => new bs(e),
|
|
4033
|
+
chromePort: (e, t) => new ws(e, t),
|
|
4034
|
+
serviceWorkerClient: () => new vs(),
|
|
4035
|
+
serviceWorkerHost: () => new Cs(),
|
|
4036
|
+
self: () => new xs()
|
|
4146
4037
|
};
|
|
4147
|
-
function
|
|
4038
|
+
function oi(e, t) {
|
|
4148
4039
|
return {
|
|
4149
4040
|
send: (n, s) => e.next(n, s),
|
|
4150
4041
|
subscribe: (n) => t.subscribe({ next: n }),
|
|
@@ -4153,7 +4044,7 @@ function ui(e, t) {
|
|
|
4153
4044
|
}
|
|
4154
4045
|
};
|
|
4155
4046
|
}
|
|
4156
|
-
var
|
|
4047
|
+
var Gt = class {
|
|
4157
4048
|
_context;
|
|
4158
4049
|
_config;
|
|
4159
4050
|
_subscriptions = [];
|
|
@@ -4163,7 +4054,7 @@ var zt = class {
|
|
|
4163
4054
|
constructor(e = {}) {
|
|
4164
4055
|
this._config = {
|
|
4165
4056
|
name: e.name ?? "worker",
|
|
4166
|
-
workerName: e.workerName ?? `worker-${
|
|
4057
|
+
workerName: e.workerName ?? `worker-${u().slice(0, 8)}`,
|
|
4167
4058
|
autoAcceptChannels: e.autoAcceptChannels ?? !0,
|
|
4168
4059
|
allowedChannels: e.allowedChannels ?? [],
|
|
4169
4060
|
maxChannels: e.maxChannels ?? 100,
|
|
@@ -4271,7 +4162,7 @@ var zt = class {
|
|
|
4271
4162
|
}
|
|
4272
4163
|
_handleCreateChannel(e) {
|
|
4273
4164
|
const t = {
|
|
4274
|
-
id: e.reqId ??
|
|
4165
|
+
id: e.reqId ?? u(),
|
|
4275
4166
|
channel: e.channel,
|
|
4276
4167
|
sender: e.sender ?? "unknown",
|
|
4277
4168
|
type: "channel",
|
|
@@ -4283,7 +4174,7 @@ var zt = class {
|
|
|
4283
4174
|
}
|
|
4284
4175
|
_handleConnectChannel(e) {
|
|
4285
4176
|
const t = {
|
|
4286
|
-
id: e.reqId ??
|
|
4177
|
+
id: e.reqId ?? u(),
|
|
4287
4178
|
channel: e.channel,
|
|
4288
4179
|
sender: e.sender ?? "unknown",
|
|
4289
4180
|
type: e.portType ?? "channel",
|
|
@@ -4303,7 +4194,7 @@ var zt = class {
|
|
|
4303
4194
|
_handleAddPort(e) {
|
|
4304
4195
|
if (!e.port || !e.channel) return;
|
|
4305
4196
|
const t = {
|
|
4306
|
-
id: e.reqId ??
|
|
4197
|
+
id: e.reqId ?? u(),
|
|
4307
4198
|
channel: e.channel,
|
|
4308
4199
|
sender: e.sender ?? "unknown",
|
|
4309
4200
|
type: "port",
|
|
@@ -4343,38 +4234,38 @@ var zt = class {
|
|
|
4343
4234
|
this._subscriptions.forEach((e) => e.unsubscribe()), this._subscriptions = [], this._incomingConnections.complete(), this._channelCreated.complete(), this._channelClosed.complete(), this._context.close();
|
|
4344
4235
|
}
|
|
4345
4236
|
}, K = null;
|
|
4346
|
-
function
|
|
4347
|
-
return K || (K = new
|
|
4237
|
+
function ze(e) {
|
|
4238
|
+
return K || (K = new Gt(e)), K;
|
|
4348
4239
|
}
|
|
4349
|
-
function
|
|
4350
|
-
return K?.close(), K = new
|
|
4240
|
+
function ai(e) {
|
|
4241
|
+
return K?.close(), K = new Gt(e), K;
|
|
4351
4242
|
}
|
|
4352
|
-
function
|
|
4353
|
-
return
|
|
4243
|
+
function ci(e) {
|
|
4244
|
+
return ze().subscribeConnections(e);
|
|
4354
4245
|
}
|
|
4355
|
-
function
|
|
4356
|
-
return
|
|
4246
|
+
function li(e) {
|
|
4247
|
+
return ze().subscribeChannelCreated(e);
|
|
4357
4248
|
}
|
|
4358
4249
|
var fe = null, pe = null;
|
|
4359
|
-
function
|
|
4360
|
-
return fe || (fe =
|
|
4250
|
+
function jt(e) {
|
|
4251
|
+
return fe || (fe = Rn(e ?? "worker"), fe.listen(self)), fe;
|
|
4361
4252
|
}
|
|
4362
4253
|
function Vt(e) {
|
|
4363
4254
|
return pe || (pe = Le(e ?? "worker"), pe.connect(self)), pe;
|
|
4364
4255
|
}
|
|
4365
|
-
function
|
|
4366
|
-
|
|
4256
|
+
function ui(e, t) {
|
|
4257
|
+
jt().expose(e, t);
|
|
4367
4258
|
}
|
|
4368
|
-
function
|
|
4369
|
-
return
|
|
4259
|
+
function hi(e) {
|
|
4260
|
+
return jt().subscribeInvocations(e);
|
|
4370
4261
|
}
|
|
4371
|
-
function
|
|
4262
|
+
function di(e = "host", t = []) {
|
|
4372
4263
|
return Vt().createProxy(e, t);
|
|
4373
4264
|
}
|
|
4374
|
-
function
|
|
4265
|
+
function fi(e, t = "host") {
|
|
4375
4266
|
return Vt().importModule(t, e);
|
|
4376
4267
|
}
|
|
4377
|
-
var
|
|
4268
|
+
var pi = ze({ name: "worker" }), be = class {
|
|
4378
4269
|
_subs = /* @__PURE__ */ new Set();
|
|
4379
4270
|
_listening = !1;
|
|
4380
4271
|
_cleanup = null;
|
|
@@ -4400,7 +4291,7 @@ var yi = Ue({ name: "worker" }), ye = class {
|
|
|
4400
4291
|
close() {
|
|
4401
4292
|
this._subs.forEach((e) => e.complete?.()), this._subs.clear(), this._deactivate();
|
|
4402
4293
|
}
|
|
4403
|
-
}, He = class extends
|
|
4294
|
+
}, He = class extends be {
|
|
4404
4295
|
_handler;
|
|
4405
4296
|
_options;
|
|
4406
4297
|
_pending = /* @__PURE__ */ new Map();
|
|
@@ -4413,7 +4304,7 @@ var yi = Ue({ name: "worker" }), ye = class {
|
|
|
4413
4304
|
chrome.runtime.sendMessage(i);
|
|
4414
4305
|
}
|
|
4415
4306
|
request(e) {
|
|
4416
|
-
const t = e.reqId ??
|
|
4307
|
+
const t = e.reqId ?? u();
|
|
4417
4308
|
return new Promise((n, s) => {
|
|
4418
4309
|
this._pending.set(t, {
|
|
4419
4310
|
resolve: n,
|
|
@@ -4435,7 +4326,7 @@ var yi = Ue({ name: "worker" }), ye = class {
|
|
|
4435
4326
|
if (this._options.filterSender && !this._options.filterSender(n) || this._options.filterMessage && !this._options.filterMessage(t)) return !1;
|
|
4436
4327
|
const r = {
|
|
4437
4328
|
...t,
|
|
4438
|
-
id: t.id ??
|
|
4329
|
+
id: t.id ?? u(),
|
|
4439
4330
|
_sender: n,
|
|
4440
4331
|
_tabId: n.tab?.id,
|
|
4441
4332
|
_frameId: n.frameId
|
|
@@ -4460,7 +4351,7 @@ var yi = Ue({ name: "worker" }), ye = class {
|
|
|
4460
4351
|
};
|
|
4461
4352
|
chrome.runtime.onMessage.addListener(e), this._cleanup = () => chrome.runtime.onMessage.removeListener(e), this._listening = !0;
|
|
4462
4353
|
}
|
|
4463
|
-
},
|
|
4354
|
+
}, Ge = class extends be {
|
|
4464
4355
|
_tabId;
|
|
4465
4356
|
_options;
|
|
4466
4357
|
constructor(e, t = {}) {
|
|
@@ -4480,7 +4371,7 @@ var yi = Ue({ name: "worker" }), ye = class {
|
|
|
4480
4371
|
if (this._tabId != null && n.tab?.id !== this._tabId || this._options.filterSender && !this._options.filterSender(n)) return;
|
|
4481
4372
|
const s = {
|
|
4482
4373
|
...t,
|
|
4483
|
-
id: t.id ??
|
|
4374
|
+
id: t.id ?? u(),
|
|
4484
4375
|
_sender: n,
|
|
4485
4376
|
_tabId: n.tab?.id,
|
|
4486
4377
|
_frameId: n.frameId
|
|
@@ -4489,7 +4380,7 @@ var yi = Ue({ name: "worker" }), ye = class {
|
|
|
4489
4380
|
};
|
|
4490
4381
|
chrome.runtime.onMessage.addListener(e), this._cleanup = () => chrome.runtime.onMessage.removeListener(e), this._listening = !0;
|
|
4491
4382
|
}
|
|
4492
|
-
},
|
|
4383
|
+
}, je = class extends be {
|
|
4493
4384
|
_portName;
|
|
4494
4385
|
_tabId;
|
|
4495
4386
|
_port = null;
|
|
@@ -4511,7 +4402,7 @@ var yi = Ue({ name: "worker" }), ye = class {
|
|
|
4511
4402
|
_setupListeners() {
|
|
4512
4403
|
this._port && (this._port.onMessage.addListener((e) => this._dispatch({
|
|
4513
4404
|
...e,
|
|
4514
|
-
id: e.id ??
|
|
4405
|
+
id: e.id ?? u()
|
|
4515
4406
|
})), this._port.onDisconnect.addListener(() => {
|
|
4516
4407
|
this._subs.forEach((e) => e.complete?.()), this._port = null;
|
|
4517
4408
|
}));
|
|
@@ -4528,7 +4419,7 @@ var yi = Ue({ name: "worker" }), ye = class {
|
|
|
4528
4419
|
get isConnected() {
|
|
4529
4420
|
return this._port != null;
|
|
4530
4421
|
}
|
|
4531
|
-
}, Qt = class extends
|
|
4422
|
+
}, Qt = class extends be {
|
|
4532
4423
|
_extensionId;
|
|
4533
4424
|
constructor(e) {
|
|
4534
4425
|
super(), this._extensionId = e;
|
|
@@ -4543,14 +4434,14 @@ var yi = Ue({ name: "worker" }), ye = class {
|
|
|
4543
4434
|
const e = (t, n) => {
|
|
4544
4435
|
this._dispatch({
|
|
4545
4436
|
...t,
|
|
4546
|
-
id: t.id ??
|
|
4437
|
+
id: t.id ?? u(),
|
|
4547
4438
|
_sender: n
|
|
4548
4439
|
});
|
|
4549
4440
|
};
|
|
4550
4441
|
chrome.runtime.onMessageExternal.addListener(e), this._cleanup = () => chrome.runtime.onMessageExternal.removeListener(e), this._listening = !0;
|
|
4551
4442
|
}
|
|
4552
4443
|
};
|
|
4553
|
-
function
|
|
4444
|
+
function _i(e, t) {
|
|
4554
4445
|
return async (n, s, r) => {
|
|
4555
4446
|
if (n.type !== "request") {
|
|
4556
4447
|
r.next(n);
|
|
@@ -4560,7 +4451,7 @@ function wi(e, t) {
|
|
|
4560
4451
|
if (i && t[i]) try {
|
|
4561
4452
|
const o = await t[i](n.payload?.args ?? [], n);
|
|
4562
4453
|
s({
|
|
4563
|
-
id:
|
|
4454
|
+
id: u(),
|
|
4564
4455
|
channel: n.sender,
|
|
4565
4456
|
sender: e,
|
|
4566
4457
|
reqId: n.reqId,
|
|
@@ -4570,7 +4461,7 @@ function wi(e, t) {
|
|
|
4570
4461
|
});
|
|
4571
4462
|
} catch (o) {
|
|
4572
4463
|
s({
|
|
4573
|
-
id:
|
|
4464
|
+
id: u(),
|
|
4574
4465
|
channel: n.sender,
|
|
4575
4466
|
sender: e,
|
|
4576
4467
|
reqId: n.reqId,
|
|
@@ -4582,10 +4473,10 @@ function wi(e, t) {
|
|
|
4582
4473
|
else r.next(n);
|
|
4583
4474
|
};
|
|
4584
4475
|
}
|
|
4585
|
-
var
|
|
4476
|
+
var mi = {
|
|
4586
4477
|
runtime: (e, t) => new He(e, t),
|
|
4587
|
-
tabs: (e, t) => new
|
|
4588
|
-
port: (e, t) => new
|
|
4478
|
+
tabs: (e, t) => new Ge(e, t),
|
|
4479
|
+
port: (e, t) => new je(e, t),
|
|
4589
4480
|
external: (e) => new Qt(e)
|
|
4590
4481
|
}, we = class {
|
|
4591
4482
|
_socket;
|
|
@@ -4609,7 +4500,7 @@ var vi = {
|
|
|
4609
4500
|
this._socket.emit(e, t);
|
|
4610
4501
|
}
|
|
4611
4502
|
request(e, t) {
|
|
4612
|
-
const n = e.reqId ??
|
|
4503
|
+
const n = e.reqId ?? u();
|
|
4613
4504
|
return new Promise((s, r) => {
|
|
4614
4505
|
this._pending.set(n, {
|
|
4615
4506
|
resolve: s,
|
|
@@ -4642,7 +4533,7 @@ var vi = {
|
|
|
4642
4533
|
const r = (i, o) => {
|
|
4643
4534
|
const a = {
|
|
4644
4535
|
...typeof i == "object" ? i : { payload: i },
|
|
4645
|
-
id: i?.id ??
|
|
4536
|
+
id: i?.id ?? u(),
|
|
4646
4537
|
event: s,
|
|
4647
4538
|
ack: o
|
|
4648
4539
|
};
|
|
@@ -4682,7 +4573,7 @@ var vi = {
|
|
|
4682
4573
|
get state() {
|
|
4683
4574
|
return this._state;
|
|
4684
4575
|
}
|
|
4685
|
-
},
|
|
4576
|
+
}, ks = class {
|
|
4686
4577
|
_parent;
|
|
4687
4578
|
_roomName;
|
|
4688
4579
|
_subs = /* @__PURE__ */ new Set();
|
|
@@ -4723,14 +4614,14 @@ var vi = {
|
|
|
4723
4614
|
return this._roomName;
|
|
4724
4615
|
}
|
|
4725
4616
|
};
|
|
4726
|
-
function
|
|
4617
|
+
function gi(e, t) {
|
|
4727
4618
|
return async (n) => {
|
|
4728
4619
|
if (n.type !== "request" || !n.ack) return;
|
|
4729
4620
|
const s = n.payload?.action;
|
|
4730
4621
|
if (s && t[s]) try {
|
|
4731
4622
|
const r = await t[s](n.payload?.args ?? [], n);
|
|
4732
4623
|
n.ack({
|
|
4733
|
-
id:
|
|
4624
|
+
id: u(),
|
|
4734
4625
|
channel: n.sender,
|
|
4735
4626
|
sender: e,
|
|
4736
4627
|
reqId: n.reqId,
|
|
@@ -4740,7 +4631,7 @@ function Ci(e, t) {
|
|
|
4740
4631
|
});
|
|
4741
4632
|
} catch (r) {
|
|
4742
4633
|
n.ack({
|
|
4743
|
-
id:
|
|
4634
|
+
id: u(),
|
|
4744
4635
|
channel: n.sender,
|
|
4745
4636
|
sender: e,
|
|
4746
4637
|
reqId: n.reqId,
|
|
@@ -4751,11 +4642,11 @@ function Ci(e, t) {
|
|
|
4751
4642
|
}
|
|
4752
4643
|
};
|
|
4753
4644
|
}
|
|
4754
|
-
var
|
|
4645
|
+
var yi = {
|
|
4755
4646
|
create: (e, t, n) => new we(e, t, n),
|
|
4756
|
-
room: (e, t) => new
|
|
4647
|
+
room: (e, t) => new ks(e, t)
|
|
4757
4648
|
};
|
|
4758
|
-
function
|
|
4649
|
+
function bi(e, t, n) {
|
|
4759
4650
|
return new we(e, t, n);
|
|
4760
4651
|
}
|
|
4761
4652
|
var ve = class {
|
|
@@ -4768,7 +4659,7 @@ var ve = class {
|
|
|
4768
4659
|
_pending = /* @__PURE__ */ new Map();
|
|
4769
4660
|
_listening = !1;
|
|
4770
4661
|
_cleanup = null;
|
|
4771
|
-
_portId =
|
|
4662
|
+
_portId = u();
|
|
4772
4663
|
_state = new _();
|
|
4773
4664
|
constructor(e, t, n = {}) {
|
|
4774
4665
|
this._scriptUrl = e, this._channelName = t, this._options = n, n.autoConnect !== !1 && this.connect();
|
|
@@ -4781,7 +4672,7 @@ var ve = class {
|
|
|
4781
4672
|
credentials: this._options.credentials,
|
|
4782
4673
|
type: this._options.type
|
|
4783
4674
|
}), this._port = this._worker.port, this._setupListeners(), this._port.start(), this._state.next("connecting"), this.send({
|
|
4784
|
-
id:
|
|
4675
|
+
id: u(),
|
|
4785
4676
|
channel: this._channelName,
|
|
4786
4677
|
sender: this._portId,
|
|
4787
4678
|
type: "signal",
|
|
@@ -4803,7 +4694,7 @@ var ve = class {
|
|
|
4803
4694
|
}, t ?? []);
|
|
4804
4695
|
}
|
|
4805
4696
|
request(e) {
|
|
4806
|
-
const t = e.reqId ??
|
|
4697
|
+
const t = e.reqId ?? u();
|
|
4807
4698
|
return new Promise((n, s) => {
|
|
4808
4699
|
const r = setTimeout(() => {
|
|
4809
4700
|
this._pending.has(t) && (this._pending.delete(t), s(/* @__PURE__ */ new Error("Request timeout")));
|
|
@@ -4868,7 +4759,7 @@ var ve = class {
|
|
|
4868
4759
|
}
|
|
4869
4760
|
disconnect() {
|
|
4870
4761
|
this.send({
|
|
4871
|
-
id:
|
|
4762
|
+
id: u(),
|
|
4872
4763
|
channel: this._channelName,
|
|
4873
4764
|
sender: this._portId,
|
|
4874
4765
|
type: "signal",
|
|
@@ -4906,7 +4797,7 @@ var ve = class {
|
|
|
4906
4797
|
}
|
|
4907
4798
|
_setupGlobalHandler() {
|
|
4908
4799
|
typeof self < "u" && "onconnect" in self && (self.onconnect = (e) => {
|
|
4909
|
-
const t = e.ports[0], n =
|
|
4800
|
+
const t = e.ports[0], n = u();
|
|
4910
4801
|
this._registerPort(n, t);
|
|
4911
4802
|
}, this._state.next("ready"));
|
|
4912
4803
|
}
|
|
@@ -4925,7 +4816,7 @@ var ve = class {
|
|
|
4925
4816
|
port: t,
|
|
4926
4817
|
info: n
|
|
4927
4818
|
}), t.postMessage({
|
|
4928
|
-
id:
|
|
4819
|
+
id: u(),
|
|
4929
4820
|
channel: this._channelName,
|
|
4930
4821
|
sender: "host",
|
|
4931
4822
|
type: "signal",
|
|
@@ -4977,7 +4868,7 @@ var ve = class {
|
|
|
4977
4868
|
}
|
|
4978
4869
|
respond(e, t, n) {
|
|
4979
4870
|
!e.portId || !e.reqId || this.send(e.portId, {
|
|
4980
|
-
id:
|
|
4871
|
+
id: u(),
|
|
4981
4872
|
channel: e.sender,
|
|
4982
4873
|
sender: this._channelName,
|
|
4983
4874
|
type: "response",
|
|
@@ -5009,13 +4900,13 @@ var ve = class {
|
|
|
5009
4900
|
return this._channelName;
|
|
5010
4901
|
}
|
|
5011
4902
|
};
|
|
5012
|
-
function
|
|
4903
|
+
function wi(e, t, n) {
|
|
5013
4904
|
return new ve(e, t, n);
|
|
5014
4905
|
}
|
|
5015
|
-
function
|
|
4906
|
+
function vi(e) {
|
|
5016
4907
|
return new Ve(e);
|
|
5017
4908
|
}
|
|
5018
|
-
var
|
|
4909
|
+
var Ci = {
|
|
5019
4910
|
client: (e, t, n) => new ve(e, t, n),
|
|
5020
4911
|
host: (e) => new Ve(e)
|
|
5021
4912
|
}, ee = null;
|
|
@@ -5029,13 +4920,13 @@ async function Kt() {
|
|
|
5029
4920
|
};
|
|
5030
4921
|
} catch {
|
|
5031
4922
|
ee = {
|
|
5032
|
-
encode: (e) => new TextEncoder().encode(JSON.stringify(e,
|
|
5033
|
-
decode: (e) => JSON.parse(new TextDecoder().decode(e),
|
|
4923
|
+
encode: (e) => new TextEncoder().encode(JSON.stringify(e, Ss)),
|
|
4924
|
+
decode: (e) => JSON.parse(new TextDecoder().decode(e), Es)
|
|
5034
4925
|
};
|
|
5035
4926
|
}
|
|
5036
4927
|
return ee;
|
|
5037
4928
|
}
|
|
5038
|
-
function
|
|
4929
|
+
function Ss(e, t) {
|
|
5039
4930
|
return ArrayBuffer.isView(t) && !(t instanceof DataView) ? {
|
|
5040
4931
|
__typedArray: !0,
|
|
5041
4932
|
type: t.constructor.name,
|
|
@@ -5045,14 +4936,14 @@ function Ts(e, t) {
|
|
|
5045
4936
|
data: Array.from(new Uint8Array(t))
|
|
5046
4937
|
} : t;
|
|
5047
4938
|
}
|
|
5048
|
-
function
|
|
4939
|
+
function Es(e, t) {
|
|
5049
4940
|
if (t?.__typedArray) {
|
|
5050
4941
|
const n = globalThis[t.type];
|
|
5051
4942
|
return n ? new n(t.data) : t.data;
|
|
5052
4943
|
}
|
|
5053
4944
|
return t?.__arrayBuffer ? new Uint8Array(t.data).buffer : t;
|
|
5054
4945
|
}
|
|
5055
|
-
var Yt = 32, te = 0, Te = 4, ot = 8, at = 12,
|
|
4946
|
+
var Yt = 32, te = 0, Te = 4, ot = 8, at = 12, G = 16, _e = 20, Pe = Yt, Is = 1, Ts = 2, Ps = 4, V = class {
|
|
5056
4947
|
_config;
|
|
5057
4948
|
_sharedBuffer;
|
|
5058
4949
|
_int32View;
|
|
@@ -5065,18 +4956,18 @@ var Yt = 32, te = 0, Te = 4, ot = 8, at = 12, z = 16, _e = 20, Pe = Yt, Ms = 1,
|
|
|
5065
4956
|
if (e.byteLength > this._maxDataSize) throw new Error(`Message too large: ${e.byteLength} > ${this._maxDataSize}`);
|
|
5066
4957
|
for (; Atomics.compareExchange(this._int32View, te / 4, 0, 1) !== 0; ) this._config.useAsyncWait && "waitAsync" in Atomics ? await Atomics.waitAsync(this._int32View, te / 4, 1, this._config.waitTimeout ?? 100).value : Atomics.wait(this._int32View, te / 4, 1, this._config.waitTimeout ?? 100);
|
|
5067
4958
|
try {
|
|
5068
|
-
return Atomics.store(this._int32View, ot / 4, e.byteLength), Atomics.store(this._int32View, at / 4, t), this._uint8View.set(e, Pe), Atomics.add(this._int32View, Te / 4, 1), Atomics.store(this._int32View,
|
|
4959
|
+
return Atomics.store(this._int32View, ot / 4, e.byteLength), Atomics.store(this._int32View, at / 4, t), this._uint8View.set(e, Pe), Atomics.add(this._int32View, Te / 4, 1), Atomics.store(this._int32View, G / 4, 1), Atomics.notify(this._int32View, G / 4), !0;
|
|
5069
4960
|
} finally {
|
|
5070
4961
|
Atomics.store(this._int32View, te / 4, 0), Atomics.notify(this._int32View, te / 4);
|
|
5071
4962
|
}
|
|
5072
4963
|
}
|
|
5073
4964
|
async read() {
|
|
5074
|
-
if (Atomics.load(this._int32View,
|
|
4965
|
+
if (Atomics.load(this._int32View, G / 4) === 0 && (this._config.useAsyncWait && "waitAsync" in Atomics ? await Atomics.waitAsync(this._int32View, G / 4, 0, this._config.waitTimeout ?? 1e3).value : Atomics.wait(this._int32View, G / 4, 0, this._config.waitTimeout ?? 1e3)) === "timed-out")
|
|
5075
4966
|
return null;
|
|
5076
4967
|
const e = Atomics.load(this._int32View, ot / 4), t = Atomics.load(this._int32View, at / 4), n = Atomics.load(this._int32View, Te / 4);
|
|
5077
4968
|
if (e <= 0 || e > this._maxDataSize) return null;
|
|
5078
4969
|
const s = new Uint8Array(e);
|
|
5079
|
-
return s.set(this._uint8View.subarray(Pe, Pe + e)), Atomics.store(this._int32View,
|
|
4970
|
+
return s.set(this._uint8View.subarray(Pe, Pe + e)), Atomics.store(this._int32View, G / 4, 0), Atomics.add(this._int32View, _e / 4, 1), Atomics.notify(this._int32View, _e / 4), {
|
|
5080
4971
|
data: s,
|
|
5081
4972
|
flags: t,
|
|
5082
4973
|
seq: n
|
|
@@ -5107,7 +4998,7 @@ var Yt = 32, te = 0, Te = 4, ot = 8, at = 12, z = 16, _e = 20, Pe = Yt, Ms = 1,
|
|
|
5107
4998
|
_pending = /* @__PURE__ */ new Map();
|
|
5108
4999
|
_polling = !1;
|
|
5109
5000
|
_pollAbort = null;
|
|
5110
|
-
_workerId =
|
|
5001
|
+
_workerId = u();
|
|
5111
5002
|
_lastSeq = 0;
|
|
5112
5003
|
_state = new _();
|
|
5113
5004
|
constructor(e, t, n, s = {}) {
|
|
@@ -5120,16 +5011,16 @@ var Yt = 32, te = 0, Te = 4, ot = 8, at = 12, z = 16, _e = 20, Pe = Yt, Ms = 1,
|
|
|
5120
5011
|
this._encoder || await this._init();
|
|
5121
5012
|
const { transferable: n, ...s } = e;
|
|
5122
5013
|
let r = 0;
|
|
5123
|
-
t?.length && (r |=
|
|
5014
|
+
t?.length && (r |= Is, s._transferMeta = t.map((o, a) => ({
|
|
5124
5015
|
index: a,
|
|
5125
5016
|
type: o.constructor.name,
|
|
5126
5017
|
transferred: o instanceof ArrayBuffer && "transfer" in o
|
|
5127
5018
|
})));
|
|
5128
5019
|
const i = this._encoder.encode(s);
|
|
5129
|
-
this._config.compression && i.length > 1024 && (r |=
|
|
5020
|
+
this._config.compression && i.length > 1024 && (r |= Ts), await this._sendBuffer.write(i, r);
|
|
5130
5021
|
}
|
|
5131
5022
|
async request(e) {
|
|
5132
|
-
const t = e.reqId ??
|
|
5023
|
+
const t = e.reqId ?? u();
|
|
5133
5024
|
return new Promise((n, s) => {
|
|
5134
5025
|
const r = setTimeout(() => {
|
|
5135
5026
|
this._pending.delete(t), s(/* @__PURE__ */ new Error("Request timeout"));
|
|
@@ -5165,7 +5056,7 @@ var Yt = 32, te = 0, Te = 4, ot = 8, at = 12, z = 16, _e = 20, Pe = Yt, Ms = 1,
|
|
|
5165
5056
|
if (!e || e.seq <= this._lastSeq) continue;
|
|
5166
5057
|
this._lastSeq = e.seq;
|
|
5167
5058
|
const t = this._encoder.decode(e.data);
|
|
5168
|
-
if (t.seq = e.seq, t.workerId = t.workerId ?? this._workerId, (e.flags &
|
|
5059
|
+
if (t.seq = e.seq, t.workerId = t.workerId ?? this._workerId, (e.flags & Ps || t.type === "response") && t.reqId) {
|
|
5169
5060
|
const n = this._pending.get(t.reqId);
|
|
5170
5061
|
if (n) {
|
|
5171
5062
|
this._pending.delete(t.reqId), t.payload?.error ? n.reject(new Error(t.payload.error)) : n.resolve(t.payload?.result ?? t.payload);
|
|
@@ -5213,10 +5104,10 @@ function Jt(e, t = {}) {
|
|
|
5213
5104
|
}
|
|
5214
5105
|
};
|
|
5215
5106
|
}
|
|
5216
|
-
function
|
|
5107
|
+
function xi(e, t, n, s = {}) {
|
|
5217
5108
|
return new le(e, t, n, s);
|
|
5218
5109
|
}
|
|
5219
|
-
var Xt = class
|
|
5110
|
+
var Xt = class b {
|
|
5220
5111
|
_buffer;
|
|
5221
5112
|
_meta;
|
|
5222
5113
|
_data;
|
|
@@ -5229,35 +5120,35 @@ var Xt = class y {
|
|
|
5229
5120
|
static OVERFLOW = 8;
|
|
5230
5121
|
constructor(t = {}) {
|
|
5231
5122
|
if (t instanceof SharedArrayBuffer)
|
|
5232
|
-
this._buffer = t, this._slotCount = 64, this._slotSize = (this._buffer.byteLength -
|
|
5123
|
+
this._buffer = t, this._slotCount = 64, this._slotSize = (this._buffer.byteLength - b.META_SIZE) / this._slotCount;
|
|
5233
5124
|
else {
|
|
5234
5125
|
this._slotSize = t.slotSize ?? 1024, this._slotCount = t.slotCount ?? 64, this._slotCount = 1 << Math.ceil(Math.log2(this._slotCount));
|
|
5235
|
-
const n =
|
|
5126
|
+
const n = b.META_SIZE + this._slotSize * this._slotCount;
|
|
5236
5127
|
this._buffer = new SharedArrayBuffer(n);
|
|
5237
5128
|
}
|
|
5238
|
-
this._meta = new Int32Array(this._buffer, 0,
|
|
5129
|
+
this._meta = new Int32Array(this._buffer, 0, b.META_SIZE / 4), this._data = new Uint8Array(this._buffer, b.META_SIZE), this._mask = this._slotCount - 1;
|
|
5239
5130
|
}
|
|
5240
5131
|
write(t) {
|
|
5241
5132
|
if (t.byteLength > this._slotSize - 4) return !1;
|
|
5242
|
-
const n = Atomics.load(this._meta,
|
|
5133
|
+
const n = Atomics.load(this._meta, b.WRITE_IDX), s = Atomics.load(this._meta, b.READ_IDX);
|
|
5243
5134
|
if ((n + 1 & this._mask) === (s & this._mask))
|
|
5244
|
-
return Atomics.add(this._meta,
|
|
5135
|
+
return Atomics.add(this._meta, b.OVERFLOW, 1), !1;
|
|
5245
5136
|
const r = (n & this._mask) * this._slotSize;
|
|
5246
|
-
return new DataView(this._buffer,
|
|
5137
|
+
return new DataView(this._buffer, b.META_SIZE + r).setUint32(0, t.byteLength, !0), this._data.set(t, r + 4), Atomics.store(this._meta, b.WRITE_IDX, n + 1), Atomics.notify(this._meta, b.WRITE_IDX), !0;
|
|
5247
5138
|
}
|
|
5248
5139
|
read() {
|
|
5249
|
-
const t = Atomics.load(this._meta,
|
|
5140
|
+
const t = Atomics.load(this._meta, b.WRITE_IDX), n = Atomics.load(this._meta, b.READ_IDX);
|
|
5250
5141
|
if (n === t) return null;
|
|
5251
|
-
const s = (n & this._mask) * this._slotSize, r = new DataView(this._buffer,
|
|
5142
|
+
const s = (n & this._mask) * this._slotSize, r = new DataView(this._buffer, b.META_SIZE + s).getUint32(0, !0);
|
|
5252
5143
|
if (r === 0 || r > this._slotSize - 4) return null;
|
|
5253
5144
|
const i = new Uint8Array(r);
|
|
5254
|
-
return i.set(this._data.subarray(s + 4, s + 4 + r)), Atomics.store(this._meta,
|
|
5145
|
+
return i.set(this._data.subarray(s + 4, s + 4 + r)), Atomics.store(this._meta, b.READ_IDX, n + 1), i;
|
|
5255
5146
|
}
|
|
5256
5147
|
async waitRead(t) {
|
|
5257
|
-
const n = Atomics.load(this._meta,
|
|
5258
|
-
if (Atomics.load(this._meta,
|
|
5148
|
+
const n = Atomics.load(this._meta, b.WRITE_IDX);
|
|
5149
|
+
if (Atomics.load(this._meta, b.READ_IDX) < n) return this.read();
|
|
5259
5150
|
if ("waitAsync" in Atomics) {
|
|
5260
|
-
if (await Atomics.waitAsync(this._meta,
|
|
5151
|
+
if (await Atomics.waitAsync(this._meta, b.WRITE_IDX, n, t ?? 1e3).value === "ok") return this.read();
|
|
5261
5152
|
} else
|
|
5262
5153
|
return await new Promise((s) => setTimeout(s, Math.min(t ?? 1e3, 100))), this.read();
|
|
5263
5154
|
return null;
|
|
@@ -5266,18 +5157,18 @@ var Xt = class y {
|
|
|
5266
5157
|
return this._buffer;
|
|
5267
5158
|
}
|
|
5268
5159
|
get available() {
|
|
5269
|
-
return Atomics.load(this._meta,
|
|
5160
|
+
return Atomics.load(this._meta, b.WRITE_IDX) - Atomics.load(this._meta, b.READ_IDX) & this._mask;
|
|
5270
5161
|
}
|
|
5271
5162
|
get overflow() {
|
|
5272
|
-
return Atomics.load(this._meta,
|
|
5163
|
+
return Atomics.load(this._meta, b.OVERFLOW);
|
|
5273
5164
|
}
|
|
5274
|
-
},
|
|
5165
|
+
}, ki = {
|
|
5275
5166
|
create: (e, t, n, s) => new le(e, t, n, s),
|
|
5276
5167
|
createPair: (e, t) => Jt(e, t),
|
|
5277
5168
|
createBuffer: (e, t) => new V(e, t),
|
|
5278
5169
|
createRingBuffer: (e) => new Xt(e),
|
|
5279
5170
|
getCBOR: Kt
|
|
5280
|
-
},
|
|
5171
|
+
}, Ms = [
|
|
5281
5172
|
{ urls: "stun:stun.l.google.com:19302" },
|
|
5282
5173
|
{ urls: "stun:stun1.l.google.com:19302" },
|
|
5283
5174
|
{ urls: "stun:stun2.l.google.com:19302" }
|
|
@@ -5288,14 +5179,14 @@ var Xt = class y {
|
|
|
5288
5179
|
_channel = null;
|
|
5289
5180
|
_subs = /* @__PURE__ */ new Set();
|
|
5290
5181
|
_pending = /* @__PURE__ */ new Map();
|
|
5291
|
-
_localId =
|
|
5182
|
+
_localId = u();
|
|
5292
5183
|
_remoteId = null;
|
|
5293
5184
|
_state = new _();
|
|
5294
5185
|
_channelState = new _();
|
|
5295
5186
|
_iceCandidates = [];
|
|
5296
5187
|
_iceGatheringComplete = !1;
|
|
5297
5188
|
constructor(e, t = {}) {
|
|
5298
|
-
this._channelName = e, this._config = t, this._pc = new RTCPeerConnection({ iceServers: t.iceServers ??
|
|
5189
|
+
this._channelName = e, this._config = t, this._pc = new RTCPeerConnection({ iceServers: t.iceServers ?? Ms }), this._setupPeerConnection();
|
|
5299
5190
|
}
|
|
5300
5191
|
_setupPeerConnection() {
|
|
5301
5192
|
this._pc.onicecandidate = (e) => {
|
|
@@ -5378,7 +5269,7 @@ var Xt = class y {
|
|
|
5378
5269
|
t || e.binary ? this._channel.send(this._encodeBinary(i)) : this._channel.send(JSON.stringify(i));
|
|
5379
5270
|
}
|
|
5380
5271
|
request(e) {
|
|
5381
|
-
const t = e.reqId ??
|
|
5272
|
+
const t = e.reqId ?? u();
|
|
5382
5273
|
return new Promise((n, s) => {
|
|
5383
5274
|
const r = setTimeout(() => {
|
|
5384
5275
|
this._pending.delete(t), s(/* @__PURE__ */ new Error("Request timeout"));
|
|
@@ -5450,7 +5341,7 @@ var Xt = class y {
|
|
|
5450
5341
|
_channelName;
|
|
5451
5342
|
_config;
|
|
5452
5343
|
_peers = /* @__PURE__ */ new Map();
|
|
5453
|
-
_localId =
|
|
5344
|
+
_localId = u();
|
|
5454
5345
|
_subs = /* @__PURE__ */ new Set();
|
|
5455
5346
|
_signalingCleanup = null;
|
|
5456
5347
|
_peerEvents = new _();
|
|
@@ -5588,7 +5479,7 @@ function Zt(e) {
|
|
|
5588
5479
|
}
|
|
5589
5480
|
};
|
|
5590
5481
|
}
|
|
5591
|
-
var
|
|
5482
|
+
var Si = {
|
|
5592
5483
|
createPeer: (e, t) => new Ce(e, t),
|
|
5593
5484
|
createManager: (e, t) => new Qe(e, t),
|
|
5594
5485
|
createSignaling: (e) => Zt(e)
|
|
@@ -5600,7 +5491,7 @@ var Mi = {
|
|
|
5600
5491
|
_pending = /* @__PURE__ */ new Map();
|
|
5601
5492
|
_listening = !1;
|
|
5602
5493
|
_cleanup = null;
|
|
5603
|
-
_portId =
|
|
5494
|
+
_portId = u();
|
|
5604
5495
|
_state = new _();
|
|
5605
5496
|
_keepAliveTimer = null;
|
|
5606
5497
|
constructor(e, t, n = {}) {
|
|
@@ -5618,7 +5509,7 @@ var Mi = {
|
|
|
5618
5509
|
}
|
|
5619
5510
|
if (s.type === "signal" && s.payload?.action === "ping") {
|
|
5620
5511
|
this.send({
|
|
5621
|
-
id:
|
|
5512
|
+
id: u(),
|
|
5622
5513
|
channel: this._channelName,
|
|
5623
5514
|
sender: this._portId,
|
|
5624
5515
|
type: "signal",
|
|
@@ -5652,7 +5543,7 @@ var Mi = {
|
|
|
5652
5543
|
}, t ?? []);
|
|
5653
5544
|
}
|
|
5654
5545
|
request(e) {
|
|
5655
|
-
const t = e.reqId ??
|
|
5546
|
+
const t = e.reqId ?? u();
|
|
5656
5547
|
return new Promise((n, s) => {
|
|
5657
5548
|
const r = setTimeout(() => {
|
|
5658
5549
|
this._pending.delete(t), s(/* @__PURE__ */ new Error("Request timeout"));
|
|
@@ -5684,7 +5575,7 @@ var Mi = {
|
|
|
5684
5575
|
_startKeepAlive() {
|
|
5685
5576
|
this._keepAliveTimer = setInterval(() => {
|
|
5686
5577
|
this.send({
|
|
5687
|
-
id:
|
|
5578
|
+
id: u(),
|
|
5688
5579
|
channel: this._channelName,
|
|
5689
5580
|
sender: this._portId,
|
|
5690
5581
|
type: "signal",
|
|
@@ -5719,7 +5610,7 @@ function xe(e, t) {
|
|
|
5719
5610
|
transfer: () => n.port2
|
|
5720
5611
|
};
|
|
5721
5612
|
}
|
|
5722
|
-
function
|
|
5613
|
+
function Ei(e, t, n) {
|
|
5723
5614
|
return new H(e, t, n);
|
|
5724
5615
|
}
|
|
5725
5616
|
var en = class {
|
|
@@ -5824,7 +5715,7 @@ var en = class {
|
|
|
5824
5715
|
if (r.data?.type !== "port-connect" || r.data?.channelName !== e || !r.ports[0]) return;
|
|
5825
5716
|
const i = new H(r.ports[0], e, n);
|
|
5826
5717
|
i.send({
|
|
5827
|
-
id:
|
|
5718
|
+
id: u(),
|
|
5828
5719
|
channel: e,
|
|
5829
5720
|
sender: i.portId,
|
|
5830
5721
|
type: "signal",
|
|
@@ -5846,15 +5737,15 @@ var en = class {
|
|
|
5846
5737
|
return this._transport;
|
|
5847
5738
|
}
|
|
5848
5739
|
};
|
|
5849
|
-
function
|
|
5850
|
-
return
|
|
5740
|
+
function As(e, t = []) {
|
|
5741
|
+
return On({
|
|
5851
5742
|
request: (n) => e.request(n),
|
|
5852
5743
|
channelName: e.channelName,
|
|
5853
5744
|
senderId: e.portId
|
|
5854
5745
|
}, t);
|
|
5855
5746
|
}
|
|
5856
|
-
function
|
|
5857
|
-
const n =
|
|
5747
|
+
function Rs(e, t) {
|
|
5748
|
+
const n = Nn(t);
|
|
5858
5749
|
return e.subscribe({ next: async (s) => {
|
|
5859
5750
|
if (s.type !== "request" || !s.payload?.path) return;
|
|
5860
5751
|
const { action: r, path: i, args: o } = s.payload;
|
|
@@ -5865,7 +5756,7 @@ function Ns(e, t) {
|
|
|
5865
5756
|
c = l instanceof Error ? l.message : String(l);
|
|
5866
5757
|
}
|
|
5867
5758
|
e.send({
|
|
5868
|
-
id:
|
|
5759
|
+
id: u(),
|
|
5869
5760
|
channel: s.sender,
|
|
5870
5761
|
sender: e.portId,
|
|
5871
5762
|
type: "response",
|
|
@@ -5874,14 +5765,14 @@ function Ns(e, t) {
|
|
|
5874
5765
|
});
|
|
5875
5766
|
} });
|
|
5876
5767
|
}
|
|
5877
|
-
var
|
|
5768
|
+
var Ii = {
|
|
5878
5769
|
create: (e, t, n) => new H(e, t, n),
|
|
5879
5770
|
createPair: (e, t) => xe(e, t),
|
|
5880
5771
|
createPool: (e) => new en(e),
|
|
5881
5772
|
createWindowConnector: (e, t, n) => new qe(e, t, n),
|
|
5882
5773
|
listen: qe.listen,
|
|
5883
|
-
createProxy:
|
|
5884
|
-
expose:
|
|
5774
|
+
createProxy: As,
|
|
5775
|
+
expose: Rs
|
|
5885
5776
|
}, Ke = class {
|
|
5886
5777
|
_db = null;
|
|
5887
5778
|
_config;
|
|
@@ -6004,25 +5895,25 @@ var Ri = {
|
|
|
6004
5895
|
let o = 0;
|
|
6005
5896
|
const a = e.offset ?? 0, c = e.limit ?? 1 / 0, l = r.openCursor(e.range, e.direction);
|
|
6006
5897
|
l.onsuccess = () => {
|
|
6007
|
-
const
|
|
6008
|
-
if (!
|
|
5898
|
+
const h = l.result;
|
|
5899
|
+
if (!h || i.length >= c) {
|
|
6009
5900
|
t(i);
|
|
6010
5901
|
return;
|
|
6011
5902
|
}
|
|
6012
|
-
const p =
|
|
5903
|
+
const p = h.value;
|
|
6013
5904
|
if (p.expiresAt && p.expiresAt < Date.now()) {
|
|
6014
|
-
|
|
5905
|
+
h.continue();
|
|
6015
5906
|
return;
|
|
6016
5907
|
}
|
|
6017
5908
|
if (e.filter && !e.filter(p)) {
|
|
6018
|
-
|
|
5909
|
+
h.continue();
|
|
6019
5910
|
return;
|
|
6020
5911
|
}
|
|
6021
5912
|
if (o < a) {
|
|
6022
|
-
o++,
|
|
5913
|
+
o++, h.continue();
|
|
6023
5914
|
return;
|
|
6024
5915
|
}
|
|
6025
|
-
i.push(p),
|
|
5916
|
+
i.push(p), h.continue();
|
|
6026
5917
|
}, l.onerror = () => n(/* @__PURE__ */ new Error(`Query failed: ${l.error?.message}`));
|
|
6027
5918
|
});
|
|
6028
5919
|
}
|
|
@@ -6123,7 +6014,7 @@ var Ri = {
|
|
|
6123
6014
|
});
|
|
6124
6015
|
}
|
|
6125
6016
|
async enqueue(e) {
|
|
6126
|
-
const t = Date.now(), n =
|
|
6017
|
+
const t = Date.now(), n = u(), s = {
|
|
6127
6018
|
id: n,
|
|
6128
6019
|
channel: e.channel,
|
|
6129
6020
|
sender: e.sender,
|
|
@@ -6159,7 +6050,7 @@ var Ri = {
|
|
|
6159
6050
|
async getPendingCount(e) {
|
|
6160
6051
|
return (await this.query({ filter: (t) => t.data.channel === e && t.data.status === "pending" })).length;
|
|
6161
6052
|
}
|
|
6162
|
-
},
|
|
6053
|
+
}, Ti = {
|
|
6163
6054
|
create: (e) => new Ke(e),
|
|
6164
6055
|
createMessageQueue: (e) => new tn(e)
|
|
6165
6056
|
}, Ye = class {
|
|
@@ -6179,7 +6070,7 @@ var Ri = {
|
|
|
6179
6070
|
autoCleanup: !0,
|
|
6180
6071
|
cleanupInterval: 60 * 1e3,
|
|
6181
6072
|
...e
|
|
6182
|
-
}, this._connection =
|
|
6073
|
+
}, this._connection = Ue().getOrCreate(this._config.channelName, "service-worker", { metadata: { isHost: !0 } }), this._storage = Wt(this._config.channelName), this._setupMessageHandlers(), this._config.autoCleanup && this._startCleanupInterval();
|
|
6183
6074
|
}
|
|
6184
6075
|
async registerClient(e, t = {}) {
|
|
6185
6076
|
const n = {
|
|
@@ -6329,7 +6220,7 @@ var Ri = {
|
|
|
6329
6220
|
}
|
|
6330
6221
|
async _handleRequest(e) {
|
|
6331
6222
|
const t = {
|
|
6332
|
-
id:
|
|
6223
|
+
id: u(),
|
|
6333
6224
|
channel: e.sender,
|
|
6334
6225
|
sender: this._config.channelName,
|
|
6335
6226
|
type: "response",
|
|
@@ -6442,9 +6333,9 @@ var Ri = {
|
|
|
6442
6333
|
});
|
|
6443
6334
|
}
|
|
6444
6335
|
async request(e, t = {}) {
|
|
6445
|
-
const n =
|
|
6336
|
+
const n = u(), s = Promise.withResolvers();
|
|
6446
6337
|
return this._pendingRequests.set(n, s), this._sendToSW({
|
|
6447
|
-
id:
|
|
6338
|
+
id: u(),
|
|
6448
6339
|
type: "request",
|
|
6449
6340
|
channel: this._channelName,
|
|
6450
6341
|
sender: "client",
|
|
@@ -6460,7 +6351,7 @@ var Ri = {
|
|
|
6460
6351
|
}
|
|
6461
6352
|
emit(e, t, n) {
|
|
6462
6353
|
this._sendToSW({
|
|
6463
|
-
id:
|
|
6354
|
+
id: u(),
|
|
6464
6355
|
type: "event",
|
|
6465
6356
|
channel: n ?? this._channelName,
|
|
6466
6357
|
sender: "client",
|
|
@@ -6475,7 +6366,7 @@ var Ri = {
|
|
|
6475
6366
|
return this._subject.subscribe({ next: e });
|
|
6476
6367
|
}
|
|
6477
6368
|
on(e, t) {
|
|
6478
|
-
return
|
|
6369
|
+
return bt((n) => n.type === "event" && n.payload?.type === e)(this._subject).subscribe({ next: (n) => t(n.payload?.data) });
|
|
6479
6370
|
}
|
|
6480
6371
|
get isConnected() {
|
|
6481
6372
|
return this._isConnected;
|
|
@@ -6497,13 +6388,13 @@ var Ri = {
|
|
|
6497
6388
|
});
|
|
6498
6389
|
};
|
|
6499
6390
|
};
|
|
6500
|
-
function
|
|
6391
|
+
function Pi(e) {
|
|
6501
6392
|
return new Ye(e);
|
|
6502
6393
|
}
|
|
6503
|
-
function
|
|
6394
|
+
function Mi(e) {
|
|
6504
6395
|
return new Je(e);
|
|
6505
6396
|
}
|
|
6506
|
-
function
|
|
6397
|
+
function qs(e, t = self) {
|
|
6507
6398
|
const n = (s) => {
|
|
6508
6399
|
const r = String(s.source?.id || "").trim();
|
|
6509
6400
|
r && e.handleClientMessage(r, s.data);
|
|
@@ -6514,7 +6405,7 @@ function Ds(e, t = self) {
|
|
|
6514
6405
|
t.removeEventListener("message", n), e.stop();
|
|
6515
6406
|
} };
|
|
6516
6407
|
}
|
|
6517
|
-
var
|
|
6408
|
+
var Ns = class {
|
|
6518
6409
|
_type;
|
|
6519
6410
|
_channelName;
|
|
6520
6411
|
_config;
|
|
@@ -6526,7 +6417,7 @@ var Ls = class {
|
|
|
6526
6417
|
this._type = e, this._channelName = t, this._config = n;
|
|
6527
6418
|
}
|
|
6528
6419
|
request(e) {
|
|
6529
|
-
const t = e.reqId ??
|
|
6420
|
+
const t = e.reqId ?? u();
|
|
6530
6421
|
return new Promise((n, s) => {
|
|
6531
6422
|
const r = setTimeout(() => {
|
|
6532
6423
|
this._pending.delete(t), s(/* @__PURE__ */ new Error("Request timeout"));
|
|
@@ -6584,12 +6475,12 @@ var Ls = class {
|
|
|
6584
6475
|
get state() {
|
|
6585
6476
|
return this._state;
|
|
6586
6477
|
}
|
|
6587
|
-
}, ct = class extends
|
|
6478
|
+
}, ct = class extends Ns {
|
|
6588
6479
|
_target;
|
|
6589
6480
|
_sendFn;
|
|
6590
6481
|
_cleanup = null;
|
|
6591
6482
|
constructor(e, t) {
|
|
6592
|
-
super(ie(e), t.channelName, t), this._target = e, this._sendFn =
|
|
6483
|
+
super(ie(e), t.channelName, t), this._target = e, this._sendFn = y(e), this._setupListener();
|
|
6593
6484
|
}
|
|
6594
6485
|
_setupListener() {
|
|
6595
6486
|
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");
|
|
@@ -6601,7 +6492,7 @@ var Ls = class {
|
|
|
6601
6492
|
this._cleanup?.(), super.close();
|
|
6602
6493
|
}
|
|
6603
6494
|
};
|
|
6604
|
-
function
|
|
6495
|
+
function j(e, t = {}, n = {}) {
|
|
6605
6496
|
const s = {
|
|
6606
6497
|
channelName: e,
|
|
6607
6498
|
timeout: 3e4,
|
|
@@ -6643,16 +6534,16 @@ function G(e, t = {}, n = {}) {
|
|
|
6643
6534
|
}
|
|
6644
6535
|
}), {
|
|
6645
6536
|
send: (c, l) => i.send(c, l),
|
|
6646
|
-
request: (c) => new Promise((l,
|
|
6647
|
-
const p = c.reqId ??
|
|
6648
|
-
a.delete(p),
|
|
6537
|
+
request: (c) => new Promise((l, h) => {
|
|
6538
|
+
const p = c.reqId ?? u(), w = setTimeout(() => {
|
|
6539
|
+
a.delete(p), h(/* @__PURE__ */ new Error("Request timeout"));
|
|
6649
6540
|
}, s.timeout);
|
|
6650
6541
|
a.set(p, {
|
|
6651
|
-
resolve: (
|
|
6652
|
-
clearTimeout(w), l(
|
|
6542
|
+
resolve: (S) => {
|
|
6543
|
+
clearTimeout(w), l(S);
|
|
6653
6544
|
},
|
|
6654
|
-
reject: (
|
|
6655
|
-
clearTimeout(w),
|
|
6545
|
+
reject: (S) => {
|
|
6546
|
+
clearTimeout(w), h(S);
|
|
6656
6547
|
},
|
|
6657
6548
|
timestamp: Date.now()
|
|
6658
6549
|
}), i.send({
|
|
@@ -6706,7 +6597,7 @@ function G(e, t = {}, n = {}) {
|
|
|
6706
6597
|
};
|
|
6707
6598
|
}
|
|
6708
6599
|
if (t.chrome.mode === "tabs") {
|
|
6709
|
-
const i = new
|
|
6600
|
+
const i = new Ge(t.chrome.tabId, t.chrome.options);
|
|
6710
6601
|
return {
|
|
6711
6602
|
send: (o) => i.send(o),
|
|
6712
6603
|
request: () => Promise.reject("Not supported"),
|
|
@@ -6718,7 +6609,7 @@ function G(e, t = {}, n = {}) {
|
|
|
6718
6609
|
};
|
|
6719
6610
|
}
|
|
6720
6611
|
if (t.chrome.mode === "port") {
|
|
6721
|
-
const i = new
|
|
6612
|
+
const i = new je(t.chrome.portName ?? e, t.chrome.tabId);
|
|
6722
6613
|
return {
|
|
6723
6614
|
send: (o) => i.send(o),
|
|
6724
6615
|
request: () => Promise.reject("Not supported"),
|
|
@@ -6759,7 +6650,7 @@ function G(e, t = {}, n = {}) {
|
|
|
6759
6650
|
const i = new Ye({
|
|
6760
6651
|
channelName: e,
|
|
6761
6652
|
...t.serviceWorker.config ?? {}
|
|
6762
|
-
}), o =
|
|
6653
|
+
}), o = qs(i);
|
|
6763
6654
|
return {
|
|
6764
6655
|
send: (a) => {
|
|
6765
6656
|
i.broadcastToAll(a);
|
|
@@ -6834,7 +6725,7 @@ function G(e, t = {}, n = {}) {
|
|
|
6834
6725
|
isReady: !0
|
|
6835
6726
|
};
|
|
6836
6727
|
}
|
|
6837
|
-
var
|
|
6728
|
+
var Os = class {
|
|
6838
6729
|
_transports = /* @__PURE__ */ new Map();
|
|
6839
6730
|
register(e, t) {
|
|
6840
6731
|
this._transports.set(e, t);
|
|
@@ -6844,7 +6735,7 @@ var Bs = class {
|
|
|
6844
6735
|
}
|
|
6845
6736
|
getOrCreate(e, t = {}, n = {}) {
|
|
6846
6737
|
let s = this._transports.get(e);
|
|
6847
|
-
return s || (s =
|
|
6738
|
+
return s || (s = j(e, t, n), this._transports.set(e, s)), s;
|
|
6848
6739
|
}
|
|
6849
6740
|
remove(e) {
|
|
6850
6741
|
const t = this._transports.get(e);
|
|
@@ -6861,16 +6752,16 @@ var Bs = class {
|
|
|
6861
6752
|
return this._transports.size;
|
|
6862
6753
|
}
|
|
6863
6754
|
}, Me = null;
|
|
6864
|
-
function
|
|
6865
|
-
return Me || (Me = new
|
|
6755
|
+
function Ds() {
|
|
6756
|
+
return Me || (Me = new Os()), Me;
|
|
6866
6757
|
}
|
|
6867
|
-
var
|
|
6868
|
-
create:
|
|
6869
|
-
registry:
|
|
6870
|
-
fromWorker: (e, t, n) =>
|
|
6871
|
-
fromPort: (e, t, n) =>
|
|
6872
|
-
fromWebSocket: (e, t, n) =>
|
|
6873
|
-
fromBroadcast: (e, t) =>
|
|
6758
|
+
var Ai = {
|
|
6759
|
+
create: j,
|
|
6760
|
+
registry: Ds,
|
|
6761
|
+
fromWorker: (e, t, n) => j(t, { worker: { existing: e } }, n),
|
|
6762
|
+
fromPort: (e, t, n) => j(t, { port: { port: e } }, n),
|
|
6763
|
+
fromWebSocket: (e, t, n) => j(t, { websocket: { url: e } }, n),
|
|
6764
|
+
fromBroadcast: (e, t) => j(e, { broadcast: {} }, t),
|
|
6874
6765
|
sharedWorker: {
|
|
6875
6766
|
client: (e, t, n) => new ve(e, t, n),
|
|
6876
6767
|
host: (e) => new Ve(e)
|
|
@@ -6903,12 +6794,12 @@ var Di = {
|
|
|
6903
6794
|
socketio: (e, t, n) => new we(e, t, n),
|
|
6904
6795
|
chrome: {
|
|
6905
6796
|
runtime: (e) => new He(void 0, e),
|
|
6906
|
-
tabs: (e, t) => new
|
|
6907
|
-
port: (e, t) => new
|
|
6797
|
+
tabs: (e, t) => new Ge(e, t),
|
|
6798
|
+
port: (e, t) => new je(e, t)
|
|
6908
6799
|
},
|
|
6909
6800
|
detect: ie,
|
|
6910
6801
|
meta: dt
|
|
6911
|
-
},
|
|
6802
|
+
}, Ls = class {
|
|
6912
6803
|
config;
|
|
6913
6804
|
onChannelReady;
|
|
6914
6805
|
underlyingChannel = null;
|
|
@@ -6926,7 +6817,7 @@ var Di = {
|
|
|
6926
6817
|
async request(e, t = []) {
|
|
6927
6818
|
return this.isConnected && this.underlyingChannel ? this.underlyingChannel.request(e, t) : new Promise((n, s) => {
|
|
6928
6819
|
const r = {
|
|
6929
|
-
id:
|
|
6820
|
+
id: u(),
|
|
6930
6821
|
method: e,
|
|
6931
6822
|
args: t,
|
|
6932
6823
|
resolve: n,
|
|
@@ -6964,7 +6855,7 @@ var Di = {
|
|
|
6964
6855
|
close() {
|
|
6965
6856
|
this.rejectAllQueued(/* @__PURE__ */ new Error("Channel closed")), this.underlyingChannel?.close(), this.underlyingChannel = null, this.isConnected = !1, this.connectionPromise = null;
|
|
6966
6857
|
}
|
|
6967
|
-
},
|
|
6858
|
+
}, Bs = async () => {
|
|
6968
6859
|
const e = await chrome.tabs.query({
|
|
6969
6860
|
active: !0,
|
|
6970
6861
|
currentWindow: !0
|
|
@@ -6972,15 +6863,15 @@ var Di = {
|
|
|
6972
6863
|
if (e.length === 0) throw new Error("No active tab found");
|
|
6973
6864
|
if (!e[0].id) throw new Error("Active tab has no ID");
|
|
6974
6865
|
return e[0].id;
|
|
6975
|
-
},
|
|
6866
|
+
}, Ri = async () => {
|
|
6976
6867
|
try {
|
|
6977
|
-
return await
|
|
6868
|
+
return await Bs();
|
|
6978
6869
|
} catch {
|
|
6979
6870
|
const e = (await chrome.tabs.query({ currentWindow: !0 })).find((t) => t.active);
|
|
6980
6871
|
if (!e?.id) throw new Error("No visible tab found");
|
|
6981
6872
|
return e.id;
|
|
6982
6873
|
}
|
|
6983
|
-
},
|
|
6874
|
+
}, qi = (e, t = "worker") => {
|
|
6984
6875
|
const n = We(t ?? "worker");
|
|
6985
6876
|
return Object.keys(e).forEach((s) => {
|
|
6986
6877
|
e[s];
|
|
@@ -7009,7 +6900,7 @@ var Di = {
|
|
|
7009
6900
|
async request(e, t, n) {
|
|
7010
6901
|
if (!this.isChannelReady || !this.channel) return new Promise((i, o) => {
|
|
7011
6902
|
const a = {
|
|
7012
|
-
id:
|
|
6903
|
+
id: u(),
|
|
7013
6904
|
method: e,
|
|
7014
6905
|
args: [t],
|
|
7015
6906
|
resolve: i,
|
|
@@ -7021,7 +6912,7 @@ var Di = {
|
|
|
7021
6912
|
const s = {
|
|
7022
6913
|
...this.options,
|
|
7023
6914
|
...n
|
|
7024
|
-
}, r =
|
|
6915
|
+
}, r = u();
|
|
7025
6916
|
return new Promise((i, o) => {
|
|
7026
6917
|
const a = setTimeout(() => {
|
|
7027
6918
|
this.pendingRequests.delete(r), o(/* @__PURE__ */ new Error(`Request timeout: ${e}`));
|
|
@@ -7053,7 +6944,7 @@ var Di = {
|
|
|
7053
6944
|
}
|
|
7054
6945
|
notify(e, t) {
|
|
7055
6946
|
const n = {
|
|
7056
|
-
id:
|
|
6947
|
+
id: u(),
|
|
7057
6948
|
type: e,
|
|
7058
6949
|
payload: t,
|
|
7059
6950
|
timestamp: Date.now()
|
|
@@ -7071,7 +6962,7 @@ var Di = {
|
|
|
7071
6962
|
flushBatch() {
|
|
7072
6963
|
if (this.messageQueue.length === 0) return;
|
|
7073
6964
|
const e = {
|
|
7074
|
-
id:
|
|
6965
|
+
id: u(),
|
|
7075
6966
|
type: "batch",
|
|
7076
6967
|
payload: this.messageQueue,
|
|
7077
6968
|
timestamp: Date.now()
|
|
@@ -7281,11 +7172,11 @@ var Di = {
|
|
|
7281
7172
|
}
|
|
7282
7173
|
}
|
|
7283
7174
|
}, Ae = /* @__PURE__ */ new Map();
|
|
7284
|
-
function
|
|
7175
|
+
function Ws(e) {
|
|
7285
7176
|
const t = e?.dbName ?? "default";
|
|
7286
7177
|
return Ae.has(t) || Ae.set(t, new sn(e)), Ae.get(t);
|
|
7287
7178
|
}
|
|
7288
|
-
function
|
|
7179
|
+
function Ni(e) {
|
|
7289
7180
|
return new sn(e);
|
|
7290
7181
|
}
|
|
7291
7182
|
var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
@@ -7335,7 +7226,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7335
7226
|
for (const e of this.listeners) M.get(this.channelName)?.delete(e);
|
|
7336
7227
|
this.listeners.clear();
|
|
7337
7228
|
}
|
|
7338
|
-
},
|
|
7229
|
+
}, $s = class {
|
|
7339
7230
|
wrappedByOriginal = /* @__PURE__ */ new Map();
|
|
7340
7231
|
wrappedListeners = /* @__PURE__ */ new Set();
|
|
7341
7232
|
channelName;
|
|
@@ -7440,7 +7331,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7440
7331
|
for (const e of this.wrappedListeners) M.get(this.channelName)?.delete(e);
|
|
7441
7332
|
this.wrappedListeners.clear(), this.wrappedByOriginal.clear();
|
|
7442
7333
|
}
|
|
7443
|
-
},
|
|
7334
|
+
}, Oi = class {
|
|
7444
7335
|
port;
|
|
7445
7336
|
channelName;
|
|
7446
7337
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -7475,7 +7366,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7475
7366
|
close() {
|
|
7476
7367
|
this.listeners.clear(), this.port?.disconnect?.();
|
|
7477
7368
|
}
|
|
7478
|
-
},
|
|
7369
|
+
}, Di = async (e) => {
|
|
7479
7370
|
let t;
|
|
7480
7371
|
try {
|
|
7481
7372
|
if (typeof e.script != "string") throw new Error("Chrome extension worker channel requires config.script to be a string path");
|
|
@@ -7485,21 +7376,21 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7485
7376
|
}
|
|
7486
7377
|
const n = await X(e.name, {}, t);
|
|
7487
7378
|
return n?.remote ?? n;
|
|
7488
|
-
},
|
|
7379
|
+
}, Li = (e) => new an(e), Bi = (e) => {
|
|
7489
7380
|
const t = X(e, {}, new an(e));
|
|
7490
7381
|
return t?.remote ?? t;
|
|
7491
|
-
},
|
|
7492
|
-
const n = X(e, {}, new
|
|
7382
|
+
}, Fs = (e, t) => {
|
|
7383
|
+
const n = X(e, {}, new $s(e, t));
|
|
7493
7384
|
return n?.remote ?? n;
|
|
7494
|
-
},
|
|
7385
|
+
}, Wi = (e, t) => Fs(e, t), $i = (e = "$host$") => We(e ?? "$host$"), Fi = (e, t) => new Ls(e, t), Us = async (e) => ({
|
|
7495
7386
|
async request(t, n = []) {
|
|
7496
7387
|
return new Promise((s, r) => {
|
|
7497
|
-
const i = new BroadcastChannel(`${e.name}-sw-channel`), o =
|
|
7388
|
+
const i = new BroadcastChannel(`${e.name}-sw-channel`), o = u(), a = setTimeout(() => {
|
|
7498
7389
|
i.close(), r(/* @__PURE__ */ new Error(`Service worker request timeout: ${t}`));
|
|
7499
7390
|
}, 1e4);
|
|
7500
7391
|
i.onmessage = (c) => {
|
|
7501
|
-
const { id: l, result:
|
|
7502
|
-
l === o && (clearTimeout(a), i.close(), p ? r(new Error(p)) : s(
|
|
7392
|
+
const { id: l, result: h, error: p } = c.data;
|
|
7393
|
+
l === o && (clearTimeout(a), i.close(), p ? r(new Error(p)) : s(h));
|
|
7503
7394
|
}, i.postMessage({
|
|
7504
7395
|
id: o,
|
|
7505
7396
|
type: "request",
|
|
@@ -7512,7 +7403,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7512
7403
|
}
|
|
7513
7404
|
}), cn = async (e) => {
|
|
7514
7405
|
const t = e.context;
|
|
7515
|
-
if (t === "service-worker") return
|
|
7406
|
+
if (t === "service-worker") return Us(e);
|
|
7516
7407
|
let n;
|
|
7517
7408
|
if (typeof e.script == "function") n = e.script();
|
|
7518
7409
|
else if (e.script instanceof Worker) n = e.script;
|
|
@@ -7523,67 +7414,67 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7523
7414
|
}
|
|
7524
7415
|
else n = new Worker(q(e.script), e.options);
|
|
7525
7416
|
return await X(e.name, {}, n);
|
|
7526
|
-
},
|
|
7417
|
+
}, Ui = async (e, t) => new nn(await cn(e), t), zs = (e, t, n) => {
|
|
7527
7418
|
const s = new nn(null, t, n);
|
|
7528
7419
|
return cn(e).then((r) => {
|
|
7529
7420
|
s.setChannel(r);
|
|
7530
7421
|
}).catch((r) => {
|
|
7531
7422
|
console.error("[createQueuedOptimizedWorkerChannel] Failed to create base channel:", r), s.close();
|
|
7532
7423
|
}), s;
|
|
7533
|
-
},
|
|
7424
|
+
}, Hs = /* @__PURE__ */ new Set([
|
|
7534
7425
|
"invoke",
|
|
7535
7426
|
"mail",
|
|
7536
7427
|
"attach",
|
|
7537
7428
|
"deliver",
|
|
7538
7429
|
"defer"
|
|
7539
|
-
]),
|
|
7430
|
+
]), Gs = /* @__PURE__ */ new Set([
|
|
7540
7431
|
"request",
|
|
7541
7432
|
"response",
|
|
7542
7433
|
"invoke",
|
|
7543
7434
|
"ack",
|
|
7544
7435
|
"act",
|
|
7545
7436
|
"ask"
|
|
7546
|
-
]),
|
|
7437
|
+
]), ut = "mail", E = (e) => String(e ?? "").trim(), js = (e) => {
|
|
7547
7438
|
if (!e) return;
|
|
7548
7439
|
const t = (Array.isArray(e) ? e : [e]).map(E).filter(Boolean);
|
|
7549
7440
|
return t.length > 0 ? t : void 0;
|
|
7550
|
-
},
|
|
7441
|
+
}, Vs = (e) => {
|
|
7551
7442
|
if (e != null)
|
|
7552
7443
|
return Array.isArray(e) ? e : [e];
|
|
7553
|
-
},
|
|
7444
|
+
}, Qs = (e) => {
|
|
7554
7445
|
if (e != null)
|
|
7555
7446
|
return Array.isArray(e) ? e : [e];
|
|
7556
|
-
},
|
|
7557
|
-
const t = Array.isArray(e) ? e : e ? [e] : [
|
|
7558
|
-
for (const s of t)
|
|
7559
|
-
return n.length > 0 ? n : [
|
|
7560
|
-
},
|
|
7447
|
+
}, Ks = (e) => {
|
|
7448
|
+
const t = Array.isArray(e) ? e : e ? [e] : [ut], n = [];
|
|
7449
|
+
for (const s of t) Hs.has(s) && !n.includes(s) && n.push(s);
|
|
7450
|
+
return n.length > 0 ? n : [ut];
|
|
7451
|
+
}, Ys = (e) => {
|
|
7561
7452
|
const t = E(e.type);
|
|
7562
|
-
if (
|
|
7453
|
+
if (Gs.has(t)) return t;
|
|
7563
7454
|
const n = E(e.op);
|
|
7564
7455
|
return n === "get" || n === "set" || n === "apply" || n === "import" ? "invoke" : e.error ? "response" : "request";
|
|
7565
|
-
},
|
|
7456
|
+
}, Js = (e, t) => e.op ? e.op : t === "invoke" ? "invoke" : t === "act" ? "deliver" : "mail", Xs = (e) => {
|
|
7566
7457
|
const t = E(e).toLowerCase();
|
|
7567
7458
|
return t || "unknown";
|
|
7568
|
-
},
|
|
7569
|
-
const t = Number.isFinite(e.timestamp) ? Number(e.timestamp) : Date.now(), n = E(e.srcChannel ?? e.source) || "uniform", s = E(e.destination), r = e.dstChannel ?? (s || void 0), i = E(e.uuid ?? e.id) ||
|
|
7459
|
+
}, Zs = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `uniform_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`, Ne = (e) => {
|
|
7460
|
+
const t = Number.isFinite(e.timestamp) ? Number(e.timestamp) : Date.now(), n = E(e.srcChannel ?? e.source) || "uniform", s = E(e.destination), r = e.dstChannel ?? (s || void 0), i = E(e.uuid ?? e.id) || Zs(), o = Ys(e), a = e.payload ?? e.data, c = { ...e.metadata ?? {} };
|
|
7570
7461
|
return {
|
|
7571
|
-
purpose:
|
|
7572
|
-
protocol:
|
|
7462
|
+
purpose: Ks(e.purpose),
|
|
7463
|
+
protocol: Xs(e.protocol),
|
|
7573
7464
|
redirect: !!e.redirect,
|
|
7574
7465
|
flags: { ...e.flags ?? {} },
|
|
7575
7466
|
type: o,
|
|
7576
|
-
path:
|
|
7467
|
+
path: js(e.path),
|
|
7577
7468
|
result: e.result,
|
|
7578
|
-
args:
|
|
7579
|
-
op:
|
|
7469
|
+
args: Vs(e.args),
|
|
7470
|
+
op: Js(e, o),
|
|
7580
7471
|
error: e.error ? String(e.error) : void 0,
|
|
7581
7472
|
timestamp: t,
|
|
7582
7473
|
where: E(e.where) || void 0,
|
|
7583
7474
|
uuid: i,
|
|
7584
7475
|
bridges: Array.isArray(e.bridges) ? e.bridges.map(E).filter(Boolean) : [],
|
|
7585
7476
|
payload: a,
|
|
7586
|
-
transfer:
|
|
7477
|
+
transfer: Qs(e.transfer),
|
|
7587
7478
|
extension: e.extension,
|
|
7588
7479
|
defer: e.defer,
|
|
7589
7480
|
srcChannel: n,
|
|
@@ -7595,11 +7486,11 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7595
7486
|
contentType: E(e.contentType) || void 0,
|
|
7596
7487
|
metadata: c
|
|
7597
7488
|
};
|
|
7598
|
-
},
|
|
7489
|
+
}, er = (e) => {
|
|
7599
7490
|
if (!e || typeof e != "object") return !1;
|
|
7600
7491
|
const t = e;
|
|
7601
7492
|
return typeof t.uuid == "string" && typeof t.srcChannel == "string" && Array.isArray(t.purpose) && typeof t.type == "string";
|
|
7602
|
-
},
|
|
7493
|
+
}, ht = (e) => (er(e), Ne(e)), tr = class {
|
|
7603
7494
|
seen = /* @__PURE__ */ new Map();
|
|
7604
7495
|
windowMs;
|
|
7605
7496
|
constructor(e = 300) {
|
|
@@ -7612,7 +7503,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7612
7503
|
prune(e) {
|
|
7613
7504
|
for (const [t, n] of this.seen.entries()) e - n > this.windowMs && this.seen.delete(t);
|
|
7614
7505
|
}
|
|
7615
|
-
},
|
|
7506
|
+
}, nr = class {
|
|
7616
7507
|
storageKey;
|
|
7617
7508
|
maxMessages;
|
|
7618
7509
|
defaultTTLMs;
|
|
@@ -7676,10 +7567,10 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7676
7567
|
executionContext;
|
|
7677
7568
|
channelMappings;
|
|
7678
7569
|
componentRegistry = /* @__PURE__ */ new Map();
|
|
7679
|
-
replayGuard = new
|
|
7570
|
+
replayGuard = new tr(300);
|
|
7680
7571
|
localChannelId = "";
|
|
7681
7572
|
constructor(e = {}) {
|
|
7682
|
-
this.executionContext = Be(), this.localChannelId = `${this.executionContext}:${Math.random().toString(36).slice(2, 10)}`, this.channelMappings = e.channelMappings ?? {}, this.messageQueue =
|
|
7573
|
+
this.executionContext = Be(), this.localChannelId = `${this.executionContext}:${Math.random().toString(36).slice(2, 10)}`, this.channelMappings = e.channelMappings ?? {}, this.messageQueue = Ws(e.queueOptions), this.pendingStore = new nr(e.pendingStoreOptions), this.setupGlobalListeners();
|
|
7683
7574
|
}
|
|
7684
7575
|
registerHandler(e, t) {
|
|
7685
7576
|
this.handlers.has(e) || this.handlers.set(e, []), this.handlers.get(e).push(t);
|
|
@@ -7700,7 +7591,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7700
7591
|
})), !1);
|
|
7701
7592
|
}
|
|
7702
7593
|
async processMessage(e) {
|
|
7703
|
-
const t =
|
|
7594
|
+
const t = ht(e);
|
|
7704
7595
|
if (!this.replayGuard.accept(t)) return;
|
|
7705
7596
|
const n = t.destination ?? "general", s = this.handlers.get(n) ?? [];
|
|
7706
7597
|
for (const r of s) if (r.canHandle(t)) try {
|
|
@@ -7710,7 +7601,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7710
7601
|
}
|
|
7711
7602
|
}
|
|
7712
7603
|
async tryDeliverMessage(e) {
|
|
7713
|
-
const t =
|
|
7604
|
+
const t = ht(e);
|
|
7714
7605
|
if (t.destination && this.handlers.has(t.destination))
|
|
7715
7606
|
return await this.processMessage(t), !0;
|
|
7716
7607
|
const n = this.getChannelForDestination(t.destination);
|
|
@@ -7736,7 +7627,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7736
7627
|
console.log(`[UnifiedMessaging] Skipping worker '${s.name}' in ${this.executionContext} context`);
|
|
7737
7628
|
continue;
|
|
7738
7629
|
}
|
|
7739
|
-
const r =
|
|
7630
|
+
const r = zs({
|
|
7740
7631
|
name: s.name,
|
|
7741
7632
|
script: s.script,
|
|
7742
7633
|
options: s.options,
|
|
@@ -7809,7 +7700,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7809
7700
|
for (const i of n.stages) {
|
|
7810
7701
|
const o = i.timeout ?? r, a = i.retries ?? 0;
|
|
7811
7702
|
for (let c = 0; c <= a; c++) try {
|
|
7812
|
-
s = await Promise.race([i.handler(s), new Promise((l,
|
|
7703
|
+
s = await Promise.race([i.handler(s), new Promise((l, h) => setTimeout(() => h(/* @__PURE__ */ new Error(`Stage '${i.name}' timeout`)), o))]);
|
|
7813
7704
|
break;
|
|
7814
7705
|
} catch (l) {
|
|
7815
7706
|
if (c === a)
|
|
@@ -7877,7 +7768,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7877
7768
|
if (this.executionContext === "chrome-extension") return "chrome-extension";
|
|
7878
7769
|
}
|
|
7879
7770
|
toProtocolMessage(e, t) {
|
|
7880
|
-
return
|
|
7771
|
+
return Ne({
|
|
7881
7772
|
...e,
|
|
7882
7773
|
id: e.id,
|
|
7883
7774
|
type: e.type ?? "unknown",
|
|
@@ -7895,7 +7786,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7895
7786
|
});
|
|
7896
7787
|
}
|
|
7897
7788
|
isWorkerSupported(e) {
|
|
7898
|
-
return this.executionContext === "service-worker" ? !0 : this.executionContext === "chrome-extension" ?
|
|
7789
|
+
return this.executionContext === "service-worker" ? !0 : this.executionContext === "chrome-extension" ? Fn() : !0;
|
|
7899
7790
|
}
|
|
7900
7791
|
setupGlobalListeners() {
|
|
7901
7792
|
typeof window < "u" && globalThis.addEventListener("message", (e) => {
|
|
@@ -7924,22 +7815,22 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
|
|
|
7924
7815
|
function Xe(e) {
|
|
7925
7816
|
return Y || (Y = new ln(e)), Y;
|
|
7926
7817
|
}
|
|
7927
|
-
function
|
|
7818
|
+
function zi(e) {
|
|
7928
7819
|
return new ln(e);
|
|
7929
7820
|
}
|
|
7930
|
-
function
|
|
7821
|
+
function Hi() {
|
|
7931
7822
|
Y && (Y.destroy(), Y = null);
|
|
7932
7823
|
}
|
|
7933
|
-
function
|
|
7824
|
+
function Gi(e) {
|
|
7934
7825
|
return Xe().sendMessage(e);
|
|
7935
7826
|
}
|
|
7936
|
-
function
|
|
7827
|
+
function ji(e, t) {
|
|
7937
7828
|
Xe().registerHandler(e, t);
|
|
7938
7829
|
}
|
|
7939
|
-
function
|
|
7830
|
+
function Vi(e) {
|
|
7940
7831
|
return Xe().getBroadcastChannel(e);
|
|
7941
7832
|
}
|
|
7942
|
-
var
|
|
7833
|
+
var un = class {
|
|
7943
7834
|
channels = /* @__PURE__ */ new Map();
|
|
7944
7835
|
readyPromises = /* @__PURE__ */ new Map();
|
|
7945
7836
|
messageHandlers = /* @__PURE__ */ new Map();
|
|
@@ -8055,24 +7946,24 @@ var hn = class {
|
|
|
8055
7946
|
return this.executionContext;
|
|
8056
7947
|
}
|
|
8057
7948
|
};
|
|
8058
|
-
function
|
|
8059
|
-
return new
|
|
7949
|
+
function Qi(e) {
|
|
7950
|
+
return new un(e);
|
|
8060
7951
|
}
|
|
8061
|
-
var
|
|
8062
|
-
function
|
|
8063
|
-
return
|
|
7952
|
+
var U = null;
|
|
7953
|
+
function Ki(e) {
|
|
7954
|
+
return U ? e?.channels && U.registerConfigs(e.channels) : U = new un(e), U;
|
|
8064
7955
|
}
|
|
8065
|
-
function
|
|
8066
|
-
|
|
7956
|
+
function Yi() {
|
|
7957
|
+
U && (U.closeAll(), U = null);
|
|
8067
7958
|
}
|
|
8068
|
-
function
|
|
8069
|
-
const s = /* @__PURE__ */ new Map(), r =
|
|
7959
|
+
function Ji(e, t, n) {
|
|
7960
|
+
const s = /* @__PURE__ */ new Map(), r = y(e);
|
|
8070
7961
|
return (i) => {
|
|
8071
|
-
const o = (l) => l.type === "response" && l.reqId ? (
|
|
7962
|
+
const o = (l) => l.type === "response" && l.reqId ? (h) => {
|
|
8072
7963
|
const p = s.get(l.reqId);
|
|
8073
|
-
p && (p.resolve(
|
|
8074
|
-
} : l.type === "request" ? (
|
|
8075
|
-
...
|
|
7964
|
+
p && (p.resolve(h), s.delete(l.reqId));
|
|
7965
|
+
} : l.type === "request" ? (h, p) => r({
|
|
7966
|
+
...h,
|
|
8076
7967
|
channel: l.sender,
|
|
8077
7968
|
sender: t,
|
|
8078
7969
|
type: "response",
|
|
@@ -8080,16 +7971,16 @@ function no(e, t, n) {
|
|
|
8080
7971
|
}, p) : r, c = m(e, (l) => {
|
|
8081
7972
|
if (i.active) {
|
|
8082
7973
|
if (l.type === "response" && l.reqId) {
|
|
8083
|
-
const
|
|
8084
|
-
|
|
7974
|
+
const h = s.get(l.reqId);
|
|
7975
|
+
h && (h.resolve(l.payload), s.delete(l.reqId));
|
|
8085
7976
|
}
|
|
8086
7977
|
n ? n(l, o(l)) : i.next(l);
|
|
8087
7978
|
}
|
|
8088
7979
|
}, (l) => i.error(l), () => i.complete());
|
|
8089
7980
|
return i.request = (l) => {
|
|
8090
|
-
const
|
|
8091
|
-
return l.reqId =
|
|
8092
|
-
s.set(
|
|
7981
|
+
const h = l.reqId ?? u();
|
|
7982
|
+
return l.reqId = h, new Promise((p, w) => {
|
|
7983
|
+
s.set(h, {
|
|
8093
7984
|
resolve: p,
|
|
8094
7985
|
reject: w,
|
|
8095
7986
|
timestamp: Date.now()
|
|
@@ -8098,7 +7989,7 @@ function no(e, t, n) {
|
|
|
8098
7989
|
}, c;
|
|
8099
7990
|
};
|
|
8100
7991
|
}
|
|
8101
|
-
var
|
|
7992
|
+
var Xi = class {
|
|
8102
7993
|
_transport;
|
|
8103
7994
|
_channelName;
|
|
8104
7995
|
_pending = /* @__PURE__ */ new Map();
|
|
@@ -8107,7 +7998,7 @@ var so = class {
|
|
|
8107
7998
|
_send;
|
|
8108
7999
|
_active = !1;
|
|
8109
8000
|
constructor(e, t) {
|
|
8110
|
-
this._transport = e, this._channelName = t, this._send =
|
|
8001
|
+
this._transport = e, this._channelName = t, this._send = y(e);
|
|
8111
8002
|
}
|
|
8112
8003
|
subscribe(e) {
|
|
8113
8004
|
return this._subs.add(e), this._active || this._activate(), { unsubscribe: () => {
|
|
@@ -8118,7 +8009,7 @@ var so = class {
|
|
|
8118
8009
|
this._send(e, t);
|
|
8119
8010
|
}
|
|
8120
8011
|
request(e) {
|
|
8121
|
-
const t = e.reqId ??
|
|
8012
|
+
const t = e.reqId ?? u();
|
|
8122
8013
|
return new Promise((n, s) => {
|
|
8123
8014
|
this._pending.set(t, {
|
|
8124
8015
|
resolve: n,
|
|
@@ -8147,19 +8038,19 @@ var so = class {
|
|
|
8147
8038
|
this._cleanup?.(), this._cleanup = null, this._active = !1;
|
|
8148
8039
|
}
|
|
8149
8040
|
};
|
|
8150
|
-
function
|
|
8041
|
+
function Zi(e, t = {}) {
|
|
8151
8042
|
return async (n, s) => {
|
|
8152
8043
|
if (n.type !== "request" || n.channel !== e) return;
|
|
8153
8044
|
t.onRequest?.(n.payload);
|
|
8154
8045
|
const r = await Fe(n.payload, n.reqId, e);
|
|
8155
8046
|
r && (t.onResponse?.(r.response), s({
|
|
8156
8047
|
...r.response,
|
|
8157
|
-
id:
|
|
8048
|
+
id: u(),
|
|
8158
8049
|
timestamp: Date.now()
|
|
8159
8050
|
}, r.transfer));
|
|
8160
8051
|
};
|
|
8161
8052
|
}
|
|
8162
|
-
var
|
|
8053
|
+
var eo = class {
|
|
8163
8054
|
_channelName;
|
|
8164
8055
|
_targetChannel;
|
|
8165
8056
|
_pending = /* @__PURE__ */ new Map();
|
|
@@ -8182,8 +8073,8 @@ var io = class {
|
|
|
8182
8073
|
}
|
|
8183
8074
|
dispatch(e, t, n) {
|
|
8184
8075
|
if (!this._subscriber?.active) return Promise.reject(/* @__PURE__ */ new Error("Not connected"));
|
|
8185
|
-
const s =
|
|
8186
|
-
id:
|
|
8076
|
+
const s = u(), r = {
|
|
8077
|
+
id: u(),
|
|
8187
8078
|
channel: this._targetChannel,
|
|
8188
8079
|
sender: this._channelName,
|
|
8189
8080
|
type: "request",
|
|
@@ -8203,10 +8094,10 @@ var io = class {
|
|
|
8203
8094
|
}));
|
|
8204
8095
|
return this._subscriber.next(r), i;
|
|
8205
8096
|
}
|
|
8206
|
-
},
|
|
8097
|
+
}, to = async (e, t = {}, n = null) => X(e, t, n ?? (typeof self < "u" ? self : null)), no = async (e, t, n = {}, s = typeof self < "u" ? self : null) => (await X(e, n?.channelOptions, s))?.doImportModule?.(t, n?.importOptions), so = ce, ro = fs, io = ps, oo = _s, ao = async (e, t = {}, n = typeof self < "u" ? self : null, s = "$host$") => {
|
|
8207
8098
|
const r = qt(s ?? "$host$");
|
|
8208
8099
|
return await r?.createRemoteChannel(e, t, n), Tt(e, r ?? v?.instance);
|
|
8209
|
-
},
|
|
8100
|
+
}, co = (e, t = {}) => {
|
|
8210
8101
|
const n = Be();
|
|
8211
8102
|
return n !== "chrome-extension" ? {
|
|
8212
8103
|
async request(s) {
|
|
@@ -8241,286 +8132,286 @@ var io = class {
|
|
|
8241
8132
|
};
|
|
8242
8133
|
};
|
|
8243
8134
|
export {
|
|
8244
|
-
|
|
8135
|
+
Ur as $createOrUseExistingChannel,
|
|
8245
8136
|
Z as $descriptor,
|
|
8246
|
-
|
|
8247
|
-
|
|
8137
|
+
Hn as $requestHandler,
|
|
8138
|
+
Ns as AbstractTransport,
|
|
8248
8139
|
V as AtomicsBuffer,
|
|
8249
8140
|
Xt as AtomicsRingBuffer,
|
|
8250
8141
|
le as AtomicsTransport,
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8142
|
+
ki as AtomicsTransportFactory,
|
|
8143
|
+
An as BidirectionalInvoker,
|
|
8144
|
+
ms as BroadcastChannelObservable,
|
|
8145
|
+
Zn as BroadcastChannelTransport,
|
|
8146
|
+
Se as CHANNEL_MAP,
|
|
8147
|
+
Kn as ChannelConnection,
|
|
8257
8148
|
Ft as ChannelContext,
|
|
8258
|
-
|
|
8259
|
-
|
|
8149
|
+
Un as ChannelHandler,
|
|
8150
|
+
Xi as ChannelMessageObservable,
|
|
8260
8151
|
C as ChannelNativeObservable,
|
|
8261
|
-
|
|
8262
|
-
|
|
8152
|
+
wn as ChannelObservable,
|
|
8153
|
+
ls as ChannelStorage,
|
|
8263
8154
|
_ as ChannelSubject,
|
|
8264
|
-
|
|
8155
|
+
us as ChannelTransaction,
|
|
8265
8156
|
an as ChromeExtensionBroadcastChannel,
|
|
8266
|
-
|
|
8267
|
-
|
|
8157
|
+
Oi as ChromeExtensionPortChannel,
|
|
8158
|
+
$s as ChromeExtensionTabsChannel,
|
|
8268
8159
|
Qt as ChromeExternalObservable,
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8160
|
+
rs as ChromeExternalTransport,
|
|
8161
|
+
mi as ChromeObservableFactory,
|
|
8162
|
+
je as ChromePortObservable,
|
|
8163
|
+
ss as ChromePortTransport,
|
|
8273
8164
|
He as ChromeRuntimeObservable,
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8165
|
+
ts as ChromeRuntimeTransport,
|
|
8166
|
+
Ge as ChromeTabsObservable,
|
|
8167
|
+
ns as ChromeTabsTransport,
|
|
8168
|
+
Yn as ConnectionPool,
|
|
8169
|
+
Mn as DefaultReflect,
|
|
8170
|
+
Er as DispatchHandler,
|
|
8171
|
+
Er as DispatchProxyHandler,
|
|
8172
|
+
ar as MessageObservable,
|
|
8282
8173
|
Ie as MessagePortObservable,
|
|
8283
|
-
|
|
8174
|
+
Xn as MessagePortTransport,
|
|
8284
8175
|
sn as MessageQueue,
|
|
8285
8176
|
tn as MessageQueueStorage,
|
|
8286
8177
|
C as Observable,
|
|
8287
|
-
|
|
8288
|
-
|
|
8289
|
-
|
|
8178
|
+
Un as ObservableChannelHandler,
|
|
8179
|
+
Cr as ObservableFactory,
|
|
8180
|
+
eo as ObservableRequestDispatcher,
|
|
8290
8181
|
nn as OptimizedWorkerChannel,
|
|
8291
8182
|
xt as PROXY_INTERNALS,
|
|
8292
8183
|
Ct as PROXY_MARKER,
|
|
8293
|
-
|
|
8184
|
+
nr as PendingMessageStore,
|
|
8294
8185
|
en as PortPool,
|
|
8295
8186
|
H as PortTransport,
|
|
8296
|
-
|
|
8297
|
-
|
|
8298
|
-
|
|
8299
|
-
|
|
8300
|
-
|
|
8187
|
+
Ii as PortTransportFactory,
|
|
8188
|
+
tr as ProtocolReplayGuard,
|
|
8189
|
+
Dn as ProxyBuilder,
|
|
8190
|
+
Ls as QueuedWorkerChannel,
|
|
8191
|
+
zr as READ,
|
|
8301
8192
|
Qe as RTCPeerManager,
|
|
8302
8193
|
Ce as RTCPeerTransport,
|
|
8303
|
-
|
|
8194
|
+
Si as RTCTransportFactory,
|
|
8304
8195
|
Rt as RemoteChannelHelper,
|
|
8305
|
-
|
|
8306
|
-
|
|
8307
|
-
|
|
8196
|
+
ke as RemoteChannels,
|
|
8197
|
+
qn as RemoteProxyHandler,
|
|
8198
|
+
or as ReplayChannelSubject,
|
|
8308
8199
|
wt as Requestor,
|
|
8309
8200
|
vt as Responder,
|
|
8310
8201
|
v as SELF_CHANNEL,
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
|
|
8202
|
+
xs as SelfObservable,
|
|
8203
|
+
os as SelfTransport,
|
|
8204
|
+
un as ServiceChannelManager,
|
|
8314
8205
|
Je as ServiceWorkerClient,
|
|
8315
|
-
|
|
8206
|
+
vs as ServiceWorkerClientObservable,
|
|
8316
8207
|
Ye as ServiceWorkerHost,
|
|
8317
|
-
|
|
8318
|
-
|
|
8208
|
+
Cs as ServiceWorkerHostObservable,
|
|
8209
|
+
is as ServiceWorkerTransport,
|
|
8319
8210
|
ve as SharedWorkerClient,
|
|
8320
8211
|
Ve as SharedWorkerHost,
|
|
8321
|
-
|
|
8212
|
+
Ci as SharedWorkerObservableFactory,
|
|
8322
8213
|
we as SocketIOObservable,
|
|
8323
|
-
|
|
8324
|
-
|
|
8214
|
+
yi as SocketIOObservableFactory,
|
|
8215
|
+
ks as SocketIORoomObservable,
|
|
8325
8216
|
Ke as TransferableStorage,
|
|
8326
|
-
|
|
8217
|
+
Ti as TransferableStorageFactory,
|
|
8327
8218
|
T as TransportAdapter,
|
|
8328
|
-
|
|
8329
|
-
|
|
8330
|
-
|
|
8331
|
-
|
|
8332
|
-
|
|
8219
|
+
ws as TransportChromePortObservable,
|
|
8220
|
+
ys as TransportChromeRuntimeObservable,
|
|
8221
|
+
bs as TransportChromeTabsObservable,
|
|
8222
|
+
ir as TransportCoreFactory,
|
|
8223
|
+
Gr as TransportFactory,
|
|
8333
8224
|
P as TransportObservable,
|
|
8334
|
-
|
|
8225
|
+
ii as TransportObservableFactory,
|
|
8335
8226
|
It as UnifiedChannel,
|
|
8336
8227
|
ln as UnifiedMessagingManager,
|
|
8337
|
-
|
|
8228
|
+
Ai as UnifiedTransportFactory,
|
|
8338
8229
|
d as WReflectAction,
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
|
|
8230
|
+
sr as WStatus,
|
|
8231
|
+
rr as WType,
|
|
8232
|
+
gs as WebSocketObservable,
|
|
8233
|
+
es as WebSocketTransport,
|
|
8343
8234
|
qe as WindowPortConnector,
|
|
8344
|
-
|
|
8235
|
+
Gt as WorkerContext,
|
|
8345
8236
|
it as WorkerObservable,
|
|
8346
|
-
|
|
8347
|
-
|
|
8348
|
-
|
|
8349
|
-
|
|
8350
|
-
|
|
8351
|
-
|
|
8352
|
-
|
|
8237
|
+
Jn as WorkerTransport,
|
|
8238
|
+
Zr as addBroadcastChannel,
|
|
8239
|
+
Xr as addPortChannel,
|
|
8240
|
+
ei as addSelfChannelToDefault,
|
|
8241
|
+
Jr as addWorkerChannel,
|
|
8242
|
+
Sr as autoInvoker,
|
|
8243
|
+
qs as bindServiceWorkerHostBridge,
|
|
8353
8244
|
Lt as buildResponse,
|
|
8354
|
-
|
|
8355
|
-
|
|
8356
|
-
|
|
8245
|
+
Vr as closeAllStorage,
|
|
8246
|
+
Nr as closeUnifiedChannel,
|
|
8247
|
+
ao as connectToChannelAsModule,
|
|
8357
8248
|
Jt as createAtomicsChannelPair,
|
|
8358
|
-
|
|
8359
|
-
|
|
8249
|
+
In as createBidirectionalChannel,
|
|
8250
|
+
oi as createBidirectionalTransport,
|
|
8360
8251
|
Zt as createBroadcastSignaling,
|
|
8361
8252
|
_t as createBroadcastTransport,
|
|
8362
8253
|
ce as createChannelContext,
|
|
8363
8254
|
xe as createChannelPair,
|
|
8364
|
-
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8255
|
+
Zi as createChannelRequestHandler,
|
|
8256
|
+
ps as createChannelsInContext,
|
|
8257
|
+
Li as createChromeExtensionBroadcast,
|
|
8258
|
+
Bi as createChromeExtensionBroadcastChannel,
|
|
8259
|
+
Di as createChromeExtensionChannel,
|
|
8260
|
+
co as createChromeExtensionRuntimeChannel,
|
|
8261
|
+
Fs as createChromeExtensionTabsChannel,
|
|
8262
|
+
Wi as createChromeExtensionTabsMessagingChannel,
|
|
8372
8263
|
pn as createChromeListener,
|
|
8373
|
-
|
|
8264
|
+
_i as createChromeRequestHandler,
|
|
8374
8265
|
ft as createChromeTabsListener,
|
|
8375
|
-
|
|
8376
|
-
|
|
8377
|
-
|
|
8378
|
-
|
|
8379
|
-
|
|
8266
|
+
jr as createConnectionObserver,
|
|
8267
|
+
so as createContext,
|
|
8268
|
+
ri as createDefaultChannelPair,
|
|
8269
|
+
Nn as createExposeHandler,
|
|
8270
|
+
Ei as createFromPort,
|
|
8380
8271
|
qt as createHostChannel,
|
|
8381
|
-
|
|
8272
|
+
di as createHostProxy,
|
|
8382
8273
|
Le as createInvoker,
|
|
8383
8274
|
et as createInvokerObservable,
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
|
|
8275
|
+
fr as createMessageId,
|
|
8276
|
+
Ni as createMessageQueue,
|
|
8277
|
+
io as createMultiChannel,
|
|
8278
|
+
Wr as createObservableChannel,
|
|
8279
|
+
Ui as createOptimizedWorkerChannel,
|
|
8389
8280
|
X as createOrUseExistingChannel,
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8394
|
-
|
|
8281
|
+
As as createPortProxy,
|
|
8282
|
+
Ne as createProtocolEnvelope,
|
|
8283
|
+
zs as createQueuedOptimizedWorkerChannel,
|
|
8284
|
+
Fi as createQueuedWorkerChannel,
|
|
8285
|
+
vn as createReflectHandler,
|
|
8395
8286
|
oe as createRemoteProxy,
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8287
|
+
xr as createRequestor,
|
|
8288
|
+
Rn as createResponder,
|
|
8289
|
+
On as createSenderProxy,
|
|
8290
|
+
Qi as createServiceChannelManager,
|
|
8291
|
+
Us as createServiceWorkerChannel,
|
|
8292
|
+
Mi as createServiceWorkerClient,
|
|
8293
|
+
Pi as createServiceWorkerHost,
|
|
8294
|
+
vi as createSharedWorkerHostObservable,
|
|
8295
|
+
wi as createSharedWorkerObservable,
|
|
8296
|
+
bi as createSocketObservable,
|
|
8297
|
+
gi as createSocketRequestHandler,
|
|
8298
|
+
j as createTransport,
|
|
8408
8299
|
m as createTransportListener,
|
|
8409
|
-
|
|
8300
|
+
y as createTransportSender,
|
|
8410
8301
|
I as createUnifiedChannel,
|
|
8411
|
-
|
|
8412
|
-
|
|
8302
|
+
Ar as createUnifiedChannelPair,
|
|
8303
|
+
zi as createUnifiedMessaging,
|
|
8413
8304
|
pt as createWebSocketTransport,
|
|
8414
|
-
|
|
8305
|
+
xi as createWorkerAtomicsTransport,
|
|
8415
8306
|
cn as createWorkerChannel,
|
|
8416
|
-
|
|
8417
|
-
|
|
8418
|
-
|
|
8419
|
-
|
|
8307
|
+
hr as debounce,
|
|
8308
|
+
ti as deferChannel,
|
|
8309
|
+
kn as delay,
|
|
8310
|
+
Kr as deleteContext,
|
|
8420
8311
|
nt as descMap,
|
|
8421
8312
|
J as detectContextType,
|
|
8422
8313
|
Be as detectExecutionContext,
|
|
8423
|
-
|
|
8314
|
+
Pn as detectIncomingContextType,
|
|
8424
8315
|
tt as detectTransport,
|
|
8425
8316
|
ie as detectTransportType,
|
|
8426
8317
|
Dt as executeAction,
|
|
8427
|
-
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
|
|
8318
|
+
Or as exposeFromUnified,
|
|
8319
|
+
ui as exposeFromWorker,
|
|
8320
|
+
Rs as exposeOverPort,
|
|
8321
|
+
bt as filter,
|
|
8322
|
+
Cn as fromEvent,
|
|
8323
|
+
xn as fromPromise,
|
|
8324
|
+
Vi as getBroadcastChannel,
|
|
8325
|
+
si as getChannelFromDefault,
|
|
8435
8326
|
Wt as getChannelStorage,
|
|
8436
8327
|
Bt as getConnection,
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
8328
|
+
Ue as getConnectionPool,
|
|
8329
|
+
Qr as getContext,
|
|
8330
|
+
Yr as getContextNames,
|
|
8331
|
+
Bs as getCurrentTabId,
|
|
8441
8332
|
F as getDefaultContext,
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8333
|
+
Hr as getHostConnection,
|
|
8334
|
+
Ws as getMessageQueue,
|
|
8335
|
+
fs as getOrCreateContext,
|
|
8336
|
+
Ir as getProxyDescriptor,
|
|
8337
|
+
Tr as getProxyInternals,
|
|
8338
|
+
Ki as getServiceChannelManager,
|
|
8339
|
+
ro as getSharedContext,
|
|
8449
8340
|
dt as getTransportMeta,
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8341
|
+
Ds as getTransportRegistry,
|
|
8342
|
+
Rr as getUnifiedChannel,
|
|
8343
|
+
qr as getUnifiedChannelNames,
|
|
8453
8344
|
Xe as getUnifiedMessaging,
|
|
8454
|
-
|
|
8345
|
+
Ri as getVisibleTabId,
|
|
8455
8346
|
ae as getWorkerChannel,
|
|
8456
|
-
|
|
8347
|
+
ze as getWorkerContext,
|
|
8457
8348
|
Vt as getWorkerInvoker,
|
|
8458
8349
|
Mt as getWorkerResolveBaseUrl,
|
|
8459
|
-
|
|
8350
|
+
jt as getWorkerResponder,
|
|
8460
8351
|
me as handMap,
|
|
8461
8352
|
Fe as handleRequest,
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
|
|
8466
|
-
|
|
8353
|
+
Vn as hasNoPath,
|
|
8354
|
+
fi as importInHost,
|
|
8355
|
+
oo as importIsolatedModule,
|
|
8356
|
+
no as importModuleInChannel,
|
|
8357
|
+
_s as importModuleInContext,
|
|
8467
8358
|
We as initChannelHandler,
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8359
|
+
ni as initDeferredChannel,
|
|
8360
|
+
$i as initMainChannel,
|
|
8361
|
+
ai as initWorkerContext,
|
|
8362
|
+
Sn as interval,
|
|
8363
|
+
$n as isChromeExtensionContext,
|
|
8364
|
+
er as isProtocolEnvelope,
|
|
8365
|
+
St as isRemoteProxy,
|
|
8475
8366
|
Pt as isServiceWorkerContext,
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8367
|
+
Fr as loadWorker,
|
|
8368
|
+
mr as makeBroadcastInvoker,
|
|
8369
|
+
Ji as makeChannelMessageHandler,
|
|
8370
|
+
yr as makeChromeRuntimeInvoker,
|
|
8371
|
+
_r as makeMessagePortInvoker,
|
|
8372
|
+
Br as makeObservableRequestProxy,
|
|
8373
|
+
Ln as makeRequestProxy,
|
|
8374
|
+
vr as makeSelfInvoker,
|
|
8375
|
+
br as makeServiceWorkerClientInvoker,
|
|
8376
|
+
wr as makeServiceWorkerHostInvoker,
|
|
8377
|
+
gr as makeWebSocketInvoker,
|
|
8378
|
+
pr as makeWorkerInvoker,
|
|
8379
|
+
cr as map,
|
|
8380
|
+
En as merge,
|
|
8381
|
+
ht as normalizeProtocolEnvelope,
|
|
8491
8382
|
Ee as normalizeRef,
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8383
|
+
zn as objectToRef,
|
|
8384
|
+
li as onWorkerChannelCreated,
|
|
8385
|
+
ci as onWorkerConnection,
|
|
8386
|
+
hi as onWorkerInvocation,
|
|
8387
|
+
Pr as proxyBuilder,
|
|
8388
|
+
z as readByPath,
|
|
8389
|
+
ji as registerHandler,
|
|
8390
|
+
qi as registerWorkerAPI,
|
|
8500
8391
|
W as registeredInPath,
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8392
|
+
Dr as remoteFromUnified,
|
|
8393
|
+
jn as removeByData,
|
|
8394
|
+
Nt as removeByPath,
|
|
8395
|
+
Yi as resetServiceChannelManager,
|
|
8396
|
+
Hi as resetUnifiedMessaging,
|
|
8506
8397
|
q as resolveWorkerSpecifierHref,
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8398
|
+
Gi as sendMessage,
|
|
8399
|
+
kr as setupInvoker,
|
|
8400
|
+
Mr as setupUnifiedChannel,
|
|
8510
8401
|
re as storedData,
|
|
8511
|
-
|
|
8512
|
-
|
|
8513
|
-
|
|
8514
|
-
|
|
8515
|
-
|
|
8402
|
+
Fn as supportsDedicatedWorkers,
|
|
8403
|
+
to as sync,
|
|
8404
|
+
lr as take,
|
|
8405
|
+
ur as takeUntil,
|
|
8406
|
+
dr as throttle,
|
|
8516
8407
|
$e as traverseByPath,
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
|
|
8408
|
+
Gn as unwrapDescriptorFromProxy,
|
|
8409
|
+
he as unwrapDescriptorFromProxyRecursive,
|
|
8410
|
+
Tn as when,
|
|
8411
|
+
pi as workerContext,
|
|
8521
8412
|
Tt as wrapChannel,
|
|
8522
|
-
|
|
8413
|
+
kt as wrapDescriptor,
|
|
8523
8414
|
ge as wrapMap,
|
|
8524
|
-
|
|
8525
|
-
|
|
8415
|
+
Lr as wrapObservableChannel,
|
|
8416
|
+
ye as writeByPath
|
|
8526
8417
|
};
|