@tapflowio/relay 0.20.1 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RelayServer.d.ts +33 -0
- package/dist/RelayServer.d.ts.map +1 -1
- package/dist/RelayServer.js +173 -26
- package/dist/RelayServer.js.map +1 -1
- package/dist/api/team.d.ts +2 -1
- package/dist/api/team.d.ts.map +1 -1
- package/dist/api/team.js +7 -5
- package/dist/api/team.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/buildTickets.d.ts +50 -0
- package/dist/lib/buildTickets.d.ts.map +1 -0
- package/dist/lib/buildTickets.js +47 -0
- package/dist/lib/buildTickets.js.map +1 -0
- package/dist/lib/lanAddress.d.ts +10 -0
- package/dist/lib/lanAddress.d.ts.map +1 -1
- package/dist/lib/lanAddress.js +13 -0
- package/dist/lib/lanAddress.js.map +1 -1
- package/dist/lib/proxyConfig.d.ts +4 -2
- package/dist/lib/proxyConfig.d.ts.map +1 -1
- package/dist/lib/proxyConfig.js +22 -13
- package/dist/lib/proxyConfig.js.map +1 -1
- package/dist/lib/publicUrl.d.ts +31 -1
- package/dist/lib/publicUrl.d.ts.map +1 -1
- package/dist/lib/publicUrl.js +51 -9
- package/dist/lib/publicUrl.js.map +1 -1
- package/dist/server.js +7 -1
- package/dist/server.js.map +1 -1
- package/package.json +4 -4
- package/public/assets/{AppCenter-DtF_g4F7.js → AppCenter-gbsJscjW.js} +5 -5
- package/public/assets/AppCenter-gbsJscjW.js.br +0 -0
- package/public/assets/AppCenter-gbsJscjW.js.gz +0 -0
- package/public/assets/{Default-C_p-ZWS6.js → Default-2rFTkbo9.js} +1 -1
- package/public/assets/Default-2rFTkbo9.js.br +0 -0
- package/public/assets/Default-2rFTkbo9.js.gz +0 -0
- package/public/assets/{Invite-DKT4qT6M.js → Invite-aN4DXJyM.js} +1 -1
- package/public/assets/Invite-aN4DXJyM.js.br +0 -0
- package/public/assets/Invite-aN4DXJyM.js.gz +0 -0
- package/public/assets/MacResources-D3IlesXU.js +3 -0
- package/public/assets/MacResources-D3IlesXU.js.br +0 -0
- package/public/assets/MacResources-D3IlesXU.js.gz +0 -0
- package/public/assets/NotFound-BoDDivK5.js.gz +0 -0
- package/public/assets/QASession-U29t9j0E.js +140 -0
- package/public/assets/QASession-U29t9j0E.js.br +0 -0
- package/public/assets/QASession-U29t9j0E.js.gz +0 -0
- package/public/assets/{ResetPassword-BnmE9MfY.js → ResetPassword-DPc5kwQU.js} +1 -1
- package/public/assets/ResetPassword-DPc5kwQU.js.br +0 -0
- package/public/assets/ResetPassword-DPc5kwQU.js.gz +0 -0
- package/public/assets/{Setup-I6nFcwNZ.js → Setup-CwPx_e_O.js} +1 -1
- package/public/assets/Setup-CwPx_e_O.js.br +0 -0
- package/public/assets/Setup-CwPx_e_O.js.gz +0 -0
- package/public/assets/Team-DD9li-7M.js +6 -0
- package/public/assets/Team-DD9li-7M.js.br +0 -0
- package/public/assets/Team-DD9li-7M.js.gz +0 -0
- package/public/assets/Tokens-DdMMke73.js +1 -0
- package/public/assets/Tokens-DdMMke73.js.br +0 -0
- package/public/assets/Tokens-DdMMke73.js.gz +0 -0
- package/public/assets/{alert-dialog-CLhPOSdB.js → alert-dialog-DADd1jHN.js} +1 -1
- package/public/assets/alert-dialog-DADd1jHN.js.br +0 -0
- package/public/assets/alert-dialog-DADd1jHN.js.gz +0 -0
- package/public/assets/{badge-CP-xbjo3.js → badge-CMf8d5RJ.js} +1 -1
- package/public/assets/badge-CMf8d5RJ.js.br +0 -0
- package/public/assets/badge-CMf8d5RJ.js.gz +0 -0
- package/public/assets/{build-format-DO1zN4vW.js → build-format-lp_8kSvq.js} +3 -3
- package/public/assets/build-format-lp_8kSvq.js.br +0 -0
- package/public/assets/build-format-lp_8kSvq.js.gz +0 -0
- package/public/assets/{dialog-BGH9MPcH.js → dialog-pS8vHXXv.js} +3 -3
- package/public/assets/dialog-pS8vHXXv.js.br +0 -0
- package/public/assets/dialog-pS8vHXXv.js.gz +0 -0
- package/public/assets/index-Bxs7CdEi.css +1 -0
- package/public/assets/index-Bxs7CdEi.css.br +0 -0
- package/public/assets/index-Bxs7CdEi.css.gz +0 -0
- package/public/assets/{index-O-Temo_p.js → index-Cajf0T-5.js} +23 -23
- package/public/assets/index-Cajf0T-5.js.br +0 -0
- package/public/assets/index-Cajf0T-5.js.gz +0 -0
- package/public/assets/{pencil-0UYCdq7e.js → pencil-LD1ga-Kk.js} +2 -2
- package/public/assets/pencil-LD1ga-Kk.js.br +0 -0
- package/public/assets/pencil-LD1ga-Kk.js.gz +0 -0
- package/public/assets/publicLink-D6zKS_wu.js +1 -0
- package/public/assets/publicLink-D6zKS_wu.js.br +0 -0
- package/public/assets/publicLink-D6zKS_wu.js.gz +0 -0
- package/public/assets/resource-health-BScurILF.js +1 -0
- package/public/assets/resource-health-BScurILF.js.br +0 -0
- package/public/assets/resource-health-BScurILF.js.gz +0 -0
- package/public/assets/{table-4DnBixRm.js → table-CL9AvoTp.js} +1 -1
- package/public/assets/table-CL9AvoTp.js.br +0 -0
- package/public/assets/table-CL9AvoTp.js.gz +0 -0
- package/public/assets/tinyh264.worker-DiJ50Hai.js.gz +0 -0
- package/public/assets/{trash-2-CAhMuWgg.js → trash-mvVp4nwq.js} +4 -4
- package/public/assets/trash-mvVp4nwq.js.br +0 -0
- package/public/assets/trash-mvVp4nwq.js.gz +0 -0
- package/public/assets/vendor-charts-8kVeHLwY.js +5 -0
- package/public/assets/vendor-charts-8kVeHLwY.js.br +0 -0
- package/public/assets/vendor-charts-8kVeHLwY.js.gz +0 -0
- package/public/assets/vendor-react-AJpf4YZ0.js.gz +0 -0
- package/public/assets/vendor-router-BFibuab1.js.gz +0 -0
- package/public/favicon.svg.gz +0 -0
- package/public/index.html +2 -2
- package/public/index.html.br +0 -0
- package/public/index.html.gz +0 -0
- package/public/logo-dark.svg.gz +0 -0
- package/public/logo.svg.gz +0 -0
- package/public/assets/AppCenter-DtF_g4F7.js.br +0 -0
- package/public/assets/Default-C_p-ZWS6.js.br +0 -0
- package/public/assets/Invite-DKT4qT6M.js.br +0 -0
- package/public/assets/MacResources-D8T_KpPV.js +0 -1
- package/public/assets/MacResources-D8T_KpPV.js.br +0 -0
- package/public/assets/QASession-Daup7RGP.js +0 -140
- package/public/assets/QASession-Daup7RGP.js.br +0 -0
- package/public/assets/ResetPassword-BnmE9MfY.js.br +0 -0
- package/public/assets/Setup-I6nFcwNZ.js.br +0 -0
- package/public/assets/Team-JhXhGt1H.js +0 -6
- package/public/assets/Team-JhXhGt1H.js.br +0 -0
- package/public/assets/Tokens-KAKIDZ0V.js +0 -1
- package/public/assets/Tokens-KAKIDZ0V.js.br +0 -0
- package/public/assets/alert-dialog-CLhPOSdB.js.br +0 -0
- package/public/assets/badge-CP-xbjo3.js.br +0 -0
- package/public/assets/build-format-DO1zN4vW.js.br +0 -0
- package/public/assets/dialog-BGH9MPcH.js.br +0 -0
- package/public/assets/index-ClHUQm-F.css +0 -1
- package/public/assets/index-ClHUQm-F.css.br +0 -0
- package/public/assets/index-O-Temo_p.js.br +0 -0
- package/public/assets/pencil-0UYCdq7e.js.br +0 -0
- package/public/assets/table-4DnBixRm.js.br +0 -0
- package/public/assets/tabs-DwiCx3dV.js +0 -1
- package/public/assets/tabs-DwiCx3dV.js.br +0 -0
- package/public/assets/trash-2-CAhMuWgg.js.br +0 -0
- package/public/assets/vendor-charts-DyX5CBcf.js +0 -5
- package/public/assets/vendor-charts-DyX5CBcf.js.br +0 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import{i as s,j as n}from"./vendor-react-AJpf4YZ0.js";import{W as ne,J as te,y as Vt,T as Ce,z as Te,B as ie,x as Ee,S as jn,a4 as Ne,r as pr,s as Mt,K as Ke,a9 as tt,t as nt,O as Cn,a8 as ht,af as mr,ab as gr,U as xr,w as br,f as yr,ag as vr,aa as wr,a7 as Sr,L as Rr}from"./index-Cajf0T-5.js";import{f as kr,a as jr,P as Tn,c as ln,S as Cr,b as Tr}from"./build-format-lp_8kSvq.js";import{u as En,n as X,T as Er,b as Nr,c as un,a as dn,R as Ar,g as _r}from"./resource-health-BScurILF.js";import{c as Nn,b as Pr}from"./vendor-router-BFibuab1.js";import{A as Dr,c as Lr,f as Ir,g as Mr,d as Ur,e as $r,b as Fr,a as Br}from"./alert-dialog-DADd1jHN.js";import{D as An,a as _n,d as Or,e as Pn,b as Hr,c as zr,k as Wr,S as Vr,i as qr,j as Xr,g as Kr,h as fn}from"./dialog-pS8vHXXv.js";import{l as hn,j as Yr}from"./publicLink-D6zKS_wu.js";import{B as Gr}from"./badge-CMf8d5RJ.js";/**
|
|
2
|
+
* @license lucide-react v1.41.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 Jr=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Qr=ne("arrow-left",Jr);/**
|
|
7
|
+
* @license lucide-react v1.41.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 Zr=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],es=ne("arrow-up",Zr);/**
|
|
12
|
+
* @license lucide-react v1.41.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 ts=[["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"}]],ns=ne("camera",ts);/**
|
|
17
|
+
* @license lucide-react v1.41.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 rs=[["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"}]],ss=ne("download",rs);/**
|
|
22
|
+
* @license lucide-react v1.41.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 os=[["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"}]],as=ne("film",os);/**
|
|
27
|
+
* @license lucide-react v1.41.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 is=[["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"}]],Dn=ne("house",is);/**
|
|
32
|
+
* @license lucide-react v1.41.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 cs=[["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"}]],ls=ne("image-plus",cs);/**
|
|
37
|
+
* @license lucide-react v1.41.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 us=[["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"}]],ds=ne("keyboard",us);/**
|
|
42
|
+
* @license lucide-react v1.41.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 fs=[["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"}]],Ln=ne("link-2",fs);/**
|
|
47
|
+
* @license lucide-react v1.41.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 hs=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],yt=ne("loader-circle",hs);/**
|
|
52
|
+
* @license lucide-react v1.41.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 ps=[["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"}]],ms=ne("message-square",ps);/**
|
|
57
|
+
* @license lucide-react v1.41.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 gs=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],xs=ne("power",gs);/**
|
|
62
|
+
* @license lucide-react v1.41.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 bs=[["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"}]],ys=ne("radio-off",bs);/**
|
|
67
|
+
* @license lucide-react v1.41.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 vs=[["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"}]],Ot=ne("radio",vs);/**
|
|
72
|
+
* @license lucide-react v1.41.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 ws=[["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"}]],Ss=ne("refresh-cw",ws);/**
|
|
77
|
+
* @license lucide-react v1.41.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 Rs=[["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"}]],ks=ne("rotate-cw",Rs);/**
|
|
82
|
+
* @license lucide-react v1.41.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 js=[["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"}]],Cs=ne("scan-line",js);/**
|
|
87
|
+
* @license lucide-react v1.41.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 Ts=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Es=ne("square",Ts);/**
|
|
92
|
+
* @license lucide-react v1.41.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 Ns=[["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"}]],As=ne("video",Ns);/**
|
|
97
|
+
* @license lucide-react v1.41.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 _s=[["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"}]],Ps=ne("volume-1",_s);/**
|
|
102
|
+
* @license lucide-react v1.41.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 Ds=[["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"}]],Ls=ne("volume-2",Ds);function Is(t){const[e,r]=s.useState(null);return s.useEffect(()=>{t&&kr(t).then(r)},[t]),{build:e}}function Ms(t){const[e,r]=s.useState([]),[o,i]=s.useState(null),[a,c]=s.useState(null),[u,d]=s.useState(""),[h,p]=s.useState(!1),[g,x]=s.useState(""),f=s.useCallback(k=>{k.type==="agents:listed"&&r(k.sessions),k.type==="session:joined"&&(p(!1),x("Connected")),k.type==="error"&&(p(!1),x(`Error: ${k.message}`))},[]),{send:b,connected:v}=En(f);s.useEffect(()=>{if(!v)return;b({type:"agents:list"});const k=setInterval(()=>b({type:"agents:list"}),5e3);return()=>clearInterval(k)},[v,b]);const T=s.useRef({sessionId:a,deviceId:u});s.useEffect(()=>{T.current={sessionId:a,deviceId:u}},[a,u]),s.useEffect(()=>()=>{const{sessionId:k,deviceId:F}=T.current;k&&F&&b({type:"device:shutdown",sessionId:k,payload:{deviceId:F}})},[b]);const j=e.filter(k=>k.devices.some(F=>F.platform===t)),L=s.useCallback(k=>{d(k.id),p(!0),x("Booting…"),c(k.sessionId)},[]),C=s.useCallback(()=>d(""),[]),N=s.useCallback(()=>{const{sessionId:k,deviceId:F}=T.current;k&&F&&b({type:"device:shutdown",sessionId:k,payload:{deviceId:F}}),c(null),p(!1),x("")},[b]),E=s.useCallback(()=>{const{sessionId:k,deviceId:F}=T.current;k&&F&&b({type:"device:shutdown",sessionId:k,payload:{deviceId:F}}),c(null),i(null),p(!1),x(""),b({type:"agents:list"})},[b]),M=s.useCallback(()=>{c(null),i(null),p(!1),x(""),b({type:"agents:list"})},[b]);return{sessions:e,selectedAgent:o,setSelectedAgent:i,activeSessionId:a,deviceId:u,booting:h,status:g,send:b,connected:v,agentGroups:j,startDevice:L,resetDevice:C,handleBack:N,handleBackToMacs:E,handleSessionEnded:M}}function Us(t,e){const[r,o]=s.useState(""),[i,a]=s.useState(""),[c,u]=s.useState("app-only"),[d,h]=s.useState("app-only"),p=(t==null?void 0:t.capabilities.includes("full-reset"))??!1,g=s.useCallback(()=>{h(p?c:"app-only"),u("app-only")},[c,p]),x=(t==null?void 0:t.devices.filter(v=>v.platform===e))??[],f=[...new Set(x.map(v=>v.osVersion).filter(Boolean))].sort((v,T)=>{const j=N=>N.replace(/^[^\d]*/,"").split(".").map(Number),[L,C]=[j(v),j(T)];for(let N=0;N<Math.max(L.length,C.length);N++){const E=(C[N]??0)-(L[N]??0);if(E!==0)return E}return 0}),b=(r?x.filter(v=>v.osVersion===r):x).filter(v=>!i||v.name.toLowerCase().includes(i.toLowerCase()));return{filteredDevices:x,osVersions:f,osVersion:r,setOsVersion:o,deviceSearch:i,setDeviceSearch:a,versionedDevices:b,resetMode:c,setResetMode:u,appliedResetMode:d,consumeResetMode:g,fullResetSupported:p}}function $s(){const[t]=Nn(),e=t.get("perf")==="1",[r,o]=s.useState(e);return s.useEffect(()=>{if(!e){o(!1);return}o(!0);const i=a=>{a.ctrlKey&&a.shiftKey&&a.key==="P"&&o(c=>!c)};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[e]),{perfMode:e,visible:r}}function In(t){const e=t.rolloverOffset.x-t.buttonW/2,r=t.anchor==="top"?t.rolloverOffset.y:t.normalOffset.y-t.buttonH/2;return{left:e,top:r,right:e+t.buttonW,bottom:r+t.buttonH}}function Fs(t,e,r){const o=Math.max(r.left-t,0,t-r.right),i=Math.max(r.top-e,0,e-r.bottom);return Math.hypot(o,i)}function Bs(t,e,r,o){let i=null,a=1/0;for(const c of r){const u=Fs(t,e,In(c));u<a&&(a=u,i=c.name)}return a<=o?i:null}const Os=["video/mp4;codecs=avc1","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"];function Mn({sessionId:t,buildId:e,onRecordingUploaded:r}){const[o,i]=s.useState("idle"),a=s.useRef(null),c=s.useRef(r);s.useEffect(()=>{c.current=r},[r]);const u=s.useRef(!1),d=s.useRef(null),h=s.useRef([]),p=s.useRef(""),g=s.useRef(0),x=s.useRef(null),f=s.useCallback(function T(){var j;u.current&&((j=x.current)==null||j.call(x),g.current=requestAnimationFrame(T))},[]),b=s.useCallback(T=>{const j=a.current;if(!j)return;const L=j.getContext("2d");L&&(L.fillStyle="#000",L.fillRect(0,0,j.width,j.height));const C=Os.find(E=>MediaRecorder.isTypeSupported(E))??"";if(!C)return;p.current=C,h.current=[];const N=new MediaRecorder(j.captureStream(30),{mimeType:C});N.ondataavailable=E=>{E.data.size>0&&h.current.push(E.data)},d.current=N,N.start(1e3),x.current=T,u.current=!0,g.current=requestAnimationFrame(f),i("recording")},[f]),v=s.useCallback(async()=>{var E;i("uploading"),u.current=!1,cancelAnimationFrame(g.current);const T=d.current;if(!T){i("idle");return}await new Promise(M=>{const k=setTimeout(M,5e3);T.onstop=()=>{clearTimeout(k),M()};try{T.stop()}catch{clearTimeout(k),M()}}),d.current=null;const j=p.current,L=j.includes("mp4")?".mp4":".webm",C=new Blob(h.current,{type:j});h.current=[];const N=new FormData;N.append("file",C,`tapflow-${Date.now()}${L}`);try{const M=new URLSearchParams({sessionId:t});e&&M.set("buildId",String(e));const k=await fetch(`/api/v1/recordings/upload?${M}`,{method:"POST",credentials:"include",body:N}),F=await k.json();if(k.ok&&F.url){const G=document.createElement("a");G.href=F.url,G.download="",G.click(),(E=c.current)==null||E.call(c),i("done"),setTimeout(()=>i("idle"),2e3)}else i("idle")}catch{i("idle")}},[t,e]);return s.useEffect(()=>{if(o!=="recording")return;const T=()=>{document.visibilityState==="hidden"&&v()};return document.addEventListener("visibilitychange",T),()=>{var j;document.removeEventListener("visibilitychange",T),u.current&&(u.current=!1,cancelAnimationFrame(g.current),(j=d.current)==null||j.stop(),d.current=null)}},[o,v]),{recordState:o,recordCanvasRef:a,startClientRecording:b,stopClientRecording:v}}function Un(){const t=s.useRef(0),[e,r]=s.useState(0);return s.useEffect(()=>{const o=setInterval(()=>{r(t.current),t.current=0},1e3);return()=>clearInterval(o)},[]),{fps:e,frameCount:t}}function ft({className:t,...e}){return n.jsx("kbd",{"data-slot":"kbd",className:te("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})}function qt({className:t,...e}){return n.jsx("kbd",{"data-slot":"kbd-group",className:te("inline-flex items-center gap-1",t),...e})}function St({label:t,keys:e}){return n.jsxs("span",{className:"flex items-center gap-3",children:[t,n.jsx(qt,{children:e.map(r=>n.jsx(ft,{children:r},r))})]})}const pn="text-muted-foreground hover:text-muted-foreground",mn="text-destructive hover:text-destructive";function Hs(t){switch(t){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 zs({position:t,steerable:e,reason:r}){const o=r==="awaiting-app",i=!e&&r==="state-unconfirmed"?" animate-pulse":"",a=e?"":Hs(r);switch(t){case"offline":return{Icon:ys,className:(e||o?"text-amber-500 hover:text-amber-500":mn)+i,status:`Device is offline.${a}`};case"online":return{Icon:Ot,className:(e||o?"":mn)+i,status:`Device is on the network.${a}`};case"waiting":return{Icon:Ot,className:`${pn} animate-pulse`,status:"Checking the network state."};case"unknown":return{Icon:Ot,className:pn,status:"No network state has been reported."}}}function Ws({position:t,steerable:e,reason:r}){const o=t==="offline"?"Bring device online":t==="online"?"Take device offline":"Toggle device network",i=t==="online"||t==="offline",a=r==="state-unconfirmed"||r==="unsupported-device";return e||!i||r==="awaiting-app"?o:a?`Retry: ${o.toLowerCase()}`:`${o} — unavailable`}function $n({joined:t,onScreenshot:e,onRecordToggle:r,recordState:o,onRotate:i,onDeepLink:a,navigationSlot:c,deviceSlot:u,launchSlot:d,network:h,reboot:p}){const g=s.useId(),x=s.useId(),f=s.useId(),[b,v]=s.useState(!1);return t?n.jsxs(Vt,{delayDuration:400,children:[n.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:[n.jsxs("div",{role:"group","aria-label":"Navigation",className:"flex flex-col items-center gap-0.5",children:[d,c,n.jsxs(Ce,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Open a deeplink",onClick:a,children:n.jsx(Ln,{className:"h-4 w-4"})})}),n.jsx(Ee,{side:"left",children:n.jsx(St,{label:"Deeplink",keys:["⌘","K"]})})]})]}),n.jsx("div",{role:"separator","aria-orientation":"horizontal",className:"w-4 h-px bg-border my-1"}),n.jsxs("div",{role:"group","aria-label":"Device",className:"flex flex-col items-center gap-0.5",children:[u,n.jsxs(Ce,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Rotate the device",onClick:i,children:n.jsx(ks,{className:"h-4 w-4"})})}),n.jsx(Ee,{side:"left",children:n.jsx(St,{label:"Rotate",keys:["⌘","⇧","O"]})})]}),p&&(()=>{const T=p.pending?"Restarting the device":"Restart the device";return n.jsxs(n.Fragment,{children:[n.jsxs(Ce,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(ie,{ref:p.buttonRef,variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":T,"aria-busy":p.pending,"aria-disabled":p.pending,"aria-describedby":x,onClick:()=>{p.pending||v(!0)},children:p.pending?n.jsx(yt,{className:"h-4 w-4 animate-spin"}):n.jsx(Ss,{className:"h-4 w-4"})})}),n.jsx(Ee,{side:"left",children:T})]}),n.jsx("span",{id:x,role:"status",className:"sr-only",children:p.pending?"Restarting the device.":""})]})})()]}),n.jsx("div",{role:"separator","aria-orientation":"horizontal",className:"w-4 h-px bg-border my-1"}),n.jsxs("div",{role:"group","aria-label":"Capture",className:"flex flex-col items-center gap-0.5",children:[n.jsxs(Ce,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Take a screenshot",onClick:e,children:n.jsx(ns,{className:"h-4 w-4"})})}),n.jsx(Ee,{side:"left",children:n.jsx(St,{label:"Screenshot",keys:["⌘","S"]})})]}),n.jsxs(Ce,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:te("h-8 w-8 aria-disabled:opacity-50",o==="recording"&&"text-red-500 hover:text-red-500"),"aria-label":o==="recording"?"Stop recording":o==="uploading"?"Processing the recording":o==="done"?"Recording saved":"Start recording","aria-busy":o==="uploading","aria-disabled":o==="uploading"||o==="done","aria-describedby":f,onClick:()=>{(o==="idle"||o==="recording")&&r()},children:o==="uploading"?n.jsx(yt,{className:"h-4 w-4 animate-spin"}):o==="recording"?n.jsx(Es,{className:"h-4 w-4 fill-current"}):n.jsx(As,{className:"h-4 w-4"})})}),n.jsx(Ee,{side:"left",children:o==="idle"?n.jsx(St,{label:"Start recording",keys:["⌘","⇧","Y"]}):o==="recording"?n.jsx(St,{label:"Stop recording",keys:["⌘","⇧","Y"]}):o==="done"?"Recording saved":"Processing the recording"})]}),n.jsx("span",{id:f,role:"status",className:"sr-only",children:o==="recording"?"Recording.":o==="uploading"?"Processing the recording.":o==="done"?"Recording saved.":""})]}),h&&n.jsxs(n.Fragment,{children:[n.jsx("div",{role:"separator","aria-orientation":"horizontal",className:"w-4 h-px bg-border my-1"}),n.jsx("div",{role:"group","aria-label":"Environment",className:"flex flex-col items-center gap-0.5",children:h&&(()=>{const{Icon:T,className:j,status:L}=zs(h),C=Ws(h),N=h.position==="waiting"||h.position==="unknown"||!h.steerable;return n.jsxs(Ce,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:te("h-8 w-8",j),"aria-label":C,"aria-busy":h.pending,"aria-disabled":h.pending,"aria-describedby":g,onClick:()=>{h.pending||h.onToggle()},children:h.pending?n.jsx(yt,{className:"h-4 w-4 animate-spin"}):n.jsx(T,{className:"h-4 w-4"})})}),n.jsx("span",{id:g,role:"status",className:"sr-only",children:h.pending?"Changing the network state.":L}),n.jsx(Ee,{side:"left",children:N?`${C} — ${L}`:C})]})})()})]})]}),p&&n.jsx(Dr,{open:b,onOpenChange:v,children:n.jsxs(Lr,{children:[n.jsxs(Ir,{children:[n.jsx(Mr,{children:"Restart this device?"}),n.jsx(Ur,{children:"Anything open on the device closes, and whatever you had set up on screen is gone. Installed apps and their data stay. The device takes a moment to come back."})]}),n.jsxs($r,{children:[n.jsx(Fr,{children:"Cancel"}),n.jsx(Br,{onClick:()=>{v(!1),p.onReboot()},children:"Restart"})]})]})})]}):null}const Vs=3e3,qs=8e3;function Fn({sessionId:t,send:e,supported:r,deviceReady:o,handlerRef:i,onError:a}){const[c,u]=s.useState("waiting"),[d,h]=s.useState(!0),[p,g]=s.useState(void 0),x=s.useRef(void 0),[f,b]=s.useState(!1),v=s.useRef(null),T=s.useRef(new Set),j=s.useRef(a);s.useEffect(()=>{j.current=a},[a]);const L=s.useRef(o);s.useEffect(()=>{L.current=o},[o]);const C=s.useRef(o);s.useEffect(()=>{u("waiting"),h(!0),g(void 0),x.current=void 0,b(!1),v.current=null,C.current=L.current,T.current.clear()},[t]),s.useEffect(()=>{var k;if(o){C.current=!0,u("waiting");return}u(C.current?"unknown":"waiting"),h(!0),g(void 0),x.current=void 0,v.current&&((k=j.current)==null||k.call(j,"The device became unavailable before it answered. Its network state is unchanged as far as tapflow can tell."),T.current.add(v.current)),b(!1),v.current=null},[o]),s.useEffect(()=>{if(r)return i.current=k=>{var G,z;if(k.type==="network:error"){k.requestId===v.current&&(v.current=null,b(!1),(G=j.current)==null||G.call(j,k.message));return}if(k.type!=="network:state"||!L.current||k.requestId!==void 0&&T.current.has(k.requestId))return;const F=k.payload.available?void 0:k.payload.reason;u(k.payload.offline?"offline":"online"),h(k.payload.available),g(F),F==="enforcement-lost"&&x.current!=="enforcement-lost"&&((z=j.current)==null||z.call(j,"The device went back on the network before you took it off. Anything checked while it was offline needs checking again.")),x.current=F,k.requestId!==void 0&&k.requestId===v.current&&(v.current=null,b(!1))},()=>{i.current=void 0}},[i,r]),s.useEffect(()=>{if(!r||!o||c!=="waiting")return;const k=setTimeout(()=>u(F=>F==="waiting"?"unknown":F),Vs);return()=>clearTimeout(k)},[r,o,c]);const N=s.useCallback(()=>{if(!r||f)return;const k=X();v.current=k,b(!0),e({type:"network:set",sessionId:t,requestId:k,payload:{offline:c!=="offline"}})},[c,f,e,t,r]),[E,M]=s.useState(null);return s.useEffect(()=>{M(f?v.current:null)},[f]),s.useEffect(()=>{if(E===null)return;const k=setTimeout(()=>{var F;v.current===E&&(v.current=null,b(!1),(F=j.current)==null||F.call(j,"The device did not answer. Its network state is unchanged as far as tapflow can tell."))},qs);return()=>clearTimeout(k)},[E]),{position:c,steerable:d,reason:p,pending:f,toggle:N}}class Xt{constructor(e){this.bytes=e,this.bitPos=0}get position(){return this.bitPos}bit(){const e=this.bitPos>>3,r=7-(this.bitPos&7);return this.bitPos++,e>=this.bytes.length?0:this.bytes[e]>>r&1}bits(e){let r=0;for(let o=0;o<e;o++)r=r<<1|this.bit();return r>>>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 Xs{constructor(){this.bitsArr=[]}bit(e){this.bitsArr.push(e&1)}ue(e){const r=e+1,o=Math.floor(Math.log2(r));for(let i=0;i<o;i++)this.bit(0);for(let i=o;i>=0;i--)this.bit(r>>i&1)}toBytes(){const e=[];for(let r=0;r<this.bitsArr.length;r+=8){let o=0;for(let i=0;i<8;i++)o=o<<1|(this.bitsArr[r+i]??0);e.push(o)}return new Uint8Array(e)}}function Bn(t){const e=[];let r=0;for(let o=1;o<t.length;o++){const i=t[o];if(r>=2&&i===3){r=0;continue}e.push(i),r=i===0?r+1:0}return new Uint8Array(e)}function Ks(t){const e=[];let r=0;for(const o of t)r>=2&&o<=3&&(e.push(3),r=0),e.push(o),r=o===0?r+1:0;return new Uint8Array(e)}const Ys=new Set([100,110,122,244,44,83,86,118,128,138,139,134,135]);function gn(t){const e=t.ue()+1;t.bits(4),t.bits(4);for(let r=0;r<e;r++)t.ue(),t.ue(),t.flag();t.bits(5),t.bits(5),t.bits(5),t.bits(5)}function On(t){const e=t.bits(8);t.bits(8);const r=t.bits(8);if(t.ue(),Ys.has(e)){const g=t.ue();if(g===3&&t.flag(),t.ue(),t.ue(),t.flag(),t.flag()){const x=g!==3?8:12;for(let f=0;f<x;f++)if(t.flag()){const b=f<6?16:64;let v=8,T=8;for(let j=0;j<b;j++)T!==0&&(T=(v+t.se()+256)%256),v=T===0?v:T}}}t.ue();const o=t.ue();if(o===0)t.ue();else if(o===1){t.flag(),t.se(),t.se();const g=t.ue();for(let x=0;x<g;x++)t.se()}const i=t.ue();t.flag(),t.ue(),t.ue(),t.flag()||t.flag(),t.flag(),t.flag()&&(t.ue(),t.ue(),t.ue(),t.ue());const a={profileIdc:e,levelIdc:r,numRefFrames:i,bitstreamRestriction:!1,maxNumReorderFrames:null,maxDecFrameBuffering:null};if(!t.flag())return{...a,vuiPresent:!1,restrictionFlagPos:-1};t.flag()&&t.bits(8)===255&&(t.bits(16),t.bits(16)),t.flag()&&t.flag(),t.flag()&&(t.bits(3),t.flag(),t.flag()&&(t.bits(8),t.bits(8),t.bits(8))),t.flag()&&(t.ue(),t.ue()),t.flag()&&(t.bits(32),t.bits(32),t.flag());const u=t.flag();u&&gn(t);const d=t.flag();d&&gn(t),(u||d)&&t.flag(),t.flag();const h=t.position;return t.flag()?(t.flag(),t.ue(),t.ue(),t.ue(),t.ue(),{...a,vuiPresent:!0,bitstreamRestriction:!0,maxNumReorderFrames:t.ue(),maxDecFrameBuffering:t.ue(),restrictionFlagPos:h}):{...a,vuiPresent:!0,restrictionFlagPos:h}}function Gs(t){const e=On(new Xt(Bn(t)));return{profileIdc:e.profileIdc,levelIdc:e.levelIdc,vuiPresent:e.vuiPresent,bitstreamRestriction:e.bitstreamRestriction,maxNumReorderFrames:e.maxNumReorderFrames,maxDecFrameBuffering:e.maxDecFrameBuffering}}function Js(t){const e=Bn(t),r=On(new Xt(e));if(!r.vuiPresent||r.restrictionFlagPos<0||r.bitstreamRestriction)return null;const o=new Xs,i=new Xt(e);for(let a=0;a<r.restrictionFlagPos;a++)o.bit(i.bit());return o.bit(1),o.bit(1),o.ue(0),o.ue(0),o.ue(0),o.ue(0),o.ue(0),o.ue(r.numRefFrames),o.bit(1),Uint8Array.from([t[0],...Ks(o.toBytes())])}function Qs(t){const e=[],r=t.length;let o=-1,i=0;for(;i+2<r;){const a=i+3<r&&t[i]===0&&t[i+1]===0&&t[i+2]===0&&t[i+3]===1,c=t[i]===0&&t[i+1]===0&&t[i+2]===1;a||c?(o>=0&&e.push(t.subarray(o,i)),i+=a?4:3,o=i):i++}return o>=0&&e.push(t.subarray(o,r)),e}class Zs{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 r=[];let o=!1;for(const h of Qs(new Uint8Array(e))){const p=h[0]&31;if(p===7){const g=!this.sps||h.length!==this.sps.length||h.some((x,f)=>x!==this.sps[f]);this.sps=h,g&&this.decoder&&(this.decoder.close(),this.decoder=null)}else p===8?this.pps=h:p>=1&&p<=5&&(p===5&&(o=!0),r.push(h))}if(o&&this.sps&&this.pps&&!this.decoder&&this.initDecoder(this.sps,this.pps),!this.decoder||r.length===0)return;let i=0;for(const h of r)i+=4+h.length;const a=new Uint8Array(i),c=new DataView(a.buffer);let u=0;for(const h of r)c.setUint32(u,h.length,!1),u+=4,a.set(h,u),u+=h.length;const d=Math.round(this.frameCount++*(1e6/30));if(this.decodeSampler&&(this.submitAt.set(d,performance.now()),this.submitAt.size>120)){const h=this.submitAt.keys().next().value;h!==void 0&&this.submitAt.delete(h)}try{this.decoder.decode(new EncodedVideoChunk({type:o?"key":"delta",timestamp:d,data:a}))}catch{}}sampleDecode(e){var o;if(!this.decodeSampler)return;const r=this.submitAt.get(e.timestamp);r!==void 0&&(this.submitAt.delete(e.timestamp),this.decodeSampler({decodeMs:performance.now()-r,queueSize:((o=this.decoder)==null?void 0:o.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(Gs(e)))}catch(r){console.warn("[sps-vui] parse failed",r)}}}initDecoder(e,r){this.logSpsVui(e);const o=Js(e)??e,i=o[0]===0?o.subarray(4):o,a=`avc1.${i[1].toString(16).padStart(2,"0")}${i[2].toString(16).padStart(2,"0")}${i[3].toString(16).padStart(2,"0")}`,c=this.buildAVCC(o,r);this.decoder=new VideoDecoder({output:u=>{this.sampleDecode(u),this.onFrame(u)},error:u=>console.error("[WebCodecsCore]",u)}),this.decoder.configure({codec:a,description:c,optimizeForLatency:!0})}buildAVCC(e,r){const o=e[0]===0?e.subarray(4):e,i=r[0]===0?r.subarray(4):r,a=new Uint8Array(8+o.length+1+2+i.length);let c=0;return a[c++]=1,a[c++]=o[1],a[c++]=o[2],a[c++]=o[3],a[c++]=255,a[c++]=225,a[c++]=o.length>>8&255,a[c++]=o.length&255,a.set(o,c),c+=o.length,a[c++]=1,a[c++]=i.length>>8&255,a[c++]=i.length&255,a.set(i,c),a}}const eo=`#version 300 es
|
|
107
|
+
in vec2 a_pos;
|
|
108
|
+
out vec2 v_uv;
|
|
109
|
+
void main() {
|
|
110
|
+
v_uv = vec2(a_pos.x * 0.5 + 0.5, 0.5 - a_pos.y * 0.5);
|
|
111
|
+
gl_Position = vec4(a_pos, 0.0, 1.0);
|
|
112
|
+
}`,to=`#version 300 es
|
|
113
|
+
precision mediump float;
|
|
114
|
+
in vec2 v_uv;
|
|
115
|
+
uniform sampler2D u_tex;
|
|
116
|
+
out vec4 out_color;
|
|
117
|
+
void main() {
|
|
118
|
+
out_color = texture(u_tex, v_uv);
|
|
119
|
+
}`;function no(t){const e=t.getContext("webgl2",{alpha:!1,antialias:!1,powerPreference:"high-performance",preserveDrawingBuffer:!0});if(!e)return null;const r=(p,g)=>{const x=e.createShader(p);return e.shaderSource(x,g),e.compileShader(x),x},o=e.createProgram(),i=r(e.VERTEX_SHADER,eo),a=r(e.FRAGMENT_SHADER,to);e.attachShader(o,i),e.attachShader(o,a),e.linkProgram(o),e.deleteShader(i),e.deleteShader(a),e.useProgram(o);const c=e.createVertexArray();e.bindVertexArray(c);const u=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),e.STATIC_DRAW);const d=e.getAttribLocation(o,"a_pos");e.enableVertexAttribArray(d),e.vertexAttribPointer(d,2,e.FLOAT,!1,0,0),e.bindVertexArray(null);const h=e.createTexture();return e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,h),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(o,"u_tex"),0),{gl:e,program:o,tex:h,vao:c}}class ro{constructor(e){this.canvas=e,this.state=null}init(){return this.state=no(this.canvas),this.state!==null}drawFrame(e){const r=this.state;if(!r)return e.close(),null;const o=e.displayWidth,i=e.displayHeight;try{return(this.canvas.width!==o||this.canvas.height!==i)&&(this.canvas.width=o,this.canvas.height=i,r.gl.viewport(0,0,o,i)),r.gl.activeTexture(r.gl.TEXTURE0),r.gl.bindTexture(r.gl.TEXTURE_2D,r.tex),r.gl.texImage2D(r.gl.TEXTURE_2D,0,r.gl.RGBA,r.gl.RGBA,r.gl.UNSIGNED_BYTE,e),r.gl.bindVertexArray(r.vao),r.gl.drawArrays(r.gl.TRIANGLES,0,6),r.gl.bindVertexArray(null),r.gl.bindTexture(r.gl.TEXTURE_2D,null),{width:o,height:i}}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 so(t){const e=new ro(t);return e.init(),e}class oo{constructor(e=so){this._size=null,this.canvas=document.createElement("canvas"),this.renderer=e(this.canvas),this.core=new Zs(r=>this.render(r))}get surface(){return this.canvas}get size(){return this._size}onResize(e){this.resizeCb=e}onDecodedFrame(e){this.decodedCb=e,this.core.setDecodeSampler(r=>{this.lastSample=r})}decode(e){this.core.decode(e)}close(){this.core.close(),this.renderer.dispose()}render(e){var o,i;const r=this.renderer.drawFrame(e);r&&((o=this.decodedCb)==null||o.call(this,performance.now(),this.lastSample),this.lastSample=void 0,(!this._size||this._size.width!==r.width||this._size.height!==r.height)&&(this._size=r,(i=this.resizeCb)==null||i.call(this,r)))}}const ao=`#version 300 es
|
|
120
|
+
in vec2 a_pos;
|
|
121
|
+
out vec2 v_uv;
|
|
122
|
+
void main() {
|
|
123
|
+
v_uv = vec2(a_pos.x * 0.5 + 0.5, 0.5 - a_pos.y * 0.5);
|
|
124
|
+
gl_Position = vec4(a_pos, 0.0, 1.0);
|
|
125
|
+
}`,io=`#version 300 es
|
|
126
|
+
precision mediump float;
|
|
127
|
+
in vec2 v_uv;
|
|
128
|
+
uniform sampler2D u_texY;
|
|
129
|
+
uniform sampler2D u_texU;
|
|
130
|
+
uniform sampler2D u_texV;
|
|
131
|
+
out vec4 out_color;
|
|
132
|
+
void main() {
|
|
133
|
+
float Y = (texture(u_texY, v_uv).r - 0.0627451) * 1.1643836; // (y-16/255)*255/219
|
|
134
|
+
float U = (texture(u_texU, v_uv).r - 0.5019608) * 1.1383929; // (u-128/255)*255/224
|
|
135
|
+
float V = (texture(u_texV, v_uv).r - 0.5019608) * 1.1383929;
|
|
136
|
+
float r = Y + 1.5748 * V;
|
|
137
|
+
float g = Y - 0.1873 * U - 0.4681 * V;
|
|
138
|
+
float b = Y + 1.8556 * U;
|
|
139
|
+
out_color = vec4(r, g, b, 1.0);
|
|
140
|
+
}`;function Ht(t,e,r,o){const i=t.createTexture();return t.activeTexture(t.TEXTURE0+e),t.bindTexture(t.TEXTURE_2D,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.uniform1i(t.getUniformLocation(o,r),e),i}function co(t){const e=t.getContext("webgl2",{alpha:!1,antialias:!1,powerPreference:"high-performance",preserveDrawingBuffer:!0});if(!e)return null;const r=(x,f)=>{const b=e.createShader(x);return e.shaderSource(b,f),e.compileShader(b),b},o=e.createProgram(),i=r(e.VERTEX_SHADER,ao),a=r(e.FRAGMENT_SHADER,io);e.attachShader(o,i),e.attachShader(o,a),e.linkProgram(o),e.deleteShader(i),e.deleteShader(a),e.useProgram(o);const c=e.createVertexArray();e.bindVertexArray(c);const u=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),e.STATIC_DRAW);const d=e.getAttribLocation(o,"a_pos");e.enableVertexAttribArray(d),e.vertexAttribPointer(d,2,e.FLOAT,!1,0,0),e.bindVertexArray(null),e.pixelStorei(e.UNPACK_ALIGNMENT,1);const h=Ht(e,0,"u_texY",o),p=Ht(e,1,"u_texU",o),g=Ht(e,2,"u_texV",o);return{gl:e,program:o,texY:h,texU:p,texV:g,vao:c}}class lo{constructor(e){this.canvas=e,this.state=null}init(){return this.state=co(this.canvas),this.state!==null}drawI420(e,r,o){const i=this.state;if(!i)return null;const{gl:a}=i,c=r+1>>1,u=o+1>>1,d=r*o,h=c*u,p=e.subarray(0,d),g=e.subarray(d,d+h),x=e.subarray(d+h,d+2*h);(this.canvas.width!==r||this.canvas.height!==o)&&(this.canvas.width=r,this.canvas.height=o,a.viewport(0,0,r,o));const f=(b,v,T,j,L)=>{a.activeTexture(a.TEXTURE0+b),a.bindTexture(a.TEXTURE_2D,v),a.texImage2D(a.TEXTURE_2D,0,a.R8,T,j,0,a.RED,a.UNSIGNED_BYTE,L)};return f(0,i.texY,r,o,p),f(1,i.texU,c,u,g),f(2,i.texV,c,u,x),a.bindVertexArray(i.vao),a.drawArrays(a.TRIANGLES,0,6),a.bindVertexArray(null),{width:r,height:o}}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 uo=0;function fo(t){const e=new lo(t);return e.init(),e}function ho(){return new Worker(new URL("/assets/tinyh264.worker-DiJ50Hai.js",import.meta.url),{type:"module"})}class po{constructor(e=fo,r=ho){this.ready=!1,this.pending=[],this._size=null,this.canvas=document.createElement("canvas"),this.renderer=e(this.canvas),this.worker=r(),this.worker.onmessage=o=>this.onMessage(o.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:uo},[e])}onMessage(e){var o,i;if(e.type==="decoderReady"){this.ready=!0;for(const a of this.pending)this.post(a);this.pending.length=0;return}const r=this.renderer.drawI420(new Uint8Array(e.data),e.width,e.height);r&&((o=this.decodedCb)==null||o.call(this,performance.now()),(!this._size||this._size.width!==r.width||this._size.height!==r.height)&&(this._size=r,(i=this.resizeCb)==null||i.call(this,r)))}}function Jt(){const t=typeof window<"u";let e=!1;try{e=!!document.createElement("canvas").getContext("webgl2")}catch{e=!1}return{secureContext:t&&window.isSecureContext===!0,webCodecs:t&&"VideoDecoder"in window,webgl2:e,wasm:typeof WebAssembly<"u"&&typeof Worker<"u"}}function mo(t=Jt()){return t.secureContext&&t.webCodecs&&t.webgl2?new oo:t.wasm&&t.webgl2?new po:null}function go(t=Jt()){return t.secureContext&&t.webCodecs&&t.webgl2||t.wasm&&t.webgl2}function xo(t=Jt()){return t.secureContext&&t.webCodecs&&t.webgl2?"high":t.wasm&&t.webgl2?"standard":"unsupported"}const bo="https://www.tapflow.dev/reference/configuration#https-secure-context";function yo({open:t,onOpenChange:e}){return n.jsx(An,{open:t,onOpenChange:e,children:n.jsxs(_n,{className:"sm:max-w-[440px]",children:[n.jsxs(Or,{children:[n.jsx(Pn,{children:"Streaming in Standard mode"}),n.jsxs(Hr,{className:"space-y-3 pt-1",children:[n.jsx("span",{className:"block",children:"This screen is running in Standard mode. For a faster, smoother picture, switch to Smooth."}),n.jsx("span",{className:"block",children:"Smooth needs the relay served over HTTPS. If you didn't set up tapflow, ask whoever did."})]})]}),n.jsxs(zr,{children:[n.jsx(ie,{variant:"outline",onClick:()=>window.open(bo,"_blank","noopener,noreferrer"),children:"How to enable"}),n.jsx(ie,{onClick:()=>e(!1),children:"Got it"})]})]})})}const xn="tapflow.perfModeNoticeDismissed";function vo(t,e){return t==="standard"&&!e}const wo={high:"Smooth",standard:"Standard",unsupported:null};function So(t){const{connected:e,joined:r,bootError:o,deviceReady:i,installing:a,installError:c,agentAway:u,decoderUnsupported:d}=t;return e?r?u?"The agent went away — waiting for it to come back…":o?`Boot failed: ${o.length>40?o.slice(0,40)+"…":o}`:i?a?"Installing app…":c?`Install failed: ${c}`:d?"Streaming is not supported in this environment.":null:"Starting device…":"Joining session…":"Connecting…"}function Qt(t){const{joined:e,fps:r,keyboardActive:o}=t,i=So(t),a=r>15,c=a?"#10b981":"#94a3b8",u=a?"Active":"Idle",d=s.useMemo(()=>xo(),[]),h=wo[d],[p,g]=s.useState(!1);s.useEffect(()=>{let f=!1;try{f=localStorage.getItem(xn)==="1"}catch{}vo(d,f)&&g(!0)},[d]);const x=f=>{if(g(f),!f)try{localStorage.setItem(xn,"1")}catch{}};return n.jsxs("div",{className:"w-[300px] shrink-0 mt-3 rounded-xl border bg-background px-4 py-4 flex flex-col gap-3",children:[n.jsxs("div",{className:te("flex items-center",o?"text-emerald-500":"text-muted-foreground"),style:{gap:6},children:[n.jsx(Cs,{className:"h-3.5 w-3.5 shrink-0"}),n.jsx("span",{className:"text-[12px] font-medium",children:"Focus"})]}),e&&n.jsxs("div",{className:"flex items-center gap-[12px]",children:[n.jsxs("div",{className:"flex items-center gap-[4px]",children:[n.jsx("span",{className:"h-2 w-2 rounded-full shrink-0 mr-1",style:{background:c}}),n.jsx("span",{className:"text-[12px] font-mono text-foreground/75",children:r}),n.jsx("span",{className:"text-[12px] text-muted-foreground",children:"fps"}),n.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:"·"}),n.jsx("span",{className:te("text-[11px]",a?"text-emerald-500":"text-muted-foreground/60"),children:u})]}),h&&n.jsxs(n.Fragment,{children:[n.jsx(jn,{orientation:"vertical",className:"h-3"}),d==="standard"?n.jsx("button",{type:"button",onClick:()=>g(!0),className:"text-[11px] text-foreground/70 hover:text-foreground underline-offset-2 hover:underline",children:h}):n.jsx("span",{className:"text-[11px] text-muted-foreground",children:h})]})]}),n.jsx("div",{role:"status",className:i?void 0:"sr-only",children:i&&n.jsx("p",{className:"text-[12px] text-muted-foreground leading-relaxed break-words",children:i})}),n.jsx(yo,{open:p,onOpenChange:x})]})}function Hn({open:t,onOpenChange:e,openUrl:r}){const[o,i]=s.useState(""),a=s.useRef(null);s.useEffect(()=>{t?setTimeout(()=>{var u;return(u=a.current)==null?void 0:u.focus()},0):i("")},[t]);const c=()=>{o.trim()&&(r(o.trim()),e(!1))};return n.jsx(An,{open:t,onOpenChange:e,children:n.jsxs(_n,{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:[n.jsx(Pn,{className:"sr-only",children:"Open Deeplink"}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex-1 h-[32px] flex items-center gap-2 pl-[4px] pb-[1px]",children:[n.jsx(jr,{className:"h-4 w-4 text-muted-foreground shrink-0","aria-hidden":"true"}),n.jsx("input",{ref:a,"aria-label":"Deeplink URL",className:"flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground min-w-0",placeholder:"myapp://home...",value:o,onChange:u=>i(u.target.value),onKeyDown:u=>{u.key==="Enter"&&c()}})]}),n.jsx(ie,{size:"sm",disabled:!o.trim(),onClick:c,className:"shrink-0 rounded-xl h-8 px-4",children:"Open"})]})]})})}function Ro(t,e,r,o,i,a){const{x:c,y:u,width:d,height:h}=i;let p,g;if(a){const x=(t.x-e.left)/e.width;p=(1-(t.y-e.top)/e.height)*r,g=x*o}else p=(t.x-e.left)*(r/e.width),g=(t.y-e.top)*(o/e.height);return p<c||p>c+d||g<u||g>u+h?null:{x:(p-c)/d,y:(g-u)/h}}function ko(t,e,r){const o=(t.x-e.left)/e.width,i=(t.y-e.top)/e.height;return o<0||o>1||i<0||i>1?null:r?{x:i,y:1-o}:{x:o,y:i}}function zn(t){return{f0:{x:1-t.x,y:1-t.y},f1:t}}function jo(t,e){return t>0?Math.min(1,e/t):1}const Kt=22,bn=[84,70,70,69],Co=1,To=0,It=1,Wn=2,Eo=1,No=2,Ao=4;function _o(t){if(t.byteLength<Kt)return null;const e=new DataView(t);for(let i=0;i<bn.length;i++)if(e.getUint8(i)!==bn[i])return null;if(e.getUint8(4)!==Co)return null;const r=e.getUint8(5),o=r&Ao?Wn:r&Eo?It:To;return{capturedAt:Number(e.getBigUint64(6)),relayedAt:Number(e.getBigUint64(14)),codec:o,keyframe:o===It&&(r&No)!==0}}function Vn(t){const{binaryFrameHandlerRef:e,perfHookRef:r,frameCount:o}=t,i=s.useRef(t);s.useLayoutEffect(()=>{i.current=t},[t]),s.useEffect(()=>{let a=null,c=!1,u=!1,d;const h=()=>{if(a)return a;if(c)return null;const p=mo();return p?(a=p,p.onResize(g=>i.current.onResize(g)),d=i.current.onDecoderReady(p),p):(c=!0,i.current.onUnsupported(),console.warn("[decoder] none available — set up HTTPS or use a supported browser"),null)};return e.current=(p,g)=>{const x=i.current.onJpegFrame;if(x&&(g==null?void 0:g.codec)!==It){x(p,g);return}const f=h();if(f){if(!u){if(!(g!=null&&g.keyframe))return;u=!0}f.decode(p),o.current+=1}},()=>{e.current=void 0,typeof d=="function"&&d(),a==null||a.close(),a==null||a.surface.remove(),a=null}},[e,r,o])}const Po=3e3+5*300,Do=Po+500,_t=8;function Lo(){var t;return window.isSecureContext&&typeof ClipboardItem<"u"&&!!((t=navigator.clipboard)!=null&&t.write)}class Rt extends Error{}function Io(t){const e=t.then(r=>new Blob([r],{type:"text/plain"}));return navigator.clipboard.write([new ClipboardItem({"text/plain":e})])}function Zt(t){return!(t.metaKey||t.ctrlKey)||t.altKey?!1:t.code==="KeyV"?!0:!t.shiftKey&&(t.code==="KeyC"||t.code==="KeyX")}const Mo=1024*1024,Uo=t=>new TextEncoder().encode(t).length,$o=t=>{var e;return!!((e=t.payload)!=null&&e.unsupported)},Fo=t=>{var e,r;return((e=t.payload)==null?void 0:e.sentinelParked)===!1||((r=t.payload)==null?void 0:r.unsupported)===!0};function Bo(){const t=window.getSelection();return!!t&&!t.isCollapsed&&t.toString().length>0}function yn(){const t=document.activeElement;return!!t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable)}function qn({sessionId:t,send:e,active:r,supported:o,handlerRef:i,sendChord:a,onError:c}){const u=s.useRef(new Map),d=s.useRef(null),h=s.useRef(c);s.useLayoutEffect(()=>{h.current=c});const p=s.useCallback(x=>{var f;d.current!==x&&(d.current=x,(f=h.current)==null||f.call(h,x))},[]);s.useEffect(()=>(i.current=x=>{if(!x.requestId)return;const f=u.current.get(x.requestId);f&&(u.current.delete(x.requestId),f(x))},()=>{i.current=void 0}),[i]);const g=s.useCallback((...[x,f])=>{const b=X();return new Promise(v=>{const T=setTimeout(()=>{u.current.delete(b),v(null)},Do);u.current.set(b,j=>{clearTimeout(T),v(j)}),e({type:x,sessionId:t,requestId:b,payload:f})})},[e,t]);s.useEffect(()=>{if(!r||!o)return;const x=async b=>{if(b.code==="KeyV"||!Zt(b))return;const v=b.code==="KeyX";if(yn()||Bo()||(b.preventDefault(),b.repeat))return;if(!Lo()){a(v?"KeyX":"KeyC",_t),p("Copied on the device. Serving the dashboard over HTTPS also brings it to your clipboard.");return}let T,j;const L=new Promise((M,k)=>{T=M,j=k});L.catch(()=>{});const C=Io(L).catch(M=>{M instanceof Rt||p(M instanceof Error&&M.name==="NotAllowedError"?"Your browser blocked the clipboard write":"Could not write to your clipboard")}),N=await g("clipboard:read",{press:v?"cut":"copy"});if(!N){j(new Rt("timeout")),p("The device is taking too long — try again");return}if(N.type==="clipboard:error"){j(new Rt(N.message||"read failed")),p(N.message||"Clipboard read failed"),Fo(N)&&a(v?"KeyX":"KeyC",_t);return}if(N.type!=="clipboard:data"){j(new Rt("unexpected reply")),p("Clipboard read failed");return}const{text:E}=N.payload;if(d.current=null,!E){j(new Rt("empty"));return}T(E),await C},f=b=>{var T;if(yn())return;const v=((T=b.clipboardData)==null?void 0:T.getData("text"))??"";if(b.preventDefault(),!v){a("KeyV",_t);return}if(Uo(v)>Mo){p("That text is too large to send to the device");return}g("clipboard:write",{text:v,pasteAfter:!0}).then(j=>{if(!j){p("The device is taking too long — try again");return}if(j.type==="clipboard:write-done"){d.current=null;return}if(j.type!=="clipboard:error"){p("Clipboard write failed");return}p(j.message||"Clipboard write failed"),$o(j)&&a("KeyV",_t)})};return document.addEventListener("keydown",x),document.addEventListener("paste",f),()=>{document.removeEventListener("keydown",x),document.removeEventListener("paste",f)}},[r,o,g,a,p])}const ze=13,ut=8,vn=16,Oo=.02,Ho=100;function zo({sessionId:t,buildId:e,send:r,openUrl:o,launchApp:i,connected:a,joined:c,deviceReady:u,installing:d,installed:h,installError:p,bootError:g,launching:x,chrome:f,binaryFrameHandlerRef:b,clipboardHandlerRef:v,clipboardSupported:T,networkHandlerRef:j,networkSupported:L,onRecordingUploaded:C,swKeyboardVisible:N,swKeyboardPending:E,onKbdToggle:M,rebootPending:k,onReboot:F,restartButtonRef:G,perfHookRef:z}){const B=s.useRef(null),Q=s.useRef(null),ue=s.useRef(null),{fps:Ie,frameCount:Be}=Un(),be=s.useRef(0),{recordState:ye,recordCanvasRef:Z,startClientRecording:Ae,stopClientRecording:Oe}=Mn({sessionId:t,buildId:e,onRecordingUploaded:C}),He=s.useRef(0),[Me,Ue]=s.useState(!1),[U,q]=s.useState(!1),[K,Se]=s.useState(!1),[J,Re]=s.useState(!1),[de,ee]=s.useState(!1),[We,rt]=s.useState(null),[Ve,fe]=s.useState(null),[ve,ke]=s.useState(!1),[Y,he]=s.useState(null),$e=s.useRef(Y);s.useEffect(()=>{$e.current=Y},[Y]);const ge=s.useRef(null),oe=s.useRef(null),re=s.useRef(!1),ae=s.useRef(!1),_e=s.useRef(0),Pe=s.useRef(null),je=s.useRef(null),we=s.useRef("idle"),w=s.useRef(null),H=s.useRef(null),ce=s.useRef(null);s.useEffect(()=>{ce.current=f},[f]),s.useEffect(()=>{const l=new Image;l.onload=()=>{H.current=l},l.src=`data:image/png;base64,${f.framePng}`},[f.framePng]),Vn({binaryFrameHandlerRef:b,perfHookRef:z,frameCount:Be,onUnsupported:()=>Se(!0),onResize:l=>{const y=B.current;if(y&&(y.width!==l.width||y.height!==l.height)&&(y.width=l.width,y.height=l.height,!ce.current)){const m=Z.current;m&&(m.width=l.width,m.height=l.height)}q(!0)},onDecoderReady:l=>{var S;const y=l.surface,m=B.current;y.style.position="absolute",m&&(y.style.left=m.style.left,y.style.top=m.style.top,y.style.width=m.style.width,y.style.height=m.style.height,y.style.borderRadius=m.style.borderRadius),y.style.objectFit="fill",y.style.zIndex="3",y.style.pointerEvents="none",(S=Q.current)==null||S.appendChild(y);let A=null;const P=()=>{const I=B.current,$=I==null?void 0:I.getContext("2d");if(I&&$&&l.size)try{$.drawImage(l.surface,0,0,I.width,I.height)}catch{}A=requestAnimationFrame(P)};return A=requestAnimationFrame(P),()=>{A!==null&&cancelAnimationFrame(A)}},onJpegFrame:l=>{const y=performance.now();be.current&&y-be.current,be.current=y;const m=He.current;createImageBitmap(new Blob([l],{type:"image/jpeg"})).then(A=>{if(performance.now()-y,He.current!==m){A.close();return}const P=B.current,S=P==null?void 0:P.getContext("2d");if(!P||!S){A.close();return}if((P.width!==A.width||P.height!==A.height)&&(P.width=A.width,P.height=A.height,!ce.current)){const $=Z.current;$&&($.width=A.width,$.height=A.height)}const I=performance.now();S.drawImage(A,0,0),performance.now()-I,A.close(),q(!0),Be.current+=1}).catch(()=>{})}}),s.useEffect(()=>{const l=Z.current,y=Q.current;l&&y&&(l.width=y.clientWidth,l.height=y.clientHeight)},[f,Z]);const pe=s.useCallback(()=>{const l=Z.current,y=B.current;if(!l||!y)return;const m=l.getContext("2d");if(!m)return;const A=ce.current;if(m.clearRect(0,0,l.width,l.height),A){H.current&&m.drawImage(H.current,0,0,l.width,l.height);const I=Math.round(A.screenCornerRadius/2*(l.height/(A.compositeHeight/2)));m.save(),m.beginPath(),I>0?m.roundRect(y.offsetLeft,y.offsetTop,y.clientWidth,y.clientHeight,I):m.rect(y.offsetLeft,y.offsetTop,y.clientWidth,y.clientHeight),m.clip(),m.drawImage(y,y.offsetLeft,y.offsetTop,y.clientWidth,y.clientHeight),m.restore()}else m.drawImage(y,0,0,l.width,l.height);const P=$e.current;if(P)for(const I of[P.f0,P.f1]){const $=A?y.offsetLeft+I.x*y.clientWidth:I.x*l.width,le=A?y.offsetTop+I.y*y.clientHeight:I.y*l.height;re.current?(m.beginPath(),m.arc($,le,ut,0,Math.PI*2),m.fillStyle="rgba(255,255,255,0.92)",m.fill(),m.strokeStyle="rgba(0,0,0,0.2)",m.lineWidth=1,m.stroke()):(m.beginPath(),m.arc($,le,ze,0,Math.PI*2),m.strokeStyle="rgba(0,0,0,0.3)",m.lineWidth=3,m.stroke(),m.beginPath(),m.arc($,le,ze,0,Math.PI*2),m.strokeStyle="rgba(255,255,255,0.65)",m.lineWidth=1.5,m.stroke())}const S=je.current;if(S){const I=we.current,$=w.current;if(m.save(),I==="down")m.beginPath(),m.arc(S.x,S.y,ut,0,Math.PI*2),m.fillStyle="rgba(255,255,255,0.92)",m.fill(),m.strokeStyle="rgba(0,0,0,0.2)",m.lineWidth=1,m.stroke();else if(I==="release"&&$){const le=Math.min((performance.now()-$.startTime)/350,1);m.beginPath(),m.arc(S.x,S.y,ut+26*le,0,Math.PI*2),m.strokeStyle=`rgba(255,255,255,${(1-le)*.55})`,m.lineWidth=1.5,m.stroke(),le>=1&&(we.current="idle",w.current=null)}else m.beginPath(),m.arc(S.x,S.y,ze,0,Math.PI*2),m.strokeStyle="rgba(0,0,0,0.3)",m.lineWidth=3,m.stroke(),m.beginPath(),m.arc(S.x,S.y,ze,0,Math.PI*2),m.strokeStyle="rgba(255,255,255,0.65)",m.lineWidth=1.5,m.stroke();m.restore()}},[Z]),V=s.useCallback(()=>{const l=B.current;if(!l)return;const y=document.createElement("canvas"),m=y.getContext("2d");m&&(y.width=l.width,y.height=l.height,m.drawImage(l,0,0),y.toBlob(A=>{if(!A)return;const P=URL.createObjectURL(A),S=document.createElement("a");S.href=P,S.download=`tapflow-${Date.now()}.png`,S.click(),URL.revokeObjectURL(P)},"image/png"))},[]),me=s.useCallback(()=>{if(ye==="idle"){const l=Z.current;if(!l)return;const y=Q.current;if(y&&y.clientWidth>0)l.width=y.clientWidth,l.height=y.clientHeight;else{const m=B.current;if(m&&m.width>0)l.width=m.width,l.height=m.height;else return}Ae(pe)}else ye==="recording"&&Oe()},[ye,Ae,Oe,pe,Z]),qe=s.useCallback(()=>{r({type:"input:rotate",sessionId:t}),Re(l=>!l)},[r,t]),Nt=s.useRef(J);s.useEffect(()=>{Nt.current=J},[J]),s.useEffect(()=>()=>{Nt.current&&r({type:"input:rotate",sessionId:t})},[]);const Ut=s.useCallback((l,y)=>{r({type:"input:key",sessionId:t,requestId:X(),payload:{code:l,modifiers:y}})},[r,t]);qn({sessionId:t,send:r,active:de,supported:T,handlerRef:v,sendChord:Ut,onError:l=>Ne.error(l)});const st=Fn({sessionId:t,send:r,supported:L,deviceReady:u,handlerRef:j,onError:l=>Ne.error(l)});s.useEffect(()=>{const l=new Set(["ShiftLeft","ShiftRight","ControlLeft","ControlRight","MetaLeft","MetaRight"]),y=S=>{if(S.code==="AltLeft"||S.code==="AltRight"){ae.current=!0;return}if(S.metaKey){const $=document.activeElement;if(!$||$.tagName!=="INPUT"&&$.tagName!=="TEXTAREA"){if(!S.shiftKey&&S.code==="KeyK"){S.preventDefault(),Ue(!0);return}if(!S.shiftKey&&S.code==="KeyS"){S.preventDefault(),V();return}if(S.shiftKey&&S.code==="KeyY"){S.preventDefault(),me();return}if(S.shiftKey&&S.code==="KeyO"){S.preventDefault(),qe();return}if(S.shiftKey&&S.code==="KeyU"){S.preventDefault(),r({type:"input:button",sessionId:t,requestId:X(),payload:{name:"home"}});return}if(S.shiftKey&&S.code==="KeyK"){S.preventDefault(),E||M();return}}}if(!de||l.has(S.code)||T&&Zt(S))return;S.preventDefault();const I=(S.shiftKey?2:0)|(S.ctrlKey?1:0)|(S.metaKey?8:0);r({type:"input:key",sessionId:t,requestId:X(),payload:{code:S.code,modifiers:I}})},m=()=>{re.current&&(re.current=!1,ke(!1),r({type:"input:pinch:end",sessionId:t,requestId:X()})),ae.current=!1,he(null)},A=S=>{(S.code==="AltLeft"||S.code==="AltRight")&&m()},P=()=>{ae.current&&m()};return window.addEventListener("keydown",y),window.addEventListener("keyup",A),window.addEventListener("blur",P),()=>{window.removeEventListener("keydown",y),window.removeEventListener("keyup",A),window.removeEventListener("blur",P)}},[de,T,r,t,V,me,qe,M,E]),s.useEffect(()=>{if(!de)return;const l=y=>{const m=Q.current??B.current;m&&!m.contains(y.target)&&ee(!1)};return document.addEventListener("pointerdown",l),()=>document.removeEventListener("pointerdown",l)},[de]);const Xe=s.useCallback(l=>{const y=(J?ue.current:null)??Q.current;if(!y)return null;const m=y.getBoundingClientRect(),A=f.compositeWidth/2,P=f.compositeHeight/2,S=f.screenRect.x/2,I=f.screenRect.y/2,$=f.screenRect.width/2,le=f.screenRect.height/2;return Ro({x:l.clientX,y:l.clientY},m,A,P,{x:S,y:I,width:$,height:le},J)},[f,J]),ot=s.useCallback(l=>{const y=Xe(l);return y?zn(y):null},[Xe]),xe=s.useCallback(l=>{const y=J?ue.current:Q.current;if(!y)return null;const m=y.getBoundingClientRect();let A,P;if(J){const I=m.height-(l.clientY-m.top),$=l.clientX-m.left;A=I*(f.compositeWidth/m.height),P=$*(f.compositeHeight/m.width)}else A=(l.clientX-m.left)*(f.compositeWidth/m.width),P=(l.clientY-m.top)*(f.compositeHeight/m.height);const S=f.screenRect;return A>=S.x&&A<=S.x+S.width&&P>=S.y&&P<=S.y+S.height?null:Bs(A,P,f.buttons,Ho)},[f,J]),Ge=s.useCallback(l=>{const y=B.current,m=Z.current;return y&&y.clientWidth>0?{x:y.offsetLeft+l.x*y.clientWidth,y:y.offsetTop+l.y*y.clientHeight}:{x:l.x*((m==null?void 0:m.width)??1),y:l.y*((m==null?void 0:m.height)??1)}},[Z]),Je=s.useCallback(l=>{if(ee(!0),ae.current){const S=ot(l);if(!S)return;re.current=!0,ke(!0),l.target.setPointerCapture(l.pointerId),he(S),r({type:"input:pinch:start",sessionId:t,payload:S});return}const y=xe(l);if(y){ge.current=y,rt(y),l.target.setPointerCapture(l.pointerId),r({type:"input:button",sessionId:t,requestId:X(),payload:{name:y,phase:"down"}});return}const m=Xe(l);if(!m)return;oe.current=m,l.target.setPointerCapture(l.pointerId),je.current=Ge(m),we.current="down",w.current=null;const A=l.currentTarget.getBoundingClientRect(),P=Pe.current;P&&(P.style.display="block",P.style.left=`${l.clientX-A.left}px`,P.style.top=`${l.clientY-A.top}px`,P.style.width=`${ut*2}px`,P.style.height=`${ut*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:m})},[xe,Xe,ot,Ge,r,t]),at=s.useCallback(l=>{if(l.buttons===0){if(fe(xe(l)),ae.current){he(ot(l)),je.current=null;const I=Pe.current;I&&(I.style.display="none")}else{he(null);const I=Xe(l);je.current=I?Ge(I):null,we.current!=="down"&&(we.current="idle");const $=Pe.current;if($)if(I){const le=l.currentTarget.getBoundingClientRect();$.style.display="block",$.style.left=`${l.clientX-le.left}px`,$.style.top=`${l.clientY-le.top}px`,$.style.width=`${ze*2}px`,$.style.height=`${ze*2}px`,$.style.background="transparent",$.style.border="1.5px solid rgba(255,255,255,0.6)",$.style.boxShadow="0 0 0 1px rgba(0,0,0,0.3)"}else $.style.display="none"}return}if(re.current){const I=ot(l);if(!I)return;const $=performance.now();if($-_e.current<vn)return;_e.current=$,he(I),r({type:"input:pinch:move",sessionId:t,payload:I});return}if(ge.current||!oe.current)return;const y=Xe(l);if(!y)return;const m=y.x-oe.current.x,A=y.y-oe.current.y;if(Math.sqrt(m*m+A*A)<Oo)return;const P=performance.now();if(P-_e.current<vn)return;_e.current=P,je.current=Ge(y);const S=Pe.current;if(S&&S.style.display!=="none"){const I=l.currentTarget.getBoundingClientRect();S.style.left=`${l.clientX-I.left}px`,S.style.top=`${l.clientY-I.top}px`}r({type:"input:touch:move",sessionId:t,payload:y})},[xe,Xe,ot,Ge,r,t]),$t=s.useCallback(()=>{if(re.current){re.current=!1,ke(!1),he(null),r({type:"input:pinch:end",sessionId:t,requestId:X()});return}if(oe.current=null,ge.current){r({type:"input:button",sessionId:t,requestId:X(),payload:{name:ge.current,phase:"up"}}),ge.current=null,setTimeout(()=>rt(null),100);return}we.current="release",w.current={startTime:performance.now()};const l=Pe.current;l&&(l.style.width=`${ze*2}px`,l.style.height=`${ze*2}px`,l.style.background="transparent",l.style.border="1.5px solid rgba(255,255,255,0.6)",l.style.boxShadow="0 0 0 1px rgba(0,0,0,0.3)"),r({type:"input:touch:end",sessionId:t,requestId:X()})},[r,t]),Qe=s.useCallback(()=>{if(re.current){re.current=!1,ke(!1),he(null),r({type:"input:pinch:end",sessionId:t,requestId:X()});return}if(oe.current=null,ge.current){r({type:"input:button",sessionId:t,requestId:X(),payload:{name:ge.current,phase:"up"}}),ge.current=null,rt(null);return}we.current="release",w.current={startTime:performance.now()},r({type:"input:touch:end",sessionId:t,requestId:X()})},[r,t]),Ft=s.useCallback(()=>{fe(null),he(null),je.current=null;const l=Pe.current;l&&(l.style.display="none")},[]),Bt=f.compositeWidth/2,vt=f.compositeHeight/2,wt=jo(vt,750),it=Math.round(Bt*wt),ct=Math.round(vt*wt),lt=f.screenRect.x/f.compositeWidth*100,mt=f.screenRect.y/f.compositeHeight*100,gt=f.screenRect.width/f.compositeWidth*100,xt=f.screenRect.height/f.compositeHeight*100,R=Math.round(f.screenCornerRadius/2*wt),D=n.jsx(n.Fragment,{children:n.jsxs(Ce,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Home",onClick:()=>r({type:"input:button",sessionId:t,requestId:X(),payload:{name:"home"}}),children:n.jsx(Dn,{className:"h-4 w-4"})})}),n.jsx(Ee,{side:"left",children:n.jsxs("span",{className:"flex items-center gap-3",children:["Home ",n.jsxs(qt,{children:[n.jsx(ft,{children:"⌘"}),n.jsx(ft,{children:"⇧"}),n.jsx(ft,{children:"U"})]})]})})]})}),W=s.useId(),_=n.jsxs(n.Fragment,{children:[n.jsx("span",{id:W,role:"status",className:"sr-only",children:E?"Changing the software keyboard.":N?"The software keyboard is up.":"The software keyboard is down."}),n.jsxs(Ce,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":E?"Software keyboard — changing it":"Software keyboard","aria-pressed":N,"aria-busy":E,"aria-disabled":E,"aria-describedby":W,onClick:()=>{E||M()},"data-active":N,children:E?n.jsx(yt,{className:"h-4 w-4 animate-spin"}):n.jsx(ds,{className:"h-4 w-4"})})}),n.jsx(Ee,{side:"left",children:E?n.jsx("span",{children:"Software keyboard — changing it"}):n.jsxs("span",{className:"flex items-center gap-3",children:["Software keyboard ",n.jsxs(qt,{children:[n.jsx(ft,{children:"⌘"}),n.jsx(ft,{children:"⇧"}),n.jsx(ft,{children:"K"})]})]})})]})]}),se=h&&e?n.jsxs(Ce,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:"h-8 w-8",disabled:x,"aria-label":"Launch app",onClick:i,children:x?n.jsx(yt,{className:"h-4 w-4 animate-spin"}):n.jsx(Tn,{className:"h-4 w-4"})})}),n.jsx(Ee,{side:"left",children:x?"Launching…":"Launch app"})]}):null;return n.jsxs("div",{role:"region","aria-label":"Device screen",className:"flex items-start justify-center gap-16",children:[n.jsx("canvas",{ref:Z,style:{display:"none"}}),n.jsx(Hn,{open:Me,onOpenChange:Ue,openUrl:o}),n.jsx($n,{joined:c,onDeepLink:()=>Ue(!0),onScreenshot:V,onRecordToggle:me,recordState:ye,onRotate:qe,navigationSlot:D,deviceSlot:_,launchSlot:se,network:L?{position:st.position,steerable:st.steerable,reason:st.reason,pending:st.pending,onToggle:st.toggle}:void 0,reboot:{pending:k,onReboot:F,buttonRef:G}}),n.jsxs("div",{className:"flex items-start gap-8",children:[n.jsxs("div",{ref:ue,style:{width:J?ct:it,height:J?it:ct,position:"relative",flexShrink:0},children:[n.jsxs("div",{ref:Q,className:`relative ${Ve?"cursor-pointer":"cursor-default"}`,style:{width:it,height:ct,...J?{position:"absolute",top:(it-ct)/2,left:(ct-it)/2,transform:"rotate(-90deg)",transformOrigin:"center center"}:{}},onPointerDown:Je,onPointerMove:at,onPointerUp:$t,onPointerCancel:Qe,onPointerLeave:Ft,children:[n.jsx("img",{src:`data:image/png;base64,${f.framePng}`,style:{position:"absolute",top:0,left:0,zIndex:2,width:"100%",height:"100%",display:"block",pointerEvents:"none",userSelect:"none"},draggable:!1,alt:""}),n.jsx("canvas",{ref:B,style:{position:"absolute",zIndex:3,left:`${lt}%`,top:`${mt}%`,width:`${gt}%`,height:`${xt}%`,borderRadius:R>0?`${R}px`:void 0,backgroundColor:"#010101",cursor:"none",visibility:U?"visible":"hidden"}}),!U&&n.jsx("div",{className:"absolute animate-pulse bg-zinc-700",style:{zIndex:3,left:`${lt}%`,top:`${mt}%`,width:`${gt}%`,height:`${xt}%`,borderRadius:R>0?`${R}px`:void 0}}),Y&&(()=>{const l=lt/100,y=mt/100,m=gt/100,A=xt/100,P=(S,I)=>({left:`${(l+S*m)*100}%`,top:`${(y+I*A)*100}%`});return n.jsx(n.Fragment,{children:[Y.f0,Y.f1].map((S,I)=>n.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",...ve?{width:ut*2,height:ut*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:ze*2,height:ze*2,background:"transparent",border:"1.5px solid rgba(255,255,255,0.6)",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)"},...P(S.x,S.y)}},I))})})(),c&&Ie===0&&n.jsx("div",{style:{position:"absolute",zIndex:8,left:`${lt}%`,top:`${mt}%`,width:`${gt}%`,height:`${xt}%`,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:n.jsx("span",{style:{color:"white",fontSize:"0.875rem"},children:"Waiting for first frame..."})}),f.buttons.map(l=>{const y=We===l.name,m=Ve===l.name,A=l.anchor==="top",P=In(l),S=P.top/f.compositeHeight*100,I=l.buttonH/f.compositeHeight*100,$=l.buttonW/f.compositeWidth*100,le=l.buttonW/2,De=P.left/f.compositeWidth*100,Fe=(2*l.rolloverOffset.x-l.normalOffset.x-le)/f.compositeWidth*100,Ze=l.rolloverOffset.x/f.compositeWidth*100,At=S,bt=A?(2*l.rolloverOffset.y-l.normalOffset.y)/f.compositeHeight*100:0,hr=l.onTop?4:1;return n.jsxs(s.Fragment,{children:[l.buttonPng&&n.jsx("img",{src:`data:image/png;base64,${l.buttonPng}`,style:{position:"absolute",zIndex:hr,top:`${A&&m?bt:S}%`,left:`${A?De:m?Fe:De}%`,width:`${$}%`,height:`${I}%`,transition:A?"top 0.15s ease":"left 0.15s ease",pointerEvents:"none",userSelect:"none"},draggable:!1,alt:""}),y&&l.pressedPng&&l.pressedRect&&n.jsx("img",{src:`data:image/png;base64,${l.pressedPng}`,style:{position:"absolute",zIndex:l.onTop?3:1,left:`${A?De:m?Fe:De}%`,top:`${A&&m?bt:S}%`,width:`${l.pressedRect.width/f.compositeWidth*100}%`,height:`${l.pressedRect.height/f.compositeHeight*100}%`,pointerEvents:"none",userSelect:"none"},draggable:!1,alt:""}),m&&n.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:`${Ze}%`,top:`${At}%`,transform:"translate(-50%, calc(-100% - 8px))"},children:l.accessibilityTitle})]},l.name)})]}),n.jsx("div",{ref:Pe,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"}})]}),n.jsx(Qt,{joined:c,fps:Ie,connected:a,deviceReady:u,bootError:g,installing:d,installError:p,decoderUnsupported:K,keyboardActive:de})]})]})}const dt=13,kt=8,wn=16,Wo=.02,zt=720;function Vo({sessionId:t,buildId:e,send:r,openUrl:o,launchApp:i,connected:a,joined:c,deviceReady:u,installing:d,installed:h,installError:p,bootError:g,launching:x,androidButtons:f,binaryFrameHandlerRef:b,clipboardHandlerRef:v,clipboardSupported:T,networkHandlerRef:j,networkSupported:L,onRecordingUploaded:C,rebootPending:N,onReboot:E,restartButtonRef:M,screenWidth:k,screenHeight:F,cornerRadius:G,perfHookRef:z}){const B=s.useRef(null),Q=s.useRef(null),ue=s.useRef(null),{fps:Ie,frameCount:Be}=Un(),{recordState:be,recordCanvasRef:ye,startClientRecording:Z,stopClientRecording:Ae}=Mn({sessionId:t,buildId:e,onRecordingUploaded:C}),[Oe,He]=s.useState(!1),[Me,Ue]=s.useState(!1),[U,q]=s.useState(!1),K=s.useRef(null),[Se,J]=s.useState(null),[Re,de]=s.useState(!1),[ee,We]=s.useState(!1),[rt,Ve]=s.useState(!1),[fe,ve]=s.useState(null),ke=s.useRef(fe);s.useEffect(()=>{ke.current=fe},[fe]);const Y=s.useRef(!1),he=s.useRef(!1),$e=s.useRef(null),ge=s.useRef(0),oe=s.useRef(null),re=s.useRef(null),ae=s.useRef("idle"),_e=s.useRef(null);Vn({binaryFrameHandlerRef:b,perfHookRef:z,frameCount:Be,onUnsupported:()=>q(!0),onResize:R=>{Ue(!0);const D=K.current;(!D||D.width!==R.width||D.height!==R.height)&&(K.current=R,J(R))},onDecoderReady:R=>{var W;ue.current=R;const D=R.surface;D.style.display="block",D.style.width="100%",D.style.height="100%",D.style.objectFit="fill",(W=B.current)==null||W.appendChild(D)}});const Pe=s.useCallback(()=>{var le;const R=ye.current,D=(le=ue.current)==null?void 0:le.surface,W=K.current;if(!R||!D||!W)return;const _=R.getContext("2d");if(!_)return;const se=W.width,l=W.height,y=R.width>R.height!=se>l;_.save(),y&&(_.translate(R.width,0),_.rotate(Math.PI/2)),_.drawImage(D,0,0,se,l);const m=Math.max(se,l),A=m>zt?m/zt:1,P=dt*A,S=kt*A,I=ke.current;if(I)for(const De of[I.f0,I.f1]){const Fe=De.x*se,Ze=De.y*l;Y.current?(_.beginPath(),_.arc(Fe,Ze,S,0,Math.PI*2),_.fillStyle="rgba(255,255,255,0.92)",_.fill(),_.strokeStyle="rgba(0,0,0,0.2)",_.lineWidth=A,_.stroke()):(_.beginPath(),_.arc(Fe,Ze,P,0,Math.PI*2),_.strokeStyle="rgba(0,0,0,0.3)",_.lineWidth=3*A,_.stroke(),_.beginPath(),_.arc(Fe,Ze,P,0,Math.PI*2),_.strokeStyle="rgba(255,255,255,0.65)",_.lineWidth=1.5*A,_.stroke())}const $=re.current;if($){const De=$.x*se,Fe=$.y*l,Ze=ae.current,At=_e.current;if(Ze==="down")_.beginPath(),_.arc(De,Fe,S,0,Math.PI*2),_.fillStyle="rgba(255,255,255,0.92)",_.fill(),_.strokeStyle="rgba(0,0,0,0.2)",_.lineWidth=A,_.stroke();else if(Ze==="release"&&At){const bt=Math.min((performance.now()-At.startTime)/350,1);_.beginPath(),_.arc(De,Fe,S+26*A*bt,0,Math.PI*2),_.strokeStyle=`rgba(255,255,255,${(1-bt)*.55})`,_.lineWidth=1.5*A,_.stroke(),bt>=1&&(ae.current="idle",_e.current=null)}else _.beginPath(),_.arc(De,Fe,P,0,Math.PI*2),_.strokeStyle="rgba(0,0,0,0.3)",_.lineWidth=3*A,_.stroke(),_.beginPath(),_.arc(De,Fe,P,0,Math.PI*2),_.strokeStyle="rgba(255,255,255,0.65)",_.lineWidth=1.5*A,_.stroke()}_.restore()},[ye]),je=s.useCallback(()=>{var se;const R=(se=ue.current)==null?void 0:se.surface,D=K.current;if(!R||!D)return;const W=document.createElement("canvas"),_=W.getContext("2d");_&&(W.width=D.width,W.height=D.height,_.drawImage(R,0,0,D.width,D.height),W.toBlob(l=>{if(!l)return;const y=URL.createObjectURL(l),m=document.createElement("a");m.href=y,m.download=`tapflow-${Date.now()}.png`,m.click(),URL.revokeObjectURL(y)},"image/png"))},[]),we=s.useCallback(()=>{if(be==="idle"){const R=ye.current;if(!R)return;const D=K.current;if(!D)return;const W=V.current;R.width=W?D.height:D.width,R.height=W?D.width:D.height,Z(Pe)}else be==="recording"&&Ae()},[be,Z,Ae,Pe,ye]),w=s.useCallback(()=>{r({type:"input:rotate",sessionId:t}),de(R=>!R)},[r,t]),H=s.useRef(Re);s.useEffect(()=>{H.current=Re},[Re]),s.useEffect(()=>()=>{H.current&&r({type:"input:rotate",sessionId:t})},[]);const ce=s.useCallback((R,D)=>{r({type:"input:key",sessionId:t,requestId:X(),payload:{code:R,modifiers:D}})},[r,t]);qn({sessionId:t,send:r,active:ee,supported:T,handlerRef:v,sendChord:ce,onError:R=>Ne.error(R)});const pe=Fn({sessionId:t,send:r,supported:L,deviceReady:u,handlerRef:j,onError:R=>Ne.error(R)});s.useEffect(()=>{const R=new Set(["ShiftLeft","ShiftRight","ControlLeft","ControlRight","MetaLeft","MetaRight"]),D=l=>{if(l.code==="AltLeft"||l.code==="AltRight"){he.current=!0;return}if(l.metaKey){const m=document.activeElement;if(!m||m.tagName!=="INPUT"&&m.tagName!=="TEXTAREA"){if(!l.shiftKey&&l.code==="KeyK"){l.preventDefault(),He(!0);return}if(!l.shiftKey&&l.code==="KeyS"){l.preventDefault(),je();return}if(l.shiftKey&&l.code==="KeyY"){l.preventDefault(),we();return}if(l.shiftKey&&l.code==="KeyO"){l.preventDefault(),w();return}}}if(!ee||R.has(l.code)||T&&Zt(l))return;l.preventDefault();const y=(l.shiftKey?2:0)|(l.ctrlKey?1:0)|(l.metaKey?8:0);r({type:"input:key",sessionId:t,requestId:X(),payload:{code:l.code,modifiers:y}})},W=()=>{Y.current&&(Y.current=!1,Ve(!1),r({type:"input:pinch:end",sessionId:t,requestId:X()})),he.current=!1,ve(null)},_=l=>{(l.code==="AltLeft"||l.code==="AltRight")&&W()},se=()=>{he.current&&W()};return window.addEventListener("keydown",D),window.addEventListener("keyup",_),window.addEventListener("blur",se),()=>{window.removeEventListener("keydown",D),window.removeEventListener("keyup",_),window.removeEventListener("blur",se)}},[ee,T,r,t,je,we,w]),s.useEffect(()=>{if(!ee)return;const R=D=>{const W=Q.current??B.current;W&&!W.contains(D.target)&&We(!1)};return document.addEventListener("pointerdown",R),()=>document.removeEventListener("pointerdown",R)},[ee]);const V=s.useRef(!1),me=s.useCallback(R=>{const D=B.current;if(!D)return null;const W=D.getBoundingClientRect();return ko({x:R.clientX,y:R.clientY},W,V.current)},[]),qe=s.useCallback(R=>{const D=me(R);return D?zn(D):null},[me]),Nt=s.useCallback(R=>{if(he.current){const se=qe(R);if(!se)return;Y.current=!0,Ve(!0),R.target.setPointerCapture(R.pointerId);const l=oe.current;l&&(l.style.display="none"),ve(se),r({type:"input:pinch:start",sessionId:t,payload:se});return}const D=me(R);if(!D)return;We(!0),$e.current=D,R.target.setPointerCapture(R.pointerId);const W=R.currentTarget.getBoundingClientRect();re.current=D,ae.current="down",_e.current=null;const _=oe.current;_&&(_.style.display="block",_.style.left=`${R.clientX-W.left}px`,_.style.top=`${R.clientY-W.top}px`,_.style.width=`${kt*2}px`,_.style.height=`${kt*2}px`,_.style.background="rgba(255,255,255,0.92)",_.style.border="1.5px solid rgba(0,0,0,0.2)",_.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:D})},[me,qe,r,t]),Ut=s.useCallback(R=>{if(R.buttons===0){if(he.current){ve(qe(R)),re.current=null;const S=oe.current;S&&(S.style.display="none");return}const m=me(R),A=R.currentTarget.getBoundingClientRect(),P=oe.current;m?(re.current=m,ae.current!=="down"&&(ae.current="idle"),P&&(P.style.display="block",P.style.left=`${R.clientX-A.left}px`,P.style.top=`${R.clientY-A.top}px`,P.style.width=`${dt*2}px`,P.style.height=`${dt*2}px`,P.style.background="transparent",P.style.border="1.5px solid rgba(255,255,255,0.6)",P.style.boxShadow="0 0 0 1px rgba(0,0,0,0.3)")):(re.current=null,P&&(P.style.display="none"));return}if(Y.current){const m=qe(R);if(!m)return;const A=performance.now();if(A-ge.current<wn)return;ge.current=A,ve(m),r({type:"input:pinch:move",sessionId:t,payload:m});return}if(!$e.current)return;const D=me(R);if(!D)return;const W=D.x-$e.current.x,_=D.y-$e.current.y;if(Math.sqrt(W*W+_*_)<Wo)return;const se=performance.now();if(se-ge.current<wn)return;ge.current=se;const l=R.currentTarget.getBoundingClientRect();re.current=D;const y=oe.current;y&&y.style.display!=="none"&&(y.style.left=`${R.clientX-l.left}px`,y.style.top=`${R.clientY-l.top}px`),r({type:"input:touch:move",sessionId:t,payload:D})},[me,qe,r,t]),st=s.useCallback(()=>{if(Y.current){Y.current=!1,Ve(!1),ve(null),r({type:"input:pinch:end",sessionId:t,requestId:X()});return}$e.current=null,ae.current="release",_e.current={startTime:performance.now()};const R=oe.current;R&&(R.style.width=`${dt*2}px`,R.style.height=`${dt*2}px`,R.style.background="transparent",R.style.border="1.5px solid rgba(255,255,255,0.6)",R.style.boxShadow="0 0 0 1px rgba(0,0,0,0.3)"),r({type:"input:touch:end",sessionId:t,requestId:X()})},[r,t]),Xe=s.useCallback(()=>{if(Y.current){Y.current=!1,Ve(!1),ve(null),r({type:"input:pinch:end",sessionId:t,requestId:X()});return}$e.current=null,ae.current="release",_e.current={startTime:performance.now()},r({type:"input:touch:end",sessionId:t,requestId:X()})},[r,t]),ot=s.useCallback(()=>{ve(null),re.current=null;const R=oe.current;R&&(R.style.display="none")},[]),xe=Se??(k&&F?{width:k,height:F}:null),Ge=xe?Math.min(1,zt/Math.max(xe.width,xe.height)):.3,Je=xe?Math.round(xe.width*Ge):324,at=xe?Math.round(xe.height*Ge):720,$t=xe?xe.width>xe.height:!1,Qe=Re&&!$t;s.useLayoutEffect(()=>{V.current=Qe},[Qe]);const Ft=Qe?at:Je,Bt=Qe?Je:at,vt=G!=null?Math.round(G*Je):22,cn=Qe?{position:"absolute",width:Je,height:at,top:(Je-at)/2,left:(at-Je)/2,transform:"rotate(90deg)",transformOrigin:"center center",visibility:Me?"visible":"hidden",cursor:"none"}:{visibility:Me?"visible":"hidden",cursor:"none"},wt=["home","back","recent_apps"],it=["volume_up","volume_down","power"],ct=R=>R==="back"?n.jsx(Qr,{className:"h-4 w-4"}):R==="recent_apps"?n.jsx(pr,{className:"h-4 w-4"}):R==="volume_up"?n.jsx(Ls,{className:"h-4 w-4"}):R==="volume_down"?n.jsx(Ps,{className:"h-4 w-4"}):R==="power"?n.jsx(xs,{className:"h-4 w-4"}):n.jsx(Dn,{className:"h-4 w-4"}),lt=R=>n.jsx(n.Fragment,{children:R.map(D=>f==null?void 0:f.find(W=>W.name===D)).filter(D=>D!==void 0).map(D=>n.jsxs(Ce,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":D.accessibilityTitle,onClick:()=>r({type:"input:button",sessionId:t,requestId:X(),payload:{name:D.name}}),children:ct(D.name)})}),n.jsx(Ee,{side:"left",children:D.accessibilityTitle})]},D.name))}),mt=lt(wt),gt=lt(it),xt=h&&e?n.jsxs(Ce,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:"h-8 w-8",disabled:x||d,"aria-label":"Launch app",onClick:i,children:x?n.jsx(yt,{className:"h-4 w-4 animate-spin"}):n.jsx(Tn,{className:"h-4 w-4"})})}),n.jsx(Ee,{side:"left",children:x?"Launching…":d?"Installing…":"Launch app"})]}):null;return n.jsxs("div",{role:"region","aria-label":"Device screen",className:"flex items-start justify-center gap-16",children:[n.jsx("canvas",{ref:ye,style:{display:"none"}}),n.jsx(Hn,{open:Oe,onOpenChange:He,openUrl:o}),n.jsx($n,{joined:c,onDeepLink:()=>He(!0),onScreenshot:je,onRecordToggle:we,recordState:be,onRotate:w,navigationSlot:mt,deviceSlot:gt,launchSlot:xt,network:L?{position:pe.position,steerable:pe.steerable,reason:pe.reason,pending:pe.pending,onToggle:pe.toggle}:void 0,reboot:{pending:N,onReboot:E,buttonRef:M}}),n.jsxs("div",{className:"flex items-start gap-8",children:[n.jsx("div",{style:{background:"#1c1c1e",borderRadius:`${vt+12}px`,padding:"12px",flexShrink:0,boxShadow:"0 8px 32px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06)"},children:n.jsx("div",{ref:Q,className:"relative",style:{width:Ft,height:Bt,backgroundColor:"#010101",borderRadius:`${vt}px`,overflow:"hidden"},children:!U&&n.jsxs(n.Fragment,{children:[n.jsx("div",{ref:B,className:Qe?void 0:"block w-full h-full",style:cn,onPointerDown:Nt,onPointerMove:Ut,onPointerUp:st,onPointerCancel:Xe,onPointerLeave:ot}),!Me&&n.jsx("div",{className:"absolute inset-0 animate-pulse bg-zinc-700"}),!Me&&u&&n.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:n.jsx("span",{style:{color:"rgba(255,255,255,0.6)",fontSize:"0.875rem"},children:"Waiting for stream…"})}),n.jsx("div",{ref:oe,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"}}),fe&&n.jsx(n.Fragment,{children:[fe.f0,fe.f1].map((R,D)=>n.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:`${R.x*100}%`,top:`${R.y*100}%`,...rt?{width:kt*2,height:kt*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:dt*2,height:dt*2,background:"transparent",border:"1.5px solid rgba(255,255,255,0.6)",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)"}}},D))})]})})}),n.jsx(Qt,{joined:c,fps:Ie,connected:a,deviceReady:u,bootError:g,installing:d,installError:p,decoderUnsupported:U,keyboardActive:ee})]})]})}function qo(t,e){const r=new DataView(t),o=Math.floor(t.byteLength/2),i=Math.floor(o/e),a=[];for(let c=0;c<e;c++)a.push(new Float32Array(i));for(let c=0;c<i;c++)for(let u=0;u<e;u++){const d=r.getInt16((c*e+u)*2,!0);a[u][c]=d/32768}return a}const Xo=44100,Wt=2,Sn=.06,Ko=.3;function Yo(){const t=s.useRef(null),e=s.useRef(0),r=s.useCallback(()=>{if(t.current)return t.current;const i=window.AudioContext??window.webkitAudioContext;return i?(t.current=new i,t.current):null},[]),o=s.useCallback(i=>{var x;const a=r();if(!a)return;a.state==="suspended"&&a.resume();const c=qo(i,Wt),u=((x=c[0])==null?void 0:x.length)??0;if(u===0)return;const d=a.createBuffer(Wt,u,Xo);for(let f=0;f<Wt;f++)d.getChannelData(f).set(c[f]);const h=a.createBufferSource();h.buffer=d,h.connect(a.destination);const p=a.currentTime;let g=e.current;(g<p+.005||g>p+Ko+Sn)&&(g=p+Sn),h.start(g),e.current=g+d.duration},[r]);return s.useEffect(()=>()=>{var i;(i=t.current)==null||i.close(),t.current=null},[]),{pushFrame:o}}const Go=2e4;function Jo({sessionId:t,deviceId:e,deviceReady:r,send:o,handlerRef:i,onShutdownComplete:a,onError:c}){const[u,d]=s.useState(!1),h=s.useRef(null),p=s.useRef(a),g=s.useRef(c);s.useEffect(()=>{p.current=a},[a]),s.useEffect(()=>{g.current=c},[c]),s.useEffect(()=>{d(!1),h.current=null},[t]),s.useEffect(()=>{r||(d(!1),h.current=null)},[r]),s.useEffect(()=>(i.current=v=>{if(v.requestId===h.current){if(h.current=null,d(!1),v.type==="device:shutdown-error"){g.current(`The device was not restarted. ${v.message}`);return}p.current()}},()=>{i.current=void 0}),[i]);const[x,f]=s.useState(null);s.useEffect(()=>{f(u?h.current:null)},[u]),s.useEffect(()=>{if(x===null)return;const v=setTimeout(()=>{h.current===x&&(d(!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."))},Go);return()=>clearTimeout(v)},[x]);const b=s.useCallback(()=>{if(u)return;const v=X();h.current=v,d(!0),o({type:"device:shutdown",sessionId:t,requestId:v,payload:{deviceId:e}})},[u,o,t,e]);return{pending:u,reboot:b}}const Rn={"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 Qo(t){const e=t!==void 0&&Object.hasOwn(Rn,t)?t:"channel-unavailable";return{key:e,notice:Rn[e]}}function Zo({sessionId:t,deviceId:e,buildId:r,resetMode:o,onRecordingUploaded:i,onSessionEnded:a}){const c=s.useRef(()=>{}),u=s.useRef(!1),d=s.useRef({pending:0,appInstalled:!1});$s();const h=s.useRef(null),p=s.useRef(null),g=s.useRef([]);s.useRef({onFrameBegin:()=>{var w;return(w=h.current)==null?void 0:w.onFrameBegin()},onFrameEnd:w=>{var pe,V;const H=g.current.shift()??null,ce=H?{...w,capturedAt:H.capturedAt,relayedAt:H.relayedAt}:w;(pe=h.current)==null||pe.onFrameEnd(ce),(V=p.current)==null||V.call(p,ce)}});const[x,f]=s.useState(!1),[b,v]=s.useState(!1),[T,j]=s.useState(!1),[L,C]=s.useState(null),[N,E]=s.useState(!1),[M,k]=s.useState(!1),[F,G]=s.useState(null),[z,B]=s.useState(null),[Q,ue]=s.useState(!1),[Ie,Be]=s.useState([]),be=s.useRef(new Set),ye=s.useRef(null),Z=s.useRef(new Set),Ae=s.useRef(new Set),Oe=s.useRef(new Set),[He,Me]=s.useState(!1),Ue=8e3,[U,q]=s.useState(!1),K=s.useRef(null);s.useEffect(()=>()=>{K.current&&clearTimeout(K.current)},[]);const Se=s.useRef(void 0),J=s.useRef(void 0),Re=s.useRef(void 0),de=s.useRef(void 0),ee=s.useCallback(w=>{const H=X();be.current.add(H),ye.current=H,c.current({type:"device:boot",sessionId:t,requestId:H,payload:{deviceId:e,resetMode:w,acceptH264:go(),secureContext:window.isSecureContext}})},[t,e]),{pushFrame:We}=Yo(),rt=s.useCallback(w=>{var H,ce,pe;if(!("sessionId"in w&&w.sessionId!==t)){if(w.type==="session:joined"){d.current={pending:0,appInstalled:!1},f(!0),v(!1),Be(w.capabilities??[]);const V=u.current?"app-only":o;u.current=!0,be.current.clear(),ee(V)}if(w.type==="session:agent-away"){v(!0),C(null),j(!1);return}if(w.type==="session:terminated"){a==null||a(w.reason);return}if(w.type==="session:rebound"){j(!1),C(null),E(!1),G(null),B(null),ue(!1),q(!1),K.current&&clearTimeout(K.current),Me(!1),g.current=[],Be(w.capabilities);const V=b;v(!1),d.current={pending:d.current.pending+1,appInstalled:d.current.pending>0?d.current.appInstalled:M},u.current=!0,ee("app-only"),V||Ne.info("The agent restarted — reconnecting to the device.");return}if(w.type==="device:boot-error"){if(w.requestId!==void 0&&w.requestId!==ye.current||b)return;d.current={pending:0,appInstalled:!1},B(w.message)}if(w.type==="input:error"){if(b)return;const{key:V,notice:me}=Qo(w.reason);w.reason!==void 0&&w.reason!==V&&console.debug(`[tapflow] unrecognised input:error reason "${w.reason}", treated as ${V}`),me?Ne.error(me.title,{id:`input:${t}:${V}`,description:w.message?`${me.action} (${w.message})`:me.action,duration:6e3}):console.debug(`[tapflow] input refused, shown nowhere: ${V}${w.message?` — ${w.message}`:""}`)}if(w.type==="device:booting"&&(j(!1),E(!1),k(!1),G(null),B(null),Ae.current.clear(),Oe.current.clear(),C(null)),w.type==="device:ready"){if(j(!0),w.requestId!==void 0&&!be.current.delete(w.requestId))return;if(d.current.pending>0){const{appInstalled:V}=d.current;if(d.current={pending:d.current.pending-1,appInstalled:V},V){k(!0);return}}if(r){E(!0);const V=X();Ae.current.add(V),c.current({type:"app:install",sessionId:t,requestId:V,buildId:r})}}if(w.type==="app:install-done"||w.type==="app:install-error"){if(!Ae.current.delete(w.requestId))return;E(!1),w.type==="app:install-done"?k(!0):G(w.message)}if(w.type==="app:launch-done"||w.type==="app:launch-error"){if(!Oe.current.delete(w.requestId))return;ue(!1)}if(w.type==="session:chrome"&&C(w.payload),w.type==="keyboard:toggled"){const{visible:V}=w.payload;Me(V),q(!1),K.current&&clearTimeout(K.current)}if(w.type==="network:state"||w.type==="network:error"){(H=Re.current)==null||H.call(Re,w);return}if(w.type==="device:shutdown-done"||w.type==="device:shutdown-error"){(ce=de.current)==null||ce.call(de,w);return}if((w.type==="clipboard:data"||w.type==="clipboard:write-done"||w.type==="clipboard:error")&&((pe=J.current)==null||pe.call(J,w)),w.type==="open-url:done"||w.type==="open-url:error"){if(!Z.current.delete(w.requestId))return;w.type==="open-url:done"?Ne.success("Deeplink opened"):Ne.error(w.message)}if(w.type==="error")switch(w.reason){case"session-not-found":a==null||a("agent-disconnected");return;case"session-busy":a==null||a("busy-elsewhere");return;case"agent-resources-exhausted":a==null||a("mac-overloaded");return}}},[t,r,a,o,M,b,ee]),Ve=s.useCallback(w=>{var V;const H=_o(w);if(H&&H.codec===Wn){We(w.slice(Kt));return}H&&H.codec===It||g.current.push(H);const ce=H?w.slice(Kt):w,pe=H?{codec:H.codec,keyframe:H.keyframe,capturedAt:H.capturedAt,relayedAt:H.relayedAt}:void 0;(V=Se.current)==null||V.call(Se,ce,pe)},[We]),{send:fe,connected:ve}=En(rt,Ve);s.useLayoutEffect(()=>{c.current=fe}),s.useEffect(()=>{ve&&fe({type:"session:start",sessionId:t})},[ve,fe,t]);const ke=L!==null&&"framePng"in L?L:null,Y=L!==null&&!("framePng"in L)?L:null,he=()=>{q(!0),K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{q(!1),Ne.error("The device did not answer. The software keyboard is where it was, as far as tapflow can tell.")},Ue),fe({type:"input:keyboard:toggle",sessionId:t})},$e=s.useCallback(w=>{const H=X();Z.current.add(H),c.current({type:"open-url",sessionId:t,requestId:H,payload:{url:w}})},[t]),ge=s.useCallback(()=>{if(r===void 0)return;const w=X();Oe.current.add(w),ue(!0),c.current({type:"app:launch",sessionId:t,requestId:w,buildId:r})},[t,r]),oe=s.useRef(null),re=s.useRef(!1),ae=s.useRef(!1),{pending:_e,reboot:Pe}=Jo({sessionId:t,deviceId:e,deviceReady:T,send:fe,handlerRef:de,onShutdownComplete:s.useCallback(()=>{ae.current=!0,ee("app-only")},[ee]),onError:s.useCallback(w=>{Ne.error(w)},[])});s.useEffect(()=>{var ce;const w=!!(ke??Y),H=!re.current&&w;re.current=w,!(!H||!ae.current)&&(ae.current=!1,document.activeElement===document.body&&((ce=oe.current)==null||ce.focus()))},[ke,Y]),s.useEffect(()=>{(z||b)&&(ae.current=!1)},[z,b]);const je={sessionId:t,buildId:r,send:fe,openUrl:$e,launchApp:ge,connected:ve,joined:x,deviceReady:T,installing:N,installed:M,installError:F,bootError:z,launching:Q,binaryFrameHandlerRef:Se,clipboardHandlerRef:J,clipboardSupported:Ie.includes("clipboard"),networkHandlerRef:Re,networkSupported:Ie.includes("network-control"),onRecordingUploaded:i,swKeyboardVisible:He,swKeyboardPending:U,onKbdToggle:he,rebootPending:_e,onReboot:Pe,restartButtonRef:oe};if(!ke&&!Y)return n.jsxs("div",{role:"region","aria-label":"Device screen",className:"flex items-start justify-center gap-16",children:[n.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((w,H)=>n.jsx("div",{className:"h-8 w-8 rounded-md bg-muted animate-pulse"},H))}),n.jsxs("div",{className:"flex items-start gap-8",children:[n.jsx("div",{"aria-hidden":"true",style:{background:"#1c1c1e",borderRadius:"34px",padding:"12px",flexShrink:0},children:n.jsx("div",{className:"animate-pulse bg-zinc-700",style:{width:324,height:720,borderRadius:"22px"}})}),n.jsx(Qt,{joined:x,fps:0,connected:ve,deviceReady:T,bootError:z,installing:N,installError:F,decoderUnsupported:!1,keyboardActive:!1,agentAway:b})]})]});const we=void 0;return n.jsxs(n.Fragment,{children:[ke&&n.jsx(zo,{...je,chrome:ke,perfHookRef:we}),Y&&n.jsx(Vo,{...je,androidButtons:Y.buttons,screenWidth:Y.screenWidth,screenHeight:Y.screenHeight,cornerRadius:Y.cornerRadius,perfHookRef:we}),!1]})}const Xn=s.forwardRef(({className:t,...e},r)=>n.jsx("textarea",{className:te("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",t),ref:r,...e}));Xn.displayName="Textarea";var ea=Object.defineProperty,O=(t,e)=>ea(t,"name",{value:e,configurable:!0});function Kn(t,e){return s.useReducer((r,o)=>e[r][o]??r,t)}O(Kn,"useStateMachine");var Yn="ScrollArea",[Gn,Ka]=Cn(Yn),[ta,Le]=Gn(Yn),na=s.forwardRef(O(function(e,r){const{__scopeScrollArea:o,type:i="hover",dir:a,scrollHideDelay:c=600,...u}=e,[d,h]=s.useState(null),[p,g]=s.useState(null),[x,f]=s.useState(null),[b,v]=s.useState(null),[T,j]=s.useState(null),[L,C]=s.useState(0),[N,E]=s.useState(0),[M,k]=s.useState(!1),[F,G]=s.useState(!1),z=tt(r,h),B=gr(a);return n.jsx(ta,{scope:o,type:i,dir:B,scrollHideDelay:c,scrollArea:d,viewport:p,onViewportChange:g,content:x,onContentChange:f,scrollbarX:b,onScrollbarXChange:v,scrollbarXEnabled:M,onScrollbarXEnabledChange:k,scrollbarY:T,onScrollbarYChange:j,scrollbarYEnabled:F,onScrollbarYEnabledChange:G,onCornerWidthChange:C,onCornerHeightChange:E,children:n.jsx(nt.div,{dir:B,...u,ref:z,style:{position:"relative","--radix-scroll-area-corner-width":L+"px","--radix-scroll-area-corner-height":N+"px",...e.style}})})},"ScrollArea")),ra="ScrollAreaViewport",sa=s.forwardRef(O(function(e,r){const{__scopeScrollArea:o,children:i,nonce:a,...c}=e,u=Le(ra,o),d=s.useRef(null),h=tt(r,d,u.onViewportChange);return n.jsxs(n.Fragment,{children:[n.jsx(oa,{nonce:a}),n.jsx(nt.div,{"data-radix-scroll-area-viewport":"",...c,ref:h,style:{overflowX:u.scrollbarXEnabled?"scroll":"hidden",overflowY:u.scrollbarYEnabled?"scroll":"hidden",...e.style},children:n.jsx("div",{ref:u.onContentChange,style:{minWidth:"100%",display:"table"},children:i})})]})},"ScrollAreaViewport")),oa=s.memo(O(function({nonce:e}){return n.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"),(t,e)=>t.nonce===e.nonce),Ye="ScrollAreaScrollbar",Jn=s.forwardRef(O(function(e,r){const{forceMount:o,...i}=e,a=Le(Ye,e.__scopeScrollArea),{onScrollbarXEnabledChange:c,onScrollbarYEnabledChange:u}=a,d=e.orientation==="horizontal";return s.useEffect(()=>(d?c(!0):u(!0),()=>{d?c(!1):u(!1)}),[d,c,u]),a.type==="hover"?n.jsx(aa,{...i,ref:r,forceMount:o}):a.type==="scroll"?n.jsx(ia,{...i,ref:r,forceMount:o}):a.type==="auto"?n.jsx(Qn,{...i,ref:r,forceMount:o}):a.type==="always"?n.jsx(en,{...i,ref:r,"data-state":"visible"}):null},"ScrollAreaScrollbar")),aa=s.forwardRef(O(function(e,r){const{forceMount:o,...i}=e,a=Le(Ye,e.__scopeScrollArea),[c,u]=s.useState(!1);return s.useEffect(()=>{const d=a.scrollArea;let h=0;if(d){const p=O(()=>{window.clearTimeout(h),u(!0)},"handlePointerEnter"),g=O(()=>{h=window.setTimeout(()=>u(!1),a.scrollHideDelay)},"handlePointerLeave");return d.addEventListener("pointerenter",p),d.addEventListener("pointerleave",g),()=>{window.clearTimeout(h),d.removeEventListener("pointerenter",p),d.removeEventListener("pointerleave",g)}}},[a.scrollArea,a.scrollHideDelay]),n.jsx(Mt,{present:o||c,children:n.jsx(Qn,{"data-state":c?"visible":"hidden",...i,ref:r})})},"ScrollAreaScrollbarHover")),ia=s.forwardRef(O(function(e,r){const{forceMount:o,...i}=e,a=Le(Ye,e.__scopeScrollArea),c=e.orientation==="horizontal",u=Et(()=>h("SCROLL_END"),100),[d,h]=Kn("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 s.useEffect(()=>{if(d==="idle"){const p=window.setTimeout(()=>h("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(p)}},[d,a.scrollHideDelay,h]),s.useEffect(()=>{const p=a.viewport,g=c?"scrollLeft":"scrollTop";if(p){let x=p[g];const f=O(()=>{const b=p[g];x!==b&&(h("SCROLL"),u()),x=b},"handleScroll");return p.addEventListener("scroll",f),()=>p.removeEventListener("scroll",f)}},[a.viewport,c,h,u]),n.jsx(Mt,{present:o||d!=="hidden",children:n.jsx(en,{"data-state":d==="hidden"?"hidden":"visible",...i,ref:r,onPointerEnter:Ke(e.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:Ke(e.onPointerLeave,()=>h("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),Qn=s.forwardRef(O(function(e,r){const o=Le(Ye,e.__scopeScrollArea),{forceMount:i,...a}=e,[c,u]=s.useState(!1),d=e.orientation==="horizontal",h=Et(()=>{if(o.viewport){const p=o.viewport.offsetWidth<o.viewport.scrollWidth,g=o.viewport.offsetHeight<o.viewport.scrollHeight;u(d?p:g)}},10);return pt(o.viewport,h),pt(o.content,h),n.jsx(Mt,{present:i||c,children:n.jsx(en,{"data-state":c?"visible":"hidden",...a,ref:r})})},"ScrollAreaScrollbarAuto")),en=s.forwardRef(O(function(e,r){const{orientation:o="vertical",...i}=e,a=Le(Ye,e.__scopeScrollArea),c=s.useRef(null),u=s.useRef(0),[d,h]=s.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=tn(d.viewport,d.content),g={...i,sizes:d,onSizesChange:h,hasThumb:p>0&&p<1,onThumbChange:O(f=>c.current=f,"onThumbChange"),onThumbPointerUp:O(()=>u.current=0,"onThumbPointerUp"),onThumbPointerDown:O(f=>u.current=f,"onThumbPointerDown")};function x(f,b){return nr(f,u.current,d,b)}return O(x,"getScrollPosition"),o==="horizontal"?n.jsx(ca,{...g,ref:r,onThumbPositionChange:()=>{if(a.viewport&&c.current){const f=a.viewport.scrollLeft,b=Gt(f,d,a.dir);c.current.style.transform=`translate3d(${b}px, 0, 0)`}},onWheelScroll:f=>{a.viewport&&(a.viewport.scrollLeft=f)},onDragScroll:f=>{a.viewport&&(a.viewport.scrollLeft=x(f,a.dir))}}):o==="vertical"?n.jsx(la,{...g,ref:r,onThumbPositionChange:()=>{if(a.viewport&&c.current){const f=a.viewport.scrollTop,b=Gt(f,d);c.current.style.transform=`translate3d(0, ${b}px, 0)`}},onWheelScroll:f=>{a.viewport&&(a.viewport.scrollTop=f)},onDragScroll:f=>{a.viewport&&(a.viewport.scrollTop=x(f))}}):null},"ScrollAreaScrollbarVisible")),ca=s.forwardRef(O(function(e,r){const{sizes:o,onSizesChange:i,...a}=e,c=Le(Ye,e.__scopeScrollArea),[u,d]=s.useState(),h=s.useRef(null),p=tt(r,h,c.onScrollbarXChange);return s.useEffect(()=>{h.current&&d(getComputedStyle(h.current))},[h]),n.jsx(er,{"data-orientation":"horizontal",...a,ref:p,sizes:o,style:{bottom:0,left:c.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:c.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Tt(o)+"px",...e.style},onThumbPointerDown:g=>e.onThumbPointerDown(g.x),onDragScroll:g=>e.onDragScroll(g.x),onWheelScroll:(g,x)=>{if(c.viewport){const f=c.viewport.scrollLeft+g.deltaX;e.onWheelScroll(f),rn(f,x)&&g.preventDefault()}},onResize:()=>{h.current&&c.viewport&&u&&i({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:Ct(u.paddingLeft),paddingEnd:Ct(u.paddingRight)}})}})},"ScrollAreaScrollbarX")),la=s.forwardRef(O(function(e,r){const{sizes:o,onSizesChange:i,...a}=e,c=Le(Ye,e.__scopeScrollArea),[u,d]=s.useState(),h=s.useRef(null),p=tt(r,h,c.onScrollbarYChange);return s.useEffect(()=>{h.current&&d(getComputedStyle(h.current))},[h]),n.jsx(er,{"data-orientation":"vertical",...a,ref:p,sizes:o,style:{top:0,right:c.dir==="ltr"?0:void 0,left:c.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Tt(o)+"px",...e.style},onThumbPointerDown:g=>e.onThumbPointerDown(g.y),onDragScroll:g=>e.onDragScroll(g.y),onWheelScroll:(g,x)=>{if(c.viewport){const f=c.viewport.scrollTop+g.deltaY;e.onWheelScroll(f),rn(f,x)&&g.preventDefault()}},onResize:()=>{h.current&&c.viewport&&u&&i({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:Ct(u.paddingTop),paddingEnd:Ct(u.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[ua,Zn]=Gn(Ye),er=s.forwardRef(O(function(e,r){const{__scopeScrollArea:o,sizes:i,hasThumb:a,onThumbChange:c,onThumbPointerUp:u,onThumbPointerDown:d,onThumbPositionChange:h,onDragScroll:p,onWheelScroll:g,onResize:x,...f}=e,b=Le(Ye,o),[v,T]=s.useState(null),j=tt(r,T),L=s.useRef(null),C=s.useRef(""),N=b.viewport,E=i.content-i.viewport,M=ht(g),k=ht(h),F=Et(x,10);function G(z){if(L.current){const B=z.clientX-L.current.left,Q=z.clientY-L.current.top;p({x:B,y:Q})}}return O(G,"handleDragScroll"),s.useEffect(()=>{const z=O(B=>{const Q=B.target;(v==null?void 0:v.contains(Q))&&M(B,E)},"handleWheel");return document.addEventListener("wheel",z,{passive:!1}),()=>document.removeEventListener("wheel",z,{passive:!1})},[N,v,E,M]),s.useEffect(k,[i,k]),pt(v,F),pt(b.content,F),n.jsx(ua,{scope:o,scrollbar:v,hasThumb:a,onThumbChange:ht(c),onThumbPointerUp:ht(u),onThumbPositionChange:k,onThumbPointerDown:ht(d),children:n.jsx(nt.div,{...f,ref:j,style:{position:"absolute",...f.style},onPointerDown:Ke(e.onPointerDown,z=>{z.button===0&&(z.target.setPointerCapture(z.pointerId),L.current=v.getBoundingClientRect(),C.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",b.viewport&&(b.viewport.style.scrollBehavior="auto"),G(z))}),onPointerMove:Ke(e.onPointerMove,G),onPointerUp:Ke(e.onPointerUp,z=>{const B=z.target;B.hasPointerCapture(z.pointerId)&&B.releasePointerCapture(z.pointerId),document.body.style.webkitUserSelect=C.current,b.viewport&&(b.viewport.style.scrollBehavior=""),L.current=null})})})},"ScrollAreaScrollbarImpl")),Yt="ScrollAreaThumb",da=s.forwardRef(O(function(e,r){const{forceMount:o,...i}=e,a=Zn(Yt,e.__scopeScrollArea);return n.jsx(Mt,{present:o||a.hasThumb,children:n.jsx(fa,{ref:r,...i})})},"ScrollAreaThumb")),fa=s.forwardRef(O(function(e,r){const{__scopeScrollArea:o,style:i,...a}=e,c=Le(Yt,o),u=Zn(Yt,o),{onThumbPositionChange:d}=u,h=tt(r,u.onThumbChange),p=s.useRef(void 0),g=Et(()=>{p.current&&(p.current(),p.current=void 0)},100);return s.useEffect(()=>{const x=c.viewport;if(x){const f=O(()=>{if(g(),!p.current){const b=ma(x,d);p.current=b,d()}},"handleScroll");return d(),x.addEventListener("scroll",f),()=>x.removeEventListener("scroll",f)}},[c.viewport,g,d]),n.jsx(nt.div,{"data-state":u.hasThumb?"visible":"hidden",...a,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...i},onPointerDownCapture:Ke(e.onPointerDownCapture,x=>{const b=x.target.getBoundingClientRect(),v=x.clientX-b.left,T=x.clientY-b.top;u.onThumbPointerDown({x:v,y:T})}),onPointerUp:Ke(e.onPointerUp,u.onThumbPointerUp)})},"ScrollAreaThumbImpl")),tr="ScrollAreaCorner",ha=s.forwardRef(O(function(e,r){const o=Le(tr,e.__scopeScrollArea),i=!!(o.scrollbarX&&o.scrollbarY);return o.type!=="scroll"&&i?n.jsx(pa,{...e,ref:r}):null},"ScrollAreaCorner")),pa=s.forwardRef(O(function(e,r){const{__scopeScrollArea:o,...i}=e,a=Le(tr,o),[c,u]=s.useState(0),[d,h]=s.useState(0),p=!!(c&&d),{onCornerWidthChange:g,onCornerHeightChange:x}=a;return pt(a.scrollbarX,()=>{var b;const f=((b=a.scrollbarX)==null?void 0:b.offsetHeight)||0;a.onCornerHeightChange(f),h(f)}),pt(a.scrollbarY,()=>{var b;const f=((b=a.scrollbarY)==null?void 0:b.offsetWidth)||0;a.onCornerWidthChange(f),u(f)}),s.useEffect(()=>()=>{g(0),x(0)},[g,x]),p?n.jsx(nt.div,{...i,ref:r,style:{width:c,height:d,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null},"ScrollAreaCornerImpl"));function Ct(t){return t?parseInt(t,10):0}O(Ct,"toInt");function tn(t,e){const r=t/e;return isNaN(r)?0:r}O(tn,"getThumbRatio");function Tt(t){const e=tn(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=(t.scrollbar.size-r)*e;return Math.max(o,18)}O(Tt,"getThumbSize");function nr(t,e,r,o="ltr"){const i=Tt(r),a=i/2,c=e||a,u=i-c,d=r.scrollbar.paddingStart+c,h=r.scrollbar.size-r.scrollbar.paddingEnd-u,p=r.content-r.viewport,g=o==="ltr"?[0,p]:[p*-1,0];return nn([d,h],g)(t)}O(nr,"getScrollPositionFromPointer");function Gt(t,e,r="ltr"){const o=Tt(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,a=e.scrollbar.size-i,c=e.content-e.viewport,u=a-o,d=r==="ltr"?[0,c]:[c*-1,0],h=Wr(t,d);return nn([0,c],[0,u])(h)}O(Gt,"getThumbOffsetFromScroll");function nn(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const o=(e[1]-e[0])/(t[1]-t[0]);return e[0]+o*(r-t[0])}}O(nn,"linearScale");function rn(t,e){return t>0&&t<e}O(rn,"isScrollingWithinScrollbarBounds");var ma=O((t,e=()=>{})=>{let r={left:t.scrollLeft,top:t.scrollTop},o=0;return O((function i(){const a={left:t.scrollLeft,top:t.scrollTop},c=r.left!==a.left,u=r.top!==a.top;(c||u)&&e(),r=a,o=window.requestAnimationFrame(i)}),"loop")(),()=>window.cancelAnimationFrame(o)},"addUnlinkedScrollListener");function Et(t,e){const r=ht(t),o=s.useRef(0);return s.useEffect(()=>()=>window.clearTimeout(o.current),[]),s.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(r,e)},[r,e])}O(Et,"useDebounceCallback");function pt(t,e){const r=ht(e);mr(()=>{let o=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(r)});return i.observe(t),()=>{window.cancelAnimationFrame(o),i.unobserve(t)}}},[t,r])}O(pt,"useResizeObserver");var rr=na,ga=sa,xa=ha;const sr=s.forwardRef(({className:t,children:e,...r},o)=>n.jsxs(rr,{ref:o,className:te("relative overflow-hidden",t),...r,children:[n.jsx(ga,{className:"h-full w-full rounded-[inherit]",children:e}),n.jsx(or,{}),n.jsx(xa,{})]}));sr.displayName=rr.displayName;const or=s.forwardRef(({className:t,orientation:e="vertical",...r},o)=>n.jsx(Jn,{ref:o,orientation:e,className:te("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...r,children:n.jsx(da,{className:"relative flex-1 rounded-full bg-border"})}));or.displayName=Jn.displayName;function ar(t){return/[Zz]|[+-]\d{2}/.test(t)?new Date(t):new Date(t.replace(" ","T")+"Z")}function ba(t){const e=new Map;for(const i of t){const a=ar(i.created_at).toDateString();e.has(a)||e.set(a,[]),e.get(a).push(i)}const r=new Date().toDateString(),o=new Date(Date.now()-864e5).toDateString();return Array.from(e.entries()).map(([i,a])=>{let c;if(i===r)c="Today";else if(i===o)c="Yesterday";else{const u=new Date(i);c=u.toLocaleDateString(void 0,{month:"short",day:"numeric",...u.getFullYear()!==new Date().getFullYear()?{year:"numeric"}:{}})}return{label:c,items:a}})}function ya(t){return ar(t).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}const va=5*1024*1024,wa=["image/png","image/jpeg","image/webp"];function Sa({buildId:t}){const e=s.useId(),[r,o]=s.useState([]),[i,a]=s.useState(""),[c,u]=s.useState(null),[d,h]=s.useState(!1),[p,g]=s.useState(""),x=s.useRef(null),f=s.useRef({}),b=s.useCallback(()=>{fetch(`/api/v1/comments?build_id=${t}`,{credentials:"include"}).then(C=>C.ok?C.json():[]).then(o)},[t]);s.useEffect(()=>{b()},[b]),s.useEffect(()=>{const C=window.location.hash;if(!C.startsWith("#comment-"))return;const N=Number(C.replace("#comment-","")),E=f.current[N];if(!E)return;E.scrollIntoView({behavior:"smooth"});const M=document.documentElement.classList.contains("dark");E.style.backgroundColor=M?"rgb(0 112 243 / 0.18)":"#d3e5ff",setTimeout(()=>{E.style.backgroundColor=""},2e3)},[r]),s.useEffect(()=>{hn()},[]);async function v(C){const{linkBase:N}=await hn(),E=Yr(N,`${location.pathname}${location.search}#comment-${C}`);try{if(!navigator.clipboard)throw new Error("no clipboard");await navigator.clipboard.writeText(E),Ne.success("Link copied")}catch{Ne.error("Could not copy link")}}function T(C){if(g(""),!wa.includes(C.type)){g("Only png, jpg, webp allowed");return}if(C.size>va){g("Max 5MB");return}u(C)}async function j(C){if(C.preventDefault(),!i.trim()&&!c)return;h(!0);const N=new FormData;N.append("build_id",String(t)),N.append("body",i),c&&N.append("attachment",c),(await fetch("/api/v1/comments",{method:"POST",credentials:"include",body:N})).ok&&(a(""),u(null),b()),h(!1)}const L=ba(r);return n.jsxs("div",{className:"flex h-full flex-col gap-3 px-1",children:[n.jsx(sr,{className:"flex-1 rounded-md border",children:n.jsx("div",{className:"p-3",children:r.length===0?n.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No comments yet."}):n.jsx("div",{className:"flex flex-col",children:L.map(({label:C,items:N})=>n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 py-3",children:[n.jsx("div",{className:"h-px flex-1 bg-border"}),n.jsx("span",{className:"text-[11px] font-medium text-muted-foreground px-1 select-none",children:C}),n.jsx("div",{className:"h-px flex-1 bg-border"})]}),n.jsx("div",{className:"flex flex-col gap-4",children:N.map(E=>n.jsxs("div",{id:`comment-${E.id}`,ref:M=>{f.current[E.id]=M},className:"group flex gap-2.5 rounded-md px-2 py-1.5 transition-all",children:[n.jsx("div",{className:"mt-0.5 shrink-0",children:n.jsx(xr,{name:E.author,avatarUrl:E.authorAvatarUrl,size:28})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"text-sm font-semibold leading-none",children:E.author}),n.jsx("span",{className:"text-[11px] text-muted-foreground leading-none",children:ya(E.created_at)}),n.jsx(ie,{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 v(E.id),children:n.jsx(Ln,{className:"h-3 w-3","aria-hidden":"true"})})]}),n.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap mt-1",children:E.body}),E.attachments.map(M=>{const k=decodeURIComponent(M.file_path.split("/").pop()??"image");return n.jsx("a",{href:M.file_path,target:"_blank",rel:"noreferrer",className:"mt-1.5 block","aria-label":`Open ${k} in a new tab`,children:n.jsx("img",{src:M.file_path,alt:k,className:"max-h-48 rounded border object-contain"})},M.id)})]})]},E.id))})]},C))})})}),n.jsx("div",{className:"pb-1",children:n.jsx("form",{onSubmit:j,children:n.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:[n.jsx(Xn,{"aria-label":"Comment",placeholder:"Leave a comment…",value:i,onChange:C=>a(C.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"}),(c||p)&&n.jsxs("div",{className:"px-3 -mt-1 pb-1",children:[c&&n.jsx("p",{className:"text-xs text-muted-foreground",children:c.name}),p&&n.jsx("p",{id:e,role:"alert",className:"text-xs text-destructive",children:p})]}),n.jsxs("div",{className:"flex items-center gap-2 px-2 py-2",children:[n.jsx(ie,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground","aria-label":"Attach image","aria-describedby":p?e:void 0,onClick:()=>{var C;return(C=x.current)==null?void 0:C.click()},children:n.jsx(ls,{className:"h-4 w-4","aria-hidden":"true"})}),n.jsx("input",{ref:x,type:"file",accept:"image/png,image/jpeg,image/webp",className:"hidden",onChange:C=>{var E;const N=(E=C.target.files)==null?void 0:E[0];N&&T(N)}}),n.jsx("div",{className:"flex-1"}),n.jsx(ie,{type:"submit",size:"icon",className:"h-7 w-7 rounded-full","aria-label":"Post comment",disabled:d||!i.trim()&&!c,children:n.jsx(es,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})]})})})]})}function Ra(t){return t<1024*1024?`${(t/1024).toFixed(0)} KB`:`${(t/1024/1024).toFixed(1)} MB`}function ka(t){return new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function ja(t){const e=new Date(t).getTime()-Date.now();if(e<=0)return{label:"Expired",urgent:!0};const r=Math.floor(e/36e5);return r<1?{label:"< 1 hour left",urgent:!0}:r<24?{label:`Expires in ${r}h`,urgent:r<6}:{label:`Expires in ${Math.floor(r/24)}d`,urgent:!1}}function Ca({buildId:t,refreshKey:e}){const[r,o]=s.useState([]),[i,a]=s.useState(!0),[c,u]=s.useState(!1);return s.useEffect(()=>{a(!0),u(!1);const d=setTimeout(()=>u(!0),250);return fetch(`/api/v1/recordings?buildId=${t}`,{credentials:"include"}).then(h=>h.ok?h.json():[]).then(h=>o(h)).catch(()=>o([])).finally(()=>{clearTimeout(d),a(!1)}),()=>clearTimeout(d)},[t,e]),i?c?n.jsx("p",{className:"text-xs text-muted-foreground",children:"Loading recordings…"}):null:r.length===0?n.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No recordings yet."}):n.jsx("div",{className:"flex flex-col gap-2",children:r.map(d=>{const h=ja(d.expiresAt);return n.jsxs("div",{className:"flex items-center justify-between rounded-md border border-border px-3 py-2 text-sm",children:[n.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[n.jsx("span",{className:"text-xs font-medium truncate",children:ka(d.createdAt)}),n.jsxs("span",{className:`text-xs ${h.urgent?"text-destructive":"text-muted-foreground"}`,children:[h.label," · ",Ra(d.fileSize)]})]}),n.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 ml-2",title:"Download",onClick:()=>{const p=document.createElement("a");p.href=d.url,p.download="",p.click()},children:n.jsx(ss,{className:"h-3.5 w-3.5"})})]},d.id)})})}function Ta({buildId:t,recordingsRefreshKey:e=0}){return n.jsxs(Er,{defaultValue:"comments",className:"flex h-full flex-col",children:[n.jsx("div",{className:"shrink-0 px-1",children:n.jsxs(Nr,{className:"w-full",children:[n.jsxs(un,{value:"comments",className:"flex-1 gap-1.5",children:[n.jsx(ms,{className:"h-3.5 w-3.5"}),"Comments"]}),n.jsxs(un,{value:"recordings",className:"flex-1 gap-1.5",children:[n.jsx(as,{className:"h-3.5 w-3.5"}),"Recordings"]})]})}),n.jsx(dn,{value:"comments",className:"mt-3 min-h-0 flex-1 overflow-hidden",children:n.jsx(Sa,{buildId:t})}),n.jsx(dn,{value:"recordings",className:"mt-3 min-h-0 flex-1 overflow-y-auto",children:n.jsx(Ca,{buildId:t,refreshKey:e})})]})}const ir=s.forwardRef(({...t},e)=>n.jsx("nav",{ref:e,"aria-label":"breadcrumb",...t}));ir.displayName="Breadcrumb";const cr=s.forwardRef(({className:t,...e},r)=>n.jsx("ol",{ref:r,className:te("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",t),...e}));cr.displayName="BreadcrumbList";const jt=s.forwardRef(({className:t,...e},r)=>n.jsx("li",{ref:r,className:te("inline-flex items-center gap-1.5",t),...e}));jt.displayName="BreadcrumbItem";const Pt=s.forwardRef(({asChild:t,className:e,...r},o)=>{const i=t?br:"a";return n.jsx(i,{ref:o,className:te("transition-colors hover:text-foreground cursor-pointer",e),...r})});Pt.displayName="BreadcrumbLink";const Dt=s.forwardRef(({className:t,...e},r)=>n.jsx("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:te("font-medium text-foreground",t),...e}));Dt.displayName="BreadcrumbPage";const Lt=({children:t,className:e,...r})=>n.jsx("li",{role:"presentation","aria-hidden":"true",className:te("[&>svg]:h-3.5 [&>svg]:w-3.5",e),...r,children:t??n.jsx(yr,{})});Lt.displayName="BreadcrumbSeparator";var Ea=Object.defineProperty,et=(t,e)=>Ea(t,"name",{value:e,configurable:!0}),sn="Switch",[Na,Ya]=Cn(sn),[Aa,on]=Na(sn);function lr(t){const{__scopeSwitch:e,checked:r,children:o,defaultChecked:i,disabled:a,form:c,name:u,onCheckedChange:d,required:h,value:p="on",internal_do_not_use_render:g}=t,[x,f]=wr({prop:r,defaultProp:i??!1,onChange:d,caller:sn}),[b,v]=s.useState(null),[T,j]=s.useState(null),L=s.useRef(!1),[C,N]=s.useReducer(k=>k+1,0),E=b?!!c||!!b.closest("form"):!0,M={checked:x,setChecked:f,disabled:a,control:b,setControl:v,name:u,form:c,value:p,hasConsumerStoppedPropagationRef:L,userInteractionCount:C,onUserInteraction:N,required:h,defaultChecked:i,isFormControl:E,bubbleInput:T,setBubbleInput:j};return n.jsx(Aa,{scope:e,...M,children:dr(g)?g(M):o})}et(lr,"SwitchProvider");var _a="SwitchTrigger",Pa=s.forwardRef(et(function({__scopeSwitch:e,onClick:r,...o},i){const{control:a,form:c,value:u,disabled:d,checked:h,required:p,setControl:g,setChecked:x,hasConsumerStoppedPropagationRef:f,onUserInteraction:b,isFormControl:v,bubbleInput:T}=on(_a,e),j=tt(i,g),L=s.useRef(h);return s.useEffect(()=>{const C=c?a==null?void 0:a.ownerDocument.getElementById(c):a==null?void 0:a.form;if(C instanceof HTMLFormElement){const N=et(()=>x(L.current),"reset");return C.addEventListener("reset",N),()=>C.removeEventListener("reset",N)}},[a,c,x]),n.jsx(nt.button,{type:"button",role:"switch","aria-checked":h,"aria-required":p,"data-state":an(h),"data-disabled":d?"":void 0,disabled:d,value:u,...o,ref:j,onClick:Ke(r,C=>{b(),x(N=>!N),T&&v&&(f.current=C.isPropagationStopped(),f.current||C.stopPropagation())})})},"SwitchTrigger")),ur=s.forwardRef(et(function(e,r){const{__scopeSwitch:o,name:i,checked:a,defaultChecked:c,required:u,disabled:d,value:h,onCheckedChange:p,form:g,...x}=e;return n.jsx(lr,{__scopeSwitch:o,checked:a,defaultChecked:c,disabled:d,required:u,onCheckedChange:p,name:i,form:g,value:h,internal_do_not_use_render:({isFormControl:f})=>n.jsxs(n.Fragment,{children:[n.jsx(Pa,{...x,ref:r,__scopeSwitch:o}),f&&n.jsx(Ma,{__scopeSwitch:o})]})})},"Switch")),Da="SwitchThumb",La=s.forwardRef(et(function(e,r){const{__scopeSwitch:o,...i}=e,a=on(Da,o);return n.jsx(nt.span,{"data-state":an(a.checked),"data-disabled":a.disabled?"":void 0,...i,ref:r})},"SwitchThumb")),Ia="SwitchBubbleInput",Ma=s.forwardRef(et(function({__scopeSwitch:e,onClick:r,...o},i){const{control:a,hasConsumerStoppedPropagationRef:c,userInteractionCount:u,checked:d,defaultChecked:h,required:p,disabled:g,name:x,value:f,form:b,bubbleInput:v,setBubbleInput:T}=on(Ia,e),j=tt(i,T),L=vr(a),C=s.useRef(!1),N=s.useRef(d),E=s.useRef(u);s.useEffect(()=>{const k=v;if(!k)return;const F=window.HTMLInputElement.prototype,z=Object.getOwnPropertyDescriptor(F,"checked").set,B=u!==E.current;E.current=u;const Q=N.current!==d;N.current=d;const ue=!(B&&c.current);if(Q&&z){C.current=!B;const Ie=new Event("click",{bubbles:ue});z.call(k,d),k.dispatchEvent(Ie),C.current=!1}},[v,d,c,u]);const M=s.useRef(d);return n.jsx(nt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:h??M.current,required:p,disabled:g,name:x,value:f,form:b,...o,tabIndex:-1,ref:j,onClick:Ke(r,k=>{C.current&&k.stopPropagation()}),style:{...o.style,...L,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function dr(t){return typeof t=="function"}et(dr,"isFunction");function an(t){return t?"checked":"unchecked"}et(an,"getState");const fr=s.forwardRef(({className:t,...e},r)=>n.jsx(ur,{className:te("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",t),...e,ref:r,children:n.jsx(La,{className:te("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")})}));fr.displayName=ur.displayName;const Ua={"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 Ga(){const[t]=Nn(),e=Pr(),r=t.get("id"),{build:o}=Is(r),[i,a]=s.useState(0),c=(o==null?void 0:o.platform)??"ios",{sessions:u,selectedAgent:d,setSelectedAgent:h,activeSessionId:p,deviceId:g,booting:x,status:f,connected:b,agentGroups:v,startDevice:T,resetDevice:j,handleBack:L,handleBackToMacs:C,handleSessionEnded:N}=Ms(c),E=v.find(U=>U.agentName===d),{osVersions:M,osVersion:k,setOsVersion:F,deviceSearch:G,setDeviceSearch:z,versionedDevices:B,resetMode:Q,setResetMode:ue,appliedResetMode:Ie,consumeResetMode:Be,fullResetSupported:be}=Us(E,c),Z=u.flatMap(U=>U.devices).find(U=>U.id===g),Ae=Z?`${Z.name}${Z.osVersion?` · ${Z.osVersion}`:""}`:"",Oe=s.useCallback(()=>a(U=>U+1),[]),He=s.useCallback(U=>{Be(),T(U)},[Be,T]),Me=s.useCallback(U=>{const q=Ua[U];Ne.error(q.title,{description:q.description}),N()},[N]),{setNode:Ue}=Sr();return s.useEffect(()=>{if(o)return Ue(n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(ir,{children:n.jsxs(cr,{children:[n.jsx(jt,{children:n.jsx(Pt,{asChild:!0,children:n.jsx("button",{onClick:()=>e(`/app-center?appId=${o.app_id}`),children:o.name})})}),n.jsx(Lt,{}),n.jsx(jt,{children:d?n.jsx(Pt,{asChild:!0,children:n.jsx("button",{onClick:C,children:ln(o)})}):n.jsx(Dt,{children:ln(o)})}),d&&n.jsxs(n.Fragment,{children:[n.jsx(Lt,{}),n.jsx(jt,{children:p?n.jsx(Pt,{asChild:!0,children:n.jsx("button",{onClick:L,children:d})}):n.jsx(Dt,{children:d})})]}),p&&n.jsxs(n.Fragment,{children:[n.jsx(Lt,{}),n.jsx(jt,{children:n.jsx(Dt,{children:Ae})})]})]})}),!d&&o.status_label&&n.jsx(Gr,{tone:Cr[o.status_label],children:o.status_label})]})),()=>Ue(null)},[o,d,p,Ae,e,L,C,Ue]),n.jsxs("div",{className:"flex h-full min-h-0 gap-6 p-6",children:[n.jsx("div",{className:"flex flex-col gap-3 flex-1 min-w-0 min-h-0",children:n.jsx("div",{className:"flex-1 min-h-0 overflow-auto -ml-1 pl-1 -mr-4 pr-4",children:p?n.jsx("div",{className:"min-h-full flex items-center justify-center py-6 px-8 min-w-max",children:n.jsx(Zo,{sessionId:p,deviceId:g,buildId:o==null?void 0:o.id,resetMode:Ie,onRecordingUploaded:Oe,onSessionEnded:Me})}):d?n.jsxs("div",{className:"flex flex-col gap-5",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:C,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"← All Macs"}),n.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Select device"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Tr,{placeholder:"Search device…",value:G,onChange:z}),M.length>0&&n.jsxs(Vr,{value:k||"__all__",onValueChange:U=>{F(U==="__all__"?"":U),j()},children:[n.jsx(qr,{className:"h-8 w-36 shrink-0",children:n.jsx(Xr,{})}),n.jsxs(Kr,{children:[n.jsx(fn,{value:"__all__",children:"Any version"}),M.map(U=>n.jsx(fn,{value:U,children:U},U))]})]}),be&&n.jsx(Vt,{children:n.jsxs(Ce,{children:[n.jsx(Te,{asChild:!0,children:n.jsxs("div",{className:"ml-auto flex items-center gap-2 shrink-0",children:[n.jsx(Rr,{htmlFor:"reset-mode",className:"text-sm cursor-pointer whitespace-nowrap",children:"Full reset"}),n.jsx("span",{id:"reset-mode-desc",className:"sr-only",children:"When on, erases all data on the next device you pick"}),n.jsx(fr,{id:"reset-mode","aria-describedby":"reset-mode-desc",checked:Q==="full-erase",onCheckedChange:U=>ue(U?"full-erase":"app-only")})]})}),n.jsx(Ee,{children:Q==="full-erase"?"Erase all data on the next device you pick":"Keep existing data"})]})})]}),B.length===0?n.jsx("p",{className:"text-sm text-muted-foreground",children:b?"No devices available for this OS.":"Connecting to relay…"}):n.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 2xl:grid-cols-3 gap-2",children:B.map(U=>{const q=U.status==="booted",K=U.busy,Se=K?"In use":q?"Booted":"Available",J=K?"bg-amber-400":q?"bg-emerald-400":"bg-muted-foreground/40";return n.jsxs("button",{disabled:K||x||!b,onClick:()=>He(U),className:te("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:[n.jsx("span",{className:"text-sm font-medium leading-tight",children:U.name}),U.osVersion&&n.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:U.osVersion}),n.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[n.jsx("span",{className:te("inline-block h-1.5 w-1.5 rounded-full",J)}),Se]})]},U.id)})}),f&&n.jsx("p",{className:"text-sm text-muted-foreground",children:f})]}):n.jsxs("div",{className:"flex flex-col gap-5",children:[n.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Select Mac"}),v.length===0?n.jsx("p",{className:"text-sm text-muted-foreground",children:b?`No agents available for ${c}.`:"Connecting to relay…"}):n.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 2xl:grid-cols-3 gap-2",children:v.map(U=>{const q=U.resources,K=q?Date.now()-q.reportedAt>Ar:!1,Se=U.devices.filter(We=>We.platform===c).length,J=(q==null?void 0:q.cpuPercent)??0,Re=q?q.memUsedMB/q.memTotalMB*100:0,de=_r(q,K),ee=de==="overloaded";return n.jsx(Vt,{children:n.jsxs(Ce,{children:[n.jsx(Te,{asChild:!0,children:n.jsx("span",{tabIndex:ee?0:void 0,className:ee?"cursor-not-allowed":void 0,children:n.jsxs("button",{disabled:ee,"aria-disabled":ee,onClick:()=>h(U.agentName??null),className:te("flex flex-col gap-3 rounded-lg border p-3 text-left transition-colors min-h-[100px] w-full",ee?"pointer-events-none":"hover:bg-accent"),children:[n.jsxs("div",{className:"flex items-start justify-between gap-2",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx($a,{health:de}),n.jsx("span",{className:"text-sm font-medium leading-tight truncate",children:U.agentName??"Unknown"})]}),K&&n.jsx("span",{className:"shrink-0 text-[10px] font-medium text-amber-500",children:"Stale"})]}),n.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[n.jsxs("span",{children:[Se," device",Se!==1?"s":""]}),q&&n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"·"}),n.jsxs("span",{children:[q.slotsAvailable,"/",q.slotsTotal," slots"]})]})]}),q&&!K&&n.jsxs("div",{className:"flex flex-col gap-1.5 w-full",children:[n.jsx(kn,{label:"CPU",percent:J,colorClass:"bg-blue-400"}),n.jsx(kn,{label:"RAM",percent:Re,colorClass:"bg-violet-400"})]})]})})}),ee&&n.jsx(Ee,{children:"This Mac is currently overloaded. Try again later."})]})},U.agentName)})})]})})}),r&&n.jsxs(n.Fragment,{children:[n.jsx(jn,{orientation:"vertical",className:"h-auto"}),n.jsx("div",{className:"w-80 shrink-0 h-full",children:n.jsx(Ta,{buildId:Number(r),recordingsRefreshKey:i})})]})]})}function $a({health:t}){const e={unknown:"bg-muted-foreground/40",healthy:"bg-emerald-400",warning:"bg-amber-400",overloaded:"bg-red-500"}[t];return n.jsx("span",{"data-testid":"resource-health-dot",className:te("inline-block h-2 w-2 shrink-0 rounded-full",e)})}function kn({label:t,percent:e,colorClass:r}){return n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground",children:[n.jsx("span",{children:t}),n.jsxs("span",{children:[e.toFixed(0),"%"]})]}),n.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:n.jsx("div",{className:te("h-full rounded-full transition-all",r),style:{width:`${Math.min(100,e)}%`}})})]})}export{Ga as QASession};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as m,j as s}from"./vendor-react-AJpf4YZ0.js";import{ad as b,a5 as S,C as h,c as p,d as x,b as f,a as k,L as u,I as w,B as C,a2 as P,a3 as j}from"./index-
|
|
1
|
+
import{i as m,j as s}from"./vendor-react-AJpf4YZ0.js";import{ad as b,a5 as S,C as h,c as p,d as x,b as f,a as k,L as u,I as w,B as C,a2 as P,a3 as j}from"./index-Cajf0T-5.js";import{b as E,c as F}from"./vendor-router-BFibuab1.js";const T=P({password:j().min(8),confirm:j()}).refine(r=>r.password===r.confirm,{message:"Passwords do not match",path:["confirm"]});function I(){const r=E(),[g]=F(),a=g.get("token")??"",[n,t]=m.useState("loading"),{register:o,handleSubmit:v,setError:d,formState:{errors:e,isSubmitting:c}}=b({resolver:S(T),mode:"onBlur"});m.useEffect(()=>{if(!a){t("invalid");return}fetch(`/api/v1/auth/reset-password/verify?token=${a}`).then(i=>i.ok?t("valid"):Promise.reject()).catch(()=>t("invalid"))},[a]);async function N(i){try{const l=await fetch("/api/v1/auth/reset-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:a,password:i.password})});if(!l.ok){const y=await l.json();d("root",{message:y.error??"Failed to reset password"});return}r("/login",{replace:!0})}catch{d("root",{message:"Network error. Please try again."})}}return n==="loading"?s.jsx("div",{className:"flex min-h-svh items-center justify-center"}):n==="invalid"?s.jsx("div",{className:"bg-mesh-gradient flex min-h-svh items-center justify-center overflow-hidden p-4",children:s.jsx(h,{level:4,className:"w-full max-w-sm text-center",children:s.jsxs(p,{children:[s.jsx(x,{children:"Link expired"}),s.jsx(f,{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(h,{level:4,className:"w-full max-w-sm",children:[s.jsxs(p,{className:"text-center",children:[s.jsx(x,{children:"Reset password"}),s.jsx(f,{children:"Enter your new password below."})]}),s.jsx(k,{children:s.jsxs("form",{onSubmit:v(N),className:"flex flex-col gap-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(u,{htmlFor:"password",children:"New password"}),s.jsx(w,{id:"password",type:"password",...o("password")}),e.password&&s.jsx("p",{className:"text-sm text-destructive",children:e.password.message})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(u,{htmlFor:"confirm",children:"Confirm password"}),s.jsx(w,{id:"confirm",type:"password",...o("confirm")}),e.confirm&&s.jsx("p",{className:"text-sm text-destructive",children:e.confirm.message})]}),e.root&&s.jsx("p",{className:"text-sm text-destructive",children:e.root.message}),s.jsx(C,{type:"submit",disabled:c,className:"w-full",children:c?"Saving…":"Set new password"})]})})]})})}export{I as ResetPassword};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as f,j as e}from"./vendor-react-AJpf4YZ0.js";import{ai as g,ad as j,a5 as w,C as v,c as N,d as b,a as y,L as i,I as o,B as C,a2 as S,a3 as l}from"./index-
|
|
1
|
+
import{i as f,j as e}from"./vendor-react-AJpf4YZ0.js";import{ai as g,ad as j,a5 as w,C as v,c as N,d as b,a as y,L as i,I as o,B as C,a2 as S,a3 as l}from"./index-Cajf0T-5.js";import{b as k}from"./vendor-router-BFibuab1.js";const E=S({email:l().email("Enter a valid email"),password:l().min(8,"Password must be at least 8 characters"),confirm:l()}).refine(a=>a.password===a.confirm,{message:"Passwords do not match",path:["confirm"]});function B(){const a=k(),{resolvedTheme:d}=g(),p=d==="dark"?"/logo-dark.svg":"/logo.svg",{register:r,handleSubmit:x,setError:c,formState:{errors:s,isSubmitting:m}}=j({resolver:w(E),mode:"onBlur"});f.useEffect(()=>{fetch("/api/v1/auth/status").then(t=>t.json()).then(({initialized:t})=>{t&&a("/login",{replace:!0})}).catch(()=>{})},[a]);async function h(t){try{const n=await fetch("/api/v1/auth/init",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:t.email,password:t.password})});if(!n.ok){const u=await n.json();c("root",{message:u.error??"Failed to create account"});return}a("/login",{replace:!0})}catch{c("root",{message:"Network error. Please try again."})}}return e.jsx("div",{className:"flex min-h-svh items-center justify-center overflow-hidden p-4",children:e.jsxs("div",{className:"flex flex-col items-center gap-6 w-full max-w-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("img",{src:p,alt:"tapflow",className:"w-6 h-6"}),e.jsx("span",{className:"text-base font-semibold tracking-tight",children:"tapflow"})]}),e.jsxs(v,{level:4,className:"w-full",children:[e.jsx(N,{className:"text-center",children:e.jsx(b,{className:"text-2xl tracking-display-md",children:"Set up tapflow"})}),e.jsx(y,{children:e.jsxs("form",{onSubmit:x(h),className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(i,{htmlFor:"email",children:"Admin email"}),e.jsx(o,{id:"email",type:"email",placeholder:"admin@yourteam.com",autoComplete:"email",...r("email")}),s.email&&e.jsx("p",{className:"text-sm text-destructive",children:s.email.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(i,{htmlFor:"password",children:"Password"}),e.jsx(o,{id:"password",type:"password",autoComplete:"new-password",...r("password")}),s.password&&e.jsx("p",{className:"text-sm text-destructive",children:s.password.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(i,{htmlFor:"confirm",children:"Confirm password"}),e.jsx(o,{id:"confirm",type:"password",autoComplete:"new-password",...r("confirm")}),s.confirm&&e.jsx("p",{className:"text-sm text-destructive",children:s.confirm.message})]}),s.root&&e.jsx("p",{className:"text-sm text-destructive",children:s.root.message}),e.jsx(C,{type:"submit",size:"lg",disabled:m,className:"w-full mt-1",children:m?"Creating account…":"Create admin account"})]})})]})]})})}export{B as Setup};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{i,j as e}from"./vendor-react-AJpf4YZ0.js";import{W as K,ad as X,a5 as Y,B as r,I as N,L as A,h as Z,C as ee,c as se,d as ie,a as te,a4 as x,a2 as O,a3 as u,G as ne}from"./index-Cajf0T-5.js";import{D as ae,f as le,a as re,d as oe,e as ce,S as I,i as R,j as E,g as P,h as n}from"./dialog-pS8vHXXv.js";import{A as de,c as me,f as he,g as xe,d as ue,e as je,b as ve,a as pe}from"./alert-dialog-DADd1jHN.js";import{T as ge,d as fe,e as L,c as o,a as be,b as c}from"./table-CL9AvoTp.js";import{j as Se,l as ye}from"./publicLink-D6zKS_wu.js";import"./vendor-router-BFibuab1.js";/**
|
|
2
|
+
* @license lucide-react v1.41.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 Ce=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],ke=K("user-plus",Ce),we=O({email:u().email(),role:u().min(1)}),Te=O({token:u(),emailSent:ne(),inviteUrl:u().nullable()});function Le(){const[g,$]=i.useState([]),[V,f]=i.useState({}),[d,b]=i.useState(""),[F,S]=i.useState(!1),[H,m]=i.useState(""),y=i.useId(),C=i.useRef(null),[B,M]=i.useState(!1),[j,v]=i.useState(null),{register:Q,handleSubmit:_,control:z,reset:J,formState:{errors:k,isSubmitting:w}}=X({resolver:Y(we),mode:"onBlur",defaultValues:{email:"",role:"QA"}});function p(){fetch("/api/v1/team/members",{credentials:"include"}).then(s=>s.json()).then($)}i.useEffect(()=>{p()},[]),i.useEffect(()=>{var s;d&&((s=C.current)==null||s.focus())},[d]);async function U(s){m("");try{const t=await fetch("/api/v1/team/invite",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:s.email,role:s.role})});if(!t.ok)throw new Error(`Server error: ${t.status}`);const l=Te.parse(await t.json()),h=l.inviteUrl??Se((await ye()).linkBase,`/invite?token=${l.token}`),a=await(navigator.clipboard?navigator.clipboard.writeText(h):Promise.reject(new Error("no clipboard"))).then(()=>!0,()=>!1);b(h),S(a),m(`${l.emailSent?`Invite email sent to ${s.email}.`:"Email could not be sent."} ${a?"Invite link copied to clipboard.":"Copy the invite link."}`),l.emailSent?x.success(`Invite email sent to ${s.email}`):a?x.warning("Invite link copied — email could not be sent. Check your SMTP settings."):x.warning("Email could not be sent. Copy the invite link from the dialog, and check your SMTP settings.")}catch{x.error("Failed to create invite link"),m("Failed to create invite link.")}}function T(s){M(s),s||(b(""),S(!1),m(""),J())}async function G(s,t){await fetch(`/api/v1/team/members/${s}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({role:t})}),p()}async function q(s){const h=(await(await fetch(`/api/v1/team/members/${s}/send-reset`,{method:"POST",credentials:"include"})).json()).emailSent?"Sent":"No SMTP";f(a=>({...a,[s]:h})),setTimeout(()=>f(a=>{const D={...a};return delete D[s],D}),3e3)}async function W(s){await fetch(`/api/v1/team/members/${s}`,{method:"DELETE",credentials:"include"}),v(null),p()}return e.jsxs("div",{className:"flex flex-col gap-6 max-w-[900px] mx-auto w-full p-6",children:[e.jsx(de,{open:j!==null,onOpenChange:s=>{s||v(null)},children:e.jsxs(me,{children:[e.jsxs(he,{children:[e.jsx(xe,{children:"Remove this member?"}),e.jsx(ue,{children:"This member will lose access to the team immediately."})]}),e.jsxs(je,{children:[e.jsx(ve,{children:"Cancel"}),e.jsx(pe,{className:"bg-destructive/10 text-destructive hover:bg-destructive/20 border-0",onClick:()=>j!==null&&W(j),children:"Remove"})]})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"text-xl font-semibold",children:"Team"}),e.jsxs(ae,{open:B,onOpenChange:T,children:[e.jsx(le,{asChild:!0,children:e.jsxs(r,{size:"sm",children:[e.jsx(ke,{className:"mr-2 h-4 w-4"}),"Invite member"]})}),e.jsxs(re,{className:"sm:max-w-md",children:[e.jsx(oe,{children:e.jsx(ce,{children:"Invite team member"})}),e.jsx("p",{role:"status",className:"sr-only",children:H}),d?e.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[e.jsx("p",{id:y,className:"text-sm text-muted-foreground",children:F?"Invite link copied to clipboard:":"Copy this invite link:"}),e.jsx(N,{ref:C,readOnly:!0,value:d,"aria-labelledby":y,onFocus:s=>s.currentTarget.select(),className:"font-mono text-xs"}),e.jsx(r,{onClick:()=>T(!1),children:"Done"})]}):e.jsxs("form",{onSubmit:_(U),className:"flex flex-col gap-4 pt-2",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(A,{htmlFor:"invite-email",children:"Email"}),e.jsx(N,{id:"invite-email",type:"email",...Q("email")}),k.email&&e.jsx("p",{className:"text-sm text-destructive",children:k.email.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(A,{htmlFor:"invite-role",children:"Role"}),e.jsx(Z,{name:"role",control:z,render:({field:s})=>e.jsxs(I,{value:s.value,onValueChange:s.onChange,children:[e.jsx(R,{id:"invite-role",children:e.jsx(E,{})}),e.jsxs(P,{children:[e.jsx(n,{value:"Admin",children:"Admin"}),e.jsx(n,{value:"Developer",children:"Developer"}),e.jsx(n,{value:"QA",children:"QA"}),e.jsx(n,{value:"Viewer",children:"Viewer"})]})]})})]}),e.jsx(r,{type:"submit",disabled:w,children:w?"Creating link…":"Generate invite link"})]})]})]})]}),e.jsxs(ee,{children:[e.jsx(se,{children:e.jsxs(ie,{children:["Members (",g.length,")"]})}),e.jsx(te,{className:"px-4 pt-0 pb-2",children:e.jsxs(ge,{children:[e.jsx(fe,{children:e.jsxs(L,{children:[e.jsx(o,{children:"Nickname"}),e.jsx(o,{children:"Email"}),e.jsx(o,{children:"Role"}),e.jsx(o,{children:"Joined"}),e.jsx(o,{className:"w-10"})]})}),e.jsx(be,{children:g.map(s=>e.jsxs(L,{className:"hover:bg-transparent",children:[e.jsx(c,{className:"font-medium",children:s.display_name||"—"}),e.jsx(c,{className:"text-muted-foreground text-sm",children:s.email}),e.jsx(c,{children:e.jsxs(I,{value:s.role,onValueChange:t=>G(s.id,t),children:[e.jsx(R,{className:"h-7 w-28",children:e.jsx(E,{})}),e.jsxs(P,{children:[e.jsx(n,{value:"Admin",children:"Admin"}),e.jsx(n,{value:"Developer",children:"Developer"}),e.jsx(n,{value:"QA",children:"QA"}),e.jsx(n,{value:"Viewer",children:"Viewer"})]})]})}),e.jsx(c,{className:"text-muted-foreground text-sm",children:new Date(s.joined_at).toLocaleDateString()}),e.jsx(c,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(r,{variant:"secondary",size:"nav",onClick:()=>q(s.id),children:V[s.id]??"Reset pwd"}),e.jsx(r,{variant:"destructive",size:"nav",onClick:()=>v(s.id),children:"Remove"})]})})]},s.id))})]})})]})]})}export{Le as TeamSettings};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as t,j as e}from"./vendor-react-AJpf4YZ0.js";import{ad as $,a5 as M,B as d,I as p,a4 as a,L as y,C as J,c as U,d as q,b as G,a as K,a2 as Q,a3 as F}from"./index-Cajf0T-5.js";import{B}from"./badge-CMf8d5RJ.js";import{A as X,c as Y,f as Z,g as ee,d as se,e as te,b as ae}from"./alert-dialog-DADd1jHN.js";import{D as ne,f as re,a as oe,d as le,e as ie,S as ce,i as de,j as xe,g as me,h as R}from"./dialog-pS8vHXXv.js";import{T as he,d as ue,e as v,c as x,a as pe,b as l}from"./table-CL9AvoTp.js";import{l as je}from"./publicLink-D6zKS_wu.js";import{P as ge,T as fe}from"./trash-mvVp4nwq.js";import"./vendor-router-BFibuab1.js";const ke=Q({name:F().min(1),expiresDays:F().refine(m=>{const i=parseInt(m,10);return!isNaN(i)&&i>=1&&i<=365},{message:"Must be between 1 and 365"})});function Ae(){const[m,i]=t.useState([]),[_,P]=t.useState(!1),[n,N]=t.useState(""),[c,b]=t.useState("api"),[w,T]=t.useState(""),[j,g]=t.useState(null),C=t.useId(),D=t.useId(),f=t.useRef(null),[L,r]=t.useState(""),{register:S,handleSubmit:O,reset:H,formState:{errors:h,isSubmitting:A}}=$({resolver:M(ke),mode:"onBlur",defaultValues:{name:"",expiresDays:"30"}});function k(){fetch("/api/v1/tokens",{credentials:"include"}).then(s=>s.json()).then(i)}t.useEffect(()=>{k()},[]),t.useEffect(()=>{var s;n&&((s=f.current)==null||s.focus())},[n]);async function z(s){r("");try{const u=await fetch("/api/v1/tokens",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s.name,expires_in_days:parseInt(s.expiresDays,10),...c==="agent"?{scope:"agent"}:{}})});if(!u.ok){const o=await u.json().catch(()=>null);a.error((o==null?void 0:o.error)??"Failed to create token"),r((o==null?void 0:o.error)??"Failed to create token");return}const W=await u.json();c==="agent"&&T((await je()).agentWsBase),a.success("Token created"),N(W.token),k()}catch{a.error("Network error"),r("Network error")}}function I(s){P(s),s||(N(""),b("api"),T(""),r(""),H())}async function V(s){try{return(await fetch(`/api/v1/tokens/${s}`,{method:"DELETE",credentials:"include"})).ok?(a.success("Token revoked"),k(),!0):(a.error("Failed to revoke token"),!1)}catch{return a.error("Network error"),!1}}function E(s){return s.expires_at&&new Date(s.expires_at)<new Date}return e.jsxs("div",{className:"flex flex-col gap-6 max-w-[900px] mx-auto w-full p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"text-xl font-semibold",children:"Personal Access Tokens"}),e.jsxs(ne,{open:_,onOpenChange:I,children:[e.jsx(re,{asChild:!0,children:e.jsxs(d,{size:"sm",children:[e.jsx(ge,{className:"mr-2 h-4 w-4"}),"New token"]})}),e.jsxs(oe,{className:"sm:max-w-md",children:[e.jsx(le,{children:e.jsx(ie,{children:"Create token"})}),e.jsx("p",{role:"status",className:"sr-only",children:L}),n?e.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[e.jsx("p",{id:C,className:"text-sm text-muted-foreground",children:"Copy this token now — it won't be shown again."}),e.jsx(p,{ref:f,readOnly:!0,value:n,"aria-labelledby":C,onFocus:s=>s.currentTarget.select(),className:"font-mono text-xs"}),c==="agent"&&w&&e.jsxs(e.Fragment,{children:[e.jsx("p",{id:D,className:"text-sm text-muted-foreground",children:"Run this on the agent Mac to connect it to this relay:"}),e.jsx(p,{readOnly:!0,value:`tapflow agent start --relay ${w} --token ${n}`,"aria-labelledby":D,onFocus:s=>s.currentTarget.select(),className:"font-mono text-xs"})]}),e.jsx(d,{onClick:()=>{r(""),(navigator.clipboard?navigator.clipboard.writeText(n):Promise.reject(new Error("no clipboard"))).then(()=>{a.success("Token copied to clipboard"),I(!1)}).catch(()=>{var s;a.error("Failed to copy — copy manually"),r("Could not copy the token. Select it and copy it by hand."),(s=f.current)==null||s.focus()})},children:"Copy & close"})]}):e.jsxs("form",{onSubmit:O(z),className:"flex flex-col gap-4 pt-2",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(y,{htmlFor:"token-name",children:"Name"}),e.jsx(p,{id:"token-name",placeholder:"e.g. ci-deploy",...S("name")}),h.name&&e.jsx("p",{className:"text-sm text-destructive",children:h.name.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(y,{htmlFor:"expires",children:"Expires in (days)"}),e.jsx(p,{id:"expires",type:"number",...S("expiresDays")}),h.expiresDays&&e.jsx("p",{className:"text-sm text-destructive",children:h.expiresDays.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(y,{htmlFor:"token-type",children:"Type"}),e.jsxs(ce,{value:c,onValueChange:s=>b(s),children:[e.jsx(de,{id:"token-type",children:e.jsx(xe,{})}),e.jsxs(me,{children:[e.jsx(R,{value:"api",children:"API — CI uploads & API access"}),e.jsx(R,{value:"agent",children:"Agent — connect remote device agents (Admin only)"})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Scope: ",e.jsx(B,{variant:"secondary",children:c==="agent"?"agent":"view, builds:write"})]}),e.jsx(d,{type:"submit",disabled:A,children:A?"Creating…":"Create token"})]})]})]})]}),e.jsxs(J,{children:[e.jsxs(U,{children:[e.jsx(q,{children:"Active tokens"}),e.jsxs(G,{children:["Use these tokens with ",e.jsx("code",{className:"text-xs",children:"Authorization: Bearer <token>"})," for API deployments."]})]}),e.jsx(K,{className:"px-4 pt-0 pb-2",children:e.jsxs(he,{children:[e.jsx(ue,{children:e.jsxs(v,{children:[e.jsx(x,{children:"Name"}),e.jsx(x,{children:"Scope"}),e.jsx(x,{children:"Last used"}),e.jsx(x,{children:"Expires"}),e.jsx(x,{className:"w-10"})]})}),e.jsx(pe,{children:m.length===0?e.jsx(v,{children:e.jsx(l,{colSpan:5,className:"h-20 text-center text-muted-foreground",children:"No tokens yet."})}):m.map(s=>e.jsxs(v,{className:"hover:bg-transparent",children:[e.jsx(l,{className:"font-medium",children:s.name}),e.jsx(l,{children:e.jsx(B,{variant:"secondary",children:s.scope})}),e.jsx(l,{className:"text-muted-foreground text-sm",children:s.last_used_at?new Date(s.last_used_at).toLocaleDateString():"Never"}),e.jsx(l,{children:s.expires_at?e.jsx("span",{className:E(s)?"text-destructive text-sm":"text-muted-foreground text-sm",children:E(s)?"Expired":new Date(s.expires_at).toLocaleDateString()}):e.jsx("span",{className:"text-muted-foreground text-sm",children:"Never"})}),e.jsx(l,{children:e.jsx(d,{variant:"destructive",size:"icon",className:"h-7 w-7","aria-label":"Revoke token",onClick:()=>g(s.id),children:e.jsx(fe,{className:"h-4 w-4"})})})]},s.id))})]})})]}),e.jsx(X,{open:j!==null,onOpenChange:s=>{s||g(null)},children:e.jsxs(Y,{children:[e.jsxs(Z,{children:[e.jsx(ee,{children:"Revoke token?"}),e.jsx(se,{children:"Any active API calls using this token will immediately fail."})]}),e.jsxs(te,{children:[e.jsx(ae,{children:"Cancel"}),e.jsx(d,{variant:"destructive",onClick:async()=>{if(j===null)return;await V(j)&&g(null)},children:"Revoke"})]})]})})]})}export{Ae as TokenSettings};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as r,j as o}from"./vendor-react-AJpf4YZ0.js";import{m as O,a9 as u,j as T,K as S,n as b,k as $,i as m,Q as v,l as E,O as h,D as z,o as F,J as g,H as x}from"./index-
|
|
1
|
+
import{i as r,j as o}from"./vendor-react-AJpf4YZ0.js";import{m as O,a9 as u,j as T,K as S,n as b,k as $,i as m,Q as v,l as E,O as h,D as z,o as F,J as g,H as x}from"./index-Cajf0T-5.js";var H=Object.defineProperty,n=(t,e)=>H(t,"name",{value:e,configurable:!0}),k="AlertDialog",[M,pe]=h(k,[v]),c=v(),I=n(t=>{const{__scopeAlertDialog:e,...a}=t,l=c(e);return o.jsx(z,{...l,...a,modal:!0})},"AlertDialog"),J=r.forwardRef(n(function(e,a){const{__scopeAlertDialog:l,...i}=e,s=c(l);return o.jsx(F,{...s,...i,ref:a})},"AlertDialogTrigger")),K=n(t=>{const{__scopeAlertDialog:e,...a}=t,l=c(e);return o.jsx(O,{...l,...a})},"AlertDialogPortal"),L=r.forwardRef(n(function(e,a){const{__scopeAlertDialog:l,...i}=e,s=c(l);return o.jsx(E,{...s,...i,ref:a})},"AlertDialogOverlay")),Q="AlertDialogContent",[V,q]=M(Q),B=r.forwardRef(n(function(e,a){const{__scopeAlertDialog:l,children:i,...s}=e,p=c(l),f=r.useRef(null),P=u(a,f),D=r.useRef(null);return o.jsx(V,{scope:l,cancelRef:D,children:o.jsx(T,{role:"alertdialog",...p,...s,ref:P,onOpenAutoFocus:S(s.onOpenAutoFocus,d=>{var A;d.preventDefault(),(A=D.current)==null||A.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:i})})},"AlertDialogContent")),G=r.forwardRef(n(function(e,a){const{__scopeAlertDialog:l,...i}=e,s=c(l);return o.jsx(b,{...s,...i,ref:a})},"AlertDialogTitle")),U=r.forwardRef(n(function(e,a){const{__scopeAlertDialog:l,...i}=e,s=c(l);return o.jsx($,{...s,...i,ref:a})},"AlertDialogDescription")),W=r.forwardRef(n(function(e,a){const{__scopeAlertDialog:l,...i}=e,s=c(l);return o.jsx(m,{...s,...i,ref:a})},"AlertDialogAction")),X="AlertDialogCancel",Y=r.forwardRef(n(function(e,a){const{__scopeAlertDialog:l,...i}=e,{cancelRef:s}=q(X,l),p=c(l),f=u(a,s);return o.jsx(m,{...p,...i,ref:f})},"AlertDialogCancel")),Z=I,ee=J,ae=K,N=L,j=B,y=W,_=Y,C=G,R=U;const fe=Z,De=ee,te=ae,w=r.forwardRef(({className:t,...e},a)=>o.jsx(N,{className:g("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:a}));w.displayName=N.displayName;const oe=r.forwardRef(({className:t,...e},a)=>o.jsxs(te,{children:[o.jsx(w,{}),o.jsx(j,{ref:a,className:g("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));oe.displayName=j.displayName;const le=({className:t,...e})=>o.jsx("div",{className:g("flex flex-col space-y-2 text-center sm:text-left",t),...e});le.displayName="AlertDialogHeader";const re=({className:t,...e})=>o.jsx("div",{className:g("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});re.displayName="AlertDialogFooter";const se=r.forwardRef(({className:t,...e},a)=>o.jsx(C,{ref:a,className:g("text-lg font-semibold",t),...e}));se.displayName=C.displayName;const ie=r.forwardRef(({className:t,...e},a)=>o.jsx(R,{ref:a,className:g("text-sm text-muted-foreground",t),...e}));ie.displayName=R.displayName;const ne=r.forwardRef(({className:t,...e},a)=>o.jsx(y,{ref:a,className:g(x(),t),...e}));ne.displayName=y.displayName;const ce=r.forwardRef(({className:t,...e},a)=>o.jsx(_,{ref:a,className:g(x({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));ce.displayName=_.displayName;export{fe as A,ne as a,ce as b,oe as c,ie as d,re as e,le as f,se as g,De as h};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as n}from"./vendor-react-AJpf4YZ0.js";import{J as d,a0 as o}from"./index-
|
|
1
|
+
import{j as n}from"./vendor-react-AJpf4YZ0.js";import{J as d,a0 as o}from"./index-Cajf0T-5.js";const s=o("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground",outline:"text-foreground"},tone:{backlog:"border-transparent bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400",progress:"border-transparent bg-blue-50 text-blue-700 dark:bg-blue-950 dark:text-blue-300",done:"border-transparent bg-green-50 text-green-700 dark:bg-green-950 dark:text-green-300",rejected:"border-transparent bg-red-50 text-red-700 dark:bg-red-950 dark:text-red-300",ios:"border-transparent bg-sky-50 text-sky-700 dark:bg-sky-950 dark:text-sky-300",android:"border-transparent bg-emerald-50 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300"}},defaultVariants:{variant:"default"}});function g({className:r,variant:e,tone:t,...a}){return n.jsx("div",{className:d(s({variant:e,tone:t}),r),...a})}export{g as B};
|