@tapflowio/relay 0.18.0 → 0.19.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.
Files changed (97) hide show
  1. package/README.md +1 -1
  2. package/dist/RelayServer.d.ts +263 -2
  3. package/dist/RelayServer.d.ts.map +1 -1
  4. package/dist/RelayServer.js +936 -177
  5. package/dist/RelayServer.js.map +1 -1
  6. package/dist/SessionManager.d.ts +83 -17
  7. package/dist/SessionManager.d.ts.map +1 -1
  8. package/dist/SessionManager.js +107 -14
  9. package/dist/SessionManager.js.map +1 -1
  10. package/dist/index.d.ts +0 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/types.d.ts +2 -38
  13. package/dist/types.d.ts.map +1 -1
  14. package/dist/types.js +13 -0
  15. package/dist/types.js.map +1 -1
  16. package/package.json +8 -8
  17. package/public/assets/{AppCenter-B3FO67aw.js → AppCenter-DyP0aqfF.js} +2 -2
  18. package/public/assets/AppCenter-DyP0aqfF.js.br +0 -0
  19. package/public/assets/Default-D7ScPE30.js +1 -0
  20. package/public/assets/Default-D7ScPE30.js.br +0 -0
  21. package/public/assets/Invite-UmhV5rAf.js +1 -0
  22. package/public/assets/Invite-UmhV5rAf.js.br +0 -0
  23. package/public/assets/MacResources-MS4E00w3.js +1 -0
  24. package/public/assets/MacResources-MS4E00w3.js.br +0 -0
  25. package/public/assets/NotFound-BoDDivK5.js +1 -0
  26. package/public/assets/NotFound-BoDDivK5.js.br +0 -0
  27. package/public/assets/QASession-CjgJHDZ3.js +125 -0
  28. package/public/assets/QASession-CjgJHDZ3.js.br +0 -0
  29. package/public/assets/ResetPassword-CAlB6CfP.js +1 -0
  30. package/public/assets/ResetPassword-CAlB6CfP.js.br +0 -0
  31. package/public/assets/Setup-CPm2-hPJ.js +1 -0
  32. package/public/assets/Setup-CPm2-hPJ.js.br +0 -0
  33. package/public/assets/{Team-CBsjuUwh.js → Team-GEIzrM1D.js} +2 -2
  34. package/public/assets/Team-GEIzrM1D.js.br +0 -0
  35. package/public/assets/Tokens-DSeBz_CJ.js +1 -0
  36. package/public/assets/Tokens-DSeBz_CJ.js.br +0 -0
  37. package/public/assets/alert-dialog-BsXI9SVV.js +1 -0
  38. package/public/assets/alert-dialog-BsXI9SVV.js.br +0 -0
  39. package/public/assets/badge-BkdYQFsh.js +1 -0
  40. package/public/assets/badge-BkdYQFsh.js.br +0 -0
  41. package/public/assets/{build-format-B78hbKY9.js → build-format-CXuQt1X2.js} +3 -3
  42. package/public/assets/build-format-CXuQt1X2.js.br +0 -0
  43. package/public/assets/{dialog-BxC9v2BL.js → dialog-DuXZpbiF.js} +3 -3
  44. package/public/assets/dialog-DuXZpbiF.js.br +0 -0
  45. package/public/assets/{index-uGJGo6ac.css → index-Bk2hqaHZ.css} +1 -1
  46. package/public/assets/index-Bk2hqaHZ.css.br +0 -0
  47. package/public/assets/index-bitr6DIC.js +215 -0
  48. package/public/assets/index-bitr6DIC.js.br +0 -0
  49. package/public/assets/{pencil-Cq64I9LV.js → pencil-iRR275s8.js} +1 -1
  50. package/public/assets/pencil-iRR275s8.js.br +0 -0
  51. package/public/assets/table-CHmhGpHG.js +1 -0
  52. package/public/assets/table-CHmhGpHG.js.br +0 -0
  53. package/public/assets/tabs-BnbeuAOe.js +1 -0
  54. package/public/assets/tabs-BnbeuAOe.js.br +0 -0
  55. package/public/assets/{trash-2-CszwJHEh.js → trash-2-QI162w2K.js} +1 -1
  56. package/public/assets/trash-2-QI162w2K.js.br +0 -0
  57. package/public/assets/vendor-charts-DyX5CBcf.js +5 -0
  58. package/public/assets/vendor-charts-DyX5CBcf.js.br +0 -0
  59. package/public/assets/vendor-react-AJpf4YZ0.js +49 -0
  60. package/public/assets/vendor-react-AJpf4YZ0.js.br +0 -0
  61. package/public/assets/vendor-router-ChFy8CZ1.js +12 -0
  62. package/public/assets/vendor-router-ChFy8CZ1.js.br +0 -0
  63. package/public/index.html +4 -2
  64. package/public/index.html.br +0 -0
  65. package/public/assets/AppCenter-B3FO67aw.js.br +0 -0
  66. package/public/assets/Default-BlNUv5dw.js +0 -1
  67. package/public/assets/Default-BlNUv5dw.js.br +0 -0
  68. package/public/assets/Invite-CKYFmy7S.js +0 -1
  69. package/public/assets/Invite-CKYFmy7S.js.br +0 -0
  70. package/public/assets/MacResources-BK4VQnFc.js +0 -5
  71. package/public/assets/MacResources-BK4VQnFc.js.br +0 -0
  72. package/public/assets/NotFound-BMmi1paB.js +0 -1
  73. package/public/assets/NotFound-BMmi1paB.js.br +0 -0
  74. package/public/assets/QASession-CVTlqW3d.js +0 -125
  75. package/public/assets/QASession-CVTlqW3d.js.br +0 -0
  76. package/public/assets/ResetPassword-VPPBWzSI.js +0 -1
  77. package/public/assets/ResetPassword-VPPBWzSI.js.br +0 -0
  78. package/public/assets/Setup-CRdnCl41.js +0 -1
  79. package/public/assets/Setup-CRdnCl41.js.br +0 -0
  80. package/public/assets/Team-CBsjuUwh.js.br +0 -0
  81. package/public/assets/Tokens-CU9HB9WD.js +0 -1
  82. package/public/assets/Tokens-CU9HB9WD.js.br +0 -0
  83. package/public/assets/alert-dialog-DWqGDQTB.js +0 -1
  84. package/public/assets/alert-dialog-DWqGDQTB.js.br +0 -0
  85. package/public/assets/badge-OToVq1dK.js +0 -1
  86. package/public/assets/badge-OToVq1dK.js.br +0 -0
  87. package/public/assets/build-format-B78hbKY9.js.br +0 -3
  88. package/public/assets/dialog-BxC9v2BL.js.br +0 -0
  89. package/public/assets/index-DXjMx9hQ.js +0 -274
  90. package/public/assets/index-DXjMx9hQ.js.br +0 -0
  91. package/public/assets/index-uGJGo6ac.css.br +0 -0
  92. package/public/assets/pencil-Cq64I9LV.js.br +0 -0
  93. package/public/assets/table-CbATN5Pi.js +0 -1
  94. package/public/assets/table-CbATN5Pi.js.br +0 -0
  95. package/public/assets/tabs-BVumgDA4.js +0 -1
  96. package/public/assets/tabs-BVumgDA4.js.br +0 -0
  97. package/public/assets/trash-2-CszwJHEh.js.br +0 -0
