@limrun/ui 0.18.1 → 0.18.2
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/README.md +5 -1
- package/dist/{GLTFLoader-DRVkwp64.js → GLTFLoader--3fP8K2r.js} +1 -1
- package/dist/{GLTFLoader-8J-xzNti.mjs → GLTFLoader-C62L6gT7.mjs} +1 -1
- package/dist/components/remote-control.d.ts +1 -1
- package/dist/{duo-frame-D17Tat2r.mjs → duo-frame-B6jf62Rq.mjs} +3 -3
- package/dist/{duo-frame-BFXPC17N.js → duo-frame-DAmRgZuT.js} +2 -2
- package/dist/{duo-view-XeO_m-1d.mjs → duo-view-DSZO0-zg.mjs} +2 -2
- package/dist/{duo-view-D-T1cLtl.js → duo-view-hTVLMDcc.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/lite.cjs +1 -1
- package/dist/lite.js +1 -1
- package/dist/remote-control-B3_Hzmx8.js +2 -0
- package/dist/{remote-control-BWu73g2Z.mjs → remote-control-BFxEfAdr.mjs} +327 -323
- package/package.json +1 -1
- package/dist/remote-control-CFF1nIoN.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { memo as cr, useState as
|
|
1
|
+
import { jsx as P, jsxs as ue, Fragment as $r } from "react/jsx-runtime";
|
|
2
|
+
import { memo as cr, useState as G, useEffect as me, useMemo as ke, useCallback as Un, lazy as Ln, forwardRef as xn, useRef as v, useImperativeHandle as Fn, Suspense as Wn } from "react";
|
|
3
3
|
import { createPortal as Hn } from "react-dom";
|
|
4
4
|
import './index.css';function Xr(r) {
|
|
5
5
|
var t, c, a = "";
|
|
@@ -97,7 +97,7 @@ const xt = {
|
|
|
97
97
|
// iOS-specific: send two touch points in one message (Option/Alt+drag pinch)
|
|
98
98
|
INJECT_TWO_FINGER_TOUCH_EVENT: 18,
|
|
99
99
|
SET_CLIPBOARD: 9
|
|
100
|
-
},
|
|
100
|
+
}, K = {
|
|
101
101
|
ACTION_DOWN: 0,
|
|
102
102
|
ACTION_UP: 1,
|
|
103
103
|
ACTION_MOVE: 2,
|
|
@@ -362,27 +362,27 @@ function Bn(r) {
|
|
|
362
362
|
}
|
|
363
363
|
function qn(r, t, c) {
|
|
364
364
|
const { MediaStreamTrackProcessor: a, MediaStreamTrackGenerator: m } = globalThis, p = t.getVideoTracks()[0];
|
|
365
|
-
let g, C,
|
|
365
|
+
let g, C, w, O, M = !1;
|
|
366
366
|
const S = () => {
|
|
367
|
-
M || (M = !0, g?.stop(), C?.stop(),
|
|
368
|
-
},
|
|
367
|
+
M || (M = !0, g?.stop(), C?.stop(), w && (w.postMessage({ type: "stop" }), O = setTimeout(() => w?.terminate(), 1e3)));
|
|
368
|
+
}, X = (J) => {
|
|
369
369
|
r.srcObject = J, r.play().catch(() => {
|
|
370
370
|
});
|
|
371
371
|
}, ce = (J) => {
|
|
372
|
-
M || (S(), c(J),
|
|
372
|
+
M || (S(), c(J), X(t));
|
|
373
373
|
};
|
|
374
374
|
try {
|
|
375
375
|
if (p && a && m) {
|
|
376
376
|
g = p.clone();
|
|
377
|
-
const J = new a({ track: g, maxBufferSize: 1 }),
|
|
378
|
-
C =
|
|
379
|
-
ee.type === "error" ? ce(new Error(ee.message)) : ee.type === "stopped" && (clearTimeout(O),
|
|
380
|
-
},
|
|
377
|
+
const J = new a({ track: g, maxBufferSize: 1 }), fe = new m({ kind: "video" });
|
|
378
|
+
C = fe, w = new Bn(), w.onmessage = ({ data: ee }) => {
|
|
379
|
+
ee.type === "error" ? ce(new Error(ee.message)) : ee.type === "stopped" && (clearTimeout(O), w?.terminate());
|
|
380
|
+
}, w.onerror = (ee) => ce(new Error(ee.message)), w.postMessage({ type: "start", readable: J.readable, writable: fe.writable }, [
|
|
381
381
|
J.readable,
|
|
382
|
-
|
|
383
|
-
]),
|
|
382
|
+
fe.writable
|
|
383
|
+
]), X(new MediaStream(t.getTracks().map((ee) => ee === p ? fe : ee)));
|
|
384
384
|
} else
|
|
385
|
-
|
|
385
|
+
X(t);
|
|
386
386
|
} catch (J) {
|
|
387
387
|
ce(J);
|
|
388
388
|
}
|
|
@@ -400,8 +400,8 @@ function Vn(r, t) {
|
|
|
400
400
|
let C;
|
|
401
401
|
try {
|
|
402
402
|
C = JSON.parse(g.data);
|
|
403
|
-
} catch (
|
|
404
|
-
console.warn("Invalid latency trace message",
|
|
403
|
+
} catch (w) {
|
|
404
|
+
console.warn("Invalid latency trace message", w);
|
|
405
405
|
return;
|
|
406
406
|
}
|
|
407
407
|
C && typeof C == "object" && !Array.isArray(C) && t(C);
|
|
@@ -412,24 +412,28 @@ function Vn(r, t) {
|
|
|
412
412
|
a = !m && g === 1;
|
|
413
413
|
},
|
|
414
414
|
wrap(g) {
|
|
415
|
-
if (!a || g.byteLength !== 32
|
|
416
|
-
const C = new
|
|
417
|
-
|
|
415
|
+
if (!a || g.byteLength !== 32) return g;
|
|
416
|
+
const C = new DataView(g);
|
|
417
|
+
if (C.getUint8(0) !== 2 || C.getUint8(1) > 2) return g;
|
|
418
|
+
const w = new ArrayBuffer(38), O = new DataView(w);
|
|
419
|
+
return O.setUint8(0, 240), O.setUint8(1, 1), O.setUint32(2, ++p, !0), new Uint8Array(w, 6).set(new Uint8Array(g)), w;
|
|
418
420
|
},
|
|
419
421
|
close() {
|
|
420
422
|
m = !0, a = !1, c.onmessage = null, c.onclose = null, c.close();
|
|
421
423
|
}
|
|
422
424
|
};
|
|
423
425
|
}
|
|
424
|
-
function Pt(r, t, c, a, m, p, g = 1, C = 0,
|
|
426
|
+
function Pt(r, t, c, a, m, p, g = 1, C = 0, w = 0) {
|
|
425
427
|
const O = new ArrayBuffer(32), M = new DataView(O);
|
|
426
428
|
let S = 0;
|
|
427
|
-
|
|
429
|
+
M.setUint8(S, xt.INJECT_TOUCH_EVENT), S += 1;
|
|
430
|
+
const X = r === K.ACTION_POINTER_DOWN ? K.ACTION_DOWN : r === K.ACTION_POINTER_UP ? K.ACTION_UP : r;
|
|
431
|
+
return M.setUint8(S, X), S += 1, M.setBigInt64(S, BigInt(t), !0), S += 8, M.setInt32(S, Math.round(m), !0), S += 4, M.setInt32(S, Math.round(p), !0), S += 4, M.setUint16(S, c, !0), S += 2, M.setUint16(S, a, !0), S += 2, M.setInt16(S, Math.round(g * 65535), !0), S += 2, M.setInt32(S, C, !0), S += 4, M.setInt32(S, w, !0), O;
|
|
428
432
|
}
|
|
429
433
|
function Gn(r, t, c, a, m, p, g) {
|
|
430
|
-
const C = new ArrayBuffer(24),
|
|
434
|
+
const C = new ArrayBuffer(24), w = new DataView(C);
|
|
431
435
|
let O = 0;
|
|
432
|
-
return
|
|
436
|
+
return w.setUint8(O, xt.INJECT_TWO_FINGER_TOUCH_EVENT), O += 1, w.setUint8(O, r), O += 1, w.setInt32(O, Math.round(a), !0), O += 4, w.setInt32(O, Math.round(m), !0), O += 4, w.setInt32(O, Math.round(p), !0), O += 4, w.setInt32(O, Math.round(g), !0), O += 4, w.setUint16(O, t, !0), O += 2, w.setUint16(O, c, !0), O += 2, w.setUint16(O, 0, !0), C;
|
|
433
437
|
}
|
|
434
438
|
function Jn(r, t = !0) {
|
|
435
439
|
const a = new TextEncoder().encode(r), m = new ArrayBuffer(14 + a.length), p = new DataView(m);
|
|
@@ -475,9 +479,9 @@ function eo(r) {
|
|
|
475
479
|
raw: Zn(p)
|
|
476
480
|
});
|
|
477
481
|
}
|
|
478
|
-
const
|
|
479
|
-
for (let O = 0; O <
|
|
480
|
-
m(
|
|
482
|
+
const w = Array.isArray(p.children) ? p.children : [];
|
|
483
|
+
for (let O = 0; O < w.length && a.length < Lt; O++)
|
|
484
|
+
m(w[O], `${g}.${O}`);
|
|
481
485
|
};
|
|
482
486
|
for (let p = 0; p < t.length && a.length < Lt; p++)
|
|
483
487
|
m(t[p], String(p));
|
|
@@ -508,8 +512,8 @@ function no(r) {
|
|
|
508
512
|
if (!p) continue;
|
|
509
513
|
const g = Math.max(0, p.right - p.left), C = Math.max(0, p.bottom - p.top);
|
|
510
514
|
if (g <= 0 || C <= 0) continue;
|
|
511
|
-
const
|
|
512
|
-
if (Vr(
|
|
515
|
+
const w = { x: p.left, y: p.top, width: g, height: C };
|
|
516
|
+
if (Vr(w, { x: 0, y: 0, width: t.width, height: t.height })) continue;
|
|
513
517
|
const O = m.contentDesc || m.text || "", M = m.className || "";
|
|
514
518
|
c.push({
|
|
515
519
|
id: m.resourceId && m.resourceId.length > 0 ? m.resourceId : m.contentDesc && m.contentDesc.length > 0 ? `cd:${m.contentDesc}` : String(a),
|
|
@@ -520,7 +524,7 @@ function no(r) {
|
|
|
520
524
|
type: M,
|
|
521
525
|
enabled: m.enabled !== !1,
|
|
522
526
|
focused: m.focused === !0,
|
|
523
|
-
frame:
|
|
527
|
+
frame: w,
|
|
524
528
|
selectors: ro(m),
|
|
525
529
|
raw: { ...m }
|
|
526
530
|
});
|
|
@@ -679,9 +683,9 @@ class po {
|
|
|
679
683
|
const C = typeof t.error == "string" ? t.error : null;
|
|
680
684
|
if (C)
|
|
681
685
|
return this.settleReject(c, new Error(C)), !0;
|
|
682
|
-
const
|
|
686
|
+
const w = typeof t.json == "string" ? t.json : "";
|
|
683
687
|
try {
|
|
684
|
-
const O = JSON.parse(
|
|
688
|
+
const O = JSON.parse(w), M = eo(O);
|
|
685
689
|
this.settleResolve(c, M);
|
|
686
690
|
} catch (O) {
|
|
687
691
|
this.settleReject(c, O instanceof Error ? O : new Error(String(O)));
|
|
@@ -847,8 +851,8 @@ const Oo = async (r) => {
|
|
|
847
851
|
function({ element: t, screen: c, highlighted: a, selected: m, selectable: p, onClick: g }) {
|
|
848
852
|
const C = oo(t.frame, c);
|
|
849
853
|
if (!C) return null;
|
|
850
|
-
const
|
|
851
|
-
return /* @__PURE__ */
|
|
854
|
+
const w = zr(t);
|
|
855
|
+
return /* @__PURE__ */ P(
|
|
852
856
|
"button",
|
|
853
857
|
{
|
|
854
858
|
type: "button",
|
|
@@ -859,7 +863,7 @@ const Oo = async (r) => {
|
|
|
859
863
|
"data-ax-role": t.role || void 0,
|
|
860
864
|
"data-highlighted": a ? "true" : "false",
|
|
861
865
|
"data-selected": m ? "true" : "false",
|
|
862
|
-
"aria-label":
|
|
866
|
+
"aria-label": w,
|
|
863
867
|
onClick: (O) => {
|
|
864
868
|
p && (O.preventDefault(), O.stopPropagation(), g(t, { x: O.clientX, y: O.clientY }));
|
|
865
869
|
},
|
|
@@ -873,7 +877,7 @@ const Oo = async (r) => {
|
|
|
873
877
|
);
|
|
874
878
|
},
|
|
875
879
|
(r, t) => r.highlighted === t.highlighted && r.selected === t.selected && r.selectable === t.selectable && r.screen.width === t.screen.width && r.screen.height === t.screen.height && r.onClick === t.onClick && Gr(r.element, t.element)
|
|
876
|
-
),
|
|
880
|
+
), To = 260, wo = 220, Do = 6, Ao = 8, bo = cr(function({
|
|
877
881
|
element: t,
|
|
878
882
|
platform: c,
|
|
879
883
|
anchor: a,
|
|
@@ -881,21 +885,21 @@ const Oo = async (r) => {
|
|
|
881
885
|
showActions: p,
|
|
882
886
|
onTap: g
|
|
883
887
|
}) {
|
|
884
|
-
const [C,
|
|
888
|
+
const [C, w] = G(null);
|
|
885
889
|
me(() => {
|
|
886
890
|
if (!C) return;
|
|
887
|
-
const
|
|
888
|
-
return () => window.clearTimeout(
|
|
891
|
+
const B = window.setTimeout(() => w(null), 1100);
|
|
892
|
+
return () => window.clearTimeout(B);
|
|
889
893
|
}, [C]);
|
|
890
894
|
const O = ke(() => {
|
|
891
|
-
const
|
|
892
|
-
let _e =
|
|
893
|
-
const Wt = `translate(${
|
|
894
|
-
return _e = Math.max(H + (
|
|
895
|
-
}, [a.x, a.y]), M = ke(() => co(t, c), [t, c]), S = c === "ios" ? t.selectors.AXUniqueId : t.selectors.resourceId,
|
|
896
|
-
if (!
|
|
897
|
-
await Oo(
|
|
898
|
-
}, []), J = jr(t),
|
|
895
|
+
const B = To, Ee = wo, se = Do, H = Ao, ge = typeof window < "u" ? window.innerWidth : 1024, tt = typeof window < "u" ? window.innerHeight : 768, De = a.x + se + B <= ge - H, Ue = a.y - se - Ee >= H;
|
|
896
|
+
let _e = De ? a.x + se : a.x - se, W = Ue ? a.y - se : a.y + se;
|
|
897
|
+
const Wt = `translate(${De ? "0" : "-100%"}, ${Ue ? "-100%" : "0"})`;
|
|
898
|
+
return _e = Math.max(H + (De ? 0 : B), Math.min(ge - H - (De ? B : 0), _e)), W = Math.max(H + (Ue ? Ee : 0), Math.min(tt - H - (Ue ? 0 : Ee), W)), { left: `${_e}px`, top: `${W}px`, transform: Wt };
|
|
899
|
+
}, [a.x, a.y]), M = ke(() => co(t, c), [t, c]), S = c === "ios" ? t.selectors.AXUniqueId : t.selectors.resourceId, X = c === "ios" ? "AXUniqueId" : "resourceId", ce = Un(async (B, Ee) => {
|
|
900
|
+
if (!B) return;
|
|
901
|
+
await Oo(B) && w(Ee);
|
|
902
|
+
}, []), J = jr(t), fe = t.label || t.value || J, ee = zr(t);
|
|
899
903
|
return Hn(
|
|
900
904
|
/* @__PURE__ */ ue(
|
|
901
905
|
"div",
|
|
@@ -903,29 +907,29 @@ const Oo = async (r) => {
|
|
|
903
907
|
className: "rc-inspect-card",
|
|
904
908
|
"data-cursor-anchored": m ? "true" : "false",
|
|
905
909
|
style: O,
|
|
906
|
-
onClick: (
|
|
907
|
-
onMouseDown: (
|
|
908
|
-
onMouseMove: (
|
|
910
|
+
onClick: (B) => B.stopPropagation(),
|
|
911
|
+
onMouseDown: (B) => B.stopPropagation(),
|
|
912
|
+
onMouseMove: (B) => B.stopPropagation(),
|
|
909
913
|
children: [
|
|
910
914
|
/* @__PURE__ */ ue("div", { className: "rc-inspect-card-header", children: [
|
|
911
|
-
/* @__PURE__ */
|
|
912
|
-
!t.enabled && /* @__PURE__ */
|
|
913
|
-
t.focused && /* @__PURE__ */
|
|
915
|
+
/* @__PURE__ */ P("span", { className: "rc-inspect-card-role", children: J }),
|
|
916
|
+
!t.enabled && /* @__PURE__ */ P("span", { className: "rc-inspect-card-tag", children: "disabled" }),
|
|
917
|
+
t.focused && /* @__PURE__ */ P("span", { className: "rc-inspect-card-tag rc-inspect-card-tag-blue", children: "focused" })
|
|
914
918
|
] }),
|
|
915
|
-
/* @__PURE__ */
|
|
919
|
+
/* @__PURE__ */ P("p", { className: "rc-inspect-card-title", title: ee, children: fe }),
|
|
916
920
|
S && /* @__PURE__ */ ue("div", { className: "rc-inspect-card-row", children: [
|
|
917
921
|
/* @__PURE__ */ ue("span", { className: "rc-inspect-card-row-label", children: [
|
|
918
|
-
|
|
922
|
+
X,
|
|
919
923
|
":"
|
|
920
924
|
] }),
|
|
921
|
-
/* @__PURE__ */
|
|
925
|
+
/* @__PURE__ */ P("span", { className: "rc-inspect-card-row-value", children: S })
|
|
922
926
|
] }),
|
|
923
927
|
t.value && t.value !== t.label && /* @__PURE__ */ ue("div", { className: "rc-inspect-card-row", children: [
|
|
924
|
-
/* @__PURE__ */
|
|
925
|
-
/* @__PURE__ */
|
|
928
|
+
/* @__PURE__ */ P("span", { className: "rc-inspect-card-row-label", children: "value:" }),
|
|
929
|
+
/* @__PURE__ */ P("span", { className: "rc-inspect-card-row-value", children: t.value })
|
|
926
930
|
] }),
|
|
927
931
|
/* @__PURE__ */ ue("div", { className: "rc-inspect-card-row", children: [
|
|
928
|
-
/* @__PURE__ */
|
|
932
|
+
/* @__PURE__ */ P("span", { className: "rc-inspect-card-row-label", children: "frame:" }),
|
|
929
933
|
/* @__PURE__ */ ue("span", { className: "rc-inspect-card-row-value", children: [
|
|
930
934
|
Math.round(t.frame.width),
|
|
931
935
|
"×",
|
|
@@ -937,7 +941,7 @@ const Oo = async (r) => {
|
|
|
937
941
|
] })
|
|
938
942
|
] }),
|
|
939
943
|
p && /* @__PURE__ */ ue("div", { className: "rc-inspect-card-actions", children: [
|
|
940
|
-
/* @__PURE__ */
|
|
944
|
+
/* @__PURE__ */ P(
|
|
941
945
|
"button",
|
|
942
946
|
{
|
|
943
947
|
type: "button",
|
|
@@ -946,7 +950,7 @@ const Oo = async (r) => {
|
|
|
946
950
|
children: "Tap"
|
|
947
951
|
}
|
|
948
952
|
),
|
|
949
|
-
/* @__PURE__ */
|
|
953
|
+
/* @__PURE__ */ P(
|
|
950
954
|
"button",
|
|
951
955
|
{
|
|
952
956
|
type: "button",
|
|
@@ -957,15 +961,15 @@ const Oo = async (r) => {
|
|
|
957
961
|
children: C === "selector" ? "Copied!" : "Copy selector"
|
|
958
962
|
}
|
|
959
963
|
),
|
|
960
|
-
/* @__PURE__ */
|
|
964
|
+
/* @__PURE__ */ P(
|
|
961
965
|
"button",
|
|
962
966
|
{
|
|
963
967
|
type: "button",
|
|
964
968
|
className: Pe("rc-inspect-card-btn", C === "id" && "rc-inspect-card-btn-copied"),
|
|
965
969
|
disabled: !S,
|
|
966
|
-
title: S ?? `No ${
|
|
970
|
+
title: S ?? `No ${X}`,
|
|
967
971
|
onClick: () => ce(S, "id"),
|
|
968
|
-
children: C === "id" ? "Copied!" : `Copy ${
|
|
972
|
+
children: C === "id" ? "Copied!" : `Copy ${X}`
|
|
969
973
|
}
|
|
970
974
|
)
|
|
971
975
|
] })
|
|
@@ -982,21 +986,21 @@ const Oo = async (r) => {
|
|
|
982
986
|
mode: p,
|
|
983
987
|
cursorPosition: g,
|
|
984
988
|
frozenCursorPosition: C,
|
|
985
|
-
onSelectChange:
|
|
989
|
+
onSelectChange: w,
|
|
986
990
|
onTapElement: O
|
|
987
991
|
}) {
|
|
988
|
-
const M = p === "select", S = M ? a !== null && a !== m : a !== null,
|
|
992
|
+
const M = p === "select", S = M ? a !== null && a !== m : a !== null, X = M ? a ?? m : a, ce = ke(() => {
|
|
989
993
|
const H = /* @__PURE__ */ new Map();
|
|
990
994
|
if (!t) return H;
|
|
991
995
|
for (const ge of t.elements) H.set(ge.id, ge);
|
|
992
996
|
return H;
|
|
993
|
-
}, [t]), J = ke(() =>
|
|
997
|
+
}, [t]), J = ke(() => X ? ce.get(X) ?? null : null, [X, ce]);
|
|
994
998
|
if (!(!!t && !!c && t.screen.width > 0 && t.screen.height > 0 && t.elements.length > 0)) return null;
|
|
995
|
-
const ee = S ? g : C ?? g,
|
|
996
|
-
M && H.target === H.currentTarget &&
|
|
999
|
+
const ee = S ? g : C ?? g, B = S, Ee = M && !S && m !== null, se = (H) => {
|
|
1000
|
+
M && H.target === H.currentTarget && w(null, null);
|
|
997
1001
|
};
|
|
998
1002
|
return /* @__PURE__ */ ue($r, { children: [
|
|
999
|
-
/* @__PURE__ */
|
|
1003
|
+
/* @__PURE__ */ P(
|
|
1000
1004
|
"div",
|
|
1001
1005
|
{
|
|
1002
1006
|
className: Pe("rc-inspect-overlay", M && "rc-inspect-overlay-select"),
|
|
@@ -1007,7 +1011,7 @@ const Oo = async (r) => {
|
|
|
1007
1011
|
height: `${c.height}px`
|
|
1008
1012
|
},
|
|
1009
1013
|
onClick: se,
|
|
1010
|
-
children: t.elements.map((H) => /* @__PURE__ */
|
|
1014
|
+
children: t.elements.map((H) => /* @__PURE__ */ P(
|
|
1011
1015
|
_o,
|
|
1012
1016
|
{
|
|
1013
1017
|
element: H,
|
|
@@ -1015,36 +1019,36 @@ const Oo = async (r) => {
|
|
|
1015
1019
|
highlighted: H.id === a,
|
|
1016
1020
|
selected: H.id === m,
|
|
1017
1021
|
selectable: M,
|
|
1018
|
-
onClick:
|
|
1022
|
+
onClick: w
|
|
1019
1023
|
},
|
|
1020
1024
|
H.id
|
|
1021
1025
|
))
|
|
1022
1026
|
}
|
|
1023
1027
|
),
|
|
1024
|
-
J && ee && /* @__PURE__ */
|
|
1028
|
+
J && ee && /* @__PURE__ */ P(
|
|
1025
1029
|
bo,
|
|
1026
1030
|
{
|
|
1027
1031
|
element: J,
|
|
1028
1032
|
platform: t.platform,
|
|
1029
1033
|
anchor: ee,
|
|
1030
|
-
cursorAnchored:
|
|
1034
|
+
cursorAnchored: B,
|
|
1031
1035
|
showActions: Ee,
|
|
1032
1036
|
onTap: O
|
|
1033
1037
|
}
|
|
1034
1038
|
)
|
|
1035
1039
|
] });
|
|
1036
|
-
}), Mo = Ln(() => import("./duo-view-
|
|
1040
|
+
}), Mo = Ln(() => import("./duo-view-DSZO0-zg.mjs").then((r) => r.d)), F = (...r) => {
|
|
1037
1041
|
window.debugRemoteControl && console.log(...r);
|
|
1038
1042
|
}, A = (...r) => {
|
|
1039
1043
|
window.debugRemoteControl && console.warn(...r);
|
|
1040
|
-
},
|
|
1044
|
+
}, L = (r, t, ...c) => {
|
|
1041
1045
|
if (t)
|
|
1042
1046
|
try {
|
|
1043
1047
|
t(...c);
|
|
1044
1048
|
} catch (a) {
|
|
1045
1049
|
console.error(`[RemoteControl] customer callback "${r}" threw:`, a);
|
|
1046
1050
|
}
|
|
1047
|
-
}, Ut = (r) => Object.entries(
|
|
1051
|
+
}, Ut = (r) => Object.entries(K).find(
|
|
1048
1052
|
([c, a]) => c.startsWith("ACTION_") && a === r
|
|
1049
1053
|
)?.[0] ?? String(r), Ro = (r) => r.includes("/android_") ? "android" : "ios", Fr = (r, t) => {
|
|
1050
1054
|
const c = new URL(r);
|
|
@@ -1088,27 +1092,27 @@ const jo = xn(
|
|
|
1088
1092
|
showFrame: p = !0,
|
|
1089
1093
|
deviceModel: g,
|
|
1090
1094
|
duoModelUrl: C,
|
|
1091
|
-
autoReconnect:
|
|
1095
|
+
autoReconnect: w = !1,
|
|
1092
1096
|
onTerminated: O,
|
|
1093
1097
|
assets: M,
|
|
1094
1098
|
onConnectionStateChange: S,
|
|
1095
|
-
inspectMode:
|
|
1099
|
+
inspectMode: X,
|
|
1096
1100
|
onAxSnapshotChange: ce,
|
|
1097
1101
|
onInspectSelectionChange: J,
|
|
1098
|
-
onAxStatusChange:
|
|
1102
|
+
onAxStatusChange: fe,
|
|
1099
1103
|
axPollIntervalMs: ee,
|
|
1100
|
-
axMaxBackoffMs:
|
|
1104
|
+
axMaxBackoffMs: B,
|
|
1101
1105
|
androidElementTreeOptions: Ee,
|
|
1102
1106
|
onCameraDemandChange: se,
|
|
1103
1107
|
onCameraStats: H,
|
|
1104
1108
|
onTrace: ge,
|
|
1105
1109
|
microphoneEnabled: tt = !1,
|
|
1106
|
-
onMicrophoneStateChange:
|
|
1110
|
+
onMicrophoneStateChange: De
|
|
1107
1111
|
}, Ue) => {
|
|
1108
|
-
const _e = v(null), W = v(null), rt = v(/* @__PURE__ */ new Map()), Ft = v(null), [Wt, Qr] =
|
|
1112
|
+
const _e = v(null), W = v(null), rt = v(/* @__PURE__ */ new Map()), Ft = v(null), [Wt, Qr] = G(!1), ye = g === "iphone-duo" || Wt, nt = v(null), [sr, ar] = G(null), [ur, lr] = G(), Le = v(
|
|
1109
1113
|
/* @__PURE__ */ new Map()
|
|
1110
1114
|
), Ht = (e, i) => new Promise((o, n) => {
|
|
1111
|
-
const l =
|
|
1115
|
+
const l = D.current;
|
|
1112
1116
|
if (!l || l.readyState !== WebSocket.OPEN) {
|
|
1113
1117
|
n(new Error("Simulator disconnected"));
|
|
1114
1118
|
return;
|
|
@@ -1117,79 +1121,79 @@ const jo = xn(
|
|
|
1117
1121
|
Le.current.delete(u), n(new Error("Device control timed out"));
|
|
1118
1122
|
}, 5e3);
|
|
1119
1123
|
Le.current.set(u, { resolve: o, reject: n, timer: f }), l.send(JSON.stringify({ type: e, id: u, ...i }));
|
|
1120
|
-
}), [Zr, $t] =
|
|
1124
|
+
}), [Zr, $t] = G(!1), [en, yt] = G(!1), [tn, dr] = G(!1), xe = v(!1), Xt = v(!1), [fr, rn] = G(!1), [nn, on] = G(!1), [cn, hr] = G({}), D = v(null), x = v(null), U = v(null), Ct = v(null), Bt = v(ge);
|
|
1121
1125
|
Bt.current = ge;
|
|
1122
|
-
const sn = !!ge, Fe = v(void 0), ot = v(void 0), it = v(void 0), vt = v(void 0), We = v(void 0), Ae = v(0), Ot = v(0), Ce = v(!1), qt = v(
|
|
1123
|
-
qt.current =
|
|
1126
|
+
const sn = !!ge, Fe = v(void 0), ot = v(void 0), it = v(void 0), vt = v(void 0), We = v(void 0), Ae = v(0), Ot = v(0), Ce = v(!1), qt = v(w);
|
|
1127
|
+
qt.current = w;
|
|
1124
1128
|
const be = v(null), ne = v(null), Se = v(void 0), Vt = ke(() => new mo(), []), ve = v(se);
|
|
1125
1129
|
ve.current = se;
|
|
1126
1130
|
const _t = v(H);
|
|
1127
1131
|
_t.current = H;
|
|
1128
|
-
const ct = v(null),
|
|
1132
|
+
const ct = v(null), Tt = v(null), Gt = v(tt);
|
|
1129
1133
|
Gt.current = tt;
|
|
1130
|
-
const Jt = v(!1), st = v(
|
|
1131
|
-
st.current =
|
|
1132
|
-
const at = v(null),
|
|
1134
|
+
const Jt = v(!1), st = v(De);
|
|
1135
|
+
st.current = De;
|
|
1136
|
+
const at = v(null), he = v(null), wt = v(0), pr = v(Promise.resolve()), He = v(null), ut = v(!1), Te = v(/* @__PURE__ */ new Map()), Oe = v(/* @__PURE__ */ new Map()), Me = v(/* @__PURE__ */ new Map()), Re = v(/* @__PURE__ */ new Map()), Z = v(/* @__PURE__ */ new Map()), Ne = v(!1), [an, un] = G(!1), q = v(null), $e = v(null), lt = v({
|
|
1133
1137
|
handle: () => {
|
|
1134
1138
|
},
|
|
1135
1139
|
end: () => {
|
|
1136
1140
|
}
|
|
1137
|
-
}), [Ie,
|
|
1141
|
+
}), [Ie, Dt] = G(null), te = v(null), [mr, Er] = G(null), [jt, dt] = G(null), [zt, At] = G(null), [ln, gr] = G(null), [dn, yr] = G(null), bt = v(null), ae = v(void 0), Cr = (e) => {
|
|
1138
1142
|
bt.current = e, ae.current === void 0 && (ae.current = window.requestAnimationFrame(() => {
|
|
1139
1143
|
ae.current = void 0, yr(bt.current);
|
|
1140
1144
|
}));
|
|
1141
|
-
}, [fn, Xe] =
|
|
1142
|
-
Be.current =
|
|
1145
|
+
}, [fn, Xe] = G(null), Be = v(X);
|
|
1146
|
+
Be.current = X;
|
|
1143
1147
|
const qe = v(null);
|
|
1144
1148
|
qe.current = mr;
|
|
1145
1149
|
const Qt = v(ce);
|
|
1146
1150
|
Qt.current = ce;
|
|
1147
1151
|
const Ve = v(J);
|
|
1148
1152
|
Ve.current = J;
|
|
1149
|
-
const vr = v(
|
|
1150
|
-
vr.current =
|
|
1153
|
+
const vr = v(fe);
|
|
1154
|
+
vr.current = fe;
|
|
1151
1155
|
const Or = v(O);
|
|
1152
1156
|
Or.current = O;
|
|
1153
1157
|
const _r = v(S);
|
|
1154
1158
|
_r.current = S;
|
|
1155
1159
|
const Zt = v(null), Ge = (e) => {
|
|
1156
|
-
Zt.current !== e && (Zt.current = e,
|
|
1157
|
-
}, ft =
|
|
1160
|
+
Zt.current !== e && (Zt.current = e, L("onConnectionStateChange", _r.current, e));
|
|
1161
|
+
}, ft = X === !0 || X === "hover-only", hn = X === "hover-only" ? "hover-only" : "select", le = ke(
|
|
1158
1162
|
() => a || Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15),
|
|
1159
1163
|
[a]
|
|
1160
|
-
),
|
|
1164
|
+
), pe = ke(() => Ro(t), [t]), Je = Po[pe], ht = M?.[pe], Tr = pe === "android" && nn ? fr ? ht?.tabletFrameLandscape : ht?.tabletFrame : fr ? ht?.frameLandscape : ht?.frame, wr = ht?.loadingLogo, St = !ye && p && !!Tr, k = (e) => {
|
|
1161
1165
|
F(e);
|
|
1162
|
-
},
|
|
1163
|
-
!
|
|
1164
|
-
},
|
|
1166
|
+
}, de = (e) => {
|
|
1167
|
+
!U.current || U.current.readyState !== "open" || (U.current.send(Ct.current?.wrap(e) ?? e), te.current?.bumpActivity());
|
|
1168
|
+
}, Dr = -10, Ar = (e, i) => {
|
|
1165
1169
|
const o = pt();
|
|
1166
1170
|
if (!o) return;
|
|
1167
1171
|
const n = ze(o, e, i);
|
|
1168
1172
|
if (!n) return;
|
|
1169
1173
|
const { videoX: l, videoY: u, videoWidth: f, videoHeight: E } = n, y = Pt(
|
|
1170
|
-
|
|
1171
|
-
|
|
1174
|
+
K.ACTION_DOWN,
|
|
1175
|
+
Dr,
|
|
1172
1176
|
f,
|
|
1173
1177
|
E,
|
|
1174
1178
|
l,
|
|
1175
1179
|
u,
|
|
1176
1180
|
1,
|
|
1177
|
-
|
|
1178
|
-
|
|
1181
|
+
K.BUTTON_PRIMARY,
|
|
1182
|
+
K.BUTTON_PRIMARY
|
|
1179
1183
|
);
|
|
1180
|
-
y &&
|
|
1184
|
+
y && de(y), window.setTimeout(() => {
|
|
1181
1185
|
const h = Pt(
|
|
1182
|
-
|
|
1183
|
-
|
|
1186
|
+
K.ACTION_UP,
|
|
1187
|
+
Dr,
|
|
1184
1188
|
f,
|
|
1185
1189
|
E,
|
|
1186
1190
|
l,
|
|
1187
1191
|
u,
|
|
1188
1192
|
0,
|
|
1189
|
-
|
|
1190
|
-
|
|
1193
|
+
K.BUTTON_PRIMARY,
|
|
1194
|
+
K.BUTTON_PRIMARY
|
|
1191
1195
|
);
|
|
1192
|
-
h &&
|
|
1196
|
+
h && de(h);
|
|
1193
1197
|
}, 60);
|
|
1194
1198
|
}, pn = (e, i) => {
|
|
1195
1199
|
const o = pt();
|
|
@@ -1206,8 +1210,8 @@ const jo = xn(
|
|
|
1206
1210
|
u,
|
|
1207
1211
|
1,
|
|
1208
1212
|
// pressure
|
|
1209
|
-
|
|
1210
|
-
|
|
1213
|
+
K.BUTTON_PRIMARY,
|
|
1214
|
+
K.BUTTON_PRIMARY
|
|
1211
1215
|
);
|
|
1212
1216
|
f && (F("[rc-touch] sendSingleTouch", {
|
|
1213
1217
|
action: e,
|
|
@@ -1216,22 +1220,22 @@ const jo = xn(
|
|
|
1216
1220
|
x: l,
|
|
1217
1221
|
y: u,
|
|
1218
1222
|
video: { width: o, height: n }
|
|
1219
|
-
}),
|
|
1223
|
+
}), de(f));
|
|
1220
1224
|
}, Ke = (e, i, o) => {
|
|
1221
1225
|
if (!o) return;
|
|
1222
1226
|
const { videoX: n, videoY: l, videoWidth: u, videoHeight: f } = o;
|
|
1223
1227
|
let E = null, y = null, h = 1;
|
|
1224
|
-
const R =
|
|
1228
|
+
const R = K.BUTTON_PRIMARY;
|
|
1225
1229
|
switch (i) {
|
|
1226
1230
|
case "down":
|
|
1227
|
-
e !== Ye && lt.current.end(), E = Z.current.size === 0 ?
|
|
1231
|
+
e !== Ye && lt.current.end(), E = Z.current.size === 0 ? K.ACTION_DOWN : K.ACTION_POINTER_DOWN, y = { x: n, y: l }, Z.current.set(e, y), e === -1 && W.current?.focus();
|
|
1228
1232
|
break;
|
|
1229
1233
|
case "move":
|
|
1230
|
-
Z.current.has(e) && (E =
|
|
1234
|
+
Z.current.has(e) && (E = K.ACTION_MOVE, y = { x: n, y: l }, Z.current.set(e, y));
|
|
1231
1235
|
break;
|
|
1232
1236
|
case "up":
|
|
1233
1237
|
case "cancel":
|
|
1234
|
-
Z.current.has(e) && (y = Z.current.get(e), Z.current.delete(e), i === "cancel" ? E =
|
|
1238
|
+
Z.current.has(e) && (y = Z.current.get(e), Z.current.delete(e), i === "cancel" ? E = K.ACTION_CANCEL : E = Z.current.size === 0 ? K.ACTION_UP : K.ACTION_POINTER_UP);
|
|
1235
1239
|
break;
|
|
1236
1240
|
}
|
|
1237
1241
|
if (E !== null && y !== null) {
|
|
@@ -1264,13 +1268,13 @@ const jo = xn(
|
|
|
1264
1268
|
pointerId: e,
|
|
1265
1269
|
actionName: Ut(E),
|
|
1266
1270
|
byteLength: _.byteLength
|
|
1267
|
-
}),
|
|
1271
|
+
}), de(_));
|
|
1268
1272
|
} else (i === "up" || i === "cancel") && Z.current.delete(e);
|
|
1269
1273
|
}, er = (e) => {
|
|
1270
|
-
if (Ne.current !== e && (Ne.current = e, un(e), e ||
|
|
1274
|
+
if (Ne.current !== e && (Ne.current = e, un(e), e || Dt(null), F("[rc-touch][alt] updateAltHeld", {
|
|
1271
1275
|
nextHeld: e,
|
|
1272
1276
|
activePointerIds: Array.from(Z.current.keys())
|
|
1273
|
-
}),
|
|
1277
|
+
}), pe === "ios" && U.current && U.current.readyState === "open")) {
|
|
1274
1278
|
const i = e ? s.ACTION_DOWN : s.ACTION_UP, o = gt(
|
|
1275
1279
|
i,
|
|
1276
1280
|
s.KEYCODE_ALT_LEFT,
|
|
@@ -1280,7 +1284,7 @@ const jo = xn(
|
|
|
1280
1284
|
F("[rc-touch][alt] sending Indigo modifier keycode", {
|
|
1281
1285
|
action: i,
|
|
1282
1286
|
keycode: s.KEYCODE_ALT_LEFT
|
|
1283
|
-
}), o &&
|
|
1287
|
+
}), o && de(o);
|
|
1284
1288
|
}
|
|
1285
1289
|
}, pt = () => {
|
|
1286
1290
|
const e = W.current, i = _e.current;
|
|
@@ -1343,26 +1347,26 @@ const jo = xn(
|
|
|
1343
1347
|
p0: { x: n, y: l },
|
|
1344
1348
|
p1: { x: u, y: f },
|
|
1345
1349
|
byteLength: E.byteLength
|
|
1346
|
-
}),
|
|
1350
|
+
}), de(E);
|
|
1347
1351
|
}, Qe = (e, i, o, n, l, u, f, E, y) => {
|
|
1348
1352
|
if (F("[rc-touch2] applyTwoFingerEvent", {
|
|
1349
|
-
platform:
|
|
1353
|
+
platform: pe,
|
|
1350
1354
|
eventType: e,
|
|
1351
1355
|
video: { width: i, height: o },
|
|
1352
1356
|
p0: { x: n, y: l, id: E },
|
|
1353
1357
|
p1: { x: u, y: f, id: y }
|
|
1354
|
-
}), e === "down" && lt.current.end(),
|
|
1355
|
-
const h = e === "down" ?
|
|
1358
|
+
}), e === "down" && lt.current.end(), pe === "ios") {
|
|
1359
|
+
const h = e === "down" ? K.ACTION_DOWN : e === "move" ? K.ACTION_MOVE : K.ACTION_UP;
|
|
1356
1360
|
En(h, i, o, n, l, u, f);
|
|
1357
1361
|
} else
|
|
1358
|
-
e === "down" ? (je(
|
|
1362
|
+
e === "down" ? (je(K.ACTION_DOWN, E, i, o, n, l), je(K.ACTION_POINTER_DOWN, y, i, o, u, f)) : e === "move" ? (je(K.ACTION_MOVE, E, i, o, n, l), je(K.ACTION_MOVE, y, i, o, u, f)) : (je(K.ACTION_POINTER_UP, y, i, o, u, f), je(K.ACTION_UP, E, i, o, n, l));
|
|
1359
1363
|
}, gn = (e, i, o) => {
|
|
1360
1364
|
if (!Ne.current) {
|
|
1361
|
-
Ie !== null &&
|
|
1365
|
+
Ie !== null && Dt(null);
|
|
1362
1366
|
return;
|
|
1363
1367
|
}
|
|
1364
1368
|
const n = mn(e, i, o);
|
|
1365
|
-
|
|
1369
|
+
Dt(n);
|
|
1366
1370
|
}, yn = (e, i, o) => {
|
|
1367
1371
|
const n = qe.current;
|
|
1368
1372
|
if (!n || n.screen.width <= 0 || n.screen.height <= 0) return null;
|
|
@@ -1370,7 +1374,7 @@ const jo = xn(
|
|
|
1370
1374
|
if (l < 0 || u < 0 || l > e.actualWidth || u > e.actualHeight) return null;
|
|
1371
1375
|
const f = l / e.actualWidth * n.screen.width, E = u / e.actualHeight * n.screen.height;
|
|
1372
1376
|
return io(n, f, E);
|
|
1373
|
-
},
|
|
1377
|
+
}, we = (e) => {
|
|
1374
1378
|
if (ye) return;
|
|
1375
1379
|
e.preventDefault(), e.stopPropagation();
|
|
1376
1380
|
const i = pt();
|
|
@@ -1381,7 +1385,7 @@ const jo = xn(
|
|
|
1381
1385
|
dt(n?.id ?? null);
|
|
1382
1386
|
}
|
|
1383
1387
|
} else e.type === "mouseleave" && (Cr(null), dt(null));
|
|
1384
|
-
if (Be.current !== !0 && (!("touches" in e) && i && (e.type === "mousemove" ? gn(i, e.clientX, e.clientY) : e.type === "mouseleave" &&
|
|
1388
|
+
if (Be.current !== !0 && (!("touches" in e) && i && (e.type === "mousemove" ? gn(i, e.clientX, e.clientY) : e.type === "mouseleave" && Dt(null)), !(!U.current || U.current.readyState !== "open" || !W.current || !i)))
|
|
1385
1389
|
if ("touches" in e) {
|
|
1386
1390
|
const n = e.touches, l = e.changedTouches;
|
|
1387
1391
|
let u;
|
|
@@ -1404,7 +1408,7 @@ const jo = xn(
|
|
|
1404
1408
|
if (n.length === 2) {
|
|
1405
1409
|
const f = n[0], E = n[1], y = ze(i, f.clientX, f.clientY), h = ze(i, E.clientX, E.clientY);
|
|
1406
1410
|
if (!y || !h) return;
|
|
1407
|
-
|
|
1411
|
+
q.current ? q.current.source === "real-touch" && (q.current.finger0 = { x: y.videoX, y: y.videoY }, q.current.finger1 = { x: h.videoX, y: h.videoY }, Qe(
|
|
1408
1412
|
"move",
|
|
1409
1413
|
y.videoWidth,
|
|
1410
1414
|
y.videoHeight,
|
|
@@ -1412,9 +1416,9 @@ const jo = xn(
|
|
|
1412
1416
|
y.videoY,
|
|
1413
1417
|
h.videoX,
|
|
1414
1418
|
h.videoY,
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
)) : (
|
|
1419
|
+
q.current.pointerId0,
|
|
1420
|
+
q.current.pointerId1
|
|
1421
|
+
)) : (q.current = {
|
|
1418
1422
|
finger0: { x: y.videoX, y: y.videoY },
|
|
1419
1423
|
finger1: { x: h.videoX, y: h.videoY },
|
|
1420
1424
|
videoSize: { width: y.videoWidth, height: y.videoHeight },
|
|
@@ -1432,8 +1436,8 @@ const jo = xn(
|
|
|
1432
1436
|
f.identifier,
|
|
1433
1437
|
E.identifier
|
|
1434
1438
|
));
|
|
1435
|
-
} else if (n.length < 2 &&
|
|
1436
|
-
const f =
|
|
1439
|
+
} else if (n.length < 2 && q.current?.source === "real-touch") {
|
|
1440
|
+
const f = q.current;
|
|
1437
1441
|
Qe(
|
|
1438
1442
|
"up",
|
|
1439
1443
|
f.videoSize.width,
|
|
@@ -1444,7 +1448,7 @@ const jo = xn(
|
|
|
1444
1448
|
f.finger1.y,
|
|
1445
1449
|
f.pointerId0,
|
|
1446
1450
|
f.pointerId1
|
|
1447
|
-
),
|
|
1451
|
+
), q.current = null;
|
|
1448
1452
|
return;
|
|
1449
1453
|
} else {
|
|
1450
1454
|
if (n.length > 2)
|
|
@@ -1459,7 +1463,7 @@ const jo = xn(
|
|
|
1459
1463
|
}
|
|
1460
1464
|
} else {
|
|
1461
1465
|
let l = null;
|
|
1462
|
-
const u =
|
|
1466
|
+
const u = q.current?.source === "alt-mouse";
|
|
1463
1467
|
switch (e.type) {
|
|
1464
1468
|
case "mousedown":
|
|
1465
1469
|
e.button === 0 && (l = "down");
|
|
@@ -1499,7 +1503,7 @@ const jo = xn(
|
|
|
1499
1503
|
}, Cn = (e, i) => {
|
|
1500
1504
|
const { videoX: o, videoY: n, videoWidth: l, videoHeight: u } = i, f = l - o, E = u - n;
|
|
1501
1505
|
if (e === "down") {
|
|
1502
|
-
|
|
1506
|
+
q.current = {
|
|
1503
1507
|
finger0: { x: o, y: n },
|
|
1504
1508
|
finger1: { x: f, y: E },
|
|
1505
1509
|
videoSize: { width: l, height: u },
|
|
@@ -1520,7 +1524,7 @@ const jo = xn(
|
|
|
1520
1524
|
return;
|
|
1521
1525
|
}
|
|
1522
1526
|
if (e === "move") {
|
|
1523
|
-
|
|
1527
|
+
q.current?.source === "alt-mouse" && (q.current.finger0 = { x: o, y: n }, q.current.finger1 = { x: f, y: E }, Qe(
|
|
1524
1528
|
"move",
|
|
1525
1529
|
l,
|
|
1526
1530
|
u,
|
|
@@ -1534,7 +1538,7 @@ const jo = xn(
|
|
|
1534
1538
|
return;
|
|
1535
1539
|
}
|
|
1536
1540
|
if (e === "up" || e === "cancel") {
|
|
1537
|
-
const y =
|
|
1541
|
+
const y = q.current;
|
|
1538
1542
|
if (y?.source === "alt-mouse") {
|
|
1539
1543
|
const { finger0: h, finger1: R, videoSize: _ } = y;
|
|
1540
1544
|
Qe(
|
|
@@ -1547,7 +1551,7 @@ const jo = xn(
|
|
|
1547
1551
|
R.y,
|
|
1548
1552
|
Mt,
|
|
1549
1553
|
Rt
|
|
1550
|
-
),
|
|
1554
|
+
), q.current = null;
|
|
1551
1555
|
}
|
|
1552
1556
|
return;
|
|
1553
1557
|
}
|
|
@@ -1555,7 +1559,7 @@ const jo = xn(
|
|
|
1555
1559
|
const e = $e.current;
|
|
1556
1560
|
e && (window.clearTimeout(e.endTimer), Ke(Ye, "up", e.pos), $e.current = null);
|
|
1557
1561
|
}, On = (e) => {
|
|
1558
|
-
if (e.ctrlKey || Ne.current ||
|
|
1562
|
+
if (e.ctrlKey || Ne.current || q.current) return;
|
|
1559
1563
|
const i = Z.current.size;
|
|
1560
1564
|
if (i > 1 || i === 1 && !Z.current.has(Ye)) return;
|
|
1561
1565
|
const o = pt();
|
|
@@ -1628,8 +1632,8 @@ const jo = xn(
|
|
|
1628
1632
|
A("Simulator input not focused, skipping keyboard event");
|
|
1629
1633
|
return;
|
|
1630
1634
|
}
|
|
1631
|
-
if (!
|
|
1632
|
-
A("Data channel not ready for keyboard event:",
|
|
1635
|
+
if (!U.current || U.current.readyState !== "open") {
|
|
1636
|
+
A("Data channel not ready for keyboard event:", U.current?.readyState);
|
|
1633
1637
|
return;
|
|
1634
1638
|
}
|
|
1635
1639
|
if (e.type === "keydown") {
|
|
@@ -1641,7 +1645,7 @@ const jo = xn(
|
|
|
1641
1645
|
n.substring(0, 20) + (n.length > 20 ? "..." : "")
|
|
1642
1646
|
);
|
|
1643
1647
|
const l = Jn(n, !0);
|
|
1644
|
-
|
|
1648
|
+
de(l);
|
|
1645
1649
|
}
|
|
1646
1650
|
}).catch((n) => {
|
|
1647
1651
|
console.error("Failed to read clipboard contents: ", n);
|
|
@@ -1657,14 +1661,14 @@ const jo = xn(
|
|
|
1657
1661
|
s.META_NONE
|
|
1658
1662
|
// Modifiers are handled by the shortcut check, not passed down
|
|
1659
1663
|
);
|
|
1660
|
-
|
|
1664
|
+
de(n);
|
|
1661
1665
|
const l = gt(
|
|
1662
1666
|
s.ACTION_UP,
|
|
1663
1667
|
s.MENU,
|
|
1664
1668
|
0,
|
|
1665
1669
|
s.META_NONE
|
|
1666
1670
|
);
|
|
1667
|
-
|
|
1671
|
+
de(l);
|
|
1668
1672
|
return;
|
|
1669
1673
|
}
|
|
1670
1674
|
}
|
|
@@ -1679,11 +1683,11 @@ const jo = xn(
|
|
|
1679
1683
|
// repeat count, typically 0 for single presses
|
|
1680
1684
|
l
|
|
1681
1685
|
);
|
|
1682
|
-
|
|
1686
|
+
de(f);
|
|
1683
1687
|
} else
|
|
1684
1688
|
F(`Ignoring unhandled key event: type=${e.type}, key=${e.key}`);
|
|
1685
1689
|
}, _n = () => {
|
|
1686
|
-
|
|
1690
|
+
D.current && D.current.readyState === WebSocket.OPEN && D.current.send(
|
|
1687
1691
|
JSON.stringify({
|
|
1688
1692
|
type: "keepAlive",
|
|
1689
1693
|
sessionId: le
|
|
@@ -1701,7 +1705,7 @@ const jo = xn(
|
|
|
1701
1705
|
vt.current && (window.clearInterval(vt.current), vt.current = void 0);
|
|
1702
1706
|
}, Et = () => {
|
|
1703
1707
|
We.current !== void 0 && (window.clearTimeout(We.current), We.current = void 0);
|
|
1704
|
-
},
|
|
1708
|
+
}, Tn = () => {
|
|
1705
1709
|
ut.current || (ut.current = !0, mt(), $t(!0), Ge("connected"));
|
|
1706
1710
|
}, re = (e) => {
|
|
1707
1711
|
for (const i of e.getTracks())
|
|
@@ -1710,7 +1714,7 @@ const jo = xn(
|
|
|
1710
1714
|
} catch (o) {
|
|
1711
1715
|
A("track.stop() failed:", o);
|
|
1712
1716
|
}
|
|
1713
|
-
},
|
|
1717
|
+
}, wn = () => {
|
|
1714
1718
|
const e = ne.current;
|
|
1715
1719
|
e && (ne.current = null, re(e));
|
|
1716
1720
|
}, Rr = (e) => {
|
|
@@ -1721,16 +1725,16 @@ const jo = xn(
|
|
|
1721
1725
|
}, tr = () => Gt.current || Jt.current, Nr = (e) => {
|
|
1722
1726
|
const i = `ui-mic-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
1723
1727
|
He.current = i, e.send(JSON.stringify({ type: "microphoneStart", id: i }));
|
|
1724
|
-
}, rr = () => Rr(() =>
|
|
1725
|
-
const e =
|
|
1726
|
-
|
|
1728
|
+
}, rr = () => Rr(() => Dn()), Dn = async () => {
|
|
1729
|
+
const e = wt.current, i = () => e === wt.current && tr(), o = (E) => {
|
|
1730
|
+
L("onMicrophoneStateChange", st.current, {
|
|
1727
1731
|
active: !1,
|
|
1728
1732
|
error: E
|
|
1729
1733
|
});
|
|
1730
1734
|
};
|
|
1731
1735
|
if (!i()) return;
|
|
1732
|
-
const n =
|
|
1733
|
-
if (!n || n.readyState !== WebSocket.OPEN || !l ||
|
|
1736
|
+
const n = D.current, l = at.current;
|
|
1737
|
+
if (!n || n.readyState !== WebSocket.OPEN || !l || he.current) return;
|
|
1734
1738
|
if (!navigator.mediaDevices || typeof navigator.mediaDevices.getUserMedia != "function") {
|
|
1735
1739
|
console.warn(
|
|
1736
1740
|
"[RemoteControl] navigator.mediaDevices.getUserMedia unavailable. getUserMedia requires a secure context (https or http://localhost)."
|
|
@@ -1771,27 +1775,27 @@ const jo = xn(
|
|
|
1771
1775
|
re(u);
|
|
1772
1776
|
return;
|
|
1773
1777
|
}
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
}, Nr(n),
|
|
1778
|
+
he.current = u, f.onended = () => {
|
|
1779
|
+
he.current === u && Kt("microphone capture ended by the browser");
|
|
1780
|
+
}, Nr(n), L("onMicrophoneStateChange", st.current, {
|
|
1777
1781
|
active: !0,
|
|
1778
1782
|
label: f.label || void 0
|
|
1779
1783
|
});
|
|
1780
|
-
}, Kt = (e) => (++
|
|
1781
|
-
const i = at.current, o =
|
|
1782
|
-
if (
|
|
1784
|
+
}, Kt = (e) => (++wt.current, He.current = null, Rr(async () => {
|
|
1785
|
+
const i = at.current, o = he.current;
|
|
1786
|
+
if (he.current = null, i && o)
|
|
1783
1787
|
try {
|
|
1784
1788
|
await i.replaceTrack(null);
|
|
1785
1789
|
} catch (l) {
|
|
1786
1790
|
A("replaceTrack(null) on mic detach failed:", l);
|
|
1787
1791
|
}
|
|
1788
1792
|
o && re(o);
|
|
1789
|
-
const n =
|
|
1793
|
+
const n = D.current;
|
|
1790
1794
|
if (o && n && n.readyState === WebSocket.OPEN) {
|
|
1791
1795
|
const l = `ui-mic-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
1792
1796
|
n.send(JSON.stringify({ type: "microphoneStop", id: l }));
|
|
1793
1797
|
}
|
|
1794
|
-
(o || e) &&
|
|
1798
|
+
(o || e) && L("onMicrophoneStateChange", st.current, {
|
|
1795
1799
|
active: !1,
|
|
1796
1800
|
...e !== void 0 && { error: e }
|
|
1797
1801
|
});
|
|
@@ -1810,7 +1814,7 @@ const jo = xn(
|
|
|
1810
1814
|
}
|
|
1811
1815
|
};
|
|
1812
1816
|
}
|
|
1813
|
-
e.send(JSON.stringify(o)),
|
|
1817
|
+
e.send(JSON.stringify(o)), L("onCameraDemandChange", ve.current, !0, !0, o.camera);
|
|
1814
1818
|
}, An = (e) => {
|
|
1815
1819
|
if (!e) return;
|
|
1816
1820
|
const i = e.indexOf("/"), n = (i >= 0 ? e.slice(i + 1) : e).toUpperCase();
|
|
@@ -1832,7 +1836,7 @@ const jo = xn(
|
|
|
1832
1836
|
N && (l = N.mimeType);
|
|
1833
1837
|
}
|
|
1834
1838
|
if (!n) return;
|
|
1835
|
-
const f = n.timestamp ?? Date.now(), E =
|
|
1839
|
+
const f = n.timestamp ?? Date.now(), E = Tt.current;
|
|
1836
1840
|
let y, h, R;
|
|
1837
1841
|
if (E && f > E.timestamp) {
|
|
1838
1842
|
const N = (f - E.timestamp) / 1e3;
|
|
@@ -1841,7 +1845,7 @@ const jo = xn(
|
|
|
1841
1845
|
$ > 0 && (R = Math.max(0, Math.min(100, oe / $ * 100)));
|
|
1842
1846
|
}
|
|
1843
1847
|
}
|
|
1844
|
-
|
|
1848
|
+
Tt.current = {
|
|
1845
1849
|
timestamp: f,
|
|
1846
1850
|
framesEncoded: n.framesEncoded,
|
|
1847
1851
|
bytesSent: n.bytesSent,
|
|
@@ -1861,15 +1865,15 @@ const jo = xn(
|
|
|
1861
1865
|
rttMs: typeof u?.roundTripTime == "number" ? u.roundTripTime * 1e3 : void 0,
|
|
1862
1866
|
packetsLostPct: R
|
|
1863
1867
|
};
|
|
1864
|
-
|
|
1868
|
+
L("onCameraStats", _t.current, _);
|
|
1865
1869
|
}, Yr = () => {
|
|
1866
|
-
ct.current === null && (
|
|
1870
|
+
ct.current === null && (Tt.current = null, ct.current = setInterval(() => {
|
|
1867
1871
|
bn();
|
|
1868
1872
|
}, 1e3));
|
|
1869
1873
|
}, kt = () => {
|
|
1870
|
-
ct.current !== null && (clearInterval(ct.current), ct.current = null),
|
|
1874
|
+
ct.current !== null && (clearInterval(ct.current), ct.current = null), Tt.current = null, L("onCameraStats", _t.current, null);
|
|
1871
1875
|
}, Sn = (e, i, o, n) => Vt.enqueue(async ({ isCurrent: l }) => {
|
|
1872
|
-
const u = () => l() && n() &&
|
|
1876
|
+
const u = () => l() && n() && D.current === i && be.current === o;
|
|
1873
1877
|
if (!u()) return;
|
|
1874
1878
|
if (!e.active) {
|
|
1875
1879
|
const _ = ne.current;
|
|
@@ -1879,10 +1883,10 @@ const jo = xn(
|
|
|
1879
1883
|
A("replaceTrack(null) on camera detach failed:", N);
|
|
1880
1884
|
}
|
|
1881
1885
|
if (ne.current === _ && (ne.current = null, Se.current = void 0, _ && re(_)), kt(), !u()) return;
|
|
1882
|
-
|
|
1886
|
+
L("onCameraDemandChange", ve.current, !1);
|
|
1883
1887
|
return;
|
|
1884
1888
|
}
|
|
1885
|
-
|
|
1889
|
+
L("onCameraDemandChange", ve.current, !0);
|
|
1886
1890
|
const f = ne.current, E = f?.getVideoTracks()[0], y = Se.current;
|
|
1887
1891
|
if (E?.readyState === "live" && y && !yo(y, e)) {
|
|
1888
1892
|
Se.current = e, Ir(i, E), Yr();
|
|
@@ -1900,7 +1904,7 @@ const jo = xn(
|
|
|
1900
1904
|
if (console.warn(
|
|
1901
1905
|
"[RemoteControl] navigator.mediaDevices.getUserMedia unavailable. getUserMedia requires a secure context (https or http://localhost). Replying cameraResult granted=false so limulator falls back to black frames."
|
|
1902
1906
|
), !u()) return;
|
|
1903
|
-
i.send(JSON.stringify({ type: "cameraResult", granted: !1 })),
|
|
1907
|
+
i.send(JSON.stringify({ type: "cameraResult", granted: !1 })), L("onCameraDemandChange", ve.current, !0, !1);
|
|
1904
1908
|
return;
|
|
1905
1909
|
}
|
|
1906
1910
|
let h = null;
|
|
@@ -1917,13 +1921,13 @@ const jo = xn(
|
|
|
1917
1921
|
return;
|
|
1918
1922
|
}
|
|
1919
1923
|
if (!h) {
|
|
1920
|
-
i.send(JSON.stringify({ type: "cameraResult", granted: !1 })),
|
|
1924
|
+
i.send(JSON.stringify({ type: "cameraResult", granted: !1 })), L("onCameraDemandChange", ve.current, !0, !1);
|
|
1921
1925
|
return;
|
|
1922
1926
|
}
|
|
1923
1927
|
const R = h.getVideoTracks()[0] ?? null;
|
|
1924
1928
|
if (!R) {
|
|
1925
1929
|
if (re(h), !u()) return;
|
|
1926
|
-
i.send(JSON.stringify({ type: "cameraResult", granted: !1 })),
|
|
1930
|
+
i.send(JSON.stringify({ type: "cameraResult", granted: !1 })), L("onCameraDemandChange", ve.current, !0, !1);
|
|
1927
1931
|
return;
|
|
1928
1932
|
}
|
|
1929
1933
|
try {
|
|
@@ -1934,7 +1938,7 @@ const jo = xn(
|
|
|
1934
1938
|
await o.replaceTrack(R);
|
|
1935
1939
|
} catch (_) {
|
|
1936
1940
|
if (A("replaceTrack(videoTrack) failed:", _), re(h), !u()) return;
|
|
1937
|
-
i.send(JSON.stringify({ type: "cameraResult", granted: !1 })),
|
|
1941
|
+
i.send(JSON.stringify({ type: "cameraResult", granted: !1 })), L("onCameraDemandChange", ve.current, !0, !1);
|
|
1938
1942
|
return;
|
|
1939
1943
|
}
|
|
1940
1944
|
if (!u()) {
|
|
@@ -1963,13 +1967,13 @@ const jo = xn(
|
|
|
1963
1967
|
}
|
|
1964
1968
|
ne.current = h, Se.current = e, R.onended = () => {
|
|
1965
1969
|
ne.current === h && Vt.enqueueCurrent(async ({ isCurrent: _ }) => {
|
|
1966
|
-
if (!(!_() || ne.current !== h || !n() ||
|
|
1970
|
+
if (!(!_() || ne.current !== h || !n() || D.current !== i || be.current !== o)) {
|
|
1967
1971
|
try {
|
|
1968
1972
|
await o.replaceTrack(null);
|
|
1969
1973
|
} catch (N) {
|
|
1970
1974
|
A("replaceTrack(null) after camera ended failed:", N);
|
|
1971
1975
|
}
|
|
1972
|
-
!_() || ne.current !== h || !n() ||
|
|
1976
|
+
!_() || ne.current !== h || !n() || D.current !== i || be.current !== o || (ne.current = null, Se.current = void 0, re(h), kt(), i.send(JSON.stringify({ type: "cameraResult", granted: !1 })), L("onCameraDemandChange", ve.current, !0, !1));
|
|
1973
1977
|
}
|
|
1974
1978
|
}).catch((_) => A("camera ended cleanup failed:", _));
|
|
1975
1979
|
}, u() && (Ir(i, R), Yr());
|
|
@@ -1978,9 +1982,9 @@ const jo = xn(
|
|
|
1978
1982
|
rt.current.clear();
|
|
1979
1983
|
for (const e of Le.current.values())
|
|
1980
1984
|
clearTimeout(e.timer), e.reject(new Error("Simulator disconnected"));
|
|
1981
|
-
Le.current.clear(), ar(null), nt.current && (nt.current.srcObject = null), Yt(), Et(), mt(), te.current && (te.current.stop(), te.current = null), Vt.invalidate(), kt(),
|
|
1985
|
+
Le.current.clear(), ar(null), nt.current && (nt.current.srcObject = null), Yt(), Et(), mt(), te.current && (te.current.stop(), te.current = null), Vt.invalidate(), kt(), wn(), Se.current = void 0, be.current = null, ++wt.current, Jt.current = !1, He.current = null, he.current && (re(he.current), he.current = null, L("onMicrophoneStateChange", st.current, {
|
|
1982
1986
|
active: !1
|
|
1983
|
-
})), at.current = null, ae.current !== void 0 && (window.cancelAnimationFrame(ae.current), ae.current = void 0),
|
|
1987
|
+
})), at.current = null, ae.current !== void 0 && (window.cancelAnimationFrame(ae.current), ae.current = void 0), D.current && (D.current.onopen = null, D.current.onmessage = null, D.current.onerror = null, D.current.onclose = null, D.current.close(), D.current = null), Ct.current?.close(), Ct.current = null, x.current && (x.current.onconnectionstatechange = null, x.current.oniceconnectionstatechange = null, x.current.ontrack = null, x.current.onicecandidate = null, x.current.close(), x.current = null), W.current && (W.current.srcObject = null), U.current && (U.current.onopen = null, U.current.onclose = null, U.current.onerror = null, U.current.close(), U.current = null);
|
|
1984
1988
|
}, Kr = () => {
|
|
1985
1989
|
document.hidden ? Mr() : Sr();
|
|
1986
1990
|
}, Mn = async () => {
|
|
@@ -2002,7 +2006,7 @@ const jo = xn(
|
|
|
2002
2006
|
window.clearTimeout(o);
|
|
2003
2007
|
}
|
|
2004
2008
|
}, Rn = () => {
|
|
2005
|
-
xe.current || (xe.current = !0, dr(!0), yt(!1), Ae.current += 1, It(), Yt(), Et(), Ze(),
|
|
2009
|
+
xe.current || (xe.current = !0, dr(!0), yt(!1), Ae.current += 1, It(), Yt(), Et(), Ze(), k("Instance terminated"), Ge("terminated"), L("onTerminated", Or.current));
|
|
2006
2010
|
}, Nn = () => {
|
|
2007
2011
|
xe.current || Xt.current || (Xt.current = !0, Mn().then((e) => {
|
|
2008
2012
|
Xt.current = !1, e && Rn();
|
|
@@ -2012,18 +2016,18 @@ const jo = xn(
|
|
|
2012
2016
|
return;
|
|
2013
2017
|
if (Nn(), Ce.current) {
|
|
2014
2018
|
if (!qt.current) {
|
|
2015
|
-
|
|
2019
|
+
k(`Connection failed after it was established: ${e}`), yt(!0), Ge("failed"), Ze();
|
|
2016
2020
|
return;
|
|
2017
2021
|
}
|
|
2018
|
-
|
|
2022
|
+
k(`Reconnecting after established session dropped: ${e}`), Ce.current = !1, Ot.current = -1;
|
|
2019
2023
|
}
|
|
2020
2024
|
It();
|
|
2021
2025
|
const o = Ot.current + 1;
|
|
2022
2026
|
if (o >= ir) {
|
|
2023
|
-
|
|
2027
|
+
k(`Connection failed after ${ir} attempts: ${e}`), yt(!0), Ge("failed"), Ze();
|
|
2024
2028
|
return;
|
|
2025
2029
|
}
|
|
2026
|
-
|
|
2030
|
+
k(`Retrying connection (${o + 1}/${ir})`), Ge("reconnecting"), Ze(), ot.current = window.setTimeout(() => {
|
|
2027
2031
|
ot.current = void 0, i === Ae.current && kr(o);
|
|
2028
2032
|
}, No);
|
|
2029
2033
|
}, kr = async (e = 0) => {
|
|
@@ -2036,47 +2040,47 @@ const jo = xn(
|
|
|
2036
2040
|
}, Io);
|
|
2037
2041
|
try {
|
|
2038
2042
|
const n = new WebSocket(Fr(t, c));
|
|
2039
|
-
if (
|
|
2043
|
+
if (D.current = n, await new Promise((T, d) => {
|
|
2040
2044
|
let Y = !1;
|
|
2041
2045
|
const Q = window.setTimeout(() => d(new Error("WebSocket connection timeout")), 3e4), b = (I) => {
|
|
2042
2046
|
Y || (Y = !0, window.clearTimeout(Q), I());
|
|
2043
2047
|
};
|
|
2044
2048
|
n.onopen = () => {
|
|
2045
|
-
!o() ||
|
|
2049
|
+
!o() || D.current !== n || b(T);
|
|
2046
2050
|
}, n.onerror = (I) => {
|
|
2047
|
-
!o() ||
|
|
2051
|
+
!o() || D.current !== n || (k("WebSocket error: " + I), b(() => d(new Error("WebSocket connection failed"))));
|
|
2048
2052
|
}, n.onclose = () => {
|
|
2049
|
-
!o() ||
|
|
2053
|
+
!o() || D.current !== n || (k("WebSocket closed"), b(() => d(new Error("WebSocket closed before connection was established"))));
|
|
2050
2054
|
};
|
|
2051
|
-
}), !o() ||
|
|
2055
|
+
}), !o() || D.current !== n)
|
|
2052
2056
|
return;
|
|
2053
|
-
n.onerror = (
|
|
2054
|
-
!o() ||
|
|
2057
|
+
n.onerror = (T) => {
|
|
2058
|
+
!o() || D.current !== n || k("WebSocket error: " + T);
|
|
2055
2059
|
}, n.onclose = () => {
|
|
2056
|
-
!o() ||
|
|
2060
|
+
!o() || D.current !== n || k("WebSocket closed");
|
|
2057
2061
|
};
|
|
2058
|
-
const l = new Promise((
|
|
2062
|
+
const l = new Promise((T, d) => {
|
|
2059
2063
|
const Y = (I) => {
|
|
2060
2064
|
window.clearTimeout(Q), n.removeEventListener("message", b), I();
|
|
2061
2065
|
}, Q = window.setTimeout(
|
|
2062
2066
|
() => Y(() => d(new Error("RTCConfiguration timeout"))),
|
|
2063
2067
|
3e4
|
|
2064
2068
|
), b = (I) => {
|
|
2065
|
-
if (!(!o() ||
|
|
2069
|
+
if (!(!o() || D.current !== n))
|
|
2066
2070
|
try {
|
|
2067
|
-
const
|
|
2068
|
-
if (
|
|
2069
|
-
const ie = typeof
|
|
2071
|
+
const V = JSON.parse(I.data);
|
|
2072
|
+
if (V.type === "signalingError" && V.requestType === "requestRtcConfiguration" && V.sessionId === le) {
|
|
2073
|
+
const ie = typeof V.error == "string" ? V.error : "Unable to load streaming configuration";
|
|
2070
2074
|
Y(() => d(new Error(ie)));
|
|
2071
|
-
} else
|
|
2072
|
-
() =>
|
|
2073
|
-
rtcConfiguration:
|
|
2074
|
-
cameraSupported:
|
|
2075
|
-
foldSupported:
|
|
2075
|
+
} else V.type === "rtcConfiguration" && Y(
|
|
2076
|
+
() => T({
|
|
2077
|
+
rtcConfiguration: V.rtcConfiguration,
|
|
2078
|
+
cameraSupported: V.cameraSupported === !0,
|
|
2079
|
+
foldSupported: V.foldSupported === !0
|
|
2076
2080
|
})
|
|
2077
2081
|
);
|
|
2078
|
-
} catch (
|
|
2079
|
-
console.error("Error handling RTC configuration:",
|
|
2082
|
+
} catch (V) {
|
|
2083
|
+
console.error("Error handling RTC configuration:", V), Y(() => d(V));
|
|
2080
2084
|
}
|
|
2081
2085
|
};
|
|
2082
2086
|
n.addEventListener("message", b), n.send(
|
|
@@ -2090,13 +2094,13 @@ const jo = xn(
|
|
|
2090
2094
|
cameraSupported: f,
|
|
2091
2095
|
foldSupported: E
|
|
2092
2096
|
} = await l;
|
|
2093
|
-
if (!o() ||
|
|
2097
|
+
if (!o() || D.current !== n)
|
|
2094
2098
|
return;
|
|
2095
2099
|
const y = g === "iphone-duo" || E;
|
|
2096
2100
|
Qr(y);
|
|
2097
2101
|
const h = new RTCPeerConnection({ ...u, iceTransportPolicy: "relay" });
|
|
2098
2102
|
x.current = h, h.addTransceiver("audio", { direction: "recvonly" });
|
|
2099
|
-
const R = h.addTransceiver("video", { direction: "recvonly" }), _ = y ? h.addTransceiver("video", { direction: "recvonly" }) : null, N =
|
|
2103
|
+
const R = h.addTransceiver("video", { direction: "recvonly" }), _ = y ? h.addTransceiver("video", { direction: "recvonly" }) : null, N = pe === "ios" || f, $ = N ? h.addTransceiver("video", {
|
|
2100
2104
|
direction: "sendonly"
|
|
2101
2105
|
}) : null;
|
|
2102
2106
|
be.current = $?.sender ?? null;
|
|
@@ -2104,11 +2108,11 @@ const jo = xn(
|
|
|
2104
2108
|
direction: "sendonly"
|
|
2105
2109
|
}) : null;
|
|
2106
2110
|
if (at.current = oe?.sender ?? null, RTCRtpReceiver.getCapabilities) {
|
|
2107
|
-
const
|
|
2108
|
-
if (
|
|
2109
|
-
const Y =
|
|
2110
|
-
const I = (
|
|
2111
|
-
const ie =
|
|
2111
|
+
const T = RTCRtpReceiver.getCapabilities("video");
|
|
2112
|
+
if (T && T.codecs) {
|
|
2113
|
+
const Y = T.codecs.sort((Q, b) => {
|
|
2114
|
+
const I = (V) => {
|
|
2115
|
+
const ie = V.mimeType.toLowerCase();
|
|
2112
2116
|
return ie.includes("vp9") ? 1 : ie.includes("h265") || ie.includes("hevc") ? 2 : ie.includes("h264") || ie.includes("avc") ? 3 : 4;
|
|
2113
2117
|
};
|
|
2114
2118
|
return I(Q) - I(b);
|
|
@@ -2117,12 +2121,12 @@ const jo = xn(
|
|
|
2117
2121
|
}
|
|
2118
2122
|
}
|
|
2119
2123
|
if ($ && RTCRtpSender.getCapabilities) {
|
|
2120
|
-
const
|
|
2121
|
-
if (
|
|
2124
|
+
const T = RTCRtpSender.getCapabilities("video");
|
|
2125
|
+
if (T && T.codecs) {
|
|
2122
2126
|
const d = /* @__PURE__ */ new Set(["42e01f", "42e028", "640c1f"]), Y = (b) => {
|
|
2123
2127
|
const I = b.mimeType.toLowerCase(), ie = (b.sdpFmtpLine || "").toLowerCase().match(/profile-level-id=([0-9a-f]{6})/), Pn = ie ? ie[1] : "";
|
|
2124
2128
|
return I === "video/h265" || I === "video/hevc" ? 1 : I === "video/h264" && d.has(Pn) ? 2 : I === "video/h264" ? 3 : I === "video/vp9" ? 4 : I === "video/vp8" ? 5 : I === "video/rtx" || I === "video/red" || I === "video/ulpfec" ? 0 : 6;
|
|
2125
|
-
}, Q = [...
|
|
2129
|
+
}, Q = [...T.codecs].sort((b, I) => Y(b) - Y(I));
|
|
2126
2130
|
try {
|
|
2127
2131
|
$.setCodecPreferences(Q), F(
|
|
2128
2132
|
"Outbound camera codec preferences:",
|
|
@@ -2138,48 +2142,48 @@ const jo = xn(
|
|
|
2138
2142
|
negotiated: !0,
|
|
2139
2143
|
id: 1
|
|
2140
2144
|
});
|
|
2141
|
-
|
|
2142
|
-
const z =
|
|
2143
|
-
o() && x.current === h &&
|
|
2145
|
+
U.current = j;
|
|
2146
|
+
const z = !y && Bt.current ? Vn(h, (T) => {
|
|
2147
|
+
o() && x.current === h && L("onTrace", Bt.current, T);
|
|
2144
2148
|
}) : null;
|
|
2145
2149
|
if (Ct.current = z, j.onopen = () => {
|
|
2146
|
-
if (!o() ||
|
|
2150
|
+
if (!o() || U.current !== j || D.current !== n)
|
|
2147
2151
|
return;
|
|
2148
|
-
Ce.current = !0, Yt(),
|
|
2149
|
-
platform:
|
|
2152
|
+
Ce.current = !0, Yt(), k("Control channel opened"), y && n.send(JSON.stringify({ type: "getFoldState", id: "duo-capabilities" })), te.current || (te.current = new po({
|
|
2153
|
+
platform: pe,
|
|
2150
2154
|
baseIntervalMs: ee,
|
|
2151
|
-
maxBackoffMs:
|
|
2155
|
+
maxBackoffMs: B,
|
|
2152
2156
|
androidElementTreeOptions: Ee,
|
|
2153
2157
|
send: (d) => {
|
|
2154
|
-
if (!
|
|
2158
|
+
if (!D.current || D.current.readyState !== WebSocket.OPEN) return !1;
|
|
2155
2159
|
try {
|
|
2156
|
-
return
|
|
2160
|
+
return D.current.send(JSON.stringify(d)), !0;
|
|
2157
2161
|
} catch {
|
|
2158
2162
|
return !1;
|
|
2159
2163
|
}
|
|
2160
2164
|
},
|
|
2161
2165
|
onSnapshot: (d) => {
|
|
2162
2166
|
Er((Y) => Jr(Y, d) ? Y : d), queueMicrotask(() => {
|
|
2163
|
-
|
|
2167
|
+
L("onAxSnapshotChange", Qt.current, d);
|
|
2164
2168
|
});
|
|
2165
2169
|
},
|
|
2166
2170
|
onStatusChange: (d, Y) => {
|
|
2167
|
-
|
|
2171
|
+
L("onAxStatusChange", vr.current, d, Y);
|
|
2168
2172
|
}
|
|
2169
2173
|
}), (Be.current === !0 || Be.current === "hover-only") && te.current.start());
|
|
2170
|
-
const
|
|
2171
|
-
!o() || ut.current ||
|
|
2174
|
+
const T = () => {
|
|
2175
|
+
!o() || ut.current || U.current !== j || D.current !== n || n.readyState !== WebSocket.OPEN || n.send(JSON.stringify({ type: "requestFrame", sessionId: le }));
|
|
2172
2176
|
};
|
|
2173
|
-
if (
|
|
2174
|
-
if (!o() || ut.current ||
|
|
2177
|
+
if (T(), mt(), vt.current = window.setInterval(() => {
|
|
2178
|
+
if (!o() || ut.current || U.current !== j || D.current !== n || n.readyState !== WebSocket.OPEN) {
|
|
2175
2179
|
mt();
|
|
2176
2180
|
return;
|
|
2177
2181
|
}
|
|
2178
|
-
|
|
2182
|
+
T();
|
|
2179
2183
|
}, 250), m) {
|
|
2180
2184
|
try {
|
|
2181
2185
|
const d = decodeURIComponent(m);
|
|
2182
|
-
|
|
2186
|
+
k("Opening URL"), n.send(
|
|
2183
2187
|
JSON.stringify({
|
|
2184
2188
|
type: "openUrl",
|
|
2185
2189
|
url: d,
|
|
@@ -2198,63 +2202,63 @@ const jo = xn(
|
|
|
2198
2202
|
te.current?.bumpActivity();
|
|
2199
2203
|
}
|
|
2200
2204
|
}, j.onclose = () => {
|
|
2201
|
-
!o() ||
|
|
2202
|
-
}, j.onerror = (
|
|
2203
|
-
!o() ||
|
|
2205
|
+
!o() || U.current !== j || k("Control channel closed");
|
|
2206
|
+
}, j.onerror = (T) => {
|
|
2207
|
+
!o() || U.current !== j || (console.error("Control channel error:", T), k("Control channel error: " + T));
|
|
2204
2208
|
}, h.onconnectionstatechange = () => {
|
|
2205
|
-
!o() || x.current !== h || (
|
|
2209
|
+
!o() || x.current !== h || (k("Connection state: " + h.connectionState), h.connectionState === "failed" && Ce.current && et("WebRTC connection entered failed state", i));
|
|
2206
2210
|
}, h.oniceconnectionstatechange = () => {
|
|
2207
2211
|
if (!o() || x.current !== h)
|
|
2208
2212
|
return;
|
|
2209
|
-
const
|
|
2210
|
-
if (
|
|
2211
|
-
Et(), tr() && !
|
|
2213
|
+
const T = h.iceConnectionState;
|
|
2214
|
+
if (k("ICE state: " + T), T === "connected" || T === "completed") {
|
|
2215
|
+
Et(), tr() && !he.current && rr();
|
|
2212
2216
|
return;
|
|
2213
2217
|
}
|
|
2214
|
-
if (
|
|
2218
|
+
if (T === "failed") {
|
|
2215
2219
|
Et(), Ce.current && et("ICE connection entered failed state", i);
|
|
2216
2220
|
return;
|
|
2217
2221
|
}
|
|
2218
|
-
|
|
2222
|
+
T === "disconnected" && Ce.current && qt.current && We.current === void 0 && (We.current = window.setTimeout(() => {
|
|
2219
2223
|
We.current = void 0, !(!o() || x.current !== h) && h.iceConnectionState === "disconnected" && et("ICE stayed disconnected past grace period", i);
|
|
2220
2224
|
}, Yo));
|
|
2221
|
-
}, h.ontrack = (
|
|
2222
|
-
if (!(!o() || x.current !== h) && (
|
|
2223
|
-
F(`[${(/* @__PURE__ */ new Date()).toISOString()}] Video track received:`,
|
|
2224
|
-
const Y =
|
|
2225
|
+
}, h.ontrack = (T) => {
|
|
2226
|
+
if (!(!o() || x.current !== h) && (k("Received remote track: " + T.track.kind), T.track.kind === "video" && W.current)) {
|
|
2227
|
+
F(`[${(/* @__PURE__ */ new Date()).toISOString()}] Video track received:`, T.track);
|
|
2228
|
+
const Y = T.track.id === "duo-inner" || T.streams.some((Q) => Q.id === "duo-inner") ? nt.current : W.current;
|
|
2225
2229
|
if (Y) {
|
|
2226
|
-
const Q = y ? new MediaStream([
|
|
2230
|
+
const Q = y ? new MediaStream([T.track]) : T.streams[0] ?? new MediaStream([T.track]);
|
|
2227
2231
|
rt.current.get(Y)?.(), rt.current.set(
|
|
2228
2232
|
Y,
|
|
2229
2233
|
qn(Y, Q, (b) => A("Video playback fallback:", b))
|
|
2230
2234
|
);
|
|
2231
2235
|
}
|
|
2232
2236
|
}
|
|
2233
|
-
}, h.onicecandidate = (
|
|
2234
|
-
if (!(!o() || x.current !== h ||
|
|
2235
|
-
if (
|
|
2237
|
+
}, h.onicecandidate = (T) => {
|
|
2238
|
+
if (!(!o() || x.current !== h || D.current !== n))
|
|
2239
|
+
if (T.candidate && n.readyState === WebSocket.OPEN) {
|
|
2236
2240
|
const d = {
|
|
2237
2241
|
type: "candidate",
|
|
2238
|
-
candidate:
|
|
2239
|
-
sdpMid:
|
|
2240
|
-
sdpMLineIndex:
|
|
2242
|
+
candidate: T.candidate.candidate,
|
|
2243
|
+
sdpMid: T.candidate.sdpMid,
|
|
2244
|
+
sdpMLineIndex: T.candidate.sdpMLineIndex,
|
|
2241
2245
|
sessionId: le
|
|
2242
2246
|
};
|
|
2243
|
-
n.send(JSON.stringify(d)),
|
|
2247
|
+
n.send(JSON.stringify(d)), k("Sent ICE candidate");
|
|
2244
2248
|
} else
|
|
2245
|
-
|
|
2246
|
-
}, n.onmessage = async (
|
|
2247
|
-
if (!o() ||
|
|
2249
|
+
k("ICE candidate gathering completed");
|
|
2250
|
+
}, n.onmessage = async (T) => {
|
|
2251
|
+
if (!o() || D.current !== n)
|
|
2248
2252
|
return;
|
|
2249
2253
|
let d;
|
|
2250
2254
|
try {
|
|
2251
|
-
d = JSON.parse(
|
|
2255
|
+
d = JSON.parse(T.data);
|
|
2252
2256
|
} catch (Y) {
|
|
2253
2257
|
A("Error parsing message:", Y);
|
|
2254
2258
|
return;
|
|
2255
2259
|
}
|
|
2256
2260
|
if (!te.current?.handleMessage(d))
|
|
2257
|
-
switch (
|
|
2261
|
+
switch (k("Received: " + d.type), d.type) {
|
|
2258
2262
|
case "performActionsResult":
|
|
2259
2263
|
case "foldStateResult":
|
|
2260
2264
|
case "foldStateChanged": {
|
|
@@ -2268,12 +2272,12 @@ const jo = xn(
|
|
|
2268
2272
|
if (d.requestType !== "offer" || d.sessionId !== le)
|
|
2269
2273
|
break;
|
|
2270
2274
|
const b = typeof d.error == "string" ? d.error : "Unable to establish the streaming connection";
|
|
2271
|
-
|
|
2275
|
+
k("Error: " + b), et(b, i);
|
|
2272
2276
|
break;
|
|
2273
2277
|
}
|
|
2274
2278
|
case "answer":
|
|
2275
2279
|
if (!x.current || x.current !== h) {
|
|
2276
|
-
|
|
2280
|
+
k("No peer connection, skipping answer");
|
|
2277
2281
|
break;
|
|
2278
2282
|
}
|
|
2279
2283
|
if (z?.accept(d.latencyTraceVersion), await h.setRemoteDescription(
|
|
@@ -2283,11 +2287,11 @@ const jo = xn(
|
|
|
2283
2287
|
})
|
|
2284
2288
|
), !o() || x.current !== h)
|
|
2285
2289
|
return;
|
|
2286
|
-
|
|
2290
|
+
k("Set remote description");
|
|
2287
2291
|
break;
|
|
2288
2292
|
case "candidate":
|
|
2289
2293
|
if (!x.current || x.current !== h) {
|
|
2290
|
-
|
|
2294
|
+
k("No peer connection, skipping candidate");
|
|
2291
2295
|
break;
|
|
2292
2296
|
}
|
|
2293
2297
|
if (await h.addIceCandidate(
|
|
@@ -2298,7 +2302,7 @@ const jo = xn(
|
|
|
2298
2302
|
})
|
|
2299
2303
|
), !o() || x.current !== h)
|
|
2300
2304
|
return;
|
|
2301
|
-
|
|
2305
|
+
k("Added ICE candidate");
|
|
2302
2306
|
break;
|
|
2303
2307
|
case "screenshot":
|
|
2304
2308
|
case "screenshotResult": {
|
|
@@ -2313,7 +2317,7 @@ const jo = xn(
|
|
|
2313
2317
|
A(`Received screenshot error for unknown or handled id: ${d.id}`);
|
|
2314
2318
|
break;
|
|
2315
2319
|
}
|
|
2316
|
-
A(`Received screenshot error for id ${d.id}: ${b}`), ie(new Error(b)),
|
|
2320
|
+
A(`Received screenshot error for id ${d.id}: ${b}`), ie(new Error(b)), Te.current.delete(d.id), Oe.current.delete(d.id);
|
|
2317
2321
|
break;
|
|
2318
2322
|
}
|
|
2319
2323
|
const I = xo(d);
|
|
@@ -2321,12 +2325,12 @@ const jo = xn(
|
|
|
2321
2325
|
A("Received screenshot message without image data:", d);
|
|
2322
2326
|
break;
|
|
2323
2327
|
}
|
|
2324
|
-
const
|
|
2325
|
-
if (!
|
|
2328
|
+
const V = Te.current.get(d.id);
|
|
2329
|
+
if (!V) {
|
|
2326
2330
|
A(`Received screenshot data for unknown or handled id: ${d.id}`);
|
|
2327
2331
|
break;
|
|
2328
2332
|
}
|
|
2329
|
-
F(`Received screenshot data for id ${d.id}`),
|
|
2333
|
+
F(`Received screenshot data for id ${d.id}`), V(I), Te.current.delete(d.id), Oe.current.delete(d.id);
|
|
2330
2334
|
break;
|
|
2331
2335
|
}
|
|
2332
2336
|
case "screenshotError":
|
|
@@ -2339,7 +2343,7 @@ const jo = xn(
|
|
|
2339
2343
|
A(`Received screenshot error for unknown or handled id: ${d.id}`);
|
|
2340
2344
|
break;
|
|
2341
2345
|
}
|
|
2342
|
-
A(`Received screenshot error for id ${d.id}: ${d.message}`), Y(new Error(d.message)),
|
|
2346
|
+
A(`Received screenshot error for id ${d.id}: ${d.message}`), Y(new Error(d.message)), Te.current.delete(d.id), Oe.current.delete(d.id);
|
|
2343
2347
|
break;
|
|
2344
2348
|
case "cameraRequest": {
|
|
2345
2349
|
const b = be.current;
|
|
@@ -2361,7 +2365,7 @@ const jo = xn(
|
|
|
2361
2365
|
Gt.current || await Kt();
|
|
2362
2366
|
break;
|
|
2363
2367
|
}
|
|
2364
|
-
if (
|
|
2368
|
+
if (he.current) {
|
|
2365
2369
|
Nr(n);
|
|
2366
2370
|
break;
|
|
2367
2371
|
}
|
|
@@ -2400,32 +2404,32 @@ const jo = xn(
|
|
|
2400
2404
|
break;
|
|
2401
2405
|
}
|
|
2402
2406
|
}, x.current === h) {
|
|
2403
|
-
const
|
|
2407
|
+
const T = await h.createOffer({
|
|
2404
2408
|
offerToReceiveVideo: !0,
|
|
2405
2409
|
offerToReceiveAudio: !1
|
|
2406
2410
|
});
|
|
2407
|
-
if (!o() || x.current !== h || (await h.setLocalDescription(
|
|
2411
|
+
if (!o() || x.current !== h || (await h.setLocalDescription(T), !o() || x.current !== h))
|
|
2408
2412
|
return;
|
|
2409
|
-
o() &&
|
|
2413
|
+
o() && D.current === n && n.readyState === WebSocket.OPEN && n.send(
|
|
2410
2414
|
JSON.stringify({
|
|
2411
2415
|
type: "offer",
|
|
2412
2416
|
...y ? { displayStreams: !0 } : {},
|
|
2413
2417
|
...z ? { latencyTraceVersion: 1 } : {},
|
|
2414
|
-
sdp:
|
|
2418
|
+
sdp: T.sdp,
|
|
2415
2419
|
sessionId: le
|
|
2416
2420
|
})
|
|
2417
|
-
),
|
|
2421
|
+
), k("Sent offer");
|
|
2418
2422
|
}
|
|
2419
2423
|
} catch (n) {
|
|
2420
2424
|
if (!o())
|
|
2421
2425
|
return;
|
|
2422
2426
|
const l = n instanceof Error ? n.message : String(n);
|
|
2423
|
-
|
|
2427
|
+
k("Error: " + l), et(l, i);
|
|
2424
2428
|
}
|
|
2425
2429
|
}, nr = () => {
|
|
2426
2430
|
xe.current = !1, dr(!1), kr(0);
|
|
2427
2431
|
}, In = () => {
|
|
2428
|
-
Ae.current += 1, Ot.current = 0, Ce.current = !1, It(), Et(), Ze(),
|
|
2432
|
+
Ae.current += 1, Ot.current = 0, Ce.current = !1, It(), Et(), Ze(), k("Stopped");
|
|
2429
2433
|
}, Yn = (e) => {
|
|
2430
2434
|
e.stopPropagation(), nr();
|
|
2431
2435
|
};
|
|
@@ -2462,7 +2466,7 @@ const jo = xn(
|
|
|
2462
2466
|
if (f === 0 || E === 0) return;
|
|
2463
2467
|
const y = e.videoWidth > e.videoHeight;
|
|
2464
2468
|
rn(y), on(
|
|
2465
|
-
|
|
2469
|
+
pe === "android" && ko(e.videoWidth, e.videoHeight)
|
|
2466
2470
|
);
|
|
2467
2471
|
const h = y ? Je.videoPosition.landscape : Je.videoPosition.portrait;
|
|
2468
2472
|
let R = {};
|
|
@@ -2477,13 +2481,13 @@ const jo = xn(
|
|
|
2477
2481
|
};
|
|
2478
2482
|
}, [Je, St]), me(() => {
|
|
2479
2483
|
const e = te.current;
|
|
2480
|
-
ft ? e?.start() : (e?.stop(), Er(null), dt(null), At(null), yr(null), Xe(null), bt.current = null, ae.current !== void 0 && (window.cancelAnimationFrame(ae.current), ae.current = void 0),
|
|
2484
|
+
ft ? e?.start() : (e?.stop(), Er(null), dt(null), At(null), yr(null), Xe(null), bt.current = null, ae.current !== void 0 && (window.cancelAnimationFrame(ae.current), ae.current = void 0), L("onAxSnapshotChange", Qt.current, null));
|
|
2481
2485
|
}, [ft]), me(() => () => {
|
|
2482
2486
|
ae.current !== void 0 && (window.cancelAnimationFrame(ae.current), ae.current = void 0);
|
|
2483
2487
|
}, []), me(() => {
|
|
2484
2488
|
if (!ft) return;
|
|
2485
2489
|
const e = (i) => {
|
|
2486
|
-
i.key === "Escape" && (zt || jt) && (At(null), dt(null), Xe(null),
|
|
2490
|
+
i.key === "Escape" && (zt || jt) && (At(null), dt(null), Xe(null), L("onInspectSelectionChange", Ve.current, null));
|
|
2487
2491
|
};
|
|
2488
2492
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
2489
2493
|
}, [ft, zt, jt]);
|
|
@@ -2492,13 +2496,13 @@ const jo = xn(
|
|
|
2492
2496
|
};
|
|
2493
2497
|
Fn(Ue, () => ({
|
|
2494
2498
|
openUrl: (e) => {
|
|
2495
|
-
if (!
|
|
2499
|
+
if (!D.current || D.current.readyState !== WebSocket.OPEN) {
|
|
2496
2500
|
A("WebSocket not open, cannot send open_url command via ref.");
|
|
2497
2501
|
return;
|
|
2498
2502
|
}
|
|
2499
2503
|
try {
|
|
2500
2504
|
const i = decodeURIComponent(e);
|
|
2501
|
-
|
|
2505
|
+
k("Opening URL"), D.current.send(
|
|
2502
2506
|
JSON.stringify({
|
|
2503
2507
|
type: "openUrl",
|
|
2504
2508
|
url: i,
|
|
@@ -2506,7 +2510,7 @@ const jo = xn(
|
|
|
2506
2510
|
})
|
|
2507
2511
|
);
|
|
2508
2512
|
} catch (i) {
|
|
2509
|
-
A("Error decoding or sending URL via ref:", { error: i, url: e }),
|
|
2513
|
+
A("Error decoding or sending URL via ref:", { error: i, url: e }), D.current.send(
|
|
2510
2514
|
JSON.stringify({
|
|
2511
2515
|
type: "openUrl",
|
|
2512
2516
|
url: e,
|
|
@@ -2517,8 +2521,8 @@ const jo = xn(
|
|
|
2517
2521
|
te.current?.bumpActivity();
|
|
2518
2522
|
},
|
|
2519
2523
|
sendKeyEvent: (e) => {
|
|
2520
|
-
if (!
|
|
2521
|
-
A("Data channel not ready for imperative key command:",
|
|
2524
|
+
if (!U.current || U.current.readyState !== "open") {
|
|
2525
|
+
A("Data channel not ready for imperative key command:", U.current?.readyState);
|
|
2522
2526
|
return;
|
|
2523
2527
|
}
|
|
2524
2528
|
const i = Br[e.code];
|
|
@@ -2539,29 +2543,29 @@ const jo = xn(
|
|
|
2539
2543
|
// repeat count, typically 0 for single presses
|
|
2540
2544
|
o
|
|
2541
2545
|
);
|
|
2542
|
-
l &&
|
|
2546
|
+
l && de(l);
|
|
2543
2547
|
},
|
|
2544
2548
|
screenshot: (e) => new Promise((i, o) => {
|
|
2545
|
-
if (!
|
|
2549
|
+
if (!D.current || D.current.readyState !== WebSocket.OPEN)
|
|
2546
2550
|
return A("WebSocket not open, cannot send screenshot command."), o(new Error("WebSocket is not connected or connection is not open."));
|
|
2547
2551
|
const n = `ui-ss-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`, l = {
|
|
2548
2552
|
type: e ? "screenshotDisplay" : "screenshot",
|
|
2549
2553
|
...e ? { display: e } : {},
|
|
2550
2554
|
id: n
|
|
2551
2555
|
};
|
|
2552
|
-
|
|
2556
|
+
Te.current.set(n, i), Oe.current.set(n, o), F("Sending screenshot request:", l);
|
|
2553
2557
|
try {
|
|
2554
|
-
|
|
2558
|
+
D.current.send(JSON.stringify(l));
|
|
2555
2559
|
} catch (u) {
|
|
2556
|
-
A("Failed to send screenshot request immediately:", u),
|
|
2560
|
+
A("Failed to send screenshot request immediately:", u), Te.current.delete(n), Oe.current.delete(n), o(u);
|
|
2557
2561
|
return;
|
|
2558
2562
|
}
|
|
2559
2563
|
setTimeout(() => {
|
|
2560
|
-
|
|
2564
|
+
Te.current.has(n) && (A(`Screenshot request timed out for id ${n}`), Oe.current.get(n)?.(new Error("Screenshot request timed out")), Te.current.delete(n), Oe.current.delete(n));
|
|
2561
2565
|
}, 3e4);
|
|
2562
2566
|
}),
|
|
2563
2567
|
terminateApp: (e) => new Promise((i, o) => {
|
|
2564
|
-
if (!
|
|
2568
|
+
if (!D.current || D.current.readyState !== WebSocket.OPEN)
|
|
2565
2569
|
return A("WebSocket not open, cannot send terminateApp command."), o(new Error("WebSocket is not connected or connection is not open."));
|
|
2566
2570
|
const n = `ui-term-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`, l = {
|
|
2567
2571
|
type: "terminateApp",
|
|
@@ -2570,7 +2574,7 @@ const jo = xn(
|
|
|
2570
2574
|
};
|
|
2571
2575
|
Me.current.set(n, i), Re.current.set(n, o), F("Sending terminateApp request:", l);
|
|
2572
2576
|
try {
|
|
2573
|
-
|
|
2577
|
+
D.current.send(JSON.stringify(l));
|
|
2574
2578
|
} catch (u) {
|
|
2575
2579
|
A("Failed to send terminateApp request immediately:", u), Me.current.delete(n), Re.current.delete(n), o(u);
|
|
2576
2580
|
return;
|
|
@@ -2593,7 +2597,7 @@ const jo = xn(
|
|
|
2593
2597
|
setInspectSelection: (e) => {
|
|
2594
2598
|
At(e?.id ?? null), Xe(e ? bt.current : null);
|
|
2595
2599
|
const i = qe.current;
|
|
2596
|
-
e && i ?
|
|
2600
|
+
e && i ? L("onInspectSelectionChange", Ve.current, { element: e, snapshot: i }) : L("onInspectSelectionChange", Ve.current, null);
|
|
2597
2601
|
},
|
|
2598
2602
|
getAxStatus: () => te.current?.getStatus() ?? "idle"
|
|
2599
2603
|
}));
|
|
@@ -2604,17 +2608,17 @@ const jo = xn(
|
|
|
2604
2608
|
ref: _e,
|
|
2605
2609
|
className: Pe("rc-container", r),
|
|
2606
2610
|
style: { touchAction: "none" },
|
|
2607
|
-
onMouseDown:
|
|
2608
|
-
onMouseMove:
|
|
2609
|
-
onMouseUp:
|
|
2610
|
-
onMouseLeave:
|
|
2611
|
-
onTouchStart:
|
|
2612
|
-
onTouchMove:
|
|
2613
|
-
onTouchEnd:
|
|
2614
|
-
onTouchCancel:
|
|
2611
|
+
onMouseDown: we,
|
|
2612
|
+
onMouseMove: we,
|
|
2613
|
+
onMouseUp: we,
|
|
2614
|
+
onMouseLeave: we,
|
|
2615
|
+
onTouchStart: we,
|
|
2616
|
+
onTouchMove: we,
|
|
2617
|
+
onTouchEnd: we,
|
|
2618
|
+
onTouchCancel: we,
|
|
2615
2619
|
children: [
|
|
2616
2620
|
kn && Ie && /* @__PURE__ */ ue($r, { children: [
|
|
2617
|
-
/* @__PURE__ */
|
|
2621
|
+
/* @__PURE__ */ P(
|
|
2618
2622
|
"div",
|
|
2619
2623
|
{
|
|
2620
2624
|
className: "rc-touch-indicator",
|
|
@@ -2624,7 +2628,7 @@ const jo = xn(
|
|
|
2624
2628
|
}
|
|
2625
2629
|
}
|
|
2626
2630
|
),
|
|
2627
|
-
/* @__PURE__ */
|
|
2631
|
+
/* @__PURE__ */ P(
|
|
2628
2632
|
"div",
|
|
2629
2633
|
{
|
|
2630
2634
|
className: "rc-touch-indicator",
|
|
@@ -2635,17 +2639,17 @@ const jo = xn(
|
|
|
2635
2639
|
}
|
|
2636
2640
|
)
|
|
2637
2641
|
] }),
|
|
2638
|
-
St && /* @__PURE__ */
|
|
2642
|
+
St && /* @__PURE__ */ P(
|
|
2639
2643
|
"img",
|
|
2640
2644
|
{
|
|
2641
2645
|
ref: Ft,
|
|
2642
|
-
src:
|
|
2646
|
+
src: Tr,
|
|
2643
2647
|
alt: "",
|
|
2644
|
-
className:
|
|
2648
|
+
className: pe === "ios" ? Pe("rc-phone-frame", "rc-phone-frame-ios") : "rc-phone-frame",
|
|
2645
2649
|
draggable: !1
|
|
2646
2650
|
}
|
|
2647
2651
|
),
|
|
2648
|
-
/* @__PURE__ */
|
|
2652
|
+
/* @__PURE__ */ P(
|
|
2649
2653
|
"video",
|
|
2650
2654
|
{
|
|
2651
2655
|
ref: W,
|
|
@@ -2657,8 +2661,8 @@ const jo = xn(
|
|
|
2657
2661
|
style: {
|
|
2658
2662
|
...cn,
|
|
2659
2663
|
...ye ? { opacity: 0, width: 1, height: 1, pointerEvents: "none" } : {},
|
|
2660
|
-
...
|
|
2661
|
-
backgroundImage: `url("${
|
|
2664
|
+
...wr ? {
|
|
2665
|
+
backgroundImage: `url("${wr}")`,
|
|
2662
2666
|
backgroundRepeat: "no-repeat",
|
|
2663
2667
|
backgroundPosition: "center",
|
|
2664
2668
|
backgroundSize: Je.loadingLogoSize
|
|
@@ -2671,7 +2675,7 @@ const jo = xn(
|
|
|
2671
2675
|
onKeyDown: Nt,
|
|
2672
2676
|
onKeyUp: Nt,
|
|
2673
2677
|
onClick: Kn,
|
|
2674
|
-
onLoadedData:
|
|
2678
|
+
onLoadedData: Tn,
|
|
2675
2679
|
onFocus: () => {
|
|
2676
2680
|
W.current && (W.current.style.outline = "none");
|
|
2677
2681
|
},
|
|
@@ -2680,7 +2684,7 @@ const jo = xn(
|
|
|
2680
2684
|
}
|
|
2681
2685
|
}
|
|
2682
2686
|
),
|
|
2683
|
-
ye && /* @__PURE__ */
|
|
2687
|
+
ye && /* @__PURE__ */ P(
|
|
2684
2688
|
"video",
|
|
2685
2689
|
{
|
|
2686
2690
|
ref: nt,
|
|
@@ -2690,7 +2694,7 @@ const jo = xn(
|
|
|
2690
2694
|
style: { position: "absolute", width: 1, height: 1, opacity: 0, pointerEvents: "none" }
|
|
2691
2695
|
}
|
|
2692
2696
|
),
|
|
2693
|
-
ye && sr && /* @__PURE__ */
|
|
2697
|
+
ye && sr && /* @__PURE__ */ P(Wn, { fallback: /* @__PURE__ */ P("div", { children: "Loading iPhone Duo…" }), children: /* @__PURE__ */ P(
|
|
2694
2698
|
Mo,
|
|
2695
2699
|
{
|
|
2696
2700
|
showFrame: p,
|
|
@@ -2704,15 +2708,15 @@ const jo = xn(
|
|
|
2704
2708
|
actions: [{ type: i ? "buttonDown" : "buttonUp", button: e }]
|
|
2705
2709
|
}),
|
|
2706
2710
|
touch: (e, i, o, n) => {
|
|
2707
|
-
const l =
|
|
2711
|
+
const l = U.current;
|
|
2708
2712
|
l?.readyState === "open" && l.send(Xn(e, i, o, n));
|
|
2709
2713
|
},
|
|
2710
2714
|
onKeyDown: Nt,
|
|
2711
2715
|
onKeyUp: Nt
|
|
2712
2716
|
}
|
|
2713
2717
|
) }),
|
|
2714
|
-
ye && ur && /* @__PURE__ */
|
|
2715
|
-
!ye && ft && /* @__PURE__ */
|
|
2718
|
+
ye && ur && /* @__PURE__ */ P("div", { role: "alert", className: "rc-duo-error", children: ur }),
|
|
2719
|
+
!ye && ft && /* @__PURE__ */ P(
|
|
2716
2720
|
So,
|
|
2717
2721
|
{
|
|
2718
2722
|
snapshot: mr,
|
|
@@ -2725,10 +2729,10 @@ const jo = xn(
|
|
|
2725
2729
|
onSelectChange: (e, i) => {
|
|
2726
2730
|
At(e?.id ?? null), e && i ? Xe(i) : e || Xe(null);
|
|
2727
2731
|
const o = qe.current;
|
|
2728
|
-
e && o ?
|
|
2732
|
+
e && o ? L("onInspectSelectionChange", Ve.current, {
|
|
2729
2733
|
element: e,
|
|
2730
2734
|
snapshot: o
|
|
2731
|
-
}) :
|
|
2735
|
+
}) : L("onInspectSelectionChange", Ve.current, null);
|
|
2732
2736
|
},
|
|
2733
2737
|
onTapElement: (e, i) => {
|
|
2734
2738
|
if (i) {
|
|
@@ -2741,9 +2745,9 @@ const jo = xn(
|
|
|
2741
2745
|
}
|
|
2742
2746
|
),
|
|
2743
2747
|
tn ? /* @__PURE__ */ ue("div", { className: "rc-terminated", role: "status", children: [
|
|
2744
|
-
/* @__PURE__ */
|
|
2745
|
-
/* @__PURE__ */
|
|
2746
|
-
] }) : en && /* @__PURE__ */
|
|
2748
|
+
/* @__PURE__ */ P("div", { className: "rc-terminated-title", children: "Instance terminated" }),
|
|
2749
|
+
/* @__PURE__ */ P("div", { className: "rc-terminated-message", children: "This instance no longer exists and can't be reconnected." })
|
|
2750
|
+
] }) : en && /* @__PURE__ */ P("button", { type: "button", className: "rc-retry-button", onClick: Yn, children: "Retry" })
|
|
2747
2751
|
]
|
|
2748
2752
|
}
|
|
2749
2753
|
);
|