@tapflowio/relay 0.27.0 → 0.27.1

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.
Files changed (136) hide show
  1. package/dist/RelayServer.d.ts +20 -0
  2. package/dist/RelayServer.d.ts.map +1 -1
  3. package/dist/RelayServer.js +98 -6
  4. package/dist/RelayServer.js.map +1 -1
  5. package/dist/api/builds.d.ts.map +1 -1
  6. package/dist/api/builds.js +13 -8
  7. package/dist/api/builds.js.map +1 -1
  8. package/dist/api/comments.d.ts.map +1 -1
  9. package/dist/api/comments.js +5 -7
  10. package/dist/api/comments.js.map +1 -1
  11. package/dist/api/invitations.d.ts.map +1 -1
  12. package/dist/api/invitations.js +3 -0
  13. package/dist/api/invitations.js.map +1 -1
  14. package/dist/api/profile.d.ts.map +1 -1
  15. package/dist/api/profile.js +28 -9
  16. package/dist/api/profile.js.map +1 -1
  17. package/dist/api/recordings.d.ts.map +1 -1
  18. package/dist/api/recordings.js +5 -6
  19. package/dist/api/recordings.js.map +1 -1
  20. package/dist/api/settings.d.ts.map +1 -1
  21. package/dist/api/settings.js +28 -9
  22. package/dist/api/settings.js.map +1 -1
  23. package/dist/lib/clientAddress.d.ts +12 -0
  24. package/dist/lib/clientAddress.d.ts.map +1 -1
  25. package/dist/lib/clientAddress.js +22 -0
  26. package/dist/lib/clientAddress.js.map +1 -1
  27. package/dist/lib/uploads.d.ts +13 -0
  28. package/dist/lib/uploads.d.ts.map +1 -1
  29. package/dist/lib/uploads.js +41 -0
  30. package/dist/lib/uploads.js.map +1 -1
  31. package/package.json +3 -3
  32. package/public/assets/{AppCenter-BMdYtQbV.js → AppCenter-CeLjUbnR.js} +1 -1
  33. package/public/assets/AppCenter-CeLjUbnR.js.br +0 -0
  34. package/public/assets/AppCenter-CeLjUbnR.js.gz +0 -0
  35. package/public/assets/{Default-0DHHVGaN.js → Default-UB0Pa3lN.js} +1 -1
  36. package/public/assets/Default-UB0Pa3lN.js.br +0 -0
  37. package/public/assets/Default-UB0Pa3lN.js.gz +0 -0
  38. package/public/assets/{Invite-C0ZB_HiU.js → Invite-Dv3omu3x.js} +1 -1
  39. package/public/assets/Invite-Dv3omu3x.js.br +0 -0
  40. package/public/assets/Invite-Dv3omu3x.js.gz +0 -0
  41. package/public/assets/{MacResources-DmY5pRV2.js → MacResources-CY4-OdGt.js} +1 -1
  42. package/public/assets/MacResources-CY4-OdGt.js.br +0 -0
  43. package/public/assets/MacResources-CY4-OdGt.js.gz +0 -0
  44. package/public/assets/QASession-H5eRSwZv.js +150 -0
  45. package/public/assets/QASession-H5eRSwZv.js.br +0 -0
  46. package/public/assets/QASession-H5eRSwZv.js.gz +0 -0
  47. package/public/assets/{ResetPassword-jNRuertx.js → ResetPassword-nFTigYt2.js} +1 -1
  48. package/public/assets/ResetPassword-nFTigYt2.js.br +0 -0
  49. package/public/assets/ResetPassword-nFTigYt2.js.gz +0 -0
  50. package/public/assets/{Setup-CF_FN9Dt.js → Setup-UmLtF2PF.js} +1 -1
  51. package/public/assets/Setup-UmLtF2PF.js.br +0 -0
  52. package/public/assets/Setup-UmLtF2PF.js.gz +0 -0
  53. package/public/assets/{Team-BbiyOGau.js → Team-DW40kt3H.js} +1 -1
  54. package/public/assets/Team-DW40kt3H.js.br +0 -0
  55. package/public/assets/Team-DW40kt3H.js.gz +0 -0
  56. package/public/assets/{Tokens-CZo4sPTx.js → Tokens-B1a4ChJK.js} +1 -1
  57. package/public/assets/Tokens-B1a4ChJK.js.br +0 -0
  58. package/public/assets/Tokens-B1a4ChJK.js.gz +0 -0
  59. package/public/assets/{alert-dialog-DFz8G_zu.js → alert-dialog-aoqYdAwx.js} +1 -1
  60. package/public/assets/alert-dialog-aoqYdAwx.js.br +0 -0
  61. package/public/assets/alert-dialog-aoqYdAwx.js.gz +0 -0
  62. package/public/assets/{badge-B3vaBVIQ.js → badge-DNaS0Mu3.js} +1 -1
  63. package/public/assets/badge-DNaS0Mu3.js.br +0 -0
  64. package/public/assets/badge-DNaS0Mu3.js.gz +0 -0
  65. package/public/assets/{build-format-dbQPU3A4.js → build-format-DF5aFcag.js} +1 -1
  66. package/public/assets/build-format-DF5aFcag.js.br +0 -0
  67. package/public/assets/build-format-DF5aFcag.js.gz +0 -0
  68. package/public/assets/{dialog-DeBPk-I3.js → dialog-DE2WUMuX.js} +1 -1
  69. package/public/assets/dialog-DE2WUMuX.js.br +0 -0
  70. package/public/assets/dialog-DE2WUMuX.js.gz +0 -0
  71. package/public/assets/{field-hint-CMKmbVpy.js → field-hint-Csb40Gzp.js} +1 -1
  72. package/public/assets/field-hint-Csb40Gzp.js.br +2 -0
  73. package/public/assets/field-hint-Csb40Gzp.js.gz +0 -0
  74. package/public/assets/index-BbCkTtjO.css +1 -0
  75. package/public/assets/index-BbCkTtjO.css.br +0 -0
  76. package/public/assets/index-BbCkTtjO.css.gz +0 -0
  77. package/public/assets/{index-B4w4Lh3e.js → index-DSW9h8XX.js} +2 -2
  78. package/public/assets/index-DSW9h8XX.js.br +0 -0
  79. package/public/assets/index-DSW9h8XX.js.gz +0 -0
  80. package/public/assets/{list-view-BvINA5t4.js → list-view-C0w97ltJ.js} +1 -1
  81. package/public/assets/list-view-C0w97ltJ.js.br +0 -0
  82. package/public/assets/list-view-C0w97ltJ.js.gz +0 -0
  83. package/public/assets/{pencil-CycAOoC_.js → pencil-BN18R4oa.js} +1 -1
  84. package/public/assets/pencil-BN18R4oa.js.br +0 -0
  85. package/public/assets/pencil-BN18R4oa.js.gz +0 -0
  86. package/public/assets/{resource-health-C1qSG3MK.js → resource-health-Bi20EUDs.js} +1 -1
  87. package/public/assets/resource-health-Bi20EUDs.js.br +0 -0
  88. package/public/assets/resource-health-Bi20EUDs.js.gz +0 -0
  89. package/public/assets/{trash-BXQnOI5U.js → trash-D1l1Fm-Z.js} +1 -1
  90. package/public/assets/trash-D1l1Fm-Z.js.br +0 -0
  91. package/public/assets/trash-D1l1Fm-Z.js.gz +0 -0
  92. package/public/index.html +2 -2
  93. package/public/index.html.br +0 -0
  94. package/public/index.html.gz +0 -0
  95. package/public/assets/AppCenter-BMdYtQbV.js.br +0 -0
  96. package/public/assets/AppCenter-BMdYtQbV.js.gz +0 -0
  97. package/public/assets/Default-0DHHVGaN.js.br +0 -0
  98. package/public/assets/Default-0DHHVGaN.js.gz +0 -0
  99. package/public/assets/Invite-C0ZB_HiU.js.br +0 -0
  100. package/public/assets/Invite-C0ZB_HiU.js.gz +0 -0
  101. package/public/assets/MacResources-DmY5pRV2.js.br +0 -0
  102. package/public/assets/MacResources-DmY5pRV2.js.gz +0 -0
  103. package/public/assets/QASession-2QogWEX7.js +0 -150
  104. package/public/assets/QASession-2QogWEX7.js.br +0 -0
  105. package/public/assets/QASession-2QogWEX7.js.gz +0 -0
  106. package/public/assets/ResetPassword-jNRuertx.js.br +0 -0
  107. package/public/assets/ResetPassword-jNRuertx.js.gz +0 -0
  108. package/public/assets/Setup-CF_FN9Dt.js.br +0 -0
  109. package/public/assets/Setup-CF_FN9Dt.js.gz +0 -0
  110. package/public/assets/Team-BbiyOGau.js.br +0 -0
  111. package/public/assets/Team-BbiyOGau.js.gz +0 -0
  112. package/public/assets/Tokens-CZo4sPTx.js.br +0 -0
  113. package/public/assets/Tokens-CZo4sPTx.js.gz +0 -0
  114. package/public/assets/alert-dialog-DFz8G_zu.js.br +0 -0
  115. package/public/assets/alert-dialog-DFz8G_zu.js.gz +0 -0
  116. package/public/assets/badge-B3vaBVIQ.js.br +0 -0
  117. package/public/assets/badge-B3vaBVIQ.js.gz +0 -0
  118. package/public/assets/build-format-dbQPU3A4.js.br +0 -0
  119. package/public/assets/build-format-dbQPU3A4.js.gz +0 -0
  120. package/public/assets/dialog-DeBPk-I3.js.br +0 -0
  121. package/public/assets/dialog-DeBPk-I3.js.gz +0 -0
  122. package/public/assets/field-hint-CMKmbVpy.js.br +0 -0
  123. package/public/assets/field-hint-CMKmbVpy.js.gz +0 -0
  124. package/public/assets/index-B4w4Lh3e.js.br +0 -0
  125. package/public/assets/index-B4w4Lh3e.js.gz +0 -0
  126. package/public/assets/index-CDWu0GQL.css +0 -1
  127. package/public/assets/index-CDWu0GQL.css.br +0 -0
  128. package/public/assets/index-CDWu0GQL.css.gz +0 -0
  129. package/public/assets/list-view-BvINA5t4.js.br +0 -0
  130. package/public/assets/list-view-BvINA5t4.js.gz +0 -0
  131. package/public/assets/pencil-CycAOoC_.js.br +0 -0
  132. package/public/assets/pencil-CycAOoC_.js.gz +0 -0
  133. package/public/assets/resource-health-C1qSG3MK.js.br +0 -0
  134. package/public/assets/resource-health-C1qSG3MK.js.gz +0 -0
  135. package/public/assets/trash-BXQnOI5U.js.br +0 -0
  136. package/public/assets/trash-BXQnOI5U.js.gz +0 -0
