@limrun/ui 0.20.5 → 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.
@@ -1,8 +1,8 @@
1
- import { jsx as m, jsxs as z, Fragment as yt } from "react/jsx-runtime";
2
- import { f as qt, c as wt, d as Gt, b as Jt, h as Qt, i as Zt, s as Te, j as en, e as tn, k as D, l as je, m as nn, o as De, p as M, q as We, a as on, r as rn, t as g, u as cn } from "./core-DuukW7sF.mjs";
3
- import { memo as qe, useState as O, useEffect as F, useMemo as fe, useCallback as sn, lazy as an, forwardRef as ln, useRef as S, useImperativeHandle as dn, Suspense as un } from "react";
4
- import { createPortal as hn } from "react-dom";
5
- import './index.css';const fn = async (d) => {
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
- }, pn = qe(
20
+ }, vn = Qe(
21
21
  function({ element: r, screen: u, highlighted: h, selected: C, selectable: V, onClick: R }) {
22
- const p = qt(r.frame, u);
22
+ const p = Qt(r.frame, u);
23
23
  if (!p) return null;
24
- const U = wt(r);
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 && Gt(d.element, r.element)
50
- ), mn = 260, gn = 220, vn = 6, yn = 8, wn = qe(function({
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] = O(null);
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 = mn, B = gn, W = vn, y = yn, J = typeof window < "u" ? window.innerWidth : 1024, Ie = typeof window < "u" ? window.innerHeight : 768, j = h.x + W + b <= J - y, te = h.y - W - B >= y;
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(J - 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(() => Jt(r, u), [r, u]), N = u === "ios" ? r.selectors.AXUniqueId : r.selectors.resourceId, L = u === "ios" ? "AXUniqueId" : "resourceId", G = sn(async (b, B) => {
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 fn(b) && U(B);
72
- }, []), ee = Qt(r), $ = r.label || r.value || ee, oe = wt(r);
73
- return hn(
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: () => G(_ ?? void 0, "selector"),
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: () => G(N, "id"),
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
- }), An = qe(function({
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, G = fe(() => {
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 J of r.elements) y.set(J.id, J);
166
+ for (const Q of r.elements) y.set(Q.id, Q);
167
167
  return y;
168
- }, [r]), ee = fe(() => L ? G.get(L) ?? null : null, [L, G]);
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(yt, { children: [
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
- pn,
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
- wn,
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 bn(d, r) {
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, G] = v.split(":");
228
- if (!(G !== void 0 || _ !== h && _ !== "*") && !(N !== u && N !== "*")) {
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 Tn = an(() => import("./duo-view-CvOd3jDJ.mjs").then((d) => d.d)), He = (d) => Object.entries(g).find(
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), gt = 1920, vt = 1200, Cn = (d, r) => d === gt && r === vt || d === vt && r === gt, Rn = {
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-CvOd3jDJ.mjs").then((d) => d.d)), He = (d
256
256
  landscape: { widthMultiplier: 0.962 }
257
257
  }
258
258
  }
259
- }, Nn = {
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-CvOd3jDJ.mjs").then((d) => d.d)), He = (d
264
281
  landscape: { widthMultiplier: 2560 / 2798 }
265
282
  }
266
283
  };
267
- function En(d) {
268
- const r = d.code, u = rn[r];
284
+ function _n(d) {
285
+ const r = d.code, u = an[r];
269
286
  if (!u)
270
- return je(`Unknown event.code: ${r}, key: ${d.key}`), null;
271
- let h = M.META_NONE;
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 |= M.META_SHIFT_ON), d.ctrlKey && (h |= M.META_CTRL_ON), d.altKey && (h |= M.META_ALT_ON), d.metaKey && (h |= M.META_META_ON), { keycode: u, metaState: 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 In(d, r) {
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 Pn = ln(
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: G,
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: J,
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
- }, Ge) => {
310
- const Je = fe(() => bn(r, u), [r, u]), ie = V || Je, Oe = S(null), P = S(null), Qe = S(null), [At, bt] = O(!1), K = p === "iphone-duo" || At, Me = S(null), [Ze, Tt] = O(null), [et, Ct] = O(), [Rt, Nt] = O(!1), [Et, It] = O(!1), [Ot, Mt] = O(!1), [tt, nt] = O(!1), [ot, rt] = O(!1), [_t, it] = O({}), xe = S(null), k = S(/* @__PURE__ */ new Map()), ce = S(!1), [St, Pt] = O(!1), E = S(null), me = S(null), Ce = S({
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, _e] = O(null), [ct, Ue] = O(null), [$e, Re] = O(null), [Fe, Se] = O(null), [kt, st] = O(null), [Yt, at] = O(null), Pe = S(null), Q = S(void 0), lt = (e) => {
316
- Pe.current = e, Q.current === void 0 && (Q.current = window.requestAnimationFrame(() => {
317
- Q.current = void 0, at(Pe.current);
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
- }, [Lt, ge] = O(null), ae = S(null);
320
- ae.current = ct;
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", dt = S(le);
324
- dt.current = le;
325
- const Xt = $ === "hover-only" ? "hover-only" : "select", Z = fe(() => Zt(r), [r]), Dt = fe(
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
- [h, u]
328
- ), ye = Z === "android" && ot ? Nn : Rn[Z], Ne = G?.[Z], ut = Z === "android" && ot ? tt ? Ne?.tabletFrameLandscape : Ne?.tabletFrame : tt ? Ne?.frameLandscape : Ne?.frame, ht = Ne?.loadingLogo, ke = !K && R && !!ut, w = S(null), q = (e) => w.current?.sendControl(e), ze = (e, t) => w.current?.sendDuoControl(e, t) ?? Promise.reject(new Error("Simulator disconnected")), ft = -10, pt = (e, t) => {
329
- const o = Ee();
344
+ [h]
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 = Ae(o, e, t);
348
+ const n = be(o, e, t);
332
349
  if (!n) return;
333
- const { videoX: c, videoY: a, videoWidth: i, videoHeight: l } = n, s = We(
350
+ const { videoX: c, videoY: a, videoWidth: i, videoHeight: l } = n, s = xe(
334
351
  g.ACTION_DOWN,
335
- ft,
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 && q(s), window.setTimeout(() => {
345
- const f = We(
361
+ s && G(s), window.setTimeout(() => {
362
+ const f = xe(
346
363
  g.ACTION_UP,
347
- ft,
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 && q(f);
373
+ f && G(f);
357
374
  }, 60);
358
- }, Wt = (e, t) => {
359
- const o = Ee();
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
- pt(l, s);
363
- }, Ye = -1, Le = -2, de = -3, we = (e, t, o, n, c, a) => {
364
- const i = We(
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 && (D("[rc-touch] sendSingleTouch", {
393
+ i && (X("[rc-touch] sendSingleTouch", {
377
394
  action: e,
378
- actionName: He(e),
395
+ actionName: Ue(e),
379
396
  pointerId: t,
380
397
  x: c,
381
398
  y: a,
382
399
  video: { width: o, height: n }
383
- }), q(i));
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 I = g.BUTTON_PRIMARY;
405
+ const M = g.BUTTON_PRIMARY;
389
406
  switch (t) {
390
407
  case "down":
391
- e !== de && Ce.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();
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
- D("[rc-touch][mouse->touch] sending", {
419
+ X("[rc-touch][mouse->touch] sending", {
403
420
  pointerId: e,
404
421
  eventType: t,
405
422
  action: l,
406
- actionName: He(l),
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(([X, T]) => ({
411
- id: X,
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 = We(
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
- I,
425
- I
441
+ M,
442
+ M
426
443
  );
427
- A && (D("[rc-touch][mouse->touch] buffer", {
444
+ A && (X("[rc-touch][mouse->touch] buffer", {
428
445
  pointerId: e,
429
- actionName: He(l),
446
+ actionName: Ue(l),
430
447
  byteLength: A.byteLength
431
- }), q(A));
448
+ }), G(A));
432
449
  } else (t === "up" || t === "cancel") && k.current.delete(e);
433
- }, Ve = (e) => {
434
- if (ce.current !== e && (ce.current = e, Pt(e), e || _e(null), D("[rc-touch][alt] updateAltHeld", {
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
- }), Z === "ios" && w.current?.getState().controlReady)) {
438
- const t = e ? M.ACTION_DOWN : M.ACTION_UP, o = De(
454
+ }), q === "ios" && w.current?.getState().controlReady)) {
455
+ const t = e ? O.ACTION_DOWN : O.ACTION_UP, o = He(
439
456
  t,
440
- M.KEYCODE_ALT_LEFT,
457
+ O.KEYCODE_ALT_LEFT,
441
458
  0,
442
- M.META_NONE
459
+ O.META_NONE
443
460
  );
444
- D("[rc-touch][alt] sending Indigo modifier keycode", {
461
+ X("[rc-touch][alt] sending Indigo modifier keycode", {
445
462
  action: t,
446
- keycode: M.KEYCODE_ALT_LEFT
447
- }), o && q(o);
463
+ keycode: O.KEYCODE_ALT_LEFT
464
+ }), o && G(o);
448
465
  }
449
- }, Ee = () => {
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 I = i, A = l;
456
- s > f ? A = i / s : I = l * s;
457
- const X = (i - I) / 2, T = (l - A) / 2;
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: I,
480
+ actualWidth: M,
464
481
  actualHeight: A,
465
- offsetX: X,
482
+ offsetX: D,
466
483
  offsetY: T
467
484
  };
468
- }, Ae = (e, t, o) => {
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
- }, Ht = (e, t, o) => {
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, I = e.videoHeight - s, A = e.videoRect.left + e.offsetX, X = e.videoRect.top + e.offsetY, T = A - e.containerRect.left + a, Y = X - e.containerRect.top + i, he = A - e.containerRect.left + (e.actualWidth - a), x = X - e.containerRect.top + (e.actualHeight - i);
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: I,
515
+ mirrorVideoY: M,
499
516
  videoWidth: e.videoWidth,
500
517
  videoHeight: e.videoHeight
501
518
  };
502
- }, xt = (e, t, o, n, c, a, i) => {
503
- const l = cn(e, t, o, n, c, a, i);
504
- D("[rc-touch2] sendTwoFingerMessage (iOS)", {
505
- actionName: He(e),
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
- }), q(l);
511
- }, be = (e, t, o, n, c, a, i, l, s) => {
512
- if (D("[rc-touch2] applyTwoFingerEvent", {
513
- platform: Z,
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" && Ce.current.end(), Z === "ios") {
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
- xt(f, t, o, n, c, a, i);
537
+ Ft(f, t, o, n, c, a, i);
521
538
  } else
522
- e === "down" ? (we(g.ACTION_DOWN, l, t, o, n, c), we(g.ACTION_POINTER_DOWN, s, t, o, a, i)) : e === "move" ? (we(g.ACTION_MOVE, l, t, o, n, c), we(g.ACTION_MOVE, s, t, o, a, i)) : (we(g.ACTION_POINTER_UP, s, t, o, a, i), we(g.ACTION_UP, l, t, o, n, c));
523
- }, Ut = (e, t, o) => {
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 && _e(null);
542
+ se !== null && Pe(null);
526
543
  return;
527
544
  }
528
- const n = Ht(e, t, o);
529
- _e(n);
530
- }, $t = (e, t, o) => {
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 on(n, i, l);
553
+ return sn(n, i, l);
537
554
  }, ne = (e) => {
538
555
  if (K) return;
539
556
  e.preventDefault(), e.stopPropagation();
540
- const t = Ee();
557
+ const t = Me();
541
558
  if (($ === !0 || $ === "hover-only") && !("touches" in e))
542
559
  if (e.type === "mousemove") {
543
- if (lt({ x: e.clientX, y: e.clientY }), t) {
544
- const n = $t(t, e.clientX, e.clientY);
545
- Re(n?.id ?? null);
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" && (lt(null), Re(null));
548
- if ($ !== !0 && (!("touches" in e) && t && (e.type === "mousemove" ? Ut(t, e.clientX, e.clientY) : e.type === "mouseleave" && _e(null)), !(!w.current?.getState().controlReady || !P.current || !t)))
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 = Ae(t, i.clientX, i.clientY), f = Ae(t, l.clientX, l.clientY);
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 }, be(
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
- }, be(
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
- be(
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 = Ae(t, i.clientX, i.clientY);
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 = Ae(t, e.clientX, e.clientY);
659
+ const i = be(t, e.clientX, e.clientY);
643
660
  if (!i)
644
661
  return;
645
- D("[rc-touch][mouse] event", {
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 ? Ft(c, i) : ue(-1, c, i);
677
+ }), ce.current || a ? Kt(c, i) : ue(-1, c, i);
661
678
  }
662
679
  }
663
- }, Ft = (e, t) => {
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: Ye,
672
- pointerId1: Le
673
- }, P.current?.focus(), be(
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
- Ye,
682
- Le
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 }, be(
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
- Ye,
696
- Le
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: I, videoSize: A } = s;
704
- be(
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
- I.x,
711
- I.y,
712
- Ye,
713
- Le
727
+ M.x,
728
+ M.y,
729
+ De,
730
+ Xe
714
731
  ), E.current = null;
715
732
  }
716
733
  return;
717
734
  }
718
- }, zt = 150, mt = () => {
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
- }, Vt = (e) => {
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 = Ee();
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 = Ae(o, e.clientX, e.clientY);
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, I = (x) => {
734
- window.clearTimeout(x.endTimer), x.endTimer = window.setTimeout(mt, zt);
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 && I(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
- }), X = (x) => ({
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 = X(Y);
758
- he.videoX === Y.videoX && he.videoY === Y.videoY && (ue(de, "up", Y), Y = A(), ue(de, "down", Y), he = X(Y)), ue(de, "move", he), T.pos = he, I(T);
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
- Ce.current = { handle: Vt, end: mt };
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) => Ce.current.handle(o);
782
+ const t = (o) => Re.current.handle(o);
766
783
  return e.addEventListener("wheel", t, { passive: !1 }), () => {
767
- Ce.current.end(), e.removeEventListener("wheel", t);
784
+ Re.current.end(), e.removeEventListener("wheel", t);
768
785
  };
769
786
  }, []), F(() => {
770
787
  const e = (n) => {
771
- n.key === "Alt" && Ve(!0);
788
+ n.key === "Alt" && je(!0);
772
789
  }, t = (n) => {
773
- n.key === "Alt" && Ve(!1);
790
+ n.key === "Alt" && je(!1);
774
791
  }, o = () => {
775
- Ve(!1);
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 Xe = (e) => {
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 (D("Keyboard event:", {
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
- je("Simulator input not focused, skipping keyboard event");
809
+ Je("Simulator input not focused, skipping keyboard event");
793
810
  return;
794
811
  }
795
812
  if (!w.current?.getState().controlReady) {
796
- je("Data channel not ready for keyboard event:", w.current?.getState().connection);
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
- D("Paste shortcut detected"), navigator.clipboard.readText().then((n) => {
818
+ X("Paste shortcut detected"), navigator.clipboard.readText().then((n) => {
802
819
  if (n) {
803
- D(
820
+ X(
804
821
  "Pasting text via SET_CLIPBOARD:",
805
822
  n.substring(0, 20) + (n.length > 20 ? "..." : "")
806
823
  );
807
- const c = nn(n, !0);
808
- q(c);
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
- D("Menu shortcut detected");
817
- const n = De(
818
- M.ACTION_DOWN,
819
- M.MENU,
833
+ X("Menu shortcut detected");
834
+ const n = He(
835
+ O.ACTION_DOWN,
836
+ O.MENU,
820
837
  0,
821
- M.META_NONE
838
+ O.META_NONE
822
839
  // Modifiers are handled by the shortcut check, not passed down
823
840
  );
824
- q(n);
825
- const c = De(
826
- M.ACTION_UP,
827
- M.MENU,
841
+ G(n);
842
+ const c = He(
843
+ O.ACTION_UP,
844
+ O.MENU,
828
845
  0,
829
- M.META_NONE
846
+ O.META_NONE
830
847
  );
831
- q(c);
848
+ G(c);
832
849
  return;
833
850
  }
834
851
  }
835
- const o = En(e);
852
+ const o = _n(e);
836
853
  if (o) {
837
- const { keycode: n, metaState: c } = o, a = e.type === "keydown" ? M.ACTION_DOWN : M.ACTION_UP;
838
- D(`Sending Keycode: key=${e.key}, code=${n}, action=${a}, meta=${c}`);
839
- const i = De(
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
- q(i);
863
+ G(i);
847
864
  } else
848
- D(`Ignoring unhandled key event: type=${e.type}, key=${e.key}`);
849
- }, Kt = (e) => {
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 Ke = !!te;
890
+ const qe = !!te;
874
891
  F(() => {
875
- xe.current = null, nt(!1), rt(!1), it({});
876
- }, [r, p]), F(() => {
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, Ue(null), Te("onAxSnapshotChange", H.current.onAxSnapshotChange, null));
879
- const t = en({
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: Dt,
899
+ sessionId: xt,
883
900
  watchOnly: ie,
884
- deviceModel: p,
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: J,
908
+ androidElementTreeOptions: Q,
892
909
  microphoneEnabled: re,
893
910
  onStateChange: (n) => {
894
- (n.videoReady || n.connection === "idle" || n.connection === "connecting" || n.connection === "reconnecting") && Nt(n.videoReady), It(n.connection === "failed"), Mt(n.connection === "terminated"), bt(n.duo), Tt(n.duoState), Ct(n.duoError);
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 && (Ue((c) => tn(c, n) ? c : n), H.current.onAxSnapshotChange?.(n));
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: Ke ? (...n) => H.current.onTrace?.(...n) : void 0,
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,15 +927,16 @@ const Pn = ln(
910
927
  return t.start(), () => {
911
928
  e = !1, t.dispose(), o?.(), w.current = null;
912
929
  };
913
- }, [r, u, h, p, Ke, ie]), F(() => {
914
- if (K && Me.current)
915
- return w.current?.attachVideo(Me.current, "inner");
916
- }, [K, r, u, h, p, Ke, ie]), F(() => {
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({
935
+ token: u,
918
936
  openUrl: C,
919
937
  axPollIntervalMs: W,
920
938
  axMaxBackoffMs: y,
921
- androidElementTreeOptions: J,
939
+ androidElementTreeOptions: Q,
922
940
  autoReconnect: v,
923
941
  jitterBufferTargetMs: _,
924
942
  microphoneEnabled: re,
@@ -927,6 +945,7 @@ const Pn = ln(
927
945
  onCameraStats: j ? (...e) => H.current.onCameraStats?.(...e) : void 0
928
946
  });
929
947
  }, [
948
+ u,
930
949
  v,
931
950
  _,
932
951
  re,
@@ -936,13 +955,13 @@ const Pn = ln(
936
955
  C,
937
956
  W,
938
957
  y,
939
- J
958
+ Q
940
959
  ]);
941
- const Be = () => {
942
- if (!dt.current) return;
943
- const e = Ee();
960
+ const Ge = () => {
961
+ if (!ht.current) return;
962
+ const e = Me();
944
963
  if (!e) {
945
- st(null);
964
+ lt(null);
946
965
  return;
947
966
  }
948
967
  const t = {
@@ -951,36 +970,36 @@ const Pn = ln(
951
970
  width: e.actualWidth,
952
971
  height: e.actualHeight
953
972
  };
954
- st(
973
+ lt(
955
974
  (o) => o && o.left === t.left && o.top === t.top && o.width === t.width && o.height === t.height ? o : t
956
975
  );
957
976
  };
958
977
  F(() => {
959
- const e = P.current, t = Qe.current, o = Oe.current;
978
+ const e = P.current, t = tt.current, o = Oe.current;
960
979
  if (!e) return;
961
- const n = (l) => it((s) => In(s, l) ? s : l), c = () => {
980
+ const n = (l) => st((s) => Sn(s, l) ? s : l), c = () => {
962
981
  const l = e.videoWidth > 0 && e.videoHeight > 0;
963
- l && (xe.current = { width: e.videoWidth, height: e.videoHeight });
964
- const s = xe.current, f = s ? `${s.width} / ${s.height}` : void 0;
965
- if (!ke || !t) {
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) {
966
985
  n(
967
986
  !l && s ? {
968
987
  aspectRatio: f,
969
988
  contain: "size",
970
989
  containIntrinsicSize: `${s.width}px ${s.height}px`
971
990
  } : {}
972
- ), Be();
991
+ ), Ge();
973
992
  return;
974
993
  }
975
- const I = t.clientWidth, A = t.clientHeight;
976
- if (I === 0 || A === 0) return;
977
- const X = s ? s.width > s.height : !1;
978
- nt(X), rt(
979
- Z === "android" && !!s && Cn(s.width, s.height)
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)
980
999
  );
981
- const T = X ? ye.videoPosition.landscape : ye.videoPosition.portrait;
1000
+ const T = D ? ye.videoPosition.landscape : ye.videoPosition.portrait;
982
1001
  let Y = { aspectRatio: f };
983
- T.heightMultiplier ? (Y.height = `${A * T.heightMultiplier}px`, Y.width = "auto") : T.widthMultiplier && (Y.width = `${I * T.widthMultiplier}px`, Y.height = "auto"), Y.borderRadius = `${X ? A * ye.videoBorderRadiusMultiplier : I * ye.videoBorderRadiusMultiplier}px`, n(Y), Be();
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();
984
1003
  }, a = new ResizeObserver(() => {
985
1004
  c();
986
1005
  });
@@ -989,21 +1008,21 @@ const Pn = ln(
989
1008
  return e.addEventListener("resize", i), c(), () => {
990
1009
  a.disconnect(), e.removeEventListener("loadedmetadata", c), e.removeEventListener("resize", c), e.removeEventListener("resize", i), t && t.removeEventListener("load", c);
991
1010
  };
992
- }, [ye, ke, r, p]), F(() => {
993
- le ? Be() : (Ue(null), Re(null), Se(null), at(null), ge(null), Pe.current = null, Q.current !== void 0 && (window.cancelAnimationFrame(Q.current), Q.current = void 0));
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));
994
1013
  }, [le]), F(() => () => {
995
- Q.current !== void 0 && (window.cancelAnimationFrame(Q.current), Q.current = void 0);
1014
+ Z.current !== void 0 && (window.cancelAnimationFrame(Z.current), Z.current = void 0);
996
1015
  }, []), F(() => {
997
1016
  if (!le) return;
998
1017
  const e = (t) => {
999
- t.key === "Escape" && (Fe || $e) && (Se(null), Re(null), ge(null), Te("onInspectSelectionChange", ve.current, null));
1018
+ t.key === "Escape" && (Ke || Ve) && (ke(null), Ne(null), ge(null), Ce("onInspectSelectionChange", ve.current, null));
1000
1019
  };
1001
1020
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
1002
- }, [le, Fe, $e]);
1003
- const Bt = () => {
1021
+ }, [le, Ke, Ve]);
1022
+ const Gt = () => {
1004
1023
  P.current && P.current.focus();
1005
1024
  };
1006
- dn(Ge, () => ({
1025
+ fn(Ze, () => ({
1007
1026
  openUrl: (e) => w.current?.openUrl(e),
1008
1027
  sendKeyEvent: (e) => w.current?.sendKeyEvent(e),
1009
1028
  screenshot: (e) => w.current?.screenshot(e) ?? Promise.reject(new Error("Simulator disconnected")),
@@ -1012,16 +1031,16 @@ const Pn = ln(
1012
1031
  refreshAxTree: () => w.current?.refreshAxTree() ?? Promise.reject(new Error("Simulator disconnected")),
1013
1032
  getAxSnapshot: () => w.current?.getAxSnapshot() ?? null,
1014
1033
  setInspectHighlight: (e) => {
1015
- Re(e?.id ?? null);
1034
+ Ne(e?.id ?? null);
1016
1035
  },
1017
1036
  setInspectSelection: (e) => {
1018
- Se(e?.id ?? null), ge(e ? Pe.current : null);
1037
+ ke(e?.id ?? null), ge(e ? Ye.current : null);
1019
1038
  const t = ae.current;
1020
- e && t ? Te("onInspectSelectionChange", ve.current, { element: e, snapshot: t }) : Te("onInspectSelectionChange", ve.current, null);
1039
+ e && t ? Ce("onInspectSelectionChange", ve.current, { element: e, snapshot: t }) : Ce("onInspectSelectionChange", ve.current, null);
1021
1040
  },
1022
1041
  getAxStatus: () => w.current?.getAxStatus() ?? "idle"
1023
1042
  }));
1024
- const jt = St && se !== null;
1043
+ const Jt = Yt && se !== null;
1025
1044
  return /* @__PURE__ */ z(
1026
1045
  "div",
1027
1046
  {
@@ -1037,7 +1056,7 @@ const Pn = ln(
1037
1056
  onTouchEnd: ne,
1038
1057
  onTouchCancel: ne,
1039
1058
  children: [
1040
- jt && se && /* @__PURE__ */ z(yt, { children: [
1059
+ Jt && se && /* @__PURE__ */ z(bt, { children: [
1041
1060
  /* @__PURE__ */ m(
1042
1061
  "div",
1043
1062
  {
@@ -1059,13 +1078,13 @@ const Pn = ln(
1059
1078
  }
1060
1079
  )
1061
1080
  ] }),
1062
- ke && /* @__PURE__ */ m(
1081
+ Le && /* @__PURE__ */ m(
1063
1082
  "img",
1064
1083
  {
1065
- ref: Qe,
1066
- src: ut,
1084
+ ref: tt,
1085
+ src: pt,
1067
1086
  alt: "",
1068
- className: Z === "ios" ? "rc-phone-frame rc-phone-frame-ios" : "rc-phone-frame",
1087
+ className: q === "ios" ? "rc-phone-frame rc-phone-frame-ios" : "rc-phone-frame",
1069
1088
  draggable: !1
1070
1089
  }
1071
1090
  ),
@@ -1073,12 +1092,12 @@ const Pn = ln(
1073
1092
  "video",
1074
1093
  {
1075
1094
  ref: P,
1076
- className: ["rc-video", !ke && "rc-video-frameless", !Rt && "rc-video-loading"].filter(Boolean).join(" "),
1095
+ className: ["rc-video", !Le && "rc-video-frameless", !Mt && "rc-video-loading"].filter(Boolean).join(" "),
1077
1096
  style: {
1078
- ..._t,
1097
+ ...kt,
1079
1098
  ...K ? { opacity: 0, width: 1, height: 1, pointerEvents: "none" } : {},
1080
- ...ht ? {
1081
- backgroundImage: `url("${ht}")`,
1099
+ ...mt ? {
1100
+ backgroundImage: `url("${mt}")`,
1082
1101
  backgroundRepeat: "no-repeat",
1083
1102
  backgroundPosition: "center",
1084
1103
  backgroundSize: ye.loadingLogoSize
@@ -1088,9 +1107,9 @@ const Pn = ln(
1088
1107
  playsInline: !0,
1089
1108
  muted: !0,
1090
1109
  tabIndex: K ? -1 : 0,
1091
- onKeyDown: Xe,
1092
- onKeyUp: Xe,
1093
- onClick: Bt,
1110
+ onKeyDown: We,
1111
+ onKeyUp: We,
1112
+ onClick: Gt,
1094
1113
  onFocus: () => {
1095
1114
  P.current && (P.current.style.outline = "none");
1096
1115
  },
@@ -1102,72 +1121,72 @@ const Pn = ln(
1102
1121
  K && /* @__PURE__ */ m(
1103
1122
  "video",
1104
1123
  {
1105
- ref: Me,
1124
+ ref: Se,
1106
1125
  autoPlay: !0,
1107
1126
  playsInline: !0,
1108
1127
  muted: !0,
1109
1128
  style: { position: "absolute", width: 1, height: 1, opacity: 0, pointerEvents: "none" }
1110
1129
  }
1111
1130
  ),
1112
- K && Ze && /* @__PURE__ */ m(un, { fallback: /* @__PURE__ */ m("div", { children: "Loading iPhone Duo…" }), children: /* @__PURE__ */ m(
1113
- Tn,
1131
+ K && nt && /* @__PURE__ */ m(pn, { fallback: /* @__PURE__ */ m("div", { children: "Loading iPhone Duo…" }), children: /* @__PURE__ */ m(
1132
+ Nn,
1114
1133
  {
1115
1134
  watchOnly: ie,
1116
1135
  showFrame: R,
1117
1136
  modelUrl: U,
1118
1137
  outer: P.current,
1119
- inner: Me.current,
1120
- state: Ze,
1121
- setAngle: (e) => ze("setHingeAngle", { angleDegrees: e }),
1122
- setOrientation: (e) => ze("setDuoOrientation", { orientation: e }),
1123
- button: (e, t) => ze("performActions", {
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", {
1124
1143
  actions: [{ type: t ? "buttonDown" : "buttonUp", button: e }]
1125
1144
  }),
1126
1145
  touch: (e, t, o, n) => {
1127
1146
  w.current?.sendDisplayTouch(e, t, o, n);
1128
1147
  },
1129
- onKeyDown: Xe,
1130
- onKeyUp: Xe
1148
+ onKeyDown: We,
1149
+ onKeyUp: We
1131
1150
  }
1132
1151
  ) }),
1133
- K && et && /* @__PURE__ */ m("div", { role: "alert", className: "rc-duo-error", children: et }),
1152
+ K && ot && /* @__PURE__ */ m("div", { role: "alert", className: "rc-duo-error", children: ot }),
1134
1153
  !K && le && /* @__PURE__ */ m(
1135
- An,
1154
+ Cn,
1136
1155
  {
1137
- snapshot: ct,
1138
- geometry: kt,
1139
- highlightedId: $e,
1140
- selectedId: Fe,
1141
- mode: Xt,
1142
- cursorPosition: Yt,
1143
- frozenCursorPosition: Lt,
1156
+ snapshot: at,
1157
+ geometry: Dt,
1158
+ highlightedId: Ve,
1159
+ selectedId: Ke,
1160
+ mode: Ht,
1161
+ cursorPosition: Xt,
1162
+ frozenCursorPosition: Wt,
1144
1163
  onSelectChange: (e, t) => {
1145
- Se(e?.id ?? null), e && t ? ge(t) : e || ge(null);
1164
+ ke(e?.id ?? null), e && t ? ge(t) : e || ge(null);
1146
1165
  const o = ae.current;
1147
- e && o ? Te("onInspectSelectionChange", ve.current, {
1166
+ e && o ? Ce("onInspectSelectionChange", ve.current, {
1148
1167
  element: e,
1149
1168
  snapshot: o
1150
- }) : Te("onInspectSelectionChange", ve.current, null);
1169
+ }) : Ce("onInspectSelectionChange", ve.current, null);
1151
1170
  },
1152
1171
  onTapElement: ie ? void 0 : ((e, t) => {
1153
1172
  if (t) {
1154
- pt(t.x, t.y);
1173
+ vt(t.x, t.y);
1155
1174
  return;
1156
1175
  }
1157
1176
  const o = ae.current;
1158
- o && Wt(e, o);
1177
+ o && Ut(e, o);
1159
1178
  })
1160
1179
  }
1161
1180
  ),
1162
- Ot ? /* @__PURE__ */ z("div", { className: "rc-terminated", role: "status", children: [
1181
+ St ? /* @__PURE__ */ z("div", { className: "rc-terminated", role: "status", children: [
1163
1182
  /* @__PURE__ */ m("div", { className: "rc-terminated-title", children: "Instance terminated" }),
1164
1183
  /* @__PURE__ */ m("div", { className: "rc-terminated-message", children: "This instance no longer exists and can't be reconnected." })
1165
- ] }) : Et && /* @__PURE__ */ m("button", { type: "button", className: "rc-retry-button", onClick: Kt, children: "Retry" })
1184
+ ] }) : Ot && /* @__PURE__ */ m("button", { type: "button", className: "rc-retry-button", onClick: qt, children: "Retry" })
1166
1185
  ]
1167
1186
  }
1168
1187
  );
1169
1188
  }
1170
1189
  );
1171
1190
  export {
1172
- Pn as R
1191
+ Dn as R
1173
1192
  };