@@ -1,125 +0,0 @@
1
- import{W as oe,a6 as s,al as dn,a3 as n,J as ne,y as Nt,T as Re,z as je,B as ie,x as Ce,S as fn,a8 as Me,r as Zn,s as Ct,K as Ie,ad as ze,t as We,O as hn,ac as tt,aj as Qn,af as er,U as tr,w as nr,f as rr,am as sr,ae as or,ak as ar,ab as ir,L as cr}from"./index-DXjMx9hQ.js";import{f as lr,a as ur,P as pn,c as Gt,S as dr,b as fr}from"./build-format-B78hbKY9.js";import{u as mn,T as hr,b as pr,c as qt,a as Jt}from"./tabs-BVumgDA4.js";import{D as gn,a as xn,d as mr,e as bn,b as gr,c as xr,k as br,S as yr,i as vr,j as wr,g as Sr,h as Zt}from"./dialog-BxC9v2BL.js";import{B as Rr}from"./badge-OToVq1dK.js";/**
2
- * @license lucide-react v0.577.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"}]],Cr=oe("arrow-left",jr);/**
7
- * @license lucide-react v0.577.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 kr=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Er=oe("arrow-up",kr);/**
12
- * @license lucide-react v0.577.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 Tr=[["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"}]],Ar=oe("camera",Tr);/**
17
- * @license lucide-react v0.577.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 _r=[["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"}]],Nr=oe("download",_r);/**
22
- * @license lucide-react v0.577.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 Pr=[["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"}]],Dr=oe("film",Pr);/**
27
- * @license lucide-react v0.577.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 Lr=[["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"}]],yn=oe("house",Lr);/**
32
- * @license lucide-react v0.577.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 Mr=[["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"}]],Ir=oe("image-plus",Mr);/**
37
- * @license lucide-react v0.577.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 Ur=[["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"}]],Hr=oe("keyboard",Ur);/**
42
- * @license lucide-react v0.577.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 Fr=[["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"}]],vn=oe("link-2",Fr);/**
47
- * @license lucide-react v0.577.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 Br=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Rt=oe("loader-circle",Br);/**
52
- * @license lucide-react v0.577.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 Or=[["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"}]],$r=oe("message-square",Or);/**
57
- * @license lucide-react v0.577.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 zr=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],Wr=oe("power",zr);/**
62
- * @license lucide-react v0.577.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 Vr=[["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"}]],Kr=oe("rotate-cw",Vr);/**
67
- * @license lucide-react v0.577.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 Xr=[["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"}]],Yr=oe("scan-line",Xr);/**
72
- * @license lucide-react v0.577.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 Gr=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],qr=oe("square",Gr);/**
77
- * @license lucide-react v0.577.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 Jr=[["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"}]],Zr=oe("video",Jr);/**
82
- * @license lucide-react v0.577.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 Qr=[["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"}]],es=oe("volume-2",Qr);/**
87
- * @license lucide-react v0.577.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=[["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"}]],ns=oe("volume-1",ts);function rs(t){const[e,r]=s.useState(null);return s.useEffect(()=>{t&&lr(t).then(r)},[t]),{build:e}}function ss(t){const[e,r]=s.useState([]),[o,i]=s.useState(null),[a,c]=s.useState(null),[f,l]=s.useState(""),[p,m]=s.useState(!1),[g,d]=s.useState(""),b=s.useCallback(P=>{P.type==="agents:listed"&&r(P.sessions),P.type==="session:joined"&&(m(!1),d("Connected")),P.type==="error"&&(m(!1),d(`Error: ${P.message}`))},[]),{send:y,connected:S}=mn(b);s.useEffect(()=>{if(!S)return;y({type:"agents:list"});const P=setInterval(()=>y({type:"agents:list"}),5e3);return()=>clearInterval(P)},[S,y]);const D=s.useRef({sessionId:a,deviceId:f});s.useEffect(()=>{D.current={sessionId:a,deviceId:f}},[a,f]),s.useEffect(()=>()=>{const{sessionId:P,deviceId:K}=D.current;P&&K&&y({type:"device:shutdown",sessionId:P,payload:{deviceId:K}})},[y]);const E=e.filter(P=>P.devices.some(K=>K.platform===t)),R=s.useCallback(P=>{l(P.id),m(!0),d("Booting…"),c(P.sessionId)},[]),A=s.useCallback(()=>l(""),[]),C=s.useCallback(()=>{const{sessionId:P,deviceId:K}=D.current;P&&K&&y({type:"device:shutdown",sessionId:P,payload:{deviceId:K}}),c(null),m(!1),d("")},[y]),N=s.useCallback(()=>{const{sessionId:P,deviceId:K}=D.current;P&&K&&y({type:"device:shutdown",sessionId:P,payload:{deviceId:K}}),c(null),i(null),m(!1),d(""),y({type:"agents:list"})},[y]),U=s.useCallback(()=>{c(null),i(null),m(!1),d(""),y({type:"agents:list"})},[y]);return{sessions:e,selectedAgent:o,setSelectedAgent:i,activeSessionId:a,deviceId:f,booting:p,status:g,send:y,connected:S,agentGroups:E,startDevice:R,resetDevice:A,handleBack:C,handleBackToMacs:N,handleSessionEnded:U}}function os(t,e){const[r,o]=s.useState(""),[i,a]=s.useState(""),[c,f]=s.useState("app-only"),[l,p]=s.useState("app-only"),m=e!=="android",g=s.useCallback(()=>{p(m?c:"app-only"),f("app-only")},[c,m]),d=(t==null?void 0:t.devices.filter(S=>S.platform===e))??[],b=[...new Set(d.map(S=>S.osVersion).filter(Boolean))].sort((S,D)=>{const E=C=>C.replace(/^[^\d]*/,"").split(".").map(Number),[R,A]=[E(S),E(D)];for(let C=0;C<Math.max(R.length,A.length);C++){const N=(A[C]??0)-(R[C]??0);if(N!==0)return N}return 0}),y=(r?d.filter(S=>S.osVersion===r):d).filter(S=>!i||S.name.toLowerCase().includes(i.toLowerCase()));return{filteredDevices:d,osVersions:b,osVersion:r,setOsVersion:o,deviceSearch:i,setDeviceSearch:a,versionedDevices:y,resetMode:c,setResetMode:f,appliedResetMode:l,consumeResetMode:g,fullResetSupported:m}}function as(){const[t]=dn(),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}}const is=["video/mp4;codecs=avc1","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"];function wn({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 f=s.useRef(!1),l=s.useRef(null),p=s.useRef([]),m=s.useRef(""),g=s.useRef(0),d=s.useRef(null),b=s.useCallback(function D(){var E;f.current&&((E=d.current)==null||E.call(d),g.current=requestAnimationFrame(D))},[]),y=s.useCallback(D=>{const E=a.current;if(!E)return;const R=E.getContext("2d");R&&(R.fillStyle="#000",R.fillRect(0,0,E.width,E.height));const A=is.find(N=>MediaRecorder.isTypeSupported(N))??"";if(!A)return;m.current=A,p.current=[];const C=new MediaRecorder(E.captureStream(30),{mimeType:A});C.ondataavailable=N=>{N.data.size>0&&p.current.push(N.data)},l.current=C,C.start(1e3),d.current=D,f.current=!0,g.current=requestAnimationFrame(b),i("recording")},[b]),S=s.useCallback(async()=>{var N;i("uploading"),f.current=!1,cancelAnimationFrame(g.current);const D=l.current;if(!D){i("idle");return}await new Promise(U=>{const P=setTimeout(U,5e3);D.onstop=()=>{clearTimeout(P),U()};try{D.stop()}catch{clearTimeout(P),U()}}),l.current=null;const E=m.current,R=E.includes("mp4")?".mp4":".webm",A=new Blob(p.current,{type:E});p.current=[];const C=new FormData;C.append("file",A,`tapflow-${Date.now()}${R}`);try{const U=new URLSearchParams({sessionId:t});e&&U.set("buildId",String(e));const P=await fetch(`/api/v1/recordings/upload?${U}`,{method:"POST",credentials:"include",body:C}),K=await P.json();if(P.ok&&K.url){const J=document.createElement("a");J.href=K.url,J.download="",J.click(),(N=c.current)==null||N.call(c),i("done"),setTimeout(()=>i("idle"),2e3)}else i("idle")}catch{i("idle")}},[t,e]);return s.useEffect(()=>{if(o!=="recording")return;const D=()=>{document.visibilityState==="hidden"&&S()};return document.addEventListener("visibilitychange",D),()=>{var E;document.removeEventListener("visibilitychange",D),f.current&&(f.current=!1,cancelAnimationFrame(g.current),(E=l.current)==null||E.stop(),l.current=null)}},[o,S]),{recordState:o,recordCanvasRef:a,startClientRecording:y,stopClientRecording:S}}function Sn(){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 et({className:t,...e}){return n.jsx("kbd",{"data-slot":"kbd",className:ne("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 Pt({className:t,...e}){return n.jsx("kbd",{"data-slot":"kbd-group",className:ne("inline-flex items-center gap-1",t),...e})}function lt({label:t,keys:e}){return n.jsxs("span",{className:"flex items-center gap-3",children:[t,n.jsx(Pt,{children:e.map(r=>n.jsx(et,{children:r},r))})]})}function Rn({joined:t,onScreenshot:e,onRecordToggle:r,recordState:o,onRotate:i,onDeepLink:a,platformSlot:c,launchSlot:f}){return t?n.jsx(Nt,{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:[f,c,n.jsxs(Re,{children:[n.jsx(je,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:a,children:n.jsx(vn,{className:"h-4 w-4"})})}),n.jsx(Ce,{side:"left",children:n.jsx(lt,{label:"Deeplink",keys:["⌘","K"]})})]}),n.jsx("div",{className:"w-4 h-px bg-border my-1"}),n.jsxs(Re,{children:[n.jsx(je,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:e,children:n.jsx(Ar,{className:"h-4 w-4"})})}),n.jsx(Ce,{side:"left",children:n.jsx(lt,{label:"Screenshot",keys:["⌘","S"]})})]}),n.jsxs(Re,{children:[n.jsx(je,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:ne("h-8 w-8",o==="recording"&&"text-red-500 hover:text-red-500"),disabled:o==="uploading"||o==="done",onClick:r,children:o==="uploading"?n.jsx(Rt,{className:"h-4 w-4 animate-spin"}):o==="recording"?n.jsx(qr,{className:"h-4 w-4 fill-current"}):n.jsx(Zr,{className:"h-4 w-4"})})}),n.jsx(Ce,{side:"left",children:o==="idle"?n.jsx(lt,{label:"Start recording",keys:["⌘","⇧","Y"]}):o==="recording"?n.jsx(lt,{label:"Stop recording",keys:["⌘","⇧","Y"]}):"Processing…"})]}),n.jsx("div",{className:"w-4 h-px bg-border my-1"}),n.jsxs(Re,{children:[n.jsx(je,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:i,children:n.jsx(Kr,{className:"h-4 w-4"})})}),n.jsx(Ce,{side:"left",children:n.jsx(lt,{label:"Rotate",keys:["⌘","⇧","O"]})})]})]})}):null}class Dt{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 cs{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 jn(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 ls(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 us=new Set([100,110,122,244,44,83,86,118,128,138,139,134,135]);function Qt(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 Cn(t){const e=t.bits(8);t.bits(8);const r=t.bits(8);if(t.ue(),us.has(e)){const g=t.ue();if(g===3&&t.flag(),t.ue(),t.ue(),t.flag(),t.flag()){const d=g!==3?8:12;for(let b=0;b<d;b++)if(t.flag()){const y=b<6?16:64;let S=8,D=8;for(let E=0;E<y;E++)D!==0&&(D=(S+t.se()+256)%256),S=D===0?S:D}}}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 d=0;d<g;d++)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 f=t.flag();f&&Qt(t);const l=t.flag();l&&Qt(t),(f||l)&&t.flag(),t.flag();const p=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:p}):{...a,vuiPresent:!0,restrictionFlagPos:p}}function ds(t){const e=Cn(new Dt(jn(t)));return{profileIdc:e.profileIdc,levelIdc:e.levelIdc,vuiPresent:e.vuiPresent,bitstreamRestriction:e.bitstreamRestriction,maxNumReorderFrames:e.maxNumReorderFrames,maxDecFrameBuffering:e.maxDecFrameBuffering}}function fs(t){const e=jn(t),r=Cn(new Dt(e));if(!r.vuiPresent||r.restrictionFlagPos<0||r.bitstreamRestriction)return null;const o=new cs,i=new Dt(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],...ls(o.toBytes())])}function hs(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 ps{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 p of hs(new Uint8Array(e))){const m=p[0]&31;if(m===7){const g=!this.sps||p.length!==this.sps.length||p.some((d,b)=>d!==this.sps[b]);this.sps=p,g&&this.decoder&&(this.decoder.close(),this.decoder=null)}else m===8?this.pps=p:m>=1&&m<=5&&(m===5&&(o=!0),r.push(p))}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 p of r)i+=4+p.length;const a=new Uint8Array(i),c=new DataView(a.buffer);let f=0;for(const p of r)c.setUint32(f,p.length,!1),f+=4,a.set(p,f),f+=p.length;const l=Math.round(this.frameCount++*(1e6/30));if(this.decodeSampler&&(this.submitAt.set(l,performance.now()),this.submitAt.size>120)){const p=this.submitAt.keys().next().value;p!==void 0&&this.submitAt.delete(p)}try{this.decoder.decode(new EncodedVideoChunk({type:o?"key":"delta",timestamp:l,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(ds(e)))}catch(r){console.warn("[sps-vui] parse failed",r)}}}initDecoder(e,r){this.logSpsVui(e);const o=fs(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:f=>{this.sampleDecode(f),this.onFrame(f)},error:f=>console.error("[WebCodecsCore]",f)}),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 ms=`#version 300 es
92
- in vec2 a_pos;
93
- out vec2 v_uv;
94
- void main() {
95
- v_uv = vec2(a_pos.x * 0.5 + 0.5, 0.5 - a_pos.y * 0.5);
96
- gl_Position = vec4(a_pos, 0.0, 1.0);
97
- }`,gs=`#version 300 es
98
- precision mediump float;
99
- in vec2 v_uv;
100
- uniform sampler2D u_tex;
101
- out vec4 out_color;
102
- void main() {
103
- out_color = texture(u_tex, v_uv);
104
- }`;function xs(t){const e=t.getContext("webgl2",{alpha:!1,antialias:!1,powerPreference:"high-performance",preserveDrawingBuffer:!0});if(!e)return null;const r=(m,g)=>{const d=e.createShader(m);return e.shaderSource(d,g),e.compileShader(d),d},o=e.createProgram(),i=r(e.VERTEX_SHADER,ms),a=r(e.FRAGMENT_SHADER,gs);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 f=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,f),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),e.STATIC_DRAW);const l=e.getAttribLocation(o,"a_pos");e.enableVertexAttribArray(l),e.vertexAttribPointer(l,2,e.FLOAT,!1,0,0),e.bindVertexArray(null);const p=e.createTexture();return e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,p),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:p,vao:c}}class bs{constructor(e){this.canvas=e,this.state=null}init(){return this.state=xs(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 ys(t){const e=new bs(t);return e.init(),e}class vs{constructor(e=ys){this._size=null,this.canvas=document.createElement("canvas"),this.renderer=e(this.canvas),this.core=new ps(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 ws=`#version 300 es
105
- in vec2 a_pos;
106
- out vec2 v_uv;
107
- void main() {
108
- v_uv = vec2(a_pos.x * 0.5 + 0.5, 0.5 - a_pos.y * 0.5);
109
- gl_Position = vec4(a_pos, 0.0, 1.0);
110
- }`,Ss=`#version 300 es
111
- precision mediump float;
112
- in vec2 v_uv;
113
- uniform sampler2D u_texY;
114
- uniform sampler2D u_texU;
115
- uniform sampler2D u_texV;
116
- out vec4 out_color;
117
- void main() {
118
- float Y = (texture(u_texY, v_uv).r - 0.0627451) * 1.1643836; // (y-16/255)*255/219
119
- float U = (texture(u_texU, v_uv).r - 0.5019608) * 1.1383929; // (u-128/255)*255/224
120
- float V = (texture(u_texV, v_uv).r - 0.5019608) * 1.1383929;
121
- float r = Y + 1.5748 * V;
122
- float g = Y - 0.1873 * U - 0.4681 * V;
123
- float b = Y + 1.8556 * U;
124
- out_color = vec4(r, g, b, 1.0);
125
- }`;function Tt(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 Rs(t){const e=t.getContext("webgl2",{alpha:!1,antialias:!1,powerPreference:"high-performance",preserveDrawingBuffer:!0});if(!e)return null;const r=(d,b)=>{const y=e.createShader(d);return e.shaderSource(y,b),e.compileShader(y),y},o=e.createProgram(),i=r(e.VERTEX_SHADER,ws),a=r(e.FRAGMENT_SHADER,Ss);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 f=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,f),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),e.STATIC_DRAW);const l=e.getAttribLocation(o,"a_pos");e.enableVertexAttribArray(l),e.vertexAttribPointer(l,2,e.FLOAT,!1,0,0),e.bindVertexArray(null),e.pixelStorei(e.UNPACK_ALIGNMENT,1);const p=Tt(e,0,"u_texY",o),m=Tt(e,1,"u_texU",o),g=Tt(e,2,"u_texV",o);return{gl:e,program:o,texY:p,texU:m,texV:g,vao:c}}class js{constructor(e){this.canvas=e,this.state=null}init(){return this.state=Rs(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,f=o+1>>1,l=r*o,p=c*f,m=e.subarray(0,l),g=e.subarray(l,l+p),d=e.subarray(l+p,l+2*p);(this.canvas.width!==r||this.canvas.height!==o)&&(this.canvas.width=r,this.canvas.height=o,a.viewport(0,0,r,o));const b=(y,S,D,E,R)=>{a.activeTexture(a.TEXTURE0+y),a.bindTexture(a.TEXTURE_2D,S),a.texImage2D(a.TEXTURE_2D,0,a.R8,D,E,0,a.RED,a.UNSIGNED_BYTE,R)};return b(0,i.texY,r,o,m),b(1,i.texU,c,f,g),b(2,i.texV,c,f,d),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 Cs=0;function ks(t){const e=new js(t);return e.init(),e}function Es(){return new Worker(new URL("/assets/tinyh264.worker-DiJ50Hai.js",import.meta.url),{type:"module"})}class Ts{constructor(e=ks,r=Es){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:Cs},[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 Ut(){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 As(t=Ut()){return t.secureContext&&t.webCodecs&&t.webgl2?new vs:t.wasm&&t.webgl2?new Ts:null}function en(t=Ut()){return t.secureContext&&t.webCodecs&&t.webgl2||t.wasm&&t.webgl2}function _s(t=Ut()){return t.secureContext&&t.webCodecs&&t.webgl2?"high":t.wasm&&t.webgl2?"standard":"unsupported"}const Ns="https://www.tapflow.dev/reference/configuration#https-secure-context";function Ps({open:t,onOpenChange:e}){return n.jsx(gn,{open:t,onOpenChange:e,children:n.jsxs(xn,{className:"sm:max-w-[440px]",children:[n.jsxs(mr,{children:[n.jsx(bn,{children:"Streaming in Standard mode"}),n.jsxs(gr,{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(xr,{children:[n.jsx(ie,{variant:"outline",onClick:()=>window.open(Ns,"_blank","noopener,noreferrer"),children:"How to enable"}),n.jsx(ie,{onClick:()=>e(!1),children:"Got it"})]})]})})}const tn="tapflow.perfModeNoticeDismissed";function Ds(t,e){return t==="standard"&&!e}const Ls={high:"Smooth",standard:"Standard",unsupported:null};function Ms(t){const{connected:e,joined:r,bootError:o,deviceReady:i,installing:a,installError:c,agentAway:f}=t;return e?r?f?"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}`:null:"Starting device…":"Joining session…":"Connecting…"}function Ht(t){const{joined:e,fps:r,keyboardActive:o}=t,i=Ms(t),a=r>15,c=a?"#10b981":"#94a3b8",f=a?"Active":"Idle",l=s.useMemo(()=>_s(),[]),p=Ls[l],[m,g]=s.useState(!1);s.useEffect(()=>{let b=!1;try{b=localStorage.getItem(tn)==="1"}catch{}Ds(l,b)&&g(!0)},[l]);const d=b=>{if(g(b),!b)try{localStorage.setItem(tn,"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:ne("flex items-center",o?"text-emerald-500":"text-muted-foreground"),style:{gap:6},children:[n.jsx(Yr,{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:ne("text-[11px]",a?"text-emerald-500":"text-muted-foreground/60"),children:f})]}),p&&n.jsxs(n.Fragment,{children:[n.jsx(fn,{orientation:"vertical",className:"h-3"}),l==="standard"?n.jsx("button",{type:"button",onClick:()=>g(!0),className:"text-[11px] text-foreground/70 hover:text-foreground underline-offset-2 hover:underline",children:p}):n.jsx("span",{className:"text-[11px] text-muted-foreground",children:p})]})]}),i&&n.jsx("p",{className:"text-[12px] text-muted-foreground leading-relaxed break-all",children:i}),n.jsx(Ps,{open:m,onOpenChange:d})]})}function kn({open:t,onOpenChange:e,sessionId:r,send:o}){const[i,a]=s.useState(""),c=s.useRef(null);s.useEffect(()=>{t?setTimeout(()=>{var l;return(l=c.current)==null?void 0:l.focus()},0):a("")},[t]);const f=()=>{i.trim()&&(o({type:"open-url",sessionId:r,payload:{url:i.trim()}}),e(!1))};return n.jsx(gn,{open:t,onOpenChange:e,children:n.jsxs(xn,{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(bn,{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(ur,{className:"h-4 w-4 text-muted-foreground shrink-0"}),n.jsx("input",{ref:c,className:"flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground min-w-0",placeholder:"myapp://home...",value:i,onChange:l=>a(l.target.value),onKeyDown:l=>{l.key==="Enter"&&f()}})]}),n.jsx(ie,{size:"sm",disabled:!i.trim(),onClick:f,className:"shrink-0 rounded-xl h-8 px-4",children:"Open"})]})]})})}function Is(t,e,r,o,i,a){const{x:c,y:f,width:l,height:p}=i;let m,g;if(a){const d=(t.x-e.left)/e.width;m=(1-(t.y-e.top)/e.height)*r,g=d*o}else m=(t.x-e.left)*(r/e.width),g=(t.y-e.top)*(o/e.height);return m<c||m>c+l||g<f||g>f+p?null:{x:(m-c)/l,y:(g-f)/p}}function Us(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 En(t){return{f0:{x:1-t.x,y:1-t.y},f1:t}}function Hs(t,e){return t>0?Math.min(1,e/t):1}const Lt=22,nn=[84,70,70,69],Fs=1,Bs=0,jt=1,Tn=2,Os=1,$s=2,zs=4;function Ws(t){if(t.byteLength<Lt)return null;const e=new DataView(t);for(let i=0;i<nn.length;i++)if(e.getUint8(i)!==nn[i])return null;if(e.getUint8(4)!==Fs)return null;const r=e.getUint8(5),o=r&zs?Tn:r&Os?jt:Bs;return{capturedAt:Number(e.getBigUint64(6)),relayedAt:Number(e.getBigUint64(14)),codec:o,keyframe:o===jt&&(r&$s)!==0}}function An(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,f=!1,l;const p=()=>{if(a)return a;if(c)return null;const m=As();return m?(a=m,m.onResize(g=>i.current.onResize(g)),l=i.current.onDecoderReady(m),m):(c=!0,i.current.onUnsupported(),console.warn("[decoder] none available — set up HTTPS or use a supported browser"),null)};return e.current=(m,g)=>{const d=i.current.onJpegFrame;if(d&&(g==null?void 0:g.codec)!==jt){d(m,g);return}const b=p();if(b){if(!f){if(!(g!=null&&g.keyframe))return;f=!0}b.decode(m),o.current+=1}},()=>{e.current=void 0,typeof l=="function"&&l(),a==null||a.close(),a==null||a.surface.remove(),a=null}},[e,r,o])}const Vs=3e3+5*300,Ks=Vs+500,bt=8;function Xs(){var t;return window.isSecureContext&&typeof ClipboardItem<"u"&&!!((t=navigator.clipboard)!=null&&t.write)}class yt extends Error{}function Ys(t){const e=t.then(r=>new Blob([r],{type:"text/plain"}));return navigator.clipboard.write([new ClipboardItem({"text/plain":e})])}function Gs(){const t=new Uint8Array(16);return crypto.getRandomValues(t),Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}function Ft(t){return!(t.metaKey||t.ctrlKey)||t.altKey?!1:t.code==="KeyV"?!0:!t.shiftKey&&(t.code==="KeyC"||t.code==="KeyX")}const qs=1024*1024,Js=t=>new TextEncoder().encode(t).length,Zs=t=>{var e;return!!((e=t.payload)!=null&&e.unsupported)},Qs=t=>{const e=t.payload;return(e==null?void 0:e.sentinelParked)===!1||(e==null?void 0:e.unsupported)===!0};function eo(){const t=window.getSelection();return!!t&&!t.isCollapsed&&t.toString().length>0}function rn(){const t=document.activeElement;return!!t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable)}function _n({sessionId:t,send:e,active:r,supported:o,handlerRef:i,sendChord:a,onError:c}){const f=s.useRef(new Map),l=s.useRef(null),p=s.useRef(c);s.useLayoutEffect(()=>{p.current=c});const m=s.useCallback(d=>{var b;l.current!==d&&(l.current=d,(b=p.current)==null||b.call(p,d))},[]);s.useEffect(()=>(i.current=d=>{if(!d.requestId)return;const b=f.current.get(d.requestId);b&&(f.current.delete(d.requestId),b(d))},()=>{i.current=void 0}),[i]);const g=s.useCallback((...[d,b])=>{const y=Gs();return new Promise(S=>{const D=setTimeout(()=>{f.current.delete(y),S(null)},Ks);f.current.set(y,E=>{clearTimeout(D),S(E)}),e({type:d,sessionId:t,requestId:y,payload:b})})},[e,t]);s.useEffect(()=>{if(!r||!o)return;const d=async y=>{if(y.code==="KeyV"||!Ft(y))return;const S=y.code==="KeyX";if(rn()||eo()||(y.preventDefault(),y.repeat))return;if(!Xs()){a(S?"KeyX":"KeyC",bt),m("Copied on the device. Serving the dashboard over HTTPS also brings it to your clipboard.");return}let D,E;const R=new Promise((U,P)=>{D=U,E=P});R.catch(()=>{});const A=Ys(R).catch(U=>{U instanceof yt||m(U instanceof Error&&U.name==="NotAllowedError"?"Your browser blocked the clipboard write":"Could not write to your clipboard")}),C=await g("clipboard:read",{press:S?"cut":"copy"});if(!C){E(new yt("timeout")),m("The device is taking too long — try again");return}if(C.type==="clipboard:error"){E(new yt(C.message??"read failed")),m(C.message??"Clipboard read failed"),Qs(C)&&a(S?"KeyX":"KeyC",bt);return}const{text:N}=C.payload??{};if(l.current=null,!N){E(new yt("empty"));return}D(N),await A},b=y=>{var D;if(rn())return;const S=((D=y.clipboardData)==null?void 0:D.getData("text"))??"";if(y.preventDefault(),!S){a("KeyV",bt);return}if(Js(S)>qs){m("That text is too large to send to the device");return}g("clipboard:write",{text:S,pasteAfter:!0}).then(E=>{if((E==null?void 0:E.type)==="clipboard:write-done"){l.current=null;return}if(!E){m("The device is taking too long — try again");return}m(E.message??"Clipboard write failed"),Zs(E)&&a("KeyV",bt)})};return document.addEventListener("keydown",d),document.addEventListener("paste",b),()=>{document.removeEventListener("keydown",d),document.removeEventListener("paste",b)}},[r,o,g,a,m])}const _e=13,Ze=8,sn=16,to=.02,no=100;function ro({sessionId:t,buildId:e,send:r,connected:o,joined:i,deviceReady:a,installing:c,installed:f,installError:l,bootError:p,launching:m,setLaunching:g,chrome:d,binaryFrameHandlerRef:b,clipboardHandlerRef:y,clipboardSupported:S,onRecordingUploaded:D,swKeyboardVisible:E,swKeyboardPending:R,onKbdToggle:A,perfHookRef:C}){const N=s.useRef(null),U=s.useRef(null),P=s.useRef(null),{fps:K,frameCount:J}=Sn(),z=s.useRef(0),{recordState:V,recordCanvasRef:Y,startClientRecording:ce,stopClientRecording:ke}=wn({sessionId:t,buildId:e,onRecordingUploaded:D}),me=s.useRef(0),[Ee,Ne]=s.useState(!1),[ve,we]=s.useState(!1),[q,Te]=s.useState(!1),[de,fe]=s.useState(!1),[F,O]=s.useState(null),[se,he]=s.useState(null),[ae,le]=s.useState(!1),[Q,Z]=s.useState(null),T=s.useRef(Q);s.useEffect(()=>{T.current=Q},[Q]);const $=s.useRef(null),X=s.useRef(null),re=s.useRef(!1),ee=s.useRef(!1),ge=s.useRef(0),ue=s.useRef(null),xe=s.useRef(null),Ae=s.useRef("idle"),Pe=s.useRef(null),Ve=s.useRef(null),He=s.useRef(null);s.useEffect(()=>{He.current=d},[d]),s.useEffect(()=>{const u=new Image;u.onload=()=>{Ve.current=u},u.src=`data:image/png;base64,${d.framePng}`},[d.framePng]),An({binaryFrameHandlerRef:b,perfHookRef:C,frameCount:J,onUnsupported:()=>{},onResize:u=>{const x=N.current;if(x&&(x.width!==u.width||x.height!==u.height)&&(x.width=u.width,x.height=u.height,!He.current)){const h=Y.current;h&&(h.width=u.width,h.height=u.height)}we(!0)},onDecoderReady:u=>{var w;const x=u.surface,h=N.current;x.style.position="absolute",h&&(x.style.left=h.style.left,x.style.top=h.style.top,x.style.width=h.style.width,x.style.height=h.style.height,x.style.borderRadius=h.style.borderRadius),x.style.objectFit="fill",x.style.zIndex="3",x.style.pointerEvents="none",(w=U.current)==null||w.appendChild(x);let k=null;const _=()=>{const M=N.current,I=M==null?void 0:M.getContext("2d");if(M&&I&&u.size)try{I.drawImage(u.surface,0,0,M.width,M.height)}catch{}k=requestAnimationFrame(_)};return k=requestAnimationFrame(_),()=>{k!==null&&cancelAnimationFrame(k)}},onJpegFrame:u=>{const x=performance.now();z.current&&x-z.current,z.current=x;const h=me.current;createImageBitmap(new Blob([u],{type:"image/jpeg"})).then(k=>{if(performance.now()-x,me.current!==h){k.close();return}const _=N.current,w=_==null?void 0:_.getContext("2d");if(!_||!w){k.close();return}if((_.width!==k.width||_.height!==k.height)&&(_.width=k.width,_.height=k.height,!He.current)){const I=Y.current;I&&(I.width=k.width,I.height=k.height)}const M=performance.now();w.drawImage(k,0,0),performance.now()-M,k.close(),we(!0),J.current+=1}).catch(()=>{})}}),s.useEffect(()=>{const u=Y.current,x=U.current;u&&x&&(u.width=x.clientWidth,u.height=x.clientHeight)},[d,Y]);const at=s.useCallback(()=>{const u=Y.current,x=N.current;if(!u||!x)return;const h=u.getContext("2d");if(!h)return;const k=He.current;if(h.clearRect(0,0,u.width,u.height),k){Ve.current&&h.drawImage(Ve.current,0,0,u.width,u.height);const M=Math.round(k.screenCornerRadius/2*(u.height/(k.compositeHeight/2)));h.save(),h.beginPath(),M>0?h.roundRect(x.offsetLeft,x.offsetTop,x.clientWidth,x.clientHeight,M):h.rect(x.offsetLeft,x.offsetTop,x.clientWidth,x.clientHeight),h.clip(),h.drawImage(x,x.offsetLeft,x.offsetTop,x.clientWidth,x.clientHeight),h.restore()}else h.drawImage(x,0,0,u.width,u.height);const _=T.current;if(_)for(const M of[_.f0,_.f1]){const I=k?x.offsetLeft+M.x*x.clientWidth:M.x*u.width,G=k?x.offsetTop+M.y*x.clientHeight:M.y*u.height;re.current?(h.beginPath(),h.arc(I,G,Ze,0,Math.PI*2),h.fillStyle="rgba(255,255,255,0.92)",h.fill(),h.strokeStyle="rgba(0,0,0,0.2)",h.lineWidth=1,h.stroke()):(h.beginPath(),h.arc(I,G,_e,0,Math.PI*2),h.strokeStyle="rgba(0,0,0,0.3)",h.lineWidth=3,h.stroke(),h.beginPath(),h.arc(I,G,_e,0,Math.PI*2),h.strokeStyle="rgba(255,255,255,0.65)",h.lineWidth=1.5,h.stroke())}const w=xe.current;if(w){const M=Ae.current,I=Pe.current;if(h.save(),M==="down")h.beginPath(),h.arc(w.x,w.y,Ze,0,Math.PI*2),h.fillStyle="rgba(255,255,255,0.92)",h.fill(),h.strokeStyle="rgba(0,0,0,0.2)",h.lineWidth=1,h.stroke();else if(M==="release"&&I){const G=Math.min((performance.now()-I.startTime)/350,1);h.beginPath(),h.arc(w.x,w.y,Ze+26*G,0,Math.PI*2),h.strokeStyle=`rgba(255,255,255,${(1-G)*.55})`,h.lineWidth=1.5,h.stroke(),G>=1&&(Ae.current="idle",Pe.current=null)}else h.beginPath(),h.arc(w.x,w.y,_e,0,Math.PI*2),h.strokeStyle="rgba(0,0,0,0.3)",h.lineWidth=3,h.stroke(),h.beginPath(),h.arc(w.x,w.y,_e,0,Math.PI*2),h.strokeStyle="rgba(255,255,255,0.65)",h.lineWidth=1.5,h.stroke();h.restore()}},[Y]),it=s.useCallback(()=>{const u=N.current;if(!u)return;const x=document.createElement("canvas"),h=x.getContext("2d");h&&(x.width=u.width,x.height=u.height,h.drawImage(u,0,0),x.toBlob(k=>{if(!k)return;const _=URL.createObjectURL(k),w=document.createElement("a");w.href=_,w.download=`tapflow-${Date.now()}.png`,w.click(),URL.revokeObjectURL(_)},"image/png"))},[]),Ke=s.useCallback(()=>{if(V==="idle"){const u=Y.current;if(!u)return;const x=U.current;if(x&&x.clientWidth>0)u.width=x.clientWidth,u.height=x.clientHeight;else{const h=N.current;if(h&&h.width>0)u.width=h.width,u.height=h.height;else return}ce(at)}else V==="recording"&&ke()},[V,ce,ke,at,Y]),Se=s.useCallback(()=>{r({type:"input:rotate",sessionId:t}),Te(u=>!u)},[r,t]),Fe=s.useRef(q);s.useEffect(()=>{Fe.current=q},[q]),s.useEffect(()=>()=>{Fe.current&&r({type:"input:rotate",sessionId:t})},[]);const kt=s.useCallback((u,x)=>{r({type:"input:key",sessionId:t,payload:{code:u,modifiers:x}})},[r,t]);_n({sessionId:t,send:r,active:de,supported:S,handlerRef:y,sendChord:kt,onError:u=>Me.error(u)}),s.useEffect(()=>{const u=new Set(["ShiftLeft","ShiftRight","ControlLeft","ControlRight","MetaLeft","MetaRight"]),x=w=>{if(w.code==="AltLeft"||w.code==="AltRight"){ee.current=!0;return}if(w.metaKey){const I=document.activeElement;if(!I||I.tagName!=="INPUT"&&I.tagName!=="TEXTAREA"){if(!w.shiftKey&&w.code==="KeyK"){w.preventDefault(),Ne(!0);return}if(!w.shiftKey&&w.code==="KeyS"){w.preventDefault(),it();return}if(w.shiftKey&&w.code==="KeyY"){w.preventDefault(),Ke();return}if(w.shiftKey&&w.code==="KeyO"){w.preventDefault(),Se();return}if(w.shiftKey&&w.code==="KeyU"){w.preventDefault(),r({type:"input:button",sessionId:t,payload:{name:"home"}});return}if(w.shiftKey&&w.code==="KeyK"){w.preventDefault(),R||A();return}}}if(!de||u.has(w.code)||S&&Ft(w))return;w.preventDefault();const M=(w.shiftKey?2:0)|(w.ctrlKey?1:0)|(w.metaKey?8:0);r({type:"input:key",sessionId:t,payload:{code:w.code,modifiers:M}})},h=()=>{re.current&&(re.current=!1,le(!1),r({type:"input:pinch:end",sessionId:t})),ee.current=!1,Z(null)},k=w=>{(w.code==="AltLeft"||w.code==="AltRight")&&h()},_=()=>{ee.current&&h()};return window.addEventListener("keydown",x),window.addEventListener("keyup",k),window.addEventListener("blur",_),()=>{window.removeEventListener("keydown",x),window.removeEventListener("keyup",k),window.removeEventListener("blur",_)}},[de,S,r,t,it,Ke,Se,A,R]),s.useEffect(()=>{if(!de)return;const u=x=>{const h=U.current??N.current;h&&!h.contains(x.target)&&fe(!1)};return document.addEventListener("pointerdown",u),()=>document.removeEventListener("pointerdown",u)},[de]);const De=s.useCallback(u=>{const x=(q?P.current:null)??U.current;if(!x)return null;const h=x.getBoundingClientRect(),k=d.compositeWidth/2,_=d.compositeHeight/2,w=d.screenRect.x/2,M=d.screenRect.y/2,I=d.screenRect.width/2,G=d.screenRect.height/2;return Is({x:u.clientX,y:u.clientY},h,k,_,{x:w,y:M,width:I,height:G},q)},[d,q]),Xe=s.useCallback(u=>{const x=De(u);return x?En(x):null},[De]),rt=s.useCallback(u=>{const x=q?P.current:U.current;if(!x)return null;const h=x.getBoundingClientRect();let k,_;if(q){const M=h.height-(u.clientY-h.top),I=u.clientX-h.left;k=M*(d.compositeWidth/h.height),_=I*(d.compositeHeight/h.width)}else k=(u.clientX-h.left)*(d.compositeWidth/h.width),_=(u.clientY-h.top)*(d.compositeHeight/h.height);const w=d.screenRect;if(k>=w.x&&k<=w.x+w.width&&_>=w.y&&_<=w.y+w.height)return null;for(const M of d.buttons){const I=k-M.normalOffset.x,G=_-M.normalOffset.y;if(I*I+G*G<no**2)return M.name}return null},[d,q]),Ye=s.useCallback(u=>{const x=N.current,h=Y.current;return x&&x.clientWidth>0?{x:x.offsetLeft+u.x*x.clientWidth,y:x.offsetTop+u.y*x.clientHeight}:{x:u.x*((h==null?void 0:h.width)??1),y:u.y*((h==null?void 0:h.height)??1)}},[Y]),be=s.useCallback(u=>{if(fe(!0),ee.current){const w=Xe(u);if(!w)return;re.current=!0,le(!0),u.target.setPointerCapture(u.pointerId),Z(w),r({type:"input:pinch:start",sessionId:t,payload:w});return}const x=rt(u);if(x){$.current=x,O(x),u.target.setPointerCapture(u.pointerId),r({type:"input:button",sessionId:t,payload:{name:x,phase:"down"}});return}const h=De(u);if(!h)return;X.current=h,u.target.setPointerCapture(u.pointerId),xe.current=Ye(h),Ae.current="down",Pe.current=null;const k=u.currentTarget.getBoundingClientRect(),_=ue.current;_&&(_.style.display="block",_.style.left=`${u.clientX-k.left}px`,_.style.top=`${u.clientY-k.top}px`,_.style.width=`${Ze*2}px`,_.style.height=`${Ze*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:h})},[rt,De,Xe,Ye,r,t]),mt=s.useCallback(u=>{if(u.buttons===0){if(he(rt(u)),ee.current){Z(Xe(u)),xe.current=null;const M=ue.current;M&&(M.style.display="none")}else{Z(null);const M=De(u);xe.current=M?Ye(M):null,Ae.current!=="down"&&(Ae.current="idle");const I=ue.current;if(I)if(M){const G=u.currentTarget.getBoundingClientRect();I.style.display="block",I.style.left=`${u.clientX-G.left}px`,I.style.top=`${u.clientY-G.top}px`,I.style.width=`${_e*2}px`,I.style.height=`${_e*2}px`,I.style.background="transparent",I.style.border="1.5px solid rgba(255,255,255,0.6)",I.style.boxShadow="0 0 0 1px rgba(0,0,0,0.3)"}else I.style.display="none"}return}if(re.current){const M=Xe(u);if(!M)return;const I=performance.now();if(I-ge.current<sn)return;ge.current=I,Z(M),r({type:"input:pinch:move",sessionId:t,payload:M});return}if($.current||!X.current)return;const x=De(u);if(!x)return;const h=x.x-X.current.x,k=x.y-X.current.y;if(Math.sqrt(h*h+k*k)<to)return;const _=performance.now();if(_-ge.current<sn)return;ge.current=_,xe.current=Ye(x);const w=ue.current;if(w&&w.style.display!=="none"){const M=u.currentTarget.getBoundingClientRect();w.style.left=`${u.clientX-M.left}px`,w.style.top=`${u.clientY-M.top}px`}r({type:"input:touch:move",sessionId:t,payload:x})},[rt,De,Xe,Ye,r,t]),Be=s.useCallback(()=>{if(re.current){re.current=!1,le(!1),Z(null),r({type:"input:pinch:end",sessionId:t});return}if(X.current=null,$.current){r({type:"input:button",sessionId:t,payload:{name:$.current,phase:"up"}}),$.current=null,setTimeout(()=>O(null),100);return}Ae.current="release",Pe.current={startTime:performance.now()};const u=ue.current;u&&(u.style.width=`${_e*2}px`,u.style.height=`${_e*2}px`,u.style.background="transparent",u.style.border="1.5px solid rgba(255,255,255,0.6)",u.style.boxShadow="0 0 0 1px rgba(0,0,0,0.3)"),r({type:"input:touch:end",sessionId:t})},[r,t]),Ge=s.useCallback(()=>{if(re.current){re.current=!1,le(!1),Z(null),r({type:"input:pinch:end",sessionId:t});return}if(X.current=null,$.current){r({type:"input:button",sessionId:t,payload:{name:$.current,phase:"up"}}),$.current=null,O(null);return}Ae.current="release",Pe.current={startTime:performance.now()},r({type:"input:touch:end",sessionId:t})},[r,t]),Et=s.useCallback(()=>{he(null),Z(null),xe.current=null;const u=ue.current;u&&(u.style.display="none")},[]),Oe=d.compositeWidth/2,gt=d.compositeHeight/2,st=Hs(gt,750),qe=Math.round(Oe*st),Je=Math.round(gt*st),ot=d.screenRect.x/d.compositeWidth*100,v=d.screenRect.y/d.compositeHeight*100,L=d.screenRect.width/d.compositeWidth*100,W=d.screenRect.height/d.compositeHeight*100,j=Math.round(d.screenCornerRadius/2*st),te=n.jsxs(n.Fragment,{children:[n.jsxs(Re,{children:[n.jsx(je,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>r({type:"input:button",sessionId:t,payload:{name:"home"}}),children:n.jsx(yn,{className:"h-4 w-4"})})}),n.jsx(Ce,{side:"left",children:n.jsxs("span",{className:"flex items-center gap-3",children:["Home ",n.jsxs(Pt,{children:[n.jsx(et,{children:"⌘"}),n.jsx(et,{children:"⇧"}),n.jsx(et,{children:"U"})]})]})})]}),n.jsxs(Re,{children:[n.jsx(je,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:"h-8 w-8",disabled:R,onClick:A,"data-active":E,children:R?n.jsx(Rt,{className:"h-4 w-4 animate-spin"}):n.jsx(Hr,{className:"h-4 w-4"})})}),n.jsx(Ce,{side:"left",children:n.jsxs("span",{className:"flex items-center gap-3",children:["Software keyboard ",n.jsxs(Pt,{children:[n.jsx(et,{children:"⌘"}),n.jsx(et,{children:"⇧"}),n.jsx(et,{children:"K"})]})]})})]})]}),H=f&&e?n.jsxs(Re,{children:[n.jsx(je,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:"h-8 w-8",disabled:m,"aria-label":"Launch app",onClick:()=>{g(!0),r({type:"app:launch",sessionId:t,buildId:e})},children:m?n.jsx(Rt,{className:"h-4 w-4 animate-spin"}):n.jsx(pn,{className:"h-4 w-4"})})}),n.jsx(Ce,{side:"left",children:m?"Launching…":"Launch app"})]}):null;return n.jsxs("div",{className:"flex items-start justify-center gap-16",children:[n.jsx("canvas",{ref:Y,style:{display:"none"}}),n.jsx(kn,{open:Ee,onOpenChange:Ne,sessionId:t,send:r}),n.jsx(Rn,{joined:i,onDeepLink:()=>Ne(!0),onScreenshot:it,onRecordToggle:Ke,recordState:V,onRotate:Se,platformSlot:te,launchSlot:H}),n.jsxs("div",{className:"flex items-start gap-8",children:[n.jsxs("div",{ref:P,style:{width:q?Je:qe,height:q?qe:Je,position:"relative",flexShrink:0},children:[n.jsxs("div",{ref:U,className:`relative ${se?"cursor-pointer":"cursor-default"}`,style:{width:qe,height:Je,...q?{position:"absolute",top:(qe-Je)/2,left:(Je-qe)/2,transform:"rotate(-90deg)",transformOrigin:"center center"}:{}},onPointerDown:be,onPointerMove:mt,onPointerUp:Be,onPointerCancel:Ge,onPointerLeave:Et,children:[n.jsx("img",{src:`data:image/png;base64,${d.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:N,style:{position:"absolute",zIndex:3,left:`${ot}%`,top:`${v}%`,width:`${L}%`,height:`${W}%`,borderRadius:j>0?`${j}px`:void 0,backgroundColor:"#010101",cursor:"none",visibility:ve?"visible":"hidden"}}),!ve&&n.jsx("div",{className:"absolute animate-pulse bg-zinc-700",style:{zIndex:3,left:`${ot}%`,top:`${v}%`,width:`${L}%`,height:`${W}%`,borderRadius:j>0?`${j}px`:void 0}}),Q&&(()=>{const u=ot/100,x=v/100,h=L/100,k=W/100,_=(w,M)=>({left:`${(u+w*h)*100}%`,top:`${(x+M*k)*100}%`});return n.jsx(n.Fragment,{children:[Q.f0,Q.f1].map((w,M)=>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",...ae?{width:Ze*2,height:Ze*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:_e*2,height:_e*2,background:"transparent",border:"1.5px solid rgba(255,255,255,0.6)",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)"},..._(w.x,w.y)}},M))})})(),i&&K===0&&n.jsx("div",{style:{position:"absolute",zIndex:8,left:`${ot}%`,top:`${v}%`,width:`${L}%`,height:`${W}%`,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:n.jsx("span",{style:{color:"white",fontSize:"0.875rem"},children:"Waiting for first frame..."})}),d.buttons.map(u=>{const x=F===u.name,h=se===u.name,k=u.anchor==="bottom",_=u.anchor==="top",w=k?(u.normalOffset.y-u.buttonH/2)/d.compositeHeight*100:_?u.rolloverOffset.y/d.compositeHeight*100:(u.normalOffset.y-u.buttonH/2)/d.compositeHeight*100,M=u.buttonH/d.compositeHeight*100,I=u.buttonW/d.compositeWidth*100,G=u.buttonW/2,pe=(u.rolloverOffset.x-G)/d.compositeWidth*100,Le=(2*u.rolloverOffset.x-u.normalOffset.x-G)/d.compositeWidth*100,xt=u.rolloverOffset.x/d.compositeWidth*100,ct=k?(u.normalOffset.y-u.buttonH/2)/d.compositeHeight*100:_?u.rolloverOffset.y/d.compositeHeight*100:(u.normalOffset.y-u.buttonH/2)/d.compositeHeight*100,Yt=_?(2*u.rolloverOffset.y-u.normalOffset.y)/d.compositeHeight*100:0,Jn=u.onTop?4:1;return n.jsxs(s.Fragment,{children:[u.buttonPng&&n.jsx("img",{src:`data:image/png;base64,${u.buttonPng}`,style:{position:"absolute",zIndex:Jn,top:`${_&&h?Yt:w}%`,left:`${_?pe:h?Le:pe}%`,width:`${I}%`,height:`${M}%`,transition:_?"top 0.15s ease":"left 0.15s ease",pointerEvents:"none",userSelect:"none"},draggable:!1,alt:""}),x&&u.pressedPng&&u.pressedRect&&n.jsx("img",{src:`data:image/png;base64,${u.pressedPng}`,style:{position:"absolute",zIndex:u.onTop?3:1,left:`${_?pe:h?Le:pe}%`,top:`${_&&h?Yt:w}%`,width:`${u.pressedRect.width/d.compositeWidth*100}%`,height:`${u.pressedRect.height/d.compositeHeight*100}%`,pointerEvents:"none",userSelect:"none"},draggable:!1,alt:""}),h&&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:`${xt}%`,top:`${ct}%`,transform:"translate(-50%, calc(-100% - 8px))"},children:u.accessibilityTitle})]},u.name)})]}),n.jsx("div",{ref:ue,style:{display:"none",position:"absolute",zIndex:20,borderRadius:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none",transition:"width 0.1s ease, height 0.1s ease, background 0.1s ease, box-shadow 0.1s ease"}})]}),n.jsx(Ht,{joined:i,fps:K,connected:o,deviceReady:a,bootError:p,installing:c,installError:l,keyboardActive:de})]})]})}const Qe=13,ut=8,on=16,so=.02,At=720;function oo({sessionId:t,buildId:e,send:r,connected:o,joined:i,deviceReady:a,installing:c,installed:f,installError:l,bootError:p,launching:m,setLaunching:g,androidButtons:d,binaryFrameHandlerRef:b,clipboardHandlerRef:y,clipboardSupported:S,onRecordingUploaded:D,screenWidth:E,screenHeight:R,cornerRadius:A,perfHookRef:C}){const N=s.useRef(null),U=s.useRef(null),P=s.useRef(null),{fps:K,frameCount:J}=Sn(),{recordState:z,recordCanvasRef:V,startClientRecording:Y,stopClientRecording:ce}=wn({sessionId:t,buildId:e,onRecordingUploaded:D}),[ke,me]=s.useState(!1),[Ee,Ne]=s.useState(!1),[ve,we]=s.useState(!1),q=s.useRef(null),[Te,de]=s.useState(null),[fe,F]=s.useState(!1),[O,se]=s.useState(!1),[he,ae]=s.useState(!1),[le,Q]=s.useState(null),Z=s.useRef(le);s.useEffect(()=>{Z.current=le},[le]);const T=s.useRef(!1),$=s.useRef(!1),X=s.useRef(null),re=s.useRef(0),ee=s.useRef(null),ge=s.useRef(null),ue=s.useRef("idle"),xe=s.useRef(null);An({binaryFrameHandlerRef:b,perfHookRef:C,frameCount:J,onUnsupported:()=>we(!0),onResize:v=>{Ne(!0);const L=q.current;(!L||L.width!==v.width||L.height!==v.height)&&(q.current=v,de(v))},onDecoderReady:v=>{var W;P.current=v;const L=v.surface;L.style.display="block",L.style.width="100%",L.style.height="100%",L.style.objectFit="fill",(W=N.current)==null||W.appendChild(L)}});const Ae=s.useCallback(()=>{var I;const v=V.current,L=(I=P.current)==null?void 0:I.surface,W=q.current;if(!v||!L||!W)return;const j=v.getContext("2d");if(!j)return;const te=W.width,H=W.height,u=v.width>v.height!=te>H;j.save(),u&&(j.translate(v.width,0),j.rotate(Math.PI/2)),j.drawImage(L,0,0,te,H);const x=Math.max(te,H),h=x>At?x/At:1,k=Qe*h,_=ut*h,w=Z.current;if(w)for(const G of[w.f0,w.f1]){const pe=G.x*te,Le=G.y*H;T.current?(j.beginPath(),j.arc(pe,Le,_,0,Math.PI*2),j.fillStyle="rgba(255,255,255,0.92)",j.fill(),j.strokeStyle="rgba(0,0,0,0.2)",j.lineWidth=h,j.stroke()):(j.beginPath(),j.arc(pe,Le,k,0,Math.PI*2),j.strokeStyle="rgba(0,0,0,0.3)",j.lineWidth=3*h,j.stroke(),j.beginPath(),j.arc(pe,Le,k,0,Math.PI*2),j.strokeStyle="rgba(255,255,255,0.65)",j.lineWidth=1.5*h,j.stroke())}const M=ge.current;if(M){const G=M.x*te,pe=M.y*H,Le=ue.current,xt=xe.current;if(Le==="down")j.beginPath(),j.arc(G,pe,_,0,Math.PI*2),j.fillStyle="rgba(255,255,255,0.92)",j.fill(),j.strokeStyle="rgba(0,0,0,0.2)",j.lineWidth=h,j.stroke();else if(Le==="release"&&xt){const ct=Math.min((performance.now()-xt.startTime)/350,1);j.beginPath(),j.arc(G,pe,_+26*h*ct,0,Math.PI*2),j.strokeStyle=`rgba(255,255,255,${(1-ct)*.55})`,j.lineWidth=1.5*h,j.stroke(),ct>=1&&(ue.current="idle",xe.current=null)}else j.beginPath(),j.arc(G,pe,k,0,Math.PI*2),j.strokeStyle="rgba(0,0,0,0.3)",j.lineWidth=3*h,j.stroke(),j.beginPath(),j.arc(G,pe,k,0,Math.PI*2),j.strokeStyle="rgba(255,255,255,0.65)",j.lineWidth=1.5*h,j.stroke()}j.restore()},[V]),Pe=s.useCallback(()=>{var te;const v=(te=P.current)==null?void 0:te.surface,L=q.current;if(!v||!L)return;const W=document.createElement("canvas"),j=W.getContext("2d");j&&(W.width=L.width,W.height=L.height,j.drawImage(v,0,0,L.width,L.height),W.toBlob(H=>{if(!H)return;const u=URL.createObjectURL(H),x=document.createElement("a");x.href=u,x.download=`tapflow-${Date.now()}.png`,x.click(),URL.revokeObjectURL(u)},"image/png"))},[]),Ve=s.useCallback(()=>{if(z==="idle"){const v=V.current;if(!v)return;const L=q.current;if(!L)return;const W=Ke.current;v.width=W?L.height:L.width,v.height=W?L.width:L.height,Y(Ae)}else z==="recording"&&ce()},[z,Y,ce,Ae,V]),He=s.useCallback(()=>{r({type:"input:rotate",sessionId:t}),F(v=>!v)},[r,t]),at=s.useRef(fe);s.useEffect(()=>{at.current=fe},[fe]),s.useEffect(()=>()=>{at.current&&r({type:"input:rotate",sessionId:t})},[]);const it=s.useCallback((v,L)=>{r({type:"input:key",sessionId:t,payload:{code:v,modifiers:L}})},[r,t]);_n({sessionId:t,send:r,active:O,supported:S,handlerRef:y,sendChord:it,onError:v=>Me.error(v)}),s.useEffect(()=>{const v=new Set(["ShiftLeft","ShiftRight","ControlLeft","ControlRight","MetaLeft","MetaRight"]),L=H=>{if(H.code==="AltLeft"||H.code==="AltRight"){$.current=!0;return}if(H.metaKey){const x=document.activeElement;if(!x||x.tagName!=="INPUT"&&x.tagName!=="TEXTAREA"){if(!H.shiftKey&&H.code==="KeyK"){H.preventDefault(),me(!0);return}if(!H.shiftKey&&H.code==="KeyS"){H.preventDefault(),Pe();return}if(H.shiftKey&&H.code==="KeyY"){H.preventDefault(),Ve();return}if(H.shiftKey&&H.code==="KeyO"){H.preventDefault(),He();return}}}if(!O||v.has(H.code)||S&&Ft(H))return;H.preventDefault();const u=(H.shiftKey?2:0)|(H.ctrlKey?1:0)|(H.metaKey?8:0);r({type:"input:key",sessionId:t,payload:{code:H.code,modifiers:u}})},W=()=>{T.current&&(T.current=!1,ae(!1),r({type:"input:pinch:end",sessionId:t})),$.current=!1,Q(null)},j=H=>{(H.code==="AltLeft"||H.code==="AltRight")&&W()},te=()=>{$.current&&W()};return window.addEventListener("keydown",L),window.addEventListener("keyup",j),window.addEventListener("blur",te),()=>{window.removeEventListener("keydown",L),window.removeEventListener("keyup",j),window.removeEventListener("blur",te)}},[O,S,r,t,Pe,Ve,He]),s.useEffect(()=>{if(!O)return;const v=L=>{const W=U.current??N.current;W&&!W.contains(L.target)&&se(!1)};return document.addEventListener("pointerdown",v),()=>document.removeEventListener("pointerdown",v)},[O]);const Ke=s.useRef(!1),Se=s.useCallback(v=>{const L=N.current;if(!L)return null;const W=L.getBoundingClientRect();return Us({x:v.clientX,y:v.clientY},W,Ke.current)},[]),Fe=s.useCallback(v=>{const L=Se(v);return L?En(L):null},[Se]),kt=s.useCallback(v=>{if($.current){const te=Fe(v);if(!te)return;T.current=!0,ae(!0),v.target.setPointerCapture(v.pointerId);const H=ee.current;H&&(H.style.display="none"),Q(te),r({type:"input:pinch:start",sessionId:t,payload:te});return}const L=Se(v);if(!L)return;se(!0),X.current=L,v.target.setPointerCapture(v.pointerId);const W=v.currentTarget.getBoundingClientRect();ge.current=L,ue.current="down",xe.current=null;const j=ee.current;j&&(j.style.display="block",j.style.left=`${v.clientX-W.left}px`,j.style.top=`${v.clientY-W.top}px`,j.style.width=`${ut*2}px`,j.style.height=`${ut*2}px`,j.style.background="rgba(255,255,255,0.92)",j.style.border="1.5px solid rgba(0,0,0,0.2)",j.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:L})},[Se,Fe,r,t]),De=s.useCallback(v=>{if(v.buttons===0){if($.current){Q(Fe(v)),ge.current=null;const _=ee.current;_&&(_.style.display="none");return}const x=Se(v),h=v.currentTarget.getBoundingClientRect(),k=ee.current;x?(ge.current=x,ue.current!=="down"&&(ue.current="idle"),k&&(k.style.display="block",k.style.left=`${v.clientX-h.left}px`,k.style.top=`${v.clientY-h.top}px`,k.style.width=`${Qe*2}px`,k.style.height=`${Qe*2}px`,k.style.background="transparent",k.style.border="1.5px solid rgba(255,255,255,0.6)",k.style.boxShadow="0 0 0 1px rgba(0,0,0,0.3)")):(ge.current=null,k&&(k.style.display="none"));return}if(T.current){const x=Fe(v);if(!x)return;const h=performance.now();if(h-re.current<on)return;re.current=h,Q(x),r({type:"input:pinch:move",sessionId:t,payload:x});return}if(!X.current)return;const L=Se(v);if(!L)return;const W=L.x-X.current.x,j=L.y-X.current.y;if(Math.sqrt(W*W+j*j)<so)return;const te=performance.now();if(te-re.current<on)return;re.current=te;const H=v.currentTarget.getBoundingClientRect();ge.current=L;const u=ee.current;u&&u.style.display!=="none"&&(u.style.left=`${v.clientX-H.left}px`,u.style.top=`${v.clientY-H.top}px`),r({type:"input:touch:move",sessionId:t,payload:L})},[Se,Fe,r,t]),Xe=s.useCallback(()=>{if(T.current){T.current=!1,ae(!1),Q(null),r({type:"input:pinch:end",sessionId:t});return}X.current=null,ue.current="release",xe.current={startTime:performance.now()};const v=ee.current;v&&(v.style.width=`${Qe*2}px`,v.style.height=`${Qe*2}px`,v.style.background="transparent",v.style.border="1.5px solid rgba(255,255,255,0.6)",v.style.boxShadow="0 0 0 1px rgba(0,0,0,0.3)"),r({type:"input:touch:end",sessionId:t})},[r,t]),rt=s.useCallback(()=>{if(T.current){T.current=!1,ae(!1),Q(null),r({type:"input:pinch:end",sessionId:t});return}X.current=null,ue.current="release",xe.current={startTime:performance.now()},r({type:"input:touch:end",sessionId:t})},[r,t]),Ye=s.useCallback(()=>{Q(null),ge.current=null;const v=ee.current;v&&(v.style.display="none")},[]),be=Te??(E&&R?{width:E,height:R}:null),mt=be?Math.min(1,At/Math.max(be.width,be.height)):.3,Be=be?Math.round(be.width*mt):324,Ge=be?Math.round(be.height*mt):720,Et=be?be.width>be.height:!1,Oe=fe&&!Et;s.useLayoutEffect(()=>{Ke.current=Oe},[Oe]);const gt=Oe?Ge:Be,Xt=Oe?Be:Ge,st=A!=null?Math.round(A*Be):22,qe=Oe?{position:"absolute",width:Be,height:Ge,top:(Be-Ge)/2,left:(Ge-Be)/2,transform:"rotate(90deg)",transformOrigin:"center center",visibility:Ee?"visible":"hidden",cursor:"none"}:{visibility:Ee?"visible":"hidden",cursor:"none"},Je=n.jsx(n.Fragment,{children:d==null?void 0:d.map(v=>n.jsxs(Re,{children:[n.jsx(je,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>r({type:"input:button",sessionId:t,payload:{name:v.name}}),children:v.name==="back"?n.jsx(Cr,{className:"h-4 w-4"}):v.name==="recent_apps"?n.jsx(Zn,{className:"h-4 w-4"}):v.name==="volume_up"?n.jsx(es,{className:"h-4 w-4"}):v.name==="volume_down"?n.jsx(ns,{className:"h-4 w-4"}):v.name==="power"?n.jsx(Wr,{className:"h-4 w-4"}):n.jsx(yn,{className:"h-4 w-4"})})}),n.jsx(Ce,{side:"left",children:v.accessibilityTitle})]},v.name))}),ot=f&&e?n.jsxs(Re,{children:[n.jsx(je,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:"h-8 w-8",disabled:m||c,"aria-label":"Launch app",onClick:()=>{g(!0),r({type:"app:launch",sessionId:t,buildId:e})},children:m?n.jsx(Rt,{className:"h-4 w-4 animate-spin"}):n.jsx(pn,{className:"h-4 w-4"})})}),n.jsx(Ce,{side:"left",children:m?"Launching…":c?"Installing…":"Launch app"})]}):null;return n.jsxs("div",{className:"flex items-start justify-center gap-16",children:[n.jsx("canvas",{ref:V,style:{display:"none"}}),n.jsx(kn,{open:ke,onOpenChange:me,sessionId:t,send:r}),n.jsx(Rn,{joined:i,onDeepLink:()=>me(!0),onScreenshot:Pe,onRecordToggle:Ve,recordState:z,onRotate:He,platformSlot:Je,launchSlot:ot}),n.jsxs("div",{className:"flex items-start gap-8",children:[n.jsx("div",{style:{background:"#1c1c1e",borderRadius:`${st+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:U,className:"relative",style:{width:gt,height:Xt,backgroundColor:"#010101",borderRadius:`${st}px`,overflow:"hidden"},children:ve?n.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-4 text-center",children:n.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontSize:"0.875rem"},children:["이 환경에서는 스트리밍을 표시할 수 없습니다.",n.jsx("br",{}),"Chrome/Edge 또는 HTTPS 환경에서 다시 시도해 주세요."]})}):n.jsxs(n.Fragment,{children:[n.jsx("div",{ref:N,className:Oe?void 0:"block w-full h-full",style:qe,onPointerDown:kt,onPointerMove:De,onPointerUp:Xe,onPointerCancel:rt,onPointerLeave:Ye}),!Ee&&n.jsx("div",{className:"absolute inset-0 animate-pulse bg-zinc-700"}),!Ee&&a&&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:ee,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"}}),le&&n.jsx(n.Fragment,{children:[le.f0,le.f1].map((v,L)=>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:`${v.x*100}%`,top:`${v.y*100}%`,...he?{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:Qe*2,height:Qe*2,background:"transparent",border:"1.5px solid rgba(255,255,255,0.6)",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)"}}},L))})]})})}),n.jsx(Ht,{joined:i,fps:K,connected:o,deviceReady:a,bootError:p,installing:c,installError:l,keyboardActive:O})]})]})}function ao(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 f=0;f<e;f++){const l=r.getInt16((c*e+f)*2,!0);a[f][c]=l/32768}return a}const io=44100,_t=2,an=.06,co=.3;function lo(){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 d;const a=r();if(!a)return;a.state==="suspended"&&a.resume();const c=ao(i,_t),f=((d=c[0])==null?void 0:d.length)??0;if(f===0)return;const l=a.createBuffer(_t,f,io);for(let b=0;b<_t;b++)l.getChannelData(b).set(c[b]);const p=a.createBufferSource();p.buffer=l,p.connect(a.destination);const m=a.currentTime;let g=e.current;(g<m+.005||g>m+co+an)&&(g=m+an),p.start(g),e.current=g+l.duration},[r]);return s.useEffect(()=>()=>{var i;(i=t.current)==null||i.close(),t.current=null},[]),{pushFrame:o}}function uo({sessionId:t,deviceId:e,buildId:r,resetMode:o,onRecordingUploaded:i,onSessionEnded:a}){const c=s.useRef(()=>{}),f=s.useRef(!1),l=s.useRef({pending:0,appInstalled:!1});as();const p=s.useRef(null),m=s.useRef(null),g=s.useRef([]);s.useRef({onFrameBegin:()=>{var T;return(T=p.current)==null?void 0:T.onFrameBegin()},onFrameEnd:T=>{var re,ee;const $=g.current.shift()??null,X=$?{...T,capturedAt:$.capturedAt,relayedAt:$.relayedAt}:T;(re=p.current)==null||re.onFrameEnd(X),(ee=m.current)==null||ee.call(m,X)}});const[d,b]=s.useState(!1),[y,S]=s.useState(!1),[D,E]=s.useState(!1),[R,A]=s.useState(null),[C,N]=s.useState(!1),[U,P]=s.useState(!1),[K,J]=s.useState(null),[z,V]=s.useState(null),[Y,ce]=s.useState(!1),[ke,me]=s.useState([]),[Ee,Ne]=s.useState(!1),[ve,we]=s.useState(!1),q=s.useRef(void 0),Te=s.useRef(void 0),{pushFrame:de}=lo(),fe=s.useCallback(T=>{var $;if(!("sessionId"in T&&T.sessionId&&T.sessionId!==t)){if(T.type==="session:joined"){l.current={pending:0,appInstalled:!1},b(!0),S(!1),me(T.capabilities??[]);const X=f.current?"app-only":o;f.current=!0,c.current({type:"device:boot",sessionId:t,payload:{deviceId:e,resetMode:X,acceptH264:en(),secureContext:window.isSecureContext}})}if(T.type==="session:agent-away"){S(!0),A(null),E(!1);return}if(T.type==="session:terminated"){a==null||a(T.reason);return}if(T.type==="session:rebound"){E(!1),A(null),N(!1),J(null),V(null),ce(!1),we(!1),Ne(!1),g.current=[],me(T.capabilities);const X=y;S(!1),l.current={pending:l.current.pending+1,appInstalled:l.current.pending>0?l.current.appInstalled:U},f.current=!0,c.current({type:"device:boot",sessionId:t,payload:{deviceId:e,resetMode:"app-only",acceptH264:en(),secureContext:window.isSecureContext}}),X||Me.info("The agent restarted — reconnecting to the device.");return}if(T.type==="device:boot-error"){if(y)return;l.current={pending:0,appInstalled:!1},V(T.message)}if(T.type==="device:booting"&&(E(!1),N(!1),P(!1),J(null),V(null),A(null)),T.type==="device:ready"){if(E(!0),l.current.pending>0){const{appInstalled:X}=l.current;if(l.current={pending:l.current.pending-1,appInstalled:X},X){P(!0);return}}r&&(N(!0),c.current({type:"app:install",sessionId:t,buildId:r}))}if(T.type==="app:install-done"&&(N(!1),P(!0)),T.type==="app:install-error"&&(N(!1),J(T.message)),T.type==="app:launch-done"&&ce(!1),T.type==="app:launch-error"&&ce(!1),T.type==="session:chrome"&&A(T.payload),T.type==="keyboard:toggled"){const{visible:X}=T.payload;Ne(X),we(!1)}if((T.type==="clipboard:data"||T.type==="clipboard:write-done"||T.type==="clipboard:error")&&(($=Te.current)==null||$.call(Te,T)),T.type==="open-url:done"&&Me.success("Deeplink opened"),T.type==="open-url:error"&&Me.error(T.message),T.type==="error"&&T.message==="Session not found"){a==null||a("agent-disconnected");return}T.type==="error"&&T.message==="Agent resources exhausted"&&Me.error("Could not start session — this Mac is currently overloaded.",{description:"Go back and select a different Mac."})}},[t,e,r,a,o,U,y]),F=s.useCallback(T=>{var ee;const $=Ws(T);if($&&$.codec===Tn){de(T.slice(Lt));return}$&&$.codec===jt||g.current.push($);const X=$?T.slice(Lt):T,re=$?{codec:$.codec,keyframe:$.keyframe,capturedAt:$.capturedAt,relayedAt:$.relayedAt}:void 0;(ee=q.current)==null||ee.call(q,X,re)},[de]),{send:O,connected:se}=mn(fe,F);s.useLayoutEffect(()=>{c.current=O}),s.useEffect(()=>{se&&O({type:"session:start",sessionId:t})},[se,O,t]);const he=R!==null&&"framePng"in R?R:null,ae=R!==null&&!("framePng"in R)?R:null,le=()=>{we(!0),O({type:"input:keyboard:toggle",sessionId:t})},Q={sessionId:t,buildId:r,send:O,connected:se,joined:d,deviceReady:D,installing:C,installed:U,installError:K,bootError:z,launching:Y,setLaunching:ce,binaryFrameHandlerRef:q,clipboardHandlerRef:Te,clipboardSupported:ke.includes("clipboard"),onRecordingUploaded:i,swKeyboardVisible:Ee,swKeyboardPending:ve,onKbdToggle:le};if(!he&&!ae)return n.jsxs("div",{className:"flex items-start justify-center gap-16",children:[n.jsx("div",{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((T,$)=>n.jsx("div",{className:"h-8 w-8 rounded-md bg-muted animate-pulse"},$))}),n.jsxs("div",{className:"flex items-start gap-8",children:[n.jsx("div",{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(Ht,{joined:d,fps:0,connected:se,deviceReady:D,bootError:z,installing:C,installError:K,keyboardActive:!1,agentAway:y})]})]});const Z=void 0;return n.jsxs(n.Fragment,{children:[he&&n.jsx(ro,{...Q,chrome:he,perfHookRef:Z}),ae&&n.jsx(oo,{...Q,androidButtons:ae.buttons,screenWidth:ae.screenWidth,screenHeight:ae.screenHeight,cornerRadius:ae.cornerRadius,perfHookRef:Z}),!1]})}const Nn=s.forwardRef(({className:t,...e},r)=>n.jsx("textarea",{className:ne("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}));Nn.displayName="Textarea";var fo=Object.defineProperty,B=(t,e)=>fo(t,"name",{value:e,configurable:!0});function Pn(t,e){return s.useReducer((r,o)=>e[r][o]??r,t)}B(Pn,"useStateMachine");var Dn="ScrollArea",[Ln,ra]=hn(Dn),[ho,ye]=Ln(Dn),po=s.forwardRef(B(function(e,r){const{__scopeScrollArea:o,type:i="hover",dir:a,scrollHideDelay:c=600,...f}=e,[l,p]=s.useState(null),[m,g]=s.useState(null),[d,b]=s.useState(null),[y,S]=s.useState(null),[D,E]=s.useState(null),[R,A]=s.useState(0),[C,N]=s.useState(0),[U,P]=s.useState(!1),[K,J]=s.useState(!1),z=ze(r,p),V=er(a);return n.jsx(ho,{scope:o,type:i,dir:V,scrollHideDelay:c,scrollArea:l,viewport:m,onViewportChange:g,content:d,onContentChange:b,scrollbarX:y,onScrollbarXChange:S,scrollbarXEnabled:U,onScrollbarXEnabledChange:P,scrollbarY:D,onScrollbarYChange:E,scrollbarYEnabled:K,onScrollbarYEnabledChange:J,onCornerWidthChange:A,onCornerHeightChange:N,children:n.jsx(We.div,{dir:V,...f,ref:z,style:{position:"relative","--radix-scroll-area-corner-width":R+"px","--radix-scroll-area-corner-height":C+"px",...e.style}})})},"ScrollArea")),mo="ScrollAreaViewport",go=s.forwardRef(B(function(e,r){const{__scopeScrollArea:o,children:i,nonce:a,...c}=e,f=ye(mo,o),l=s.useRef(null),p=ze(r,l,f.onViewportChange);return n.jsxs(n.Fragment,{children:[n.jsx(xo,{nonce:a}),n.jsx(We.div,{"data-radix-scroll-area-viewport":"",...c,ref:p,style:{overflowX:f.scrollbarXEnabled?"scroll":"hidden",overflowY:f.scrollbarYEnabled?"scroll":"hidden",...e.style},children:n.jsx("div",{ref:f.onContentChange,style:{minWidth:"100%",display:"table"},children:i})})]})},"ScrollAreaViewport")),xo=s.memo(B(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),Ue="ScrollAreaScrollbar",Mn=s.forwardRef(B(function(e,r){const{forceMount:o,...i}=e,a=ye(Ue,e.__scopeScrollArea),{onScrollbarXEnabledChange:c,onScrollbarYEnabledChange:f}=a,l=e.orientation==="horizontal";return s.useEffect(()=>(l?c(!0):f(!0),()=>{l?c(!1):f(!1)}),[l,c,f]),a.type==="hover"?n.jsx(bo,{...i,ref:r,forceMount:o}):a.type==="scroll"?n.jsx(yo,{...i,ref:r,forceMount:o}):a.type==="auto"?n.jsx(In,{...i,ref:r,forceMount:o}):a.type==="always"?n.jsx(Bt,{...i,ref:r,"data-state":"visible"}):null},"ScrollAreaScrollbar")),bo=s.forwardRef(B(function(e,r){const{forceMount:o,...i}=e,a=ye(Ue,e.__scopeScrollArea),[c,f]=s.useState(!1);return s.useEffect(()=>{const l=a.scrollArea;let p=0;if(l){const m=B(()=>{window.clearTimeout(p),f(!0)},"handlePointerEnter"),g=B(()=>{p=window.setTimeout(()=>f(!1),a.scrollHideDelay)},"handlePointerLeave");return l.addEventListener("pointerenter",m),l.addEventListener("pointerleave",g),()=>{window.clearTimeout(p),l.removeEventListener("pointerenter",m),l.removeEventListener("pointerleave",g)}}},[a.scrollArea,a.scrollHideDelay]),n.jsx(Ct,{present:o||c,children:n.jsx(In,{"data-state":c?"visible":"hidden",...i,ref:r})})},"ScrollAreaScrollbarHover")),yo=s.forwardRef(B(function(e,r){const{forceMount:o,...i}=e,a=ye(Ue,e.__scopeScrollArea),c=e.orientation==="horizontal",f=pt(()=>p("SCROLL_END"),100),[l,p]=Pn("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(l==="idle"){const m=window.setTimeout(()=>p("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(m)}},[l,a.scrollHideDelay,p]),s.useEffect(()=>{const m=a.viewport,g=c?"scrollLeft":"scrollTop";if(m){let d=m[g];const b=B(()=>{const y=m[g];d!==y&&(p("SCROLL"),f()),d=y},"handleScroll");return m.addEventListener("scroll",b),()=>m.removeEventListener("scroll",b)}},[a.viewport,c,p,f]),n.jsx(Ct,{present:o||l!=="hidden",children:n.jsx(Bt,{"data-state":l==="hidden"?"hidden":"visible",...i,ref:r,onPointerEnter:Ie(e.onPointerEnter,()=>p("POINTER_ENTER")),onPointerLeave:Ie(e.onPointerLeave,()=>p("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),In=s.forwardRef(B(function(e,r){const o=ye(Ue,e.__scopeScrollArea),{forceMount:i,...a}=e,[c,f]=s.useState(!1),l=e.orientation==="horizontal",p=pt(()=>{if(o.viewport){const m=o.viewport.offsetWidth<o.viewport.scrollWidth,g=o.viewport.offsetHeight<o.viewport.scrollHeight;f(l?m:g)}},10);return nt(o.viewport,p),nt(o.content,p),n.jsx(Ct,{present:i||c,children:n.jsx(Bt,{"data-state":c?"visible":"hidden",...a,ref:r})})},"ScrollAreaScrollbarAuto")),Bt=s.forwardRef(B(function(e,r){const{orientation:o="vertical",...i}=e,a=ye(Ue,e.__scopeScrollArea),c=s.useRef(null),f=s.useRef(0),[l,p]=s.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),m=Ot(l.viewport,l.content),g={...i,sizes:l,onSizesChange:p,hasThumb:m>0&&m<1,onThumbChange:B(b=>c.current=b,"onThumbChange"),onThumbPointerUp:B(()=>f.current=0,"onThumbPointerUp"),onThumbPointerDown:B(b=>f.current=b,"onThumbPointerDown")};function d(b,y){return Bn(b,f.current,l,y)}return B(d,"getScrollPosition"),o==="horizontal"?n.jsx(vo,{...g,ref:r,onThumbPositionChange:()=>{if(a.viewport&&c.current){const b=a.viewport.scrollLeft,y=It(b,l,a.dir);c.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:b=>{a.viewport&&(a.viewport.scrollLeft=b)},onDragScroll:b=>{a.viewport&&(a.viewport.scrollLeft=d(b,a.dir))}}):o==="vertical"?n.jsx(wo,{...g,ref:r,onThumbPositionChange:()=>{if(a.viewport&&c.current){const b=a.viewport.scrollTop,y=It(b,l);c.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:b=>{a.viewport&&(a.viewport.scrollTop=b)},onDragScroll:b=>{a.viewport&&(a.viewport.scrollTop=d(b))}}):null},"ScrollAreaScrollbarVisible")),vo=s.forwardRef(B(function(e,r){const{sizes:o,onSizesChange:i,...a}=e,c=ye(Ue,e.__scopeScrollArea),[f,l]=s.useState(),p=s.useRef(null),m=ze(r,p,c.onScrollbarXChange);return s.useEffect(()=>{p.current&&l(getComputedStyle(p.current))},[p]),n.jsx(Hn,{"data-orientation":"horizontal",...a,ref:m,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":ht(o)+"px",...e.style},onThumbPointerDown:g=>e.onThumbPointerDown(g.x),onDragScroll:g=>e.onDragScroll(g.x),onWheelScroll:(g,d)=>{if(c.viewport){const b=c.viewport.scrollLeft+g.deltaX;e.onWheelScroll(b),zt(b,d)&&g.preventDefault()}},onResize:()=>{p.current&&c.viewport&&f&&i({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:p.current.clientWidth,paddingStart:ft(f.paddingLeft),paddingEnd:ft(f.paddingRight)}})}})},"ScrollAreaScrollbarX")),wo=s.forwardRef(B(function(e,r){const{sizes:o,onSizesChange:i,...a}=e,c=ye(Ue,e.__scopeScrollArea),[f,l]=s.useState(),p=s.useRef(null),m=ze(r,p,c.onScrollbarYChange);return s.useEffect(()=>{p.current&&l(getComputedStyle(p.current))},[p]),n.jsx(Hn,{"data-orientation":"vertical",...a,ref:m,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":ht(o)+"px",...e.style},onThumbPointerDown:g=>e.onThumbPointerDown(g.y),onDragScroll:g=>e.onDragScroll(g.y),onWheelScroll:(g,d)=>{if(c.viewport){const b=c.viewport.scrollTop+g.deltaY;e.onWheelScroll(b),zt(b,d)&&g.preventDefault()}},onResize:()=>{p.current&&c.viewport&&f&&i({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:p.current.clientHeight,paddingStart:ft(f.paddingTop),paddingEnd:ft(f.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[So,Un]=Ln(Ue),Hn=s.forwardRef(B(function(e,r){const{__scopeScrollArea:o,sizes:i,hasThumb:a,onThumbChange:c,onThumbPointerUp:f,onThumbPointerDown:l,onThumbPositionChange:p,onDragScroll:m,onWheelScroll:g,onResize:d,...b}=e,y=ye(Ue,o),[S,D]=s.useState(null),E=ze(r,D),R=s.useRef(null),A=s.useRef(""),C=y.viewport,N=i.content-i.viewport,U=tt(g),P=tt(p),K=pt(d,10);function J(z){if(R.current){const V=z.clientX-R.current.left,Y=z.clientY-R.current.top;m({x:V,y:Y})}}return B(J,"handleDragScroll"),s.useEffect(()=>{const z=B(V=>{const Y=V.target;(S==null?void 0:S.contains(Y))&&U(V,N)},"handleWheel");return document.addEventListener("wheel",z,{passive:!1}),()=>document.removeEventListener("wheel",z,{passive:!1})},[C,S,N,U]),s.useEffect(P,[i,P]),nt(S,K),nt(y.content,K),n.jsx(So,{scope:o,scrollbar:S,hasThumb:a,onThumbChange:tt(c),onThumbPointerUp:tt(f),onThumbPositionChange:P,onThumbPointerDown:tt(l),children:n.jsx(We.div,{...b,ref:E,style:{position:"absolute",...b.style},onPointerDown:Ie(e.onPointerDown,z=>{z.button===0&&(z.target.setPointerCapture(z.pointerId),R.current=S.getBoundingClientRect(),A.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),J(z))}),onPointerMove:Ie(e.onPointerMove,J),onPointerUp:Ie(e.onPointerUp,z=>{const V=z.target;V.hasPointerCapture(z.pointerId)&&V.releasePointerCapture(z.pointerId),document.body.style.webkitUserSelect=A.current,y.viewport&&(y.viewport.style.scrollBehavior=""),R.current=null})})})},"ScrollAreaScrollbarImpl")),Mt="ScrollAreaThumb",Ro=s.forwardRef(B(function(e,r){const{forceMount:o,...i}=e,a=Un(Mt,e.__scopeScrollArea);return n.jsx(Ct,{present:o||a.hasThumb,children:n.jsx(jo,{ref:r,...i})})},"ScrollAreaThumb")),jo=s.forwardRef(B(function(e,r){const{__scopeScrollArea:o,style:i,...a}=e,c=ye(Mt,o),f=Un(Mt,o),{onThumbPositionChange:l}=f,p=ze(r,f.onThumbChange),m=s.useRef(void 0),g=pt(()=>{m.current&&(m.current(),m.current=void 0)},100);return s.useEffect(()=>{const d=c.viewport;if(d){const b=B(()=>{if(g(),!m.current){const y=Eo(d,l);m.current=y,l()}},"handleScroll");return l(),d.addEventListener("scroll",b),()=>d.removeEventListener("scroll",b)}},[c.viewport,g,l]),n.jsx(We.div,{"data-state":f.hasThumb?"visible":"hidden",...a,ref:p,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...i},onPointerDownCapture:Ie(e.onPointerDownCapture,d=>{const y=d.target.getBoundingClientRect(),S=d.clientX-y.left,D=d.clientY-y.top;f.onThumbPointerDown({x:S,y:D})}),onPointerUp:Ie(e.onPointerUp,f.onThumbPointerUp)})},"ScrollAreaThumbImpl")),Fn="ScrollAreaCorner",Co=s.forwardRef(B(function(e,r){const o=ye(Fn,e.__scopeScrollArea),i=!!(o.scrollbarX&&o.scrollbarY);return o.type!=="scroll"&&i?n.jsx(ko,{...e,ref:r}):null},"ScrollAreaCorner")),ko=s.forwardRef(B(function(e,r){const{__scopeScrollArea:o,...i}=e,a=ye(Fn,o),[c,f]=s.useState(0),[l,p]=s.useState(0),m=!!(c&&l),{onCornerWidthChange:g,onCornerHeightChange:d}=a;return nt(a.scrollbarX,()=>{var y;const b=((y=a.scrollbarX)==null?void 0:y.offsetHeight)||0;a.onCornerHeightChange(b),p(b)}),nt(a.scrollbarY,()=>{var y;const b=((y=a.scrollbarY)==null?void 0:y.offsetWidth)||0;a.onCornerWidthChange(b),f(b)}),s.useEffect(()=>()=>{g(0),d(0)},[g,d]),m?n.jsx(We.div,{...i,ref:r,style:{width:c,height:l,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null},"ScrollAreaCornerImpl"));function ft(t){return t?parseInt(t,10):0}B(ft,"toInt");function Ot(t,e){const r=t/e;return isNaN(r)?0:r}B(Ot,"getThumbRatio");function ht(t){const e=Ot(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=(t.scrollbar.size-r)*e;return Math.max(o,18)}B(ht,"getThumbSize");function Bn(t,e,r,o="ltr"){const i=ht(r),a=i/2,c=e||a,f=i-c,l=r.scrollbar.paddingStart+c,p=r.scrollbar.size-r.scrollbar.paddingEnd-f,m=r.content-r.viewport,g=o==="ltr"?[0,m]:[m*-1,0];return $t([l,p],g)(t)}B(Bn,"getScrollPositionFromPointer");function It(t,e,r="ltr"){const o=ht(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,a=e.scrollbar.size-i,c=e.content-e.viewport,f=a-o,l=r==="ltr"?[0,c]:[c*-1,0],p=br(t,l);return $t([0,c],[0,f])(p)}B(It,"getThumbOffsetFromScroll");function $t(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])}}B($t,"linearScale");function zt(t,e){return t>0&&t<e}B(zt,"isScrollingWithinScrollbarBounds");var Eo=B((t,e=()=>{})=>{let r={left:t.scrollLeft,top:t.scrollTop},o=0;return B((function i(){const a={left:t.scrollLeft,top:t.scrollTop},c=r.left!==a.left,f=r.top!==a.top;(c||f)&&e(),r=a,o=window.requestAnimationFrame(i)}),"loop")(),()=>window.cancelAnimationFrame(o)},"addUnlinkedScrollListener");function pt(t,e){const r=tt(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])}B(pt,"useDebounceCallback");function nt(t,e){const r=tt(e);Qn(()=>{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])}B(nt,"useResizeObserver");var On=po,To=go,Ao=Co;const $n=s.forwardRef(({className:t,children:e,...r},o)=>n.jsxs(On,{ref:o,className:ne("relative overflow-hidden",t),...r,children:[n.jsx(To,{className:"h-full w-full rounded-[inherit]",children:e}),n.jsx(zn,{}),n.jsx(Ao,{})]}));$n.displayName=On.displayName;const zn=s.forwardRef(({className:t,orientation:e="vertical",...r},o)=>n.jsx(Mn,{ref:o,orientation:e,className:ne("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(Ro,{className:"relative flex-1 rounded-full bg-border"})}));zn.displayName=Mn.displayName;function Wn(t){return/[Zz]|[+-]\d{2}/.test(t)?new Date(t):new Date(t.replace(" ","T")+"Z")}function _o(t){const e=new Map;for(const i of t){const a=Wn(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 f=new Date(i);c=f.toLocaleDateString(void 0,{month:"short",day:"numeric",...f.getFullYear()!==new Date().getFullYear()?{year:"numeric"}:{}})}return{label:c,items:a}})}function No(t){return Wn(t).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}const Po=5*1024*1024,Do=["image/png","image/jpeg","image/webp"];function Lo({buildId:t}){const[e,r]=s.useState([]),[o,i]=s.useState(""),[a,c]=s.useState(null),[f,l]=s.useState(!1),[p,m]=s.useState(""),g=s.useRef(null),d=s.useRef({}),b=s.useCallback(()=>{fetch(`/api/v1/comments?build_id=${t}`,{credentials:"include"}).then(R=>R.ok?R.json():[]).then(r)},[t]);s.useEffect(()=>{b()},[b]),s.useEffect(()=>{const R=window.location.hash;if(!R.startsWith("#comment-"))return;const A=Number(R.replace("#comment-","")),C=d.current[A];if(!C)return;C.scrollIntoView({behavior:"smooth"});const N=document.documentElement.classList.contains("dark");C.style.backgroundColor=N?"rgb(0 112 243 / 0.18)":"#d3e5ff",setTimeout(()=>{C.style.backgroundColor=""},2e3)},[e]);function y(R){const A=`${location.origin}${location.pathname}${location.search}#comment-${R}`;navigator.clipboard.writeText(A).then(()=>Me.success("Link copied")).catch(()=>Me.error("Could not copy link"))}function S(R){if(m(""),!Do.includes(R.type)){m("Only png, jpg, webp allowed");return}if(R.size>Po){m("Max 5MB");return}c(R)}async function D(R){if(R.preventDefault(),!o.trim()&&!a)return;l(!0);const A=new FormData;A.append("build_id",String(t)),A.append("body",o),a&&A.append("attachment",a),(await fetch("/api/v1/comments",{method:"POST",credentials:"include",body:A})).ok&&(i(""),c(null),b()),l(!1)}const E=_o(e);return n.jsxs("div",{className:"flex h-full flex-col gap-3 px-1",children:[n.jsx($n,{className:"flex-1 rounded-md border",children:n.jsx("div",{className:"p-3",children:e.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:E.map(({label:R,items:A})=>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:R}),n.jsx("div",{className:"h-px flex-1 bg-border"})]}),n.jsx("div",{className:"flex flex-col gap-4",children:A.map(C=>n.jsxs("div",{id:`comment-${C.id}`,ref:N=>{d.current[C.id]=N},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(tr,{name:C.author,avatarUrl:C.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:C.author}),n.jsx("span",{className:"text-[11px] text-muted-foreground leading-none",children:No(C.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 transition-opacity",onClick:()=>y(C.id),children:n.jsx(vn,{className:"h-3 w-3"})})]}),n.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap mt-1",children:C.body}),C.attachments.map(N=>n.jsx("a",{href:N.file_path,target:"_blank",rel:"noreferrer",className:"mt-1.5 block",children:n.jsx("img",{src:N.file_path,alt:"attachment",className:"max-h-48 rounded border object-contain"})},N.id))]})]},C.id))})]},R))})})}),n.jsx("div",{className:"pb-1",children:n.jsx("form",{onSubmit:D,children:n.jsxs("div",{className:"rounded-xl 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(Nn,{placeholder:"Leave a comment…",value:o,onChange:R=>i(R.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"}),(a||p)&&n.jsxs("div",{className:"px-3 -mt-1 pb-1",children:[a&&n.jsx("p",{className:"text-xs text-muted-foreground",children:a.name}),p&&n.jsx("p",{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",onClick:()=>{var R;return(R=g.current)==null?void 0:R.click()},children:n.jsx(Ir,{className:"h-4 w-4"})}),n.jsx("input",{ref:g,type:"file",accept:"image/png,image/jpeg,image/webp",className:"hidden",onChange:R=>{var C;const A=(C=R.target.files)==null?void 0:C[0];A&&S(A)}}),n.jsx("div",{className:"flex-1"}),n.jsx(ie,{type:"submit",size:"icon",className:"h-7 w-7 rounded-full",disabled:f||!o.trim()&&!a,children:n.jsx(Er,{className:"h-3.5 w-3.5"})})]})]})})})]})}function Mo(t){return t<1024*1024?`${(t/1024).toFixed(0)} KB`:`${(t/1024/1024).toFixed(1)} MB`}function Io(t){return new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Uo(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 Ho({buildId:t,refreshKey:e}){const[r,o]=s.useState([]),[i,a]=s.useState(!0),[c,f]=s.useState(!1);return s.useEffect(()=>{a(!0),f(!1);const l=setTimeout(()=>f(!0),250);return fetch(`/api/v1/recordings?buildId=${t}`,{credentials:"include"}).then(p=>p.ok?p.json():[]).then(p=>o(p)).catch(()=>o([])).finally(()=>{clearTimeout(l),a(!1)}),()=>clearTimeout(l)},[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(l=>{const p=Uo(l.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:Io(l.createdAt)}),n.jsxs("span",{className:`text-xs ${p.urgent?"text-destructive":"text-muted-foreground"}`,children:[p.label," · ",Mo(l.fileSize)]})]}),n.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 ml-2",title:"Download",onClick:()=>{const m=document.createElement("a");m.href=l.url,m.download="",m.click()},children:n.jsx(Nr,{className:"h-3.5 w-3.5"})})]},l.id)})})}function Fo({buildId:t,recordingsRefreshKey:e=0}){return n.jsxs(hr,{defaultValue:"comments",className:"flex h-full flex-col",children:[n.jsx("div",{className:"shrink-0 px-1",children:n.jsxs(pr,{className:"w-full",children:[n.jsxs(qt,{value:"comments",className:"flex-1 gap-1.5",children:[n.jsx($r,{className:"h-3.5 w-3.5"}),"Comments"]}),n.jsxs(qt,{value:"recordings",className:"flex-1 gap-1.5",children:[n.jsx(Dr,{className:"h-3.5 w-3.5"}),"Recordings"]})]})}),n.jsx(Jt,{value:"comments",className:"mt-3 min-h-0 flex-1 overflow-hidden",children:n.jsx(Lo,{buildId:t})}),n.jsx(Jt,{value:"recordings",className:"mt-3 min-h-0 flex-1 overflow-y-auto",children:n.jsx(Ho,{buildId:t,refreshKey:e})})]})}const Vn=s.forwardRef(({...t},e)=>n.jsx("nav",{ref:e,"aria-label":"breadcrumb",...t}));Vn.displayName="Breadcrumb";const Kn=s.forwardRef(({className:t,...e},r)=>n.jsx("ol",{ref:r,className:ne("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",t),...e}));Kn.displayName="BreadcrumbList";const dt=s.forwardRef(({className:t,...e},r)=>n.jsx("li",{ref:r,className:ne("inline-flex items-center gap-1.5",t),...e}));dt.displayName="BreadcrumbItem";const vt=s.forwardRef(({asChild:t,className:e,...r},o)=>{const i=t?nr:"a";return n.jsx(i,{ref:o,className:ne("transition-colors hover:text-foreground cursor-pointer",e),...r})});vt.displayName="BreadcrumbLink";const wt=s.forwardRef(({className:t,...e},r)=>n.jsx("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:ne("font-medium text-foreground",t),...e}));wt.displayName="BreadcrumbPage";const St=({children:t,className:e,...r})=>n.jsx("li",{role:"presentation","aria-hidden":"true",className:ne("[&>svg]:h-3.5 [&>svg]:w-3.5",e),...r,children:t??n.jsx(rr,{})});St.displayName="BreadcrumbSeparator";var Bo=Object.defineProperty,$e=(t,e)=>Bo(t,"name",{value:e,configurable:!0}),Wt="Switch",[Oo,sa]=hn(Wt),[$o,Vt]=Oo(Wt);function Xn(t){const{__scopeSwitch:e,checked:r,children:o,defaultChecked:i,disabled:a,form:c,name:f,onCheckedChange:l,required:p,value:m="on",internal_do_not_use_render:g}=t,[d,b]=or({prop:r,defaultProp:i??!1,onChange:l,caller:Wt}),[y,S]=s.useState(null),[D,E]=s.useState(null),R=s.useRef(!1),[A,C]=s.useReducer(P=>P+1,0),N=y?!!c||!!y.closest("form"):!0,U={checked:d,setChecked:b,disabled:a,control:y,setControl:S,name:f,form:c,value:m,hasConsumerStoppedPropagationRef:R,userInteractionCount:A,onUserInteraction:C,required:p,defaultChecked:i,isFormControl:N,bubbleInput:D,setBubbleInput:E};return n.jsx($o,{scope:e,...U,children:Gn(g)?g(U):o})}$e(Xn,"SwitchProvider");var zo="SwitchTrigger",Wo=s.forwardRef($e(function({__scopeSwitch:e,onClick:r,...o},i){const{control:a,form:c,value:f,disabled:l,checked:p,required:m,setControl:g,setChecked:d,hasConsumerStoppedPropagationRef:b,onUserInteraction:y,isFormControl:S,bubbleInput:D}=Vt(zo,e),E=ze(i,g),R=s.useRef(p);return s.useEffect(()=>{const A=c?a==null?void 0:a.ownerDocument.getElementById(c):a==null?void 0:a.form;if(A instanceof HTMLFormElement){const C=$e(()=>d(R.current),"reset");return A.addEventListener("reset",C),()=>A.removeEventListener("reset",C)}},[a,c,d]),n.jsx(We.button,{type:"button",role:"switch","aria-checked":p,"aria-required":m,"data-state":Kt(p),"data-disabled":l?"":void 0,disabled:l,value:f,...o,ref:E,onClick:Ie(r,A=>{y(),d(C=>!C),D&&S&&(b.current=A.isPropagationStopped(),b.current||A.stopPropagation())})})},"SwitchTrigger")),Yn=s.forwardRef($e(function(e,r){const{__scopeSwitch:o,name:i,checked:a,defaultChecked:c,required:f,disabled:l,value:p,onCheckedChange:m,form:g,...d}=e;return n.jsx(Xn,{__scopeSwitch:o,checked:a,defaultChecked:c,disabled:l,required:f,onCheckedChange:m,name:i,form:g,value:p,internal_do_not_use_render:({isFormControl:b})=>n.jsxs(n.Fragment,{children:[n.jsx(Wo,{...d,ref:r,__scopeSwitch:o}),b&&n.jsx(Yo,{__scopeSwitch:o})]})})},"Switch")),Vo="SwitchThumb",Ko=s.forwardRef($e(function(e,r){const{__scopeSwitch:o,...i}=e,a=Vt(Vo,o);return n.jsx(We.span,{"data-state":Kt(a.checked),"data-disabled":a.disabled?"":void 0,...i,ref:r})},"SwitchThumb")),Xo="SwitchBubbleInput",Yo=s.forwardRef($e(function({__scopeSwitch:e,onClick:r,...o},i){const{control:a,hasConsumerStoppedPropagationRef:c,userInteractionCount:f,checked:l,defaultChecked:p,required:m,disabled:g,name:d,value:b,form:y,bubbleInput:S,setBubbleInput:D}=Vt(Xo,e),E=ze(i,D),R=sr(a),A=s.useRef(!1),C=s.useRef(l),N=s.useRef(f);s.useEffect(()=>{const P=S;if(!P)return;const K=window.HTMLInputElement.prototype,z=Object.getOwnPropertyDescriptor(K,"checked").set,V=f!==N.current;N.current=f;const Y=C.current!==l;C.current=l;const ce=!(V&&c.current);if(Y&&z){A.current=!V;const ke=new Event("click",{bubbles:ce});z.call(P,l),P.dispatchEvent(ke),A.current=!1}},[S,l,c,f]);const U=s.useRef(l);return n.jsx(We.input,{type:"checkbox","aria-hidden":!0,defaultChecked:p??U.current,required:m,disabled:g,name:d,value:b,form:y,...o,tabIndex:-1,ref:E,onClick:Ie(r,P=>{A.current&&P.stopPropagation()}),style:{...o.style,...R,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function Gn(t){return typeof t=="function"}$e(Gn,"isFunction");function Kt(t){return t?"checked":"unchecked"}$e(Kt,"getState");const qn=s.forwardRef(({className:t,...e},r)=>n.jsx(Yn,{className:ne("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(Ko,{className:ne("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")})}));qn.displayName=Yn.displayName;const cn=70,ln=80;function Go(t,e){if(!t||e)return"unknown";const r=t.memUsedMB/t.memTotalMB*100;return t.cpuPercent>ln||r>ln?"overloaded":t.cpuPercent>=cn||r>=cn?"warning":"healthy"}const qo={"agent-disconnected":{title:"The agent disconnected — this session ended.",description:"Pick the Mac again to start a new session."}};function oa(){const[t]=dn(),e=ar(),r=t.get("id"),{build:o}=rs(r),[i,a]=s.useState(0),c=(o==null?void 0:o.platform)??"ios",{sessions:f,selectedAgent:l,setSelectedAgent:p,activeSessionId:m,deviceId:g,booting:d,status:b,connected:y,agentGroups:S,startDevice:D,resetDevice:E,handleBack:R,handleBackToMacs:A,handleSessionEnded:C}=ss(c),N=S.find(F=>F.agentName===l),{osVersions:U,osVersion:P,setOsVersion:K,deviceSearch:J,setDeviceSearch:z,versionedDevices:V,resetMode:Y,setResetMode:ce,appliedResetMode:ke,consumeResetMode:me,fullResetSupported:Ee}=os(N,c),ve=f.flatMap(F=>F.devices).find(F=>F.id===g),we=ve?`${ve.name}${ve.osVersion?` · ${ve.osVersion}`:""}`:"",q=s.useCallback(()=>a(F=>F+1),[]),Te=s.useCallback(F=>{me(),D(F)},[me,D]),de=s.useCallback(F=>{const O=qo[F];Me.error(O.title,{description:O.description}),C()},[C]),{setNode:fe}=ir();return s.useEffect(()=>{if(o)return fe(n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Vn,{children:n.jsxs(Kn,{children:[n.jsx(dt,{children:n.jsx(vt,{asChild:!0,children:n.jsx("button",{onClick:()=>e(`/app-center?appId=${o.app_id}`),children:o.name})})}),n.jsx(St,{}),n.jsx(dt,{children:l?n.jsx(vt,{asChild:!0,children:n.jsx("button",{onClick:A,children:Gt(o)})}):n.jsx(wt,{children:Gt(o)})}),l&&n.jsxs(n.Fragment,{children:[n.jsx(St,{}),n.jsx(dt,{children:m?n.jsx(vt,{asChild:!0,children:n.jsx("button",{onClick:R,children:l})}):n.jsx(wt,{children:l})})]}),m&&n.jsxs(n.Fragment,{children:[n.jsx(St,{}),n.jsx(dt,{children:n.jsx(wt,{children:we})})]})]})}),!l&&o.status_label&&n.jsx(Rr,{tone:dr[o.status_label],children:o.status_label})]})),()=>fe(null)},[o,l,m,we,e,R,A,fe]),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:m?n.jsx("div",{className:"min-h-full flex items-center justify-center py-6 px-8 min-w-max",children:n.jsx(uo,{sessionId:m,deviceId:g,buildId:o==null?void 0:o.id,resetMode:ke,onRecordingUploaded:q,onSessionEnded:de})}):l?n.jsxs("div",{className:"flex flex-col gap-5",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:A,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(fr,{placeholder:"Search device…",value:J,onChange:z}),U.length>0&&n.jsxs(yr,{value:P||"__all__",onValueChange:F=>{K(F==="__all__"?"":F),E()},children:[n.jsx(vr,{className:"h-8 w-36 shrink-0",children:n.jsx(wr,{})}),n.jsxs(Sr,{children:[n.jsx(Zt,{value:"__all__",children:"Any version"}),U.map(F=>n.jsx(Zt,{value:F,children:F},F))]})]}),Ee&&n.jsx(Nt,{children:n.jsxs(Re,{children:[n.jsx(je,{asChild:!0,children:n.jsxs("div",{className:"ml-auto flex items-center gap-2 shrink-0",children:[n.jsx(cr,{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(qn,{id:"reset-mode","aria-describedby":"reset-mode-desc",checked:Y==="full-erase",onCheckedChange:F=>ce(F?"full-erase":"app-only")})]})}),n.jsx(Ce,{children:Y==="full-erase"?"Erase all data on the next device you pick":"Keep existing data"})]})})]}),V.length===0?n.jsx("p",{className:"text-sm text-muted-foreground",children:y?"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:V.map(F=>{const O=F.status==="booted",se=F.busy,he=se?"In use":O?"Booted":"Available",ae=se?"bg-amber-400":O?"bg-emerald-400":"bg-muted-foreground/40";return n.jsxs("button",{disabled:se||d||!y,onClick:()=>Te(F),className:ne("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:F.name}),F.osVersion&&n.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:F.osVersion}),n.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[n.jsx("span",{className:ne("inline-block h-1.5 w-1.5 rounded-full",ae)}),he]})]},F.id)})}),b&&n.jsx("p",{className:"text-sm text-muted-foreground",children:b})]}):n.jsxs("div",{className:"flex flex-col gap-5",children:[n.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Select Mac"}),S.length===0?n.jsx("p",{className:"text-sm text-muted-foreground",children:y?`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:S.map(F=>{const O=F.resources,se=O?Date.now()-O.reportedAt>3e4:!1,he=F.devices.filter(T=>T.platform===c).length,ae=(O==null?void 0:O.cpuPercent)??0,le=O?O.memUsedMB/O.memTotalMB*100:0,Q=Go(O,se),Z=Q==="overloaded";return n.jsx(Nt,{children:n.jsxs(Re,{children:[n.jsx(je,{asChild:!0,children:n.jsx("span",{tabIndex:Z?0:void 0,className:Z?"cursor-not-allowed":void 0,children:n.jsxs("button",{disabled:Z,"aria-disabled":Z,onClick:()=>p(F.agentName??null),className:ne("flex flex-col gap-3 rounded-lg border p-3 text-left transition-colors min-h-[100px] w-full",Z?"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(Jo,{health:Q}),n.jsx("span",{className:"text-sm font-medium leading-tight truncate",children:F.agentName??"Unknown"})]}),se&&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:[he," device",he!==1?"s":""]}),O&&n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"·"}),n.jsxs("span",{children:[O.slotsAvailable,"/",O.slotsTotal," slots"]})]})]}),O&&!se&&n.jsxs("div",{className:"flex flex-col gap-1.5 w-full",children:[n.jsx(un,{label:"CPU",percent:ae,colorClass:"bg-blue-400"}),n.jsx(un,{label:"RAM",percent:le,colorClass:"bg-violet-400"})]})]})})}),Z&&n.jsx(Ce,{children:"This Mac is currently overloaded. Try again later."})]})},F.agentName)})})]})})}),r&&n.jsxs(n.Fragment,{children:[n.jsx(fn,{orientation:"vertical",className:"h-auto"}),n.jsx("div",{className:"w-80 shrink-0 h-full",children:n.jsx(Fo,{buildId:Number(r),recordingsRefreshKey:i})})]})]})}function Jo({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:ne("inline-block h-2 w-2 shrink-0 rounded-full",e)})}function un({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:ne("h-full rounded-full transition-all",r),style:{width:`${Math.min(100,e)}%`}})})]})}export{oa as QASession};
@@ -1 +0,0 @@
1
- import{ak as b,al as S,a6 as m,ah as k,a9 as C,a3 as s,C as h,c as p,d as x,b as f,a as P,L as u,I as w,B as E,a4 as F,a7 as j}from"./index-DXjMx9hQ.js";const T=F({password:j().min(8),confirm:j()}).refine(r=>r.password===r.confirm,{message:"Passwords do not match",path:["confirm"]});function L(){const r=b(),[g]=S(),a=g.get("token")??"",[n,t]=m.useState("loading"),{register:o,handleSubmit:v,setError:d,formState:{errors:e,isSubmitting:c}}=k({resolver:C(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(P,{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(E,{type:"submit",disabled:c,className:"w-full",children:c?"Saving…":"Set new password"})]})})]})})}export{L as ResetPassword};
@@ -1 +0,0 @@
1
- import{ak as f,ao as g,ah as w,a9 as j,a6 as v,a3 as e,C as N,c as y,d as b,a as C,L as i,I as o,B as S,a4 as k,a7 as l}from"./index-DXjMx9hQ.js";const E=k({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 P(){const a=f(),{resolvedTheme:d}=g(),p=d==="dark"?"/logo-dark.svg":"/logo.svg",{register:r,handleSubmit:x,setError:c,formState:{errors:s,isSubmitting:n}}=w({resolver:j(E),mode:"onBlur"});v.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 m=await fetch("/api/v1/auth/init",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:t.email,password:t.password})});if(!m.ok){const u=await m.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(N,{level:4,className:"w-full",children:[e.jsx(y,{className:"text-center",children:e.jsx(b,{className:"text-2xl tracking-display-md",children:"Set up tapflow"})}),e.jsx(C,{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(S,{type:"submit",size:"lg",disabled:n,className:"w-full mt-1",children:n?"Creating account…":"Create admin account"})]})})]})]})})}export{P as Setup};
Binary file
Binary file
@@ -1 +0,0 @@
1
- import{a6 as n,ah as $,a9 as H,a3 as e,B as d,a8 as t,L as k,I as S,C as O,c as z,d as V,b as W,a as M,a4 as J,a7 as A}from"./index-DXjMx9hQ.js";import{B as I}from"./badge-OToVq1dK.js";import{A as U,c as q,f as G,g as K,d as Q,e as X,b as Y}from"./alert-dialog-DWqGDQTB.js";import{D as Z,f as ee,a as se,d as te,e as ae,S as ne,i as re,j as oe,g as ie,h as B}from"./dialog-BxC9v2BL.js";import{T as le,d as ce,e as w,c as x,a as de,b as i}from"./table-CbATN5Pi.js";import{P as xe,T as he}from"./trash-2-CszwJHEh.js";async function me(){const a=window.location.protocol==="https:"?"wss":"ws";if(["localhost","127.0.0.1","[::1]"].includes(window.location.hostname))try{const h=await fetch("/api/v1/relay/host",{credentials:"include"});if(h.ok){const{lanHost:l,port:o}=await h.json();if(l)return`${a}://${l}:${o}`}}catch{}return`${a}://${window.location.host}`}const pe=J({name:A().min(1),expiresDays:A().refine(a=>{const r=parseInt(a,10);return!isNaN(r)&&r>=1&&r<=365},{message:"Must be between 1 and 365"})});function ye(){const[a,r]=n.useState([]),[h,l]=n.useState(!1),[o,y]=n.useState(""),[c,v]=n.useState("api"),[N,b]=n.useState(""),[u,j]=n.useState(null),{register:T,handleSubmit:E,reset:_,formState:{errors:m,isSubmitting:C}}=$({resolver:H(pe),mode:"onBlur",defaultValues:{name:"",expiresDays:"30"}});function g(){fetch("/api/v1/tokens",{credentials:"include"}).then(s=>s.json()).then(r)}n.useEffect(()=>{g()},[]);async function F(s){try{const p=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(!p.ok){const f=await p.json().catch(()=>null);t.error((f==null?void 0:f.error)??"Failed to create token");return}const P=await p.json();c==="agent"&&b(await me()),t.success("Token created"),y(P.token),g()}catch{t.error("Network error")}}function R(s){l(s),s||(y(""),v("api"),b(""),_())}async function L(s){try{return(await fetch(`/api/v1/tokens/${s}`,{method:"DELETE",credentials:"include"})).ok?(t.success("Token revoked"),g(),!0):(t.error("Failed to revoke token"),!1)}catch{return t.error("Network error"),!1}}function D(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(Z,{open:h,onOpenChange:R,children:[e.jsx(ee,{asChild:!0,children:e.jsxs(d,{size:"sm",children:[e.jsx(xe,{className:"mr-2 h-4 w-4"}),"New token"]})}),e.jsxs(se,{className:"sm:max-w-md",children:[e.jsx(te,{children:e.jsx(ae,{children:"Create token"})}),o?e.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Copy this token now — it won't be shown again."}),e.jsx("code",{className:"rounded bg-muted px-3 py-2 text-xs break-all font-mono",children:o}),c==="agent"&&N&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Run this on the agent Mac to connect it to this relay:"}),e.jsx("code",{className:"rounded bg-muted px-3 py-2 text-xs break-all font-mono",children:`tapflow agent start --relay ${N} --token ${o}`})]}),e.jsx(d,{onClick:()=>{navigator.clipboard.writeText(o).then(()=>{t.success("Token copied to clipboard"),l(!1)}).catch(()=>t.error("Failed to copy — copy manually"))},children:"Copy & close"})]}):e.jsxs("form",{onSubmit:E(F),className:"flex flex-col gap-4 pt-2",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"token-name",children:"Name"}),e.jsx(S,{id:"token-name",placeholder:"e.g. ci-deploy",...T("name")}),m.name&&e.jsx("p",{className:"text-sm text-destructive",children:m.name.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"expires",children:"Expires in (days)"}),e.jsx(S,{id:"expires",type:"number",...T("expiresDays")}),m.expiresDays&&e.jsx("p",{className:"text-sm text-destructive",children:m.expiresDays.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"token-type",children:"Type"}),e.jsxs(ne,{value:c,onValueChange:s=>v(s),children:[e.jsx(re,{id:"token-type",children:e.jsx(oe,{})}),e.jsxs(ie,{children:[e.jsx(B,{value:"api",children:"API — CI uploads & API access"}),e.jsx(B,{value:"agent",children:"Agent — connect remote device agents (Admin only)"})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Scope: ",e.jsx(I,{variant:"secondary",children:c==="agent"?"agent":"view, builds:write"})]}),e.jsx(d,{type:"submit",disabled:C,children:C?"Creating…":"Create token"})]})]})]})]}),e.jsxs(O,{children:[e.jsxs(z,{children:[e.jsx(V,{children:"Active tokens"}),e.jsxs(W,{children:["Use these tokens with ",e.jsx("code",{className:"text-xs",children:"Authorization: Bearer <token>"})," for API deployments."]})]}),e.jsx(M,{className:"px-4 pt-0 pb-2",children:e.jsxs(le,{children:[e.jsx(ce,{children:e.jsxs(w,{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(de,{children:a.length===0?e.jsx(w,{children:e.jsx(i,{colSpan:5,className:"h-20 text-center text-muted-foreground",children:"No tokens yet."})}):a.map(s=>e.jsxs(w,{className:"hover:bg-transparent",children:[e.jsx(i,{className:"font-medium",children:s.name}),e.jsx(i,{children:e.jsx(I,{variant:"secondary",children:s.scope})}),e.jsx(i,{className:"text-muted-foreground text-sm",children:s.last_used_at?new Date(s.last_used_at).toLocaleDateString():"Never"}),e.jsx(i,{children:s.expires_at?e.jsx("span",{className:D(s)?"text-destructive text-sm":"text-muted-foreground text-sm",children:D(s)?"Expired":new Date(s.expires_at).toLocaleDateString()}):e.jsx("span",{className:"text-muted-foreground text-sm",children:"Never"})}),e.jsx(i,{children:e.jsx(d,{variant:"destructive",size:"icon",className:"h-7 w-7","aria-label":"Revoke token",onClick:()=>j(s.id),children:e.jsx(he,{className:"h-4 w-4"})})})]},s.id))})]})})]}),e.jsx(U,{open:u!==null,onOpenChange:s=>{s||j(null)},children:e.jsxs(q,{children:[e.jsxs(G,{children:[e.jsx(K,{children:"Revoke token?"}),e.jsx(Q,{children:"Any active API calls using this token will immediately fail."})]}),e.jsxs(X,{children:[e.jsx(Y,{children:"Cancel"}),e.jsx(d,{variant:"destructive",onClick:async()=>{if(u===null)return;await L(u)&&j(null)},children:"Revoke"})]})]})})]})}export{ye as TokenSettings};
Binary file
@@ -1 +0,0 @@
1
- import{a6 as r,a3 as o,m as O,ad 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-DXjMx9hQ.js";var H=Object.defineProperty,n=(t,e)=>H(t,"name",{value:e,configurable:!0}),k="AlertDialog",[M,de]=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,y=B,_=W,j=Y,C=G,R=U;const pe=Z,fe=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(y,{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=y.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(_,{ref:a,className:g(x(),t),...e}));ne.displayName=_.displayName;const ce=r.forwardRef(({className:t,...e},a)=>o.jsx(j,{ref:a,className:g(x({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));ce.displayName=j.displayName;export{pe as A,ne as a,ce as b,oe as c,ie as d,re as e,le as f,se as g,fe as h};
@@ -1 +0,0 @@
1
- import{a3 as n,J as d,a0 as o}from"./index-DXjMx9hQ.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};
Binary file
@@ -1,3 +0,0 @@
1
- w ��-�q*��G�.��?��f�DF�� �J�N��n��\
2
- ��f+�Xe��"�2���h��"+��j;��Y��6��Xk��N�Ղ�g�A�#8��$��G�鳍Ǝ�g|Ŭ�M%-e����I ���g��s��a�6��43�l%JB*�ꨪE�����(QVJZ�)'��>�g���Zoc�4\��e���;ln�����>�g��8RB�~��Q����t�(�$}� �g�D]�;�es~^�-��cq�X�1��ci'�e]u��E�DT�^��ve���������&�nڇ�~�Dջ;�aD'Z١�0�}�چ�w�D�$��]�/�e{F$Nc#H��Bw�t�$+�i]�~�14]�z����G�g��]�!|�6h1|���X�[+7/km�N���;ٖ�?yo��7��p�9��k�}㭫�͎����T��Zՠ��?Fa�e������gyM�+�$�Ӯ��u�Q�!YtoO���o:葓޼�m��ؽ�!��|��5����1 �����^h�^i�-$�L�@M÷�$�� {�4Nc�e����lɤ��6�t�F�v
3
- >����mt��
Binary file