@limrun/ui 0.20.6 → 0.20.7
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/components/remote-control.d.ts +13 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +32 -24
- package/dist/lite.cjs +1 -1
- package/dist/lite.js +1 -1
- package/dist/{remote-control-VZ7b8hFe.mjs → remote-control-34lVk06k.mjs} +289 -272
- package/dist/remote-control-I_8xmy6Y.js +1 -0
- package/package.json +1 -1
- package/dist/remote-control-CTn0dIkj.js +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as m, jsxs as z, Fragment as
|
|
2
|
-
import { f as
|
|
3
|
-
import { memo as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import './index.css';const
|
|
1
|
+
import { jsx as m, jsxs as z, Fragment as bt } from "react/jsx-runtime";
|
|
2
|
+
import { f as Qt, c as Tt, d as Zt, b as en, h as tn, i as nn, s as Ce, j as on, e as rn, k as X, l as Je, m as cn, o as He, p as O, q as xe, a as sn, r as an, t as g, u as ln } from "./core-BpV73M0K.mjs";
|
|
3
|
+
import { memo as Qe, useState as I, useEffect as F, useMemo as fe, useCallback as dn, lazy as un, forwardRef as hn, useRef as S, useImperativeHandle as fn, Suspense as pn } from "react";
|
|
4
|
+
import { createPortal as mn } from "react-dom";
|
|
5
|
+
import './index.css';const gn = async (d) => {
|
|
6
6
|
if (!d) return !1;
|
|
7
7
|
try {
|
|
8
8
|
if (typeof navigator < "u" && navigator.clipboard?.writeText)
|
|
@@ -17,11 +17,11 @@ import './index.css';const fn = async (d) => {
|
|
|
17
17
|
} catch {
|
|
18
18
|
return !1;
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, vn = Qe(
|
|
21
21
|
function({ element: r, screen: u, highlighted: h, selected: C, selectable: V, onClick: R }) {
|
|
22
|
-
const p =
|
|
22
|
+
const p = Qt(r.frame, u);
|
|
23
23
|
if (!p) return null;
|
|
24
|
-
const U =
|
|
24
|
+
const U = Tt(r);
|
|
25
25
|
return /* @__PURE__ */ m(
|
|
26
26
|
"button",
|
|
27
27
|
{
|
|
@@ -46,8 +46,8 @@ import './index.css';const fn = async (d) => {
|
|
|
46
46
|
}
|
|
47
47
|
);
|
|
48
48
|
},
|
|
49
|
-
(d, r) => d.highlighted === r.highlighted && d.selected === r.selected && d.selectable === r.selectable && d.screen.width === r.screen.width && d.screen.height === r.screen.height && d.onClick === r.onClick &&
|
|
50
|
-
),
|
|
49
|
+
(d, r) => d.highlighted === r.highlighted && d.selected === r.selected && d.selectable === r.selectable && d.screen.width === r.screen.width && d.screen.height === r.screen.height && d.onClick === r.onClick && Zt(d.element, r.element)
|
|
50
|
+
), yn = 260, wn = 220, An = 6, bn = 8, Tn = Qe(function({
|
|
51
51
|
element: r,
|
|
52
52
|
platform: u,
|
|
53
53
|
anchor: h,
|
|
@@ -55,22 +55,22 @@ import './index.css';const fn = async (d) => {
|
|
|
55
55
|
showActions: V,
|
|
56
56
|
onTap: R
|
|
57
57
|
}) {
|
|
58
|
-
const [p, U] =
|
|
58
|
+
const [p, U] = I(null);
|
|
59
59
|
F(() => {
|
|
60
60
|
if (!p) return;
|
|
61
61
|
const b = window.setTimeout(() => U(null), 1100);
|
|
62
62
|
return () => window.clearTimeout(b);
|
|
63
63
|
}, [p]);
|
|
64
64
|
const v = fe(() => {
|
|
65
|
-
const b =
|
|
65
|
+
const b = yn, B = wn, W = An, y = bn, Q = typeof window < "u" ? window.innerWidth : 1024, Ie = typeof window < "u" ? window.innerHeight : 768, j = h.x + W + b <= Q - y, te = h.y - W - B >= y;
|
|
66
66
|
let re = j ? h.x + W : h.x - W, pe = te ? h.y - W : h.y + W;
|
|
67
67
|
const ie = `translate(${j ? "0" : "-100%"}, ${te ? "-100%" : "0"})`;
|
|
68
|
-
return re = Math.max(y + (j ? 0 : b), Math.min(
|
|
69
|
-
}, [h.x, h.y]), _ = fe(() =>
|
|
68
|
+
return re = Math.max(y + (j ? 0 : b), Math.min(Q - y - (j ? b : 0), re)), pe = Math.max(y + (te ? B : 0), Math.min(Ie - y - (te ? 0 : B), pe)), { left: `${re}px`, top: `${pe}px`, transform: ie };
|
|
69
|
+
}, [h.x, h.y]), _ = fe(() => en(r, u), [r, u]), N = u === "ios" ? r.selectors.AXUniqueId : r.selectors.resourceId, L = u === "ios" ? "AXUniqueId" : "resourceId", J = dn(async (b, B) => {
|
|
70
70
|
if (!b) return;
|
|
71
|
-
await
|
|
72
|
-
}, []), ee =
|
|
73
|
-
return
|
|
71
|
+
await gn(b) && U(B);
|
|
72
|
+
}, []), ee = tn(r), $ = r.label || r.value || ee, oe = Tt(r);
|
|
73
|
+
return mn(
|
|
74
74
|
/* @__PURE__ */ z(
|
|
75
75
|
"div",
|
|
76
76
|
{
|
|
@@ -128,7 +128,7 @@ import './index.css';const fn = async (d) => {
|
|
|
128
128
|
className: p === "selector" ? "rc-inspect-card-btn rc-inspect-card-btn-copied" : "rc-inspect-card-btn",
|
|
129
129
|
disabled: !_,
|
|
130
130
|
title: _ ?? "No usable selector for this element",
|
|
131
|
-
onClick: () =>
|
|
131
|
+
onClick: () => J(_ ?? void 0, "selector"),
|
|
132
132
|
children: p === "selector" ? "Copied!" : "Copy selector"
|
|
133
133
|
}
|
|
134
134
|
),
|
|
@@ -139,7 +139,7 @@ import './index.css';const fn = async (d) => {
|
|
|
139
139
|
className: p === "id" ? "rc-inspect-card-btn rc-inspect-card-btn-copied" : "rc-inspect-card-btn",
|
|
140
140
|
disabled: !N,
|
|
141
141
|
title: N ?? `No ${L}`,
|
|
142
|
-
onClick: () =>
|
|
142
|
+
onClick: () => J(N, "id"),
|
|
143
143
|
children: p === "id" ? "Copied!" : `Copy ${L}`
|
|
144
144
|
}
|
|
145
145
|
)
|
|
@@ -149,7 +149,7 @@ import './index.css';const fn = async (d) => {
|
|
|
149
149
|
),
|
|
150
150
|
document.body
|
|
151
151
|
);
|
|
152
|
-
}),
|
|
152
|
+
}), Cn = Qe(function({
|
|
153
153
|
snapshot: r,
|
|
154
154
|
geometry: u,
|
|
155
155
|
highlightedId: h,
|
|
@@ -160,17 +160,17 @@ import './index.css';const fn = async (d) => {
|
|
|
160
160
|
onSelectChange: U,
|
|
161
161
|
onTapElement: v
|
|
162
162
|
}) {
|
|
163
|
-
const _ = V === "select", N = _ ? h !== null && h !== C : h !== null, L = _ ? h ?? C : h,
|
|
163
|
+
const _ = V === "select", N = _ ? h !== null && h !== C : h !== null, L = _ ? h ?? C : h, J = fe(() => {
|
|
164
164
|
const y = /* @__PURE__ */ new Map();
|
|
165
165
|
if (!r) return y;
|
|
166
|
-
for (const
|
|
166
|
+
for (const Q of r.elements) y.set(Q.id, Q);
|
|
167
167
|
return y;
|
|
168
|
-
}, [r]), ee = fe(() => L ?
|
|
168
|
+
}, [r]), ee = fe(() => L ? J.get(L) ?? null : null, [L, J]);
|
|
169
169
|
if (!(!!r && !!u && r.screen.width > 0 && r.screen.height > 0 && r.elements.length > 0)) return null;
|
|
170
170
|
const oe = N ? R : p ?? R, b = N, B = _ && !N && C !== null, W = (y) => {
|
|
171
171
|
_ && y.target === y.currentTarget && U(null, null);
|
|
172
172
|
};
|
|
173
|
-
return /* @__PURE__ */ z(
|
|
173
|
+
return /* @__PURE__ */ z(bt, { children: [
|
|
174
174
|
/* @__PURE__ */ m(
|
|
175
175
|
"div",
|
|
176
176
|
{
|
|
@@ -183,7 +183,7 @@ import './index.css';const fn = async (d) => {
|
|
|
183
183
|
},
|
|
184
184
|
onClick: W,
|
|
185
185
|
children: r.elements.map((y) => /* @__PURE__ */ m(
|
|
186
|
-
|
|
186
|
+
vn,
|
|
187
187
|
{
|
|
188
188
|
element: y,
|
|
189
189
|
screen: r.screen,
|
|
@@ -197,7 +197,7 @@ import './index.css';const fn = async (d) => {
|
|
|
197
197
|
}
|
|
198
198
|
),
|
|
199
199
|
ee && oe && /* @__PURE__ */ m(
|
|
200
|
-
|
|
200
|
+
Tn,
|
|
201
201
|
{
|
|
202
202
|
element: ee,
|
|
203
203
|
platform: r.platform,
|
|
@@ -209,7 +209,7 @@ import './index.css';const fn = async (d) => {
|
|
|
209
209
|
)
|
|
210
210
|
] });
|
|
211
211
|
});
|
|
212
|
-
function
|
|
212
|
+
function Rn(d, r) {
|
|
213
213
|
if (!r.startsWith("lim_st_")) return !1;
|
|
214
214
|
try {
|
|
215
215
|
const u = new URL(d).pathname.split("/").map(decodeURIComponent).find((v) => /^(ios|android)_[a-z0-9_]+$/.test(v));
|
|
@@ -224,8 +224,8 @@ function bn(d, r) {
|
|
|
224
224
|
if (!Array.isArray(p) || !p.every((v) => typeof v == "string")) return !1;
|
|
225
225
|
let U = !1;
|
|
226
226
|
for (const v of p) {
|
|
227
|
-
const [_, N, L,
|
|
228
|
-
if (!(
|
|
227
|
+
const [_, N, L, J] = v.split(":");
|
|
228
|
+
if (!(J !== void 0 || _ !== h && _ !== "*") && !(N !== u && N !== "*")) {
|
|
229
229
|
if (L === "stream" || L === "all") return !1;
|
|
230
230
|
L === "watch" && (U = !0);
|
|
231
231
|
}
|
|
@@ -235,9 +235,9 @@ function bn(d, r) {
|
|
|
235
235
|
return !1;
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
const
|
|
238
|
+
const Nn = un(() => import("./duo-view-DWqQXwdZ.mjs").then((d) => d.d)), Ue = (d) => Object.entries(g).find(
|
|
239
239
|
([u, h]) => u.startsWith("ACTION_") && h === d
|
|
240
|
-
)?.[0] ?? String(d),
|
|
240
|
+
)?.[0] ?? String(d), wt = 1920, At = 1200, En = (d, r) => d === wt && r === At || d === At && r === wt, Mn = {
|
|
241
241
|
ios: {
|
|
242
242
|
videoBorderRadiusMultiplier: 0.15,
|
|
243
243
|
loadingLogoSize: "20%",
|
|
@@ -256,7 +256,24 @@ const Tn = an(() => import("./duo-view-DWqQXwdZ.mjs").then((d) => d.d)), He = (d
|
|
|
256
256
|
landscape: { widthMultiplier: 0.962 }
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
-
},
|
|
259
|
+
}, In = {
|
|
260
|
+
"iphone-se": {
|
|
261
|
+
videoBorderRadiusMultiplier: 0,
|
|
262
|
+
loadingLogoSize: "20%",
|
|
263
|
+
videoPosition: {
|
|
264
|
+
portrait: { heightMultiplier: 667 / 889 },
|
|
265
|
+
landscape: { widthMultiplier: 667 / 889 }
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
"iphone-17e": {
|
|
269
|
+
videoBorderRadiusMultiplier: 47.33 / 452,
|
|
270
|
+
loadingLogoSize: "20%",
|
|
271
|
+
videoPosition: {
|
|
272
|
+
portrait: { heightMultiplier: 844 / 888 },
|
|
273
|
+
landscape: { widthMultiplier: 844 / 888 }
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}, On = {
|
|
260
277
|
videoBorderRadiusMultiplier: 32 / 1837,
|
|
261
278
|
loadingLogoSize: "40%",
|
|
262
279
|
videoPosition: {
|
|
@@ -264,20 +281,20 @@ const Tn = an(() => import("./duo-view-DWqQXwdZ.mjs").then((d) => d.d)), He = (d
|
|
|
264
281
|
landscape: { widthMultiplier: 2560 / 2798 }
|
|
265
282
|
}
|
|
266
283
|
};
|
|
267
|
-
function
|
|
268
|
-
const r = d.code, u =
|
|
284
|
+
function _n(d) {
|
|
285
|
+
const r = d.code, u = an[r];
|
|
269
286
|
if (!u)
|
|
270
|
-
return
|
|
271
|
-
let h =
|
|
287
|
+
return Je(`Unknown event.code: ${r}, key: ${d.key}`), null;
|
|
288
|
+
let h = O.META_NONE;
|
|
272
289
|
const C = r >= "KeyA" && r <= "KeyZ", V = d.getModifierState("CapsLock"), R = d.shiftKey;
|
|
273
290
|
let p = R;
|
|
274
|
-
return C && (p = R !== V), p && (h |=
|
|
291
|
+
return C && (p = R !== V), p && (h |= O.META_SHIFT_ON), d.ctrlKey && (h |= O.META_CTRL_ON), d.altKey && (h |= O.META_ALT_ON), d.metaKey && (h |= O.META_META_ON), { keycode: u, metaState: h };
|
|
275
292
|
}
|
|
276
|
-
function
|
|
293
|
+
function Sn(d, r) {
|
|
277
294
|
const u = Object.keys(d);
|
|
278
295
|
return u.length === Object.keys(r).length && u.every((h) => d[h] === r[h]);
|
|
279
296
|
}
|
|
280
|
-
const
|
|
297
|
+
const Dn = hn(
|
|
281
298
|
({
|
|
282
299
|
className: d,
|
|
283
300
|
url: r,
|
|
@@ -292,7 +309,7 @@ const Pn = ln(
|
|
|
292
309
|
jitterBufferTargetMs: _,
|
|
293
310
|
onPlaybackStats: N,
|
|
294
311
|
onTerminated: L,
|
|
295
|
-
assets:
|
|
312
|
+
assets: J,
|
|
296
313
|
onConnectionStateChange: ee,
|
|
297
314
|
inspectMode: $,
|
|
298
315
|
onAxSnapshotChange: oe,
|
|
@@ -300,39 +317,39 @@ const Pn = ln(
|
|
|
300
317
|
onAxStatusChange: B,
|
|
301
318
|
axPollIntervalMs: W,
|
|
302
319
|
axMaxBackoffMs: y,
|
|
303
|
-
androidElementTreeOptions:
|
|
320
|
+
androidElementTreeOptions: Q,
|
|
304
321
|
onCameraDemandChange: Ie,
|
|
305
322
|
onCameraStats: j,
|
|
306
323
|
onTrace: te,
|
|
307
324
|
microphoneEnabled: re = !1,
|
|
308
325
|
onMicrophoneStateChange: pe
|
|
309
|
-
},
|
|
310
|
-
const
|
|
326
|
+
}, Ze) => {
|
|
327
|
+
const et = fe(() => Rn(r, u), [r, u]), ie = V || et, Oe = S(null), P = S(null), tt = S(null), [Ct, Rt] = I(!1), K = p === "iphone-duo" || Ct, _e = p === "iphone-duo" ? p : void 0, Se = S(null), [nt, Nt] = I(null), [ot, Et] = I(), [Mt, It] = I(!1), [Ot, _t] = I(!1), [St, Pt] = I(!1), [$e, rt] = I(!1), [it, ct] = I(!1), [kt, st] = I({}), Fe = S(null), k = S(/* @__PURE__ */ new Map()), ce = S(!1), [Yt, Lt] = I(!1), E = S(null), me = S(null), Re = S({
|
|
311
328
|
handle: () => {
|
|
312
329
|
},
|
|
313
330
|
end: () => {
|
|
314
331
|
}
|
|
315
|
-
}), [se,
|
|
316
|
-
|
|
317
|
-
|
|
332
|
+
}), [se, Pe] = I(null), [at, ze] = I(null), [Ve, Ne] = I(null), [Ke, ke] = I(null), [Dt, lt] = I(null), [Xt, dt] = I(null), Ye = S(null), Z = S(void 0), ut = (e) => {
|
|
333
|
+
Ye.current = e, Z.current === void 0 && (Z.current = window.requestAnimationFrame(() => {
|
|
334
|
+
Z.current = void 0, dt(Ye.current);
|
|
318
335
|
}));
|
|
319
|
-
}, [
|
|
320
|
-
ae.current =
|
|
336
|
+
}, [Wt, ge] = I(null), ae = S(null);
|
|
337
|
+
ae.current = at;
|
|
321
338
|
const ve = S(b);
|
|
322
339
|
ve.current = b;
|
|
323
|
-
const le = $ === !0 || $ === "hover-only",
|
|
324
|
-
|
|
325
|
-
const
|
|
340
|
+
const le = $ === !0 || $ === "hover-only", ht = S(le);
|
|
341
|
+
ht.current = le;
|
|
342
|
+
const Ht = $ === "hover-only" ? "hover-only" : "select", q = fe(() => nn(r), [r]), xt = fe(
|
|
326
343
|
() => h || Array.from(crypto.getRandomValues(new Uint32Array(4)), (e) => e.toString(36)).join(""),
|
|
327
344
|
[h]
|
|
328
|
-
), ye =
|
|
329
|
-
const o =
|
|
345
|
+
), Ee = q === "ios" && p && p !== "iphone-duo" ? p : void 0, ye = q === "android" && it ? On : Ee ? In[Ee] : Mn[q], we = J?.[q], ft = Ee && we?.modelFrames?.[Ee], pt = q === "android" && it ? $e ? we?.tabletFrameLandscape : we?.tabletFrame : Ee ? $e ? ft?.frameLandscape : ft?.frame : $e ? we?.frameLandscape : we?.frame, mt = we?.loadingLogo, Le = !K && R && !!pt, w = S(null), G = (e) => w.current?.sendControl(e), Be = (e, t) => w.current?.sendDuoControl(e, t) ?? Promise.reject(new Error("Simulator disconnected")), gt = -10, vt = (e, t) => {
|
|
346
|
+
const o = Me();
|
|
330
347
|
if (!o) return;
|
|
331
|
-
const n =
|
|
348
|
+
const n = be(o, e, t);
|
|
332
349
|
if (!n) return;
|
|
333
|
-
const { videoX: c, videoY: a, videoWidth: i, videoHeight: l } = n, s =
|
|
350
|
+
const { videoX: c, videoY: a, videoWidth: i, videoHeight: l } = n, s = xe(
|
|
334
351
|
g.ACTION_DOWN,
|
|
335
|
-
|
|
352
|
+
gt,
|
|
336
353
|
i,
|
|
337
354
|
l,
|
|
338
355
|
c,
|
|
@@ -341,10 +358,10 @@ const Pn = ln(
|
|
|
341
358
|
g.BUTTON_PRIMARY,
|
|
342
359
|
g.BUTTON_PRIMARY
|
|
343
360
|
);
|
|
344
|
-
s &&
|
|
345
|
-
const f =
|
|
361
|
+
s && G(s), window.setTimeout(() => {
|
|
362
|
+
const f = xe(
|
|
346
363
|
g.ACTION_UP,
|
|
347
|
-
|
|
364
|
+
gt,
|
|
348
365
|
i,
|
|
349
366
|
l,
|
|
350
367
|
c,
|
|
@@ -353,15 +370,15 @@ const Pn = ln(
|
|
|
353
370
|
g.BUTTON_PRIMARY,
|
|
354
371
|
g.BUTTON_PRIMARY
|
|
355
372
|
);
|
|
356
|
-
f &&
|
|
373
|
+
f && G(f);
|
|
357
374
|
}, 60);
|
|
358
|
-
},
|
|
359
|
-
const o =
|
|
375
|
+
}, Ut = (e, t) => {
|
|
376
|
+
const o = Me();
|
|
360
377
|
if (!o || t.screen.width <= 0 || t.screen.height <= 0) return;
|
|
361
378
|
const n = e.frame.x + e.frame.width / 2, c = e.frame.y + e.frame.height / 2, a = n / t.screen.width * o.actualWidth, i = c / t.screen.height * o.actualHeight, l = o.videoRect.left + o.offsetX + a, s = o.videoRect.top + o.offsetY + i;
|
|
362
|
-
|
|
363
|
-
},
|
|
364
|
-
const i =
|
|
379
|
+
vt(l, s);
|
|
380
|
+
}, De = -1, Xe = -2, de = -3, Ae = (e, t, o, n, c, a) => {
|
|
381
|
+
const i = xe(
|
|
365
382
|
e,
|
|
366
383
|
t,
|
|
367
384
|
o,
|
|
@@ -373,22 +390,22 @@ const Pn = ln(
|
|
|
373
390
|
g.BUTTON_PRIMARY,
|
|
374
391
|
g.BUTTON_PRIMARY
|
|
375
392
|
);
|
|
376
|
-
i && (
|
|
393
|
+
i && (X("[rc-touch] sendSingleTouch", {
|
|
377
394
|
action: e,
|
|
378
|
-
actionName:
|
|
395
|
+
actionName: Ue(e),
|
|
379
396
|
pointerId: t,
|
|
380
397
|
x: c,
|
|
381
398
|
y: a,
|
|
382
399
|
video: { width: o, height: n }
|
|
383
|
-
}),
|
|
400
|
+
}), G(i));
|
|
384
401
|
}, ue = (e, t, o) => {
|
|
385
402
|
if (!o) return;
|
|
386
403
|
const { videoX: n, videoY: c, videoWidth: a, videoHeight: i } = o;
|
|
387
404
|
let l = null, s = null, f = 1;
|
|
388
|
-
const
|
|
405
|
+
const M = g.BUTTON_PRIMARY;
|
|
389
406
|
switch (t) {
|
|
390
407
|
case "down":
|
|
391
|
-
e !== de &&
|
|
408
|
+
e !== de && Re.current.end(), l = k.current.size === 0 ? g.ACTION_DOWN : g.ACTION_POINTER_DOWN, s = { x: n, y: c }, k.current.set(e, s), e === -1 && P.current?.focus();
|
|
392
409
|
break;
|
|
393
410
|
case "move":
|
|
394
411
|
k.current.has(e) && (l = g.ACTION_MOVE, s = { x: n, y: c }, k.current.set(e, s));
|
|
@@ -399,21 +416,21 @@ const Pn = ln(
|
|
|
399
416
|
break;
|
|
400
417
|
}
|
|
401
418
|
if (l !== null && s !== null) {
|
|
402
|
-
|
|
419
|
+
X("[rc-touch][mouse->touch] sending", {
|
|
403
420
|
pointerId: e,
|
|
404
421
|
eventType: t,
|
|
405
422
|
action: l,
|
|
406
|
-
actionName:
|
|
423
|
+
actionName: Ue(l),
|
|
407
424
|
positionToSend: s,
|
|
408
425
|
video: { width: a, height: i },
|
|
409
426
|
altHeld: ce.current,
|
|
410
|
-
activePointersAfter: Array.from(k.current.entries()).map(([
|
|
411
|
-
id:
|
|
427
|
+
activePointersAfter: Array.from(k.current.entries()).map(([D, T]) => ({
|
|
428
|
+
id: D,
|
|
412
429
|
x: T.x,
|
|
413
430
|
y: T.y
|
|
414
431
|
}))
|
|
415
432
|
});
|
|
416
|
-
const A =
|
|
433
|
+
const A = xe(
|
|
417
434
|
l,
|
|
418
435
|
e,
|
|
419
436
|
a,
|
|
@@ -421,51 +438,51 @@ const Pn = ln(
|
|
|
421
438
|
s.x,
|
|
422
439
|
s.y,
|
|
423
440
|
f,
|
|
424
|
-
|
|
425
|
-
|
|
441
|
+
M,
|
|
442
|
+
M
|
|
426
443
|
);
|
|
427
|
-
A && (
|
|
444
|
+
A && (X("[rc-touch][mouse->touch] buffer", {
|
|
428
445
|
pointerId: e,
|
|
429
|
-
actionName:
|
|
446
|
+
actionName: Ue(l),
|
|
430
447
|
byteLength: A.byteLength
|
|
431
|
-
}),
|
|
448
|
+
}), G(A));
|
|
432
449
|
} else (t === "up" || t === "cancel") && k.current.delete(e);
|
|
433
|
-
},
|
|
434
|
-
if (ce.current !== e && (ce.current = e,
|
|
450
|
+
}, je = (e) => {
|
|
451
|
+
if (ce.current !== e && (ce.current = e, Lt(e), e || Pe(null), X("[rc-touch][alt] updateAltHeld", {
|
|
435
452
|
nextHeld: e,
|
|
436
453
|
activePointerIds: Array.from(k.current.keys())
|
|
437
|
-
}),
|
|
438
|
-
const t = e ?
|
|
454
|
+
}), q === "ios" && w.current?.getState().controlReady)) {
|
|
455
|
+
const t = e ? O.ACTION_DOWN : O.ACTION_UP, o = He(
|
|
439
456
|
t,
|
|
440
|
-
|
|
457
|
+
O.KEYCODE_ALT_LEFT,
|
|
441
458
|
0,
|
|
442
|
-
|
|
459
|
+
O.META_NONE
|
|
443
460
|
);
|
|
444
|
-
|
|
461
|
+
X("[rc-touch][alt] sending Indigo modifier keycode", {
|
|
445
462
|
action: t,
|
|
446
|
-
keycode:
|
|
447
|
-
}), o &&
|
|
463
|
+
keycode: O.KEYCODE_ALT_LEFT
|
|
464
|
+
}), o && G(o);
|
|
448
465
|
}
|
|
449
|
-
},
|
|
466
|
+
}, Me = () => {
|
|
450
467
|
const e = P.current, t = Oe.current;
|
|
451
468
|
if (!e || !t) return null;
|
|
452
469
|
const o = e.videoWidth, n = e.videoHeight;
|
|
453
470
|
if (!o || !n) return null;
|
|
454
471
|
const c = e.getBoundingClientRect(), a = t.getBoundingClientRect(), i = c.width, l = c.height, s = o / n, f = i / l;
|
|
455
|
-
let
|
|
456
|
-
s > f ? A = i / s :
|
|
457
|
-
const
|
|
472
|
+
let M = i, A = l;
|
|
473
|
+
s > f ? A = i / s : M = l * s;
|
|
474
|
+
const D = (i - M) / 2, T = (l - A) / 2;
|
|
458
475
|
return {
|
|
459
476
|
videoWidth: o,
|
|
460
477
|
videoHeight: n,
|
|
461
478
|
videoRect: c,
|
|
462
479
|
containerRect: a,
|
|
463
|
-
actualWidth:
|
|
480
|
+
actualWidth: M,
|
|
464
481
|
actualHeight: A,
|
|
465
|
-
offsetX:
|
|
482
|
+
offsetX: D,
|
|
466
483
|
offsetY: T
|
|
467
484
|
};
|
|
468
|
-
},
|
|
485
|
+
}, be = (e, t, o) => {
|
|
469
486
|
const n = t - e.videoRect.left - e.offsetX, c = o - e.videoRect.top - e.offsetY, a = Math.max(0, Math.min(e.actualWidth, n)), i = Math.max(0, Math.min(e.actualHeight, c)), l = Math.max(
|
|
470
487
|
0,
|
|
471
488
|
Math.min(e.videoWidth, a / e.actualWidth * e.videoWidth)
|
|
@@ -479,14 +496,14 @@ const Pn = ln(
|
|
|
479
496
|
videoWidth: e.videoWidth,
|
|
480
497
|
videoHeight: e.videoHeight
|
|
481
498
|
};
|
|
482
|
-
},
|
|
499
|
+
}, $t = (e, t, o) => {
|
|
483
500
|
const n = t - e.videoRect.left - e.offsetX, c = o - e.videoRect.top - e.offsetY, a = Math.max(0, Math.min(e.actualWidth, n)), i = Math.max(0, Math.min(e.actualHeight, c)), l = Math.max(
|
|
484
501
|
0,
|
|
485
502
|
Math.min(e.videoWidth, a / e.actualWidth * e.videoWidth)
|
|
486
503
|
), s = Math.max(
|
|
487
504
|
0,
|
|
488
505
|
Math.min(e.videoHeight, i / e.actualHeight * e.videoHeight)
|
|
489
|
-
), f = e.videoWidth - l,
|
|
506
|
+
), f = e.videoWidth - l, M = e.videoHeight - s, A = e.videoRect.left + e.offsetX, D = e.videoRect.top + e.offsetY, T = A - e.containerRect.left + a, Y = D - e.containerRect.top + i, he = A - e.containerRect.left + (e.actualWidth - a), x = D - e.containerRect.top + (e.actualHeight - i);
|
|
490
507
|
return {
|
|
491
508
|
containerX: T,
|
|
492
509
|
containerY: Y,
|
|
@@ -495,57 +512,57 @@ const Pn = ln(
|
|
|
495
512
|
videoX: l,
|
|
496
513
|
videoY: s,
|
|
497
514
|
mirrorVideoX: f,
|
|
498
|
-
mirrorVideoY:
|
|
515
|
+
mirrorVideoY: M,
|
|
499
516
|
videoWidth: e.videoWidth,
|
|
500
517
|
videoHeight: e.videoHeight
|
|
501
518
|
};
|
|
502
|
-
},
|
|
503
|
-
const l =
|
|
504
|
-
|
|
505
|
-
actionName:
|
|
519
|
+
}, Ft = (e, t, o, n, c, a, i) => {
|
|
520
|
+
const l = ln(e, t, o, n, c, a, i);
|
|
521
|
+
X("[rc-touch2] sendTwoFingerMessage (iOS)", {
|
|
522
|
+
actionName: Ue(e),
|
|
506
523
|
video: { width: t, height: o },
|
|
507
524
|
p0: { x: n, y: c },
|
|
508
525
|
p1: { x: a, y: i },
|
|
509
526
|
byteLength: l.byteLength
|
|
510
|
-
}),
|
|
511
|
-
},
|
|
512
|
-
if (
|
|
513
|
-
platform:
|
|
527
|
+
}), G(l);
|
|
528
|
+
}, Te = (e, t, o, n, c, a, i, l, s) => {
|
|
529
|
+
if (X("[rc-touch2] applyTwoFingerEvent", {
|
|
530
|
+
platform: q,
|
|
514
531
|
eventType: e,
|
|
515
532
|
video: { width: t, height: o },
|
|
516
533
|
p0: { x: n, y: c, id: l },
|
|
517
534
|
p1: { x: a, y: i, id: s }
|
|
518
|
-
}), e === "down" &&
|
|
535
|
+
}), e === "down" && Re.current.end(), q === "ios") {
|
|
519
536
|
const f = e === "down" ? g.ACTION_DOWN : e === "move" ? g.ACTION_MOVE : g.ACTION_UP;
|
|
520
|
-
|
|
537
|
+
Ft(f, t, o, n, c, a, i);
|
|
521
538
|
} else
|
|
522
|
-
e === "down" ? (
|
|
523
|
-
},
|
|
539
|
+
e === "down" ? (Ae(g.ACTION_DOWN, l, t, o, n, c), Ae(g.ACTION_POINTER_DOWN, s, t, o, a, i)) : e === "move" ? (Ae(g.ACTION_MOVE, l, t, o, n, c), Ae(g.ACTION_MOVE, s, t, o, a, i)) : (Ae(g.ACTION_POINTER_UP, s, t, o, a, i), Ae(g.ACTION_UP, l, t, o, n, c));
|
|
540
|
+
}, zt = (e, t, o) => {
|
|
524
541
|
if (!ce.current) {
|
|
525
|
-
se !== null &&
|
|
542
|
+
se !== null && Pe(null);
|
|
526
543
|
return;
|
|
527
544
|
}
|
|
528
|
-
const n =
|
|
529
|
-
|
|
530
|
-
},
|
|
545
|
+
const n = $t(e, t, o);
|
|
546
|
+
Pe(n);
|
|
547
|
+
}, Vt = (e, t, o) => {
|
|
531
548
|
const n = ae.current;
|
|
532
549
|
if (!n || n.screen.width <= 0 || n.screen.height <= 0) return null;
|
|
533
550
|
const c = t - e.videoRect.left - e.offsetX, a = o - e.videoRect.top - e.offsetY;
|
|
534
551
|
if (c < 0 || a < 0 || c > e.actualWidth || a > e.actualHeight) return null;
|
|
535
552
|
const i = c / e.actualWidth * n.screen.width, l = a / e.actualHeight * n.screen.height;
|
|
536
|
-
return
|
|
553
|
+
return sn(n, i, l);
|
|
537
554
|
}, ne = (e) => {
|
|
538
555
|
if (K) return;
|
|
539
556
|
e.preventDefault(), e.stopPropagation();
|
|
540
|
-
const t =
|
|
557
|
+
const t = Me();
|
|
541
558
|
if (($ === !0 || $ === "hover-only") && !("touches" in e))
|
|
542
559
|
if (e.type === "mousemove") {
|
|
543
|
-
if (
|
|
544
|
-
const n =
|
|
545
|
-
|
|
560
|
+
if (ut({ x: e.clientX, y: e.clientY }), t) {
|
|
561
|
+
const n = Vt(t, e.clientX, e.clientY);
|
|
562
|
+
Ne(n?.id ?? null);
|
|
546
563
|
}
|
|
547
|
-
} else e.type === "mouseleave" && (
|
|
548
|
-
if ($ !== !0 && (!("touches" in e) && t && (e.type === "mousemove" ?
|
|
564
|
+
} else e.type === "mouseleave" && (ut(null), Ne(null));
|
|
565
|
+
if ($ !== !0 && (!("touches" in e) && t && (e.type === "mousemove" ? zt(t, e.clientX, e.clientY) : e.type === "mouseleave" && Pe(null)), !(!w.current?.getState().controlReady || !P.current || !t)))
|
|
549
566
|
if ("touches" in e) {
|
|
550
567
|
const n = e.touches, c = e.changedTouches;
|
|
551
568
|
let a;
|
|
@@ -566,9 +583,9 @@ const Pn = ln(
|
|
|
566
583
|
return;
|
|
567
584
|
}
|
|
568
585
|
if (n.length === 2) {
|
|
569
|
-
const i = n[0], l = n[1], s =
|
|
586
|
+
const i = n[0], l = n[1], s = be(t, i.clientX, i.clientY), f = be(t, l.clientX, l.clientY);
|
|
570
587
|
if (!s || !f) return;
|
|
571
|
-
E.current ? E.current.source === "real-touch" && (E.current.finger0 = { x: s.videoX, y: s.videoY }, E.current.finger1 = { x: f.videoX, y: f.videoY },
|
|
588
|
+
E.current ? E.current.source === "real-touch" && (E.current.finger0 = { x: s.videoX, y: s.videoY }, E.current.finger1 = { x: f.videoX, y: f.videoY }, Te(
|
|
572
589
|
"move",
|
|
573
590
|
s.videoWidth,
|
|
574
591
|
s.videoHeight,
|
|
@@ -585,7 +602,7 @@ const Pn = ln(
|
|
|
585
602
|
source: "real-touch",
|
|
586
603
|
pointerId0: i.identifier,
|
|
587
604
|
pointerId1: l.identifier
|
|
588
|
-
},
|
|
605
|
+
}, Te(
|
|
589
606
|
"down",
|
|
590
607
|
s.videoWidth,
|
|
591
608
|
s.videoHeight,
|
|
@@ -598,7 +615,7 @@ const Pn = ln(
|
|
|
598
615
|
));
|
|
599
616
|
} else if (n.length < 2 && E.current?.source === "real-touch") {
|
|
600
617
|
const i = E.current;
|
|
601
|
-
|
|
618
|
+
Te(
|
|
602
619
|
"up",
|
|
603
620
|
i.videoSize.width,
|
|
604
621
|
i.videoSize.height,
|
|
@@ -616,7 +633,7 @@ const Pn = ln(
|
|
|
616
633
|
{
|
|
617
634
|
const i = c[0];
|
|
618
635
|
if (i) {
|
|
619
|
-
const l =
|
|
636
|
+
const l = be(t, i.clientX, i.clientY);
|
|
620
637
|
ue(i.identifier, a, l);
|
|
621
638
|
}
|
|
622
639
|
}
|
|
@@ -639,10 +656,10 @@ const Pn = ln(
|
|
|
639
656
|
break;
|
|
640
657
|
}
|
|
641
658
|
if (c) {
|
|
642
|
-
const i =
|
|
659
|
+
const i = be(t, e.clientX, e.clientY);
|
|
643
660
|
if (!i)
|
|
644
661
|
return;
|
|
645
|
-
|
|
662
|
+
X("[rc-touch][mouse] event", {
|
|
646
663
|
domType: e.type,
|
|
647
664
|
eventType: c,
|
|
648
665
|
button: e.button,
|
|
@@ -657,10 +674,10 @@ const Pn = ln(
|
|
|
657
674
|
videoHeight: i.videoHeight
|
|
658
675
|
},
|
|
659
676
|
activePointerIds: Array.from(k.current.keys())
|
|
660
|
-
}), ce.current || a ?
|
|
677
|
+
}), ce.current || a ? Kt(c, i) : ue(-1, c, i);
|
|
661
678
|
}
|
|
662
679
|
}
|
|
663
|
-
},
|
|
680
|
+
}, Kt = (e, t) => {
|
|
664
681
|
const { videoX: o, videoY: n, videoWidth: c, videoHeight: a } = t, i = c - o, l = a - n;
|
|
665
682
|
if (e === "down") {
|
|
666
683
|
E.current = {
|
|
@@ -668,9 +685,9 @@ const Pn = ln(
|
|
|
668
685
|
finger1: { x: i, y: l },
|
|
669
686
|
videoSize: { width: c, height: a },
|
|
670
687
|
source: "alt-mouse",
|
|
671
|
-
pointerId0:
|
|
672
|
-
pointerId1:
|
|
673
|
-
}, P.current?.focus(),
|
|
688
|
+
pointerId0: De,
|
|
689
|
+
pointerId1: Xe
|
|
690
|
+
}, P.current?.focus(), Te(
|
|
674
691
|
"down",
|
|
675
692
|
c,
|
|
676
693
|
a,
|
|
@@ -678,13 +695,13 @@ const Pn = ln(
|
|
|
678
695
|
n,
|
|
679
696
|
i,
|
|
680
697
|
l,
|
|
681
|
-
|
|
682
|
-
|
|
698
|
+
De,
|
|
699
|
+
Xe
|
|
683
700
|
);
|
|
684
701
|
return;
|
|
685
702
|
}
|
|
686
703
|
if (e === "move") {
|
|
687
|
-
E.current?.source === "alt-mouse" && (E.current.finger0 = { x: o, y: n }, E.current.finger1 = { x: i, y: l },
|
|
704
|
+
E.current?.source === "alt-mouse" && (E.current.finger0 = { x: o, y: n }, E.current.finger1 = { x: i, y: l }, Te(
|
|
688
705
|
"move",
|
|
689
706
|
c,
|
|
690
707
|
a,
|
|
@@ -692,49 +709,49 @@ const Pn = ln(
|
|
|
692
709
|
n,
|
|
693
710
|
i,
|
|
694
711
|
l,
|
|
695
|
-
|
|
696
|
-
|
|
712
|
+
De,
|
|
713
|
+
Xe
|
|
697
714
|
));
|
|
698
715
|
return;
|
|
699
716
|
}
|
|
700
717
|
if (e === "up" || e === "cancel") {
|
|
701
718
|
const s = E.current;
|
|
702
719
|
if (s?.source === "alt-mouse") {
|
|
703
|
-
const { finger0: f, finger1:
|
|
704
|
-
|
|
720
|
+
const { finger0: f, finger1: M, videoSize: A } = s;
|
|
721
|
+
Te(
|
|
705
722
|
"up",
|
|
706
723
|
A.width,
|
|
707
724
|
A.height,
|
|
708
725
|
f.x,
|
|
709
726
|
f.y,
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
727
|
+
M.x,
|
|
728
|
+
M.y,
|
|
729
|
+
De,
|
|
730
|
+
Xe
|
|
714
731
|
), E.current = null;
|
|
715
732
|
}
|
|
716
733
|
return;
|
|
717
734
|
}
|
|
718
|
-
},
|
|
735
|
+
}, Bt = 150, yt = () => {
|
|
719
736
|
const e = me.current;
|
|
720
737
|
e && (window.clearTimeout(e.endTimer), ue(de, "up", e.pos), me.current = null);
|
|
721
|
-
},
|
|
738
|
+
}, jt = (e) => {
|
|
722
739
|
if (!w.current?.getState().controlReady || e.ctrlKey || ce.current || E.current) return;
|
|
723
740
|
const t = k.current.size;
|
|
724
741
|
if (t > 1 || t === 1 && !k.current.has(de)) return;
|
|
725
|
-
const o =
|
|
742
|
+
const o = Me();
|
|
726
743
|
if (!o) return;
|
|
727
744
|
const n = e.clientX - o.videoRect.left - o.offsetX, c = e.clientY - o.videoRect.top - o.offsetY;
|
|
728
745
|
if (n < 0 || n > o.actualWidth || c < 0 || c > o.actualHeight)
|
|
729
746
|
return;
|
|
730
|
-
const a =
|
|
747
|
+
const a = be(o, e.clientX, e.clientY);
|
|
731
748
|
if (!a) return;
|
|
732
749
|
e.preventDefault();
|
|
733
|
-
const i = (e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? o.actualWidth : 1) * (o.videoWidth / o.actualWidth), l = (e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? o.actualHeight : 1) * (o.videoHeight / o.actualHeight), s = -e.deltaX * i, f = -e.deltaY * l,
|
|
734
|
-
window.clearTimeout(x.endTimer), x.endTimer = window.setTimeout(
|
|
750
|
+
const i = (e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? o.actualWidth : 1) * (o.videoWidth / o.actualWidth), l = (e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? o.actualHeight : 1) * (o.videoHeight / o.actualHeight), s = -e.deltaX * i, f = -e.deltaY * l, M = (x) => {
|
|
751
|
+
window.clearTimeout(x.endTimer), x.endTimer = window.setTimeout(yt, Bt);
|
|
735
752
|
};
|
|
736
753
|
if (s === 0 && f === 0) {
|
|
737
|
-
me.current &&
|
|
754
|
+
me.current && M(me.current);
|
|
738
755
|
return;
|
|
739
756
|
}
|
|
740
757
|
const A = () => ({
|
|
@@ -742,7 +759,7 @@ const Pn = ln(
|
|
|
742
759
|
videoHeight: a.videoHeight,
|
|
743
760
|
videoX: Math.abs(s) > Math.abs(f) ? Math.min(Math.max(a.videoX, a.videoWidth * 0.2), a.videoWidth * 0.8) : a.videoX,
|
|
744
761
|
videoY: Math.abs(f) >= Math.abs(s) ? Math.min(Math.max(a.videoY, a.videoHeight * 0.2), a.videoHeight * 0.8) : a.videoY
|
|
745
|
-
}),
|
|
762
|
+
}), D = (x) => ({
|
|
746
763
|
...x,
|
|
747
764
|
videoX: Math.min(Math.max(x.videoX + s, 0), x.videoWidth),
|
|
748
765
|
videoY: Math.min(Math.max(x.videoY + f, 0), x.videoHeight)
|
|
@@ -754,34 +771,34 @@ const Pn = ln(
|
|
|
754
771
|
const x = A();
|
|
755
772
|
ue(de, "down", x), T = { pos: x, endTimer: 0 }, me.current = T;
|
|
756
773
|
}
|
|
757
|
-
let Y = T.pos, he =
|
|
758
|
-
he.videoX === Y.videoX && he.videoY === Y.videoY && (ue(de, "up", Y), Y = A(), ue(de, "down", Y), he =
|
|
774
|
+
let Y = T.pos, he = D(Y);
|
|
775
|
+
he.videoX === Y.videoX && he.videoY === Y.videoY && (ue(de, "up", Y), Y = A(), ue(de, "down", Y), he = D(Y)), ue(de, "move", he), T.pos = he, M(T);
|
|
759
776
|
};
|
|
760
777
|
F(() => {
|
|
761
|
-
|
|
778
|
+
Re.current = { handle: jt, end: yt };
|
|
762
779
|
}), F(() => {
|
|
763
780
|
const e = Oe.current;
|
|
764
781
|
if (!e) return;
|
|
765
|
-
const t = (o) =>
|
|
782
|
+
const t = (o) => Re.current.handle(o);
|
|
766
783
|
return e.addEventListener("wheel", t, { passive: !1 }), () => {
|
|
767
|
-
|
|
784
|
+
Re.current.end(), e.removeEventListener("wheel", t);
|
|
768
785
|
};
|
|
769
786
|
}, []), F(() => {
|
|
770
787
|
const e = (n) => {
|
|
771
|
-
n.key === "Alt" &&
|
|
788
|
+
n.key === "Alt" && je(!0);
|
|
772
789
|
}, t = (n) => {
|
|
773
|
-
n.key === "Alt" &&
|
|
790
|
+
n.key === "Alt" && je(!1);
|
|
774
791
|
}, o = () => {
|
|
775
|
-
|
|
792
|
+
je(!1);
|
|
776
793
|
};
|
|
777
794
|
return window.addEventListener("keydown", e, !0), window.addEventListener("keyup", t, !0), window.addEventListener("blur", o), () => {
|
|
778
795
|
window.removeEventListener("keydown", e, !0), window.removeEventListener("keyup", t, !0), window.removeEventListener("blur", o);
|
|
779
796
|
};
|
|
780
797
|
}, []);
|
|
781
|
-
const
|
|
798
|
+
const We = (e) => {
|
|
782
799
|
e.preventDefault(), e.stopPropagation();
|
|
783
800
|
const t = document.activeElement === P.current || K && document.activeElement === e.currentTarget;
|
|
784
|
-
if (
|
|
801
|
+
if (X("Keyboard event:", {
|
|
785
802
|
type: e.type,
|
|
786
803
|
key: e.key,
|
|
787
804
|
keyCode: e.keyCode,
|
|
@@ -789,23 +806,23 @@ const Pn = ln(
|
|
|
789
806
|
target: e.target.tagName,
|
|
790
807
|
focused: t
|
|
791
808
|
}), !t) {
|
|
792
|
-
|
|
809
|
+
Je("Simulator input not focused, skipping keyboard event");
|
|
793
810
|
return;
|
|
794
811
|
}
|
|
795
812
|
if (!w.current?.getState().controlReady) {
|
|
796
|
-
|
|
813
|
+
Je("Data channel not ready for keyboard event:", w.current?.getState().connection);
|
|
797
814
|
return;
|
|
798
815
|
}
|
|
799
816
|
if (e.type === "keydown") {
|
|
800
817
|
if (e.key.toLowerCase() === "v" && (e.metaKey || e.ctrlKey)) {
|
|
801
|
-
|
|
818
|
+
X("Paste shortcut detected"), navigator.clipboard.readText().then((n) => {
|
|
802
819
|
if (n) {
|
|
803
|
-
|
|
820
|
+
X(
|
|
804
821
|
"Pasting text via SET_CLIPBOARD:",
|
|
805
822
|
n.substring(0, 20) + (n.length > 20 ? "..." : "")
|
|
806
823
|
);
|
|
807
|
-
const c =
|
|
808
|
-
|
|
824
|
+
const c = cn(n, !0);
|
|
825
|
+
G(c);
|
|
809
826
|
}
|
|
810
827
|
}).catch((n) => {
|
|
811
828
|
console.error("Failed to read clipboard contents: ", n);
|
|
@@ -813,40 +830,40 @@ const Pn = ln(
|
|
|
813
830
|
return;
|
|
814
831
|
}
|
|
815
832
|
if (e.key.toLowerCase() === "m" && (e.metaKey || e.ctrlKey)) {
|
|
816
|
-
|
|
817
|
-
const n =
|
|
818
|
-
|
|
819
|
-
|
|
833
|
+
X("Menu shortcut detected");
|
|
834
|
+
const n = He(
|
|
835
|
+
O.ACTION_DOWN,
|
|
836
|
+
O.MENU,
|
|
820
837
|
0,
|
|
821
|
-
|
|
838
|
+
O.META_NONE
|
|
822
839
|
// Modifiers are handled by the shortcut check, not passed down
|
|
823
840
|
);
|
|
824
|
-
|
|
825
|
-
const c =
|
|
826
|
-
|
|
827
|
-
|
|
841
|
+
G(n);
|
|
842
|
+
const c = He(
|
|
843
|
+
O.ACTION_UP,
|
|
844
|
+
O.MENU,
|
|
828
845
|
0,
|
|
829
|
-
|
|
846
|
+
O.META_NONE
|
|
830
847
|
);
|
|
831
|
-
|
|
848
|
+
G(c);
|
|
832
849
|
return;
|
|
833
850
|
}
|
|
834
851
|
}
|
|
835
|
-
const o =
|
|
852
|
+
const o = _n(e);
|
|
836
853
|
if (o) {
|
|
837
|
-
const { keycode: n, metaState: c } = o, a = e.type === "keydown" ?
|
|
838
|
-
|
|
839
|
-
const i =
|
|
854
|
+
const { keycode: n, metaState: c } = o, a = e.type === "keydown" ? O.ACTION_DOWN : O.ACTION_UP;
|
|
855
|
+
X(`Sending Keycode: key=${e.key}, code=${n}, action=${a}, meta=${c}`);
|
|
856
|
+
const i = He(
|
|
840
857
|
a,
|
|
841
858
|
n,
|
|
842
859
|
0,
|
|
843
860
|
// repeat count, typically 0 for single presses
|
|
844
861
|
c
|
|
845
862
|
);
|
|
846
|
-
|
|
863
|
+
G(i);
|
|
847
864
|
} else
|
|
848
|
-
|
|
849
|
-
},
|
|
865
|
+
X(`Ignoring unhandled key event: type=${e.type}, key=${e.key}`);
|
|
866
|
+
}, qt = (e) => {
|
|
850
867
|
e.stopPropagation(), w.current?.reconnect();
|
|
851
868
|
}, H = S({
|
|
852
869
|
onAxSnapshotChange: oe,
|
|
@@ -870,37 +887,37 @@ const Pn = ln(
|
|
|
870
887
|
onConnectionStateChange: ee,
|
|
871
888
|
onPlaybackStats: N
|
|
872
889
|
};
|
|
873
|
-
const
|
|
890
|
+
const qe = !!te;
|
|
874
891
|
F(() => {
|
|
875
|
-
|
|
876
|
-
}, [r,
|
|
892
|
+
Fe.current = null, rt(!1), ct(!1), st({});
|
|
893
|
+
}, [r, _e]), F(() => {
|
|
877
894
|
let e = !0;
|
|
878
|
-
ae.current !== null && (ae.current = null,
|
|
879
|
-
const t =
|
|
895
|
+
ae.current !== null && (ae.current = null, ze(null), Ce("onAxSnapshotChange", H.current.onAxSnapshotChange, null));
|
|
896
|
+
const t = on({
|
|
880
897
|
url: r,
|
|
881
898
|
token: u,
|
|
882
|
-
sessionId:
|
|
899
|
+
sessionId: xt,
|
|
883
900
|
watchOnly: ie,
|
|
884
|
-
deviceModel:
|
|
901
|
+
deviceModel: _e,
|
|
885
902
|
autoReconnect: v,
|
|
886
903
|
jitterBufferTargetMs: _,
|
|
887
904
|
openUrl: C,
|
|
888
905
|
inspectMode: $,
|
|
889
906
|
axPollIntervalMs: W,
|
|
890
907
|
axMaxBackoffMs: y,
|
|
891
|
-
androidElementTreeOptions:
|
|
908
|
+
androidElementTreeOptions: Q,
|
|
892
909
|
microphoneEnabled: re,
|
|
893
910
|
onStateChange: (n) => {
|
|
894
|
-
(n.videoReady || n.connection === "idle" || n.connection === "connecting" || n.connection === "reconnecting") &&
|
|
911
|
+
(n.videoReady || n.connection === "idle" || n.connection === "connecting" || n.connection === "reconnecting") && It(n.videoReady), _t(n.connection === "failed"), Pt(n.connection === "terminated"), Rt(n.duo), Nt(n.duoState), Et(n.duoError);
|
|
895
912
|
},
|
|
896
913
|
onAxSnapshotChange: (n) => {
|
|
897
|
-
e && (
|
|
914
|
+
e && (ze((c) => rn(c, n) ? c : n), H.current.onAxSnapshotChange?.(n));
|
|
898
915
|
},
|
|
899
916
|
onAxStatusChange: (...n) => H.current.onAxStatusChange?.(...n),
|
|
900
917
|
onCameraDemandChange: (...n) => H.current.onCameraDemandChange?.(...n),
|
|
901
918
|
onCameraStats: j ? (...n) => H.current.onCameraStats?.(...n) : void 0,
|
|
902
919
|
onMicrophoneStateChange: (...n) => H.current.onMicrophoneStateChange?.(...n),
|
|
903
|
-
onTrace:
|
|
920
|
+
onTrace: qe ? (...n) => H.current.onTrace?.(...n) : void 0,
|
|
904
921
|
onTerminated: () => H.current.onTerminated?.(),
|
|
905
922
|
onConnectionStateChange: (...n) => H.current.onConnectionStateChange?.(...n),
|
|
906
923
|
onPlaybackStats: N ? (...n) => H.current.onPlaybackStats?.(...n) : void 0
|
|
@@ -910,16 +927,16 @@ const Pn = ln(
|
|
|
910
927
|
return t.start(), () => {
|
|
911
928
|
e = !1, t.dispose(), o?.(), w.current = null;
|
|
912
929
|
};
|
|
913
|
-
}, [r, h,
|
|
914
|
-
if (K &&
|
|
915
|
-
return w.current?.attachVideo(
|
|
916
|
-
}, [K, r, h,
|
|
930
|
+
}, [r, h, _e, qe, ie]), F(() => {
|
|
931
|
+
if (K && Se.current)
|
|
932
|
+
return w.current?.attachVideo(Se.current, "inner");
|
|
933
|
+
}, [K, r, h, _e, qe, ie]), F(() => {
|
|
917
934
|
w.current?.updateOptions({
|
|
918
935
|
token: u,
|
|
919
936
|
openUrl: C,
|
|
920
937
|
axPollIntervalMs: W,
|
|
921
938
|
axMaxBackoffMs: y,
|
|
922
|
-
androidElementTreeOptions:
|
|
939
|
+
androidElementTreeOptions: Q,
|
|
923
940
|
autoReconnect: v,
|
|
924
941
|
jitterBufferTargetMs: _,
|
|
925
942
|
microphoneEnabled: re,
|
|
@@ -938,13 +955,13 @@ const Pn = ln(
|
|
|
938
955
|
C,
|
|
939
956
|
W,
|
|
940
957
|
y,
|
|
941
|
-
|
|
958
|
+
Q
|
|
942
959
|
]);
|
|
943
|
-
const
|
|
944
|
-
if (!
|
|
945
|
-
const e =
|
|
960
|
+
const Ge = () => {
|
|
961
|
+
if (!ht.current) return;
|
|
962
|
+
const e = Me();
|
|
946
963
|
if (!e) {
|
|
947
|
-
|
|
964
|
+
lt(null);
|
|
948
965
|
return;
|
|
949
966
|
}
|
|
950
967
|
const t = {
|
|
@@ -953,36 +970,36 @@ const Pn = ln(
|
|
|
953
970
|
width: e.actualWidth,
|
|
954
971
|
height: e.actualHeight
|
|
955
972
|
};
|
|
956
|
-
|
|
973
|
+
lt(
|
|
957
974
|
(o) => o && o.left === t.left && o.top === t.top && o.width === t.width && o.height === t.height ? o : t
|
|
958
975
|
);
|
|
959
976
|
};
|
|
960
977
|
F(() => {
|
|
961
|
-
const e = P.current, t =
|
|
978
|
+
const e = P.current, t = tt.current, o = Oe.current;
|
|
962
979
|
if (!e) return;
|
|
963
|
-
const n = (l) =>
|
|
980
|
+
const n = (l) => st((s) => Sn(s, l) ? s : l), c = () => {
|
|
964
981
|
const l = e.videoWidth > 0 && e.videoHeight > 0;
|
|
965
|
-
l && (
|
|
966
|
-
const s =
|
|
967
|
-
if (!
|
|
982
|
+
l && (Fe.current = { width: e.videoWidth, height: e.videoHeight });
|
|
983
|
+
const s = Fe.current, f = s ? `${s.width} / ${s.height}` : void 0;
|
|
984
|
+
if (!Le || !t) {
|
|
968
985
|
n(
|
|
969
986
|
!l && s ? {
|
|
970
987
|
aspectRatio: f,
|
|
971
988
|
contain: "size",
|
|
972
989
|
containIntrinsicSize: `${s.width}px ${s.height}px`
|
|
973
990
|
} : {}
|
|
974
|
-
),
|
|
991
|
+
), Ge();
|
|
975
992
|
return;
|
|
976
993
|
}
|
|
977
|
-
const
|
|
978
|
-
if (
|
|
979
|
-
const
|
|
980
|
-
|
|
981
|
-
|
|
994
|
+
const M = t.clientWidth, A = t.clientHeight;
|
|
995
|
+
if (M === 0 || A === 0) return;
|
|
996
|
+
const D = s ? s.width > s.height : !1;
|
|
997
|
+
rt(D), ct(
|
|
998
|
+
q === "android" && !!s && En(s.width, s.height)
|
|
982
999
|
);
|
|
983
|
-
const T =
|
|
1000
|
+
const T = D ? ye.videoPosition.landscape : ye.videoPosition.portrait;
|
|
984
1001
|
let Y = { aspectRatio: f };
|
|
985
|
-
T.heightMultiplier ? (Y.height = `${A * T.heightMultiplier}px`, Y.width = "auto") : T.widthMultiplier && (Y.width = `${
|
|
1002
|
+
T.heightMultiplier ? (Y.height = `${A * T.heightMultiplier}px`, Y.width = "auto") : T.widthMultiplier && (Y.width = `${M * T.widthMultiplier}px`, Y.height = "auto"), Y.borderRadius = `${D ? A * ye.videoBorderRadiusMultiplier : M * ye.videoBorderRadiusMultiplier}px`, n(Y), Ge();
|
|
986
1003
|
}, a = new ResizeObserver(() => {
|
|
987
1004
|
c();
|
|
988
1005
|
});
|
|
@@ -991,21 +1008,21 @@ const Pn = ln(
|
|
|
991
1008
|
return e.addEventListener("resize", i), c(), () => {
|
|
992
1009
|
a.disconnect(), e.removeEventListener("loadedmetadata", c), e.removeEventListener("resize", c), e.removeEventListener("resize", i), t && t.removeEventListener("load", c);
|
|
993
1010
|
};
|
|
994
|
-
}, [ye,
|
|
995
|
-
le ?
|
|
1011
|
+
}, [ye, Le, r, p]), F(() => {
|
|
1012
|
+
le ? Ge() : (ze(null), Ne(null), ke(null), dt(null), ge(null), Ye.current = null, Z.current !== void 0 && (window.cancelAnimationFrame(Z.current), Z.current = void 0));
|
|
996
1013
|
}, [le]), F(() => () => {
|
|
997
|
-
|
|
1014
|
+
Z.current !== void 0 && (window.cancelAnimationFrame(Z.current), Z.current = void 0);
|
|
998
1015
|
}, []), F(() => {
|
|
999
1016
|
if (!le) return;
|
|
1000
1017
|
const e = (t) => {
|
|
1001
|
-
t.key === "Escape" && (
|
|
1018
|
+
t.key === "Escape" && (Ke || Ve) && (ke(null), Ne(null), ge(null), Ce("onInspectSelectionChange", ve.current, null));
|
|
1002
1019
|
};
|
|
1003
1020
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
1004
|
-
}, [le,
|
|
1005
|
-
const
|
|
1021
|
+
}, [le, Ke, Ve]);
|
|
1022
|
+
const Gt = () => {
|
|
1006
1023
|
P.current && P.current.focus();
|
|
1007
1024
|
};
|
|
1008
|
-
|
|
1025
|
+
fn(Ze, () => ({
|
|
1009
1026
|
openUrl: (e) => w.current?.openUrl(e),
|
|
1010
1027
|
sendKeyEvent: (e) => w.current?.sendKeyEvent(e),
|
|
1011
1028
|
screenshot: (e) => w.current?.screenshot(e) ?? Promise.reject(new Error("Simulator disconnected")),
|
|
@@ -1014,16 +1031,16 @@ const Pn = ln(
|
|
|
1014
1031
|
refreshAxTree: () => w.current?.refreshAxTree() ?? Promise.reject(new Error("Simulator disconnected")),
|
|
1015
1032
|
getAxSnapshot: () => w.current?.getAxSnapshot() ?? null,
|
|
1016
1033
|
setInspectHighlight: (e) => {
|
|
1017
|
-
|
|
1034
|
+
Ne(e?.id ?? null);
|
|
1018
1035
|
},
|
|
1019
1036
|
setInspectSelection: (e) => {
|
|
1020
|
-
|
|
1037
|
+
ke(e?.id ?? null), ge(e ? Ye.current : null);
|
|
1021
1038
|
const t = ae.current;
|
|
1022
|
-
e && t ?
|
|
1039
|
+
e && t ? Ce("onInspectSelectionChange", ve.current, { element: e, snapshot: t }) : Ce("onInspectSelectionChange", ve.current, null);
|
|
1023
1040
|
},
|
|
1024
1041
|
getAxStatus: () => w.current?.getAxStatus() ?? "idle"
|
|
1025
1042
|
}));
|
|
1026
|
-
const
|
|
1043
|
+
const Jt = Yt && se !== null;
|
|
1027
1044
|
return /* @__PURE__ */ z(
|
|
1028
1045
|
"div",
|
|
1029
1046
|
{
|
|
@@ -1039,7 +1056,7 @@ const Pn = ln(
|
|
|
1039
1056
|
onTouchEnd: ne,
|
|
1040
1057
|
onTouchCancel: ne,
|
|
1041
1058
|
children: [
|
|
1042
|
-
|
|
1059
|
+
Jt && se && /* @__PURE__ */ z(bt, { children: [
|
|
1043
1060
|
/* @__PURE__ */ m(
|
|
1044
1061
|
"div",
|
|
1045
1062
|
{
|
|
@@ -1061,13 +1078,13 @@ const Pn = ln(
|
|
|
1061
1078
|
}
|
|
1062
1079
|
)
|
|
1063
1080
|
] }),
|
|
1064
|
-
|
|
1081
|
+
Le && /* @__PURE__ */ m(
|
|
1065
1082
|
"img",
|
|
1066
1083
|
{
|
|
1067
|
-
ref:
|
|
1068
|
-
src:
|
|
1084
|
+
ref: tt,
|
|
1085
|
+
src: pt,
|
|
1069
1086
|
alt: "",
|
|
1070
|
-
className:
|
|
1087
|
+
className: q === "ios" ? "rc-phone-frame rc-phone-frame-ios" : "rc-phone-frame",
|
|
1071
1088
|
draggable: !1
|
|
1072
1089
|
}
|
|
1073
1090
|
),
|
|
@@ -1075,12 +1092,12 @@ const Pn = ln(
|
|
|
1075
1092
|
"video",
|
|
1076
1093
|
{
|
|
1077
1094
|
ref: P,
|
|
1078
|
-
className: ["rc-video", !
|
|
1095
|
+
className: ["rc-video", !Le && "rc-video-frameless", !Mt && "rc-video-loading"].filter(Boolean).join(" "),
|
|
1079
1096
|
style: {
|
|
1080
|
-
...
|
|
1097
|
+
...kt,
|
|
1081
1098
|
...K ? { opacity: 0, width: 1, height: 1, pointerEvents: "none" } : {},
|
|
1082
|
-
...
|
|
1083
|
-
backgroundImage: `url("${
|
|
1099
|
+
...mt ? {
|
|
1100
|
+
backgroundImage: `url("${mt}")`,
|
|
1084
1101
|
backgroundRepeat: "no-repeat",
|
|
1085
1102
|
backgroundPosition: "center",
|
|
1086
1103
|
backgroundSize: ye.loadingLogoSize
|
|
@@ -1090,9 +1107,9 @@ const Pn = ln(
|
|
|
1090
1107
|
playsInline: !0,
|
|
1091
1108
|
muted: !0,
|
|
1092
1109
|
tabIndex: K ? -1 : 0,
|
|
1093
|
-
onKeyDown:
|
|
1094
|
-
onKeyUp:
|
|
1095
|
-
onClick:
|
|
1110
|
+
onKeyDown: We,
|
|
1111
|
+
onKeyUp: We,
|
|
1112
|
+
onClick: Gt,
|
|
1096
1113
|
onFocus: () => {
|
|
1097
1114
|
P.current && (P.current.style.outline = "none");
|
|
1098
1115
|
},
|
|
@@ -1104,72 +1121,72 @@ const Pn = ln(
|
|
|
1104
1121
|
K && /* @__PURE__ */ m(
|
|
1105
1122
|
"video",
|
|
1106
1123
|
{
|
|
1107
|
-
ref:
|
|
1124
|
+
ref: Se,
|
|
1108
1125
|
autoPlay: !0,
|
|
1109
1126
|
playsInline: !0,
|
|
1110
1127
|
muted: !0,
|
|
1111
1128
|
style: { position: "absolute", width: 1, height: 1, opacity: 0, pointerEvents: "none" }
|
|
1112
1129
|
}
|
|
1113
1130
|
),
|
|
1114
|
-
K &&
|
|
1115
|
-
|
|
1131
|
+
K && nt && /* @__PURE__ */ m(pn, { fallback: /* @__PURE__ */ m("div", { children: "Loading iPhone Duo…" }), children: /* @__PURE__ */ m(
|
|
1132
|
+
Nn,
|
|
1116
1133
|
{
|
|
1117
1134
|
watchOnly: ie,
|
|
1118
1135
|
showFrame: R,
|
|
1119
1136
|
modelUrl: U,
|
|
1120
1137
|
outer: P.current,
|
|
1121
|
-
inner:
|
|
1122
|
-
state:
|
|
1123
|
-
setAngle: (e) =>
|
|
1124
|
-
setOrientation: (e) =>
|
|
1125
|
-
button: (e, t) =>
|
|
1138
|
+
inner: Se.current,
|
|
1139
|
+
state: nt,
|
|
1140
|
+
setAngle: (e) => Be("setHingeAngle", { angleDegrees: e }),
|
|
1141
|
+
setOrientation: (e) => Be("setDuoOrientation", { orientation: e }),
|
|
1142
|
+
button: (e, t) => Be("performActions", {
|
|
1126
1143
|
actions: [{ type: t ? "buttonDown" : "buttonUp", button: e }]
|
|
1127
1144
|
}),
|
|
1128
1145
|
touch: (e, t, o, n) => {
|
|
1129
1146
|
w.current?.sendDisplayTouch(e, t, o, n);
|
|
1130
1147
|
},
|
|
1131
|
-
onKeyDown:
|
|
1132
|
-
onKeyUp:
|
|
1148
|
+
onKeyDown: We,
|
|
1149
|
+
onKeyUp: We
|
|
1133
1150
|
}
|
|
1134
1151
|
) }),
|
|
1135
|
-
K &&
|
|
1152
|
+
K && ot && /* @__PURE__ */ m("div", { role: "alert", className: "rc-duo-error", children: ot }),
|
|
1136
1153
|
!K && le && /* @__PURE__ */ m(
|
|
1137
|
-
|
|
1154
|
+
Cn,
|
|
1138
1155
|
{
|
|
1139
|
-
snapshot:
|
|
1140
|
-
geometry:
|
|
1141
|
-
highlightedId:
|
|
1142
|
-
selectedId:
|
|
1143
|
-
mode:
|
|
1144
|
-
cursorPosition:
|
|
1145
|
-
frozenCursorPosition:
|
|
1156
|
+
snapshot: at,
|
|
1157
|
+
geometry: Dt,
|
|
1158
|
+
highlightedId: Ve,
|
|
1159
|
+
selectedId: Ke,
|
|
1160
|
+
mode: Ht,
|
|
1161
|
+
cursorPosition: Xt,
|
|
1162
|
+
frozenCursorPosition: Wt,
|
|
1146
1163
|
onSelectChange: (e, t) => {
|
|
1147
|
-
|
|
1164
|
+
ke(e?.id ?? null), e && t ? ge(t) : e || ge(null);
|
|
1148
1165
|
const o = ae.current;
|
|
1149
|
-
e && o ?
|
|
1166
|
+
e && o ? Ce("onInspectSelectionChange", ve.current, {
|
|
1150
1167
|
element: e,
|
|
1151
1168
|
snapshot: o
|
|
1152
|
-
}) :
|
|
1169
|
+
}) : Ce("onInspectSelectionChange", ve.current, null);
|
|
1153
1170
|
},
|
|
1154
1171
|
onTapElement: ie ? void 0 : ((e, t) => {
|
|
1155
1172
|
if (t) {
|
|
1156
|
-
|
|
1173
|
+
vt(t.x, t.y);
|
|
1157
1174
|
return;
|
|
1158
1175
|
}
|
|
1159
1176
|
const o = ae.current;
|
|
1160
|
-
o &&
|
|
1177
|
+
o && Ut(e, o);
|
|
1161
1178
|
})
|
|
1162
1179
|
}
|
|
1163
1180
|
),
|
|
1164
|
-
|
|
1181
|
+
St ? /* @__PURE__ */ z("div", { className: "rc-terminated", role: "status", children: [
|
|
1165
1182
|
/* @__PURE__ */ m("div", { className: "rc-terminated-title", children: "Instance terminated" }),
|
|
1166
1183
|
/* @__PURE__ */ m("div", { className: "rc-terminated-message", children: "This instance no longer exists and can't be reconnected." })
|
|
1167
|
-
] }) :
|
|
1184
|
+
] }) : Ot && /* @__PURE__ */ m("button", { type: "button", className: "rc-retry-button", onClick: qt, children: "Retry" })
|
|
1168
1185
|
]
|
|
1169
1186
|
}
|
|
1170
1187
|
);
|
|
1171
1188
|
}
|
|
1172
1189
|
);
|
|
1173
1190
|
export {
|
|
1174
|
-
|
|
1191
|
+
Dn as R
|
|
1175
1192
|
};
|