@@ -0,0 +1,150 @@
1
+ import{f as ae,k as a,j as i}from"./vendor-react-BlPSzrEe.js";import{a6 as De,ae as si,a0 as Me,T as $t,O as Ft,K as Ut,B as Xe,N as ts,S as Us,aA as Ht,u as oi,aG as tr,z as nr,a4 as Hs,aF as gr,aM as ii,aI as li,y as Yr,a1 as On,aO as zs,aN as Os,ag as ai,av as Kr,U as ci,aj as di,H as ui,f as fi,aP as hi,aH as pi,aE as mi,L as gi}from"./index-DSW9h8XX.js";import{u as Bs,n as Ce,c as ws,b as bi,a as vs,T as xi,R as yi,g as wi}from"./resource-health-Bi20EUDs.js";import{c as Ws,b as vi}from"./vendor-router-B_lVHrKl.js";import{A as Si,c as Ri,f as _i,g as ki,d as ji,e as Ei,b as Ci,a as Ti}from"./alert-dialog-aoqYdAwx.js";import{e as Vs,d as Ai,b as Ni,a as qs,c as Ii,D as Ks,k as Pi,S as Di,i as Mi,j as Li,g as $i,h as Xs}from"./dialog-DE2WUMuX.js";import{a as Fi,P as Ys,b as Ui,c as Ss,S as Hi}from"./build-format-DF5aFcag.js";import{l as Rs,j as zi}from"./publicLink-D6zKS_wu.js";import{B as Oi}from"./badge-DNaS0Mu3.js";/**
2
+ * @license lucide-react v1.48.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Gs={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};Gs.node;const Bi=De(Gs);/**
7
+ * @license lucide-react v1.48.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const Qs={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]};Qs.node;const Wi=De(Qs);/**
12
+ * @license lucide-react v1.48.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const Js={name:"camera",size:24,node:[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]};Js.node;const Vi=De(Js);/**
17
+ * @license lucide-react v1.48.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const Zs={name:"download",size:24,node:[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]};Zs.node;const qi=De(Zs);/**
22
+ * @license lucide-react v1.48.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const eo={name:"film",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]};eo.node;const Ki=De(eo);/**
27
+ * @license lucide-react v1.48.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const to={name:"fold-horizontal",size:24,node:[["path",{d:"M2 12h6",key:"1wqiqv"}],["path",{d:"M22 12h-6",key:"1eg9hc"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m19 9-3 3 3 3",key:"12ol22"}],["path",{d:"m5 15 3-3-3-3",key:"1kdhjc"}]]};to.node;const Xi=De(to);/**
32
+ * @license lucide-react v1.48.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const no={name:"house",size:24,node:[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],aliases:["home"]};no.node;const ro=De(no);/**
37
+ * @license lucide-react v1.48.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const so={name:"image-plus",size:24,node:[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]};so.node;const Yi=De(so);/**
42
+ * @license lucide-react v1.48.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */const oo={name:"keyboard",size:24,node:[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]};oo.node;const Gi=De(oo);/**
47
+ * @license lucide-react v1.48.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */const io={name:"link-2",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]};io.node;const lo=De(io);/**
52
+ * @license lucide-react v1.48.0 - ISC
53
+ *
54
+ * This source code is licensed under the ISC license.
55
+ * See the LICENSE file in the root directory of this source tree.
56
+ */const ao={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]};ao.node;const br=De(ao);/**
57
+ * @license lucide-react v1.48.0 - ISC
58
+ *
59
+ * This source code is licensed under the ISC license.
60
+ * See the LICENSE file in the root directory of this source tree.
61
+ */const co={name:"message-square",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]};co.node;const Qi=De(co);/**
62
+ * @license lucide-react v1.48.0 - ISC
63
+ *
64
+ * This source code is licensed under the ISC license.
65
+ * See the LICENSE file in the root directory of this source tree.
66
+ */const uo={name:"power",size:24,node:[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]};uo.node;const Ji=De(uo);/**
67
+ * @license lucide-react v1.48.0 - ISC
68
+ *
69
+ * This source code is licensed under the ISC license.
70
+ * See the LICENSE file in the root directory of this source tree.
71
+ */const fo={name:"radio-off",size:24,node:[["path",{d:"M13.414 13.414a2 2 0 1 1-2.828-2.828",key:"srl686"}],["path",{d:"M16.247 7.761a6 6 0 0 1 1.744 4.572",key:"1h86sp"}],["path",{d:"M19.075 4.933a10 10 0 0 1 2.234 10.72",key:"1n13k4"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}]]};fo.node;const Zi=De(fo);/**
72
+ * @license lucide-react v1.48.0 - ISC
73
+ *
74
+ * This source code is licensed under the ISC license.
75
+ * See the LICENSE file in the root directory of this source tree.
76
+ */const ho={name:"radio",size:24,node:[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]};ho.node;const Qr=De(ho);/**
77
+ * @license lucide-react v1.48.0 - ISC
78
+ *
79
+ * This source code is licensed under the ISC license.
80
+ * See the LICENSE file in the root directory of this source tree.
81
+ */const po={name:"refresh-cw",size:24,node:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]};po.node;const el=De(po);/**
82
+ * @license lucide-react v1.48.0 - ISC
83
+ *
84
+ * This source code is licensed under the ISC license.
85
+ * See the LICENSE file in the root directory of this source tree.
86
+ */const mo={name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]};mo.node;const tl=De(mo);/**
87
+ * @license lucide-react v1.48.0 - ISC
88
+ *
89
+ * This source code is licensed under the ISC license.
90
+ * See the LICENSE file in the root directory of this source tree.
91
+ */const go={name:"scan-line",size:24,node:[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 12h10",key:"b7w52i"}]]};go.node;const nl=De(go);/**
92
+ * @license lucide-react v1.48.0 - ISC
93
+ *
94
+ * This source code is licensed under the ISC license.
95
+ * See the LICENSE file in the root directory of this source tree.
96
+ */const bo={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};bo.node;const rl=De(bo);/**
97
+ * @license lucide-react v1.48.0 - ISC
98
+ *
99
+ * This source code is licensed under the ISC license.
100
+ * See the LICENSE file in the root directory of this source tree.
101
+ */const xo={name:"unfold-horizontal",size:24,node:[["path",{d:"M16 12h6",key:"15xry1"}],["path",{d:"M8 12H2",key:"1jqql6"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m19 15 3-3-3-3",key:"wjy7rq"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}]]};xo.node;const sl=De(xo);/**
102
+ * @license lucide-react v1.48.0 - ISC
103
+ *
104
+ * This source code is licensed under the ISC license.
105
+ * See the LICENSE file in the root directory of this source tree.
106
+ */const yo={name:"video",size:24,node:[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]};yo.node;const ol=De(yo);/**
107
+ * @license lucide-react v1.48.0 - ISC
108
+ *
109
+ * This source code is licensed under the ISC license.
110
+ * See the LICENSE file in the root directory of this source tree.
111
+ */const wo={name:"volume-1",size:24,node:[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}]]};wo.node;const il=De(wo);/**
112
+ * @license lucide-react v1.48.0 - ISC
113
+ *
114
+ * This source code is licensed under the ISC license.
115
+ * See the LICENSE file in the root directory of this source tree.
116
+ */const vo={name:"volume-2",size:24,node:[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]};vo.node;const ll=De(vo);function al(n){const e=ae.c(5),[t,s]=a.useState(null);let r,o;e[0]!==n?(r=()=>{n&&si(n).then(s)},o=[n],e[0]=n,e[1]=r,e[2]=o):(r=e[1],o=e[2]),a.useEffect(r,o);let l;return e[3]!==t?(l={build:t},e[3]=t,e[4]=l):l=e[4],l}function cl(n){const e=ae.c(43);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0];const[s,r]=a.useState(t),[o,l]=a.useState(null),[c,u]=a.useState(null),[d,f]=a.useState(""),[p,m]=a.useState(void 0),[g,x]=a.useState(!1),[h,E]=a.useState("");let w;e[1]!==c||e[2]!==d?(w={sessionId:c,deviceId:d},e[1]=c,e[2]=d,e[3]=w):w=e[3];const T=a.useRef(w);let C,v;e[4]!==c||e[5]!==d?(C=()=>{T.current={sessionId:c,deviceId:d}},v=[c,d],e[4]=c,e[5]=d,e[6]=C,e[7]=v):(C=e[6],v=e[7]),a.useEffect(C,v);let j;e[8]===Symbol.for("react.memo_cache_sentinel")?(j=q=>{var J;if(q.type==="agents:listed"){r(q.sessions);const{deviceId:fe}=T.current,me=fe?(J=q.sessions.flatMap(dl).find(O=>O.id===fe))==null?void 0:J.formFactor:void 0;me&&m(me)}q.type==="session:joined"&&(x(!1),E("Connected")),q.type==="error"&&(x(!1),E(`Error: ${q.message}`))},e[8]=j):j=e[8];const N=j,{send:S,connected:k}=Bs(N);let D,I;e[9]!==k||e[10]!==S?(D=()=>{if(!k)return;S({type:"agents:list"});const q=setInterval(()=>S({type:"agents:list"}),5e3);return()=>clearInterval(q)},I=[k,S],e[9]=k,e[10]=S,e[11]=D,e[12]=I):(D=e[11],I=e[12]),a.useEffect(D,I);let M,$;e[13]!==S?(M=()=>()=>{const{sessionId:q,deviceId:J}=T.current;q&&J&&S({type:"device:shutdown",sessionId:q,payload:{deviceId:J}})},$=[S],e[13]=S,e[14]=M,e[15]=$):(M=e[14],$=e[15]),a.useEffect(M,$);let V;if(e[16]!==n||e[17]!==s){let q;e[19]!==n?(q=J=>J.devices.some(fe=>fe.platform===n),e[19]=n,e[20]=q):q=e[20],V=s.filter(q),e[16]=n,e[17]=s,e[18]=V}else V=e[18];const z=V;let H;e[21]===Symbol.for("react.memo_cache_sentinel")?(H=q=>{m(q.formFactor),f(q.id),x(!0),E("Booting…"),u(q.sessionId)},e[21]=H):H=e[21];const W=H;let te;e[22]===Symbol.for("react.memo_cache_sentinel")?(te=()=>f(""),e[22]=te):te=e[22];const K=te;let Z;e[23]!==S?(Z=()=>{const{sessionId:q,deviceId:J}=T.current;q&&J&&S({type:"device:shutdown",sessionId:q,payload:{deviceId:J}}),u(null),x(!1),E("")},e[23]=S,e[24]=Z):Z=e[24];const G=Z;let Q;e[25]!==S?(Q=()=>{const{sessionId:q,deviceId:J}=T.current;q&&J&&S({type:"device:shutdown",sessionId:q,payload:{deviceId:J}}),u(null),l(null),x(!1),E(""),S({type:"agents:list"})},e[25]=S,e[26]=Q):Q=e[26];const re=Q;let F;e[27]!==S?(F=()=>{u(null),l(null),x(!1),E(""),S({type:"agents:list"})},e[27]=S,e[28]=F):F=e[28];const pe=F;let de;return e[29]!==p||e[30]!==c||e[31]!==z||e[32]!==g||e[33]!==k||e[34]!==d||e[35]!==G||e[36]!==re||e[37]!==pe||e[38]!==o||e[39]!==S||e[40]!==s||e[41]!==h?(de={sessions:s,activeFormFactor:p,selectedAgent:o,setSelectedAgent:l,activeSessionId:c,deviceId:d,booting:g,status:h,send:S,connected:k,agentGroups:z,startDevice:W,resetDevice:K,handleBack:G,handleBackToMacs:re,handleSessionEnded:pe},e[29]=p,e[30]=c,e[31]=z,e[32]=g,e[33]=k,e[34]=d,e[35]=G,e[36]=re,e[37]=pe,e[38]=o,e[39]=S,e[40]=s,e[41]=h,e[42]=de):de=e[42],de}function dl(n){return n.devices}function ul(n,e){const t=ae.c(24),[s,r]=a.useState(""),[o,l]=a.useState(""),[c,u]=a.useState("app-only"),[d,f]=a.useState("app-only");let p;t[0]!==(n==null?void 0:n.capabilities)?(p=(n==null?void 0:n.capabilities.includes("full-reset"))??!1,t[0]=n==null?void 0:n.capabilities,t[1]=p):p=t[1];const m=p;let g;t[2]!==m||t[3]!==c?(g=()=>{f(m?c:"app-only"),u("app-only")},t[2]=m,t[3]=c,t[4]=g):g=t[4];const x=g;let h,E,w;if(t[5]!==o||t[6]!==e||t[7]!==s||t[8]!==(n==null?void 0:n.devices)){h=(n==null?void 0:n.devices.filter(j=>j.platform===e))??[],E=[...new Set(h.map(pl).filter(Boolean))].sort(fl);let v;t[12]!==o?(v=j=>!o||j.name.toLowerCase().includes(o.toLowerCase()),t[12]=o,t[13]=v):v=t[13],w=(s?h.filter(j=>j.osVersion===s):h).filter(v),t[5]=o,t[6]=e,t[7]=s,t[8]=n==null?void 0:n.devices,t[9]=h,t[10]=E,t[11]=w}else h=t[9],E=t[10],w=t[11];const T=w;let C;return t[14]!==d||t[15]!==x||t[16]!==o||t[17]!==h||t[18]!==m||t[19]!==s||t[20]!==E||t[21]!==c||t[22]!==T?(C={filteredDevices:h,osVersions:E,osVersion:s,setOsVersion:r,deviceSearch:o,setDeviceSearch:l,versionedDevices:T,resetMode:c,setResetMode:u,appliedResetMode:d,consumeResetMode:x,fullResetSupported:m},t[14]=d,t[15]=x,t[16]=o,t[17]=h,t[18]=m,t[19]=s,t[20]=E,t[21]=c,t[22]=T,t[23]=C):C=t[23],C}function fl(n,e){const t=hl,[s,r]=[t(n),t(e)];for(let o=0;o<Math.max(s.length,r.length);o++){const l=(r[o]??0)-(s[o]??0);if(l!==0)return l}return 0}function hl(n){return n.replace(/^[^\d]*/,"").split(".").map(Number)}function pl(n){return n.osVersion}const ml={width:324,height:720},_s={width:540,height:720};function ks(n,e){return n==="foldable"?_s:n!=="tablet"?ml:e==="android"?{width:720,height:450}:_s}const gl="iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVR4nGNgAAIAAAUAAXpeqz8AAAAASUVORK5CYII=",js=1500,Es=new Map,So=new WeakSet;function bl(n){const e=js,t=Math.round(js*n.width/n.height),s=`${t}x${e}`,r=Es.get(s);if(r)return r;const o={framePng:gl,bezelWidth:t,bezelHeight:e,compositeWidth:t,compositeHeight:e,padding:{left:0,right:0,top:0,bottom:0},screenRect:{x:0,y:0,width:t,height:e},screenCornerRadius:Math.round(t*(t/e>.6?.03:.12)),logicalWidth:Math.round(t/2),logicalHeight:Math.round(e/2),buttons:[]};return Es.set(s,o),So.add(o),o}function xl(n){return So.has(n)}function yl(){const n=ae.c(8),[e]=Ws();let t;n[0]!==e?(t=e.get("perf"),n[0]=e,n[1]=t):t=n[1];const s=t==="1",[r,o]=a.useState(!1),[l,c]=a.useState(s);l!==s&&(c(s),s||o(!1));let u,d;n[2]!==s?(u=()=>{if(!s)return;const m=g=>{g.ctrlKey&&g.shiftKey&&g.key==="P"&&o(wl)};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},d=[s],n[2]=s,n[3]=u,n[4]=d):(u=n[3],d=n[4]),a.useEffect(u,d);const f=s&&!r;let p;return n[5]!==s||n[6]!==f?(p={perfMode:s,visible:f},n[5]=s,n[6]=f,n[7]=p):p=n[7],p}function wl(n){return!n}function ls(n){const e=n.rolloverOffset.x-n.buttonW/2,t=n.anchor==="top"?n.rolloverOffset.y:n.normalOffset.y-n.buttonH/2;return{left:e,top:t,right:e+n.buttonW,bottom:t+n.buttonH}}function vl(n,e){return n.map(t=>{const s=ls(t);if(t.onTop)return s;const r=(s.left+s.right)/2,o=(s.top+s.bottom)/2;switch(t.anchor){case"left":return{...s,left:0,right:r};case"right":return{...s,left:r,right:e.width};case"top":return{...s,top:0,bottom:o};case"bottom":return{...s,top:o,bottom:e.height};default:return s}})}const Sl=12,Rl=233,_l=234;function kl(n,e,t,s){const r=n.map(m=>m.accessibilityTitle);if(s!=="tablet")return r;const o=m=>n.findIndex(g=>g.usagePage===Sl&&g.usage===m),l=o(Rl),c=o(_l);if(l<0||c<0)return r;const u=m=>{const g=ls(m),x=(g.left+g.right)/2,h=(g.top+g.bottom)/2;return t?{x:h,y:e.width-x}:{x,y:h}},d=u(n[l]),f=u(n[c]);return(Math.abs(d.x-f.x)>Math.abs(d.y-f.y)?d.x>f.x:d.y<f.y)||([r[l],r[c]]=[r[c],r[l]]),r}const jl=["video/mp4;codecs=avc1","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"];function Ro({sessionId:n,buildId:e,onRecordingUploaded:t}){const[s,r]=a.useState("idle"),o=a.useRef(null),l=a.useRef(t);a.useEffect(()=>{l.current=t},[t]);const c=a.useRef(!1),u=a.useRef(null),d=a.useRef([]),f=a.useRef(""),p=a.useRef(0),m=a.useRef(null),g=a.useCallback(function w(){var T;c.current&&((T=m.current)==null||T.call(m),p.current=requestAnimationFrame(w))},[]),x=a.useCallback(w=>{m.current=w},[]),h=a.useCallback(()=>{const w=o.current;if(!w)return;const T=w.getContext("2d");T&&(T.fillStyle="#000",T.fillRect(0,0,w.width,w.height));const C=jl.find(j=>MediaRecorder.isTypeSupported(j))??"";if(!C)return;f.current=C,d.current=[];const v=new MediaRecorder(w.captureStream(30),{mimeType:C});v.ondataavailable=j=>{j.data.size>0&&d.current.push(j.data)},u.current=v,v.start(1e3),c.current=!0,p.current=requestAnimationFrame(g),r("recording")},[g]),E=a.useCallback(async()=>{var N;r("uploading"),c.current=!1,cancelAnimationFrame(p.current);const w=u.current;if(!w){r("idle");return}await new Promise(S=>{const k=setTimeout(S,5e3);w.onstop=()=>{clearTimeout(k),S()};try{w.stop()}catch{clearTimeout(k),S()}}),u.current=null;const T=f.current,C=T.includes("mp4")?".mp4":".webm",v=new Blob(d.current,{type:T});d.current=[];const j=new FormData;j.append("file",v,`tapflow-${Date.now()}${C}`);try{const S=new URLSearchParams({sessionId:n});e&&S.set("buildId",String(e));const k=await fetch(`/api/v1/recordings/upload?${S}`,{method:"POST",credentials:"include",body:j}),D=await k.json();if(k.ok&&D.url){const I=document.createElement("a");I.href=D.url,I.download="",I.click(),(N=l.current)==null||N.call(l),r("done"),setTimeout(()=>r("idle"),2e3)}else r("idle")}catch{r("idle")}},[n,e]);return a.useEffect(()=>{if(s!=="recording")return;const w=()=>{document.visibilityState==="hidden"&&E()};return document.addEventListener("visibilitychange",w),()=>{var T;document.removeEventListener("visibilitychange",w),c.current&&(c.current=!1,cancelAnimationFrame(p.current),(T=u.current)==null||T.stop(),u.current=null)}},[s,E]),{recordState:s,recordCanvasRef:o,setComposeFrame:x,startClientRecording:h,stopClientRecording:E}}function _o(){const n=ae.c(4),e=a.useRef(0),[t,s]=a.useState(0);let r,o;n[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{const c=setInterval(()=>{s(e.current),e.current=0},1e3);return()=>clearInterval(c)},o=[],n[0]=r,n[1]=o):(r=n[0],o=n[1]),a.useEffect(r,o);let l;return n[2]!==t?(l={fps:t,frameCount:e},n[2]=t,n[3]=l):l=n[3],l}function mr(n){const e=ae.c(8);let t,s;e[0]!==n?({className:t,...s}=n,e[0]=n,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let r;e[3]!==t?(r=Me("bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 select-none items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium","[&_svg:not([class*='size-'])]:size-3","[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",t),e[3]=t,e[4]=r):r=e[4];let o;return e[5]!==s||e[6]!==r?(o=i.jsx("kbd",{"data-slot":"kbd",className:r,...s}),e[5]=s,e[6]=r,e[7]=o):o=e[7],o}function ns(n){const e=ae.c(8);let t,s;e[0]!==n?({className:t,...s}=n,e[0]=n,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let r;e[3]!==t?(r=Me("inline-flex items-center gap-1",t),e[3]=t,e[4]=r):r=e[4];let o;return e[5]!==s||e[6]!==r?(o=i.jsx("kbd",{"data-slot":"kbd-group",className:r,...s}),e[5]=s,e[6]=r,e[7]=o):o=e[7],o}function Ar(n){const e=ae.c(7),{label:t,keys:s}=n;let r;e[0]!==s?(r=s.map(El),e[0]=s,e[1]=r):r=e[1];let o;e[2]!==r?(o=i.jsx(ns,{children:r}),e[2]=r,e[3]=o):o=e[3];let l;return e[4]!==t||e[5]!==o?(l=i.jsxs("span",{className:"flex items-center gap-3",children:[t,o]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l}function El(n){return i.jsx(mr,{children:n},n)}const Cs="text-muted-foreground hover:text-muted-foreground",Ts="text-destructive hover:text-destructive";function Cl(n){switch(n){case"awaiting-app":return" Launch an app through tapflow so it is told too.";case"not-armed":return" Restart the device so tapflow can set it up.";case"state-unconfirmed":return" tapflow could not confirm the change — try again.";case"unsupported-device":return" The device did not change when tapflow asked — try again, or use another device.";case"filter-unavailable":return" This Mac is not set up to take devices off the network — see the network control guide.";case"enforcement-lost":return" It went back on the network on its own.";case"hooks-not-installed":return" tapflow cannot tell this app it is off the network.";default:return" tapflow cannot change it right now."}}function Tl({position:n,steerable:e,reason:t}){const s=t==="awaiting-app",r=!e&&t==="state-unconfirmed"?" animate-pulse":"",o=e?"":Cl(t);switch(n){case"offline":return{Icon:Zi,className:(e||s?"text-amber-500 hover:text-amber-500":Ts)+r,status:`Device is offline.${o}`};case"online":return{Icon:Qr,className:(e||s?"":Ts)+r,status:`Device is on the network.${o}`};case"waiting":return{Icon:Qr,className:`${Cs} animate-pulse`,status:"Checking the network state."};case"unknown":return{Icon:Qr,className:Cs,status:e?"No network state has been reported.":"tapflow could not read the network state — try again."}}}function Al({position:n,steerable:e,reason:t}){const s=n==="offline"?"Bring device online":n==="online"?"Take device offline":"Toggle device network",r=n==="online"||n==="offline",o=n==="unknown"&&!e&&t==="state-unconfirmed",l=t==="state-unconfirmed"||t==="unsupported-device";return e||!(r||o)||t==="awaiting-app"?s:l?`Retry: ${s.toLowerCase()}`:`${s} — unavailable`}function ko(n){var lt;const e=ae.c(82),{joined:t,onScreenshot:s,onRecordToggle:r,recordState:o,onRotate:l,posture:c,onDeepLink:u,navigationSlot:d,deviceSlot:f,launchSlot:p,network:m,reboot:g}=n,x=a.useId(),h=a.useId(),E=a.useId(),w=a.useId(),[T,C]=a.useState(!1);if(!t)return null;let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=i.jsx(lo,{className:"h-4 w-4"}),e[0]=v):v=e[0];let j;e[1]!==u?(j=i.jsx(Ft,{asChild:!0,children:i.jsx(Xe,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Open a deeplink",onClick:u,children:v})}),e[1]=u,e[2]=j):j=e[2];let N;e[3]===Symbol.for("react.memo_cache_sentinel")?(N=i.jsx(Ut,{side:"left",children:i.jsx(Ar,{label:"Deeplink",keys:["⌘","K"]})}),e[3]=N):N=e[3];let S;e[4]!==j?(S=i.jsxs($t,{children:[j,N]}),e[4]=j,e[5]=S):S=e[5];let k;e[6]!==p||e[7]!==d||e[8]!==S?(k=i.jsxs("div",{role:"group","aria-label":"Navigation",className:"flex flex-col items-center gap-0.5",children:[p,d,S]}),e[6]=p,e[7]=d,e[8]=S,e[9]=k):k=e[9];let D;e[10]===Symbol.for("react.memo_cache_sentinel")?(D=i.jsx("div",{role:"separator","aria-orientation":"horizontal",className:"w-4 h-px bg-border my-1"}),e[10]=D):D=e[10];let I;e[11]===Symbol.for("react.memo_cache_sentinel")?(I=i.jsx(tl,{className:"h-4 w-4"}),e[11]=I):I=e[11];let M;e[12]!==l?(M=i.jsx(Ft,{asChild:!0,children:i.jsx(Xe,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Rotate the device",onClick:l,children:I})}),e[12]=l,e[13]=M):M=e[13];let $;e[14]===Symbol.for("react.memo_cache_sentinel")?($=i.jsx(Ut,{side:"left",children:i.jsx(Ar,{label:"Rotate",keys:["⌘","⇧","O"]})}),e[14]=$):$=e[14];let V;e[15]!==M?(V=i.jsxs($t,{children:[M,$]}),e[15]=M,e[16]=V):V=e[16];let z;e[17]!==c||e[18]!==E?(z=c&&c.postures.length===2&&i.jsx("span",{id:E,role:"status","aria-live":"polite",className:"sr-only",children:c.pending?"Changing posture":((lt=c.postures.find(be=>be.id===c.currentId))==null?void 0:lt.label)??"Current posture unknown"}),e[17]=c,e[18]=E,e[19]=z):z=e[19];let H;e[20]!==c||e[21]!==E?(H=c&&c.postures.length===2&&(()=>{const be=c.postures.findIndex(Je=>Je.id===c.currentId),xe=be===-1?null:c.postures[be],Ye=c.postures[(be+1)%2],Ge=be===0,tt=Ge?sl:Xi,ve=Ge?"Unfold":"Fold",Se=xe?`${ve}: ${xe.label} to ${Ye.label}`:`${ve}: ${Ye.label}`,Qe=Je=>i.jsx(Xe,{variant:"ghost",size:"icon",className:"h-8 w-8 aria-disabled:opacity-50","aria-label":c.pending?`${Se} — changing`:Se,"aria-busy":c.pending,"aria-disabled":c.pending,"aria-describedby":E,onClick:()=>{c.pending||Je==null||Je()},children:c.pending?i.jsx(br,{className:"h-4 w-4 animate-spin"}):i.jsx(tt,{className:"h-4 w-4"})});return i.jsxs($t,{children:[i.jsx(Ft,{asChild:!0,children:Qe(()=>c.onSelect(Ye.id))}),i.jsx(Ut,{side:"left",children:c.pending?`${Se} — changing`:Se})]})})(),e[20]=c,e[21]=E,e[22]=H):H=e[22];let W;e[23]!==g||e[24]!==h?(W=g&&(()=>{const be=g.pending?"Restarting the device":"Restart the device";return i.jsxs(i.Fragment,{children:[i.jsxs($t,{children:[i.jsx(Ft,{asChild:!0,children:i.jsx(Xe,{ref:g.buttonRef,variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":be,"aria-busy":g.pending,"aria-disabled":g.pending,"aria-describedby":h,onClick:()=>{g.pending||C(!0)},children:g.pending?i.jsx(br,{className:"h-4 w-4 animate-spin"}):i.jsx(el,{className:"h-4 w-4"})})}),i.jsx(Ut,{side:"left",children:be})]}),i.jsx("span",{id:h,role:"status",className:"sr-only",children:g.pending?"Restarting the device.":""})]})})(),e[23]=g,e[24]=h,e[25]=W):W=e[25];let te;e[26]!==f||e[27]!==V||e[28]!==z||e[29]!==H||e[30]!==W?(te=i.jsxs("div",{role:"group","aria-label":"Device",className:"flex flex-col items-center gap-0.5",children:[f,V,z,H,W]}),e[26]=f,e[27]=V,e[28]=z,e[29]=H,e[30]=W,e[31]=te):te=e[31];let K;e[32]===Symbol.for("react.memo_cache_sentinel")?(K=i.jsx("div",{role:"separator","aria-orientation":"horizontal",className:"w-4 h-px bg-border my-1"}),e[32]=K):K=e[32];let Z;e[33]===Symbol.for("react.memo_cache_sentinel")?(Z=i.jsx(Vi,{className:"h-4 w-4"}),e[33]=Z):Z=e[33];let G;e[34]!==s?(G=i.jsx(Ft,{asChild:!0,children:i.jsx(Xe,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Take a screenshot",onClick:s,children:Z})}),e[34]=s,e[35]=G):G=e[35];let Q;e[36]===Symbol.for("react.memo_cache_sentinel")?(Q=i.jsx(Ut,{side:"left",children:i.jsx(Ar,{label:"Screenshot",keys:["⌘","S"]})}),e[36]=Q):Q=e[36];let re;e[37]!==G?(re=i.jsxs($t,{children:[G,Q]}),e[37]=G,e[38]=re):re=e[38];const F=o==="recording"&&"text-red-500 hover:text-red-500";let pe;e[39]!==F?(pe=Me("h-8 w-8 aria-disabled:opacity-50",F),e[39]=F,e[40]=pe):pe=e[40];const de=o==="recording"?"Stop recording":o==="uploading"?"Processing the recording":o==="done"?"Recording saved":"Start recording",q=o==="uploading",J=o==="uploading"||o==="done";let fe;e[41]!==r||e[42]!==o?(fe=()=>{(o==="idle"||o==="recording")&&r()},e[41]=r,e[42]=o,e[43]=fe):fe=e[43];let me;e[44]!==o?(me=o==="uploading"?i.jsx(br,{className:"h-4 w-4 animate-spin"}):o==="recording"?i.jsx(rl,{className:"h-4 w-4 fill-current"}):i.jsx(ol,{className:"h-4 w-4"}),e[44]=o,e[45]=me):me=e[45];let O;e[46]!==w||e[47]!==pe||e[48]!==de||e[49]!==q||e[50]!==J||e[51]!==fe||e[52]!==me?(O=i.jsx(Ft,{asChild:!0,children:i.jsx(Xe,{variant:"ghost",size:"icon",className:pe,"aria-label":de,"aria-busy":q,"aria-disabled":J,"aria-describedby":w,onClick:fe,children:me})}),e[46]=w,e[47]=pe,e[48]=de,e[49]=q,e[50]=J,e[51]=fe,e[52]=me,e[53]=O):O=e[53];let ue;e[54]!==o?(ue=o==="idle"?i.jsx(Ar,{label:"Start recording",keys:["⌘","⇧","Y"]}):o==="recording"?i.jsx(Ar,{label:"Stop recording",keys:["⌘","⇧","Y"]}):o==="done"?"Recording saved":"Processing the recording",e[54]=o,e[55]=ue):ue=e[55];let ge;e[56]!==ue?(ge=i.jsx(Ut,{side:"left",children:ue}),e[56]=ue,e[57]=ge):ge=e[57];let we;e[58]!==O||e[59]!==ge?(we=i.jsxs($t,{children:[O,ge]}),e[58]=O,e[59]=ge,e[60]=we):we=e[60];const Le=o==="recording"?"Recording.":o==="uploading"?"Processing the recording.":o==="done"?"Recording saved.":"";let X;e[61]!==w||e[62]!==Le?(X=i.jsx("span",{id:w,role:"status",className:"sr-only",children:Le}),e[61]=w,e[62]=Le,e[63]=X):X=e[63];let ne;e[64]!==re||e[65]!==we||e[66]!==X?(ne=i.jsxs("div",{role:"group","aria-label":"Capture",className:"flex flex-col items-center gap-0.5",children:[re,we,X]}),e[64]=re,e[65]=we,e[66]=X,e[67]=ne):ne=e[67];let Te;e[68]!==x||e[69]!==m?(Te=m&&i.jsxs(i.Fragment,{children:[i.jsx("div",{role:"separator","aria-orientation":"horizontal",className:"w-4 h-px bg-border my-1"}),i.jsx("div",{role:"group","aria-label":"Environment",className:"flex flex-col items-center gap-0.5",children:m&&(()=>{const{Icon:be,className:xe,status:Ye}=Tl(m),Ge=Al(m),tt=m.position==="waiting"||m.position==="unknown"||!m.steerable;return i.jsxs($t,{children:[i.jsx(Ft,{asChild:!0,children:i.jsx(Xe,{variant:"ghost",size:"icon",className:Me("h-8 w-8",xe),"aria-label":Ge,"aria-busy":m.pending,"aria-disabled":m.pending,"aria-describedby":x,onClick:()=>{m.pending||m.onToggle()},children:m.pending?i.jsx(br,{className:"h-4 w-4 animate-spin"}):i.jsx(be,{className:"h-4 w-4"})})}),i.jsx("span",{id:x,role:"status",className:"sr-only",children:m.pending?"Changing the network state.":Ye}),i.jsx(Ut,{side:"left",children:tt?`${Ge} — ${Ye}`:Ge})]})})()})]}),e[68]=x,e[69]=m,e[70]=Te):Te=e[70];let he;e[71]!==te||e[72]!==ne||e[73]!==Te||e[74]!==k?(he=i.jsxs("div",{className:"flex flex-col items-center gap-0.5 rounded-2xl border bg-background/90 backdrop-blur-sm px-1.5 py-2.5 shrink-0 mt-3",children:[k,D,te,K,ne,Te]}),e[71]=te,e[72]=ne,e[73]=Te,e[74]=k,e[75]=he):he=e[75];let Oe;e[76]!==T||e[77]!==g?(Oe=g&&i.jsx(Si,{open:T,onOpenChange:C,children:i.jsxs(Ri,{children:[i.jsxs(_i,{children:[i.jsx(ki,{children:"Restart this device?"}),i.jsx(ji,{children:"Anything open on the device closes, and whatever you had set up on screen is gone. The app under test is reinstalled, which clears its data; other apps keep theirs. The device takes a moment to come back."})]}),i.jsxs(Ei,{children:[i.jsx(Ci,{children:"Cancel"}),i.jsx(Ti,{onClick:()=>{C(!1),g.onReboot()},children:"Restart"})]})]})}),e[76]=T,e[77]=g,e[78]=Oe):Oe=e[78];let ke;return e[79]!==he||e[80]!==Oe?(ke=i.jsxs(ts,{delayDuration:400,children:[he,Oe]}),e[79]=he,e[80]=Oe,e[81]=ke):ke=e[81],ke}const Nl=3e3,Il=8e3;function jo(n){const e=ae.c(40),{sessionId:t,send:s,supported:r,deviceReady:o,handlerRef:l,onError:c}=n,[u,d]=a.useState("waiting"),[f,p]=a.useState(!0),[m,g]=a.useState(void 0),x=a.useRef(void 0),[h,E]=a.useState(!1),w=a.useRef(null);let T;e[0]===Symbol.for("react.memo_cache_sentinel")?(T=new Set,e[0]=T):T=e[0];const C=a.useRef(T),v=a.useRef(c);let j,N;e[1]!==c?(j=()=>{v.current=c},N=[c],e[1]=c,e[2]=j,e[3]=N):(j=e[2],N=e[3]),a.useEffect(j,N);const S=a.useRef(o);let k,D;e[4]!==o?(k=()=>{S.current=o},D=[o],e[4]=o,e[5]=k,e[6]=D):(k=e[5],D=e[6]),a.useEffect(k,D);const I=a.useRef(o),[M,$]=a.useState(t);M!==t&&($(t),d("waiting"),p(!0),g(void 0),E(!1));let V;e[7]===Symbol.for("react.memo_cache_sentinel")?(V=()=>{x.current=void 0,w.current=null,I.current=S.current,C.current.clear()},e[7]=V):V=e[7];let z;e[8]!==t?(z=[t],e[8]=t,e[9]=z):z=e[9],a.useEffect(V,z);let H,W;e[10]!==o?(H=()=>{var O;if(o){I.current=!0,d("waiting");return}d(I.current?"unknown":"waiting"),p(!0),g(void 0),x.current=void 0,w.current&&((O=v.current)==null||O.call(v,"The device became unavailable before it answered. Its network state is unchanged as far as tapflow can tell."),C.current.add(w.current)),E(!1),w.current=null},W=[o],e[10]=o,e[11]=H,e[12]=W):(H=e[11],W=e[12]),a.useEffect(H,W);let te,K;e[13]!==l||e[14]!==r?(te=()=>{if(r)return l.current=O=>{var ge,we;if(O.type==="network:error"){O.requestId===w.current&&(w.current=null,E(!1),(ge=v.current)==null||ge.call(v,O.message));return}if(O.type!=="network:state"||!S.current||O.requestId!==void 0&&C.current.has(O.requestId))return;const ue=O.payload.available?void 0:O.payload.reason;d(O.payload.offline===void 0?"unknown":O.payload.offline?"offline":"online"),p(O.payload.available),g(ue),ue==="enforcement-lost"&&x.current!=="enforcement-lost"&&((we=v.current)==null||we.call(v,"The device went back on the network before you took it off. Anything checked while it was offline needs checking again.")),x.current=ue,O.requestId!==void 0&&O.requestId===w.current&&(w.current=null,E(!1))},()=>{l.current=void 0}},K=[l,r],e[13]=l,e[14]=r,e[15]=te,e[16]=K):(te=e[15],K=e[16]),a.useEffect(te,K);let Z,G;e[17]!==o||e[18]!==u||e[19]!==r?(Z=()=>{if(!r||!o||u!=="waiting")return;const O=setTimeout(()=>d(Pl),Nl);return()=>clearTimeout(O)},G=[r,o,u],e[17]=o,e[18]=u,e[19]=r,e[20]=Z,e[21]=G):(Z=e[20],G=e[21]),a.useEffect(Z,G);let Q;e[22]!==h||e[23]!==u||e[24]!==s||e[25]!==t||e[26]!==r?(Q=()=>{if(!r||h)return;const O=Ce();w.current=O,E(!0),s({type:"network:set",sessionId:t,requestId:O,payload:{offline:u!=="offline"}})},e[22]=h,e[23]=u,e[24]=s,e[25]=t,e[26]=r,e[27]=Q):Q=e[27];const re=Q,[F,pe]=a.useState(null);let de,q;e[28]!==h?(de=()=>{pe(h?w.current:null)},q=[h],e[28]=h,e[29]=de,e[30]=q):(de=e[29],q=e[30]),a.useEffect(de,q);let J,fe;e[31]!==F?(J=()=>{if(F===null)return;const O=setTimeout(()=>{var ue;w.current===F&&(w.current=null,E(!1),(ue=v.current)==null||ue.call(v,"The device did not answer. Its network state is unchanged as far as tapflow can tell."))},Il);return()=>clearTimeout(O)},fe=[F],e[31]=F,e[32]=J,e[33]=fe):(J=e[32],fe=e[33]),a.useEffect(J,fe);let me;return e[34]!==h||e[35]!==u||e[36]!==m||e[37]!==f||e[38]!==re?(me={position:u,steerable:f,reason:m,pending:h,toggle:re},e[34]=h,e[35]=u,e[36]=m,e[37]=f,e[38]=re,e[39]=me):me=e[39],me}function Pl(n){return n==="waiting"?"unknown":n}class rs{constructor(e){this.bytes=e,this.bitPos=0}get position(){return this.bitPos}bit(){const e=this.bitPos>>3,t=7-(this.bitPos&7);return this.bitPos++,e>=this.bytes.length?0:this.bytes[e]>>t&1}bits(e){let t=0;for(let s=0;s<e;s++)t=t<<1|this.bit();return t>>>0}flag(){return this.bit()===1}ue(){let e=0;for(;this.bit()===0&&e<32;)e++;return e===0?0:(1<<e)-1+this.bits(e)}se(){const e=this.ue();return e&1?Math.ceil(e/2):-Math.ceil(e/2)}}class Dl{constructor(){this.bitsArr=[]}bit(e){this.bitsArr.push(e&1)}ue(e){const t=e+1,s=Math.floor(Math.log2(t));for(let r=0;r<s;r++)this.bit(0);for(let r=s;r>=0;r--)this.bit(t>>r&1)}toBytes(){const e=[];for(let t=0;t<this.bitsArr.length;t+=8){let s=0;for(let r=0;r<8;r++)s=s<<1|(this.bitsArr[t+r]??0);e.push(s)}return new Uint8Array(e)}}function Eo(n){const e=[];let t=0;for(let s=1;s<n.length;s++){const r=n[s];if(t>=2&&r===3){t=0;continue}e.push(r),t=r===0?t+1:0}return new Uint8Array(e)}function Ml(n){const e=[];let t=0;for(const s of n)t>=2&&s<=3&&(e.push(3),t=0),e.push(s),t=s===0?t+1:0;return new Uint8Array(e)}const Ll=new Set([100,110,122,244,44,83,86,118,128,138,139,134,135]);function As(n){const e=n.ue()+1;n.bits(4),n.bits(4);for(let t=0;t<e;t++)n.ue(),n.ue(),n.flag();n.bits(5),n.bits(5),n.bits(5),n.bits(5)}function Co(n){const e=n.bits(8);n.bits(8);const t=n.bits(8);if(n.ue(),Ll.has(e)){const p=n.ue();if(p===3&&n.flag(),n.ue(),n.ue(),n.flag(),n.flag()){const m=p!==3?8:12;for(let g=0;g<m;g++)if(n.flag()){const x=g<6?16:64;let h=8,E=8;for(let w=0;w<x;w++)E!==0&&(E=(h+n.se()+256)%256),h=E===0?h:E}}}n.ue();const s=n.ue();if(s===0)n.ue();else if(s===1){n.flag(),n.se(),n.se();const p=n.ue();for(let m=0;m<p;m++)n.se()}const r=n.ue();n.flag(),n.ue(),n.ue(),n.flag()||n.flag(),n.flag(),n.flag()&&(n.ue(),n.ue(),n.ue(),n.ue());const o={profileIdc:e,levelIdc:t,numRefFrames:r,bitstreamRestriction:!1,maxNumReorderFrames:null,maxDecFrameBuffering:null};if(!n.flag())return{...o,vuiPresent:!1,restrictionFlagPos:-1};n.flag()&&n.bits(8)===255&&(n.bits(16),n.bits(16)),n.flag()&&n.flag(),n.flag()&&(n.bits(3),n.flag(),n.flag()&&(n.bits(8),n.bits(8),n.bits(8))),n.flag()&&(n.ue(),n.ue()),n.flag()&&(n.bits(32),n.bits(32),n.flag());const c=n.flag();c&&As(n);const u=n.flag();u&&As(n),(c||u)&&n.flag(),n.flag();const d=n.position;return n.flag()?(n.flag(),n.ue(),n.ue(),n.ue(),n.ue(),{...o,vuiPresent:!0,bitstreamRestriction:!0,maxNumReorderFrames:n.ue(),maxDecFrameBuffering:n.ue(),restrictionFlagPos:d}):{...o,vuiPresent:!0,restrictionFlagPos:d}}function $l(n){const e=Co(new rs(Eo(n)));return{profileIdc:e.profileIdc,levelIdc:e.levelIdc,vuiPresent:e.vuiPresent,bitstreamRestriction:e.bitstreamRestriction,maxNumReorderFrames:e.maxNumReorderFrames,maxDecFrameBuffering:e.maxDecFrameBuffering}}function Fl(n){const e=Eo(n),t=Co(new rs(e));if(!t.vuiPresent||t.restrictionFlagPos<0||t.bitstreamRestriction)return null;const s=new Dl,r=new rs(e);for(let o=0;o<t.restrictionFlagPos;o++)s.bit(r.bit());return s.bit(1),s.bit(1),s.ue(0),s.ue(0),s.ue(0),s.ue(0),s.ue(0),s.ue(t.numRefFrames),s.bit(1),Uint8Array.from([n[0],...Ml(s.toBytes())])}function Ul(n){const e=[],t=n.length;let s=-1,r=0;for(;r+2<t;){const o=r+3<t&&n[r]===0&&n[r+1]===0&&n[r+2]===0&&n[r+3]===1,l=n[r]===0&&n[r+1]===0&&n[r+2]===1;o||l?(s>=0&&e.push(n.subarray(s,r)),r+=o?4:3,s=r):r++}return s>=0&&e.push(n.subarray(s,t)),e}class Hl{constructor(e){this.onFrame=e,this.decoder=null,this.sps=null,this.pps=null,this.frameCount=0,this.submitAt=new Map,this.spsLogged=!1}setDecodeSampler(e){this.decodeSampler=e}decode(e){const t=[];let s=!1;for(const d of Ul(new Uint8Array(e))){const f=d[0]&31;if(f===7){const p=!this.sps||d.length!==this.sps.length||d.some((m,g)=>m!==this.sps[g]);this.sps=d,p&&this.decoder&&(this.decoder.close(),this.decoder=null)}else f===8?this.pps=d:f>=1&&f<=5&&(f===5&&(s=!0),t.push(d))}if(s&&this.sps&&this.pps&&!this.decoder&&this.initDecoder(this.sps,this.pps),!this.decoder||t.length===0)return;let r=0;for(const d of t)r+=4+d.length;const o=new Uint8Array(r),l=new DataView(o.buffer);let c=0;for(const d of t)l.setUint32(c,d.length,!1),c+=4,o.set(d,c),c+=d.length;const u=Math.round(this.frameCount++*(1e6/30));if(this.decodeSampler&&(this.submitAt.set(u,performance.now()),this.submitAt.size>120)){const d=this.submitAt.keys().next().value;d!==void 0&&this.submitAt.delete(d)}try{this.decoder.decode(new EncodedVideoChunk({type:s?"key":"delta",timestamp:u,data:o}))}catch{}}sampleDecode(e){var s;if(!this.decodeSampler)return;const t=this.submitAt.get(e.timestamp);t!==void 0&&(this.submitAt.delete(e.timestamp),this.decodeSampler({decodeMs:performance.now()-t,queueSize:((s=this.decoder)==null?void 0:s.decodeQueueSize)??0}))}close(){var e;(e=this.decoder)==null||e.close(),this.decoder=null}logSpsVui(e){if(!(this.spsLogged||!this.decodeSampler)){this.spsLogged=!0;try{console.log("[sps-vui]",JSON.stringify($l(e)))}catch(t){console.warn("[sps-vui] parse failed",t)}}}initDecoder(e,t){this.logSpsVui(e);const s=Fl(e)??e,r=s[0]===0?s.subarray(4):s,o=`avc1.${r[1].toString(16).padStart(2,"0")}${r[2].toString(16).padStart(2,"0")}${r[3].toString(16).padStart(2,"0")}`,l=this.buildAVCC(s,t);this.decoder=new VideoDecoder({output:c=>{this.sampleDecode(c),this.onFrame(c)},error:c=>console.error("[WebCodecsCore]",c)}),this.decoder.configure({codec:o,description:l,optimizeForLatency:!0})}buildAVCC(e,t){const s=e[0]===0?e.subarray(4):e,r=t[0]===0?t.subarray(4):t,o=new Uint8Array(8+s.length+1+2+r.length);let l=0;return o[l++]=1,o[l++]=s[1],o[l++]=s[2],o[l++]=s[3],o[l++]=255,o[l++]=225,o[l++]=s.length>>8&255,o[l++]=s.length&255,o.set(s,l),l+=s.length,o[l++]=1,o[l++]=r.length>>8&255,o[l++]=r.length&255,o.set(r,l),o}}const zl=`#version 300 es
117
+ in vec2 a_pos;
118
+ out vec2 v_uv;
119
+ void main() {
120
+ v_uv = vec2(a_pos.x * 0.5 + 0.5, 0.5 - a_pos.y * 0.5);
121
+ gl_Position = vec4(a_pos, 0.0, 1.0);
122
+ }`,Ol=`#version 300 es
123
+ precision mediump float;
124
+ in vec2 v_uv;
125
+ uniform sampler2D u_tex;
126
+ out vec4 out_color;
127
+ void main() {
128
+ out_color = texture(u_tex, v_uv);
129
+ }`;function Bl(n){const e=n.getContext("webgl2",{alpha:!1,antialias:!1,powerPreference:"high-performance",preserveDrawingBuffer:!0});if(!e)return null;const t=(f,p)=>{const m=e.createShader(f);return e.shaderSource(m,p),e.compileShader(m),m},s=e.createProgram(),r=t(e.VERTEX_SHADER,zl),o=t(e.FRAGMENT_SHADER,Ol);e.attachShader(s,r),e.attachShader(s,o),e.linkProgram(s),e.deleteShader(r),e.deleteShader(o),e.useProgram(s);const l=e.createVertexArray();e.bindVertexArray(l);const c=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),e.STATIC_DRAW);const u=e.getAttribLocation(s,"a_pos");e.enableVertexAttribArray(u),e.vertexAttribPointer(u,2,e.FLOAT,!1,0,0),e.bindVertexArray(null);const d=e.createTexture();return e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,d),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.uniform1i(e.getUniformLocation(s,"u_tex"),0),{gl:e,program:s,tex:d,vao:l}}class Wl{constructor(e){this.canvas=e,this.state=null}init(){return this.state=Bl(this.canvas),this.state!==null}drawFrame(e){const t=this.state;if(!t)return e.close(),null;const s=e.displayWidth,r=e.displayHeight;try{return(this.canvas.width!==s||this.canvas.height!==r)&&(this.canvas.width=s,this.canvas.height=r,t.gl.viewport(0,0,s,r)),t.gl.activeTexture(t.gl.TEXTURE0),t.gl.bindTexture(t.gl.TEXTURE_2D,t.tex),t.gl.texImage2D(t.gl.TEXTURE_2D,0,t.gl.RGBA,t.gl.RGBA,t.gl.UNSIGNED_BYTE,e),t.gl.bindVertexArray(t.vao),t.gl.drawArrays(t.gl.TRIANGLES,0,6),t.gl.bindVertexArray(null),t.gl.bindTexture(t.gl.TEXTURE_2D,null),{width:s,height:r}}finally{e.close()}}dispose(){const e=this.state;e&&(e.gl.deleteTexture(e.tex),e.gl.deleteVertexArray(e.vao),e.gl.deleteProgram(e.program),this.state=null)}}function Vl(n){const e=new Wl(n);return e.init(),e}class ql{constructor(e=Vl){this._size=null,this.canvas=document.createElement("canvas"),this.renderer=e(this.canvas),this.core=new Hl(t=>this.render(t))}get surface(){return this.canvas}get size(){return this._size}onResize(e){this.resizeCb=e}onDecodedFrame(e){this.decodedCb=e,this.core.setDecodeSampler(t=>{this.lastSample=t})}decode(e){this.core.decode(e)}close(){this.core.close(),this.renderer.dispose()}render(e){var s,r;const t=this.renderer.drawFrame(e);t&&((s=this.decodedCb)==null||s.call(this,performance.now(),this.lastSample),this.lastSample=void 0,(!this._size||this._size.width!==t.width||this._size.height!==t.height)&&(this._size=t,(r=this.resizeCb)==null||r.call(this,t)))}}const Kl=`#version 300 es
130
+ in vec2 a_pos;
131
+ out vec2 v_uv;
132
+ void main() {
133
+ v_uv = vec2(a_pos.x * 0.5 + 0.5, 0.5 - a_pos.y * 0.5);
134
+ gl_Position = vec4(a_pos, 0.0, 1.0);
135
+ }`,Xl=`#version 300 es
136
+ precision mediump float;
137
+ in vec2 v_uv;
138
+ uniform sampler2D u_texY;
139
+ uniform sampler2D u_texU;
140
+ uniform sampler2D u_texV;
141
+ out vec4 out_color;
142
+ void main() {
143
+ float Y = (texture(u_texY, v_uv).r - 0.0627451) * 1.1643836; // (y-16/255)*255/219
144
+ float U = (texture(u_texU, v_uv).r - 0.5019608) * 1.1383929; // (u-128/255)*255/224
145
+ float V = (texture(u_texV, v_uv).r - 0.5019608) * 1.1383929;
146
+ float r = Y + 1.5748 * V;
147
+ float g = Y - 0.1873 * U - 0.4681 * V;
148
+ float b = Y + 1.8556 * U;
149
+ out_color = vec4(r, g, b, 1.0);
150
+ }`;function Jr(n,e,t,s){const r=n.createTexture();return n.activeTexture(n.TEXTURE0+e),n.bindTexture(n.TEXTURE_2D,r),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.uniform1i(n.getUniformLocation(s,t),e),r}function Yl(n){const e=n.getContext("webgl2",{alpha:!1,antialias:!1,powerPreference:"high-performance",preserveDrawingBuffer:!0});if(!e)return null;const t=(m,g)=>{const x=e.createShader(m);return e.shaderSource(x,g),e.compileShader(x),x},s=e.createProgram(),r=t(e.VERTEX_SHADER,Kl),o=t(e.FRAGMENT_SHADER,Xl);e.attachShader(s,r),e.attachShader(s,o),e.linkProgram(s),e.deleteShader(r),e.deleteShader(o),e.useProgram(s);const l=e.createVertexArray();e.bindVertexArray(l);const c=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),e.STATIC_DRAW);const u=e.getAttribLocation(s,"a_pos");e.enableVertexAttribArray(u),e.vertexAttribPointer(u,2,e.FLOAT,!1,0,0),e.bindVertexArray(null),e.pixelStorei(e.UNPACK_ALIGNMENT,1);const d=Jr(e,0,"u_texY",s),f=Jr(e,1,"u_texU",s),p=Jr(e,2,"u_texV",s);return{gl:e,program:s,texY:d,texU:f,texV:p,vao:l}}class Gl{constructor(e){this.canvas=e,this.state=null}init(){return this.state=Yl(this.canvas),this.state!==null}drawI420(e,t,s){const r=this.state;if(!r)return null;const{gl:o}=r,l=t+1>>1,c=s+1>>1,u=t*s,d=l*c,f=e.subarray(0,u),p=e.subarray(u,u+d),m=e.subarray(u+d,u+2*d);(this.canvas.width!==t||this.canvas.height!==s)&&(this.canvas.width=t,this.canvas.height=s,o.viewport(0,0,t,s));const g=(x,h,E,w,T)=>{o.activeTexture(o.TEXTURE0+x),o.bindTexture(o.TEXTURE_2D,h),o.texImage2D(o.TEXTURE_2D,0,o.R8,E,w,0,o.RED,o.UNSIGNED_BYTE,T)};return g(0,r.texY,t,s,f),g(1,r.texU,l,c,p),g(2,r.texV,l,c,m),o.bindVertexArray(r.vao),o.drawArrays(o.TRIANGLES,0,6),o.bindVertexArray(null),{width:t,height:s}}dispose(){const e=this.state;e&&(e.gl.deleteTexture(e.texY),e.gl.deleteTexture(e.texU),e.gl.deleteTexture(e.texV),e.gl.deleteVertexArray(e.vao),e.gl.deleteProgram(e.program),this.state=null)}}const Ql=0;function Jl(n){const e=new Gl(n);return e.init(),e}function Zl(){return new Worker(new URL("/assets/tinyh264.worker-DiJ50Hai.js",import.meta.url),{type:"module"})}class ea{constructor(e=Jl,t=Zl){this.ready=!1,this.pending=[],this._size=null,this.canvas=document.createElement("canvas"),this.renderer=e(this.canvas),this.worker=t(),this.worker.onmessage=s=>this.onMessage(s.data)}get surface(){return this.canvas}get size(){return this._size}onResize(e){this.resizeCb=e}onDecodedFrame(e){this.decodedCb=e}decode(e){if(!this.ready){this.pending.push(e);return}this.post(e)}close(){this.worker.terminate(),this.renderer.dispose()}post(e){this.worker.postMessage({type:"decode",data:e,offset:0,length:e.byteLength,renderStateId:Ql},[e])}onMessage(e){var s,r;if(e.type==="decoderReady"){this.ready=!0;for(const o of this.pending)this.post(o);this.pending.length=0;return}const t=this.renderer.drawI420(new Uint8Array(e.data),e.width,e.height);t&&((s=this.decodedCb)==null||s.call(this,performance.now()),(!this._size||this._size.width!==t.width||this._size.height!==t.height)&&(this._size=t,(r=this.resizeCb)==null||r.call(this,t)))}}function as(){const n=typeof window<"u";let e=!1;try{e=!!document.createElement("canvas").getContext("webgl2")}catch{e=!1}return{secureContext:n&&window.isSecureContext===!0,webCodecs:n&&"VideoDecoder"in window,webgl2:e,wasm:typeof WebAssembly<"u"&&typeof Worker<"u"}}function ta(n=as()){return n.secureContext&&n.webCodecs&&n.webgl2?new ql:n.wasm&&n.webgl2?new ea:null}function na(n=as()){return n.secureContext&&n.webCodecs&&n.webgl2||n.wasm&&n.webgl2}function ra(n=as()){return n.secureContext&&n.webCodecs&&n.webgl2?"high":n.wasm&&n.webgl2?"standard":"unsupported"}const sa="https://www.tapflow.dev/operate/https#pick-a-method";function oa(n){const e=ae.c(9),{open:t,onOpenChange:s}=n;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(Vs,{children:"Streaming in Standard mode"}),e[0]=r):r=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsxs(Ai,{children:[r,i.jsxs(Ni,{className:"space-y-3 pt-1",children:[i.jsx("span",{className:"block",children:"This screen is running in Standard mode. For a faster, smoother picture, switch to Smooth."}),i.jsx("span",{className:"block",children:"Smooth needs the relay served over HTTPS. If you didn't set up tapflow, ask whoever did."})]})]}),e[1]=o):o=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsx(Xe,{variant:"outline",onClick:ia,children:"How to enable"}),e[2]=l):l=e[2];let c;e[3]!==s?(c=i.jsxs(qs,{className:"sm:max-w-[440px]",children:[o,i.jsxs(Ii,{children:[l,i.jsx(Xe,{onClick:()=>s(!1),children:"Got it"})]})]}),e[3]=s,e[4]=c):c=e[4];let u;return e[5]!==s||e[6]!==t||e[7]!==c?(u=i.jsx(Ks,{open:t,onOpenChange:s,children:c}),e[5]=s,e[6]=t,e[7]=c,e[8]=u):u=e[8],u}function ia(){return window.open(sa,"_blank","noopener,noreferrer")}const Ns="tapflow.perfModeNoticeDismissed";function la(n,e){return n==="standard"&&!e}const aa={high:"Smooth",standard:"Standard",unsupported:null};function ca(n){const{connected:e,joined:t,bootError:s,deviceReady:r,installing:o,installError:l,agentAway:c,decoderUnsupported:u}=n;return e?t?c?"The agent went away — waiting for it to come back…":s?`Boot failed: ${s.length>40?s.slice(0,40)+"…":s}`:r?o?"Installing app…":l?`Install failed: ${l}`:u?"Streaming is not supported in this environment.":null:"Starting device…":"Joining session…":"Connecting…"}function cs(n){const e=ae.c(40),{joined:t,fps:s,keyboardActive:r}=n;let o;e[0]!==n?(o=ca(n),e[0]=n,e[1]=o):o=e[1];const l=o,c=s>15,u=c?"#10b981":"#94a3b8",d=c?"Active":"Idle";let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=ra(),e[2]=f):f=e[2];const p=f,m=aa[p];let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{let G=!1;try{G=localStorage.getItem(Ns)==="1"}catch{}return la(p,G)},e[3]=g):g=e[3];const[x,h]=a.useState(g);let E;e[4]===Symbol.for("react.memo_cache_sentinel")?(E=G=>{if(h(G),!G)try{localStorage.setItem(Ns,"1")}catch{}},e[4]=E):E=e[4];const w=E,T=r?"text-emerald-500":"text-muted-foreground";let C;e[5]!==T?(C=Me("flex items-center",T),e[5]=T,e[6]=C):C=e[6];let v,j,N,S;e[7]===Symbol.for("react.memo_cache_sentinel")?(v={gap:6},j=i.jsx(nl,{className:"h-3.5 w-3.5 shrink-0"}),N=i.jsx("span",{className:"text-[12px] font-medium",children:"Focus"}),S=i.jsx("span",{"aria-hidden":"true",className:"text-[11px] text-muted-foreground/60",children:"·"}),e[7]=v,e[8]=j,e[9]=N,e[10]=S):(v=e[7],j=e[8],N=e[9],S=e[10]);const k=r?"text-emerald-500":"text-muted-foreground/60";let D;e[11]!==k?(D=Me("text-[11px]",k),e[11]=k,e[12]=D):D=e[12];const I=r?"On":"Off";let M;e[13]!==D||e[14]!==I?(M=i.jsx("span",{className:D,children:I}),e[13]=D,e[14]=I,e[15]=M):M=e[15];let $;e[16]!==M||e[17]!==C?($=i.jsxs("div",{className:C,style:v,children:[j,N,S,M]}),e[16]=M,e[17]=C,e[18]=$):$=e[18];let V;e[19]!==u||e[20]!==s||e[21]!==c||e[22]!==t||e[23]!==d?(V=t&&i.jsxs("div",{className:"flex items-center gap-[12px]",children:[i.jsxs("div",{className:"flex items-center gap-[4px]",children:[i.jsx("span",{className:"h-2 w-2 rounded-full shrink-0 mr-1",style:{background:u}}),i.jsx("span",{className:"text-[12px] font-mono text-foreground/75",children:s}),i.jsx("span",{className:"text-[12px] text-muted-foreground",children:"fps"}),i.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:"·"}),i.jsx("span",{className:Me("text-[11px]",c?"text-emerald-500":"text-muted-foreground/60"),children:d})]}),m&&i.jsxs(i.Fragment,{children:[i.jsx(Us,{orientation:"vertical",className:"h-3"}),p==="standard"?i.jsx("button",{type:"button",onClick:()=>h(!0),className:"text-[11px] text-foreground/70 hover:text-foreground underline-offset-2 hover:underline",children:m}):i.jsx("span",{className:"text-[11px] text-muted-foreground",children:m})]})]}),e[19]=u,e[20]=s,e[21]=c,e[22]=t,e[23]=d,e[24]=V):V=e[24];const z=l?void 0:"sr-only";let H;e[25]!==l?(H=l&&i.jsx("p",{className:"text-[12px] text-muted-foreground leading-relaxed break-words",children:l}),e[25]=l,e[26]=H):H=e[26];let W;e[27]!==z||e[28]!==H?(W=i.jsx("div",{role:"status",className:z,children:H}),e[27]=z,e[28]=H,e[29]=W):W=e[29];let te;e[30]!==n.note?(te=n.note&&i.jsx("p",{className:"text-[12px] text-muted-foreground leading-relaxed break-words",children:n.note}),e[30]=n.note,e[31]=te):te=e[31];let K;e[32]!==x?(K=i.jsx(oa,{open:x,onOpenChange:w}),e[32]=x,e[33]=K):K=e[33];let Z;return e[34]!==$||e[35]!==V||e[36]!==W||e[37]!==te||e[38]!==K?(Z=i.jsxs("div",{className:"w-[300px] shrink-0 mt-3 rounded-xl border bg-background px-4 py-4 flex flex-col gap-3",children:[$,V,W,te,K]}),e[34]=$,e[35]=V,e[36]=W,e[37]=te,e[38]=K,e[39]=Z):Z=e[39],Z}function To(n){const e=ae.c(11),{open:t,onOpenChange:s,openUrl:r}=n,[o,l]=a.useState(0),[c,u]=a.useState(t);c!==t&&(u(t),t&&l(da));let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx(Vs,{className:"sr-only",children:"Open Deeplink"}),e[0]=d):d=e[0];let f;e[1]!==s?(f=()=>s(!1),e[1]=s,e[2]=f):f=e[2];let p;e[3]!==r||e[4]!==o||e[5]!==f?(p=i.jsxs(qs,{className:"w-[500px] max-w-[500px] h-[52px] !rounded-[18px] p-[10px] border border-border bg-background shadow-lg overflow-hidden [&>button]:hidden","aria-describedby":void 0,children:[d,i.jsx(ua,{openUrl:r,close:f},o)]}),e[3]=r,e[4]=o,e[5]=f,e[6]=p):p=e[6];let m;return e[7]!==s||e[8]!==t||e[9]!==p?(m=i.jsx(Ks,{open:t,onOpenChange:s,children:p}),e[7]=s,e[8]=t,e[9]=p,e[10]=m):m=e[10],m}function da(n){return n+1}function ua(n){const e=ae.c(21),{openUrl:t,close:s}=n,[r,o]=a.useState(""),l=a.useRef(null);let c,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{const C=setTimeout(()=>{var v;return(v=l.current)==null?void 0:v.focus()},0);return()=>clearTimeout(C)},u=[],e[0]=c,e[1]=u):(c=e[0],u=e[1]),a.useEffect(c,u);let d;e[2]!==s||e[3]!==t||e[4]!==r?(d=()=>{r.trim()&&(t(r.trim()),s())},e[2]=s,e[3]=t,e[4]=r,e[5]=d):d=e[5];const f=d;let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=i.jsx(Fi,{className:"h-4 w-4 text-muted-foreground shrink-0","aria-hidden":"true"}),e[6]=p):p=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=C=>o(C.target.value),e[7]=m):m=e[7];let g;e[8]!==f?(g=C=>{C.key==="Enter"&&f()},e[8]=f,e[9]=g):g=e[9];let x;e[10]!==g||e[11]!==r?(x=i.jsxs("div",{className:"flex-1 h-[32px] flex items-center gap-2 pl-[4px] pb-[1px]",children:[p,i.jsx("input",{ref:l,"aria-label":"Deeplink URL",className:"flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground min-w-0",placeholder:"myapp://home...",value:r,onChange:m,onKeyDown:g})]}),e[10]=g,e[11]=r,e[12]=x):x=e[12];let h;e[13]!==r?(h=r.trim(),e[13]=r,e[14]=h):h=e[14];const E=!h;let w;e[15]!==f||e[16]!==E?(w=i.jsx(Xe,{size:"sm",disabled:E,onClick:f,className:"shrink-0 rounded-xl h-8 px-4",children:"Open"}),e[15]=f,e[16]=E,e[17]=w):w=e[17];let T;return e[18]!==w||e[19]!==x?(T=i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex items-center gap-3",children:[x,w]})}),e[18]=w,e[19]=x,e[20]=T):T=e[20],T}function fa(n,e,t,s,r,o){const{x:l,y:c,width:u,height:d}=r;let f,p;if(o){const m=(n.x-e.left)/e.width;f=(1-(n.y-e.top)/e.height)*t,p=m*s}else f=(n.x-e.left)*(t/e.width),p=(n.y-e.top)*(s/e.height);return f<l||f>l+u||p<c||p>c+d?null:{x:(f-l)/u,y:(p-c)/d}}function ha(n,e,t){const s=(n.x-e.left)/e.width,r=(n.y-e.top)/e.height;return s<0||s>1||r<0||r>1?null:t?{x:r,y:1-s}:{x:s,y:r}}function Ao(n){return{f0:{x:1-n.x,y:1-n.y},f1:n}}function pa(n,e){return n>0?Math.min(1,e/n):1}function ma(n,e){return(n+(e?90:0))%360}function Dr(n,e,t){const s=t===90||t===270;return{width:s?e:n,height:s?n:e}}function ga(n,e,t,s,r){const{width:o,height:l}=Dr(t,s,r),c=Math.min(n/o,e/l);return{picW:o,picH:l,scale:c,left:(n-o*c)/2,top:(e-l*c)/2}}function ba(n,e,t){const s=n===90||n===270,r=s?t:e,o=s?e:t;return{width:r,height:o,left:(e-r)/2,top:(t-o)/2}}function xa(n,e,t,s){const{width:r,height:o}=Dr(n,e,s);return{width:r,height:o,turn:(t-s+360)%360}}function ya(n){return!n.ready||n.rotating?!1:n.aspectAgrees||!n.frameIsAhead}function wa(n,e,t){if(!n||!e)return!0;const{width:s,height:r}=Dr(n.width,n.height,t);return Math.abs(s/r-e.width/e.height)<.05}function va(n,e){return Math.max(0,n-e)}const ss=22,Is=[84,70,70,69],Sa=1,Ra=0,Xr=1,No=2,_a=1,ka=2,ja=4;function Ea(n){if(n.byteLength<ss)return null;const e=new DataView(n);for(let r=0;r<Is.length;r++)if(e.getUint8(r)!==Is[r])return null;if(e.getUint8(4)!==Sa)return null;const t=e.getUint8(5),s=t&ja?No:t&_a?Xr:Ra;return{capturedAt:Number(e.getBigUint64(6)),relayedAt:Number(e.getBigUint64(14)),codec:s,keyframe:s===Xr&&(t&ka)!==0}}function Io(n){const{binaryFrameHandlerRef:e,perfHookRef:t,frameCount:s}=n,r=a.useRef(n);a.useLayoutEffect(()=>{r.current=n},[n]),a.useEffect(()=>{let o=null,l=!1,c=!1,u;const d=()=>{if(o)return o;if(l)return null;const f=ta();return f?(o=f,f.onResize(p=>r.current.onResize(p)),u=r.current.onDecoderReady(f),f):(l=!0,r.current.onUnsupported(),console.warn("[decoder] none available — set up HTTPS or use a supported browser"),null)};return e.current=(f,p)=>{const m=r.current.onJpegFrame;if(m&&(p==null?void 0:p.codec)!==Xr){m(f,p);return}const g=d();if(g){if(!c){if(!(p!=null&&p.keyframe))return;c=!0}g.decode(f),s.current+=1}},()=>{e.current=void 0,typeof u=="function"&&u(),o==null||o.close(),o==null||o.surface.remove(),o=null}},[e,t,s])}const Ca=3e3+5*300,Ta=Ca+500,Br=8;function Aa(){var n;return window.isSecureContext&&typeof ClipboardItem<"u"&&!!((n=navigator.clipboard)!=null&&n.write)}class Nr extends Error{}function Na(n){const e=n.then(t=>new Blob([t],{type:"text/plain"}));return navigator.clipboard.write([new ClipboardItem({"text/plain":e})])}function ds(n){return!(n.metaKey||n.ctrlKey)||n.altKey?!1:n.code==="KeyV"?!0:!n.shiftKey&&(n.code==="KeyC"||n.code==="KeyX")}const Ia=1024*1024,Pa=n=>new TextEncoder().encode(n).length,Da=n=>{var e;return!!((e=n.payload)!=null&&e.unsupported)},Ma=n=>{var e,t;return((e=n.payload)==null?void 0:e.sentinelParked)===!1||((t=n.payload)==null?void 0:t.unsupported)===!0};function La(){const n=window.getSelection();return!!n&&!n.isCollapsed&&n.toString().length>0}function Ps(){const n=document.activeElement;return!!n&&(n.tagName==="INPUT"||n.tagName==="TEXTAREA"||n.isContentEditable)}function Po(n){const e=ae.c(16),{sessionId:t,send:s,active:r,supported:o,handlerRef:l,sendChord:c,onError:u}=n;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=new Map,e[0]=d):d=e[0];const f=a.useRef(d),p=a.useRef(null),m=a.useRef(u);let g;e[1]!==u?(g=()=>{m.current=u},e[1]=u,e[2]=g):g=e[2],a.useLayoutEffect(g);let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=N=>{var S;p.current!==N&&(p.current=N,(S=m.current)==null||S.call(m,N))},e[3]=x):x=e[3];const h=x;let E,w;e[4]!==l?(E=()=>(l.current=N=>{if(!N.requestId)return;const S=f.current.get(N.requestId);S&&(f.current.delete(N.requestId),S(N))},()=>{l.current=void 0}),w=[l],e[4]=l,e[5]=E,e[6]=w):(E=e[5],w=e[6]),a.useEffect(E,w);let T;e[7]!==s||e[8]!==t?(T=(...N)=>{const[S,k]=N,D=Ce();return new Promise(I=>{const M=setTimeout(()=>{f.current.delete(D),I(null)},Ta);f.current.set(D,$=>{clearTimeout(M),I($)}),s({type:S,sessionId:t,requestId:D,payload:k})})},e[7]=s,e[8]=t,e[9]=T):T=e[9];const C=T;let v,j;e[10]!==r||e[11]!==C||e[12]!==c||e[13]!==o?(v=()=>{if(!r||!o)return;const N=async k=>{if(k.code==="KeyV"||!ds(k))return;const D=k.code==="KeyX";if(Ps()||La()||(k.preventDefault(),k.repeat))return;if(!Aa()){c(D?"KeyX":"KeyC",Br),h("Copied on the device. Serving the dashboard over HTTPS also brings it to your clipboard.");return}let I,M;const $=new Promise((W,te)=>{I=W,M=te});$.catch($a);const V=Na($).catch(W=>{W instanceof Nr||h(W instanceof Error&&W.name==="NotAllowedError"?"Your browser blocked the clipboard write":"Could not write to your clipboard")}),z=await C("clipboard:read",{press:D?"cut":"copy"});if(!z){M(new Nr("timeout")),h("The device is taking too long — try again");return}if(z.type==="clipboard:error"){M(new Nr(z.message||"read failed")),h(z.message||"Clipboard read failed"),Ma(z)&&c(D?"KeyX":"KeyC",Br);return}if(z.type!=="clipboard:data"){M(new Nr("unexpected reply")),h("Clipboard read failed");return}const{text:H}=z.payload;if(p.current=null,!H){M(new Nr("empty"));return}I(H),await V},S=k=>{var I;if(Ps())return;const D=((I=k.clipboardData)==null?void 0:I.getData("text"))??"";if(k.preventDefault(),!D){c("KeyV",Br);return}if(Pa(D)>Ia){h("That text is too large to send to the device");return}C("clipboard:write",{text:D,pasteAfter:!0}).then(M=>{if(!M){h("The device is taking too long — try again");return}if(M.type==="clipboard:write-done"){p.current=null;return}if(M.type!=="clipboard:error"){h("Clipboard write failed");return}h(M.message||"Clipboard write failed"),Da(M)&&c("KeyV",Br)})};return document.addEventListener("keydown",N),document.addEventListener("paste",S),()=>{document.removeEventListener("keydown",N),document.removeEventListener("paste",S)}},j=[r,o,C,c,h],e[10]=r,e[11]=C,e[12]=c,e[13]=o,e[14]=v,e[15]=j):(v=e[14],j=e[15]),a.useEffect(v,j)}function $a(){}function Fa(n){return n.includes("Firefox/")&&n.includes("Macintosh")?"linear-gradient(#fff,#fff)":void 0}const jn=13,hr=8,Ds=16,Ua=.02,Ha=2500;function za(n){const e=ae.c(291),{sessionId:t,buildId:s,send:r,openUrl:o,launchApp:l,connected:c,joined:u,deviceReady:d,installing:f,installed:p,installError:m,bootError:g,launching:x,chrome:h,formFactor:E,binaryFrameHandlerRef:w,clipboardHandlerRef:T,clipboardSupported:C,networkHandlerRef:v,networkSupported:j,onRecordingUploaded:N,swKeyboardVisible:S,swKeyboardPending:k,onKbdToggle:D,rebootPending:I,onReboot:M,restartButtonRef:$,perfHookRef:V,onStreamSize:z}=n,H=a.useRef(null),W=a.useRef(null),te=a.useRef(null),{fps:K,frameCount:Z}=_o(),G=a.useRef(0);let Q;e[0]!==s||e[1]!==N||e[2]!==t?(Q={sessionId:t,buildId:s,onRecordingUploaded:N},e[0]=s,e[1]=N,e[2]=t,e[3]=Q):Q=e[3];const{recordState:re,recordCanvasRef:F,setComposeFrame:pe,startClientRecording:de,stopClientRecording:q}=Ro(Q),J=a.useRef(0),[fe,me]=a.useState(!1),[O,ue]=a.useState(!1),[ge,we]=a.useState(!1);K!==0&&ge&&we(!1);let Le,X;e[4]!==O||e[5]!==K?(Le=()=>{if(K!==0||!O)return;const y=setTimeout(()=>we(!0),Ha);return()=>clearTimeout(y)},X=[K,O],e[4]=O,e[5]=K,e[6]=Le,e[7]=X):(Le=e[6],X=e[7]),a.useEffect(Le,X);const[ne,Te]=a.useState(!1),[he,Oe]=a.useState(!1),[ke,lt]=a.useState(!1),[be,xe]=a.useState(null),[Ye,Ge]=a.useState(null),[tt,ve]=a.useState(!1),[Se,Qe]=a.useState(null),Je=a.useRef(Se);let Rt,Be;e[8]!==Se?(Rt=()=>{Je.current=Se},Be=[Se],e[8]=Se,e[9]=Rt,e[10]=Be):(Rt=e[9],Be=e[10]),a.useEffect(Rt,Be);const Fe=a.useRef(null);let at;e[11]===Symbol.for("react.memo_cache_sentinel")?(at=new Set,e[11]=at):at=e[11];const nt=a.useRef(at),Ue=a.useRef(null);let rt,_t;e[12]===Symbol.for("react.memo_cache_sentinel")?(rt=()=>()=>{Ue.current&&clearTimeout(Ue.current)},_t=[],e[12]=rt,e[13]=_t):(rt=e[12],_t=e[13]),a.useEffect(rt,_t);const st=a.useRef(null),ct=a.useRef(!1),Re=a.useRef(!1),He=a.useRef(0),ot=a.useRef(null),kt=a.useRef(null),Ie=a.useRef("idle"),rn=a.useRef(null),_e=a.useRef(null),$e=a.useRef(null);let We,jt;e[14]!==h?(jt=()=>{$e.current=h},We=[h],e[14]=h,e[15]=We,e[16]=jt):(We=e[15],jt=e[16]),a.useEffect(jt,We);let zt,Et;e[17]!==h.framePng?(zt=()=>{const y=new Image;y.onload=()=>{_e.current=y},y.src=`data:image/png;base64,${h.framePng}`},Et=[h.framePng],e[17]=h.framePng,e[18]=zt,e[19]=Et):(zt=e[18],Et=e[19]),a.useEffect(zt,Et);const Ct=a.useRef(null);let it;e[20]===Symbol.for("react.memo_cache_sentinel")?(it=y=>{const b=H.current;b&&(y.style.left=b.style.left,y.style.top=b.style.top,y.style.width=b.style.width,y.style.height=b.style.height,y.style.borderRadius=b.style.borderRadius,y.style.maskImage=b.style.maskImage)},e[20]=it):it=e[20];const sn=it;let gt;e[21]===Symbol.for("react.memo_cache_sentinel")?(gt=()=>{Ct.current&&sn(Ct.current)},e[21]=gt):gt=e[21];let dt;e[22]!==h?(dt=[h],e[22]=h,e[23]=dt):dt=e[23],a.useLayoutEffect(gt,dt);let Yt;e[24]===Symbol.for("react.memo_cache_sentinel")?(Yt=()=>Te(!0),e[24]=Yt):Yt=e[24];let Ze;e[25]!==z||e[26]!==F?(Ze=y=>{const b=H.current;if(b&&(b.width!==y.width||b.height!==y.height)&&(b.width=y.width,b.height=y.height,z==null||z({width:y.width,height:y.height}),!$e.current)){const _=F.current;_&&(_.width=y.width,_.height=y.height)}ue(!0)},e[25]=z,e[26]=F,e[27]=Ze):Ze=e[27];let on;e[28]===Symbol.for("react.memo_cache_sentinel")?(on=y=>{var ce;const b=y.surface;b.style.position="absolute",sn(b),Ct.current=b,b.style.objectFit="fill",b.style.zIndex="3",b.style.pointerEvents="none",(ce=W.current)==null||ce.appendChild(b);let _=null;const ee=()=>{const L=H.current,ye=L==null?void 0:L.getContext("2d");if(L&&ye&&y.size)try{ye.drawImage(y.surface,0,0,L.width,L.height)}catch{}_=requestAnimationFrame(ee)};return _=requestAnimationFrame(ee),()=>{_!==null&&cancelAnimationFrame(_),Ct.current===b&&(Ct.current=null)}},e[28]=on):on=e[28];let ut;e[29]!==Z||e[30]!==z||e[31]!==V||e[32]!==F?(ut=y=>{const b=performance.now();G.current&&b-G.current,G.current=b;const _=J.current;createImageBitmap(new Blob([y],{type:"image/jpeg"})).then(ee=>{if(performance.now()-b,J.current!==_){ee.close();return}const ce=H.current,L=ce==null?void 0:ce.getContext("2d");if(!ce||!L){ee.close();return}if((ce.width!==ee.width||ce.height!==ee.height)&&(ce.width=ee.width,ce.height=ee.height,z==null||z({width:ee.width,height:ee.height}),!$e.current)){const le=F.current;le&&(le.width=ee.width,le.height=ee.height)}const ye=performance.now();L.drawImage(ee,0,0),performance.now()-ye,ee.close(),ue(!0),Z.current=Z.current+1}).catch(Va)},e[29]=Z,e[30]=z,e[31]=V,e[32]=F,e[33]=ut):ut=e[33];let Gt;e[34]!==w||e[35]!==Z||e[36]!==V||e[37]!==Ze||e[38]!==ut?(Gt={binaryFrameHandlerRef:w,perfHookRef:V,frameCount:Z,onUnsupported:Yt,onResize:Ze,onDecoderReady:on,onJpegFrame:ut},e[34]=w,e[35]=Z,e[36]=V,e[37]=Ze,e[38]=ut,e[39]=Gt):Gt=e[39],Io(Gt);let Ot;e[40]!==F?(Ot=()=>{const y=F.current,b=W.current;y&&b&&(y.width=b.clientWidth,y.height=b.clientHeight)},e[40]=F,e[41]=Ot):Ot=e[41];let Tt;e[42]!==h||e[43]!==F?(Tt=[h,F],e[42]=h,e[43]=F,e[44]=Tt):Tt=e[44],a.useEffect(Ot,Tt);let bt;e[45]!==F?(bt=()=>{const y=F.current,b=H.current;if(!y||!b)return;const _=y.getContext("2d");if(!_)return;const ee=$e.current;if(_.clearRect(0,0,y.width,y.height),ee){_e.current&&_.drawImage(_e.current,0,0,y.width,y.height);const ye=Math.round(ee.screenCornerRadius/2*(y.height/(ee.compositeHeight/2)));_.save(),_.beginPath(),ye>0?_.roundRect(b.offsetLeft,b.offsetTop,b.clientWidth,b.clientHeight,ye):_.rect(b.offsetLeft,b.offsetTop,b.clientWidth,b.clientHeight),_.clip(),_.drawImage(b,b.offsetLeft,b.offsetTop,b.clientWidth,b.clientHeight),_.restore()}else _.drawImage(b,0,0,y.width,y.height);const ce=Je.current;if(ce)for(const ye of[ce.f0,ce.f1]){const le=ee?b.offsetLeft+ye.x*b.clientWidth:ye.x*y.width,Ae=ee?b.offsetTop+ye.y*b.clientHeight:ye.y*y.height;ct.current?(_.beginPath(),_.arc(le,Ae,hr,0,Math.PI*2),_.fillStyle="rgba(255,255,255,0.92)",_.fill(),_.strokeStyle="rgba(0,0,0,0.2)",_.lineWidth=1,_.stroke()):(_.beginPath(),_.arc(le,Ae,jn,0,Math.PI*2),_.strokeStyle="rgba(0,0,0,0.3)",_.lineWidth=3,_.stroke(),_.beginPath(),_.arc(le,Ae,jn,0,Math.PI*2),_.strokeStyle="rgba(255,255,255,0.65)",_.lineWidth=1.5,_.stroke())}const L=kt.current;if(L){const ye=Ie.current,le=rn.current;if(_.save(),ye==="down")_.beginPath(),_.arc(L.x,L.y,hr,0,Math.PI*2),_.fillStyle="rgba(255,255,255,0.92)",_.fill(),_.strokeStyle="rgba(0,0,0,0.2)",_.lineWidth=1,_.stroke();else if(ye==="release"&&le){const Ae=Math.min((performance.now()-le.startTime)/350,1);_.beginPath(),_.arc(L.x,L.y,hr+26*Ae,0,Math.PI*2),_.strokeStyle=`rgba(255,255,255,${(1-Ae)*.55})`,_.lineWidth=1.5,_.stroke(),Ae>=1&&(Ie.current="idle",rn.current=null)}else _.beginPath(),_.arc(L.x,L.y,jn,0,Math.PI*2),_.strokeStyle="rgba(0,0,0,0.3)",_.lineWidth=3,_.stroke(),_.beginPath(),_.arc(L.x,L.y,jn,0,Math.PI*2),_.strokeStyle="rgba(255,255,255,0.65)",_.lineWidth=1.5,_.stroke();_.restore()}},e[45]=F,e[46]=bt):bt=e[46];const Bt=bt;let At,ft;e[47]!==Bt||e[48]!==pe?(At=()=>{pe(Bt)},ft=[Bt,pe],e[47]=Bt,e[48]=pe,e[49]=At,e[50]=ft):(At=e[49],ft=e[50]),a.useLayoutEffect(At,ft);let Nt;e[51]===Symbol.for("react.memo_cache_sentinel")?(Nt=()=>{const y=H.current;if(!y)return;const b=document.createElement("canvas"),_=b.getContext("2d");_&&(b.width=y.width,b.height=y.height,_.drawImage(y,0,0),b.toBlob(Wa,"image/png"))},e[51]=Nt):Nt=e[51];const Wt=Nt;let ht;e[52]!==F||e[53]!==re||e[54]!==de||e[55]!==q?(ht=()=>{if(re==="idle"){const y=F.current;if(!y)return;const b=W.current;if(b&&b.clientWidth>0)y.width=b.clientWidth,y.height=b.clientHeight;else{const _=H.current;if(_&&_.width>0)y.width=_.width,y.height=_.height;else return}de()}else re==="recording"&&q()},e[52]=F,e[53]=re,e[54]=de,e[55]=q,e[56]=ht):ht=e[56];const It=ht,xt=a.useRef(!1);let Ve;e[57]!==r||e[58]!==t?(Ve=()=>{const y=!xt.current;xt.current=y,Oe(y),r({type:"input:rotate",sessionId:t,payload:{orientation:y?"landscape":"portrait"}})},e[57]=r,e[58]=t,e[59]=Ve):Ve=e[59];const qe=Ve,Pt=a.useRef(null);let R,Y;e[60]!==r||e[61]!==t?(R=()=>{Pt.current=()=>{xt.current&&r({type:"input:rotate",sessionId:t,payload:{orientation:"portrait"}})}},Y=[r,t],e[60]=r,e[61]=t,e[62]=R,e[63]=Y):(R=e[62],Y=e[63]),a.useEffect(R,Y);let je,Ne;e[64]===Symbol.for("react.memo_cache_sentinel")?(je=()=>()=>{var y;(y=Pt.current)==null||y.call(Pt)},Ne=[],e[64]=je,e[65]=Ne):(je=e[64],Ne=e[65]),a.useEffect(je,Ne);let oe;e[66]!==r||e[67]!==t?(oe=(y,b)=>{r({type:"input:key",sessionId:t,requestId:Ce(),payload:{code:y,modifiers:b}})},e[66]=r,e[67]=t,e[68]=oe):oe=e[68];const ze=oe;let Dt;e[69]!==T||e[70]!==C||e[71]!==ke||e[72]!==r||e[73]!==ze||e[74]!==t?(Dt={sessionId:t,send:r,active:ke,supported:C,handlerRef:T,sendChord:ze,onError:Ba},e[69]=T,e[70]=C,e[71]=ke,e[72]=r,e[73]=ze,e[74]=t,e[75]=Dt):Dt=e[75],Po(Dt);let Qt;e[76]!==d||e[77]!==v||e[78]!==j||e[79]!==r||e[80]!==t?(Qt={sessionId:t,send:r,supported:j,deviceReady:d,handlerRef:v,onError:Oa},e[76]=d,e[77]=v,e[78]=j,e[79]=r,e[80]=t,e[81]=Qt):Qt=e[81];const Jt=jo(Qt);let En,Cn;e[82]!==C||e[83]!==It||e[84]!==qe||e[85]!==ke||e[86]!==D||e[87]!==r||e[88]!==t||e[89]!==k?(En=()=>{const y=new Set(["ShiftLeft","ShiftRight","ControlLeft","ControlRight","MetaLeft","MetaRight"]),b=L=>{if(L.code==="AltLeft"||L.code==="AltRight"){Re.current=!0;return}if(L.metaKey){const le=document.activeElement;if(!le||le.tagName!=="INPUT"&&le.tagName!=="TEXTAREA"){if(!L.shiftKey&&L.code==="KeyK"){L.preventDefault(),me(!0);return}if(!L.shiftKey&&L.code==="KeyS"){L.preventDefault(),Wt();return}if(L.shiftKey&&L.code==="KeyY"){L.preventDefault(),It();return}if(L.shiftKey&&L.code==="KeyO"){L.preventDefault(),L.repeat||qe();return}if(L.shiftKey&&L.code==="KeyU"){L.preventDefault(),r({type:"input:button",sessionId:t,requestId:Ce(),payload:{name:"home"}});return}if(L.shiftKey&&L.code==="KeyK"){L.preventDefault(),k||D();return}}}if(!ke||y.has(L.code)||C&&ds(L))return;L.preventDefault();const ye=(L.shiftKey?2:0)|(L.ctrlKey?1:0)|(L.metaKey?8:0);r({type:"input:key",sessionId:t,requestId:Ce(),payload:{code:L.code,modifiers:ye}})},_=()=>{ct.current&&(ct.current=!1,ve(!1),r({type:"input:pinch:end",sessionId:t,requestId:Ce()})),Re.current=!1,Qe(null)},ee=L=>{(L.code==="AltLeft"||L.code==="AltRight")&&_()},ce=()=>{Re.current&&_()};return window.addEventListener("keydown",b),window.addEventListener("keyup",ee),window.addEventListener("blur",ce),()=>{window.removeEventListener("keydown",b),window.removeEventListener("keyup",ee),window.removeEventListener("blur",ce)}},Cn=[ke,C,r,t,Wt,It,qe,D,k],e[82]=C,e[83]=It,e[84]=qe,e[85]=ke,e[86]=D,e[87]=r,e[88]=t,e[89]=k,e[90]=En,e[91]=Cn):(En=e[90],Cn=e[91]),a.useEffect(En,Cn);let Tn,rr;e[92]!==ke?(Tn=()=>{if(!ke)return;const y=b=>{const _=W.current??H.current;_&&!_.contains(b.target)&&lt(!1)};return document.addEventListener("pointerdown",y),()=>document.removeEventListener("pointerdown",y)},rr=[ke],e[92]=ke,e[93]=Tn,e[94]=rr):(Tn=e[93],rr=e[94]),a.useEffect(Tn,rr);let An;e[95]!==h.compositeHeight||e[96]!==h.compositeWidth||e[97]!==h.screenRect.height||e[98]!==h.screenRect.width||e[99]!==h.screenRect.x||e[100]!==h.screenRect.y||e[101]!==he?(An=y=>{const b=(he?te.current:null)??W.current;if(!b)return null;const _=b.getBoundingClientRect(),ee=h.compositeWidth/2,ce=h.compositeHeight/2,L=h.screenRect.x/2,ye=h.screenRect.y/2,le=h.screenRect.width/2,Ae=h.screenRect.height/2;return fa({x:y.clientX,y:y.clientY},_,ee,ce,{x:L,y:ye,width:le,height:Ae},he)},e[95]=h.compositeHeight,e[96]=h.compositeWidth,e[97]=h.screenRect.height,e[98]=h.screenRect.width,e[99]=h.screenRect.x,e[100]=h.screenRect.y,e[101]=he,e[102]=An):An=e[102];const yt=An;let Nn;e[103]!==yt?(Nn=y=>{const b=yt(y);return b?Ao(b):null},e[103]=yt,e[104]=Nn):Nn=e[104];const ln=Nn;let In;e[105]!==F?(In=y=>{const b=H.current,_=F.current;return b&&b.clientWidth>0?{x:b.offsetLeft+y.x*b.clientWidth,y:b.offsetTop+y.y*b.clientHeight}:{x:y.x*((_==null?void 0:_.width)??1),y:y.y*((_==null?void 0:_.height)??1)}},e[105]=F,e[106]=In):In=e[106];const an=In;let Pn;e[107]!==an||e[108]!==r||e[109]!==t||e[110]!==yt||e[111]!==ln?(Pn=y=>{if(lt(!0),Re.current){const ce=ln(y);if(!ce)return;ct.current=!0,ve(!0),y.target.setPointerCapture(y.pointerId),Qe(ce),r({type:"input:pinch:start",sessionId:t,payload:ce});return}const b=yt(y);if(!b)return;st.current=b,y.target.setPointerCapture(y.pointerId),kt.current=an(b),Ie.current="down",rn.current=null;const _=y.currentTarget.getBoundingClientRect(),ee=ot.current;ee&&(ee.style.display="block",ee.style.left=`${y.clientX-_.left}px`,ee.style.top=`${y.clientY-_.top}px`,ee.style.width=`${hr*2}px`,ee.style.height=`${hr*2}px`,ee.style.background="rgba(255,255,255,0.92)",ee.style.border="1.5px solid rgba(0,0,0,0.2)",ee.style.boxShadow="0 0 0 1px rgba(0,0,0,0.15), 0 0 8px rgba(255,255,255,0.25)"),r({type:"input:touch:start",sessionId:t,payload:b})},e[107]=an,e[108]=r,e[109]=t,e[110]=yt,e[111]=ln,e[112]=Pn):Pn=e[112];const sr=Pn;let Dn;e[113]!==r||e[114]!==t?(Dn=(y,b)=>{if(!Re.current){if(b.stopPropagation(),Fe.current){nt.current.add(b.pointerId);return}lt(!0),Ue.current&&(clearTimeout(Ue.current),Ue.current=null),Fe.current={name:y,pointerId:b.pointerId},xe(y),b.currentTarget.setPointerCapture(b.pointerId),r({type:"input:button",sessionId:t,requestId:Ce(),payload:{name:y,phase:"down"}})}},e[113]=r,e[114]=t,e[115]=Dn):Dn=e[115];const Mn=Dn;let Ln;e[116]!==an||e[117]!==r||e[118]!==t||e[119]!==yt||e[120]!==ln?(Ln=y=>{var ye;if(nt.current.has(y.pointerId))return;if(y.buttons===0){if(Re.current){Qe(ln(y)),kt.current=null;const le=ot.current;le&&(le.style.display="none")}else{Qe(null);const le=yt(y);kt.current=le?an(le):null,Ie.current!=="down"&&(Ie.current="idle");const Ae=ot.current;if(Ae)if(le){const Hr=y.currentTarget.getBoundingClientRect();Ae.style.display="block",Ae.style.left=`${y.clientX-Hr.left}px`,Ae.style.top=`${y.clientY-Hr.top}px`,Ae.style.width=`${jn*2}px`,Ae.style.height=`${jn*2}px`,Ae.style.background="transparent",Ae.style.border="1.5px solid rgba(255,255,255,0.6)",Ae.style.boxShadow="0 0 0 1px rgba(0,0,0,0.3)"}else Ae.style.display="none"}return}if(ct.current){const le=ln(y);if(!le)return;const Ae=performance.now();if(Ae-He.current<Ds)return;He.current=Ae,Qe(le),r({type:"input:pinch:move",sessionId:t,payload:le});return}if(((ye=Fe.current)==null?void 0:ye.pointerId)===y.pointerId||!st.current)return;const b=yt(y);if(!b)return;const _=b.x-st.current.x,ee=b.y-st.current.y;if(Math.sqrt(_*_+ee*ee)<Ua)return;const ce=performance.now();if(ce-He.current<Ds)return;He.current=ce,kt.current=an(b);const L=ot.current;if(L&&L.style.display!=="none"){const le=y.currentTarget.getBoundingClientRect();L.style.left=`${y.clientX-le.left}px`,L.style.top=`${y.clientY-le.top}px`}r({type:"input:touch:move",sessionId:t,payload:b})},e[116]=an,e[117]=r,e[118]=t,e[119]=yt,e[120]=ln,e[121]=Ln):Ln=e[121];const or=Ln;let $n;e[122]!==r||e[123]!==t?($n=y=>{var _;if(nt.current.delete(y.pointerId))return;if(ct.current){ct.current=!1,ve(!1),Qe(null),r({type:"input:pinch:end",sessionId:t,requestId:Ce()});return}if(st.current=null,((_=Fe.current)==null?void 0:_.pointerId)===y.pointerId){r({type:"input:button",sessionId:t,requestId:Ce(),payload:{name:Fe.current.name,phase:"up"}}),Fe.current=null,Ue.current=setTimeout(()=>{Ue.current=null,xe(null)},100);return}Ie.current="release",rn.current={startTime:performance.now()};const b=ot.current;b&&(b.style.width=`${jn*2}px`,b.style.height=`${jn*2}px`,b.style.background="transparent",b.style.border="1.5px solid rgba(255,255,255,0.6)",b.style.boxShadow="0 0 0 1px rgba(0,0,0,0.3)"),r({type:"input:touch:end",sessionId:t,requestId:Ce()})},e[122]=r,e[123]=t,e[124]=$n):$n=e[124];const ir=$n;let lr;e[125]!==r||e[126]!==t?(lr=y=>{var b;if(!nt.current.delete(y.pointerId)){if(ct.current){ct.current=!1,ve(!1),Qe(null),r({type:"input:pinch:end",sessionId:t,requestId:Ce()});return}if(st.current=null,((b=Fe.current)==null?void 0:b.pointerId)===y.pointerId){r({type:"input:button",sessionId:t,requestId:Ce(),payload:{name:Fe.current.name,phase:"up"}}),Fe.current=null,xe(null);return}Ie.current="release",rn.current={startTime:performance.now()},r({type:"input:touch:end",sessionId:t,requestId:Ce()})}},e[125]=r,e[126]=t,e[127]=lr):lr=e[127];const ar=lr;let cr;e[128]===Symbol.for("react.memo_cache_sentinel")?(cr=()=>{Ge(null),Qe(null),kt.current=null;const y=ot.current;y&&(y.style.display="none")},e[128]=cr):cr=e[128];const yr=cr,wr=h.compositeWidth/2,dr=h.compositeHeight/2,Wn=pa(dr,750),Zt=Math.round(wr*Wn),Mt=Math.round(dr*Wn),hn=h.screenRect.x/h.compositeWidth*100,Vn=h.screenRect.y/h.compositeHeight*100,qn=h.screenRect.width/h.compositeWidth*100,Kn=h.screenRect.height/h.compositeHeight*100,pn=Math.round(h.screenCornerRadius/2*Wn);let Xn;e[129]!==pn?(Xn=pn>0?Fa(navigator.userAgent):void 0,e[129]=pn,e[130]=Xn):Xn=e[130];const mn=Xn,Yn=`${hn}%`,ur=`${Vn}%`,Gn=`${qn}%`,fr=`${Kn}%`,Qn=pn>0?`${pn}px`:void 0;let cn;e[131]!==mn||e[132]!==Yn||e[133]!==ur||e[134]!==Gn||e[135]!==fr||e[136]!==Qn?(cn={left:Yn,top:ur,width:Gn,height:fr,borderRadius:Qn,maskImage:mn},e[131]=mn,e[132]=Yn,e[133]=ur,e[134]=Gn,e[135]=fr,e[136]=Qn,e[137]=cn):cn=e[137];const pt=cn;let Fn,wt;if(e[138]!==h.buttons||e[139]!==h.compositeHeight||e[140]!==h.compositeWidth||e[141]!==E||e[142]!==he){const y={width:h.compositeWidth,height:h.compositeHeight};wt=vl(h.buttons,y),Fn=kl(h.buttons,y,he,E),e[138]=h.buttons,e[139]=h.compositeHeight,e[140]=h.compositeWidth,e[141]=E,e[142]=he,e[143]=Fn,e[144]=wt}else Fn=e[143],wt=e[144];const en=Fn;let Vt;e[145]!==r||e[146]!==t?(Vt=()=>r({type:"input:button",sessionId:t,requestId:Ce(),payload:{name:"home"}}),e[145]=r,e[146]=t,e[147]=Vt):Vt=e[147];let dn;e[148]===Symbol.for("react.memo_cache_sentinel")?(dn=i.jsx(ro,{className:"h-4 w-4"}),e[148]=dn):dn=e[148];let gn;e[149]!==Vt?(gn=i.jsx(Ft,{asChild:!0,children:i.jsx(Xe,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Home",onClick:Vt,children:dn})}),e[149]=Vt,e[150]=gn):gn=e[150];let un;e[151]===Symbol.for("react.memo_cache_sentinel")?(un=i.jsx(Ut,{side:"left",children:i.jsxs("span",{className:"flex items-center gap-3",children:["Home ",i.jsxs(ns,{children:[i.jsx(mr,{children:"⌘"}),i.jsx(mr,{children:"⇧"}),i.jsx(mr,{children:"U"})]})]})}),e[151]=un):un=e[151];let Jn;e[152]!==gn?(Jn=i.jsx(i.Fragment,{children:i.jsxs($t,{children:[gn,un]})}),e[152]=gn,e[153]=Jn):Jn=e[153];const bn=Jn,qt=a.useId(),xn=k?"Changing the software keyboard.":S?"The software keyboard is up.":"The software keyboard is down.";let Kt;e[154]!==qt||e[155]!==xn?(Kt=i.jsx("span",{id:qt,role:"status",className:"sr-only",children:xn}),e[154]=qt,e[155]=xn,e[156]=Kt):Kt=e[156];const yn=k?"Software keyboard — changing it":"Software keyboard";let Xt;e[157]!==D||e[158]!==k?(Xt=()=>{k||D()},e[157]=D,e[158]=k,e[159]=Xt):Xt=e[159];let fn;e[160]!==k?(fn=k?i.jsx(br,{className:"h-4 w-4 animate-spin"}):i.jsx(Gi,{className:"h-4 w-4"}),e[160]=k,e[161]=fn):fn=e[161];let A;e[162]!==qt||e[163]!==k||e[164]!==S||e[165]!==yn||e[166]!==Xt||e[167]!==fn?(A=i.jsx(Ft,{asChild:!0,children:i.jsx(Xe,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":yn,"aria-pressed":S,"aria-busy":k,"aria-disabled":k,"aria-describedby":qt,onClick:Xt,"data-active":S,children:fn})}),e[162]=qt,e[163]=k,e[164]=S,e[165]=yn,e[166]=Xt,e[167]=fn,e[168]=A):A=e[168];let U;e[169]!==k?(U=i.jsx(Ut,{side:"left",children:k?i.jsx("span",{children:"Software keyboard — changing it"}):i.jsxs("span",{className:"flex items-center gap-3",children:["Software keyboard ",i.jsxs(ns,{children:[i.jsx(mr,{children:"⌘"}),i.jsx(mr,{children:"⇧"}),i.jsx(mr,{children:"K"})]})]})}),e[169]=k,e[170]=U):U=e[170];let se;e[171]!==A||e[172]!==U?(se=i.jsxs($t,{children:[A,U]}),e[171]=A,e[172]=U,e[173]=se):se=e[173];let P;e[174]!==Kt||e[175]!==se?(P=i.jsxs(i.Fragment,{children:[Kt,se]}),e[174]=Kt,e[175]=se,e[176]=P):P=e[176];const Pe=P;let B;e[177]!==s||e[178]!==p||e[179]!==l||e[180]!==x?(B=p&&s?i.jsxs($t,{children:[i.jsx(Ft,{asChild:!0,children:i.jsx(Xe,{variant:"ghost",size:"icon",className:"h-8 w-8",disabled:x,"aria-label":"Launch app",onClick:l,children:x?i.jsx(br,{className:"h-4 w-4 animate-spin"}):i.jsx(Ys,{className:"h-4 w-4"})})}),i.jsx(Ut,{side:"left",children:x?"Launching…":"Launch app"})]}):null,e[177]=s,e[178]=p,e[179]=l,e[180]=x,e[181]=B):B=e[181];const Ke=B;let et;e[182]===Symbol.for("react.memo_cache_sentinel")?(et={display:"none"},e[182]=et):et=e[182];let vt;e[183]!==F?(vt=i.jsx("canvas",{ref:F,style:et}),e[183]=F,e[184]=vt):vt=e[184];let Ee;e[185]!==fe||e[186]!==o?(Ee=i.jsx(To,{open:fe,onOpenChange:me,openUrl:o}),e[185]=fe,e[186]=o,e[187]=Ee):Ee=e[187];let wn;e[188]===Symbol.for("react.memo_cache_sentinel")?(wn=()=>me(!0),e[188]=wn):wn=e[188];let Un;e[189]!==Jt||e[190]!==j?(Un=j?{position:Jt.position,steerable:Jt.steerable,reason:Jt.reason,pending:Jt.pending,onToggle:Jt.toggle}:void 0,e[189]=Jt,e[190]=j,e[191]=Un):Un=e[191];let mt;e[192]!==M||e[193]!==I||e[194]!==$?(mt={pending:I,onReboot:M,buttonRef:$},e[192]=M,e[193]=I,e[194]=$,e[195]=mt):mt=e[195];let Hn;e[196]!==Pe||e[197]!==It||e[198]!==qe||e[199]!==u||e[200]!==Ke||e[201]!==bn||e[202]!==re||e[203]!==Un||e[204]!==mt?(Hn=i.jsx(ko,{joined:u,onDeepLink:wn,onScreenshot:Wt,onRecordToggle:It,recordState:re,onRotate:qe,navigationSlot:bn,deviceSlot:Pe,launchSlot:Ke,network:Un,reboot:mt}),e[196]=Pe,e[197]=It,e[198]=qe,e[199]=u,e[200]=Ke,e[201]=bn,e[202]=re,e[203]=Un,e[204]=mt,e[205]=Hn):Hn=e[205];const Lt=he?Mt:Zt,Zn=he?Zt:Mt;let vn;e[206]!==Lt||e[207]!==Zn?(vn={width:Lt,height:Zn,position:"relative",flexShrink:0},e[206]=Lt,e[207]=Zn,e[208]=vn):vn=e[208];let Sn;e[209]!==Mt||e[210]!==Zt||e[211]!==he?(Sn=he?{position:"absolute",top:(Zt-Mt)/2,left:(Mt-Zt)/2,transform:"rotate(-90deg)",transformOrigin:"center center"}:{},e[209]=Mt,e[210]=Zt,e[211]=he,e[212]=Sn):Sn=e[212];let Rn;e[213]!==Mt||e[214]!==Zt||e[215]!==Sn?(Rn={width:Zt,height:Mt,...Sn},e[213]=Mt,e[214]=Zt,e[215]=Sn,e[216]=Rn):Rn=e[216];const vr=`data:image/png;base64,${h.framePng}`;let tn;e[217]===Symbol.for("react.memo_cache_sentinel")?(tn={position:"absolute",top:0,left:0,zIndex:2,width:"100%",height:"100%",display:"block",pointerEvents:"none",userSelect:"none"},e[217]=tn):tn=e[217];let St;e[218]!==vr?(St=i.jsx("img",{src:vr,style:tn,draggable:!1,alt:""}),e[218]=vr,e[219]=St):St=e[219];const _n=O?"visible":"hidden";let zn;e[220]!==pt||e[221]!==_n?(zn=i.jsx("canvas",{ref:H,style:{position:"absolute",zIndex:3,...pt,backgroundColor:"#010101",cursor:"none",visibility:_n}}),e[220]=pt,e[221]=_n,e[222]=zn):zn=e[222];let kn;e[223]!==O||e[224]!==pt?(kn=!O&&i.jsx("div",{className:"absolute overflow-hidden",style:{zIndex:3,...pt},children:i.jsx("div",{className:"absolute inset-0 animate-pulse bg-zinc-700"})}),e[223]=O,e[224]=pt,e[225]=kn):kn=e[225];let Sr;e[226]!==tt||e[227]!==Se||e[228]!==Kn||e[229]!==hn||e[230]!==Vn||e[231]!==qn?(Sr=Se&&(()=>{const y=hn/100,b=Vn/100,_=qn/100,ee=Kn/100,ce=(L,ye)=>({left:`${(y+L*_)*100}%`,top:`${(b+ye*ee)*100}%`});return i.jsx(i.Fragment,{children:[Se.f0,Se.f1].map((L,ye)=>i.jsx("div",{style:{position:"absolute",zIndex:10,borderRadius:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none",transition:"width 0.1s ease, height 0.1s ease, background 0.1s ease",...tt?{width:hr*2,height:hr*2,background:"rgba(255,255,255,0.92)",border:"1.5px solid rgba(0,0,0,0.2)",boxShadow:"0 0 0 1px rgba(0,0,0,0.15), 0 0 8px rgba(255,255,255,0.25)"}:{width:jn*2,height:jn*2,background:"transparent",border:"1.5px solid rgba(255,255,255,0.6)",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)"},...ce(L.x,L.y)}},ye))})})(),e[226]=tt,e[227]=Se,e[228]=Kn,e[229]=hn,e[230]=Vn,e[231]=qn,e[232]=Sr):Sr=e[232];let Rr;e[233]!==O||e[234]!==K||e[235]!==u||e[236]!==pt||e[237]!==ge?(Rr=u&&K===0&&(!O||ge)&&i.jsxs("div",{"data-testid":"screen-waiting",className:"absolute overflow-hidden pointer-events-none flex items-center justify-center",style:{zIndex:8,...pt},children:[O&&i.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 bg-black/60 bg-screen-shimmer bg-[length:200%_100%] animate-screen-shimmer motion-reduce:animate-none"}),i.jsx("span",{className:"relative text-sm text-white",children:O?"Waiting for next frame...":"Waiting for first frame..."})]}),e[233]=O,e[234]=K,e[235]=u,e[236]=pt,e[237]=ge,e[238]=Rr):Rr=e[238];let _r;if(e[239]!==h.buttons||e[240]!==h.compositeHeight||e[241]!==h.compositeWidth||e[242]!==be||e[243]!==Ye||e[244]!==Mn||e[245]!==wt||e[246]!==en){let y;e[248]!==h.compositeHeight||e[249]!==h.compositeWidth||e[250]!==be||e[251]!==Ye||e[252]!==Mn||e[253]!==wt||e[254]!==en?(y=(b,_)=>{const ee=be===b.name,ce=Ye===b.name,L=b.anchor==="top",ye=ls(b),le=ye.top/h.compositeHeight*100,Ae=b.buttonH/h.compositeHeight*100,Hr=b.buttonW/h.compositeWidth*100,ei=b.buttonW/2,zr=ye.left/h.compositeWidth*100,xs=(2*b.rolloverOffset.x-b.normalOffset.x-ei)/h.compositeWidth*100,ti=b.rolloverOffset.x/h.compositeWidth*100,ni=le,ys=L?(2*b.rolloverOffset.y-b.normalOffset.y)/h.compositeHeight*100:0,ri=b.onTop?4:1,Tr=wt[_];return i.jsxs(a.Fragment,{children:[i.jsx("div",{"data-frame-button":b.name,"aria-hidden":"true",onPointerDown:Or=>Mn(b.name,Or),onPointerEnter:()=>Ge(b.name),onPointerLeave:()=>Ge(Or=>Or===b.name?null:Or),style:{position:"absolute",zIndex:6,cursor:"pointer",left:`${Tr.left/h.compositeWidth*100}%`,top:`${Tr.top/h.compositeHeight*100}%`,width:`${(Tr.right-Tr.left)/h.compositeWidth*100}%`,height:`${(Tr.bottom-Tr.top)/h.compositeHeight*100}%`}}),b.buttonPng&&i.jsx("img",{src:`data:image/png;base64,${b.buttonPng}`,style:{position:"absolute",zIndex:ri,top:`${L&&ce?ys:le}%`,left:`${L?zr:ce?xs:zr}%`,width:`${Hr}%`,height:`${Ae}%`,transition:L?"top 0.15s ease":"left 0.15s ease",pointerEvents:"none",userSelect:"none"},draggable:!1,alt:""}),ee&&b.pressedPng&&b.pressedRect&&i.jsx("img",{src:`data:image/png;base64,${b.pressedPng}`,style:{position:"absolute",zIndex:b.onTop?3:1,left:`${L?zr:ce?xs:zr}%`,top:`${L&&ce?ys:le}%`,width:`${b.pressedRect.width/h.compositeWidth*100}%`,height:`${b.pressedRect.height/h.compositeHeight*100}%`,pointerEvents:"none",userSelect:"none"},draggable:!1,alt:""}),ce&&i.jsx("div",{className:"bg-foreground/85 text-background text-[11px] px-[7px] py-1.5 rounded-lg whitespace-nowrap pointer-events-none",style:{position:"absolute",zIndex:5,left:`${ti}%`,top:`${ni}%`,transform:"translate(-50%, calc(-100% - 8px))"},children:en[_]})]},b.name)},e[248]=h.compositeHeight,e[249]=h.compositeWidth,e[250]=be,e[251]=Ye,e[252]=Mn,e[253]=wt,e[254]=en,e[255]=y):y=e[255],_r=h.buttons.map(y),e[239]=h.buttons,e[240]=h.compositeHeight,e[241]=h.compositeWidth,e[242]=be,e[243]=Ye,e[244]=Mn,e[245]=wt,e[246]=en,e[247]=_r}else _r=e[247];let kr;e[256]!==ar||e[257]!==sr||e[258]!==or||e[259]!==ir||e[260]!==Rn||e[261]!==St||e[262]!==zn||e[263]!==kn||e[264]!==Sr||e[265]!==Rr||e[266]!==_r?(kr=i.jsxs("div",{ref:W,className:"relative cursor-default",style:Rn,onPointerDown:sr,onPointerMove:or,onPointerUp:ir,onPointerCancel:ar,onPointerLeave:yr,children:[St,zn,kn,Sr,Rr,_r]}),e[256]=ar,e[257]=sr,e[258]=or,e[259]=ir,e[260]=Rn,e[261]=St,e[262]=zn,e[263]=kn,e[264]=Sr,e[265]=Rr,e[266]=_r,e[267]=kr):kr=e[267];let Fr;e[268]===Symbol.for("react.memo_cache_sentinel")?(Fr=i.jsx("div",{ref:ot,style:{display:"none",position:"absolute",zIndex:20,borderRadius:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none",transition:"width 0.1s ease, height 0.1s ease, background 0.1s ease, box-shadow 0.1s ease"}}),e[268]=Fr):Fr=e[268];let jr;e[269]!==vn||e[270]!==kr?(jr=i.jsxs("div",{ref:te,style:vn,children:[kr,Fr]}),e[269]=vn,e[270]=kr,e[271]=jr):jr=e[271];const Gr=xl(h)?"The device frame couldn't be loaded, so its side buttons (lock, volume) are unavailable this session.":void 0;let Er;e[272]!==g||e[273]!==c||e[274]!==ne||e[275]!==d||e[276]!==K||e[277]!==m||e[278]!==f||e[279]!==u||e[280]!==ke||e[281]!==Gr?(Er=i.jsx(cs,{joined:u,fps:K,connected:c,deviceReady:d,bootError:g,installing:f,installError:m,decoderUnsupported:ne,keyboardActive:ke,note:Gr}),e[272]=g,e[273]=c,e[274]=ne,e[275]=d,e[276]=K,e[277]=m,e[278]=f,e[279]=u,e[280]=ke,e[281]=Gr,e[282]=Er):Er=e[282];let Cr;e[283]!==jr||e[284]!==Er?(Cr=i.jsxs("div",{className:"flex items-start gap-8",children:[jr,Er]}),e[283]=jr,e[284]=Er,e[285]=Cr):Cr=e[285];let Ur;return e[286]!==vt||e[287]!==Ee||e[288]!==Hn||e[289]!==Cr?(Ur=i.jsxs("div",{role:"region","aria-label":"Device screen",className:"flex items-start justify-center gap-16",children:[vt,Ee,Hn,Cr]}),e[286]=vt,e[287]=Ee,e[288]=Hn,e[289]=Cr,e[290]=Ur):Ur=e[290],Ur}function Oa(n){return Ht.error(n)}function Ba(n){return Ht.error(n)}function Wa(n){if(!n)return;const e=URL.createObjectURL(n),t=document.createElement("a");t.href=e,t.download=`tapflow-${Date.now()}.png`,t.click(),URL.revokeObjectURL(e)}function Va(){}const pr=13,Ir=8,Ms=16,qa=.02,Zr=720;function Ka(n){const e=ae.c(191),{sessionId:t,buildId:s,send:r,openUrl:o,launchApp:l,connected:c,joined:u,deviceReady:d,installing:f,installed:p,installError:m,bootError:g,launching:x,androidButtons:h,binaryFrameHandlerRef:E,clipboardHandlerRef:w,clipboardSupported:T,networkHandlerRef:C,networkSupported:v,onRecordingUploaded:j,rebootPending:N,onReboot:S,restartButtonRef:k,screenWidth:D,screenHeight:I,cornerRadius:M,postures:$,streamRotation:V,perfHookRef:z}=n,H=V===void 0?0:V,W=a.useRef(null),te=a.useRef(null),K=a.useRef(null),{fps:Z,frameCount:G}=_o();let Q;e[0]!==s||e[1]!==j||e[2]!==t?(Q={sessionId:t,buildId:s,onRecordingUploaded:j},e[0]=s,e[1]=j,e[2]=t,e[3]=Q):Q=e[3];const{recordState:re,recordCanvasRef:F,setComposeFrame:pe,startClientRecording:de,stopClientRecording:q}=Ro(Q),[J,fe]=a.useState(!1),[me,O]=a.useState(!1),[ue,ge]=a.useState(!1),we=a.useRef(null),[Le,X]=a.useState(null),[ne,Te]=a.useState(!1),he=`${H}:${D??""}:${I??""}`,[Oe,ke]=a.useState(he);Oe!==he&&(ke(he),Te(!1));const[lt,be]=a.useState(!1),[xe,Ye]=a.useState(!1),[Ge,tt]=a.useState(!1),[ve,Se]=a.useState(null),Qe=a.useRef(ve);let Je,Rt;e[4]!==ve?(Je=()=>{Qe.current=ve},Rt=[ve],e[4]=ve,e[5]=Je,e[6]=Rt):(Je=e[5],Rt=e[6]),a.useEffect(Je,Rt);const Be=a.useRef(!1),Fe=a.useRef(!1),at=a.useRef(null),nt=a.useRef(0),Ue=a.useRef(null),rt=a.useRef(null),_t=a.useRef("idle"),st=a.useRef(null);let ct,Re,He;e[7]===Symbol.for("react.memo_cache_sentinel")?(ct=()=>ge(!0),Re=A=>{O(!0);const U=we.current;(!U||U.width!==A.width||U.height!==A.height)&&(we.current=A,X(A),Te(!0))},He=A=>{var se;K.current=A;const U=A.surface;U.style.display="block",U.style.width="100%",U.style.height="100%",U.style.objectFit="fill",(se=W.current)==null||se.appendChild(U)},e[7]=ct,e[8]=Re,e[9]=He):(ct=e[7],Re=e[8],He=e[9]);let ot;e[10]!==E||e[11]!==G||e[12]!==z?(ot={binaryFrameHandlerRef:E,perfHookRef:z,frameCount:G,onUnsupported:ct,onResize:Re,onDecoderReady:He},e[10]=E,e[11]=G,e[12]=z,e[13]=ot):ot=e[13],Io(ot);const kt=D&&I?{width:D,height:I}:null,Ie=kt??Le,rn=Ie?Ie.width>Ie.height:!1,_e=lt&&!rn,$e=ma(H,_e);let We;e[14]!==F||e[15]!==H||e[16]!==$e?(We=()=>{var vr;const A=F.current,U=(vr=K.current)==null?void 0:vr.surface,se=we.current;if(!A||!U||!se)return;const P=A.getContext("2d");if(!P)return;const Pe=se.width,B=se.height,Ke=$e,{picW:et,picH:vt,scale:Ee,left:wn,top:Un}=ga(A.width,A.height,Pe,B,Ke);P.clearRect(0,0,A.width,A.height),P.save(),P.translate(wn+et*Ee/2,Un+vt*Ee/2),P.scale(Ee,Ee),P.rotate(Ke*Math.PI/180),P.drawImage(U,-Pe/2,-B/2,Pe,B),P.restore();const mt=xa(Pe,B,Ke,H);P.save(),P.translate(wn+et*Ee/2,Un+vt*Ee/2),P.scale(Ee,Ee),P.rotate(mt.turn*Math.PI/180),P.translate(-mt.width/2,-mt.height/2);const Hn=Math.max(mt.width,mt.height),Lt=Hn>Zr?Hn/Zr:1,Zn=pr*Lt,vn=Ir*Lt,Sn=Qe.current;if(Sn)for(const tn of[Sn.f0,Sn.f1]){const St=tn.x*mt.width,_n=tn.y*mt.height;Be.current?(P.beginPath(),P.arc(St,_n,vn,0,Math.PI*2),P.fillStyle="rgba(255,255,255,0.92)",P.fill(),P.strokeStyle="rgba(0,0,0,0.2)",P.lineWidth=Lt,P.stroke()):(P.beginPath(),P.arc(St,_n,Zn,0,Math.PI*2),P.strokeStyle="rgba(0,0,0,0.3)",P.lineWidth=3*Lt,P.stroke(),P.beginPath(),P.arc(St,_n,Zn,0,Math.PI*2),P.strokeStyle="rgba(255,255,255,0.65)",P.lineWidth=1.5*Lt,P.stroke())}const Rn=rt.current;if(Rn){const tn=Rn.x*mt.width,St=Rn.y*mt.height,_n=_t.current,zn=st.current;if(_n==="down")P.beginPath(),P.arc(tn,St,vn,0,Math.PI*2),P.fillStyle="rgba(255,255,255,0.92)",P.fill(),P.strokeStyle="rgba(0,0,0,0.2)",P.lineWidth=Lt,P.stroke();else if(_n==="release"&&zn){const kn=Math.min((performance.now()-zn.startTime)/350,1);P.beginPath(),P.arc(tn,St,vn+26*Lt*kn,0,Math.PI*2),P.strokeStyle=`rgba(255,255,255,${(1-kn)*.55})`,P.lineWidth=1.5*Lt,P.stroke(),kn>=1&&(_t.current="idle",st.current=null)}else P.beginPath(),P.arc(tn,St,Zn,0,Math.PI*2),P.strokeStyle="rgba(0,0,0,0.3)",P.lineWidth=3*Lt,P.stroke(),P.beginPath(),P.arc(tn,St,Zn,0,Math.PI*2),P.strokeStyle="rgba(255,255,255,0.65)",P.lineWidth=1.5*Lt,P.stroke()}P.restore()},e[14]=F,e[15]=H,e[16]=$e,e[17]=We):We=e[17];const jt=We;let zt,Et;e[18]!==jt||e[19]!==pe?(zt=()=>{pe(jt)},Et=[jt,pe],e[18]=jt,e[19]=pe,e[20]=zt,e[21]=Et):(zt=e[20],Et=e[21]),a.useLayoutEffect(zt,Et);let Ct;e[22]!==$e?(Ct=()=>{var Ke;const A=(Ke=K.current)==null?void 0:Ke.surface,U=we.current;if(!A||!U)return;const se=document.createElement("canvas"),P=se.getContext("2d");if(!P)return;const Pe=$e,B=Dr(U.width,U.height,Pe);se.width=B.width,se.height=B.height,P.translate(se.width/2,se.height/2),P.rotate(Pe*Math.PI/180),P.drawImage(A,-U.width/2,-U.height/2,U.width,U.height),se.toBlob(Ja,"image/png")},e[22]=$e,e[23]=Ct):Ct=e[23];const it=Ct;let sn;e[24]!==F||e[25]!==re||e[26]!==de||e[27]!==q||e[28]!==$e?(sn=()=>{if(re==="idle"){const A=F.current;if(!A)return;const U=we.current;if(!U)return;const se=Dr(U.width,U.height,$e);A.width=se.width,A.height=se.height,de()}else re==="recording"&&q()},e[24]=F,e[25]=re,e[26]=de,e[27]=q,e[28]=$e,e[29]=sn):sn=e[29];const gt=sn,[dt,Yt]=a.useState(null),Ze=dt!==null,on=a.useRef(0);let ut;e[30]!==r||e[31]!==t?(ut=A=>{on.current=Date.now()+8e3,Yt(A),r({type:"input:posture",sessionId:t,payload:{postureId:A}})},e[30]=r,e[31]=t,e[32]=ut):ut=e[32];const Gt=ut;let Ot;e[33]!==dt||e[34]!==($==null?void 0:$.currentId)?(Ot=()=>{if(dt===null)return;const A=($==null?void 0:$.currentId)===dt,U=setTimeout(()=>Yt(null),A?0:va(on.current,Date.now()));return()=>clearTimeout(U)},e[33]=dt,e[34]=$==null?void 0:$.currentId,e[35]=Ot):Ot=e[35];let Tt;e[36]!==dt||e[37]!==$?(Tt=[dt,$],e[36]=dt,e[37]=$,e[38]=Tt):Tt=e[38],a.useEffect(Ot,Tt);const[bt,Bt]=a.useState(!1);let At,ft;e[39]!==bt?(At=()=>{if(!bt)return;const A=setTimeout(()=>Bt(!1),400);return()=>clearTimeout(A)},ft=[bt],e[39]=bt,e[40]=At,e[41]=ft):(At=e[40],ft=e[41]),a.useEffect(At,ft);const Nt=a.useRef(!1);let Wt;e[42]===Symbol.for("react.memo_cache_sentinel")?(Wt=()=>{if(!Nt.current){Nt.current=!0;return}Bt(!1)},e[42]=Wt):Wt=e[42];let ht;e[43]!==I||e[44]!==D||e[45]!==H?(ht=[H,D,I],e[43]=I,e[44]=D,e[45]=H,e[46]=ht):ht=e[46],a.useEffect(Wt,ht);const It=a.useRef(!1);let xt;e[47]!==r||e[48]!==t?(xt=()=>{const A=!It.current;It.current=A,Bt(!0),r({type:"input:rotate",sessionId:t,payload:{orientation:A?"landscape":"portrait"}}),be(A)},e[47]=r,e[48]=t,e[49]=xt):xt=e[49];const Ve=xt,qe=a.useRef(null);let Pt,R;e[50]!==r||e[51]!==t?(Pt=()=>{qe.current=()=>{It.current&&r({type:"input:rotate",sessionId:t,payload:{orientation:"portrait"}})}},R=[r,t],e[50]=r,e[51]=t,e[52]=Pt,e[53]=R):(Pt=e[52],R=e[53]),a.useEffect(Pt,R);let Y,je;e[54]===Symbol.for("react.memo_cache_sentinel")?(Y=()=>()=>{var A;(A=qe.current)==null||A.call(qe)},je=[],e[54]=Y,e[55]=je):(Y=e[54],je=e[55]),a.useEffect(Y,je);let Ne;e[56]!==r||e[57]!==t?(Ne=(A,U)=>{r({type:"input:key",sessionId:t,requestId:Ce(),payload:{code:A,modifiers:U}})},e[56]=r,e[57]=t,e[58]=Ne):Ne=e[58];const oe=Ne;let ze;e[59]!==w||e[60]!==T||e[61]!==xe||e[62]!==r||e[63]!==oe||e[64]!==t?(ze={sessionId:t,send:r,active:xe,supported:T,handlerRef:w,sendChord:oe,onError:Qa},e[59]=w,e[60]=T,e[61]=xe,e[62]=r,e[63]=oe,e[64]=t,e[65]=ze):ze=e[65],Po(ze);let Dt;e[66]!==d||e[67]!==C||e[68]!==v||e[69]!==r||e[70]!==t?(Dt={sessionId:t,send:r,supported:v,deviceReady:d,handlerRef:C,onError:Ga},e[66]=d,e[67]=C,e[68]=v,e[69]=r,e[70]=t,e[71]=Dt):Dt=e[71];const Qt=jo(Dt);let Jt,En;e[72]!==T||e[73]!==gt||e[74]!==Ve||e[75]!==it||e[76]!==xe||e[77]!==r||e[78]!==t?(Jt=()=>{const A=new Set(["ShiftLeft","ShiftRight","ControlLeft","ControlRight","MetaLeft","MetaRight"]),U=B=>{if(B.code==="AltLeft"||B.code==="AltRight"){Fe.current=!0;return}if(B.metaKey){const et=document.activeElement;if(!et||et.tagName!=="INPUT"&&et.tagName!=="TEXTAREA"){if(!B.shiftKey&&B.code==="KeyK"){B.preventDefault(),fe(!0);return}if(!B.shiftKey&&B.code==="KeyS"){B.preventDefault(),it();return}if(B.shiftKey&&B.code==="KeyY"){B.preventDefault(),gt();return}if(B.shiftKey&&B.code==="KeyO"){B.preventDefault(),B.repeat||Ve();return}}}if(!xe||A.has(B.code)||T&&ds(B))return;B.preventDefault();const Ke=(B.shiftKey?2:0)|(B.ctrlKey?1:0)|(B.metaKey?8:0);r({type:"input:key",sessionId:t,requestId:Ce(),payload:{code:B.code,modifiers:Ke}})},se=()=>{Be.current&&(Be.current=!1,tt(!1),r({type:"input:pinch:end",sessionId:t,requestId:Ce()})),Fe.current=!1,Se(null)},P=B=>{(B.code==="AltLeft"||B.code==="AltRight")&&se()},Pe=()=>{Fe.current&&se()};return window.addEventListener("keydown",U),window.addEventListener("keyup",P),window.addEventListener("blur",Pe),()=>{window.removeEventListener("keydown",U),window.removeEventListener("keyup",P),window.removeEventListener("blur",Pe)}},En=[xe,T,r,t,it,gt,Ve],e[72]=T,e[73]=gt,e[74]=Ve,e[75]=it,e[76]=xe,e[77]=r,e[78]=t,e[79]=Jt,e[80]=En):(Jt=e[79],En=e[80]),a.useEffect(Jt,En);let Cn,Tn;e[81]!==xe?(Cn=()=>{if(!xe)return;const A=U=>{const se=te.current??W.current;se&&!se.contains(U.target)&&Ye(!1)};return document.addEventListener("pointerdown",A),()=>document.removeEventListener("pointerdown",A)},Tn=[xe],e[81]=xe,e[82]=Cn,e[83]=Tn):(Cn=e[82],Tn=e[83]),a.useEffect(Cn,Tn);const rr=a.useRef(!1);let An;e[84]===Symbol.for("react.memo_cache_sentinel")?(An=A=>{const U=W.current;if(!U)return null;const se=U.getBoundingClientRect();return ha({x:A.clientX,y:A.clientY},se,rr.current)},e[84]=An):An=e[84];const yt=An;let Nn;e[85]===Symbol.for("react.memo_cache_sentinel")?(Nn=A=>{const U=yt(A);return U?Ao(U):null},e[85]=Nn):Nn=e[85];const ln=Nn;let In;e[86]!==r||e[87]!==t?(In=A=>{if(Fe.current){const Pe=ln(A);if(!Pe)return;Be.current=!0,tt(!0),A.target.setPointerCapture(A.pointerId);const B=Ue.current;B&&(B.style.display="none"),Se(Pe),r({type:"input:pinch:start",sessionId:t,payload:Pe});return}const U=yt(A);if(!U)return;Ye(!0),at.current=U,A.target.setPointerCapture(A.pointerId);const se=A.currentTarget.getBoundingClientRect();rt.current=U,_t.current="down",st.current=null;const P=Ue.current;P&&(P.style.display="block",P.style.left=`${A.clientX-se.left}px`,P.style.top=`${A.clientY-se.top}px`,P.style.width=`${Ir*2}px`,P.style.height=`${Ir*2}px`,P.style.background="rgba(255,255,255,0.92)",P.style.border="1.5px solid rgba(0,0,0,0.2)",P.style.boxShadow="0 0 0 1px rgba(0,0,0,0.15), 0 0 8px rgba(255,255,255,0.25)"),r({type:"input:touch:start",sessionId:t,payload:U})},e[86]=r,e[87]=t,e[88]=In):In=e[88];const an=In;let Pn;e[89]!==r||e[90]!==t?(Pn=A=>{if(A.buttons===0){if(Fe.current){Se(ln(A)),rt.current=null;const wn=Ue.current;wn&&(wn.style.display="none");return}const et=yt(A),vt=A.currentTarget.getBoundingClientRect(),Ee=Ue.current;et?(rt.current=et,_t.current!=="down"&&(_t.current="idle"),Ee&&(Ee.style.display="block",Ee.style.left=`${A.clientX-vt.left}px`,Ee.style.top=`${A.clientY-vt.top}px`,Ee.style.width=`${pr*2}px`,Ee.style.height=`${pr*2}px`,Ee.style.background="transparent",Ee.style.border="1.5px solid rgba(255,255,255,0.6)",Ee.style.boxShadow="0 0 0 1px rgba(0,0,0,0.3)")):(rt.current=null,Ee&&(Ee.style.display="none"));return}if(Be.current){const et=ln(A);if(!et)return;const vt=performance.now();if(vt-nt.current<Ms)return;nt.current=vt,Se(et),r({type:"input:pinch:move",sessionId:t,payload:et});return}if(!at.current)return;const U=yt(A);if(!U)return;const se=U.x-at.current.x,P=U.y-at.current.y;if(Math.sqrt(se*se+P*P)<qa)return;const Pe=performance.now();if(Pe-nt.current<Ms)return;nt.current=Pe;const B=A.currentTarget.getBoundingClientRect();rt.current=U;const Ke=Ue.current;Ke&&Ke.style.display!=="none"&&(Ke.style.left=`${A.clientX-B.left}px`,Ke.style.top=`${A.clientY-B.top}px`),r({type:"input:touch:move",sessionId:t,payload:U})},e[89]=r,e[90]=t,e[91]=Pn):Pn=e[91];const sr=Pn;let Dn;e[92]!==r||e[93]!==t?(Dn=()=>{if(Be.current){Be.current=!1,tt(!1),Se(null),r({type:"input:pinch:end",sessionId:t,requestId:Ce()});return}at.current=null,_t.current="release",st.current={startTime:performance.now()};const A=Ue.current;A&&(A.style.width=`${pr*2}px`,A.style.height=`${pr*2}px`,A.style.background="transparent",A.style.border="1.5px solid rgba(255,255,255,0.6)",A.style.boxShadow="0 0 0 1px rgba(0,0,0,0.3)"),r({type:"input:touch:end",sessionId:t,requestId:Ce()})},e[92]=r,e[93]=t,e[94]=Dn):Dn=e[94];const Mn=Dn;let Ln;e[95]!==r||e[96]!==t?(Ln=()=>{if(Be.current){Be.current=!1,tt(!1),Se(null),r({type:"input:pinch:end",sessionId:t,requestId:Ce()});return}at.current=null,_t.current="release",st.current={startTime:performance.now()},r({type:"input:touch:end",sessionId:t,requestId:Ce()})},e[95]=r,e[96]=t,e[97]=Ln):Ln=e[97];const or=Ln;let $n;e[98]===Symbol.for("react.memo_cache_sentinel")?($n=()=>{Se(null),rt.current=null;const A=Ue.current;A&&(A.style.display="none")},e[98]=$n):$n=e[98];const ir=$n,lr=Ie?Math.min(1,Zr/Math.max(Ie.width,Ie.height)):.3,ar=Ie?Math.round(Ie.width*lr):324,cr=Ie?Math.round(Ie.height*lr):720;let yr,wr;e[99]!==_e?(yr=()=>{rr.current=_e},wr=[_e],e[99]=_e,e[100]=yr,e[101]=wr):(yr=e[100],wr=e[101]),a.useLayoutEffect(yr,wr);const dr=_e?cr:ar,Wn=_e?ar:cr,Zt=M!=null?Math.round(M*ar):22,Mt=wa(Le,kt,H),hn=ya({ready:me,aspectAgrees:Mt,frameIsAhead:ne,rotating:bt}),Vn=ba($e,dr,Wn),qn=`rotate(${$e}deg)`,Kn=hn?"visible":"hidden";let pn;e[102]!==Vn||e[103]!==qn||e[104]!==Kn?(pn={position:"absolute",...Vn,transform:qn,transformOrigin:"center center",visibility:Kn,cursor:"none"},e[102]=Vn,e[103]=qn,e[104]=Kn,e[105]=pn):pn=e[105];const Xn=pn;let mn,Yn;if(e[106]!==h||e[107]!==r||e[108]!==t){const A=["home","back","recent_apps"],U=["volume_up","volume_down","power"],se=Ya,P=Pe=>i.jsx(i.Fragment,{children:Pe.map(B=>h==null?void 0:h.find(Ke=>Ke.name===B)).filter(Xa).map(B=>i.jsxs($t,{children:[i.jsx(Ft,{asChild:!0,children:i.jsx(Xe,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":B.accessibilityTitle,onClick:()=>r({type:"input:button",sessionId:t,requestId:Ce(),payload:{name:B.name}}),children:se(B.name)})}),i.jsx(Ut,{side:"left",children:B.accessibilityTitle})]},B.name))});mn=P(A),Yn=P(U),e[106]=h,e[107]=r,e[108]=t,e[109]=mn,e[110]=Yn}else mn=e[109],Yn=e[110];const ur=Yn;let Gn;e[111]!==s||e[112]!==p||e[113]!==f||e[114]!==l||e[115]!==x?(Gn=p&&s?i.jsxs($t,{children:[i.jsx(Ft,{asChild:!0,children:i.jsx(Xe,{variant:"ghost",size:"icon",className:"h-8 w-8",disabled:x||f,"aria-label":"Launch app",onClick:l,children:x?i.jsx(br,{className:"h-4 w-4 animate-spin"}):i.jsx(Ys,{className:"h-4 w-4"})})}),i.jsx(Ut,{side:"left",children:x?"Launching…":f?"Installing…":"Launch app"})]}):null,e[111]=s,e[112]=p,e[113]=f,e[114]=l,e[115]=x,e[116]=Gn):Gn=e[116];const fr=Gn;let Qn;e[117]===Symbol.for("react.memo_cache_sentinel")?(Qn={display:"none"},e[117]=Qn):Qn=e[117];let cn;e[118]!==F?(cn=i.jsx("canvas",{ref:F,style:Qn}),e[118]=F,e[119]=cn):cn=e[119];let pt;e[120]!==J||e[121]!==o?(pt=i.jsx(To,{open:J,onOpenChange:fe,openUrl:o}),e[120]=J,e[121]=o,e[122]=pt):pt=e[122];let Fn;e[123]===Symbol.for("react.memo_cache_sentinel")?(Fn=()=>fe(!0),e[123]=Fn):Fn=e[123];let wt;e[124]!==Gt||e[125]!==Ze||e[126]!==$?(wt=$&&$.postures.length>1?{postures:$.postures,currentId:$.currentId,pending:Ze,onSelect:Gt}:void 0,e[124]=Gt,e[125]=Ze,e[126]=$,e[127]=wt):wt=e[127];let en;e[128]!==Qt||e[129]!==v?(en=v?{position:Qt.position,steerable:Qt.steerable,reason:Qt.reason,pending:Qt.pending,onToggle:Qt.toggle}:void 0,e[128]=Qt,e[129]=v,e[130]=en):en=e[130];let Vt;e[131]!==S||e[132]!==N||e[133]!==k?(Vt={pending:N,onReboot:S,buttonRef:k},e[131]=S,e[132]=N,e[133]=k,e[134]=Vt):Vt=e[134];let dn;e[135]!==ur||e[136]!==gt||e[137]!==Ve||e[138]!==it||e[139]!==u||e[140]!==fr||e[141]!==mn||e[142]!==re||e[143]!==wt||e[144]!==en||e[145]!==Vt?(dn=i.jsx(ko,{joined:u,onDeepLink:Fn,onScreenshot:it,onRecordToggle:gt,recordState:re,onRotate:Ve,posture:wt,navigationSlot:mn,deviceSlot:ur,launchSlot:fr,network:en,reboot:Vt}),e[135]=ur,e[136]=gt,e[137]=Ve,e[138]=it,e[139]=u,e[140]=fr,e[141]=mn,e[142]=re,e[143]=wt,e[144]=en,e[145]=Vt,e[146]=dn):dn=e[146];const gn=`${Zt+12}px`;let un;e[147]!==gn?(un={background:"#1c1c1e",borderRadius:gn,padding:"12px",flexShrink:0,boxShadow:"0 8px 32px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06)"},e[147]=gn,e[148]=un):un=e[148];const Jn=`${Zt}px`;let bn;e[149]!==Wn||e[150]!==dr||e[151]!==Jn?(bn={width:dr,height:Wn,backgroundColor:"#010101",borderRadius:Jn,overflow:"hidden"},e[149]=Wn,e[150]=dr,e[151]=Jn,e[152]=bn):bn=e[152];let qt;e[153]!==Xn||e[154]!==ue||e[155]!==d||e[156]!==Mt||e[157]!==or||e[158]!==an||e[159]!==ir||e[160]!==sr||e[161]!==Mn||e[162]!==hn||e[163]!==Ge||e[164]!==ve||e[165]!==Ze?(qt=!ue&&i.jsxs(i.Fragment,{children:[i.jsx("div",{ref:W,style:Xn,onPointerDown:an,onPointerMove:sr,onPointerUp:Mn,onPointerCancel:or,onPointerLeave:ir}),!hn&&i.jsx("div",{className:"absolute inset-0 animate-pulse bg-zinc-700"}),!hn&&d&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:i.jsx("span",{style:{color:"rgba(255,255,255,0.6)",fontSize:"0.875rem"},children:Ze||!Mt?"Changing posture…":"Waiting for stream…"})}),i.jsx("div",{ref:Ue,style:{display:"none",position:"absolute",zIndex:20,borderRadius:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none",transition:"width 0.1s ease, height 0.1s ease, background 0.1s ease, box-shadow 0.1s ease"}}),ve&&i.jsx(i.Fragment,{children:[ve.f0,ve.f1].map((A,U)=>i.jsx("div",{style:{position:"absolute",zIndex:10,borderRadius:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none",transition:"width 0.1s ease, height 0.1s ease, background 0.1s ease",left:`${A.x*100}%`,top:`${A.y*100}%`,...Ge?{width:Ir*2,height:Ir*2,background:"rgba(255,255,255,0.92)",border:"1.5px solid rgba(0,0,0,0.2)",boxShadow:"0 0 0 1px rgba(0,0,0,0.15), 0 0 8px rgba(255,255,255,0.25)"}:{width:pr*2,height:pr*2,background:"transparent",border:"1.5px solid rgba(255,255,255,0.6)",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)"}}},U))})]}),e[153]=Xn,e[154]=ue,e[155]=d,e[156]=Mt,e[157]=or,e[158]=an,e[159]=ir,e[160]=sr,e[161]=Mn,e[162]=hn,e[163]=Ge,e[164]=ve,e[165]=Ze,e[166]=qt):qt=e[166];let xn;e[167]!==bn||e[168]!==qt?(xn=i.jsx("div",{ref:te,className:"relative",style:bn,children:qt}),e[167]=bn,e[168]=qt,e[169]=xn):xn=e[169];let Kt;e[170]!==un||e[171]!==xn?(Kt=i.jsx("div",{style:un,children:xn}),e[170]=un,e[171]=xn,e[172]=Kt):Kt=e[172];let yn;e[173]!==g||e[174]!==c||e[175]!==ue||e[176]!==d||e[177]!==Z||e[178]!==m||e[179]!==f||e[180]!==u||e[181]!==xe?(yn=i.jsx(cs,{joined:u,fps:Z,connected:c,deviceReady:d,bootError:g,installing:f,installError:m,decoderUnsupported:ue,keyboardActive:xe}),e[173]=g,e[174]=c,e[175]=ue,e[176]=d,e[177]=Z,e[178]=m,e[179]=f,e[180]=u,e[181]=xe,e[182]=yn):yn=e[182];let Xt;e[183]!==Kt||e[184]!==yn?(Xt=i.jsxs("div",{className:"flex items-start gap-8",children:[Kt,yn]}),e[183]=Kt,e[184]=yn,e[185]=Xt):Xt=e[185];let fn;return e[186]!==cn||e[187]!==pt||e[188]!==dn||e[189]!==Xt?(fn=i.jsxs("div",{role:"region","aria-label":"Device screen",className:"flex items-start justify-center gap-16",children:[cn,pt,dn,Xt]}),e[186]=cn,e[187]=pt,e[188]=dn,e[189]=Xt,e[190]=fn):fn=e[190],fn}function Xa(n){return n!==void 0}function Ya(n){return n==="back"?i.jsx(Bi,{className:"h-4 w-4"}):n==="recent_apps"?i.jsx(oi,{className:"h-4 w-4"}):n==="volume_up"?i.jsx(ll,{className:"h-4 w-4"}):n==="volume_down"?i.jsx(il,{className:"h-4 w-4"}):n==="power"?i.jsx(Ji,{className:"h-4 w-4"}):i.jsx(ro,{className:"h-4 w-4"})}function Ga(n){return Ht.error(n)}function Qa(n){return Ht.error(n)}function Ja(n){if(!n)return;const e=URL.createObjectURL(n),t=document.createElement("a");t.href=e,t.download=`tapflow-${Date.now()}.png`,t.click(),URL.revokeObjectURL(e)}function Za(n,e){const t=new DataView(n),s=Math.floor(n.byteLength/2),r=Math.floor(s/e),o=[];for(let l=0;l<e;l++)o.push(new Float32Array(r));for(let l=0;l<r;l++)for(let c=0;c<e;c++){const u=t.getInt16((l*e+c)*2,!0);o[c][l]=u/32768}return o}const ec=44100,es=2,Ls=.06,tc=.3;function nc(){const n=ae.c(5),e=a.useRef(null),t=a.useRef(0);let s;n[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>{if(e.current)return e.current;const f=window.AudioContext??window.webkitAudioContext;return f?(e.current=new f,e.current):null},n[0]=s):s=n[0];const r=s;let o;n[1]===Symbol.for("react.memo_cache_sentinel")?(o=f=>{var T;const p=r();if(!p)return;p.state==="suspended"&&p.resume();const m=Za(f,es),g=((T=m[0])==null?void 0:T.length)??0;if(g===0)return;const x=p.createBuffer(es,g,ec);for(let C=0;C<es;C++)x.getChannelData(C).set(m[C]);const h=p.createBufferSource();h.buffer=x,h.connect(p.destination);const E=p.currentTime;let w=t.current;(w<E+.005||w>E+tc+Ls)&&(w=E+Ls),h.start(w),t.current=w+x.duration},n[1]=o):o=n[1];const l=o;let c,u;n[2]===Symbol.for("react.memo_cache_sentinel")?(c=()=>()=>{var f;(f=e.current)==null||f.close(),e.current=null},u=[],n[2]=c,n[3]=u):(c=n[2],u=n[3]),a.useEffect(c,u);let d;return n[4]===Symbol.for("react.memo_cache_sentinel")?(d={pushFrame:l},n[4]=d):d=n[4],d}const rc=2e4;function sc(n){const e=ae.c(32),{sessionId:t,deviceId:s,deviceReady:r,send:o,handlerRef:l,onShutdownComplete:c,onError:u}=n,[d,f]=a.useState(!1),p=a.useRef(null),m=a.useRef(c),g=a.useRef(u);let x,h;e[0]!==c?(x=()=>{m.current=c},h=[c],e[0]=c,e[1]=x,e[2]=h):(x=e[1],h=e[2]),a.useEffect(x,h);let E,w;e[3]!==u?(E=()=>{g.current=u},w=[u],e[3]=u,e[4]=E,e[5]=w):(E=e[4],w=e[5]),a.useEffect(E,w);let T;e[6]!==r||e[7]!==t?(T={sessionId:t,deviceReady:r},e[6]=r,e[7]=t,e[8]=T):T=e[8];const[C,v]=a.useState(T);(C.sessionId!==t||C.deviceReady!==r)&&(v({sessionId:t,deviceReady:r}),(C.sessionId!==t||!r)&&f(!1));let j;e[9]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{p.current=null},e[9]=j):j=e[9];let N;e[10]!==t?(N=[t],e[10]=t,e[11]=N):N=e[11],a.useEffect(j,N);let S,k;e[12]!==r?(S=()=>{r||(p.current=null)},k=[r],e[12]=r,e[13]=S,e[14]=k):(S=e[13],k=e[14]),a.useEffect(S,k);let D,I;e[15]!==l?(D=()=>(l.current=G=>{if(G.requestId===p.current){if(p.current=null,f(!1),G.type==="device:shutdown-error"){g.current(`The device was not restarted. ${G.message}`);return}m.current()}},()=>{l.current=void 0}),I=[l],e[15]=l,e[16]=D,e[17]=I):(D=e[16],I=e[17]),a.useEffect(D,I);const[M,$]=a.useState(null);let V,z;e[18]!==d?(V=()=>{$(d?p.current:null)},z=[d],e[18]=d,e[19]=V,e[20]=z):(V=e[19],z=e[20]),a.useEffect(V,z);let H,W;e[21]!==M?(H=()=>{if(M===null)return;const G=setTimeout(()=>{p.current===M&&(f(!1),g.current("The device has not answered the restart yet. If its answer arrives tapflow will finish restarting it; if nothing changes, press Restart again."))},rc);return()=>clearTimeout(G)},W=[M],e[21]=M,e[22]=H,e[23]=W):(H=e[22],W=e[23]),a.useEffect(H,W);let te;e[24]!==s||e[25]!==d||e[26]!==o||e[27]!==t?(te=()=>{if(d)return;const G=Ce();p.current=G,f(!0),o({type:"device:shutdown",sessionId:t,requestId:G,payload:{deviceId:s}})},e[24]=s,e[25]=d,e[26]=o,e[27]=t,e[28]=te):te=e[28];const K=te;let Z;return e[29]!==d||e[30]!==K?(Z={pending:d,reboot:K},e[29]=d,e[30]=K,e[31]=Z):Z=e[31],Z}const $s={"channel-unavailable":{title:"Input is not reaching this device",action:"Rejoin the session to continue."},"not-booted":{title:"The device is not running",action:"Start it again to continue testing."},"dispatch-failed":{title:"The device rejected that input",action:"Try once more. If it keeps failing, restart the device."},unsupported:{title:"That input is not supported on this device",action:"Everything else still works — this one has no equivalent here."},malformed:{title:"tapflow sent a malformed input",action:"This is a bug in tapflow — please report it with what you were doing."},"channel-starting":null,"no-gesture":null,"not-session-owner":{title:"This session is no longer yours",action:"Go back and open the device again — another tester may have taken it. Nothing you just did reached the device."}};function oc(n){const e=n!==void 0&&Object.hasOwn($s,n)?n:"channel-unavailable";return{key:e,notice:$s[e]}}function ic(n){const e=ae.c(125),{sessionId:t,deviceId:s,formFactor:r,platform:o,buildId:l,resetMode:c,onRecordingUploaded:u,onSessionEnded:d}=n,f=o===void 0?"ios":o,p=a.useRef(cc),m=a.useRef(!1);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={pending:0,appInstalled:!1},e[0]=g):g=e[0];const x=a.useRef(g),{perfMode:h,visible:E}=yl(),w=a.useRef(null),T=a.useRef(null);let C;e[1]===Symbol.for("react.memo_cache_sentinel")?(C=[],e[1]=C):C=e[1];const v=a.useRef(C);let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j={onFrameBegin:()=>{var R;return(R=w.current)==null?void 0:R.onFrameBegin()},onFrameEnd:R=>{var Ne,oe;const Y=v.current.shift()??null,je=Y?{...R,capturedAt:Y.capturedAt,relayedAt:Y.relayedAt}:R;(Ne=w.current)==null||Ne.onFrameEnd(je),(oe=T.current)==null||oe.call(T,je)}},e[2]=j):j=e[2],a.useRef(j);const[N,S]=a.useState(!1),[k,D]=a.useState(!1),[I,M]=a.useState(!1),[$,V]=a.useState(null),[z,H]=a.useState(null);let W;e[3]===Symbol.for("react.memo_cache_sentinel")?(W=R=>{H(Y=>Y&&Y.width===R.width&&Y.height===R.height?Y:R)},e[3]=W):W=e[3];const te=W;let K;e[4]===Symbol.for("react.memo_cache_sentinel")?(K={postures:[],currentId:null},e[4]=K):K=e[4];const[Z,G]=a.useState(K),[Q,re]=a.useState(!1),[F,pe]=a.useState(!1),[de,q]=a.useState(null),[J,fe]=a.useState(null),[me,O]=a.useState(!1);let ue;e[5]===Symbol.for("react.memo_cache_sentinel")?(ue=[],e[5]=ue):ue=e[5];const[ge,we]=a.useState(ue);let Le;e[6]===Symbol.for("react.memo_cache_sentinel")?(Le=new Set,e[6]=Le):Le=e[6];const X=a.useRef(Le),ne=a.useRef(null);let Te;e[7]===Symbol.for("react.memo_cache_sentinel")?(Te=new Set,e[7]=Te):Te=e[7];const he=a.useRef(Te);let Oe;e[8]===Symbol.for("react.memo_cache_sentinel")?(Oe=new Set,e[8]=Oe):Oe=e[8];const ke=a.useRef(Oe);let lt;e[9]===Symbol.for("react.memo_cache_sentinel")?(lt=new Set,e[9]=lt):lt=e[9];const be=a.useRef(lt),[xe,Ye]=a.useState(!1),[Ge,tt]=a.useState(!1),ve=a.useRef(null);let Se,Qe;e[10]===Symbol.for("react.memo_cache_sentinel")?(Se=()=>()=>{ve.current&&clearTimeout(ve.current)},Qe=[],e[10]=Se,e[11]=Qe):(Se=e[10],Qe=e[11]),a.useEffect(Se,Qe);const Je=a.useRef(void 0),Rt=a.useRef(void 0),Be=a.useRef(void 0),Fe=a.useRef(void 0);let at;e[12]!==s||e[13]!==t?(at=R=>{const Y=Ce();X.current.add(Y),ne.current=Y,p.current({type:"device:boot",sessionId:t,requestId:Y,payload:{deviceId:s,resetMode:R,acceptH264:na(),secureContext:window.isSecureContext}})},e[12]=s,e[13]=t,e[14]=at):at=e[14];const nt=at,{pushFrame:Ue}=nc();let rt;e[15]!==k||e[16]!==l||e[17]!==F||e[18]!==d||e[19]!==c||e[20]!==nt||e[21]!==t?(rt=R=>{var Y,je,Ne;if(!("sessionId"in R&&R.sessionId!==t)){if(R.type==="session:joined"){x.current={pending:0,appInstalled:!1},S(!0),D(!1),we(R.capabilities??[]);const oe=m.current?"app-only":c;m.current=!0,X.current.clear(),nt(oe)}if(R.type==="session:agent-away"){D(!0),V(null),M(!1);return}if(R.type==="session:terminated"){d==null||d(R.reason);return}if(R.type==="session:rebound"){M(!1),V(null),re(!1),q(null),fe(null),O(!1),tt(!1),ve.current&&clearTimeout(ve.current),Ye(!1),v.current=[],we(R.capabilities);const oe=k;D(!1),x.current={pending:x.current.pending+1,appInstalled:x.current.pending>0?x.current.appInstalled:F},m.current=!0,nt("app-only"),oe||Ht.info("The agent restarted — reconnecting to the device.");return}if(R.type==="device:boot-error"){if(R.requestId!==void 0&&R.requestId!==ne.current||k)return;x.current={pending:0,appInstalled:!1},fe(R.message)}if(R.type==="input:error"){if(k)return;const{key:oe,notice:ze}=oc(R.reason);R.reason!==void 0&&R.reason!==oe&&console.debug(`[tapflow] unrecognised input:error reason "${R.reason}", treated as ${oe}`),ze?Ht.error(ze.title,{id:`input:${t}:${oe}`,description:R.message?`${ze.action} (${R.message})`:ze.action,duration:6e3}):console.debug(`[tapflow] input refused, shown nowhere: ${oe}${R.message?` — ${R.message}`:""}`)}if(R.type==="device:booting"&&(M(!1),re(!1),pe(!1),q(null),fe(null),G({postures:[],currentId:null}),ke.current.clear(),be.current.clear(),V(null)),R.type==="device:ready"){if(M(!0),R.requestId!==void 0&&!X.current.delete(R.requestId))return;if(x.current.pending>0){const{appInstalled:oe}=x.current;if(x.current={pending:x.current.pending-1,appInstalled:oe},oe){pe(!0);return}}if(l){re(!0);const oe=Ce();ke.current.add(oe),p.current({type:"app:install",sessionId:t,requestId:oe,buildId:l})}}if(R.type==="app:install-done"||R.type==="app:install-error"){if(!ke.current.delete(R.requestId))return;re(!1),R.type==="app:install-done"?pe(!0):q(R.message)}if(R.type==="app:launch-done"||R.type==="app:launch-error"){if(!be.current.delete(R.requestId))return;O(!1),R.type==="app:launch-error"&&Ht.error("The app did not launch",{description:R.message})}if(R.type==="session:chrome"&&V(R.payload),R.type==="device:postures"&&G(R.payload),R.type==="keyboard:toggled"){const{visible:oe}=R.payload;Ye(oe),tt(!1),ve.current&&clearTimeout(ve.current)}if(R.type==="network:state"||R.type==="network:error"){(Y=Be.current)==null||Y.call(Be,R);return}if(R.type==="device:shutdown-done"||R.type==="device:shutdown-error"){(je=Fe.current)==null||je.call(Fe,R);return}if((R.type==="clipboard:data"||R.type==="clipboard:write-done"||R.type==="clipboard:error")&&((Ne=Rt.current)==null||Ne.call(Rt,R)),R.type==="open-url:done"||R.type==="open-url:error"){if(!he.current.delete(R.requestId))return;R.type==="open-url:done"?Ht.success("Deeplink opened"):Ht.error(R.message)}if(R.type==="error")switch(R.reason){case"session-not-found":{d==null||d("agent-disconnected");return}case"session-busy":{d==null||d("busy-elsewhere");return}case"agent-resources-exhausted":{d==null||d("mac-overloaded");return}}}},e[15]=k,e[16]=l,e[17]=F,e[18]=d,e[19]=c,e[20]=nt,e[21]=t,e[22]=rt):rt=e[22];const _t=rt;let st;e[23]!==Ue?(st=R=>{var oe;const Y=Ea(R);if(Y&&Y.codec===No){Ue(R.slice(ss));return}Y&&Y.codec===Xr||v.current.push(Y);const je=Y?R.slice(ss):R,Ne=Y?{codec:Y.codec,keyframe:Y.keyframe,capturedAt:Y.capturedAt,relayedAt:Y.relayedAt}:void 0;(oe=Je.current)==null||oe.call(Je,je,Ne)},e[23]=Ue,e[24]=st):st=e[24];const ct=st,{send:Re,connected:He}=Bs(_t,ct);let ot;e[25]!==Re?(ot=()=>{p.current=Re},e[25]=Re,e[26]=ot):ot=e[26],a.useLayoutEffect(ot);let kt,Ie;e[27]!==He||e[28]!==Re||e[29]!==t?(kt=()=>{He&&Re({type:"session:start",sessionId:t})},Ie=[He,Re,t],e[27]=He,e[28]=Re,e[29]=t,e[30]=kt,e[31]=Ie):(kt=e[30],Ie=e[31]),a.useEffect(kt,Ie);const rn=$!==null&&"framePng"in $?$:null,_e=$!==null&&!("framePng"in $)?$:null;let $e;e[32]!==_e||e[33]!==I||e[34]!==r||e[35]!==f||e[36]!==rn||e[37]!==z?($e=rn??(I&&f==="ios"&&!_e?bl(z??ks(r,f)):null),e[32]=_e,e[33]=I,e[34]=r,e[35]=f,e[36]=rn,e[37]=z,e[38]=$e):$e=e[38];const We=$e;let jt;e[39]!==Re||e[40]!==t?(jt=()=>{tt(!0),ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{tt(!1),Ht.error("The device did not answer. The software keyboard is where it was, as far as tapflow can tell.")},8e3),Re({type:"input:keyboard:toggle",sessionId:t})},e[39]=Re,e[40]=t,e[41]=jt):jt=e[41];const zt=jt;let Et;e[42]!==t?(Et=R=>{const Y=Ce();he.current.add(Y),p.current({type:"open-url",sessionId:t,requestId:Y,payload:{url:R}})},e[42]=t,e[43]=Et):Et=e[43];const Ct=Et;let it;e[44]!==l||e[45]!==t?(it=()=>{if(l===void 0)return;const R=Ce();be.current.add(R),O(!0),p.current({type:"app:launch",sessionId:t,requestId:R,buildId:l})},e[44]=l,e[45]=t,e[46]=it):it=e[46];const sn=it,gt=a.useRef(null),dt=a.useRef(!1),Yt=a.useRef(!1);let Ze;e[47]!==nt?(Ze=()=>{Yt.current=!0,nt("app-only")},e[47]=nt,e[48]=Ze):Ze=e[48];const on=Ze;let ut;e[49]!==s||e[50]!==I||e[51]!==Re||e[52]!==t||e[53]!==on?(ut={sessionId:t,deviceId:s,deviceReady:I,send:Re,handlerRef:Fe,onShutdownComplete:on,onError:ac},e[49]=s,e[50]=I,e[51]=Re,e[52]=t,e[53]=on,e[54]=ut):ut=e[54];const{pending:Gt,reboot:Ot}=sc(ut);let Tt,bt;e[55]!==_e||e[56]!==We?(Tt=()=>{var je;const R=!!(We??_e),Y=!dt.current&&R;dt.current=R,!(!Y||!Yt.current)&&(Yt.current=!1,document.activeElement===document.body&&((je=gt.current)==null||je.focus()))},bt=[We,_e],e[55]=_e,e[56]=We,e[57]=Tt,e[58]=bt):(Tt=e[57],bt=e[58]),a.useEffect(Tt,bt);let Bt,At;e[59]!==k||e[60]!==J?(Bt=()=>{(J||k)&&(Yt.current=!1)},At=[J,k],e[59]=k,e[60]=J,e[61]=Bt,e[62]=At):(Bt=e[61],At=e[62]),a.useEffect(Bt,At);let ft;e[63]!==ge?(ft=ge.includes("clipboard"),e[63]=ge,e[64]=ft):ft=e[64];let Nt;e[65]!==ge?(Nt=ge.includes("network-control"),e[65]=ge,e[66]=Nt):Nt=e[66];let Wt;e[67]!==J||e[68]!==l||e[69]!==He||e[70]!==I||e[71]!==de||e[72]!==F||e[73]!==Q||e[74]!==N||e[75]!==sn||e[76]!==me||e[77]!==zt||e[78]!==u||e[79]!==Ct||e[80]!==Ot||e[81]!==Gt||e[82]!==Re||e[83]!==t||e[84]!==Ge||e[85]!==xe||e[86]!==ft||e[87]!==Nt?(Wt={sessionId:t,buildId:l,send:Re,openUrl:Ct,launchApp:sn,connected:He,joined:N,deviceReady:I,installing:Q,installed:F,installError:de,bootError:J,launching:me,binaryFrameHandlerRef:Je,clipboardHandlerRef:Rt,clipboardSupported:ft,networkHandlerRef:Be,networkSupported:Nt,onRecordingUploaded:u,swKeyboardVisible:xe,swKeyboardPending:Ge,onKbdToggle:zt,rebootPending:Gt,onReboot:Ot,restartButtonRef:gt},e[67]=J,e[68]=l,e[69]=He,e[70]=I,e[71]=de,e[72]=F,e[73]=Q,e[74]=N,e[75]=sn,e[76]=me,e[77]=zt,e[78]=u,e[79]=Ct,e[80]=Ot,e[81]=Gt,e[82]=Re,e[83]=t,e[84]=Ge,e[85]=xe,e[86]=ft,e[87]=Nt,e[88]=Wt):Wt=e[88];const ht=Wt;if(!We&&!_e){let R;e[89]===Symbol.for("react.memo_cache_sentinel")?(R=i.jsx("div",{"aria-hidden":"true",className:"flex flex-col items-center gap-0.5 rounded-2xl border bg-background/90 px-1.5 py-2.5 shrink-0 mt-3 opacity-40",children:Array.from({length:5}).map(lc)}),e[89]=R):R=e[89];let Y;e[90]===Symbol.for("react.memo_cache_sentinel")?(Y={background:"#1c1c1e",borderRadius:"34px",padding:"12px",flexShrink:0},e[90]=Y):Y=e[90];let je;e[91]!==r||e[92]!==f?(je=ks(r,f),e[91]=r,e[92]=f,e[93]=je):je=e[93];let Ne;e[94]!==je?(Ne=i.jsx("div",{"aria-hidden":"true",style:Y,children:i.jsx("div",{"data-testid":"device-skeleton",className:"animate-pulse bg-zinc-700",style:{...je,borderRadius:"22px"}})}),e[94]=je,e[95]=Ne):Ne=e[95];let oe;e[96]!==k||e[97]!==J||e[98]!==He||e[99]!==I||e[100]!==de||e[101]!==Q||e[102]!==N?(oe=i.jsx(cs,{joined:N,fps:0,connected:He,deviceReady:I,bootError:J,installing:Q,installError:de,decoderUnsupported:!1,keyboardActive:!1,agentAway:k}),e[96]=k,e[97]=J,e[98]=He,e[99]=I,e[100]=de,e[101]=Q,e[102]=N,e[103]=oe):oe=e[103];let ze;e[104]!==Ne||e[105]!==oe?(ze=i.jsxs("div",{className:"flex items-start gap-8",children:[Ne,oe]}),e[104]=Ne,e[105]=oe,e[106]=ze):ze=e[106];let Dt;return e[107]!==R||e[108]!==ze?(Dt=i.jsxs("div",{role:"region","aria-label":"Device screen",className:"flex items-start justify-center gap-16",children:[R,ze]}),e[107]=R,e[108]=ze,e[109]=Dt):Dt=e[109],Dt}const It=void 0;let xt;e[110]!==ht||e[111]!==r||e[112]!==We?(xt=We&&i.jsx(za,{...ht,chrome:We,formFactor:r,perfHookRef:It,onStreamSize:te}),e[110]=ht,e[111]=r,e[112]=We,e[113]=xt):xt=e[113];let Ve;e[114]!==_e||e[115]!==ht||e[116]!==Z?(Ve=_e&&i.jsx(Ka,{...ht,androidButtons:_e.buttons,screenWidth:_e.screenWidth,screenHeight:_e.screenHeight,cornerRadius:_e.cornerRadius,postures:Z,streamRotation:_e.streamRotation,perfHookRef:It}),e[114]=_e,e[115]=ht,e[116]=Z,e[117]=Ve):Ve=e[117];let qe;e[118]!==h||e[119]!==E?(qe=!1,e[118]=h,e[119]=E,e[120]=qe):qe=e[120];let Pt;return e[121]!==xt||e[122]!==Ve||e[123]!==qe?(Pt=i.jsxs(i.Fragment,{children:[xt,Ve,qe]}),e[121]=xt,e[122]=Ve,e[123]=qe,e[124]=Pt):Pt=e[124],Pt}function lc(n,e){return i.jsx("div",{className:"h-8 w-8 rounded-md bg-muted animate-pulse"},e)}function ac(n){Ht.error(n)}function cc(){}const Do=a.forwardRef((n,e)=>{const t=ae.c(9);let s,r;t[0]!==n?({className:s,...r}=n,t[0]=n,t[1]=s,t[2]=r):(s=t[1],r=t[2]);let o;t[3]!==s?(o=Me("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",s),t[3]=s,t[4]=o):o=t[4];let l;return t[5]!==r||t[6]!==e||t[7]!==o?(l=i.jsx("textarea",{className:o,ref:e,...r}),t[5]=r,t[6]=e,t[7]=o,t[8]=l):l=t[8],l});Do.displayName="Textarea";var dc=Object.defineProperty,ie=(n,e)=>dc(n,"name",{value:e,configurable:!0});function Mo(n,e){return a.useReducer((t,s)=>e[t][s]??t,n)}ie(Mo,"useStateMachine");var Lo="ScrollArea",[$o,ad]=Hs(Lo),[uc,nn]=$o(Lo),fc=a.forwardRef(ie(function(e,t){const{__scopeScrollArea:s,type:r="hover",dir:o,scrollHideDelay:l=600,...c}=e,[u,d]=a.useState(null),[f,p]=a.useState(null),[m,g]=a.useState(null),[x,h]=a.useState(null),[E,w]=a.useState(null),[T,C]=a.useState(0),[v,j]=a.useState(0),[N,S]=a.useState(!1),[k,D]=a.useState(!1),I=tr(t,d),M=li(o);return i.jsx(uc,{scope:s,type:r,dir:M,scrollHideDelay:l,scrollArea:u,viewport:f,onViewportChange:p,content:m,onContentChange:g,scrollbarX:x,onScrollbarXChange:h,scrollbarXEnabled:N,onScrollbarXEnabledChange:S,scrollbarY:E,onScrollbarYChange:w,scrollbarYEnabled:k,onScrollbarYEnabledChange:D,onCornerWidthChange:C,onCornerHeightChange:j,children:i.jsx(nr.div,{dir:M,...c,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":T+"px","--radix-scroll-area-corner-height":v+"px",...e.style}})})},"ScrollArea")),hc="ScrollAreaViewport",pc=a.forwardRef(ie(function(e,t){const{__scopeScrollArea:s,children:r,nonce:o,...l}=e,c=nn(hc,s),u=a.useRef(null),d=tr(t,u,c.onViewportChange);return i.jsxs(i.Fragment,{children:[i.jsx(mc,{nonce:o}),i.jsx(nr.div,{"data-radix-scroll-area-viewport":"",...l,ref:d,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...e.style},children:i.jsx("div",{ref:c.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})},"ScrollAreaViewport")),mc=a.memo(ie(function({nonce:e}){return i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:e})},"ScrollAreaViewportStyle"),(n,e)=>n.nonce===e.nonce),Bn="ScrollAreaScrollbar",Fo=a.forwardRef(ie(function(e,t){const{forceMount:s,...r}=e,o=nn(Bn,e.__scopeScrollArea),{onScrollbarXEnabledChange:l,onScrollbarYEnabledChange:c}=o,u=e.orientation==="horizontal";return a.useEffect(()=>(u?l(!0):c(!0),()=>{u?l(!1):c(!1)}),[u,l,c]),o.type==="hover"?i.jsx(gc,{...r,ref:t,forceMount:s}):o.type==="scroll"?i.jsx(bc,{...r,ref:t,forceMount:s}):o.type==="auto"?i.jsx(Uo,{...r,ref:t,forceMount:s}):o.type==="always"?i.jsx(us,{...r,ref:t,"data-state":"visible"}):null},"ScrollAreaScrollbar")),gc=a.forwardRef(ie(function(e,t){const{forceMount:s,...r}=e,o=nn(Bn,e.__scopeScrollArea),[l,c]=a.useState(!1);return a.useEffect(()=>{const u=o.scrollArea;let d=0;if(u){const f=ie(()=>{window.clearTimeout(d),c(!0)},"handlePointerEnter"),p=ie(()=>{d=window.setTimeout(()=>c(!1),o.scrollHideDelay)},"handlePointerLeave");return u.addEventListener("pointerenter",f),u.addEventListener("pointerleave",p),()=>{window.clearTimeout(d),u.removeEventListener("pointerenter",f),u.removeEventListener("pointerleave",p)}}},[o.scrollArea,o.scrollHideDelay]),i.jsx(Yr,{present:s||l,children:i.jsx(Uo,{"data-state":l?"visible":"hidden",...r,ref:t})})},"ScrollAreaScrollbarHover")),bc=a.forwardRef(ie(function(e,t){const{forceMount:s,...r}=e,o=nn(Bn,e.__scopeScrollArea),l=e.orientation==="horizontal",c=$r(()=>d("SCROLL_END"),100),[u,d]=Mo("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return a.useEffect(()=>{if(u==="idle"){const f=window.setTimeout(()=>d("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(f)}},[u,o.scrollHideDelay,d]),a.useEffect(()=>{const f=o.viewport,p=l?"scrollLeft":"scrollTop";if(f){let m=f[p];const g=ie(()=>{const x=f[p];m!==x&&(d("SCROLL"),c()),m=x},"handleScroll");return f.addEventListener("scroll",g),()=>f.removeEventListener("scroll",g)}},[o.viewport,l,d,c]),i.jsx(Yr,{present:s||u!=="hidden",children:i.jsx(us,{"data-state":u==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:On(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:On(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),Uo=a.forwardRef(ie(function(e,t){const s=nn(Bn,e.__scopeScrollArea),{forceMount:r,...o}=e,[l,c]=a.useState(!1),u=e.orientation==="horizontal",d=$r(()=>{if(s.viewport){const f=s.viewport.offsetWidth<s.viewport.scrollWidth,p=s.viewport.offsetHeight<s.viewport.scrollHeight;c(u?f:p)}},10);return xr(s.viewport,d),xr(s.content,d),i.jsx(Yr,{present:r||l,children:i.jsx(us,{"data-state":l?"visible":"hidden",...o,ref:t})})},"ScrollAreaScrollbarAuto")),us=a.forwardRef(ie(function(e,t){const{orientation:s="vertical",...r}=e,o=nn(Bn,e.__scopeScrollArea),l=a.useRef(null),c=a.useRef(0),[u,d]=a.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),f=fs(u.viewport,u.content),p={...r,sizes:u,onSizesChange:d,hasThumb:f>0&&f<1,onThumbChange:ie(g=>l.current=g,"onThumbChange"),onThumbPointerUp:ie(()=>c.current=0,"onThumbPointerUp"),onThumbPointerDown:ie(g=>c.current=g,"onThumbPointerDown")};function m(g,x){return Bo(g,c.current,u,x)}return ie(m,"getScrollPosition"),s==="horizontal"?i.jsx(xc,{...p,ref:t,onThumbPositionChange:()=>{if(o.viewport&&l.current){const g=o.viewport.scrollLeft,x=is(g,u,o.dir);l.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollLeft=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollLeft=m(g,o.dir))}}):s==="vertical"?i.jsx(yc,{...p,ref:t,onThumbPositionChange:()=>{if(o.viewport&&l.current){const g=o.viewport.scrollTop,x=is(g,u);l.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollTop=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollTop=m(g))}}):null},"ScrollAreaScrollbarVisible")),xc=a.forwardRef(ie(function(e,t){const{sizes:s,onSizesChange:r,...o}=e,l=nn(Bn,e.__scopeScrollArea),[c,u]=a.useState(),d=a.useRef(null),f=tr(t,d,l.onScrollbarXChange);return a.useEffect(()=>{d.current&&u(getComputedStyle(d.current))},[d]),i.jsx(zo,{"data-orientation":"horizontal",...o,ref:f,sizes:s,style:{bottom:0,left:l.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:l.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Lr(s)+"px",...e.style},onThumbPointerDown:p=>e.onThumbPointerDown(p.x),onDragScroll:p=>e.onDragScroll(p.x),onWheelScroll:(p,m)=>{if(l.viewport){const g=l.viewport.scrollLeft+p.deltaX;e.onWheelScroll(g),ps(g,m)&&p.preventDefault()}},onResize:()=>{d.current&&l.viewport&&c&&r({content:l.viewport.scrollWidth,viewport:l.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Mr(c.paddingLeft),paddingEnd:Mr(c.paddingRight)}})}})},"ScrollAreaScrollbarX")),yc=a.forwardRef(ie(function(e,t){const{sizes:s,onSizesChange:r,...o}=e,l=nn(Bn,e.__scopeScrollArea),[c,u]=a.useState(),d=a.useRef(null),f=tr(t,d,l.onScrollbarYChange);return a.useEffect(()=>{d.current&&u(getComputedStyle(d.current))},[d]),i.jsx(zo,{"data-orientation":"vertical",...o,ref:f,sizes:s,style:{top:0,right:l.dir==="ltr"?0:void 0,left:l.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Lr(s)+"px",...e.style},onThumbPointerDown:p=>e.onThumbPointerDown(p.y),onDragScroll:p=>e.onDragScroll(p.y),onWheelScroll:(p,m)=>{if(l.viewport){const g=l.viewport.scrollTop+p.deltaY;e.onWheelScroll(g),ps(g,m)&&p.preventDefault()}},onResize:()=>{d.current&&l.viewport&&c&&r({content:l.viewport.scrollHeight,viewport:l.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Mr(c.paddingTop),paddingEnd:Mr(c.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[wc,Ho]=$o(Bn),zo=a.forwardRef(ie(function(e,t){const{__scopeScrollArea:s,sizes:r,hasThumb:o,onThumbChange:l,onThumbPointerUp:c,onThumbPointerDown:u,onThumbPositionChange:d,onDragScroll:f,onWheelScroll:p,onResize:m,...g}=e,x=nn(Bn,s),[h,E]=a.useState(null),w=tr(t,E),T=a.useRef(null),C=a.useRef(""),v=x.viewport,j=r.content-r.viewport,N=gr(p),S=gr(d),k=$r(m,10);function D(I){if(T.current){const M=I.clientX-T.current.left,$=I.clientY-T.current.top;f({x:M,y:$})}}return ie(D,"handleDragScroll"),a.useEffect(()=>{const I=ie(M=>{const $=M.target;(h==null?void 0:h.contains($))&&N(M,j)},"handleWheel");return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[v,h,j,N]),a.useEffect(S,[r,S]),xr(h,k),xr(x.content,k),i.jsx(wc,{scope:s,scrollbar:h,hasThumb:o,onThumbChange:gr(l),onThumbPointerUp:gr(c),onThumbPositionChange:S,onThumbPointerDown:gr(u),children:i.jsx(nr.div,{...g,ref:w,style:{position:"absolute",...g.style},onPointerDown:On(e.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),T.current=h.getBoundingClientRect(),C.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),D(I))}),onPointerMove:On(e.onPointerMove,D),onPointerUp:On(e.onPointerUp,I=>{const M=I.target;M.hasPointerCapture(I.pointerId)&&M.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=C.current,x.viewport&&(x.viewport.style.scrollBehavior=""),T.current=null})})})},"ScrollAreaScrollbarImpl")),os="ScrollAreaThumb",vc=a.forwardRef(ie(function(e,t){const{forceMount:s,...r}=e,o=Ho(os,e.__scopeScrollArea);return i.jsx(Yr,{present:s||o.hasThumb,children:i.jsx(Sc,{ref:t,...r})})},"ScrollAreaThumb")),Sc=a.forwardRef(ie(function(e,t){const{__scopeScrollArea:s,style:r,...o}=e,l=nn(os,s),c=Ho(os,s),{onThumbPositionChange:u}=c,d=tr(t,c.onThumbChange),f=a.useRef(void 0),p=$r(()=>{f.current&&(f.current(),f.current=void 0)},100);return a.useEffect(()=>{const m=l.viewport;if(m){const g=ie(()=>{if(p(),!f.current){const x=kc(m,u);f.current=x,u()}},"handleScroll");return u(),m.addEventListener("scroll",g),()=>m.removeEventListener("scroll",g)}},[l.viewport,p,u]),i.jsx(nr.div,{"data-state":c.hasThumb?"visible":"hidden",...o,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:On(e.onPointerDownCapture,m=>{const x=m.target.getBoundingClientRect(),h=m.clientX-x.left,E=m.clientY-x.top;c.onThumbPointerDown({x:h,y:E})}),onPointerUp:On(e.onPointerUp,c.onThumbPointerUp)})},"ScrollAreaThumbImpl")),Oo="ScrollAreaCorner",Rc=a.forwardRef(ie(function(e,t){const s=nn(Oo,e.__scopeScrollArea),r=!!(s.scrollbarX&&s.scrollbarY);return s.type!=="scroll"&&r?i.jsx(_c,{...e,ref:t}):null},"ScrollAreaCorner")),_c=a.forwardRef(ie(function(e,t){const{__scopeScrollArea:s,...r}=e,o=nn(Oo,s),[l,c]=a.useState(0),[u,d]=a.useState(0),f=!!(l&&u),{onCornerWidthChange:p,onCornerHeightChange:m}=o;return xr(o.scrollbarX,()=>{var x;const g=((x=o.scrollbarX)==null?void 0:x.offsetHeight)||0;o.onCornerHeightChange(g),d(g)}),xr(o.scrollbarY,()=>{var x;const g=((x=o.scrollbarY)==null?void 0:x.offsetWidth)||0;o.onCornerWidthChange(g),c(g)}),a.useEffect(()=>()=>{p(0),m(0)},[p,m]),f?i.jsx(nr.div,{...r,ref:t,style:{width:l,height:u,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null},"ScrollAreaCornerImpl"));function Mr(n){return n?parseInt(n,10):0}ie(Mr,"toInt");function fs(n,e){const t=n/e;return isNaN(t)?0:t}ie(fs,"getThumbRatio");function Lr(n){const e=fs(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,s=(n.scrollbar.size-t)*e;return Math.max(s,18)}ie(Lr,"getThumbSize");function Bo(n,e,t,s="ltr"){const r=Lr(t),o=r/2,l=e||o,c=r-l,u=t.scrollbar.paddingStart+l,d=t.scrollbar.size-t.scrollbar.paddingEnd-c,f=t.content-t.viewport,p=s==="ltr"?[0,f]:[f*-1,0];return hs([u,d],p)(n)}ie(Bo,"getScrollPositionFromPointer");function is(n,e,t="ltr"){const s=Lr(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-r,l=e.content-e.viewport,c=o-s,u=t==="ltr"?[0,l]:[l*-1,0],d=Pi(n,u);return hs([0,l],[0,c])(d)}ie(is,"getThumbOffsetFromScroll");function hs(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const s=(e[1]-e[0])/(n[1]-n[0]);return e[0]+s*(t-n[0])}}ie(hs,"linearScale");function ps(n,e){return n>0&&n<e}ie(ps,"isScrollingWithinScrollbarBounds");var kc=ie((n,e=()=>{})=>{let t={left:n.scrollLeft,top:n.scrollTop},s=0;return ie((function r(){const o={left:n.scrollLeft,top:n.scrollTop},l=t.left!==o.left,c=t.top!==o.top;(l||c)&&e(),t=o,s=window.requestAnimationFrame(r)}),"loop")(),()=>window.cancelAnimationFrame(s)},"addUnlinkedScrollListener");function $r(n,e){const t=gr(n),s=a.useRef(0);return a.useEffect(()=>()=>window.clearTimeout(s.current),[]),a.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(t,e)},[t,e])}ie($r,"useDebounceCallback");function xr(n,e){const t=gr(e);ii(()=>{let s=0;if(n){const r=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(t)});return r.observe(n),()=>{window.cancelAnimationFrame(s),r.unobserve(n)}}},[n,t])}ie(xr,"useResizeObserver");var Wo=fc,jc=pc,Ec=Rc;const Vo=a.forwardRef((n,e)=>{const t=ae.c(15);let s,r,o;t[0]!==n?({className:r,children:s,...o}=n,t[0]=n,t[1]=s,t[2]=r,t[3]=o):(s=t[1],r=t[2],o=t[3]);let l;t[4]!==r?(l=Me("relative overflow-hidden",r),t[4]=r,t[5]=l):l=t[5];let c;t[6]!==s?(c=i.jsx(jc,{className:"h-full w-full rounded-[inherit]",children:s}),t[6]=s,t[7]=c):c=t[7];let u,d;t[8]===Symbol.for("react.memo_cache_sentinel")?(u=i.jsx(qo,{}),d=i.jsx(Ec,{}),t[8]=u,t[9]=d):(u=t[8],d=t[9]);let f;return t[10]!==o||t[11]!==e||t[12]!==l||t[13]!==c?(f=i.jsxs(Wo,{ref:e,className:l,...o,children:[c,u,d]}),t[10]=o,t[11]=e,t[12]=l,t[13]=c,t[14]=f):f=t[14],f});Vo.displayName=Wo.displayName;const qo=a.forwardRef((n,e)=>{const t=ae.c(14);let s,r,o;t[0]!==n?({className:s,orientation:o,...r}=n,t[0]=n,t[1]=s,t[2]=r,t[3]=o):(s=t[1],r=t[2],o=t[3]);const l=o===void 0?"vertical":o,c=l==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",u=l==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]";let d;t[4]!==s||t[5]!==c||t[6]!==u?(d=Me("flex touch-none select-none transition-colors",c,u,s),t[4]=s,t[5]=c,t[6]=u,t[7]=d):d=t[7];let f;t[8]===Symbol.for("react.memo_cache_sentinel")?(f=i.jsx(vc,{className:"relative flex-1 rounded-full bg-border"}),t[8]=f):f=t[8];let p;return t[9]!==l||t[10]!==r||t[11]!==e||t[12]!==d?(p=i.jsx(Fo,{ref:e,orientation:l,className:d,...r,children:f}),t[9]=l,t[10]=r,t[11]=e,t[12]=d,t[13]=p):p=t[13],p});qo.displayName=Fo.displayName;function Ko(n){return/[Zz]|[+-]\d{2}/.test(n)?new Date(n):new Date(n.replace(" ","T")+"Z")}function Cc(n){const e=new Map;for(const r of n){const o=Ko(r.created_at).toDateString();e.has(o)||e.set(o,[]),e.get(o).push(r)}const t=new Date().toDateString(),s=new Date(Date.now()-864e5).toDateString();return Array.from(e.entries()).map(([r,o])=>{let l;if(r===t)l="Today";else if(r===s)l="Yesterday";else{const c=new Date(r);l=c.toLocaleDateString(void 0,{month:"short",day:"numeric",...c.getFullYear()!==new Date().getFullYear()?{year:"numeric"}:{}})}return{label:l,items:o}})}function Tc(n){return Ko(n).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}const Ac=5*1024*1024,Nc=["image/png","image/jpeg","image/webp"];function Ic({buildId:n}){const e=a.useId(),[t,s]=a.useState(""),[r,o]=a.useState(null),[l,c]=a.useState(!1),[u,d]=a.useState(""),f=a.useRef(null),p=a.useRef({}),m=zs(),g=Os({queryKey:Kr.comments(n),queryFn:()=>ai(n)}),x=g.data??[],h=()=>{m.invalidateQueries({queryKey:Kr.comments(n)})};a.useEffect(()=>{const v=window.location.hash;if(!v.startsWith("#comment-"))return;const j=Number(v.replace("#comment-","")),N=p.current[j];if(!N)return;N.scrollIntoView({behavior:"smooth"});const S=document.documentElement.classList.contains("dark");N.style.backgroundColor=S?"rgb(0 112 243 / 0.18)":"#d3e5ff",setTimeout(()=>{N.style.backgroundColor=""},2e3)},[g.data]),a.useEffect(()=>{Rs()},[]);async function E(v){const{linkBase:j}=await Rs(),N=zi(j,`${location.pathname}${location.search}#comment-${v}`);try{if(!navigator.clipboard)throw new Error("no clipboard");await navigator.clipboard.writeText(N),Ht.success("Link copied")}catch{Ht.error("Could not copy link")}}function w(v){if(d(""),!Nc.includes(v.type)){d("Only png, jpg, webp allowed");return}if(v.size>Ac){d("Max 5MB");return}o(v)}async function T(v){if(v.preventDefault(),!t.trim()&&!r)return;c(!0);const j=new FormData;j.append("build_id",String(n)),j.append("body",t),r&&j.append("attachment",r),(await fetch("/api/v1/comments",{method:"POST",credentials:"include",body:j})).ok&&(s(""),o(null),h()),c(!1)}const C=Cc(x);return i.jsxs("div",{className:"flex h-full flex-col gap-3 px-1",children:[i.jsx(Vo,{className:"flex-1 rounded-md border",children:i.jsx("div",{className:"p-3",children:g.isPending?i.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"Loading comments…"}):g.isError&&!g.data?i.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"Couldn't load comments."}):x.length===0?i.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No comments yet."}):i.jsx("div",{className:"flex flex-col",children:C.map(({label:v,items:j})=>i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 py-3",children:[i.jsx("div",{className:"h-px flex-1 bg-border"}),i.jsx("span",{className:"text-[11px] font-medium text-muted-foreground px-1 select-none",children:v}),i.jsx("div",{className:"h-px flex-1 bg-border"})]}),i.jsx("div",{className:"flex flex-col gap-4",children:j.map(N=>i.jsxs("div",{id:`comment-${N.id}`,ref:S=>{p.current[N.id]=S},className:"group flex gap-2.5 rounded-md px-2 py-1.5 transition-all",children:[i.jsx("div",{className:"mt-0.5 shrink-0",children:i.jsx(ci,{name:N.author,avatarUrl:N.authorAvatarUrl,size:28})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-sm font-semibold leading-none",children:N.author}),i.jsx("span",{className:"text-[11px] text-muted-foreground leading-none",children:Tc(N.created_at)}),i.jsx(Xe,{variant:"ghost",size:"icon",className:"h-4 w-4 ml-0.5 opacity-0 group-hover:opacity-50 hover:!opacity-100 group-focus-within:opacity-50 focus-visible:!opacity-100 transition-opacity","aria-label":"Copy link to comment",onClick:()=>void E(N.id),children:i.jsx(lo,{className:"h-3 w-3","aria-hidden":"true"})})]}),i.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap mt-1",children:N.body}),N.attachments.map(S=>{const k=decodeURIComponent(S.file_path.split("/").pop()??"image");return i.jsx("a",{href:S.file_path,target:"_blank",rel:"noreferrer",className:"mt-1.5 block","aria-label":`Open ${k} in a new tab`,children:i.jsx("img",{src:S.file_path,alt:k,className:"max-h-48 rounded border object-contain"})},S.id)})]})]},N.id))})]},v))})})}),i.jsx("div",{className:"pb-1",children:i.jsx("form",{onSubmit:T,children:i.jsxs("div",{className:"rounded-md border border-input bg-background ring-offset-background transition-shadow focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",children:[i.jsx(Do,{"aria-label":"Comment",placeholder:"Leave a comment…",value:t,onChange:v=>s(v.target.value),className:"min-h-16 resize-none border-0 bg-transparent shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 text-sm"}),(r||u)&&i.jsxs("div",{className:"px-3 -mt-1 pb-1",children:[r&&i.jsx("p",{className:"text-xs text-muted-foreground",children:r.name}),u&&i.jsx("p",{id:e,role:"alert",className:"text-xs text-destructive",children:u})]}),i.jsxs("div",{className:"flex items-center gap-2 px-2 py-2",children:[i.jsx(Xe,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground","aria-label":"Attach image","aria-describedby":u?e:void 0,onClick:()=>{var v;return(v=f.current)==null?void 0:v.click()},children:i.jsx(Yi,{className:"h-4 w-4","aria-hidden":"true"})}),i.jsx("input",{ref:f,type:"file",accept:"image/png,image/jpeg,image/webp",className:"hidden",onChange:v=>{var N;const j=(N=v.target.files)==null?void 0:N[0];j&&w(j)}}),i.jsx("div",{className:"flex-1"}),i.jsx(Xe,{type:"submit",size:"icon",className:"h-7 w-7 rounded-full","aria-label":"Post comment",disabled:l||!t.trim()&&!r,children:i.jsx(Wi,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})]})})})]})}function Pc(n){return n<1024*1024?`${(n/1024).toFixed(0)} KB`:`${(n/1024/1024).toFixed(1)} MB`}function Dc(n){return new Date(n).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Mc(n){const e=new Date(n).getTime()-Date.now();if(e<=0)return{label:"Expired",urgent:!0};const t=Math.floor(e/36e5);return t<1?{label:"< 1 hour left",urgent:!0}:t<24?{label:`Expires in ${t}h`,urgent:t<6}:{label:`Expires in ${Math.floor(t/24)}d`,urgent:!1}}function Lc(n,e,t){const s=ae.c(7),[r,o]=a.useState(!1);let l;s[0]!==n||s[1]!==e?(l=()=>{if(!n)return;const u=setTimeout(()=>o(!0),e);return()=>{clearTimeout(u),o(!1)}},s[0]=n,s[1]=e,s[2]=l):l=s[2];let c;return s[3]!==n||s[4]!==t||s[5]!==e?(c=[n,e,t],s[3]=n,s[4]=t,s[5]=e,s[6]=c):c=s[6],a.useEffect(l,c),n&&r}function $c(n){const e=ae.c(17),{buildId:t}=n;let s;e[0]!==t?(s=Kr.recordings(t),e[0]=t,e[1]=s):s=e[1];let r;e[2]!==t?(r=()=>di(t),e[2]=t,e[3]=r):r=e[3];let o;e[4]!==s||e[5]!==r?(o={queryKey:s,queryFn:r},e[4]=s,e[5]=r,e[6]=o):o=e[6];const l=Os(o);let c;e[7]!==l.data?(c=l.data??[],e[7]=l.data,e[8]=c):c=e[8];const u=c,d=Lc(l.isPending,250,t);if(l.isPending){let m;return e[9]!==d?(m=d?i.jsx("p",{className:"text-xs text-muted-foreground",children:"Loading recordings…"}):null,e[9]=d,e[10]=m):m=e[10],m}if(l.isError&&!l.data){let m;return e[11]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"Couldn't load recordings."}),e[11]=m):m=e[11],m}if(u.length===0){let m;return e[12]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No recordings yet."}),e[12]=m):m=e[12],m}let f;e[13]!==u?(f=u.map(Fc),e[13]=u,e[14]=f):f=e[14];let p;return e[15]!==f?(p=i.jsx("div",{className:"flex flex-col gap-2",children:f}),e[15]=f,e[16]=p):p=e[16],p}function Fc(n){const e=Mc(n.expiresAt);return i.jsxs("div",{className:"flex items-center justify-between rounded-md border border-border px-3 py-2 text-sm",children:[i.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[i.jsx("span",{className:"text-xs font-medium truncate",children:Dc(n.createdAt)}),i.jsxs("span",{className:`text-xs ${e.urgent?"text-destructive":"text-muted-foreground"}`,children:[e.label," · ",Pc(n.fileSize)]})]}),i.jsx(Xe,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 ml-2",title:"Download",onClick:()=>{const t=document.createElement("a");t.href=n.url,t.download="",t.click()},children:i.jsx(qi,{className:"h-3.5 w-3.5"})})]},n.id)}function Uc(n){const e=ae.c(9),{buildId:t}=n;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsxs(ws,{value:"comments",className:"flex-1 gap-1.5",children:[i.jsx(Qi,{className:"h-3.5 w-3.5"}),"Comments"]}),e[0]=s):s=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx("div",{className:"shrink-0 px-1",children:i.jsxs(bi,{className:"w-full",children:[s,i.jsxs(ws,{value:"recordings",className:"flex-1 gap-1.5",children:[i.jsx(Ki,{className:"h-3.5 w-3.5"}),"Recordings"]})]})}),e[1]=r):r=e[1];let o;e[2]!==t?(o=i.jsx(vs,{value:"comments",className:"mt-3 min-h-0 flex-1 overflow-hidden",children:i.jsx(Ic,{buildId:t})}),e[2]=t,e[3]=o):o=e[3];let l;e[4]!==t?(l=i.jsx(vs,{value:"recordings",className:"mt-3 min-h-0 flex-1 overflow-y-auto",children:i.jsx($c,{buildId:t})}),e[4]=t,e[5]=l):l=e[5];let c;return e[6]!==o||e[7]!==l?(c=i.jsxs(xi,{defaultValue:"comments",className:"flex h-full flex-col",children:[r,o,l]}),e[6]=o,e[7]=l,e[8]=c):c=e[8],c}const Xo=a.forwardRef((n,e)=>{const t=ae.c(5);let s;t[0]!==n?({...s}=n,t[0]=n,t[1]=s):s=t[1];let r;return t[2]!==s||t[3]!==e?(r=i.jsx("nav",{ref:e,"aria-label":"breadcrumb",...s}),t[2]=s,t[3]=e,t[4]=r):r=t[4],r});Xo.displayName="Breadcrumb";const Yo=a.forwardRef((n,e)=>{const t=ae.c(9);let s,r;t[0]!==n?({className:s,...r}=n,t[0]=n,t[1]=s,t[2]=r):(s=t[1],r=t[2]);let o;t[3]!==s?(o=Me("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",s),t[3]=s,t[4]=o):o=t[4];let l;return t[5]!==r||t[6]!==e||t[7]!==o?(l=i.jsx("ol",{ref:e,className:o,...r}),t[5]=r,t[6]=e,t[7]=o,t[8]=l):l=t[8],l});Yo.displayName="BreadcrumbList";const Pr=a.forwardRef((n,e)=>{const t=ae.c(9);let s,r;t[0]!==n?({className:s,...r}=n,t[0]=n,t[1]=s,t[2]=r):(s=t[1],r=t[2]);let o;t[3]!==s?(o=Me("inline-flex items-center gap-1.5",s),t[3]=s,t[4]=o):o=t[4];let l;return t[5]!==r||t[6]!==e||t[7]!==o?(l=i.jsx("li",{ref:e,className:o,...r}),t[5]=r,t[6]=e,t[7]=o,t[8]=l):l=t[8],l});Pr.displayName="BreadcrumbItem";const Wr=a.forwardRef((n,e)=>{const t=ae.c(11);let s,r,o;t[0]!==n?({asChild:s,className:r,...o}=n,t[0]=n,t[1]=s,t[2]=r,t[3]=o):(s=t[1],r=t[2],o=t[3]);const l=s?ui:"a";let c;t[4]!==r?(c=Me("transition-colors hover:text-foreground cursor-pointer",r),t[4]=r,t[5]=c):c=t[5];let u;return t[6]!==l||t[7]!==o||t[8]!==e||t[9]!==c?(u=i.jsx(l,{ref:e,className:c,...o}),t[6]=l,t[7]=o,t[8]=e,t[9]=c,t[10]=u):u=t[10],u});Wr.displayName="BreadcrumbLink";const Vr=a.forwardRef((n,e)=>{const t=ae.c(9);let s,r;t[0]!==n?({className:s,...r}=n,t[0]=n,t[1]=s,t[2]=r):(s=t[1],r=t[2]);let o;t[3]!==s?(o=Me("font-medium text-foreground",s),t[3]=s,t[4]=o):o=t[4];let l;return t[5]!==r||t[6]!==e||t[7]!==o?(l=i.jsx("span",{ref:e,role:"link","aria-disabled":"true","aria-current":"page",className:o,...r}),t[5]=r,t[6]=e,t[7]=o,t[8]=l):l=t[8],l});Vr.displayName="BreadcrumbPage";const qr=n=>{const e=ae.c(12);let t,s,r;e[0]!==n?({children:t,className:s,...r}=n,e[0]=n,e[1]=t,e[2]=s,e[3]=r):(t=e[1],s=e[2],r=e[3]);let o;e[4]!==s?(o=Me("[&>svg]:h-3.5 [&>svg]:w-3.5",s),e[4]=s,e[5]=o):o=e[5];let l;e[6]!==t?(l=t??i.jsx(fi,{}),e[6]=t,e[7]=l):l=e[7];let c;return e[8]!==r||e[9]!==o||e[10]!==l?(c=i.jsx("li",{role:"presentation","aria-hidden":"true",className:o,...r,children:l}),e[8]=r,e[9]=o,e[10]=l,e[11]=c):c=e[11],c};qr.displayName="BreadcrumbSeparator";var Hc=Object.defineProperty,er=(n,e)=>Hc(n,"name",{value:e,configurable:!0}),ms="Switch",[zc,cd]=Hs(ms),[Oc,gs]=zc(ms);function Go(n){const{__scopeSwitch:e,checked:t,children:s,defaultChecked:r,disabled:o,form:l,name:c,onCheckedChange:u,required:d,value:f="on",internal_do_not_use_render:p}=n,[m,g]=pi({prop:t,defaultProp:r??!1,onChange:u,caller:ms}),[x,h]=a.useState(null),[E,w]=a.useState(null),T=a.useRef(!1),[C,v]=a.useReducer(S=>S+1,0),j=x?!!l||!!x.closest("form"):!0,N={checked:m,setChecked:g,disabled:o,control:x,setControl:h,name:c,form:l,value:f,hasConsumerStoppedPropagationRef:T,userInteractionCount:C,onUserInteraction:v,required:d,defaultChecked:r,isFormControl:j,bubbleInput:E,setBubbleInput:w};return i.jsx(Oc,{scope:e,...N,children:Jo(p)?p(N):s})}er(Go,"SwitchProvider");var Bc="SwitchTrigger",Wc=a.forwardRef(er(function({__scopeSwitch:e,onClick:t,...s},r){const{control:o,form:l,value:c,disabled:u,checked:d,required:f,setControl:p,setChecked:m,hasConsumerStoppedPropagationRef:g,onUserInteraction:x,isFormControl:h,bubbleInput:E}=gs(Bc,e),w=tr(r,p),T=a.useRef(d);return a.useEffect(()=>{const C=l?o==null?void 0:o.ownerDocument.getElementById(l):o==null?void 0:o.form;if(C instanceof HTMLFormElement){const v=er(()=>m(T.current),"reset");return C.addEventListener("reset",v),()=>C.removeEventListener("reset",v)}},[o,l,m]),i.jsx(nr.button,{type:"button",role:"switch","aria-checked":d,"aria-required":f,"data-state":bs(d),"data-disabled":u?"":void 0,disabled:u,value:c,...s,ref:w,onClick:On(t,C=>{x(),m(v=>!v),E&&h&&(g.current=C.isPropagationStopped(),g.current||C.stopPropagation())})})},"SwitchTrigger")),Qo=a.forwardRef(er(function(e,t){const{__scopeSwitch:s,name:r,checked:o,defaultChecked:l,required:c,disabled:u,value:d,onCheckedChange:f,form:p,...m}=e;return i.jsx(Go,{__scopeSwitch:s,checked:o,defaultChecked:l,disabled:u,required:c,onCheckedChange:f,name:r,form:p,value:d,internal_do_not_use_render:({isFormControl:g})=>i.jsxs(i.Fragment,{children:[i.jsx(Wc,{...m,ref:t,__scopeSwitch:s}),g&&i.jsx(Xc,{__scopeSwitch:s})]})})},"Switch")),Vc="SwitchThumb",qc=a.forwardRef(er(function(e,t){const{__scopeSwitch:s,...r}=e,o=gs(Vc,s);return i.jsx(nr.span,{"data-state":bs(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})},"SwitchThumb")),Kc="SwitchBubbleInput",Xc=a.forwardRef(er(function({__scopeSwitch:e,onClick:t,...s},r){const{control:o,hasConsumerStoppedPropagationRef:l,userInteractionCount:c,checked:u,defaultChecked:d,required:f,disabled:p,name:m,value:g,form:x,bubbleInput:h,setBubbleInput:E}=gs(Kc,e),w=tr(r,E),T=hi(o),C=a.useRef(!1),v=a.useRef(u),j=a.useRef(c);a.useEffect(()=>{const S=h;if(!S)return;const k=window.HTMLInputElement.prototype,I=Object.getOwnPropertyDescriptor(k,"checked").set,M=c!==j.current;j.current=c;const $=v.current!==u;v.current=u;const V=!(M&&l.current);if($&&I){C.current=!M;const z=new Event("click",{bubbles:V});I.call(S,u),S.dispatchEvent(z),C.current=!1}},[h,u,l,c]);const N=a.useRef(u);return i.jsx(nr.input,{type:"checkbox","aria-hidden":!0,defaultChecked:d??N.current,required:f,disabled:p,name:m,value:g,form:x,...s,tabIndex:-1,ref:w,onClick:On(t,S=>{C.current&&S.stopPropagation()}),style:{...s.style,...T,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function Jo(n){return typeof n=="function"}er(Jo,"isFunction");function bs(n){return n?"checked":"unchecked"}er(bs,"getState");const Zo=a.forwardRef((n,e)=>{const t=ae.c(10);let s,r;t[0]!==n?({className:s,...r}=n,t[0]=n,t[1]=s,t[2]=r):(s=t[1],r=t[2]);let o;t[3]!==s?(o=Me("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",s),t[3]=s,t[4]=o):o=t[4];let l;t[5]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsx(qc,{className:Me("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")}),t[5]=l):l=t[5];let c;return t[6]!==r||t[7]!==e||t[8]!==o?(c=i.jsx(Qo,{className:o,...r,ref:e,children:l}),t[6]=r,t[7]=e,t[8]=o,t[9]=c):c=t[9],c});Zo.displayName=Qo.displayName;const Yc={"agent-disconnected":{title:"The agent disconnected — this session ended.",description:"Pick the Mac again to start a new session."},"busy-elsewhere":{title:"This device is already open in another browser session.",description:"Someone else may be testing it. If you reloaded while your connection was down it is your own tab, and that clears within about 45 seconds."},"mac-overloaded":{title:"That Mac is too busy to start a session.",description:"Pick a different Mac, or wait for it to settle."}};function dd(){const n=ae.c(62),[e]=Ws(),t=vi();let s;n[0]!==e?(s=e.get("id"),n[0]=e,n[1]=s):s=n[1];const r=s,{build:o}=al(r),l=zs(),c=(o==null?void 0:o.platform)??"ios",{sessions:u,activeFormFactor:d,selectedAgent:f,setSelectedAgent:p,activeSessionId:m,deviceId:g,booting:x,status:h,connected:E,agentGroups:w,startDevice:T,resetDevice:C,handleBack:v,handleBackToMacs:j,handleSessionEnded:N}=cl(c);let S;if(n[2]!==w||n[3]!==f){let X;n[5]!==f?(X=ne=>ne.agentName===f,n[5]=f,n[6]=X):X=n[6],S=w.find(X),n[2]=w,n[3]=f,n[4]=S}else S=n[4];const k=S,{osVersions:D,osVersion:I,setOsVersion:M,deviceSearch:$,setDeviceSearch:V,versionedDevices:z,resetMode:H,setResetMode:W,appliedResetMode:te,consumeResetMode:K,fullResetSupported:Z}=ul(k,c);let G;if(n[7]!==g||n[8]!==u){const X=u.flatMap(Qc);let ne;n[10]!==g?(ne=Te=>Te.id===g,n[10]=g,n[11]=ne):ne=n[11],G=X.find(ne),n[7]=g,n[8]=u,n[9]=G}else G=n[9];const Q=G,re=Q?`${Q.name}${Q.osVersion?` · ${Q.osVersion}`:""}`:"";let F;n[12]!==l?(F=()=>{l.invalidateQueries({queryKey:Kr.allRecordings})},n[12]=l,n[13]=F):F=n[13];const pe=F;let de;n[14]!==K||n[15]!==T?(de=X=>{K(),T(X)},n[14]=K,n[15]=T,n[16]=de):de=n[16];const q=de;let J;n[17]!==N?(J=X=>{const ne=Yc[X];Ht.error(ne.title,{description:ne.description}),N()},n[17]=N,n[18]=J):J=n[18];const fe=J,{setNode:me}=mi();let O,ue;n[19]!==m||n[20]!==o||n[21]!==re||n[22]!==v||n[23]!==j||n[24]!==t||n[25]!==f||n[26]!==me?(O=()=>{if(o)return me(i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Xo,{children:i.jsxs(Yo,{children:[i.jsx(Pr,{children:i.jsx(Wr,{asChild:!0,children:i.jsx("button",{onClick:()=>t(`/app-center?appId=${o.app_id}`),children:o.name})})}),i.jsx(qr,{}),i.jsx(Pr,{children:f?i.jsx(Wr,{asChild:!0,children:i.jsx("button",{onClick:j,children:Ss(o)})}):i.jsx(Vr,{children:Ss(o)})}),f&&i.jsxs(i.Fragment,{children:[i.jsx(qr,{}),i.jsx(Pr,{children:m?i.jsx(Wr,{asChild:!0,children:i.jsx("button",{onClick:v,children:f})}):i.jsx(Vr,{children:f})})]}),m&&i.jsxs(i.Fragment,{children:[i.jsx(qr,{}),i.jsx(Pr,{children:i.jsx(Vr,{children:re})})]})]})}),!f&&o.status_label&&i.jsx(Oi,{tone:Hi[o.status_label],children:o.status_label})]})),()=>me(null)},ue=[o,f,m,re,t,v,j,me],n[19]=m,n[20]=o,n[21]=re,n[22]=v,n[23]=j,n[24]=t,n[25]=f,n[26]=me,n[27]=O,n[28]=ue):(O=n[27],ue=n[28]),a.useEffect(O,ue);let ge;n[29]!==d||n[30]!==m||n[31]!==w||n[32]!==te||n[33]!==x||n[34]!==(o==null?void 0:o.id)||n[35]!==E||n[36]!==g||n[37]!==$||n[38]!==Z||n[39]!==j||n[40]!==pe||n[41]!==q||n[42]!==fe||n[43]!==c||n[44]!==I||n[45]!==D||n[46]!==C||n[47]!==H||n[48]!==f||n[49]!==(Q==null?void 0:Q.formFactor)||n[50]!==V||n[51]!==M||n[52]!==W||n[53]!==p||n[54]!==h||n[55]!==z?(ge=i.jsx("div",{className:"flex flex-col gap-3 flex-1 min-w-0 min-h-0",children:i.jsx("div",{className:"flex-1 min-h-0 overflow-auto -ml-1 pl-1 -mr-4 pr-4",children:m?i.jsx("div",{className:"min-h-full flex items-center justify-center py-6 px-8 min-w-max",children:i.jsx(ic,{sessionId:m,deviceId:g,formFactor:(Q==null?void 0:Q.formFactor)??d,platform:c,buildId:o==null?void 0:o.id,resetMode:te,onRecordingUploaded:pe,onSessionEnded:fe})}):f?i.jsxs("div",{className:"flex flex-col gap-5",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{onClick:j,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"← All Macs"}),i.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Select device"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ui,{"aria-label":"Search devices",placeholder:"Search device…",value:$,onChange:V}),D.length>0&&i.jsxs(Di,{value:I||"__all__",onValueChange:X=>{M(X==="__all__"?"":X),C()},children:[i.jsx(Mi,{className:"h-8 w-36 shrink-0","aria-label":"Filter by OS version",children:i.jsx(Li,{})}),i.jsxs($i,{children:[i.jsx(Xs,{value:"__all__",children:"Any version"}),D.map(Gc)]})]}),Z&&i.jsx(ts,{children:i.jsxs($t,{children:[i.jsx(Ft,{asChild:!0,children:i.jsxs("div",{className:"ml-auto flex items-center gap-2 shrink-0",children:[i.jsx(gi,{htmlFor:"reset-mode",className:"text-sm cursor-pointer whitespace-nowrap",children:"Full reset"}),i.jsx("span",{id:"reset-mode-desc",className:"sr-only",children:"When on, erases all data on the next device you pick"}),i.jsx(Zo,{id:"reset-mode","aria-describedby":"reset-mode-desc",checked:H==="full-erase",onCheckedChange:X=>W(X?"full-erase":"app-only")})]})}),i.jsx(Ut,{children:H==="full-erase"?"Erase all data on the next device you pick":"Keep existing data"})]})})]}),z.length===0?i.jsx("p",{className:"text-sm text-muted-foreground",children:E?"No devices available for this OS.":"Connecting to relay…"}):i.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 2xl:grid-cols-3 gap-2",children:z.map(X=>{const ne=X.status==="booted",Te=X.busy,he=Te?"In use":ne?"Booted":"Available",Oe=Te?"bg-amber-400":ne?"bg-emerald-400":"bg-muted-foreground/40";return i.jsxs("button",{disabled:Te||x||!E,onClick:()=>q(X),className:Me("flex flex-col gap-3 rounded-lg border p-3 text-left transition-colors min-h-[100px]","hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50"),children:[i.jsx("span",{className:"text-sm font-medium leading-tight",children:X.name}),X.osVersion&&i.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:X.osVersion}),i.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[i.jsx("span",{className:Me("inline-block h-1.5 w-1.5 rounded-full",Oe)}),he]})]},X.id)})}),h&&i.jsx("p",{className:"text-sm text-muted-foreground",children:h})]}):i.jsxs("div",{className:"flex flex-col gap-5",children:[i.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Select Mac"}),w.length===0?i.jsx("p",{className:"text-sm text-muted-foreground",children:E?`No agents available for ${c}.`:"Connecting to relay…"}):i.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 2xl:grid-cols-3 gap-2",children:w.map(X=>{const ne=X.resources,Te=ne?Date.now()-ne.reportedAt>yi:!1,he=X.devices.filter(xe=>xe.platform===c).length,Oe=(ne==null?void 0:ne.cpuPercent)??0,ke=ne?ne.memUsedMB/ne.memTotalMB*100:0,lt=wi(ne,Te),be=lt==="overloaded";return i.jsx(ts,{children:i.jsxs($t,{children:[i.jsx(Ft,{asChild:!0,children:i.jsx("span",{tabIndex:be?0:void 0,className:be?"cursor-not-allowed":void 0,children:i.jsxs("button",{disabled:be,"aria-disabled":be,onClick:()=>p(X.agentName??null),className:Me("flex flex-col gap-3 rounded-lg border p-3 text-left transition-colors min-h-[100px] w-full",be?"pointer-events-none":"hover:bg-accent"),children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx(Jc,{health:lt}),i.jsx("span",{className:"text-sm font-medium leading-tight truncate",children:X.agentName??"Unknown"})]}),Te&&i.jsx("span",{className:"shrink-0 text-[10px] font-medium text-amber-500",children:"Stale"})]}),i.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[i.jsxs("span",{children:[he," device",he!==1?"s":""]}),ne&&i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"·"}),i.jsxs("span",{children:[ne.slotsAvailable,"/",ne.slotsTotal," slots"]})]})]}),ne&&!Te&&i.jsxs("div",{className:"flex flex-col gap-1.5 w-full",children:[i.jsx(Fs,{label:"CPU",percent:Oe,colorClass:"bg-blue-400"}),i.jsx(Fs,{label:"RAM",percent:ke,colorClass:"bg-violet-400"})]})]})})}),be&&i.jsx(Ut,{children:"This Mac is currently overloaded. Try again later."})]})},X.agentName)})})]})})}),n[29]=d,n[30]=m,n[31]=w,n[32]=te,n[33]=x,n[34]=o==null?void 0:o.id,n[35]=E,n[36]=g,n[37]=$,n[38]=Z,n[39]=j,n[40]=pe,n[41]=q,n[42]=fe,n[43]=c,n[44]=I,n[45]=D,n[46]=C,n[47]=H,n[48]=f,n[49]=Q==null?void 0:Q.formFactor,n[50]=V,n[51]=M,n[52]=W,n[53]=p,n[54]=h,n[55]=z,n[56]=ge):ge=n[56];let we;n[57]!==r?(we=r&&i.jsxs(i.Fragment,{children:[i.jsx(Us,{orientation:"vertical",className:"h-auto"}),i.jsx("div",{className:"w-80 shrink-0 h-full",children:i.jsx(Uc,{buildId:Number(r)})})]}),n[57]=r,n[58]=we):we=n[58];let Le;return n[59]!==ge||n[60]!==we?(Le=i.jsxs("div",{className:"flex h-full min-h-0 gap-6 p-6",children:[ge,we]}),n[59]=ge,n[60]=we,n[61]=Le):Le=n[61],Le}function Gc(n){return i.jsx(Xs,{value:n,children:n},n)}function Qc(n){return n.devices}function Jc(n){const e=ae.c(6),{health:t}=n;let s,r;if(e[0]!==t){const l={unknown:"bg-muted-foreground/40",healthy:"bg-emerald-400",warning:"bg-amber-400",overloaded:"bg-red-500"}[t];s="resource-health-dot",r=Me("inline-block h-2 w-2 shrink-0 rounded-full",l),e[0]=t,e[1]=s,e[2]=r}else s=e[1],r=e[2];let o;return e[3]!==s||e[4]!==r?(o=i.jsx("span",{"data-testid":s,className:r}),e[3]=s,e[4]=r,e[5]=o):o=e[5],o}function Fs(n){const e=ae.c(19),{label:t,percent:s,colorClass:r}=n;let o;e[0]!==t?(o=i.jsx("span",{children:t}),e[0]=t,e[1]=o):o=e[1];let l;e[2]!==s?(l=s.toFixed(0),e[2]=s,e[3]=l):l=e[3];let c;e[4]!==l?(c=i.jsxs("span",{children:[l,"%"]}),e[4]=l,e[5]=c):c=e[5];let u;e[6]!==o||e[7]!==c?(u=i.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground",children:[o,c]}),e[6]=o,e[7]=c,e[8]=u):u=e[8];let d;e[9]!==r?(d=Me("h-full rounded-full transition-all",r),e[9]=r,e[10]=d):d=e[10];const f=`${Math.min(100,s)}%`;let p;e[11]!==f?(p={width:f},e[11]=f,e[12]=p):p=e[12];let m;e[13]!==d||e[14]!==p?(m=i.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:i.jsx("div",{className:d,style:p})}),e[13]=d,e[14]=p,e[15]=m):m=e[15];let g;return e[16]!==u||e[17]!==m?(g=i.jsxs("div",{className:"flex flex-col gap-0.5",children:[u,m]}),e[16]=u,e[17]=m,e[18]=g):g=e[18],g}export{dd as QASession};
@@ -1 +1 @@
1
- import{j as s}from"./vendor-react-BlPSzrEe.js";import{aK as k,aB as O,aO as E,aN as R,C as w,c as h,d as f,b as x,a as q,L as j,I as g,ab as H,P as I,F as i,B as _,s as A,av as v,au as B,az as y,v as D,w as K,aS as L}from"./index-B4w4Lh3e.js";import{F as Q}from"./field-hint-CMKmbVpy.js";import{b as W,c as z}from"./vendor-router-B_lVHrKl.js";const G=B({password:y().min(D,K),confirm:y()}).refine(a=>a.password===a.confirm,{message:"Passwords do not match",path:["confirm"]});function X(){var l,m,p;const a=W(),[b]=z(),r=b.get("token")??"",{register:o,handleSubmit:N,setError:t,formState:{errors:e,isSubmitting:n,submitCount:S}}=k({shouldFocusError:!1,resolver:O(G)}),C=E(),d=R({queryKey:v.resetToken(r),queryFn:()=>L(r),enabled:r!=="",staleTime:1/0}),c=!r||d.isError?"invalid":d.isPending?"loading":"valid";async function T(F){try{const u=await fetch("/api/v1/auth/reset-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:r,password:F.password})});if(!u.ok){const P=await u.json();t("root",{message:P.error??"Failed to reset password"});return}C.removeQueries({queryKey:v.resetToken(r)}),a("/login",{replace:!0})}catch{t("root",{message:"Network error. Please try again."})}}return c==="loading"?s.jsx("div",{className:"flex min-h-svh items-center justify-center"}):c==="invalid"?s.jsx("div",{className:"bg-mesh-gradient flex min-h-svh items-center justify-center overflow-hidden p-4",children:s.jsx(w,{level:4,className:"w-full max-w-sm text-center",children:s.jsxs(h,{children:[s.jsx(f,{children:"Link expired"}),s.jsx(x,{children:"This password reset link is invalid or has expired. Ask your admin to send a new one."})]})})}):s.jsx("div",{className:"bg-mesh-gradient flex min-h-svh items-center justify-center overflow-hidden p-4",children:s.jsxs(w,{level:4,className:"w-full max-w-sm",children:[s.jsxs(h,{className:"text-center",children:[s.jsx(f,{children:"Reset password"}),s.jsx(x,{children:"Enter your new password below."})]}),s.jsx(q,{children:s.jsxs("form",{onSubmit:N(T),className:"flex flex-col gap-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(j,{htmlFor:"password",children:"New password"}),s.jsx(g,{id:"password",type:"password","aria-required":"true",autoComplete:"new-password","aria-invalid":!!e.password,"aria-describedby":H("password-hint","password-error",!!e.password),...o("password")}),!e.password&&s.jsx(Q,{id:"password-hint",children:I}),s.jsx(i,{id:"password-error",message:(l=e.password)==null?void 0:l.message})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(j,{htmlFor:"confirm",children:"Confirm password"}),s.jsx(g,{id:"confirm",type:"password","aria-required":"true",autoComplete:"new-password","aria-invalid":!!e.confirm,"aria-describedby":e.confirm?"confirm-error":void 0,...o("confirm")}),s.jsx(i,{id:"confirm-error",message:(m=e.confirm)==null?void 0:m.message})]}),s.jsx(i,{assertive:!0,id:"resetpassword-error",message:(p=e.root)==null?void 0:p.message}),s.jsx(_,{type:"submit",disabled:n,className:"w-full",children:n?"Saving…":"Set new password"}),s.jsx(A,{errors:e,submitCount:S})]})})]})})}export{X as ResetPassword};
1
+ import{j as s}from"./vendor-react-BlPSzrEe.js";import{aK as k,aB as O,aO as E,aN as R,C as w,c as h,d as f,b as x,a as q,L as j,I as g,ab as H,P as I,F as i,B as _,s as A,av as v,au as B,az as y,v as D,w as K,aS as L}from"./index-DSW9h8XX.js";import{F as Q}from"./field-hint-Csb40Gzp.js";import{b as W,c as z}from"./vendor-router-B_lVHrKl.js";const G=B({password:y().min(D,K),confirm:y()}).refine(a=>a.password===a.confirm,{message:"Passwords do not match",path:["confirm"]});function X(){var l,m,p;const a=W(),[b]=z(),r=b.get("token")??"",{register:o,handleSubmit:N,setError:t,formState:{errors:e,isSubmitting:n,submitCount:S}}=k({shouldFocusError:!1,resolver:O(G)}),C=E(),d=R({queryKey:v.resetToken(r),queryFn:()=>L(r),enabled:r!=="",staleTime:1/0}),c=!r||d.isError?"invalid":d.isPending?"loading":"valid";async function T(F){try{const u=await fetch("/api/v1/auth/reset-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:r,password:F.password})});if(!u.ok){const P=await u.json();t("root",{message:P.error??"Failed to reset password"});return}C.removeQueries({queryKey:v.resetToken(r)}),a("/login",{replace:!0})}catch{t("root",{message:"Network error. Please try again."})}}return c==="loading"?s.jsx("div",{className:"flex min-h-svh items-center justify-center"}):c==="invalid"?s.jsx("div",{className:"bg-mesh-gradient flex min-h-svh items-center justify-center overflow-hidden p-4",children:s.jsx(w,{level:4,className:"w-full max-w-sm text-center",children:s.jsxs(h,{children:[s.jsx(f,{children:"Link expired"}),s.jsx(x,{children:"This password reset link is invalid or has expired. Ask your admin to send a new one."})]})})}):s.jsx("div",{className:"bg-mesh-gradient flex min-h-svh items-center justify-center overflow-hidden p-4",children:s.jsxs(w,{level:4,className:"w-full max-w-sm",children:[s.jsxs(h,{className:"text-center",children:[s.jsx(f,{children:"Reset password"}),s.jsx(x,{children:"Enter your new password below."})]}),s.jsx(q,{children:s.jsxs("form",{onSubmit:N(T),className:"flex flex-col gap-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(j,{htmlFor:"password",children:"New password"}),s.jsx(g,{id:"password",type:"password","aria-required":"true",autoComplete:"new-password","aria-invalid":!!e.password,"aria-describedby":H("password-hint","password-error",!!e.password),...o("password")}),!e.password&&s.jsx(Q,{id:"password-hint",children:I}),s.jsx(i,{id:"password-error",message:(l=e.password)==null?void 0:l.message})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(j,{htmlFor:"confirm",children:"Confirm password"}),s.jsx(g,{id:"confirm",type:"password","aria-required":"true",autoComplete:"new-password","aria-invalid":!!e.confirm,"aria-describedby":e.confirm?"confirm-error":void 0,...o("confirm")}),s.jsx(i,{id:"confirm-error",message:(m=e.confirm)==null?void 0:m.message})]}),s.jsx(i,{assertive:!0,id:"resetpassword-error",message:(p=e.root)==null?void 0:p.message}),s.jsx(_,{type:"submit",disabled:n,className:"w-full",children:n?"Saving…":"Set new password"}),s.jsx(A,{errors:e,submitCount:S})]})})]})})}export{X as ResetPassword};