@xenon-device-management/xenon 1.1.24 → 1.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/package.json +1 -1
- package/lib/public/assets/{Layouts-DyOOhYtz.js → Layouts-D0WSzKOh.js} +1 -1
- package/lib/public/assets/{ai-settings-UTOAls44.js → ai-settings-DQWDdNd7.js} +1 -1
- package/lib/public/assets/{apps-iWYKDaHG.js → apps-1sLWHOGO.js} +1 -1
- package/lib/public/assets/{badge-DPsMqugr.js → badge-BiR1gmMm.js} +1 -1
- package/lib/public/assets/{button-C2nVUsus.js → button-BVazt4Z1.js} +1 -1
- package/lib/public/assets/{calendar-ufCcAAd0.js → calendar-yMyP2_Nc.js} +1 -1
- package/lib/public/assets/{clock-D9Y3wV_k.js → clock-CsVplnJ2.js} +1 -1
- package/lib/public/assets/{cpu-HdPsjamK.js → cpu-DNC8n7kK.js} +1 -1
- package/lib/public/assets/{device-explorer-QINnmim7.js → device-explorer-DFu8Gxj4.js} +32 -32
- package/lib/public/assets/{index-W_MoQvsw.js → index-S71J2rWg.js} +2 -2
- package/lib/public/assets/{lock-CJ90SvYX.js → lock-BstCxnX6.js} +1 -1
- package/lib/public/assets/{maintenance-settings-CLGqmciU.js → maintenance-settings-BwfG9cu2.js} +1 -1
- package/lib/public/assets/{mouse-pointer-2-HkRMqHAy.js → mouse-pointer-2-CSn_Wnc9.js} +1 -1
- package/lib/public/assets/{plus-8iOMg9nw.js → plus-DfjM7G6e.js} +1 -1
- package/lib/public/assets/{session-dashboard-FUCdTLJc.js → session-dashboard-C6ek4z65.js} +1 -1
- package/lib/public/assets/{settings-DsABv9a7.js → settings-BDYP8ULf.js} +1 -1
- package/lib/public/assets/{trash-2-g4zyDinF.js → trash-2-CZWUMK5b.js} +1 -1
- package/lib/public/assets/{useSocket-9D3E9Hwl.js → useSocket-CliVeWS3.js} +1 -1
- package/lib/public/assets/{webhook-settings-DiEIokQy.js → webhook-settings-tPiwWf8y.js} +1 -1
- package/lib/public/assets/{zap-Dr4fY5UZ.js → zap-ZrK5B58i.js} +1 -1
- package/lib/public/index.html +1 -1
- package/lib/src/device-managers/AndroidDeviceManager.js +49 -1
- package/lib/src/device-managers/ios/IOSDiscoveryService.js +1 -1
- package/package.json +1 -1
package/lib/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as j,r as l,j as e,B as u,d as f,g as C,i as A,T as z}from"./index-
|
|
1
|
+
import{c as j,r as l,j as e,B as u,d as f,g as C,i as A,T as z}from"./index-S71J2rWg.js";import{X as x}from"./index-C1DBaoSh.js";import{A as P}from"./Layouts-D0WSzKOh.js";import{C as w}from"./cpu-DNC8n7kK.js";import{L as v}from"./lock-BstCxnX6.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as g,u as X,r,j as e,S as z,g as q,X as V}from"./index-
|
|
1
|
+
import{c as g,u as X,r,j as e,S as z,g as q,X as V}from"./index-S71J2rWg.js";import{X as c}from"./index-C1DBaoSh.js";import{S as H,B as S,D as K}from"./badge-BiR1gmMm.js";import{A as D,B as T,U as Z,C as J,a as Q,T as ee}from"./button-BVazt4Z1.js";import{Z as se}from"./zap-ZrK5B58i.js";import{T as ae}from"./trash-2-CZWUMK5b.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as t,r as c,j as i}from"./index-
|
|
1
|
+
import{c as t,r as c,j as i}from"./index-S71J2rWg.js";import{c as r,a as u}from"./badge-BiR1gmMm.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{c as E,r,a as At,j as e,X as tt,C as Lt,u as ft,b as nt,R as qe,S as st,d as it,e as yt,T as Tt,f as jt,L as
|
|
1
|
+
import{c as E,r,a as At,j as e,X as tt,C as Lt,u as ft,b as nt,R as qe,S as st,d as it,e as yt,T as Tt,f as jt,L as He,g as rt}from"./index-S71J2rWg.js";import{p as lt,H as zt,C as bt,a as Ke,u as Et}from"./useSocket-CliVeWS3.js";import{X as D}from"./index-C1DBaoSh.js";import{C as Nt}from"./clock-CsVplnJ2.js";import{P as wt}from"./plus-DfjM7G6e.js";import{A as kt,T as at,C as Je,a as Ze,U as It,B as Qe}from"./button-BVazt4Z1.js";import{C as Rt}from"./cpu-DNC8n7kK.js";import{M as Mt}from"./mouse-pointer-2-CSn_Wnc9.js";import{S as Xe,D as _t,B as Pe}from"./badge-BiR1gmMm.js";import{Z as Ut}from"./zap-ZrK5B58i.js";import{L as Ft}from"./lock-BstCxnX6.js";import{T as Be}from"./trash-2-CZWUMK5b.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const
|
|
6
|
+
*/const Ot=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],Ht=E("box",Ot);/**
|
|
7
7
|
* @license lucide-react v0.555.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
@@ -13,132 +13,132 @@ import{c as E,r,a as At,j as e,X as tt,C as Lt,u as ft,b as nt,R as qe,S as st,d
|
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const
|
|
16
|
+
*/const Bt=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],ct=E("chevron-left",Bt);/**
|
|
17
17
|
* @license lucide-react v0.555.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const
|
|
21
|
+
*/const Wt=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Vt=E("chevron-up",Wt);/**
|
|
22
22
|
* @license lucide-react v0.555.0 - ISC
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the ISC license.
|
|
25
25
|
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const
|
|
26
|
+
*/const qt=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],Xt=E("clipboard",qt);/**
|
|
27
27
|
* @license lucide-react v0.555.0 - ISC
|
|
28
28
|
*
|
|
29
29
|
* This source code is licensed under the ISC license.
|
|
30
30
|
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const
|
|
31
|
+
*/const Gt=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],ot=E("code-xml",Gt);/**
|
|
32
32
|
* @license lucide-react v0.555.0 - ISC
|
|
33
33
|
*
|
|
34
34
|
* This source code is licensed under the ISC license.
|
|
35
35
|
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const
|
|
36
|
+
*/const Yt=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Kt=E("file-text",Yt);/**
|
|
37
37
|
* @license lucide-react v0.555.0 - ISC
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the ISC license.
|
|
40
40
|
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const
|
|
41
|
+
*/const Jt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],Zt=E("grid-3x3",Jt);/**
|
|
42
42
|
* @license lucide-react v0.555.0 - ISC
|
|
43
43
|
*
|
|
44
44
|
* This source code is licensed under the ISC license.
|
|
45
45
|
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const
|
|
46
|
+
*/const Qt=[["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"}]],es=E("house",Qt);/**
|
|
47
47
|
* @license lucide-react v0.555.0 - ISC
|
|
48
48
|
*
|
|
49
49
|
* This source code is licensed under the ISC license.
|
|
50
50
|
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const
|
|
51
|
+
*/const ts=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],ss=E("layers",ts);/**
|
|
52
52
|
* @license lucide-react v0.555.0 - ISC
|
|
53
53
|
*
|
|
54
54
|
* This source code is licensed under the ISC license.
|
|
55
55
|
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/const
|
|
56
|
+
*/const is=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],as=E("lightbulb",is);/**
|
|
57
57
|
* @license lucide-react v0.555.0 - ISC
|
|
58
58
|
*
|
|
59
59
|
* This source code is licensed under the ISC license.
|
|
60
60
|
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/const
|
|
61
|
+
*/const ns=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],St=E("lock-open",ns);/**
|
|
62
62
|
* @license lucide-react v0.555.0 - ISC
|
|
63
63
|
*
|
|
64
64
|
* This source code is licensed under the ISC license.
|
|
65
65
|
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/const
|
|
66
|
+
*/const rs=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],ls=E("map-pin",rs);/**
|
|
67
67
|
* @license lucide-react v0.555.0 - ISC
|
|
68
68
|
*
|
|
69
69
|
* This source code is licensed under the ISC license.
|
|
70
70
|
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
-
*/const
|
|
71
|
+
*/const cs=[["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"}]],os=E("message-square",cs);/**
|
|
72
72
|
* @license lucide-react v0.555.0 - ISC
|
|
73
73
|
*
|
|
74
74
|
* This source code is licensed under the ISC license.
|
|
75
75
|
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
-
*/const
|
|
76
|
+
*/const ds=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],dt=E("monitor",ds);/**
|
|
77
77
|
* @license lucide-react v0.555.0 - ISC
|
|
78
78
|
*
|
|
79
79
|
* This source code is licensed under the ISC license.
|
|
80
80
|
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
-
*/const
|
|
81
|
+
*/const hs=[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]],ms=E("move",hs);/**
|
|
82
82
|
* @license lucide-react v0.555.0 - ISC
|
|
83
83
|
*
|
|
84
84
|
* This source code is licensed under the ISC license.
|
|
85
85
|
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
-
*/const
|
|
86
|
+
*/const us=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],ps=E("package",us);/**
|
|
87
87
|
* @license lucide-react v0.555.0 - ISC
|
|
88
88
|
*
|
|
89
89
|
* This source code is licensed under the ISC license.
|
|
90
90
|
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
-
*/const
|
|
91
|
+
*/const vs=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],xs=E("panels-top-left",vs);/**
|
|
92
92
|
* @license lucide-react v0.555.0 - ISC
|
|
93
93
|
*
|
|
94
94
|
* This source code is licensed under the ISC license.
|
|
95
95
|
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
-
*/const
|
|
96
|
+
*/const gs=[["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"}]],Ve=E("rotate-cw",gs);/**
|
|
97
97
|
* @license lucide-react v0.555.0 - ISC
|
|
98
98
|
*
|
|
99
99
|
* This source code is licensed under the ISC license.
|
|
100
100
|
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
-
*/const
|
|
101
|
+
*/const fs=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],ht=E("shield-alert",fs);/**
|
|
102
102
|
* @license lucide-react v0.555.0 - ISC
|
|
103
103
|
*
|
|
104
104
|
* This source code is licensed under the ISC license.
|
|
105
105
|
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
-
*/const
|
|
106
|
+
*/const ys=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],mt=E("sparkles",ys);/**
|
|
107
107
|
* @license lucide-react v0.555.0 - ISC
|
|
108
108
|
*
|
|
109
109
|
* This source code is licensed under the ISC license.
|
|
110
110
|
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
-
*/const
|
|
111
|
+
*/const js=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],bs=E("tag",js);/**
|
|
112
112
|
* @license lucide-react v0.555.0 - ISC
|
|
113
113
|
*
|
|
114
114
|
* This source code is licensed under the ISC license.
|
|
115
115
|
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
-
*/const
|
|
116
|
+
*/const Ns=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],ut=E("target",Ns);/**
|
|
117
117
|
* @license lucide-react v0.555.0 - ISC
|
|
118
118
|
*
|
|
119
119
|
* This source code is licensed under the ISC license.
|
|
120
120
|
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
-
*/const
|
|
121
|
+
*/const ws=[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]],ks=E("thermometer",ws);/**
|
|
122
122
|
* @license lucide-react v0.555.0 - ISC
|
|
123
123
|
*
|
|
124
124
|
* This source code is licensed under the ISC license.
|
|
125
125
|
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
-
*/const
|
|
126
|
+
*/const Cs=[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M12 20v-6",key:"1rm09r"}]],Ss=E("touchpad",Cs);/**
|
|
127
127
|
* @license lucide-react v0.555.0 - ISC
|
|
128
128
|
*
|
|
129
129
|
* This source code is licensed under the ISC license.
|
|
130
130
|
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
-
*/const
|
|
131
|
+
*/const $s=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Ds=E("user",$s);/**
|
|
132
132
|
* @license lucide-react v0.555.0 - ISC
|
|
133
133
|
*
|
|
134
134
|
* This source code is licensed under the ISC license.
|
|
135
135
|
* See the LICENSE file in the root directory of this source tree.
|
|
136
|
-
*/const
|
|
136
|
+
*/const As=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],$t=E("wifi",As);/**
|
|
137
137
|
* @license lucide-react v0.555.0 - ISC
|
|
138
138
|
*
|
|
139
139
|
* This source code is licensed under the ISC license.
|
|
140
140
|
* See the LICENSE file in the root directory of this source tree.
|
|
141
|
-
*/const As=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Ls=E("wrench",As),Ts=[{label:"1 Hour",value:"1h"},{label:"2 Hours",value:"2h"},{label:"4 Hours",value:"4h"},{label:"8 Hours",value:"8h"}],zs=({device:n,onClose:t,onReserved:l})=>{const[u,p]=r.useState(""),[s,L]=r.useState("1h"),[v,x]=r.useState(""),[h,m]=r.useState(!1),[A,S]=r.useState(null),U=async()=>{if(!u.trim()){S("Please enter your name/ID");return}m(!0),S(null);try{const w=await D.reserveDevice(n.udid,n.host,u,s,v);w.success?(l(),t()):S(w.error||"Failed to reserve device")}catch(w){S(w.message||"An unexpected error occurred")}finally{m(!1)}};return At.createPortal(e.jsx("div",{className:"reservation-modal-overlay",onClick:t,children:e.jsxs("div",{className:"reservation-modal",onClick:w=>w.stopPropagation(),children:[e.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),e.jsxs("div",{className:"reservation-modal-header",children:[e.jsxs("div",{className:"reservation-modal-title",children:[e.jsx(Ct,{size:18,className:"title-icon"}),"Reserve Device"]}),e.jsx("button",{className:"close-btn",onClick:t,children:e.jsx(tt,{size:20})})]}),e.jsxs("div",{className:"reservation-modal-body",children:[e.jsxs("div",{className:"device-id-badge",children:[e.jsx("span",{className:"label",children:"Device:"}),e.jsx("span",{className:"value",children:n.udid})]}),e.jsxs("p",{children:["Reserve ",e.jsx("strong",{children:n.name||n.udid})," for exclusive use. This will prevent CI sessions from using this device."]}),e.jsxs("div",{className:"reservation-form-group",children:[e.jsxs("label",{children:[e.jsx($s,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-primary)"}}),"Reserved By"]}),e.jsx("input",{type:"text",className:"reservation-input",placeholder:"Enter your name or ID",value:u,onChange:w=>p(w.target.value),disabled:h})]}),e.jsxs("div",{className:"reservation-form-group",children:[e.jsxs("label",{children:[e.jsx(Nt,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-primary)"}}),"Duration"]}),e.jsx("div",{className:"duration-selector",children:Ts.map(w=>e.jsx("div",{className:`duration-option ${s===w.value?"active":""}`,onClick:()=>L(w.value),children:w.label},w.value))})]}),e.jsxs("div",{className:"reservation-form-group",children:[e.jsxs("label",{children:[e.jsx(cs,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-primary)"}}),"Reason (Optional)"]}),e.jsx("input",{type:"text",className:"reservation-input",placeholder:"e.g., Debugging flaky login test",value:v,onChange:w=>x(w.target.value),disabled:h})]}),A&&e.jsxs("div",{className:"error-message",children:[e.jsx(Lt,{size:14,style:{marginRight:6,verticalAlign:"middle"}}),A]})]}),e.jsxs("div",{className:"reservation-actions",children:[e.jsx("button",{className:"btn-cancel",onClick:t,disabled:h,children:"Cancel"}),e.jsx("button",{className:"btn-reserve",onClick:U,disabled:h||!u.trim(),children:h?"Reserving...":"Confirm Reservation"})]})]})}),document.body)},Es=({device:n,onClose:t,onUpdated:l})=>{const{toast:u}=ft(),[p,s]=r.useState(n.tags||[]),[L,v]=r.useState(""),[x,h]=r.useState(!1),m=r.useRef(null);r.useEffect(()=>{m.current&&m.current.focus()},[]);const A=()=>{const j=L.trim();j&&!p.includes(j)&&(s([...p,j]),v(""))},S=j=>{s(p.filter(T=>T!==j))},U=j=>{j.key==="Enter"?A():j.key==="Escape"&&t()},w=async()=>{h(!0);try{await D.updateDeviceTags(n.udid,n.host,p),l(),t()}catch(j){console.error("Failed to update tags",j),u("Error saving tags. Please try again.","error")}finally{h(!1)}};return e.jsx("div",{className:"tag-modal-overlay",onClick:t,children:e.jsxs("div",{className:"tag-modal-container",onClick:j=>j.stopPropagation(),children:[e.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),e.jsxs("div",{className:"tag-modal-header",children:[e.jsxs("div",{className:"tag-modal-title",children:[e.jsx(js,{size:18,className:"title-icon"}),"Manage Device Tags"]}),e.jsx("button",{className:"close-btn",onClick:t,children:e.jsx(tt,{size:20})})]}),e.jsxs("div",{className:"tag-modal-body",children:[e.jsxs("div",{className:"device-id-badge",children:[e.jsx("span",{className:"label",children:"Device:"}),e.jsx("span",{className:"value",children:n.udid})]}),e.jsxs("div",{className:"tag-input-section",children:[e.jsx("label",{htmlFor:"tag-input",children:"Add New Tag"}),e.jsxs("div",{className:"input-with-button",children:[e.jsx("input",{ref:m,id:"tag-input",type:"text",placeholder:"e.g. stable, team-a, ios-17",value:L,onChange:j=>v(j.target.value),onKeyDown:U}),e.jsx("button",{className:"add-inline-btn",onClick:A,disabled:!L.trim(),children:e.jsx(wt,{size:16})})]}),e.jsx("p",{className:"input-hint",children:"Press Enter to add multiple tags"})]}),e.jsxs("div",{className:"tags-display-section",children:[e.jsx("label",{children:"Current Tags"}),e.jsx("div",{className:"tags-list",children:p.length>0?p.map(j=>e.jsxs("div",{className:"tag-pill-editable",children:[j,e.jsx("button",{className:"remove-tag",onClick:()=>S(j),children:e.jsx(tt,{size:12})})]},j)):e.jsx("div",{className:"empty-tags",children:"No tags assigned to this device."})})]})]}),e.jsxs("div",{className:"tag-modal-footer",children:[e.jsx("button",{className:"btn-cancel",onClick:t,children:"Cancel"}),e.jsx("button",{className:"btn-save",onClick:w,disabled:x,children:x?"Saving...":"Apply Changes"})]})]})})};class Is extends qe.Component{constructor(t){super(t),this.state={showReservation:!1,showTagManager:!1,showControl:!1}}getStatusClassName(){return this.props.device.offline?"disabled":this.props.device.busy?"busy":this.isReserved()?"reserved":""}getDeviceState(){return this.props.device.offline?"offline":this.props.device.userBlocked?"maintenance":this.props.device.busy?"busy":this.isReserved()?"reserved":"ready"}isReserved(){const{reservedUntil:t}=this.props.device;return t?Date.now()<t:!1}getRemainingReservationTime(){const{reservedUntil:t}=this.props.device;if(!t)return"";const l=t-Date.now();return l<=0?"":lt(l,{compact:!0})}async releaseReservation(t,l){await D.releaseReservation(t,l),this.props.reloadDevices()}async blockDevice(t,l){await D.blockDevice(t,l),this.props.reloadDevices()}async unblockDevice(t,l){await D.unblockDevice(t,l),this.props.reloadDevices()}async manageTags(){this.setState({showTagManager:!0})}render(){var P;const{name:t,sdk:l,deviceType:u,platform:p,udid:s,dashboard_link:L,total_session_count:v,host:x,totalUtilizationTimeMilliSec:h,userBlocked:m,busy:A,session_id:S,reservedBy:U,reservedUntil:w,reservationReason:j,batteryLevel:T,thermalStatus:F,storageFree:b,tags:k,sessionProgress:y,totalHealedCount:R}=this.props.device,M=this.getDeviceState();let _="";try{_=new URL(x).hostname}catch{_=x.split(":")[1].replace("//","")}const q=()=>A?null:this.isReserved()?e.jsx("button",{className:"tactical-btn reserved",onClick:()=>this.releaseReservation(s,x),title:`Reserved by ${U}${j?`: ${j}`:""}. Expires: ${w?new Date(w).toLocaleString():"Never"}`,children:e.jsx(St,{size:14,color:"#38bdf8"})}):m?e.jsx("button",{className:"tactical-btn exit-maintenance",onClick:()=>this.unblockDevice(s,x),title:"Exit Maintenance",children:e.jsx(it,{size:14})}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"tactical-btn reserve",onClick:()=>this.setState({showReservation:!0}),title:"Reserve Device",children:e.jsx(Ct,{size:14,color:"#38bdf8"})}),e.jsx("button",{className:"tactical-btn maintenance",onClick:()=>this.blockDevice(s,x),title:"Enter Maintenance",children:e.jsx(Ls,{size:14,color:"#fbbf24"})})]});return e.jsxs("div",{className:`device-info-card-container ${this.getStatusClassName()} group`,children:[e.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.1,zIndex:0}}),e.jsxs("div",{className:"card-header relative z-10",children:[e.jsxs("div",{className:"header-left",children:[e.jsx("div",{className:`platform-icon-wrapper ${p}`,children:["ios","tvos"].includes(p)?e.jsx(kt,{size:14}):e.jsx(st,{size:14})}),e.jsx("div",{className:"device-id-mono",title:s,children:s})]}),e.jsx("div",{className:`device-status-badge ${M} ${M==="busy"&&y&&y!=="Session Active"?"pulse":""}`,children:M==="busy"&&y&&y!=="Session Active"?y:M})]}),e.jsxs("div",{className:"device-info-main relative z-10",children:[e.jsx("h3",{className:"device-name",title:t,children:t}),e.jsxs("p",{className:"device-subtext",children:[u.toUpperCase()," • ",l]}),this.props.device.tags&&this.props.device.tags.length>0&&e.jsxs("div",{className:"device-tags-inline",children:[this.props.device.tags.slice(0,3).map(te=>e.jsx("span",{className:"inline-tag",title:te,children:te},te)),this.props.device.tags.length>3&&e.jsxs("span",{className:"inline-tag-overflow",children:["+",this.props.device.tags.length-3]})]})]}),e.jsxs("div",{className:"metrics-grid relative z-10",children:[e.jsxs("div",{className:"metric-item",title:`Location: ${_}`,children:[e.jsx(dt,{size:10,className:"text-dim"}),e.jsx("span",{className:"truncate",children:_})]}),this.props.device.ip&&e.jsxs("div",{className:"metric-item",title:`IP: ${this.props.device.ip}`,children:[e.jsx($t,{size:10,className:"text-dim"}),e.jsx("span",{className:"truncate",children:this.props.device.ip})]}),e.jsxs("div",{className:`metric-item health ${((P=this.props.device.healthStatus)==null?void 0:P.toLowerCase())||"healthy"}`,title:this.props.device.healthCheckError||"Device is healthy",children:[e.jsx("div",{className:"health-dot"}),e.jsx("span",{children:this.props.device.healthStatus||"Healthy"}),R&&R>0&&e.jsxs("span",{className:"heal-badge",children:[e.jsx(it,{size:8})," ",R]})]}),F&&F!=="Unknown"&&e.jsxs("div",{className:"metric-item thermal",title:`Thermal: ${F}`,children:[e.jsx(ws,{size:10,style:{color:F==="Nominal"?"var(--color-primary)":"var(--color-amber)"}}),e.jsx("span",{children:F})]}),T!==void 0&&e.jsxs("div",{className:"metric-item battery",title:`Battery: ${T}%`,children:[e.jsx("div",{className:`mini-battery ${T<20?"low":""}`,children:e.jsx("div",{className:"battery-fill",style:{width:`${T}%`}})}),e.jsxs("span",{children:[T,"%"]})]}),b&&b!=="Unknown"&&e.jsxs("div",{className:"metric-item storage",title:`Free Space: ${b}`,children:[e.jsx(zt,{size:10,style:{color:"var(--color-sky)"}}),e.jsx("span",{children:b})]})]}),e.jsx("div",{className:"dynamic-data-layer relative z-10",children:this.isReserved()?e.jsxs("div",{className:"reservation-micro-banner",children:[e.jsx(Nt,{size:10}),e.jsxs("span",{children:["RES: ",U||"Anon"," (",this.getRemainingReservationTime(),")"]})]}):S?e.jsxs("div",{className:"session-micro-banner",children:[e.jsx(at,{size:10}),e.jsxs("span",{children:["SID: ",S]})]}):e.jsx("div",{className:"utilization-micro-info",children:e.jsxs("span",{children:["UTIL: ",lt(h||0,{compact:!0})]})})}),e.jsxs("div",{className:"action-row relative z-10",children:[e.jsx("button",{className:"tactical-btn add-tag",onClick:()=>this.manageTags(),title:"Manage Tags",children:e.jsx(wt,{size:14})}),q(),e.jsxs("button",{className:`tactical-btn control-btn ${A&&S&&!S.toString().startsWith("manual_")?"disabled":""}`,onClick:()=>!(A&&S&&!S.toString().startsWith("manual_"))&&this.props.navigate(`/devices/${s}/control`),disabled:A&&!!S&&!S.toString().startsWith("manual_"),title:A&&S&&!S.toString().startsWith("manual_")?"Locked: Appium Session":"Take Control",children:[e.jsx(dt,{size:14}),e.jsx("span",{style:{fontSize:"10px",fontWeight:800,letterSpacing:"0.05em",fontFamily:"Outfit, sans-serif"},children:"CTRL"})]})]}),this.state.showReservation&&e.jsx(zs,{device:this.props.device,onClose:()=>this.setState({showReservation:!1}),onReserved:()=>this.props.reloadDevices()}),this.state.showTagManager&&e.jsx(Es,{device:this.props.device,onClose:()=>this.setState({showTagManager:!1}),onUpdated:()=>this.props.reloadDevices()})]})}}function Rs(n){const t=nt();return e.jsx(Is,{...n,navigate:t})}class Ms extends qe.Component{render(){return e.jsx("div",{className:"device-explorer-card-container",children:qe.Children.toArray(this.props.devices.map(t=>e.jsx(Rs,{device:t,reloadDevices:this.props.reloadDevices})))})}}var We,_s=new Uint8Array(16);function Us(){if(!We&&(We=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!We))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return We(_s)}const Fs=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Os(n){return typeof n=="string"&&Fs.test(n)}var X=[];for(var et=0;et<256;++et)X.push((et+256).toString(16).substr(1));function Ps(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,l=(X[n[t+0]]+X[n[t+1]]+X[n[t+2]]+X[n[t+3]]+"-"+X[n[t+4]]+X[n[t+5]]+"-"+X[n[t+6]]+X[n[t+7]]+"-"+X[n[t+8]]+X[n[t+9]]+"-"+X[n[t+10]]+X[n[t+11]]+X[n[t+12]]+X[n[t+13]]+X[n[t+14]]+X[n[t+15]]).toLowerCase();if(!Os(l))throw TypeError("Stringified UUID is invalid");return l}function Hs(n,t,l){n=n||{};var u=n.random||(n.rng||Us)();return u[6]=u[6]&15|64,u[8]=u[8]&63|128,Ps(u)}const Bs=({onCommand:n,prompt:t="$",welcomeMessage:l="Interactive Shell (Restricted Mode)",platform:u})=>{const[p,s]=r.useState([{type:"system",content:l,timestamp:Date.now()},{type:"system",content:'Type "help" for allowed commands.',timestamp:Date.now()}]),[L,v]=r.useState(""),[x,h]=r.useState([]),[m,A]=r.useState(-1),[S,U]=r.useState(!1),w=r.useRef(null),j=r.useRef(null);r.useEffect(()=>{w.current&&(w.current.scrollTop=w.current.scrollHeight)},[p]);const T=b=>{const k=b.trim();if((k.startsWith("{")||k.startsWith("["))&&(k.endsWith("}")||k.endsWith("]")))try{const y=JSON.parse(k);return JSON.stringify(y,null,2)}catch{}return b},F=async b=>{if(b.key==="Enter"&&!S){const k=L.trim();if(!k)return;if(v(""),s(y=>[...y,{type:"command",content:`${t} ${k}`,timestamp:Date.now()}]),h(y=>[...y,k]),A(-1),U(!0),k==="clear"){s([]),U(!1);return}if(k==="help"){let y="";u==="android"?y=`
|
|
141
|
+
*/const Ls=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Ts=E("wrench",Ls),zs=[{label:"1 Hour",value:"1h"},{label:"2 Hours",value:"2h"},{label:"4 Hours",value:"4h"},{label:"8 Hours",value:"8h"}],Es=({device:n,onClose:t,onReserved:l})=>{const[u,p]=r.useState(""),[s,L]=r.useState("1h"),[v,x]=r.useState(""),[h,m]=r.useState(!1),[A,S]=r.useState(null),U=async()=>{if(!u.trim()){S("Please enter your name/ID");return}m(!0),S(null);try{const w=await D.reserveDevice(n.udid,n.host,u,s,v);w.success?(l(),t()):S(w.error||"Failed to reserve device")}catch(w){S(w.message||"An unexpected error occurred")}finally{m(!1)}};return At.createPortal(e.jsx("div",{className:"reservation-modal-overlay",onClick:t,children:e.jsxs("div",{className:"reservation-modal",onClick:w=>w.stopPropagation(),children:[e.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),e.jsxs("div",{className:"reservation-modal-header",children:[e.jsxs("div",{className:"reservation-modal-title",children:[e.jsx(Ct,{size:18,className:"title-icon"}),"Reserve Device"]}),e.jsx("button",{className:"close-btn",onClick:t,children:e.jsx(tt,{size:20})})]}),e.jsxs("div",{className:"reservation-modal-body",children:[e.jsxs("div",{className:"device-id-badge",children:[e.jsx("span",{className:"label",children:"Device:"}),e.jsx("span",{className:"value",children:n.udid})]}),e.jsxs("p",{children:["Reserve ",e.jsx("strong",{children:n.name||n.udid})," for exclusive use. This will prevent CI sessions from using this device."]}),e.jsxs("div",{className:"reservation-form-group",children:[e.jsxs("label",{children:[e.jsx(Ds,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-primary)"}}),"Reserved By"]}),e.jsx("input",{type:"text",className:"reservation-input",placeholder:"Enter your name or ID",value:u,onChange:w=>p(w.target.value),disabled:h})]}),e.jsxs("div",{className:"reservation-form-group",children:[e.jsxs("label",{children:[e.jsx(Nt,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-primary)"}}),"Duration"]}),e.jsx("div",{className:"duration-selector",children:zs.map(w=>e.jsx("div",{className:`duration-option ${s===w.value?"active":""}`,onClick:()=>L(w.value),children:w.label},w.value))})]}),e.jsxs("div",{className:"reservation-form-group",children:[e.jsxs("label",{children:[e.jsx(os,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-primary)"}}),"Reason (Optional)"]}),e.jsx("input",{type:"text",className:"reservation-input",placeholder:"e.g., Debugging flaky login test",value:v,onChange:w=>x(w.target.value),disabled:h})]}),A&&e.jsxs("div",{className:"error-message",children:[e.jsx(Lt,{size:14,style:{marginRight:6,verticalAlign:"middle"}}),A]})]}),e.jsxs("div",{className:"reservation-actions",children:[e.jsx("button",{className:"btn-cancel",onClick:t,disabled:h,children:"Cancel"}),e.jsx("button",{className:"btn-reserve",onClick:U,disabled:h||!u.trim(),children:h?"Reserving...":"Confirm Reservation"})]})]})}),document.body)},Is=({device:n,onClose:t,onUpdated:l})=>{const{toast:u}=ft(),[p,s]=r.useState(n.tags||[]),[L,v]=r.useState(""),[x,h]=r.useState(!1),m=r.useRef(null);r.useEffect(()=>{m.current&&m.current.focus()},[]);const A=()=>{const j=L.trim();j&&!p.includes(j)&&(s([...p,j]),v(""))},S=j=>{s(p.filter(T=>T!==j))},U=j=>{j.key==="Enter"?A():j.key==="Escape"&&t()},w=async()=>{h(!0);try{await D.updateDeviceTags(n.udid,n.host,p),l(),t()}catch(j){console.error("Failed to update tags",j),u("Error saving tags. Please try again.","error")}finally{h(!1)}};return e.jsx("div",{className:"tag-modal-overlay",onClick:t,children:e.jsxs("div",{className:"tag-modal-container",onClick:j=>j.stopPropagation(),children:[e.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),e.jsxs("div",{className:"tag-modal-header",children:[e.jsxs("div",{className:"tag-modal-title",children:[e.jsx(bs,{size:18,className:"title-icon"}),"Manage Device Tags"]}),e.jsx("button",{className:"close-btn",onClick:t,children:e.jsx(tt,{size:20})})]}),e.jsxs("div",{className:"tag-modal-body",children:[e.jsxs("div",{className:"device-id-badge",children:[e.jsx("span",{className:"label",children:"Device:"}),e.jsx("span",{className:"value",children:n.udid})]}),e.jsxs("div",{className:"tag-input-section",children:[e.jsx("label",{htmlFor:"tag-input",children:"Add New Tag"}),e.jsxs("div",{className:"input-with-button",children:[e.jsx("input",{ref:m,id:"tag-input",type:"text",placeholder:"e.g. stable, team-a, ios-17",value:L,onChange:j=>v(j.target.value),onKeyDown:U}),e.jsx("button",{className:"add-inline-btn",onClick:A,disabled:!L.trim(),children:e.jsx(wt,{size:16})})]}),e.jsx("p",{className:"input-hint",children:"Press Enter to add multiple tags"})]}),e.jsxs("div",{className:"tags-display-section",children:[e.jsx("label",{children:"Current Tags"}),e.jsx("div",{className:"tags-list",children:p.length>0?p.map(j=>e.jsxs("div",{className:"tag-pill-editable",children:[j,e.jsx("button",{className:"remove-tag",onClick:()=>S(j),children:e.jsx(tt,{size:12})})]},j)):e.jsx("div",{className:"empty-tags",children:"No tags assigned to this device."})})]})]}),e.jsxs("div",{className:"tag-modal-footer",children:[e.jsx("button",{className:"btn-cancel",onClick:t,children:"Cancel"}),e.jsx("button",{className:"btn-save",onClick:w,disabled:x,children:x?"Saving...":"Apply Changes"})]})]})})};class Rs extends qe.Component{constructor(t){super(t),this.state={showReservation:!1,showTagManager:!1,showControl:!1}}getStatusClassName(){return this.props.device.offline?"disabled":this.props.device.busy?"busy":this.isReserved()?"reserved":""}getDeviceState(){return this.props.device.offline?"offline":this.props.device.userBlocked?"maintenance":this.props.device.busy?"busy":this.isReserved()?"reserved":"ready"}isReserved(){const{reservedUntil:t}=this.props.device;return t?Date.now()<t:!1}getRemainingReservationTime(){const{reservedUntil:t}=this.props.device;if(!t)return"";const l=t-Date.now();return l<=0?"":lt(l,{compact:!0})}async releaseReservation(t,l){await D.releaseReservation(t,l),this.props.reloadDevices()}async blockDevice(t,l){await D.blockDevice(t,l),this.props.reloadDevices()}async unblockDevice(t,l){await D.unblockDevice(t,l),this.props.reloadDevices()}async manageTags(){this.setState({showTagManager:!0})}render(){var H;const{name:t,sdk:l,deviceType:u,platform:p,udid:s,dashboard_link:L,total_session_count:v,host:x,totalUtilizationTimeMilliSec:h,userBlocked:m,busy:A,session_id:S,reservedBy:U,reservedUntil:w,reservationReason:j,batteryLevel:T,thermalStatus:F,storageFree:b,tags:k,sessionProgress:y,totalHealedCount:R}=this.props.device,M=this.getDeviceState();let _="";try{_=new URL(x).hostname}catch{_=x.split(":")[1].replace("//","")}const q=()=>A?null:this.isReserved()?e.jsx("button",{className:"tactical-btn reserved",onClick:()=>this.releaseReservation(s,x),title:`Reserved by ${U}${j?`: ${j}`:""}. Expires: ${w?new Date(w).toLocaleString():"Never"}`,children:e.jsx(St,{size:14,color:"#38bdf8"})}):m?e.jsx("button",{className:"tactical-btn exit-maintenance",onClick:()=>this.unblockDevice(s,x),title:"Exit Maintenance",children:e.jsx(it,{size:14})}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"tactical-btn reserve",onClick:()=>this.setState({showReservation:!0}),title:"Reserve Device",children:e.jsx(Ct,{size:14,color:"#38bdf8"})}),e.jsx("button",{className:"tactical-btn maintenance",onClick:()=>this.blockDevice(s,x),title:"Enter Maintenance",children:e.jsx(Ts,{size:14,color:"#fbbf24"})})]});return e.jsxs("div",{className:`device-info-card-container ${this.getStatusClassName()} group`,children:[e.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.1,zIndex:0}}),e.jsxs("div",{className:"card-header relative z-10",children:[e.jsxs("div",{className:"header-left",children:[e.jsx("div",{className:`platform-icon-wrapper ${p}`,children:["ios","tvos"].includes(p)?e.jsx(kt,{size:14}):e.jsx(st,{size:14})}),e.jsx("div",{className:"device-id-mono",title:s,children:s})]}),e.jsx("div",{className:`device-status-badge ${M} ${M==="busy"&&y&&y!=="Session Active"?"pulse":""}`,children:M==="busy"&&y&&y!=="Session Active"?y:M})]}),e.jsxs("div",{className:"device-info-main relative z-10",children:[e.jsx("h3",{className:"device-name",title:t,children:t}),e.jsxs("p",{className:"device-subtext",children:[u.toUpperCase()," • ",l]}),this.props.device.tags&&this.props.device.tags.length>0&&e.jsxs("div",{className:"device-tags-inline",children:[this.props.device.tags.slice(0,3).map(te=>e.jsx("span",{className:"inline-tag",title:te,children:te},te)),this.props.device.tags.length>3&&e.jsxs("span",{className:"inline-tag-overflow",children:["+",this.props.device.tags.length-3]})]})]}),e.jsxs("div",{className:"metrics-grid relative z-10",children:[e.jsxs("div",{className:"metric-item",title:`Host: ${_}${this.props.device.ip?` • IP: ${this.props.device.ip}`:""}`,children:[this.props.device.ip?e.jsx($t,{size:10,className:"text-dim"}):e.jsx(dt,{size:10,className:"text-dim"}),e.jsx("span",{className:"truncate",children:this.props.device.ip||_})]}),e.jsxs("div",{className:"metric-item",title:`Architecture: ${this.props.device.cpuArchitecture||"Unknown"}`,children:[e.jsx(Rt,{size:10,className:"text-dim"}),e.jsx("span",{className:"truncate uppercase",children:this.props.device.cpuArchitecture||"arch"})]}),e.jsxs("div",{className:`metric-item health ${((H=this.props.device.healthStatus)==null?void 0:H.toLowerCase())||"healthy"}`,title:this.props.device.healthCheckError||"Device is healthy",children:[e.jsx("div",{className:"health-dot"}),e.jsx("span",{children:this.props.device.healthStatus||"Healthy"}),R&&R>0&&e.jsxs("span",{className:"heal-badge",children:[e.jsx(it,{size:8})," ",R]})]}),F&&F!=="Unknown"&&e.jsxs("div",{className:"metric-item thermal",title:`Thermal: ${F}`,children:[e.jsx(ks,{size:10,style:{color:F==="Nominal"?"var(--color-primary)":"var(--color-amber)"}}),e.jsx("span",{children:F})]}),T!==void 0&&e.jsxs("div",{className:"metric-item battery",title:`Battery: ${T}%`,children:[e.jsx("div",{className:`mini-battery ${T<20?"low":""}`,children:e.jsx("div",{className:"battery-fill",style:{width:`${T}%`}})}),e.jsxs("span",{children:[T,"%"]})]}),b&&b!=="Unknown"&&e.jsxs("div",{className:"metric-item storage",title:`Free Space: ${b}`,children:[e.jsx(zt,{size:10,style:{color:"var(--color-sky)"}}),e.jsx("span",{children:b})]})]}),e.jsx("div",{className:"dynamic-data-layer relative z-10",children:this.isReserved()?e.jsxs("div",{className:"reservation-micro-banner",children:[e.jsx(Nt,{size:10}),e.jsxs("span",{children:["RES: ",U||"Anon"," (",this.getRemainingReservationTime(),")"]})]}):S?e.jsxs("div",{className:"session-micro-banner",children:[e.jsx(at,{size:10}),e.jsxs("span",{children:["SID: ",S]})]}):e.jsx("div",{className:"utilization-micro-info",children:e.jsxs("span",{children:["UTIL: ",lt(h||0,{compact:!0})]})})}),e.jsxs("div",{className:"action-row relative z-10",children:[e.jsx("button",{className:"tactical-btn add-tag",onClick:()=>this.manageTags(),title:"Manage Tags",children:e.jsx(wt,{size:14})}),q(),e.jsxs("button",{className:`tactical-btn control-btn ${A&&S&&!S.toString().startsWith("manual_")?"disabled":""}`,onClick:()=>!(A&&S&&!S.toString().startsWith("manual_"))&&this.props.navigate(`/devices/${s}/control`),disabled:A&&!!S&&!S.toString().startsWith("manual_"),title:A&&S&&!S.toString().startsWith("manual_")?"Locked: Appium Session":"Take Control",children:[e.jsx(dt,{size:14}),e.jsx("span",{style:{fontSize:"10px",fontWeight:800,letterSpacing:"0.05em",fontFamily:"Outfit, sans-serif"},children:"CTRL"})]})]}),this.state.showReservation&&e.jsx(Es,{device:this.props.device,onClose:()=>this.setState({showReservation:!1}),onReserved:()=>this.props.reloadDevices()}),this.state.showTagManager&&e.jsx(Is,{device:this.props.device,onClose:()=>this.setState({showTagManager:!1}),onUpdated:()=>this.props.reloadDevices()})]})}}function Ms(n){const t=nt();return e.jsx(Rs,{...n,navigate:t})}class _s extends qe.Component{render(){return e.jsx("div",{className:"device-explorer-card-container",children:qe.Children.toArray(this.props.devices.map(t=>e.jsx(Ms,{device:t,reloadDevices:this.props.reloadDevices})))})}}var We,Us=new Uint8Array(16);function Fs(){if(!We&&(We=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!We))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return We(Us)}const Os=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Hs(n){return typeof n=="string"&&Os.test(n)}var X=[];for(var et=0;et<256;++et)X.push((et+256).toString(16).substr(1));function Ps(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,l=(X[n[t+0]]+X[n[t+1]]+X[n[t+2]]+X[n[t+3]]+"-"+X[n[t+4]]+X[n[t+5]]+"-"+X[n[t+6]]+X[n[t+7]]+"-"+X[n[t+8]]+X[n[t+9]]+"-"+X[n[t+10]]+X[n[t+11]]+X[n[t+12]]+X[n[t+13]]+X[n[t+14]]+X[n[t+15]]).toLowerCase();if(!Hs(l))throw TypeError("Stringified UUID is invalid");return l}function Bs(n,t,l){n=n||{};var u=n.random||(n.rng||Fs)();return u[6]=u[6]&15|64,u[8]=u[8]&63|128,Ps(u)}const Ws=({onCommand:n,prompt:t="$",welcomeMessage:l="Interactive Shell (Restricted Mode)",platform:u})=>{const[p,s]=r.useState([{type:"system",content:l,timestamp:Date.now()},{type:"system",content:'Type "help" for allowed commands.',timestamp:Date.now()}]),[L,v]=r.useState(""),[x,h]=r.useState([]),[m,A]=r.useState(-1),[S,U]=r.useState(!1),w=r.useRef(null),j=r.useRef(null);r.useEffect(()=>{w.current&&(w.current.scrollTop=w.current.scrollHeight)},[p]);const T=b=>{const k=b.trim();if((k.startsWith("{")||k.startsWith("["))&&(k.endsWith("}")||k.endsWith("]")))try{const y=JSON.parse(k);return JSON.stringify(y,null,2)}catch{}return b},F=async b=>{if(b.key==="Enter"&&!S){const k=L.trim();if(!k)return;if(v(""),s(y=>[...y,{type:"command",content:`${t} ${k}`,timestamp:Date.now()}]),h(y=>[...y,k]),A(-1),U(!0),k==="clear"){s([]),U(!1);return}if(k==="help"){let y="";u==="android"?y=`
|
|
142
142
|
Android Allowed Commands:
|
|
143
143
|
• System Info: getprop, ip addr, date, uptime, cat /proc/meminfo, cat /proc/cpuinfo
|
|
144
144
|
• Process Mgmt: ps, top
|
|
@@ -189,7 +189,7 @@ const element = await driver.$('${T}');
|
|
|
189
189
|
await element.waitForExist({ timeout: 5000 });
|
|
190
190
|
${x?`await driver.$('target').clearValue();
|
|
191
191
|
await element.addValue("your text here");`:"await element.click();"}
|
|
192
|
-
// Assert with expect(element).toBeDisplayed()`:`// Strategy "${p}" not supported in WebdriverIO mobile`}function Ws(n){var U,w,j,T,F,b,k,y,R,M,_;const t=(n.type||"").toLowerCase(),l=((U=n.attributes)==null?void 0:U.clickable)==="true"||((w=n.attributes)==null?void 0:w.clickable)===!0,u=((j=n.attributes)==null?void 0:j.enabled)!=="false"&&((T=n.attributes)==null?void 0:T.enabled)!==!1,p=((F=n.attributes)==null?void 0:F.scrollable)==="true"||((b=n.attributes)==null?void 0:b.scrollable)===!0,s=n.text||n.label||n.value||"",L=((k=n.children)==null?void 0:k.length)||0;let v="Element",x="📦";t.includes("button")||t.includes("btn")||l&&L===0?(v="Button",x="🔘"):t.includes("edit")||t.includes("input")||t.includes("field")?(v="Text Input",x="✏️"):t.includes("image")||t.includes("img")||t.includes("imageview")?(v="Image",x="🖼️"):t.includes("scroll")||t.includes("recyclerview")||t.includes("listview")||p?(v="Scrollable List",x="📜"):t.includes("text")||t.includes("label")?(v="Text Label",x="📝"):t.includes("switch")||t.includes("toggle")||t.includes("checkbox")?(v="Toggle / Checkbox",x="☑️"):t.includes("nav")||t.includes("toolbar")||t.includes("tabbar")?(v="Navigation Bar",x="🧭"):L>0&&(v=`Container (${L} children)`,x="🗂️");const h=((y=n.suggestedLocators)==null?void 0:y.find(q=>q.strategy==="accessibility id"||q.strategy==="id"))||((R=n.suggestedLocators)==null?void 0:R[0]),m=u?((M=n.rect)==null?void 0:M.width)===0||((_=n.rect)==null?void 0:_.height)===0?"⚠️ Zero-size element — may not be interactable":void 0:"⚠️ Element is disabled",A=s?` with text "${s.slice(0,30)}"`:"",S=`This is a ${v.toLowerCase()}${A}. ${l?"It can be tapped/clicked.":p?"It supports scrolling.":"It is a visual container."}${L>0?` Contains ${L} child element${L>1?"s":""}.`:""}`;return{role:v,description:S,interactable:l||u,bestLocator:h,warning:m,emoji:x}}function xt(n,t){if(!t)return!0;const l=t.toLowerCase().trim(),u={button:["button","btn","clickable","tapable"],input:["edittext","input","field","textfield","textinput","edit"],image:["image","imageview","img","picture","photo","icon"],text:["textview","label","text","statictext"],list:["listview","recyclerview","scrollview","tableview","collectionview","scroll"],toggle:["switch","checkbox","toggle","radiobutton"],nav:["toolbar","navigationbar","tabbar","actionbar","navbar"]},p=(n.type||"").toLowerCase(),s=(n.text||n.label||n.value||"").toLowerCase(),L=(n.name||"").toLowerCase(),v=Object.values(n.attributes||{}).join(" ").toLowerCase();for(const[x,h]of Object.entries(u))if(l.includes(x)&&h.some(m=>p.includes(m)))return!0;return p.includes(l)||s.includes(l)||L.includes(l)||v.includes(l)}const Vs=({sessionId:n,udid:t,streamUrl:l})=>{var De,ie,ae,ke,xe,Ae,Ue;const[u,p]=r.useState(!0),[s,L]=r.useState(null),[v,x]=r.useState(null),[h,m]=r.useState(null),[A,S]=r.useState(null),[U,w]=r.useState(new Set(["/"])),[j,T]=r.useState(""),[F,b]=r.useState(null),[k,y]=r.useState("info"),[R,M]=r.useState("java"),[_,q]=r.useState(null),[P,te]=r.useState({width:0,height:0}),[Ce,fe]=r.useState({width:0,height:0}),[Ge,d]=r.useState(!1),[Z,Te]=r.useState("inspect"),Se=r.useRef(null),ye=r.useRef(null),je=r.useRef(null),me=r.useRef(null),ue=r.useCallback(()=>{var z,K,J;if(!Se.current)return;const i=Se.current.getBoundingClientRect(),o=i.width,g=i.height,C=(z=s==null?void 0:s.hierarchy)==null?void 0:z.rect;let O=((K=s==null?void 0:s.metadata)==null?void 0:K.screenWidth)||P.width||1,H=((J=s==null?void 0:s.metadata)==null?void 0:J.screenHeight)||P.height||1;C&&C.width>0&&C.height>0&&(O=C.width,H=C.height);const B=O/H;let W,V;o/g>B?(V=g,W=V*B):(W=o,V=W/B),fe({width:W,height:V})},[s,P]);r.useEffect(()=>(ue(),window.addEventListener("resize",ue),()=>window.removeEventListener("resize",ue)),[ue]),r.useEffect(()=>{t&&ce()},[t]),r.useEffect(()=>{var i;if((i=h==null?void 0:h.suggestedLocators)!=null&&i.length){const o=h.suggestedLocators.find(g=>g.strategy==="accessibility id"||g.strategy==="id")||h.suggestedLocators[0];q(o)}else q(null)},[h]);const ce=async()=>{if(t){p(!0),x(null);try{const i=await D.getInspectorSnapshot(t);L(i);const o=new Set(["/"]),g=(C,O)=>{var H;O<2&&(o.add(C.xpath),(H=C.children)==null||H.forEach(B=>g(B,O+1)))};i.hierarchy&&g(i.hierarchy,0),w(o)}catch(i){x(i.message||"Failed to capture snapshot")}finally{p(!1)}}},ze=i=>{const{naturalWidth:o,naturalHeight:g}=i.currentTarget;te({width:o,height:g})},le=()=>d(!0),Ee=i=>{d(!1);const{naturalWidth:o,naturalHeight:g}=i.currentTarget;o>0&&g>0&&te({width:o,height:g})},Q=l&&!Ge,Ie=i=>{if(Z!=="interact"||!t)return;const o=i.currentTarget.getBoundingClientRect();me.current={x:i.clientX-o.left,y:i.clientY-o.top,time:Date.now()}},oe=async i=>{var de,Fe,Le;if(Z!=="interact"||!t||!me.current)return;const o=me.current,g=i.currentTarget.getBoundingClientRect(),C=i.clientX-g.left,O=i.clientY-g.top,H=Date.now()-o.time,B=Ce.width,W=Ce.height,V=(de=s==null?void 0:s.hierarchy)==null?void 0:de.rect;let z=((Fe=s==null?void 0:s.metadata)==null?void 0:Fe.screenWidth)||P.width,K=((Le=s==null?void 0:s.metadata)==null?void 0:Le.screenHeight)||P.height;if(V&&V.width>0&&V.height>0&&(z=V.width,K=V.height),!z||!K||B===0||W===0)return;const J=(a,c)=>({x:Math.round(a/B*z),y:Math.round(c/W*K),px:a/B,py:c/W}),Y=J(o.x,o.y),ge=J(C,O),se=Math.sqrt(Math.pow(C-o.x,2)+Math.pow(O-o.y,2));if(!(Y.px<0||Y.px>1||Y.py<0||Y.py>1)){try{H<500&&se<10?await D.tap(t,Y.x,Y.y):H>=500&&se<10?await D.touchAndHold(t,Y.x,Y.y,H):se>=10&&await D.swipe(t,Y.x,Y.y,ge.x,ge.y)}catch(a){console.error("Interaction failed:",a)}me.current=null}},Ye=i=>{const o=new Set(U);o.has(i)?o.delete(i):o.add(i),w(o)},$e=()=>{const i=new Set,o=g=>{var C;i.add(g.xpath),(C=g.children)==null||C.forEach(o)};s!=null&&s.hierarchy&&o(s.hierarchy),w(i)},be=()=>w(new Set(["/"])),Re=(i,o)=>{navigator.clipboard.writeText(i),b(o),setTimeout(()=>b(null),2e3)},pe=i=>{var g;let o=1;return(g=i.children)==null||g.forEach(C=>o+=pe(C)),o},Ne=i=>i.xpath.split("/").filter(Boolean).slice(-3),ee=(i,o=0)=>{var V;if(!i)return null;const g=U.has(i.xpath),C=((V=i.children)==null?void 0:V.length)>0,O=(h==null?void 0:h.xpath)===i.xpath,H=(A==null?void 0:A.xpath)===i.xpath,B=i.name||i.type.split(".").pop()||"Element",W=!j||xt(i,j);if(!W&&!C)return null;if(j&&!W){const z=K=>{var J;return xt(K,j)?!0:((J=K.children)==null?void 0:J.some(z))||!1};if(!z(i))return null}return e.jsxs("div",{className:"tree-node",children:[e.jsxs("div",{className:`tree-item ${O?"selected":""} ${H&&!O?"hovered":""}`,onClick:()=>{m(i),y("info")},onMouseEnter:()=>S(i),onMouseLeave:()=>S(null),children:[e.jsx("div",{className:"tree-item-indent",style:{width:`${o*14}px`}}),C?e.jsx("button",{onClick:z=>{z.stopPropagation(),Ye(i.xpath)},className:"tree-toggle",children:g?e.jsx(yt,{size:11}):e.jsx(bt,{size:11})}):e.jsx("span",{className:"tree-toggle-spacer"}),e.jsx(Ot,{size:11,className:"tree-icon"}),e.jsx("span",{className:"tree-label",children:B}),i.text&&e.jsxs("span",{className:"tree-text-preview",children:['"',i.text.slice(0,20),'"']}),C&&e.jsx("span",{className:"tree-badge",children:i.children.length})]}),g&&C&&e.jsx("div",{className:"tree-children",children:i.children.map(z=>ee(z,o+1))})]},i.xpath)},we=i=>{var B,W,V;if(!P.width)return[];const o=[],g=(B=s==null?void 0:s.hierarchy)==null?void 0:B.rect;let C=((W=s==null?void 0:s.metadata)==null?void 0:W.screenWidth)||P.width,O=((V=s==null?void 0:s.metadata)==null?void 0:V.screenHeight)||P.height;g&&g.width>0&&g.height>0&&(C=g.width,O=g.height);const H=(z,K)=>{var Y,ge,se;const J=!z.children||z.children.length===0;((Y=z.rect)==null?void 0:Y.width)>0&&((ge=z.rect)==null?void 0:ge.height)>0&&J&&o.push(e.jsx("div",{className:"omni-hit-area",style:{left:`${z.rect.x/C*100}%`,top:`${z.rect.y/O*100}%`,width:`${z.rect.width/C*100}%`,height:`${z.rect.height/O*100}%`,zIndex:K},onClick:de=>{de.stopPropagation(),m(z),y("info")},onMouseEnter:()=>S(z),onMouseLeave:()=>S(null)},z.xpath)),(se=z.children)==null||se.forEach(de=>H(de,K+1))};return s!=null&&s.hierarchy&&H(s.hierarchy,1),o},ve=(i,o)=>{var H,B,W;if(!(i!=null&&i.rect)||!P.width)return null;const g=(H=s==null?void 0:s.hierarchy)==null?void 0:H.rect;let C=((B=s==null?void 0:s.metadata)==null?void 0:B.screenWidth)||P.width,O=((W=s==null?void 0:s.metadata)==null?void 0:W.screenHeight)||P.height;return g&&g.width>0&&g.height>0&&(C=g.width,O=g.height),e.jsx("div",{className:`omni-frame-${o}`,style:{left:`${i.rect.x/C*100}%`,top:`${i.rect.y/O*100}%`,width:`${i.rect.width/C*100}%`,height:`${i.rect.height/O*100}%`}})},Me=s!=null&&s.hierarchy?pe(s.hierarchy):0,G=h?Ws(h):null,_e={stable:{icon:e.jsx(it,{size:10}),cls:"stable"},moderate:{icon:e.jsx(Tt,{size:10}),cls:"moderate"},fragile:{icon:e.jsx(ht,{size:10}),cls:"fragile"},"very-fragile":{icon:e.jsx(ht,{size:10}),cls:"very-fragile"}};return e.jsx("div",{className:"omni-inspector-container",children:e.jsxs("div",{className:"omni-main-content",children:[e.jsxs("div",{className:"omni-screenshot-panel",children:[e.jsxs("div",{className:"omni-screenshot-header",children:[e.jsxs("div",{className:"omni-header-left",children:[e.jsx("span",{className:"omni-screenshot-title",children:"Device Preview"}),e.jsxs("div",{className:"omni-mode-toggle",children:[e.jsxs("button",{className:`omni-mode-btn ${Z==="inspect"?"active":""}`,onClick:()=>Te("inspect"),title:"Inspection Mode (Highlight Elements)",children:[e.jsx(Rt,{size:12}),e.jsx("span",{children:"Inspect"})]}),e.jsxs("button",{className:`omni-mode-btn ${Z==="interact"?"active":""}`,onClick:()=>Te("interact"),title:"Interaction Mode (Direct Control)",children:[e.jsx(Cs,{size:12}),e.jsx("span",{children:"Interact"})]})]})]}),e.jsxs("button",{className:"omni-refresh-btn",onClick:ce,disabled:u,children:[e.jsx(Ve,{size:12,className:u?"animate-spin":""}),u?"Capturing...":"Refresh"]})]}),e.jsxs("div",{className:"omni-screenshot-container",ref:Se,children:[u&&!Q&&e.jsxs("div",{className:"omni-loading-overlay",children:[e.jsx("div",{className:"omni-spinner"}),e.jsx("span",{children:"Capturing screen..."})]}),!s&&!u&&!Q&&e.jsxs("div",{className:"omni-empty-state",children:[e.jsx(ut,{size:40}),e.jsx("span",{children:"Click Refresh to capture"})]}),Q&&e.jsxs("div",{className:`omni-screenshot-wrapper ${Z==="interact"?"interactable":""}`,onMouseDown:Ie,onMouseUp:oe,children:[e.jsx("img",{ref:je,src:l,onLoad:Ee,onError:le,className:"omni-screenshot-img",style:Z==="interact"?{pointerEvents:"none"}:{},draggable:!1,alt:"Live Device Stream"}),(s==null?void 0:s.hierarchy)&&Z==="inspect"&&e.jsxs("div",{className:"omni-overlay",children:[we(s.hierarchy),ve(A,"hover"),ve(h,"select")]})]}),!Q&&(s==null?void 0:s.screenshot)&&e.jsxs("div",{className:`omni-screenshot-wrapper ${Z==="interact"?"interactable":""}`,onMouseDown:Ie,onMouseUp:oe,children:[e.jsx("img",{ref:ye,src:`data:image/png;base64,${s.screenshot}`,onLoad:ze,className:"omni-screenshot-img",style:Z==="interact"?{pointerEvents:"none"}:{},draggable:!1}),Z==="inspect"&&e.jsxs("div",{className:"omni-overlay",children:[we(s.hierarchy),ve(A,"hover"),ve(h,"select")]})]})]})]}),e.jsxs("div",{className:"omni-tree-panel",children:[e.jsxs("div",{className:"omni-tree-header",children:[e.jsxs("div",{className:"omni-tree-title",children:[e.jsx(ts,{size:14}),e.jsx("span",{children:"Source"}),Me>0&&e.jsxs("span",{className:"omni-count-badge",children:[Me," elements"]})]}),e.jsxs("div",{className:"omni-tree-actions",children:[e.jsx("button",{onClick:$e,className:"omni-action-btn",title:"Expand All",children:e.jsx(Jt,{size:12})}),e.jsx("button",{onClick:be,className:"omni-action-btn",title:"Collapse All",children:e.jsx(vs,{size:12})})]})]}),e.jsxs("div",{className:"omni-tree-search",children:[e.jsx(Xe,{size:14}),e.jsx("input",{type:"text",placeholder:"Search elements... (try 'login button' or 'text field')",value:j,onChange:i=>T(i.target.value)}),j&&e.jsx("button",{onClick:()=>T(""),className:"omni-clear-btn",children:"×"})]}),j&&e.jsxs("div",{className:"omni-search-hint",children:[e.jsx(mt,{size:10}),' Smart search active — try "button", "input", "image"']}),e.jsx("div",{className:"omni-tree-content",children:s!=null&&s.hierarchy?ee(s.hierarchy):e.jsx("div",{className:"omni-empty-state small",children:e.jsx("span",{children:"No hierarchy loaded"})})})]}),e.jsxs("div",{className:"omni-details-panel",children:[e.jsxs("div",{className:"omni-details-tabs",children:[e.jsxs("button",{className:`omni-details-tab ${k==="info"?"active":""}`,onClick:()=>y("info"),children:[e.jsx(rs,{size:12})," Info"]}),e.jsxs("button",{className:`omni-details-tab ${k==="insight"?"active":""}`,onClick:()=>y("insight"),disabled:!h,title:"AI Element Analysis",children:[e.jsx(is,{size:12})," AI Insight"]}),e.jsxs("button",{className:`omni-details-tab ${k==="code"?"active":""}`,onClick:()=>y("code"),disabled:!h,title:"Generate Test Code",children:[e.jsx(ot,{size:12})," Code Gen"]})]}),e.jsx("div",{className:"omni-details-content",children:h?e.jsxs(e.Fragment,{children:[k==="info"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"omni-section",children:[e.jsx("div",{className:"omni-section-header",children:"Element Info"}),e.jsxs("div",{className:"omni-info-table",children:[e.jsxs("div",{className:"omni-info-row",children:[e.jsx("span",{className:"omni-info-key",children:"Type"}),e.jsx("span",{className:"omni-info-value mono",children:h.type})]}),h.text&&e.jsxs("div",{className:"omni-info-row",children:[e.jsx("span",{className:"omni-info-key",children:"Text"}),e.jsx("span",{className:"omni-info-value",children:h.text})]}),e.jsxs("div",{className:"omni-info-row",children:[e.jsx("span",{className:"omni-info-key",children:"Path"}),e.jsx("span",{className:"omni-info-value mono small",children:Ne(h).join(" › ")})]})]})]}),e.jsxs("div",{className:"omni-section",children:[e.jsx("div",{className:"omni-section-header",children:"Layout"}),e.jsx("div",{className:"omni-layout-grid",children:["x","y","width","height"].map(i=>e.jsxs("div",{className:"omni-layout-item",children:[e.jsx("span",{className:"omni-layout-label",children:i.toUpperCase()}),e.jsx("span",{className:"omni-layout-value",children:h.rect[i]})]},i))})]}),e.jsxs("div",{className:"omni-section",children:[e.jsxs("div",{className:"omni-section-header",children:["Locators",e.jsx("span",{className:"omni-section-badge",children:"Stability Scored"})]}),e.jsx("div",{className:"omni-locators-list",children:(De=h.suggestedLocators)==null?void 0:De.map(i=>{const o=pt(i.strategy,i.value),g=_e[o.level];return e.jsxs("div",{className:`omni-locator-row ${(_==null?void 0:_.strategy)===i.strategy?"selected-for-code":""}`,onClick:()=>q(i),title:"Click to use in Code Generator",children:[e.jsxs("div",{className:"omni-locator-left",children:[e.jsxs("div",{className:"omni-locator-top",children:[e.jsx("span",{className:"omni-locator-strategy",children:i.strategy}),e.jsxs("span",{className:`omni-stability-badge ${g.cls}`,title:o.reason,children:[g.icon,o.level]})]}),e.jsx("code",{className:"omni-locator-value",children:i.value}),e.jsx("span",{className:"omni-stability-reason",children:o.reason})]}),e.jsx("button",{onClick:C=>{C.stopPropagation(),Re(i.value,i.strategy)},className:`omni-copy-btn ${F===i.strategy?"copied":""}`,children:F===i.strategy?e.jsx(Je,{size:12}):e.jsx(Ze,{size:12})})]},i.strategy)})})]}),e.jsxs("div",{className:"omni-section",children:[e.jsx("div",{className:"omni-section-header",children:"Attributes"}),e.jsx("div",{className:"omni-attributes-table",children:Object.entries(h.attributes||{}).filter(([i,o])=>o!=null&&o!=="").map(([i,o])=>e.jsxs("div",{className:"omni-attr-row",children:[e.jsx("span",{className:"omni-attr-key",children:i}),e.jsx("span",{className:"omni-attr-value",children:String(o)})]},i))})]})]}),k==="insight"&&G&&e.jsxs("div",{className:"omni-insight-panel",children:[e.jsxs("div",{className:"omni-insight-role",children:[e.jsx("span",{className:"omni-insight-emoji",children:G.emoji}),e.jsxs("div",{children:[e.jsx("div",{className:"omni-insight-role-name",children:G.role}),e.jsx("div",{className:"omni-insight-interactable",children:G.interactable?e.jsxs("span",{className:"omni-badge-green",children:[e.jsx(_t,{size:10})," Interactable"]}):e.jsx("span",{className:"omni-badge-gray",children:"Visual Only"})})]})]}),G.warning&&e.jsx("div",{className:"omni-insight-warning",children:G.warning}),e.jsxs("div",{className:"omni-insight-description",children:[e.jsx(mt,{size:12,className:"omni-insight-icon"}),e.jsx("p",{children:G.description})]}),G.bestLocator&&e.jsxs("div",{className:"omni-insight-best-locator",children:[e.jsx("div",{className:"omni-section-header",children:"Recommended Locator"}),e.jsxs("div",{className:"omni-locator-row",children:[e.jsxs("div",{className:"omni-locator-left",children:[e.jsx("span",{className:"omni-locator-strategy",children:G.bestLocator.strategy}),e.jsx("code",{className:"omni-locator-value",children:G.bestLocator.value})]}),e.jsx("button",{onClick:()=>Re(G.bestLocator.value,"best"),className:`omni-copy-btn ${F==="best"?"copied":""}`,children:F==="best"?e.jsx(Je,{size:12}):e.jsx(Ze,{size:12})})]})]}),e.jsxs("div",{className:"omni-insight-attributes",children:[e.jsx("div",{className:"omni-section-header",children:"Quick Facts"}),e.jsx("div",{className:"omni-quick-facts",children:[{label:"Clickable",value:(ie=h.attributes)==null?void 0:ie.clickable},{label:"Enabled",value:(ae=h.attributes)==null?void 0:ae.enabled},{label:"Scrollable",value:(ke=h.attributes)==null?void 0:ke.scrollable},{label:"Focusable",value:(xe=h.attributes)==null?void 0:xe.focusable},{label:"Children",value:((Ae=h.children)==null?void 0:Ae.length)||0}].map(({label:i,value:o})=>e.jsxs("div",{className:"omni-quick-fact-row",children:[e.jsx("span",{className:"omni-quick-fact-label",children:i}),e.jsx("span",{className:`omni-quick-fact-value ${o==="true"||o===!0?"true":""}`,children:String(o??"—")})]},i))})]})]}),k==="code"&&e.jsxs("div",{className:"omni-codegen-panel",children:[e.jsx("div",{className:"omni-codegen-frameworks",children:["java","python","javascript","wdio"].map(i=>e.jsx("button",{className:`omni-fw-btn ${R===i?"active":""}`,onClick:()=>M(i),children:i==="java"?"☕ Java":i==="python"?"🐍 Python":i==="javascript"?"🟨 JS":"🔷 WD.io"},i))}),_?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"omni-codegen-locator-selector",children:[e.jsx("span",{className:"omni-codegen-label",children:"Locator:"}),e.jsx("select",{value:_.strategy,onChange:i=>{var g;const o=(g=h.suggestedLocators)==null?void 0:g.find(C=>C.strategy===i.target.value);o&&q(o)},className:"omni-fw-select",children:(Ue=h.suggestedLocators)==null?void 0:Ue.map(i=>e.jsxs("option",{value:i.strategy,children:[i.strategy," — ",pt(i.strategy,i.value).level]},i.strategy))})]}),e.jsxs("div",{className:"omni-codegen-output",children:[e.jsxs("div",{className:"omni-codegen-header",children:[e.jsx("span",{className:"omni-codegen-lang",children:R==="java"?"Java / TestNG":R==="python"?"Python / unittest":R==="javascript"?"JavaScript / Mocha":"WebdriverIO"}),e.jsx("button",{className:"omni-copy-btn",onClick:()=>Re(vt(h,(s==null?void 0:s.platform)==="android"?"android":(s==null?void 0:s.platform)==="ios"?"ios":"unknown",R,_),"code"),children:F==="code"?e.jsx(Je,{size:12}):e.jsx(Ze,{size:12})})]}),e.jsx("pre",{className:"omni-codegen-pre",children:e.jsx("code",{children:vt(h,(s==null?void 0:s.platform)==="android"?"android":(s==null?void 0:s.platform)==="ios"?"ios":"unknown",R,_)})})]})]}):e.jsxs("div",{className:"omni-empty-state small",children:[e.jsx(ot,{size:24}),e.jsx("span",{children:"No locators available for this element"})]})]})]}):e.jsxs("div",{className:"omni-empty-state",children:[e.jsx(ut,{size:32}),e.jsx("span",{children:"Select an element from the tree or screenshot"})]})})]})]})})};function qs({device:n,onClose:t}){var Le;const{toast:l,removeToast:u}=ft(),p=nt(),{tab:s}=jt(),L=r.useRef(null),v=r.useRef(null),[x,h]=r.useState({width:0,height:0}),[m,A]=r.useState(s||"actions"),[S,U]=r.useState(""),[w,j]=r.useState(""),[T,F]=r.useState(""),[b,k]=r.useState(!0),[y,R]=r.useState([]),[M,_]=r.useState(null),[q,P]=r.useState(!1),[te,Ce]=r.useState(!1),[fe,Ge]=r.useState(0),[d,Z]=r.useState(n),[Te,Se]=r.useState([]),[ye,je]=r.useState(!1),[me,ue]=r.useState(!1),[ce,ze]=r.useState(null),[le,Ee]=r.useState([]),[Q,Ie]=r.useState(!0),[oe,Ye]=r.useState(""),[$e,be]=r.useState(!1),[Re,pe]=r.useState(0),Ne=r.useRef(""),ee=r.useRef(null),[we,ve]=r.useState(!1);r.useEffect(()=>{m&&(!s||s!==m)&&p(`/devices/${n.udid}/control/${m}`,{replace:!0})},[m,s,n.udid,p]),r.useEffect(()=>{let a;if(m==="logs"){be(!1),pe(0);const c=async()=>{try{const f=await D.getLogs(d.udid);if(pe(N=>N+1),f&&f.logs&&f.logs.trim().length>0){be(!0);const N=f.logs.replace(/\\u[0-9a-fA-F]{4}/g,$=>JSON.parse(`"${$}"`)).replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,"").split(`
|
|
193
|
-
`).filter($=>$.trim().length>0);N.length>0&&Ee($=>[...$,...N].slice(-1e3))}else pe(N=>(N>=3&&be(!0),N))}catch(f){console.error("Failed to fetch logs:",f),pe(N=>(N>=3&&be(!0),N))}};c(),a=setInterval(c,3e3)}return()=>clearInterval(a)},[m,d.udid]);const Me=()=>{if(le.length===0)return e.jsx("div",{className:"log-empty-state",children:$e?e.jsxs(e.Fragment,{children:[e.jsx(at,{size:28,style:{color:"var(--text-muted)",marginBottom:12,opacity:.4}}),e.jsx("p",{className:"log-empty-title",children:"No log output yet"}),e.jsx("p",{className:"log-empty-subtitle",children:"The log stream is active but the device is quiet. Interact with the device to generate logs."})]}):e.jsxs(e.Fragment,{children:[e.jsx(Pe,{size:28,className:"animate-spin",style:{color:"var(--primary)",marginBottom:12}}),e.jsx("p",{className:"log-empty-title",children:"Connecting to device syslog..."}),e.jsxs("p",{className:"log-empty-subtitle",children:["Initializing persistent log stream for ",d.name]})]})});const a=le.filter(c=>!oe||c.toLowerCase().includes(oe.toLowerCase()));return a.length===0&&oe?e.jsxs("div",{className:"log-empty-state",children:[e.jsx(Xe,{size:28,style:{color:"var(--text-muted)",marginBottom:12,opacity:.4}}),e.jsxs("p",{className:"log-empty-title",children:['No matches for "',oe,'"']}),e.jsxs("p",{className:"log-empty-subtitle",children:[le.length," lines in buffer. Try a different search term."]})]}):a.map((c,f)=>{let N="log-debug";const $=c.toLowerCase();return $.includes("error")||$.includes("fail")?N="log-error":$.includes("warning")||$.includes("warn")?N="log-warn":($.includes("notice")||$.includes("info"))&&(N="log-notice"),e.jsxs("div",{className:`log-line ${N}`,children:[e.jsx("span",{className:"log-index",children:f+1}),e.jsx("span",{className:"log-content",children:c})]},`${f}-${c.substring(0,10)}`)})};r.useEffect(()=>{m==="logs"&&Q&&v.current&&(v.current.scrollTop=v.current.scrollHeight)},[le,m,Q]),r.useEffect(()=>((async()=>{try{Ce(!0),await D.startStream(d.udid);const f=(await D.getDevices()).find(N=>N.udid===d.udid);f&&Z(f)}catch(c){console.error("Auto-start stream failed:",c)}finally{Ce(!1)}})(),()=>{D.stopStream(d.udid).catch(()=>{})}),[n.udid]);const G=r.useCallback(async()=>{try{je(!0);const a=await D.listApps(d.udid);Array.isArray(a)&&Se(a)}catch(a){console.error("Failed to load apps:",a)}finally{je(!1)}},[d.udid]);r.useEffect(()=>{m==="actions"&&G()},[m,G]);const _e=parseInt(d.screenWidth||"1080",10),De=parseInt(d.screenHeight||"1920",10),ie=Math.min(_e,De),ae=Math.max(_e,De),ke=ie/ae,xe=r.useCallback(()=>{const a=!b,c=a?window.innerHeight*.55:window.innerHeight*.7,f=a?window.innerWidth*.8:window.innerWidth*.45,N=b?ke:1/ke;let $,I;b?($=c,I=$*N,I>f&&(I=f,$=I/N)):(I=f,$=I/N,$>c&&($=c,I=$*N)),h({width:I,height:$})},[ke,b]);r.useEffect(()=>(xe(),window.addEventListener("resize",xe),()=>window.removeEventListener("resize",xe)),[xe]),r.useEffect(()=>{const a=async()=>{if(Ne.current.length>0){const f=Ne.current;Ne.current="";try{await D.typeText(d.udid,f)}catch(N){console.error("Keyboard buffering flush failed:",N)}}},c=f=>{const N=document.activeElement;if(N&&(N.tagName==="INPUT"||N.tagName==="TEXTAREA"||N.isContentEditable)||!we&&m!=="terminal")return;const I=f.key;I==="Enter"?(ee.current&&clearTimeout(ee.current),a(),D.pressKey(d.udid,d.platform==="android"?66:"enter")):I==="Backspace"?(ee.current&&clearTimeout(ee.current),a(),D.pressKey(d.udid,d.platform==="android"?67:"backspace")):I.length===1&&(Ne.current+=I,ee.current&&clearTimeout(ee.current),ee.current=setTimeout(()=>{a()},50))};return window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c),ee.current&&clearTimeout(ee.current)}},[d.udid,d.platform,we,m]);const[Ae,Ue]=r.useState(Date.now()),i=()=>{const a=fe>0?`r=${fe}&`:"";return d.session_id&&!String(d.session_id).startsWith("manual_")?`/xenon/api/session/${d.session_id}/live_video?${a}t=${Ae}`:`/xenon/api/control/${d.udid}/stream?${a}t=${Ae}`};r.useEffect(()=>{fe>0&&Ue(Date.now())},[fe]);const o=r.useRef(null),g=a=>{const c=a.currentTarget.getBoundingClientRect();return{x:a.clientX-c.left,y:a.clientY-c.top}},C=a=>{const c=g(a);o.current={x:c.x,y:c.y,time:Date.now()}},O=async a=>{if(!o.current)return;const c=o.current,f=g(a),N=Date.now()-c.time;let $,I,ne,re;b?($=c.x/x.width*ie,I=c.y/x.height*ae,ne=f.x/x.width*ie,re=f.y/x.height*ae):($=c.x/x.width*ae,I=c.y/x.height*ie,ne=f.x/x.width*ae,re=f.y/x.height*ie);const he=Math.abs(ne-$),Oe=Math.abs(re-I);try{N<500&&he<10&&Oe<10?await D.tap(d.udid,Math.round($),Math.round(I)):N>=500&&he<10&&Oe<10?await D.touchAndHold(d.udid,Math.round($),Math.round(I),N):await D.swipe(d.udid,Math.round($),Math.round(I),Math.round(ne),Math.round(re))}catch(Dt){console.error("Action failed:",Dt)}o.current=null},H=()=>D.pressKey(d.udid,d.platform==="android"?3:"home"),B=()=>D.lock(d.udid),W=()=>D.unlock(d.udid),V=async()=>{S.trim()&&(await D.typeText(d.udid,S),U(""))},z=async()=>{try{j("Fetching...");const a=await D.getClipboard(d.udid);a&&a.content!==void 0?j(a.content||"(Clipboard is empty)"):j("No content received")}catch{j("Error: Check Appium Settings app")}},K=async()=>{P(!0);try{const a=await D.getScreenshot(d.udid);if(a!=null&&a.screenshot){const c={id:Hs(),base64:a.screenshot,timestamp:Date.now()};R(f=>[c,...f]),_(0)}}catch(a){console.error("Failed to take screenshot:",a)}finally{P(!1)}},J=a=>{R(c=>{const f=c.filter(N=>N.id!==a);return f.length===0?_(null):M!==null&&M>=f.length&&_(0),f})},Y=()=>{R([]),_(null),l("Cleared all captured evidence.","success")},ge=a=>{const c=document.createElement("a");c.href=`data:image/png;base64,${a}`,c.download=`screenshot-${d.udid}-${Date.now()}.png`,c.click()},se=async a=>{const c=ie/2,f=ae/2,N=ie*.4,$=ae*.4;let I,ne,re,he;switch(a){case"left":I=c+N,ne=f,re=c-N,he=f;break;case"right":I=c-N,ne=f,re=c+N,he=f;break;case"up":I=c,ne=f+$,re=c,he=f-$;break;case"down":I=c,ne=f-$,re=c,he=f+$;break}try{await D.swipe(d.udid,Math.round(I),Math.round(ne),Math.round(re),Math.round(he))}catch(Oe){console.error(`Quick swipe ${a} failed:`,Oe)}},de=async()=>{if(T.trim()){const a=l(`Uninstalling ${T}...`,"loading",0);try{je(!0),await D.uninstallApp(d.udid,T),F(""),l(`Request sent for ${T}`,"success"),setTimeout(G,3e3)}catch{l("Uninstall failed. Check logs.","error")}finally{je(!1),u(a)}}},Fe=async()=>{if(!ce)return;let a;try{ue(!0),a=l(`Installing app to ${d.udid}...`,"loading",0);const c=await D.uploadAndInstallApp(d.udid,ce);c.success?(l(c.message||"App installed successfully","success"),ze(null),setTimeout(G,5e3)):l("Installation failed: "+(c.error||"Unknown error"),"error")}catch(c){l("Installation failed: "+c.message,"error")}finally{a&&u(a),ue(!1)}};return e.jsxs("div",{className:"device-control-view",children:[e.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),e.jsxs("header",{className:"control-view-top-bar",children:[e.jsxs("button",{className:"back-to-devices-btn",onClick:t,children:[e.jsx(ct,{size:18})," DEVICES"]}),e.jsxs("div",{className:"device-info-mini",children:[e.jsx("span",{className:`device-pill platform-pill ${d.platform}`,children:d.platform==="ios"?"Apple":"Android"}),e.jsxs("span",{className:"device-pill version-pill",children:["v",d.sdk]}),d.reservedUntil&&Date.now()<d.reservedUntil&&e.jsxs("span",{className:"device-pill reserved-pill",title:`Reserved by ${d.reservedBy}${d.reservationReason?`: ${d.reservationReason}`:""}`,children:["RESERVED BY ",((Le=d.reservedBy)==null?void 0:Le.toUpperCase())||"ANONYMOUS"]}),e.jsx("h2",{className:"device-name-text",children:d.name}),e.jsx("span",{className:"code-font",style:{opacity:.5},children:d.udid})]})]}),e.jsxs("div",{className:`control-view-main ${b?"":"is-landscape"} ${m==="omni"?"omni-mode":""}`,children:[e.jsxs("div",{className:"device-preview-column",children:[e.jsx("div",{className:"device-screen-wrapper",children:e.jsxs("div",{ref:L,className:`device-stream-canvas ${b?"":"landscape"} ${we?"focused":""}`,style:{width:x.width,height:x.height,background:"#000"},tabIndex:0,onFocus:()=>ve(!0),onBlur:()=>ve(!1),onMouseDown:C,onMouseUp:O,children:[te&&e.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[e.jsx(Ve,{size:40,className:"animate-spin",color:"var(--primary)"}),e.jsx("p",{style:{marginTop:16},children:"ESTABLISHING TRACE..."})]}),e.jsx("img",{src:i(),alt:"Device Stream",className:"device-stream-image",style:{width:"100%",height:"100%",objectFit:"contain"},onError:()=>{console.warn("Stream failed to load, retrying..."),setTimeout(()=>Ge(a=>a+1),2e3)}})]})}),e.jsxs("aside",{className:"device-footer-actions",children:[e.jsxs("button",{className:`footer-action-btn ${b?"active":""}`,onClick:()=>k(!0),children:[e.jsx(Ve,{size:14,style:{transform:b?"none":"rotate(-90deg)"}})," ","PORTRAIT"]}),e.jsxs("button",{className:`footer-action-btn ${b?"":"active"}`,onClick:()=>k(!1),children:[e.jsx(Ve,{size:14,style:{transform:"rotate(90deg)"}})," LANDSCAPE"]}),e.jsx("div",{className:"footer-divider"}),e.jsxs("button",{className:"footer-action-btn",onClick:H,children:[e.jsx(Qt,{size:20})," HOME"]}),e.jsx("button",{className:"footer-action-btn",onClick:B,title:"Lock Device",children:e.jsx(Ut,{size:20})}),e.jsx("button",{className:"footer-action-btn",onClick:W,title:"Unlock Device",children:e.jsx(St,{size:20})})]})]}),e.jsxs("div",{className:"device-interactions-column",children:[e.jsxs("div",{className:"interaction-tabs",children:[e.jsx("button",{className:`tab-btn ${m==="actions"?"active":""}`,onClick:()=>A("actions"),children:"ACTIONS"}),e.jsx("button",{className:`tab-btn ${m==="screenshot"?"active":""}`,onClick:()=>A("screenshot"),children:"SCREENSHOT"}),e.jsx("button",{className:`tab-btn ${m==="logs"?"active":""}`,onClick:()=>A("logs"),children:"DEBUG LOGS"}),e.jsxs("button",{className:`tab-btn ${m==="terminal"?"active":""}`,onClick:()=>A("terminal"),children:[e.jsx(at,{size:14,style:{marginRight:6}})," SHELL"]}),e.jsx("button",{className:`tab-btn ${m==="omni"?"active":""}`,onClick:()=>A("omni"),children:"OMNI-VISION"})]}),e.jsx("div",{className:`interactions-scroll-area ${m==="terminal"?"terminal-mode":""} ${m==="screenshot"||m==="logs"?"screenshot-mode":""}`,children:e.jsxs("div",{className:"tab-content",children:[m==="omni"&&e.jsx("div",{className:"omni-inspector-tab-wrapper animate-fade-in",style:{height:"calc(100vh - 266px)"},children:e.jsx(Vs,{sessionId:d.session_id?String(d.session_id):null,udid:d.udid,streamUrl:i()})}),m==="actions"&&e.jsxs("div",{className:"actions-grid",children:[e.jsxs("div",{className:"action-card",children:[e.jsxs("h4",{className:"action-card-title",children:[e.jsx(hs,{size:18,color:"var(--primary)"})," Directional Gestures"]}),e.jsxs("div",{className:"gestures-grid-container",children:[e.jsxs("div",{className:"gestures-dpad",children:[e.jsx("div",{}),e.jsx("button",{className:"dpad-btn",onClick:()=>se("up"),children:e.jsx(Wt,{size:24})}),e.jsx("div",{}),e.jsx("button",{className:"dpad-btn",onClick:()=>se("left"),children:e.jsx(ct,{size:24})}),e.jsx("div",{className:"dpad-center"}),e.jsx("button",{className:"dpad-btn",onClick:()=>se("right"),children:e.jsx(bt,{size:24})}),e.jsx("div",{}),e.jsx("button",{className:"dpad-btn",onClick:()=>se("down"),children:e.jsx(yt,{size:24})}),e.jsx("div",{})]}),e.jsx("p",{className:"compact-label",style:{opacity:.5},children:"Directional Glide"})]})]}),e.jsxs("div",{className:"action-card",children:[e.jsxs("h4",{className:"action-card-title",children:[e.jsx(Yt,{size:18,color:"var(--primary)"})," Smart Input"]}),e.jsx("input",{type:"text",className:"type-input-field compact",placeholder:"Relay keystrokes...",value:S,onChange:a=>U(a.target.value),onKeyDown:a=>a.key==="Enter"&&V()})]}),e.jsxs("div",{className:"action-card full-width",children:[e.jsxs("h4",{className:"action-card-title",children:[e.jsx(us,{size:18,color:"var(--primary)"})," App Management"]}),e.jsxs("div",{className:"app-mgmt-content",children:[e.jsxs("div",{className:"install-section",children:[e.jsx("p",{className:"compact-label",children:"Install Package (.apk, .ipa, .app)"}),e.jsxs("div",{className:"upload-box-row",children:[e.jsxs("label",{className:"file-upload-launcher",children:[e.jsx(It,{size:14}),e.jsx("span",{children:ce?ce.name:"Select File"}),e.jsx("input",{type:"file",accept:".apk,.ipa,.app",onChange:a=>{var c;return ze(((c=a.target.files)==null?void 0:c[0])||null)},hidden:!0})]}),e.jsx("button",{className:"btn-premium btn-sm",disabled:!ce||me,onClick:Fe,children:me?e.jsx(Pe,{className:"animate-spin",size:14}):"INSTALL"})]})]}),e.jsx("div",{className:"divider-v"}),e.jsxs("div",{className:"uninstall-section",children:[e.jsx("p",{className:"compact-label",children:"Quick Uninstall"}),e.jsxs("div",{className:"uninstall-controls-row",children:[e.jsxs("div",{className:"select-wrapper",children:[e.jsxs("select",{className:"app-select-dropdown compact",value:T,onChange:a=>F(a.target.value),disabled:ye,children:[e.jsx("option",{value:"",children:ye?"Loading apps...":"-- Select App to Remove --"}),Te.map(a=>e.jsx("option",{value:a,children:a},a))]}),ye&&e.jsx(Pe,{className:"animate-spin select-loader",size:12})]}),e.jsxs("button",{className:"btn-destructive btn-sm",onClick:de,disabled:!T||ye,children:[e.jsx(Be,{size:14})," UNINSTALL"]})]}),e.jsxs("div",{className:"manual-input-box",children:[e.jsx("p",{className:"hint-text",children:"Or enter manually:"}),e.jsx("input",{type:"text",className:"type-input-field tiny",placeholder:"com.example.app",value:T,onChange:a=>F(a.target.value)})]})]})]})]}),e.jsxs("div",{className:"action-card full-width",children:[e.jsxs("h4",{className:"action-card-title",children:[e.jsx(qt,{size:18,color:"var(--primary)"})," Clipboard"]}),e.jsxs("div",{style:{display:"flex",gap:"12px",alignItems:"flex-start"},children:[e.jsx("button",{className:"btn-premium btn-sm",style:{width:"140px",flexShrink:0},onClick:z,children:"FETCH VALUE"}),e.jsx("div",{className:"clipboard-display compact",style:{marginTop:0,flex:1},children:w})]})]})]}),m==="screenshot"&&e.jsxs("div",{className:"action-card screenshot-card",children:[e.jsxs("header",{className:"action-card-header",children:[e.jsxs("div",{className:"title-group",children:[e.jsxs("h4",{className:"action-card-title",children:[e.jsx(Ke,{size:20,color:"var(--primary)"})," Captured Evidence"]}),e.jsx("p",{className:"hint-text",children:"Relay screenshots from device to host."})]}),y.length>0&&e.jsx("button",{className:"btn-text-only",onClick:Y,children:"CLEAR ALL"})]}),e.jsxs("div",{className:"screenshot-workspace",children:[e.jsxs("div",{className:"screenshot-gallery-sidebar",children:[e.jsxs("button",{className:"btn-premium take-screenshot-btn",onClick:K,disabled:q,children:[q?e.jsx(Pe,{className:"animate-spin",size:16}):e.jsx(Ke,{size:16}),e.jsx("span",{children:q?"CAPTURING...":"NEW CAPTURE"})]}),e.jsxs("div",{className:"screenshot-thumbnails-list",children:[y.length===0&&!q&&e.jsx("div",{className:"empty-gallery-state",children:e.jsx("p",{children:"No captures yet"})}),y.map((a,c)=>e.jsxs("div",{className:`screenshot-thumb-item ${M===c?"active":""}`,onClick:()=>_(c),children:[e.jsx("img",{src:`data:image/png;base64,${a.base64}`,alt:"Thumb"}),e.jsx("span",{className:"thumb-time",children:new Date(a.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),e.jsx("button",{className:"thumb-delete-btn",onClick:f=>{f.stopPropagation(),J(a.id)},children:e.jsx(Be,{size:12})})]},a.id))]})]}),e.jsx("div",{className:"screenshot-main-preview",children:M!==null&&y[M]?e.jsxs("div",{className:"preview-container",children:[e.jsx("div",{className:"preview-image-wrapper",children:e.jsx("img",{src:`data:image/png;base64,${y[M].base64}`,alt:"Selected Evidence"})}),e.jsxs("footer",{className:"preview-footer",children:[e.jsxs("div",{className:"preview-meta",children:[e.jsx("span",{className:"meta-label",children:"ID:"}),e.jsx("span",{className:"meta-value",children:y[M].id.substring(0,8)}),e.jsx("span",{className:"meta-divider",children:"|"}),e.jsx("span",{className:"meta-value",children:new Date(y[M].timestamp).toLocaleString()})]}),e.jsxs("div",{className:"preview-actions",children:[e.jsx("button",{className:"btn-premium btn-sm",onClick:()=>ge(y[M].base64),children:"DOWNLOAD PNG"}),e.jsxs("button",{className:"btn-destructive btn-sm",onClick:()=>J(y[M].id),children:[e.jsx(Be,{size:14})," DELETE"]})]})]})]}):e.jsxs("div",{className:"preview-empty-placeholder",children:[e.jsx(Ke,{size:48,style:{opacity:.1,marginBottom:16}}),e.jsx("p",{children:"Capture a screenshot to begin analysis"})]})})]})]}),m==="logs"&&e.jsxs("div",{className:"action-card screenshot-card",style:{padding:0,gap:0},children:[e.jsxs("div",{className:"log-toolbar",children:[e.jsxs("div",{className:"log-filter-group",children:[e.jsxs("div",{className:"log-stat-pill",children:[e.jsx("span",{className:`log-live-dot ${$e?"active":""}`}),$e?"LIVE":"CONNECTING"]}),e.jsxs("div",{className:"log-stat-pill",style:{opacity:.6},children:[le.length," LINES"]}),e.jsxs("div",{className:"log-search-box",children:[e.jsx(Xe,{size:14,className:"search-icon-inline"}),e.jsx("input",{type:"text",className:"type-input-field tiny",placeholder:"Filter trace...",value:oe,onChange:a=>Ye(a.target.value)})]})]}),e.jsxs("div",{className:"log-actions-group",children:[e.jsxs("button",{className:`btn-secondary btn-sm ${Q?"active":""}`,onClick:()=>Ie(!Q),title:Q?"Freeze Logs":"Follow Logs",children:[e.jsx($t,{size:14,className:Q?"animate-pulse":""}),Q?"FREEZE":"FOLLOW"]}),e.jsxs("button",{className:"btn-premium btn-sm",onClick:()=>{const a=new Blob([le.join(`
|
|
194
|
-
`)],{type:"text/plain"}),c=URL.createObjectURL(a),f=document.createElement("a");f.href=c,f.download=`logs-${d.udid}-${Date.now()}.txt`,f.click(),URL.revokeObjectURL(c)},disabled:le.length===0,children:[e.jsx(
|
|
195
|
-
Internal Shell Environment.`,onCommand:async a=>{const c=await D.executeShell(d.udid,a);if(c.error)throw new Error(c.error);return c.output}})})]})})]})]})]})}const gt={platform:{ios:!0,android:!0},state:{ready:!0,offline:!0,busy:!0},name:""};class
|
|
192
|
+
// Assert with expect(element).toBeDisplayed()`:`// Strategy "${p}" not supported in WebdriverIO mobile`}function Vs(n){var U,w,j,T,F,b,k,y,R,M,_;const t=(n.type||"").toLowerCase(),l=((U=n.attributes)==null?void 0:U.clickable)==="true"||((w=n.attributes)==null?void 0:w.clickable)===!0,u=((j=n.attributes)==null?void 0:j.enabled)!=="false"&&((T=n.attributes)==null?void 0:T.enabled)!==!1,p=((F=n.attributes)==null?void 0:F.scrollable)==="true"||((b=n.attributes)==null?void 0:b.scrollable)===!0,s=n.text||n.label||n.value||"",L=((k=n.children)==null?void 0:k.length)||0;let v="Element",x="📦";t.includes("button")||t.includes("btn")||l&&L===0?(v="Button",x="🔘"):t.includes("edit")||t.includes("input")||t.includes("field")?(v="Text Input",x="✏️"):t.includes("image")||t.includes("img")||t.includes("imageview")?(v="Image",x="🖼️"):t.includes("scroll")||t.includes("recyclerview")||t.includes("listview")||p?(v="Scrollable List",x="📜"):t.includes("text")||t.includes("label")?(v="Text Label",x="📝"):t.includes("switch")||t.includes("toggle")||t.includes("checkbox")?(v="Toggle / Checkbox",x="☑️"):t.includes("nav")||t.includes("toolbar")||t.includes("tabbar")?(v="Navigation Bar",x="🧭"):L>0&&(v=`Container (${L} children)`,x="🗂️");const h=((y=n.suggestedLocators)==null?void 0:y.find(q=>q.strategy==="accessibility id"||q.strategy==="id"))||((R=n.suggestedLocators)==null?void 0:R[0]),m=u?((M=n.rect)==null?void 0:M.width)===0||((_=n.rect)==null?void 0:_.height)===0?"⚠️ Zero-size element — may not be interactable":void 0:"⚠️ Element is disabled",A=s?` with text "${s.slice(0,30)}"`:"",S=`This is a ${v.toLowerCase()}${A}. ${l?"It can be tapped/clicked.":p?"It supports scrolling.":"It is a visual container."}${L>0?` Contains ${L} child element${L>1?"s":""}.`:""}`;return{role:v,description:S,interactable:l||u,bestLocator:h,warning:m,emoji:x}}function xt(n,t){if(!t)return!0;const l=t.toLowerCase().trim(),u={button:["button","btn","clickable","tapable"],input:["edittext","input","field","textfield","textinput","edit"],image:["image","imageview","img","picture","photo","icon"],text:["textview","label","text","statictext"],list:["listview","recyclerview","scrollview","tableview","collectionview","scroll"],toggle:["switch","checkbox","toggle","radiobutton"],nav:["toolbar","navigationbar","tabbar","actionbar","navbar"]},p=(n.type||"").toLowerCase(),s=(n.text||n.label||n.value||"").toLowerCase(),L=(n.name||"").toLowerCase(),v=Object.values(n.attributes||{}).join(" ").toLowerCase();for(const[x,h]of Object.entries(u))if(l.includes(x)&&h.some(m=>p.includes(m)))return!0;return p.includes(l)||s.includes(l)||L.includes(l)||v.includes(l)}const qs=({sessionId:n,udid:t,streamUrl:l})=>{var De,ie,ae,ke,xe,Ae,Ue;const[u,p]=r.useState(!0),[s,L]=r.useState(null),[v,x]=r.useState(null),[h,m]=r.useState(null),[A,S]=r.useState(null),[U,w]=r.useState(new Set(["/"])),[j,T]=r.useState(""),[F,b]=r.useState(null),[k,y]=r.useState("info"),[R,M]=r.useState("java"),[_,q]=r.useState(null),[H,te]=r.useState({width:0,height:0}),[Ce,fe]=r.useState({width:0,height:0}),[Ge,d]=r.useState(!1),[Z,Te]=r.useState("inspect"),Se=r.useRef(null),ye=r.useRef(null),je=r.useRef(null),me=r.useRef(null),ue=r.useCallback(()=>{var z,K,J;if(!Se.current)return;const i=Se.current.getBoundingClientRect(),o=i.width,g=i.height,C=(z=s==null?void 0:s.hierarchy)==null?void 0:z.rect;let O=((K=s==null?void 0:s.metadata)==null?void 0:K.screenWidth)||H.width||1,P=((J=s==null?void 0:s.metadata)==null?void 0:J.screenHeight)||H.height||1;C&&C.width>0&&C.height>0&&(O=C.width,P=C.height);const B=O/P;let W,V;o/g>B?(V=g,W=V*B):(W=o,V=W/B),fe({width:W,height:V})},[s,H]);r.useEffect(()=>(ue(),window.addEventListener("resize",ue),()=>window.removeEventListener("resize",ue)),[ue]),r.useEffect(()=>{t&&ce()},[t]),r.useEffect(()=>{var i;if((i=h==null?void 0:h.suggestedLocators)!=null&&i.length){const o=h.suggestedLocators.find(g=>g.strategy==="accessibility id"||g.strategy==="id")||h.suggestedLocators[0];q(o)}else q(null)},[h]);const ce=async()=>{if(t){p(!0),x(null);try{const i=await D.getInspectorSnapshot(t);L(i);const o=new Set(["/"]),g=(C,O)=>{var P;O<2&&(o.add(C.xpath),(P=C.children)==null||P.forEach(B=>g(B,O+1)))};i.hierarchy&&g(i.hierarchy,0),w(o)}catch(i){x(i.message||"Failed to capture snapshot")}finally{p(!1)}}},ze=i=>{const{naturalWidth:o,naturalHeight:g}=i.currentTarget;te({width:o,height:g})},le=()=>d(!0),Ee=i=>{d(!1);const{naturalWidth:o,naturalHeight:g}=i.currentTarget;o>0&&g>0&&te({width:o,height:g})},Q=l&&!Ge,Ie=i=>{if(Z!=="interact"||!t)return;const o=i.currentTarget.getBoundingClientRect();me.current={x:i.clientX-o.left,y:i.clientY-o.top,time:Date.now()}},oe=async i=>{var de,Fe,Le;if(Z!=="interact"||!t||!me.current)return;const o=me.current,g=i.currentTarget.getBoundingClientRect(),C=i.clientX-g.left,O=i.clientY-g.top,P=Date.now()-o.time,B=Ce.width,W=Ce.height,V=(de=s==null?void 0:s.hierarchy)==null?void 0:de.rect;let z=((Fe=s==null?void 0:s.metadata)==null?void 0:Fe.screenWidth)||H.width,K=((Le=s==null?void 0:s.metadata)==null?void 0:Le.screenHeight)||H.height;if(V&&V.width>0&&V.height>0&&(z=V.width,K=V.height),!z||!K||B===0||W===0)return;const J=(a,c)=>({x:Math.round(a/B*z),y:Math.round(c/W*K),px:a/B,py:c/W}),Y=J(o.x,o.y),ge=J(C,O),se=Math.sqrt(Math.pow(C-o.x,2)+Math.pow(O-o.y,2));if(!(Y.px<0||Y.px>1||Y.py<0||Y.py>1)){try{P<500&&se<10?await D.tap(t,Y.x,Y.y):P>=500&&se<10?await D.touchAndHold(t,Y.x,Y.y,P):se>=10&&await D.swipe(t,Y.x,Y.y,ge.x,ge.y)}catch(a){console.error("Interaction failed:",a)}me.current=null}},Ye=i=>{const o=new Set(U);o.has(i)?o.delete(i):o.add(i),w(o)},$e=()=>{const i=new Set,o=g=>{var C;i.add(g.xpath),(C=g.children)==null||C.forEach(o)};s!=null&&s.hierarchy&&o(s.hierarchy),w(i)},be=()=>w(new Set(["/"])),Re=(i,o)=>{navigator.clipboard.writeText(i),b(o),setTimeout(()=>b(null),2e3)},pe=i=>{var g;let o=1;return(g=i.children)==null||g.forEach(C=>o+=pe(C)),o},Ne=i=>i.xpath.split("/").filter(Boolean).slice(-3),ee=(i,o=0)=>{var V;if(!i)return null;const g=U.has(i.xpath),C=((V=i.children)==null?void 0:V.length)>0,O=(h==null?void 0:h.xpath)===i.xpath,P=(A==null?void 0:A.xpath)===i.xpath,B=i.name||i.type.split(".").pop()||"Element",W=!j||xt(i,j);if(!W&&!C)return null;if(j&&!W){const z=K=>{var J;return xt(K,j)?!0:((J=K.children)==null?void 0:J.some(z))||!1};if(!z(i))return null}return e.jsxs("div",{className:"tree-node",children:[e.jsxs("div",{className:`tree-item ${O?"selected":""} ${P&&!O?"hovered":""}`,onClick:()=>{m(i),y("info")},onMouseEnter:()=>S(i),onMouseLeave:()=>S(null),children:[e.jsx("div",{className:"tree-item-indent",style:{width:`${o*14}px`}}),C?e.jsx("button",{onClick:z=>{z.stopPropagation(),Ye(i.xpath)},className:"tree-toggle",children:g?e.jsx(yt,{size:11}):e.jsx(bt,{size:11})}):e.jsx("span",{className:"tree-toggle-spacer"}),e.jsx(Ht,{size:11,className:"tree-icon"}),e.jsx("span",{className:"tree-label",children:B}),i.text&&e.jsxs("span",{className:"tree-text-preview",children:['"',i.text.slice(0,20),'"']}),C&&e.jsx("span",{className:"tree-badge",children:i.children.length})]}),g&&C&&e.jsx("div",{className:"tree-children",children:i.children.map(z=>ee(z,o+1))})]},i.xpath)},we=i=>{var B,W,V;if(!H.width)return[];const o=[],g=(B=s==null?void 0:s.hierarchy)==null?void 0:B.rect;let C=((W=s==null?void 0:s.metadata)==null?void 0:W.screenWidth)||H.width,O=((V=s==null?void 0:s.metadata)==null?void 0:V.screenHeight)||H.height;g&&g.width>0&&g.height>0&&(C=g.width,O=g.height);const P=(z,K)=>{var Y,ge,se;const J=!z.children||z.children.length===0;((Y=z.rect)==null?void 0:Y.width)>0&&((ge=z.rect)==null?void 0:ge.height)>0&&J&&o.push(e.jsx("div",{className:"omni-hit-area",style:{left:`${z.rect.x/C*100}%`,top:`${z.rect.y/O*100}%`,width:`${z.rect.width/C*100}%`,height:`${z.rect.height/O*100}%`,zIndex:K},onClick:de=>{de.stopPropagation(),m(z),y("info")},onMouseEnter:()=>S(z),onMouseLeave:()=>S(null)},z.xpath)),(se=z.children)==null||se.forEach(de=>P(de,K+1))};return s!=null&&s.hierarchy&&P(s.hierarchy,1),o},ve=(i,o)=>{var P,B,W;if(!(i!=null&&i.rect)||!H.width)return null;const g=(P=s==null?void 0:s.hierarchy)==null?void 0:P.rect;let C=((B=s==null?void 0:s.metadata)==null?void 0:B.screenWidth)||H.width,O=((W=s==null?void 0:s.metadata)==null?void 0:W.screenHeight)||H.height;return g&&g.width>0&&g.height>0&&(C=g.width,O=g.height),e.jsx("div",{className:`omni-frame-${o}`,style:{left:`${i.rect.x/C*100}%`,top:`${i.rect.y/O*100}%`,width:`${i.rect.width/C*100}%`,height:`${i.rect.height/O*100}%`}})},Me=s!=null&&s.hierarchy?pe(s.hierarchy):0,G=h?Vs(h):null,_e={stable:{icon:e.jsx(it,{size:10}),cls:"stable"},moderate:{icon:e.jsx(Tt,{size:10}),cls:"moderate"},fragile:{icon:e.jsx(ht,{size:10}),cls:"fragile"},"very-fragile":{icon:e.jsx(ht,{size:10}),cls:"very-fragile"}};return e.jsx("div",{className:"omni-inspector-container",children:e.jsxs("div",{className:"omni-main-content",children:[e.jsxs("div",{className:"omni-screenshot-panel",children:[e.jsxs("div",{className:"omni-screenshot-header",children:[e.jsxs("div",{className:"omni-header-left",children:[e.jsx("span",{className:"omni-screenshot-title",children:"Device Preview"}),e.jsxs("div",{className:"omni-mode-toggle",children:[e.jsxs("button",{className:`omni-mode-btn ${Z==="inspect"?"active":""}`,onClick:()=>Te("inspect"),title:"Inspection Mode (Highlight Elements)",children:[e.jsx(Mt,{size:12}),e.jsx("span",{children:"Inspect"})]}),e.jsxs("button",{className:`omni-mode-btn ${Z==="interact"?"active":""}`,onClick:()=>Te("interact"),title:"Interaction Mode (Direct Control)",children:[e.jsx(Ss,{size:12}),e.jsx("span",{children:"Interact"})]})]})]}),e.jsxs("button",{className:"omni-refresh-btn",onClick:ce,disabled:u,children:[e.jsx(Ve,{size:12,className:u?"animate-spin":""}),u?"Capturing...":"Refresh"]})]}),e.jsxs("div",{className:"omni-screenshot-container",ref:Se,children:[u&&!Q&&e.jsxs("div",{className:"omni-loading-overlay",children:[e.jsx("div",{className:"omni-spinner"}),e.jsx("span",{children:"Capturing screen..."})]}),!s&&!u&&!Q&&e.jsxs("div",{className:"omni-empty-state",children:[e.jsx(ut,{size:40}),e.jsx("span",{children:"Click Refresh to capture"})]}),Q&&e.jsxs("div",{className:`omni-screenshot-wrapper ${Z==="interact"?"interactable":""}`,onMouseDown:Ie,onMouseUp:oe,children:[e.jsx("img",{ref:je,src:l,onLoad:Ee,onError:le,className:"omni-screenshot-img",style:Z==="interact"?{pointerEvents:"none"}:{},draggable:!1,alt:"Live Device Stream"}),(s==null?void 0:s.hierarchy)&&Z==="inspect"&&e.jsxs("div",{className:"omni-overlay",children:[we(s.hierarchy),ve(A,"hover"),ve(h,"select")]})]}),!Q&&(s==null?void 0:s.screenshot)&&e.jsxs("div",{className:`omni-screenshot-wrapper ${Z==="interact"?"interactable":""}`,onMouseDown:Ie,onMouseUp:oe,children:[e.jsx("img",{ref:ye,src:`data:image/png;base64,${s.screenshot}`,onLoad:ze,className:"omni-screenshot-img",style:Z==="interact"?{pointerEvents:"none"}:{},draggable:!1}),Z==="inspect"&&e.jsxs("div",{className:"omni-overlay",children:[we(s.hierarchy),ve(A,"hover"),ve(h,"select")]})]})]})]}),e.jsxs("div",{className:"omni-tree-panel",children:[e.jsxs("div",{className:"omni-tree-header",children:[e.jsxs("div",{className:"omni-tree-title",children:[e.jsx(ss,{size:14}),e.jsx("span",{children:"Source"}),Me>0&&e.jsxs("span",{className:"omni-count-badge",children:[Me," elements"]})]}),e.jsxs("div",{className:"omni-tree-actions",children:[e.jsx("button",{onClick:$e,className:"omni-action-btn",title:"Expand All",children:e.jsx(Zt,{size:12})}),e.jsx("button",{onClick:be,className:"omni-action-btn",title:"Collapse All",children:e.jsx(xs,{size:12})})]})]}),e.jsxs("div",{className:"omni-tree-search",children:[e.jsx(Xe,{size:14}),e.jsx("input",{type:"text",placeholder:"Search elements... (try 'login button' or 'text field')",value:j,onChange:i=>T(i.target.value)}),j&&e.jsx("button",{onClick:()=>T(""),className:"omni-clear-btn",children:"×"})]}),j&&e.jsxs("div",{className:"omni-search-hint",children:[e.jsx(mt,{size:10}),' Smart search active — try "button", "input", "image"']}),e.jsx("div",{className:"omni-tree-content",children:s!=null&&s.hierarchy?ee(s.hierarchy):e.jsx("div",{className:"omni-empty-state small",children:e.jsx("span",{children:"No hierarchy loaded"})})})]}),e.jsxs("div",{className:"omni-details-panel",children:[e.jsxs("div",{className:"omni-details-tabs",children:[e.jsxs("button",{className:`omni-details-tab ${k==="info"?"active":""}`,onClick:()=>y("info"),children:[e.jsx(ls,{size:12})," Info"]}),e.jsxs("button",{className:`omni-details-tab ${k==="insight"?"active":""}`,onClick:()=>y("insight"),disabled:!h,title:"AI Element Analysis",children:[e.jsx(as,{size:12})," AI Insight"]}),e.jsxs("button",{className:`omni-details-tab ${k==="code"?"active":""}`,onClick:()=>y("code"),disabled:!h,title:"Generate Test Code",children:[e.jsx(ot,{size:12})," Code Gen"]})]}),e.jsx("div",{className:"omni-details-content",children:h?e.jsxs(e.Fragment,{children:[k==="info"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"omni-section",children:[e.jsx("div",{className:"omni-section-header",children:"Element Info"}),e.jsxs("div",{className:"omni-info-table",children:[e.jsxs("div",{className:"omni-info-row",children:[e.jsx("span",{className:"omni-info-key",children:"Type"}),e.jsx("span",{className:"omni-info-value mono",children:h.type})]}),h.text&&e.jsxs("div",{className:"omni-info-row",children:[e.jsx("span",{className:"omni-info-key",children:"Text"}),e.jsx("span",{className:"omni-info-value",children:h.text})]}),e.jsxs("div",{className:"omni-info-row",children:[e.jsx("span",{className:"omni-info-key",children:"Path"}),e.jsx("span",{className:"omni-info-value mono small",children:Ne(h).join(" › ")})]})]})]}),e.jsxs("div",{className:"omni-section",children:[e.jsx("div",{className:"omni-section-header",children:"Layout"}),e.jsx("div",{className:"omni-layout-grid",children:["x","y","width","height"].map(i=>e.jsxs("div",{className:"omni-layout-item",children:[e.jsx("span",{className:"omni-layout-label",children:i.toUpperCase()}),e.jsx("span",{className:"omni-layout-value",children:h.rect[i]})]},i))})]}),e.jsxs("div",{className:"omni-section",children:[e.jsxs("div",{className:"omni-section-header",children:["Locators",e.jsx("span",{className:"omni-section-badge",children:"Stability Scored"})]}),e.jsx("div",{className:"omni-locators-list",children:(De=h.suggestedLocators)==null?void 0:De.map(i=>{const o=pt(i.strategy,i.value),g=_e[o.level];return e.jsxs("div",{className:`omni-locator-row ${(_==null?void 0:_.strategy)===i.strategy?"selected-for-code":""}`,onClick:()=>q(i),title:"Click to use in Code Generator",children:[e.jsxs("div",{className:"omni-locator-left",children:[e.jsxs("div",{className:"omni-locator-top",children:[e.jsx("span",{className:"omni-locator-strategy",children:i.strategy}),e.jsxs("span",{className:`omni-stability-badge ${g.cls}`,title:o.reason,children:[g.icon,o.level]})]}),e.jsx("code",{className:"omni-locator-value",children:i.value}),e.jsx("span",{className:"omni-stability-reason",children:o.reason})]}),e.jsx("button",{onClick:C=>{C.stopPropagation(),Re(i.value,i.strategy)},className:`omni-copy-btn ${F===i.strategy?"copied":""}`,children:F===i.strategy?e.jsx(Je,{size:12}):e.jsx(Ze,{size:12})})]},i.strategy)})})]}),e.jsxs("div",{className:"omni-section",children:[e.jsx("div",{className:"omni-section-header",children:"Attributes"}),e.jsx("div",{className:"omni-attributes-table",children:Object.entries(h.attributes||{}).filter(([i,o])=>o!=null&&o!=="").map(([i,o])=>e.jsxs("div",{className:"omni-attr-row",children:[e.jsx("span",{className:"omni-attr-key",children:i}),e.jsx("span",{className:"omni-attr-value",children:String(o)})]},i))})]})]}),k==="insight"&&G&&e.jsxs("div",{className:"omni-insight-panel",children:[e.jsxs("div",{className:"omni-insight-role",children:[e.jsx("span",{className:"omni-insight-emoji",children:G.emoji}),e.jsxs("div",{children:[e.jsx("div",{className:"omni-insight-role-name",children:G.role}),e.jsx("div",{className:"omni-insight-interactable",children:G.interactable?e.jsxs("span",{className:"omni-badge-green",children:[e.jsx(Ut,{size:10})," Interactable"]}):e.jsx("span",{className:"omni-badge-gray",children:"Visual Only"})})]})]}),G.warning&&e.jsx("div",{className:"omni-insight-warning",children:G.warning}),e.jsxs("div",{className:"omni-insight-description",children:[e.jsx(mt,{size:12,className:"omni-insight-icon"}),e.jsx("p",{children:G.description})]}),G.bestLocator&&e.jsxs("div",{className:"omni-insight-best-locator",children:[e.jsx("div",{className:"omni-section-header",children:"Recommended Locator"}),e.jsxs("div",{className:"omni-locator-row",children:[e.jsxs("div",{className:"omni-locator-left",children:[e.jsx("span",{className:"omni-locator-strategy",children:G.bestLocator.strategy}),e.jsx("code",{className:"omni-locator-value",children:G.bestLocator.value})]}),e.jsx("button",{onClick:()=>Re(G.bestLocator.value,"best"),className:`omni-copy-btn ${F==="best"?"copied":""}`,children:F==="best"?e.jsx(Je,{size:12}):e.jsx(Ze,{size:12})})]})]}),e.jsxs("div",{className:"omni-insight-attributes",children:[e.jsx("div",{className:"omni-section-header",children:"Quick Facts"}),e.jsx("div",{className:"omni-quick-facts",children:[{label:"Clickable",value:(ie=h.attributes)==null?void 0:ie.clickable},{label:"Enabled",value:(ae=h.attributes)==null?void 0:ae.enabled},{label:"Scrollable",value:(ke=h.attributes)==null?void 0:ke.scrollable},{label:"Focusable",value:(xe=h.attributes)==null?void 0:xe.focusable},{label:"Children",value:((Ae=h.children)==null?void 0:Ae.length)||0}].map(({label:i,value:o})=>e.jsxs("div",{className:"omni-quick-fact-row",children:[e.jsx("span",{className:"omni-quick-fact-label",children:i}),e.jsx("span",{className:`omni-quick-fact-value ${o==="true"||o===!0?"true":""}`,children:String(o??"—")})]},i))})]})]}),k==="code"&&e.jsxs("div",{className:"omni-codegen-panel",children:[e.jsx("div",{className:"omni-codegen-frameworks",children:["java","python","javascript","wdio"].map(i=>e.jsx("button",{className:`omni-fw-btn ${R===i?"active":""}`,onClick:()=>M(i),children:i==="java"?"☕ Java":i==="python"?"🐍 Python":i==="javascript"?"🟨 JS":"🔷 WD.io"},i))}),_?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"omni-codegen-locator-selector",children:[e.jsx("span",{className:"omni-codegen-label",children:"Locator:"}),e.jsx("select",{value:_.strategy,onChange:i=>{var g;const o=(g=h.suggestedLocators)==null?void 0:g.find(C=>C.strategy===i.target.value);o&&q(o)},className:"omni-fw-select",children:(Ue=h.suggestedLocators)==null?void 0:Ue.map(i=>e.jsxs("option",{value:i.strategy,children:[i.strategy," — ",pt(i.strategy,i.value).level]},i.strategy))})]}),e.jsxs("div",{className:"omni-codegen-output",children:[e.jsxs("div",{className:"omni-codegen-header",children:[e.jsx("span",{className:"omni-codegen-lang",children:R==="java"?"Java / TestNG":R==="python"?"Python / unittest":R==="javascript"?"JavaScript / Mocha":"WebdriverIO"}),e.jsx("button",{className:"omni-copy-btn",onClick:()=>Re(vt(h,(s==null?void 0:s.platform)==="android"?"android":(s==null?void 0:s.platform)==="ios"?"ios":"unknown",R,_),"code"),children:F==="code"?e.jsx(Je,{size:12}):e.jsx(Ze,{size:12})})]}),e.jsx("pre",{className:"omni-codegen-pre",children:e.jsx("code",{children:vt(h,(s==null?void 0:s.platform)==="android"?"android":(s==null?void 0:s.platform)==="ios"?"ios":"unknown",R,_)})})]})]}):e.jsxs("div",{className:"omni-empty-state small",children:[e.jsx(ot,{size:24}),e.jsx("span",{children:"No locators available for this element"})]})]})]}):e.jsxs("div",{className:"omni-empty-state",children:[e.jsx(ut,{size:32}),e.jsx("span",{children:"Select an element from the tree or screenshot"})]})})]})]})})};function Xs({device:n,onClose:t}){var Le;const{toast:l,removeToast:u}=ft(),p=nt(),{tab:s}=jt(),L=r.useRef(null),v=r.useRef(null),[x,h]=r.useState({width:0,height:0}),[m,A]=r.useState(s||"actions"),[S,U]=r.useState(""),[w,j]=r.useState(""),[T,F]=r.useState(""),[b,k]=r.useState(!0),[y,R]=r.useState([]),[M,_]=r.useState(null),[q,H]=r.useState(!1),[te,Ce]=r.useState(!1),[fe,Ge]=r.useState(0),[d,Z]=r.useState(n),[Te,Se]=r.useState([]),[ye,je]=r.useState(!1),[me,ue]=r.useState(!1),[ce,ze]=r.useState(null),[le,Ee]=r.useState([]),[Q,Ie]=r.useState(!0),[oe,Ye]=r.useState(""),[$e,be]=r.useState(!1),[Re,pe]=r.useState(0),Ne=r.useRef(""),ee=r.useRef(null),[we,ve]=r.useState(!1);r.useEffect(()=>{m&&(!s||s!==m)&&p(`/devices/${n.udid}/control/${m}`,{replace:!0})},[m,s,n.udid,p]),r.useEffect(()=>{let a;if(m==="logs"){be(!1),pe(0);const c=async()=>{try{const f=await D.getLogs(d.udid);if(pe(N=>N+1),f&&f.logs&&f.logs.trim().length>0){be(!0);const N=f.logs.replace(/\\u[0-9a-fA-F]{4}/g,$=>JSON.parse(`"${$}"`)).replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,"").split(`
|
|
193
|
+
`).filter($=>$.trim().length>0);N.length>0&&Ee($=>[...$,...N].slice(-1e3))}else pe(N=>(N>=3&&be(!0),N))}catch(f){console.error("Failed to fetch logs:",f),pe(N=>(N>=3&&be(!0),N))}};c(),a=setInterval(c,3e3)}return()=>clearInterval(a)},[m,d.udid]);const Me=()=>{if(le.length===0)return e.jsx("div",{className:"log-empty-state",children:$e?e.jsxs(e.Fragment,{children:[e.jsx(at,{size:28,style:{color:"var(--text-muted)",marginBottom:12,opacity:.4}}),e.jsx("p",{className:"log-empty-title",children:"No log output yet"}),e.jsx("p",{className:"log-empty-subtitle",children:"The log stream is active but the device is quiet. Interact with the device to generate logs."})]}):e.jsxs(e.Fragment,{children:[e.jsx(He,{size:28,className:"animate-spin",style:{color:"var(--primary)",marginBottom:12}}),e.jsx("p",{className:"log-empty-title",children:"Connecting to device syslog..."}),e.jsxs("p",{className:"log-empty-subtitle",children:["Initializing persistent log stream for ",d.name]})]})});const a=le.filter(c=>!oe||c.toLowerCase().includes(oe.toLowerCase()));return a.length===0&&oe?e.jsxs("div",{className:"log-empty-state",children:[e.jsx(Xe,{size:28,style:{color:"var(--text-muted)",marginBottom:12,opacity:.4}}),e.jsxs("p",{className:"log-empty-title",children:['No matches for "',oe,'"']}),e.jsxs("p",{className:"log-empty-subtitle",children:[le.length," lines in buffer. Try a different search term."]})]}):a.map((c,f)=>{let N="log-debug";const $=c.toLowerCase();return $.includes("error")||$.includes("fail")?N="log-error":$.includes("warning")||$.includes("warn")?N="log-warn":($.includes("notice")||$.includes("info"))&&(N="log-notice"),e.jsxs("div",{className:`log-line ${N}`,children:[e.jsx("span",{className:"log-index",children:f+1}),e.jsx("span",{className:"log-content",children:c})]},`${f}-${c.substring(0,10)}`)})};r.useEffect(()=>{m==="logs"&&Q&&v.current&&(v.current.scrollTop=v.current.scrollHeight)},[le,m,Q]),r.useEffect(()=>((async()=>{try{Ce(!0),await D.startStream(d.udid);const f=(await D.getDevices()).find(N=>N.udid===d.udid);f&&Z(f)}catch(c){console.error("Auto-start stream failed:",c)}finally{Ce(!1)}})(),()=>{D.stopStream(d.udid).catch(()=>{})}),[n.udid]);const G=r.useCallback(async()=>{try{je(!0);const a=await D.listApps(d.udid);Array.isArray(a)&&Se(a)}catch(a){console.error("Failed to load apps:",a)}finally{je(!1)}},[d.udid]);r.useEffect(()=>{m==="actions"&&G()},[m,G]);const _e=parseInt(d.screenWidth||"1080",10),De=parseInt(d.screenHeight||"1920",10),ie=Math.min(_e,De),ae=Math.max(_e,De),ke=ie/ae,xe=r.useCallback(()=>{const a=!b,c=a?window.innerHeight*.55:window.innerHeight*.7,f=a?window.innerWidth*.8:window.innerWidth*.45,N=b?ke:1/ke;let $,I;b?($=c,I=$*N,I>f&&(I=f,$=I/N)):(I=f,$=I/N,$>c&&($=c,I=$*N)),h({width:I,height:$})},[ke,b]);r.useEffect(()=>(xe(),window.addEventListener("resize",xe),()=>window.removeEventListener("resize",xe)),[xe]),r.useEffect(()=>{const a=async()=>{if(Ne.current.length>0){const f=Ne.current;Ne.current="";try{await D.typeText(d.udid,f)}catch(N){console.error("Keyboard buffering flush failed:",N)}}},c=f=>{const N=document.activeElement;if(N&&(N.tagName==="INPUT"||N.tagName==="TEXTAREA"||N.isContentEditable)||!we&&m!=="terminal")return;const I=f.key;I==="Enter"?(ee.current&&clearTimeout(ee.current),a(),D.pressKey(d.udid,d.platform==="android"?66:"enter")):I==="Backspace"?(ee.current&&clearTimeout(ee.current),a(),D.pressKey(d.udid,d.platform==="android"?67:"backspace")):I.length===1&&(Ne.current+=I,ee.current&&clearTimeout(ee.current),ee.current=setTimeout(()=>{a()},50))};return window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c),ee.current&&clearTimeout(ee.current)}},[d.udid,d.platform,we,m]);const[Ae,Ue]=r.useState(Date.now()),i=()=>{const a=fe>0?`r=${fe}&`:"";return d.session_id&&!String(d.session_id).startsWith("manual_")?`/xenon/api/session/${d.session_id}/live_video?${a}t=${Ae}`:`/xenon/api/control/${d.udid}/stream?${a}t=${Ae}`};r.useEffect(()=>{fe>0&&Ue(Date.now())},[fe]);const o=r.useRef(null),g=a=>{const c=a.currentTarget.getBoundingClientRect();return{x:a.clientX-c.left,y:a.clientY-c.top}},C=a=>{const c=g(a);o.current={x:c.x,y:c.y,time:Date.now()}},O=async a=>{if(!o.current)return;const c=o.current,f=g(a),N=Date.now()-c.time;let $,I,ne,re;b?($=c.x/x.width*ie,I=c.y/x.height*ae,ne=f.x/x.width*ie,re=f.y/x.height*ae):($=c.x/x.width*ae,I=c.y/x.height*ie,ne=f.x/x.width*ae,re=f.y/x.height*ie);const he=Math.abs(ne-$),Oe=Math.abs(re-I);try{N<500&&he<10&&Oe<10?await D.tap(d.udid,Math.round($),Math.round(I)):N>=500&&he<10&&Oe<10?await D.touchAndHold(d.udid,Math.round($),Math.round(I),N):await D.swipe(d.udid,Math.round($),Math.round(I),Math.round(ne),Math.round(re))}catch(Dt){console.error("Action failed:",Dt)}o.current=null},P=()=>D.pressKey(d.udid,d.platform==="android"?3:"home"),B=()=>D.lock(d.udid),W=()=>D.unlock(d.udid),V=async()=>{S.trim()&&(await D.typeText(d.udid,S),U(""))},z=async()=>{try{j("Fetching...");const a=await D.getClipboard(d.udid);a&&a.content!==void 0?j(a.content||"(Clipboard is empty)"):j("No content received")}catch{j("Error: Check Appium Settings app")}},K=async()=>{H(!0);try{const a=await D.getScreenshot(d.udid);if(a!=null&&a.screenshot){const c={id:Bs(),base64:a.screenshot,timestamp:Date.now()};R(f=>[c,...f]),_(0)}}catch(a){console.error("Failed to take screenshot:",a)}finally{H(!1)}},J=a=>{R(c=>{const f=c.filter(N=>N.id!==a);return f.length===0?_(null):M!==null&&M>=f.length&&_(0),f})},Y=()=>{R([]),_(null),l("Cleared all captured evidence.","success")},ge=a=>{const c=document.createElement("a");c.href=`data:image/png;base64,${a}`,c.download=`screenshot-${d.udid}-${Date.now()}.png`,c.click()},se=async a=>{const c=ie/2,f=ae/2,N=ie*.4,$=ae*.4;let I,ne,re,he;switch(a){case"left":I=c+N,ne=f,re=c-N,he=f;break;case"right":I=c-N,ne=f,re=c+N,he=f;break;case"up":I=c,ne=f+$,re=c,he=f-$;break;case"down":I=c,ne=f-$,re=c,he=f+$;break}try{await D.swipe(d.udid,Math.round(I),Math.round(ne),Math.round(re),Math.round(he))}catch(Oe){console.error(`Quick swipe ${a} failed:`,Oe)}},de=async()=>{if(T.trim()){const a=l(`Uninstalling ${T}...`,"loading",0);try{je(!0),await D.uninstallApp(d.udid,T),F(""),l(`Request sent for ${T}`,"success"),setTimeout(G,3e3)}catch{l("Uninstall failed. Check logs.","error")}finally{je(!1),u(a)}}},Fe=async()=>{if(!ce)return;let a;try{ue(!0),a=l(`Installing app to ${d.udid}...`,"loading",0);const c=await D.uploadAndInstallApp(d.udid,ce);c.success?(l(c.message||"App installed successfully","success"),ze(null),setTimeout(G,5e3)):l("Installation failed: "+(c.error||"Unknown error"),"error")}catch(c){l("Installation failed: "+c.message,"error")}finally{a&&u(a),ue(!1)}};return e.jsxs("div",{className:"device-control-view",children:[e.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),e.jsxs("header",{className:"control-view-top-bar",children:[e.jsxs("button",{className:"back-to-devices-btn",onClick:t,children:[e.jsx(ct,{size:18})," DEVICES"]}),e.jsxs("div",{className:"device-info-mini",children:[e.jsx("span",{className:`device-pill platform-pill ${d.platform}`,children:d.platform==="ios"?"Apple":"Android"}),e.jsxs("span",{className:"device-pill version-pill",children:["v",d.sdk]}),d.reservedUntil&&Date.now()<d.reservedUntil&&e.jsxs("span",{className:"device-pill reserved-pill",title:`Reserved by ${d.reservedBy}${d.reservationReason?`: ${d.reservationReason}`:""}`,children:["RESERVED BY ",((Le=d.reservedBy)==null?void 0:Le.toUpperCase())||"ANONYMOUS"]}),e.jsx("h2",{className:"device-name-text",children:d.name}),e.jsx("span",{className:"code-font",style:{opacity:.5},children:d.udid})]})]}),e.jsxs("div",{className:`control-view-main ${b?"":"is-landscape"} ${m==="omni"?"omni-mode":""}`,children:[e.jsxs("div",{className:"device-preview-column",children:[e.jsx("div",{className:"device-screen-wrapper",children:e.jsxs("div",{ref:L,className:`device-stream-canvas ${b?"":"landscape"} ${we?"focused":""}`,style:{width:x.width,height:x.height,background:"#000"},tabIndex:0,onFocus:()=>ve(!0),onBlur:()=>ve(!1),onMouseDown:C,onMouseUp:O,children:[te&&e.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[e.jsx(Ve,{size:40,className:"animate-spin",color:"var(--primary)"}),e.jsx("p",{style:{marginTop:16},children:"ESTABLISHING TRACE..."})]}),e.jsx("img",{src:i(),alt:"Device Stream",className:"device-stream-image",style:{width:"100%",height:"100%",objectFit:"contain"},onError:()=>{console.warn("Stream failed to load, retrying..."),setTimeout(()=>Ge(a=>a+1),2e3)}})]})}),e.jsxs("aside",{className:"device-footer-actions",children:[e.jsxs("button",{className:`footer-action-btn ${b?"active":""}`,onClick:()=>k(!0),children:[e.jsx(Ve,{size:14,style:{transform:b?"none":"rotate(-90deg)"}})," ","PORTRAIT"]}),e.jsxs("button",{className:`footer-action-btn ${b?"":"active"}`,onClick:()=>k(!1),children:[e.jsx(Ve,{size:14,style:{transform:"rotate(90deg)"}})," LANDSCAPE"]}),e.jsx("div",{className:"footer-divider"}),e.jsxs("button",{className:"footer-action-btn",onClick:P,children:[e.jsx(es,{size:20})," HOME"]}),e.jsx("button",{className:"footer-action-btn",onClick:B,title:"Lock Device",children:e.jsx(Ft,{size:20})}),e.jsx("button",{className:"footer-action-btn",onClick:W,title:"Unlock Device",children:e.jsx(St,{size:20})})]})]}),e.jsxs("div",{className:"device-interactions-column",children:[e.jsxs("div",{className:"interaction-tabs",children:[e.jsx("button",{className:`tab-btn ${m==="actions"?"active":""}`,onClick:()=>A("actions"),children:"ACTIONS"}),e.jsx("button",{className:`tab-btn ${m==="screenshot"?"active":""}`,onClick:()=>A("screenshot"),children:"SCREENSHOT"}),e.jsx("button",{className:`tab-btn ${m==="logs"?"active":""}`,onClick:()=>A("logs"),children:"DEBUG LOGS"}),e.jsxs("button",{className:`tab-btn ${m==="terminal"?"active":""}`,onClick:()=>A("terminal"),children:[e.jsx(at,{size:14,style:{marginRight:6}})," SHELL"]}),e.jsx("button",{className:`tab-btn ${m==="omni"?"active":""}`,onClick:()=>A("omni"),children:"OMNI-VISION"})]}),e.jsx("div",{className:`interactions-scroll-area ${m==="terminal"?"terminal-mode":""} ${m==="screenshot"||m==="logs"?"screenshot-mode":""}`,children:e.jsxs("div",{className:"tab-content",children:[m==="omni"&&e.jsx("div",{className:"omni-inspector-tab-wrapper animate-fade-in",style:{height:"calc(100vh - 266px)"},children:e.jsx(qs,{sessionId:d.session_id?String(d.session_id):null,udid:d.udid,streamUrl:i()})}),m==="actions"&&e.jsxs("div",{className:"actions-grid",children:[e.jsxs("div",{className:"action-card",children:[e.jsxs("h4",{className:"action-card-title",children:[e.jsx(ms,{size:18,color:"var(--primary)"})," Directional Gestures"]}),e.jsxs("div",{className:"gestures-grid-container",children:[e.jsxs("div",{className:"gestures-dpad",children:[e.jsx("div",{}),e.jsx("button",{className:"dpad-btn",onClick:()=>se("up"),children:e.jsx(Vt,{size:24})}),e.jsx("div",{}),e.jsx("button",{className:"dpad-btn",onClick:()=>se("left"),children:e.jsx(ct,{size:24})}),e.jsx("div",{className:"dpad-center"}),e.jsx("button",{className:"dpad-btn",onClick:()=>se("right"),children:e.jsx(bt,{size:24})}),e.jsx("div",{}),e.jsx("button",{className:"dpad-btn",onClick:()=>se("down"),children:e.jsx(yt,{size:24})}),e.jsx("div",{})]}),e.jsx("p",{className:"compact-label",style:{opacity:.5},children:"Directional Glide"})]})]}),e.jsxs("div",{className:"action-card",children:[e.jsxs("h4",{className:"action-card-title",children:[e.jsx(Kt,{size:18,color:"var(--primary)"})," Smart Input"]}),e.jsx("input",{type:"text",className:"type-input-field compact",placeholder:"Relay keystrokes...",value:S,onChange:a=>U(a.target.value),onKeyDown:a=>a.key==="Enter"&&V()})]}),e.jsxs("div",{className:"action-card full-width",children:[e.jsxs("h4",{className:"action-card-title",children:[e.jsx(ps,{size:18,color:"var(--primary)"})," App Management"]}),e.jsxs("div",{className:"app-mgmt-content",children:[e.jsxs("div",{className:"install-section",children:[e.jsx("p",{className:"compact-label",children:"Install Package (.apk, .ipa, .app)"}),e.jsxs("div",{className:"upload-box-row",children:[e.jsxs("label",{className:"file-upload-launcher",children:[e.jsx(It,{size:14}),e.jsx("span",{children:ce?ce.name:"Select File"}),e.jsx("input",{type:"file",accept:".apk,.ipa,.app",onChange:a=>{var c;return ze(((c=a.target.files)==null?void 0:c[0])||null)},hidden:!0})]}),e.jsx("button",{className:"btn-premium btn-sm",disabled:!ce||me,onClick:Fe,children:me?e.jsx(He,{className:"animate-spin",size:14}):"INSTALL"})]})]}),e.jsx("div",{className:"divider-v"}),e.jsxs("div",{className:"uninstall-section",children:[e.jsx("p",{className:"compact-label",children:"Quick Uninstall"}),e.jsxs("div",{className:"uninstall-controls-row",children:[e.jsxs("div",{className:"select-wrapper",children:[e.jsxs("select",{className:"app-select-dropdown compact",value:T,onChange:a=>F(a.target.value),disabled:ye,children:[e.jsx("option",{value:"",children:ye?"Loading apps...":"-- Select App to Remove --"}),Te.map(a=>e.jsx("option",{value:a,children:a},a))]}),ye&&e.jsx(He,{className:"animate-spin select-loader",size:12})]}),e.jsxs("button",{className:"btn-destructive btn-sm",onClick:de,disabled:!T||ye,children:[e.jsx(Be,{size:14})," UNINSTALL"]})]}),e.jsxs("div",{className:"manual-input-box",children:[e.jsx("p",{className:"hint-text",children:"Or enter manually:"}),e.jsx("input",{type:"text",className:"type-input-field tiny",placeholder:"com.example.app",value:T,onChange:a=>F(a.target.value)})]})]})]})]}),e.jsxs("div",{className:"action-card full-width",children:[e.jsxs("h4",{className:"action-card-title",children:[e.jsx(Xt,{size:18,color:"var(--primary)"})," Clipboard"]}),e.jsxs("div",{style:{display:"flex",gap:"12px",alignItems:"flex-start"},children:[e.jsx("button",{className:"btn-premium btn-sm",style:{width:"140px",flexShrink:0},onClick:z,children:"FETCH VALUE"}),e.jsx("div",{className:"clipboard-display compact",style:{marginTop:0,flex:1},children:w})]})]})]}),m==="screenshot"&&e.jsxs("div",{className:"action-card screenshot-card",children:[e.jsxs("header",{className:"action-card-header",children:[e.jsxs("div",{className:"title-group",children:[e.jsxs("h4",{className:"action-card-title",children:[e.jsx(Ke,{size:20,color:"var(--primary)"})," Captured Evidence"]}),e.jsx("p",{className:"hint-text",children:"Relay screenshots from device to host."})]}),y.length>0&&e.jsx("button",{className:"btn-text-only",onClick:Y,children:"CLEAR ALL"})]}),e.jsxs("div",{className:"screenshot-workspace",children:[e.jsxs("div",{className:"screenshot-gallery-sidebar",children:[e.jsxs("button",{className:"btn-premium take-screenshot-btn",onClick:K,disabled:q,children:[q?e.jsx(He,{className:"animate-spin",size:16}):e.jsx(Ke,{size:16}),e.jsx("span",{children:q?"CAPTURING...":"NEW CAPTURE"})]}),e.jsxs("div",{className:"screenshot-thumbnails-list",children:[y.length===0&&!q&&e.jsx("div",{className:"empty-gallery-state",children:e.jsx("p",{children:"No captures yet"})}),y.map((a,c)=>e.jsxs("div",{className:`screenshot-thumb-item ${M===c?"active":""}`,onClick:()=>_(c),children:[e.jsx("img",{src:`data:image/png;base64,${a.base64}`,alt:"Thumb"}),e.jsx("span",{className:"thumb-time",children:new Date(a.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),e.jsx("button",{className:"thumb-delete-btn",onClick:f=>{f.stopPropagation(),J(a.id)},children:e.jsx(Be,{size:12})})]},a.id))]})]}),e.jsx("div",{className:"screenshot-main-preview",children:M!==null&&y[M]?e.jsxs("div",{className:"preview-container",children:[e.jsx("div",{className:"preview-image-wrapper",children:e.jsx("img",{src:`data:image/png;base64,${y[M].base64}`,alt:"Selected Evidence"})}),e.jsxs("footer",{className:"preview-footer",children:[e.jsxs("div",{className:"preview-meta",children:[e.jsx("span",{className:"meta-label",children:"ID:"}),e.jsx("span",{className:"meta-value",children:y[M].id.substring(0,8)}),e.jsx("span",{className:"meta-divider",children:"|"}),e.jsx("span",{className:"meta-value",children:new Date(y[M].timestamp).toLocaleString()})]}),e.jsxs("div",{className:"preview-actions",children:[e.jsx("button",{className:"btn-premium btn-sm",onClick:()=>ge(y[M].base64),children:"DOWNLOAD PNG"}),e.jsxs("button",{className:"btn-destructive btn-sm",onClick:()=>J(y[M].id),children:[e.jsx(Be,{size:14})," DELETE"]})]})]})]}):e.jsxs("div",{className:"preview-empty-placeholder",children:[e.jsx(Ke,{size:48,style:{opacity:.1,marginBottom:16}}),e.jsx("p",{children:"Capture a screenshot to begin analysis"})]})})]})]}),m==="logs"&&e.jsxs("div",{className:"action-card screenshot-card",style:{padding:0,gap:0},children:[e.jsxs("div",{className:"log-toolbar",children:[e.jsxs("div",{className:"log-filter-group",children:[e.jsxs("div",{className:"log-stat-pill",children:[e.jsx("span",{className:`log-live-dot ${$e?"active":""}`}),$e?"LIVE":"CONNECTING"]}),e.jsxs("div",{className:"log-stat-pill",style:{opacity:.6},children:[le.length," LINES"]}),e.jsxs("div",{className:"log-search-box",children:[e.jsx(Xe,{size:14,className:"search-icon-inline"}),e.jsx("input",{type:"text",className:"type-input-field tiny",placeholder:"Filter trace...",value:oe,onChange:a=>Ye(a.target.value)})]})]}),e.jsxs("div",{className:"log-actions-group",children:[e.jsxs("button",{className:`btn-secondary btn-sm ${Q?"active":""}`,onClick:()=>Ie(!Q),title:Q?"Freeze Logs":"Follow Logs",children:[e.jsx($t,{size:14,className:Q?"animate-pulse":""}),Q?"FREEZE":"FOLLOW"]}),e.jsxs("button",{className:"btn-premium btn-sm",onClick:()=>{const a=new Blob([le.join(`
|
|
194
|
+
`)],{type:"text/plain"}),c=URL.createObjectURL(a),f=document.createElement("a");f.href=c,f.download=`logs-${d.udid}-${Date.now()}.txt`,f.click(),URL.revokeObjectURL(c)},disabled:le.length===0,children:[e.jsx(_t,{size:14}),"EXPORT"]}),e.jsxs("button",{className:"btn-secondary btn-sm",onClick:()=>Ee([]),title:"Clear Logs",children:[e.jsx(Be,{size:14}),"CLEAR"]})]})]}),e.jsx("div",{className:"log-display-area",ref:v,style:{flex:1},children:Me()})]}),m==="terminal"&&e.jsx("div",{className:"action-card full-height",children:e.jsx(Ws,{platform:(d.platform||"").toLowerCase(),prompt:`${(d.platform||"").toLowerCase()==="ios"?"ios":"adb"} $`,welcomeMessage:`Connected to ${d.name} (${d.udid}).
|
|
195
|
+
Internal Shell Environment.`,onCommand:async a=>{const c=await D.executeShell(d.udid,a);if(c.error)throw new Error(c.error);return c.output}})})]})})]})]})]})}const gt={platform:{ios:!0,android:!0},state:{ready:!0,offline:!0,busy:!0},name:""};class Gs extends qe.Component{constructor(t){super(t),this.socketCleanups=[],this.refreshTimeout=null,this.state={devices:[],activeSessionsCount:0,pendingSessionsCount:0,queueSummary:null,filter:gt}}componentDidMount(){this.fetchDevices(),this.devicePolling=setInterval(()=>{this.fetchDevices()},1e4);const t=this.props.onSocketEvent("device_unblocked",()=>{console.info("Real-time: Device unblocked, triggering debounced refresh"),this.fetchDevicesDebounced()}),l=this.props.onSocketEvent("device_blocked",()=>{console.info("Real-time: Device blocked, triggering debounced refresh"),this.fetchDevicesDebounced()});this.socketCleanups.push(t,l)}componentWillUnmount(){this.devicePolling&&(clearInterval(this.devicePolling),this.devicePolling=void 0),this.refreshTimeout&&(clearTimeout(this.refreshTimeout),this.refreshTimeout=null),this.socketCleanups.forEach(t=>t())}fetchDevicesDebounced(){this.refreshTimeout&&clearTimeout(this.refreshTimeout),this.refreshTimeout=setTimeout(()=>{this.refreshTimeout=null,this.fetchDevices()},500)}getBusyDevicesCount(t){return[u=>u.busy].reduce((u,p)=>u.filter(p),t).length}async fetchDevices(){try{const t=await D.getDevices(),l=this.getBusyDevicesCount(t),u=await D.getPendingSessionsCount(),p=await D.getQueueSummary();console.log(t),this.setState({devices:t,activeSessionsCount:l,pendingSessionsCount:u,queueSummary:p})}catch(t){console.log(t)}}getFilteredDevice(){const{ready:t,busy:l,offline:u}=this.state.filter.state,{ios:p,android:s}=this.state.filter.platform,L=[v=>p&&(v.platform=="ios"||v.platform=="tvos")||s&&v.platform=="android",v=>t&&!v.busy&&!v.offline||l&&v.busy||u&&v.offline];return this.state.filter.name!=""&&L.push(v=>v.name.toLowerCase().includes(this.state.filter.name.toLowerCase())||v.udid.toLowerCase().includes(this.state.filter.name.toLowerCase())),L.reduce((v,x)=>v.filter(x),this.state.devices)}setFilter(t){this.setState({filter:{...this.state.filter,...t}})}getPlatformFilterComponent(){const{ios:t,android:l}=this.state.filter.platform;return e.jsxs("div",{className:"device-explorer-header-value",children:[e.jsxs("button",{className:`device-explorer-header__platform-btn ${l&&"selected"}`,onClick:()=>this.setFilter({platform:{...this.state.filter.platform,android:!this.state.filter.platform.android}}),children:[e.jsx(st,{size:20,color:"currentColor"}),"Android"]}),e.jsxs("button",{className:`device-explorer-header__platform-btn ${t&&"selected"}`,onClick:()=>this.setFilter({platform:{...this.state.filter.platform,ios:!this.state.filter.platform.ios}}),children:[e.jsx(kt,{size:20,color:"currentColor"}),"iOS"]})]})}getDeviceStateFilterComponent(){const{ready:t,busy:l,offline:u}=this.state.filter.state;return e.jsxs("div",{className:"device-explorer-header-value",children:[e.jsx("div",{className:`device-explorer-header__device-state ready ${t&&"selected"}`,onClick:()=>this.setFilter({state:{...this.state.filter.state,ready:!this.state.filter.state.ready}}),children:"Ready"}),e.jsx("div",{className:`device-explorer-header__device-state busy ${l&&"selected"}`,onClick:()=>this.setFilter({state:{...this.state.filter.state,busy:!this.state.filter.state.busy}}),children:"Busy"}),e.jsx("div",{className:`device-explorer-header__device-state offline ${u&&"selected"}`,onClick:()=>this.setFilter({state:{...this.state.filter.state,offline:!this.state.filter.state.offline}}),children:"Offline"})]})}render(){const t=this.getFilteredDevice(),{udid:l}=this.props.params,u=l?this.state.devices.find(p=>p.udid===l):null;return e.jsxs("div",{className:"device-explorer-container",children:[e.jsxs("div",{className:"device-explorer-header-container",children:[e.jsxs("div",{className:"device-explorer-header-left-container",children:[e.jsxs("div",{className:"device-explorer-header-entry",children:[e.jsx("div",{className:"device-explorer-header-entry-header",children:"Platform"}),this.getPlatformFilterComponent()]}),e.jsxs("div",{className:"device-explorer-header-entry",children:[e.jsx("div",{className:"device-explorer-header-entry-header",children:"Device state"}),this.getDeviceStateFilterComponent()]}),e.jsxs("div",{className:"device-explorer-header-entry search-entry",children:[e.jsx("div",{className:"device-explorer-header-entry-header",children:"Search by name or udid"}),e.jsx("div",{className:"device-explorer-header-value",children:e.jsxs("div",{className:"device-explorer-search-wrapper",children:[e.jsx(Xe,{size:16,color:"#94a3b8",className:"device-explorer-search-icon"}),e.jsx("input",{type:"text",className:"device-explorer-header-text-filter",placeholder:"Search devices...",onChange:p=>{this.setState({filter:{...this.state.filter,name:p.target.value}})}})]})})]})]}),e.jsx("div",{className:"device-explorer-header-filter-count",children:e.jsxs(Pe,{variant:"secondary",children:[e.jsx("span",{className:"font-bold",children:t.length})," of"," ",e.jsx("span",{className:"font-bold",children:this.state.devices.length})," ",this.state.devices.length===1?"device":"devices"]})}),e.jsxs("div",{className:"device-explorer-header-right-container",children:[this.state.queueSummary&&this.state.pendingSessionsCount>0&&e.jsxs(Pe,{variant:"secondary",className:"mr-2",children:[e.jsx("span",{className:"font-bold",children:"Queue Insights:"})," ",Object.entries(this.state.queueSummary.byPlatform).map(([p,s])=>e.jsxs("span",{className:"ml-1",children:[p==="any"?"Mixed":p.toUpperCase(),":"," ",Math.ceil(s.avgDurationMs/6e4),"m ETA"]},p))]}),e.jsxs(Pe,{variant:"success",children:[e.jsx("span",{className:"font-bold",children:this.state.activeSessionsCount})," Active session",this.state.activeSessionsCount!==1?"s":""]}),e.jsxs(Pe,{variant:"warning",children:[e.jsx("span",{className:"font-bold",children:this.state.pendingSessionsCount})," Pending session",this.state.pendingSessionsCount!==1?"s":""]}),e.jsxs(Qe,{size:"sm",variant:"default",onClick:()=>this.fetchDevices(),children:[e.jsx(rt,{size:14,color:"currentColor",className:"mr-1"}),"Refresh"]})]})]}),t.length>0?e.jsx(_s,{devices:t,reloadDevices:()=>this.fetchDevices()}):e.jsxs("div",{className:"device-explorer-empty stagger-1",children:[e.jsx("div",{className:"device-explorer-empty-icon",children:e.jsx(st,{size:32})}),this.state.devices.length===0?e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"brand-font",children:"Global Device Registry Empty"}),e.jsx("p",{children:"Xenon hasn't detected any active device nodes in your infrastructure. Ensure your device farm is connected and heartbeat signals are active."}),e.jsxs(Qe,{variant:"default",onClick:()=>this.fetchDevices(),children:[e.jsx(rt,{size:14,className:"mr-2"}),"Manual Sync"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"brand-font",children:"No Devices Found"}),e.jsx("p",{children:"Deployment configuration mismatch. Adjust your platform or state filters to find the appropriate testing target."}),e.jsx(Qe,{variant:"outline",onClick:()=>this.setState({filter:gt}),children:"Reset All Filters"})]})]}),u&&e.jsx("div",{className:"device-control-modal-overlay",children:e.jsx("div",{className:"device-control-modal",children:e.jsx(Xs,{device:u,onClose:()=>this.props.navigate("/devices")})})})]})}}function li(){const n=jt(),t=nt(),{on:l}=Et();return e.jsx(Gs,{params:n,navigate:t,onSocketEvent:l})}export{Gs as DeviceExplorer,li as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/device-explorer-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/device-explorer-DFu8Gxj4.js","assets/useSocket-CliVeWS3.js","assets/index-C1DBaoSh.js","assets/clock-CsVplnJ2.js","assets/plus-DfjM7G6e.js","assets/button-BVazt4Z1.js","assets/badge-BiR1gmMm.js","assets/badge-B1nKs8zj.css","assets/button-CJlKn4PZ.css","assets/cpu-DNC8n7kK.js","assets/mouse-pointer-2-CSn_Wnc9.js","assets/zap-ZrK5B58i.js","assets/lock-BstCxnX6.js","assets/trash-2-CZWUMK5b.js","assets/device-explorer-vr8x2iik.css","assets/session-dashboard-C6ek4z65.js","assets/session-dashboard-C2k7FFv_.css","assets/apps-1sLWHOGO.js","assets/apps-CcM77dgg.css","assets/webhook-settings-tPiwWf8y.js","assets/webhook-settings-CDPgsgkb.css","assets/settings-BDYP8ULf.js","assets/Layouts-D0WSzKOh.js","assets/Layouts-DPMls9vh.css","assets/calendar-yMyP2_Nc.js","assets/ai-settings-DQWDdNd7.js","assets/maintenance-settings-BwfG9cu2.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function Ec(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const l in r)if(l!=="default"&&!(l in e)){const o=Object.getOwnPropertyDescriptor(r,l);o&&Object.defineProperty(e,l,o.get?o:{enumerable:!0,get:()=>r[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();function kc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ss={exports:{}},Zn={};/*
|
|
3
3
|
object-assign
|
|
4
4
|
(c) Sindre Sorhus
|
|
@@ -171,4 +171,4 @@ Add a <Suspense fallback=...> component higher in the tree to provide a loading
|
|
|
171
171
|
*
|
|
172
172
|
* This source code is licensed under the ISC license.
|
|
173
173
|
* See the LICENSE file in the root directory of this source tree.
|
|
174
|
-
*/const ch=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],fh=q("x",ch),dh=[{id:"devices",label:"Devices",icon:v.jsx(uh,{size:18,color:"currentColor"}),path:"/devices",enabled:!0},{id:"builds",label:"Builds",icon:v.jsx(Zp,{size:18,color:"currentColor"}),path:"/builds",enabled:!0},{id:"apps",label:"Apps",icon:v.jsx(Dp,{size:18,color:"currentColor"}),path:"/apps",enabled:!0},{id:"notifications",label:"Notifications",icon:v.jsx(Up,{size:18,color:"currentColor"}),path:"/notifications",enabled:!0},{id:"settings",label:"Settings",icon:v.jsx(yc,{size:18,color:"currentColor"}),path:"/settings",enabled:!1}],gc=()=>dh.filter(e=>e.enabled),ph=()=>{const e=Ti();or(),gc();const[t,n]=x.useState(!1),r=x.useRef(null);return x.useEffect(()=>{const l=o=>{r.current&&!r.current.contains(o.target)&&n(!1)};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[]),v.jsxs("div",{className:"header-container",children:[v.jsx("div",{className:"header-left",children:v.jsx("div",{className:"header-logo-container",onClick:()=>e("/"),children:v.jsx("img",{src:"logo.svg",alt:"Xenon Logo",className:"header-logo-image"})})}),v.jsxs("div",{className:"header-right",children:[v.jsx("div",{className:"header-actions",children:v.jsxs("div",{className:"header-status-pill",children:[v.jsx("div",{className:"status-dot"}),v.jsx("span",{children:"System Online"})]})}),v.jsxs("div",{className:"profile-dropdown-container",ref:r,children:[v.jsxs("button",{className:`profile-trigger ${t?"open":""}`,onClick:()=>n(!t),children:[v.jsx("div",{className:"avatar-preview",children:v.jsx(oh,{size:16})}),v.jsxs("div",{className:"profile-info-compact",children:[v.jsx("span",{className:"profile-name",children:"Administrator"}),v.jsx("span",{className:"profile-role",children:"Root Node"})]}),v.jsx(Hp,{size:14,className:`chevron-icon ${t?"rotate":""}`})]}),t&&v.jsxs("div",{className:"profile-dropdown animate-slide-up",children:[v.jsxs("div",{className:"dropdown-group",children:[v.jsxs("div",{className:"dropdown-section-header",children:[v.jsx(mc,{size:12}),v.jsx("span",{children:"Workspace Context"})]}),v.jsxs("div",{className:"dropdown-context-item",children:[v.jsx("p",{className:"context-label",children:"Current Registry"}),v.jsx("p",{className:"context-value",children:"Xenon Default Registry"})]}),v.jsxs("div",{className:"dropdown-context-item",children:[v.jsx("p",{className:"context-label",children:"Active Node"}),v.jsx("p",{className:"context-value",children:"Root Node • Primary"})]})]}),v.jsx("div",{className:"dropdown-divider"}),v.jsxs("div",{className:"dropdown-system-info",children:[v.jsxs("div",{className:"status-indicator",children:[v.jsx("div",{className:"status-dot online"}),v.jsx("span",{children:"Node: Stable"})]}),v.jsx("span",{className:"version-label",children:"v1.2.4-stable"})]})]})]})]})]})},hh="modulepreload",mh=function(e){return"/xenon/"+e},is={},kt=function(t,n,r){let l=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),u=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));l=Promise.allSettled(n.map(s=>{if(s=mh(s),s in is)return;is[s]=!0;const f=s.endsWith(".css"),m=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${s}"]${m}`))return;const g=document.createElement("link");if(g.rel=f?"stylesheet":hh,f||(g.as="script"),g.crossOrigin="",g.href=s,u&&g.setAttribute("nonce",u),document.head.appendChild(g),f)return new Promise((p,E)=>{g.addEventListener("load",p),g.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${s}`)))})}))}function o(i){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=i,window.dispatchEvent(u),!u.defaultPrevented)throw i}return l.then(i=>{for(const u of i||[])u.status==="rejected"&&o(u.reason);return t().catch(o)})};class vh extends x.Component{constructor(){super(...arguments),this.state={hasError:!1},this.handleReset=()=>{this.setState({hasError:!1}),window.location.reload()}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("Uncaught error:",t,n)}render(){return this.state.hasError?this.props.fallback||v.jsxs("div",{className:"error-boundary-container",style:{padding:"4rem 2rem",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem",color:"var(--text-main)",background:"var(--bg-main)",minHeight:"100vh"},children:[v.jsx("div",{style:{color:"var(--accent-red)",filter:"drop-shadow(0 0 10px rgba(239, 68, 68, 0.3))"},children:v.jsx(ah,{size:64})}),v.jsx("h2",{style:{fontSize:"2rem",fontWeight:700,margin:0},children:"Component Exception Detected"}),v.jsx("p",{style:{color:"var(--text-muted)",maxWidth:"500px",lineHeight:1.6},children:"An unexpected error occurred while rendering this section. Xenon's isolation engine has contained the fault to prevent a total system crash."}),this.state.error&&v.jsx("pre",{style:{background:"rgba(0,0,0,0.3)",padding:"1rem",borderRadius:"8px",fontSize:"0.8rem",color:"var(--accent-red)",maxWidth:"80%",overflowX:"auto"},children:this.state.error.message}),v.jsxs("button",{onClick:this.handleReset,style:{background:"var(--primary)",color:"var(--secondary)",border:"none",padding:"0.75rem 2rem",borderRadius:"8px",fontWeight:700,cursor:"pointer",display:"flex",alignItems:"center",gap:"0.5rem",transition:"all 0.2s"},onMouseOver:t=>t.currentTarget.style.transform="translateY(-2px)",onMouseOut:t=>t.currentTarget.style.transform="translateY(0)",children:[v.jsx(vc,{size:18}),"Reload Application"]})]}):this.props.children}}const us=x.lazy(()=>kt(()=>import("./device-explorer-QINnmim7.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))),yh=x.lazy(()=>kt(()=>import("./session-dashboard-FUCdTLJc.js"),__vite__mapDeps([14,1,2,6,7,3,15,16]))),gh=x.lazy(()=>kt(()=>import("./apps-iWYKDaHG.js"),__vite__mapDeps([17,2,6,7,5,8,10,12,18]))),wh=x.lazy(()=>kt(()=>import("./webhook-settings-DiEIokQy.js"),__vite__mapDeps([19,2,12,10,4,20])).then(e=>({default:e.WebhookSettings}))),xh=x.lazy(()=>kt(()=>import("./settings-DsABv9a7.js"),__vite__mapDeps([21,2,22,23,3,24,9])).then(e=>({default:e.Settings}))),Eh=x.lazy(()=>kt(()=>import("./ai-settings-UTOAls44.js"),__vite__mapDeps([25,2,22,23,15,11])).then(e=>({default:e.AISettings}))),kh=x.lazy(()=>kt(()=>import("./maintenance-settings-CLGqmciU.js"),__vite__mapDeps([26,2,22,23,12,24])).then(e=>({default:e.MaintenanceSettings}))),Sh=()=>v.jsxs("div",{className:"settings-loading",style:{height:"calc(100vh - 72px)"},children:[v.jsx(vc,{className:"animate-spin",size:32}),v.jsx("span",{children:"Hydrating View..."})]}),_h=()=>v.jsx(vh,{children:v.jsx(x.Suspense,{fallback:v.jsx(Sh,{}),children:v.jsxs(Np,{children:[v.jsx(xe,{path:"/",element:v.jsx(ts,{to:"/devices",replace:!0})}),v.jsx(xe,{path:"/devices",element:v.jsx("div",{className:"app-body-container devices-view",children:v.jsx(us,{})})}),v.jsx(xe,{path:"/devices/:udid/control/:tab?",element:v.jsx("div",{className:"app-body-container devices-view",children:v.jsx(us,{})})}),v.jsx(xe,{path:"/apps",element:v.jsx("div",{className:"app-body-container apps-view",children:v.jsx(gh,{})})}),v.jsx(xe,{path:"/builds",element:v.jsx("div",{className:"app-body-container sessions-view",children:v.jsx(yh,{})})}),v.jsx(xe,{path:"/notifications",element:v.jsx("div",{className:"app-body-container settings-view",style:{height:"calc(100vh - 72px)",overflow:"hidden",display:"flex",flexDirection:"column"},children:v.jsx(wh,{})})}),v.jsx(xe,{path:"/settings",element:v.jsx("div",{className:"app-body-container settings-view",children:v.jsx(xh,{})})}),v.jsx(xe,{path:"/ai-settings",element:v.jsx("div",{className:"app-body-container settings-view",children:v.jsx(Eh,{})})}),v.jsx(xe,{path:"/maintenance",element:v.jsx("div",{className:"app-body-container settings-view",children:v.jsx(kh,{})})}),v.jsx(xe,{path:"*",element:v.jsx(ts,{to:"/devices",replace:!0})})]})})}),wc=x.createContext(void 0),Lh=()=>{const e=x.useContext(wc);if(!e)throw new Error("useToast must be used within a ToastProvider");return e},Ch=({children:e})=>{const[t,n]=x.useState([]),r=x.useCallback(o=>{n(i=>i.filter(u=>u.id!==o))},[]),l=x.useCallback((o,i="info",u=4e3)=>{const s=Math.random().toString(36).substring(2,9);return n(f=>[...f,{id:s,message:o,type:i,duration:u}]),i!=="loading"&&u>0&&setTimeout(()=>{r(s)},u),s},[r]);return v.jsxs(wc.Provider,{value:{toast:l,removeToast:r},children:[e,v.jsx("div",{className:"toast-container","aria-live":"polite","aria-atomic":"true",role:"status",children:t.map(o=>v.jsxs("div",{className:`toast-item toast-${o.type} animate-slide-in`,children:[v.jsxs("div",{className:"toast-icon",children:[o.type==="success"&&v.jsx(Kp,{size:18}),o.type==="error"&&v.jsx(Yp,{size:18}),o.type==="info"&&v.jsx(mc,{size:18}),o.type==="loading"&&v.jsx(bp,{size:18,className:"animate-spin"})]}),v.jsx("div",{className:"toast-message",children:o.message}),v.jsx("button",{className:"toast-close",onClick:()=>r(o.id),"aria-label":`Close ${o.type} notification`,children:v.jsx(fh,{size:14})})]},o.id))})]})},vn=({icon:e,label:t,path:n,active:r,onClick:l})=>v.jsxs("div",{className:"sidebar-item-wrapper group",onClick:l,children:[r&&v.jsx("div",{className:"sidebar-active-indicator"}),v.jsx("div",{className:`sidebar-icon-container ${r?"active":""}`,children:e}),v.jsx("div",{className:"sidebar-tooltip",children:t})]}),Nh=()=>{const e=Ti(),t=or(),n=gc(),r=l=>t.pathname===l;return v.jsxs("aside",{className:"app-sidebar",children:[v.jsx("div",{className:"sidebar-nav",children:n.map(l=>v.jsx(vn,{icon:l.icon,label:l.label,path:l.path,active:r(l.path),onClick:()=>e(l.path)},l.id))}),v.jsxs("div",{className:"sidebar-footer",children:[v.jsx(vn,{icon:v.jsx(yc,{size:18}),label:"Settings",path:"/settings",active:r("/settings"),onClick:()=>e("/settings")}),v.jsx(vn,{icon:v.jsx(Vp,{size:18}),label:"AI Engine",path:"/ai-settings",active:r("/ai-settings"),onClick:()=>e("/ai-settings")}),v.jsx(vn,{icon:v.jsx(rh,{size:18}),label:"Maintenance",path:"/maintenance",active:r("/maintenance"),onClick:()=>e("/maintenance")}),v.jsx(vn,{icon:v.jsx(Bp,{size:18}),label:"API Docs",path:"/xenon/api-docs",active:!1,onClick:()=>window.open(window.location.origin+"/xenon/api-docs","_blank")})]})]})};function Ph(){return v.jsx(Ch,{children:v.jsx(Lp,{basename:"/xenon",children:v.jsxs("div",{className:"app-layout",children:[v.jsx(ph,{}),v.jsxs("div",{className:"app-main-container",children:[v.jsx(Nh,{}),v.jsx("main",{className:"app-content",children:v.jsx(_h,{})})]})]})})})}Id.render(v.jsx(x.StrictMode,{children:v.jsx(Ph,{})}),document.getElementById("root"));export{Vp as B,Yp as C,mc as I,bp as L,Oc as R,uh as S,ah as T,fh as X,Id as a,Ti as b,q as c,rh as d,Hp as e,jh as f,vc as g,kc as h,Kp as i,v as j,Up as k,oh as l,x as r,Lh as u};
|
|
174
|
+
*/const ch=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],fh=q("x",ch),dh=[{id:"devices",label:"Devices",icon:v.jsx(uh,{size:18,color:"currentColor"}),path:"/devices",enabled:!0},{id:"builds",label:"Builds",icon:v.jsx(Zp,{size:18,color:"currentColor"}),path:"/builds",enabled:!0},{id:"apps",label:"Apps",icon:v.jsx(Dp,{size:18,color:"currentColor"}),path:"/apps",enabled:!0},{id:"notifications",label:"Notifications",icon:v.jsx(Up,{size:18,color:"currentColor"}),path:"/notifications",enabled:!0},{id:"settings",label:"Settings",icon:v.jsx(yc,{size:18,color:"currentColor"}),path:"/settings",enabled:!1}],gc=()=>dh.filter(e=>e.enabled),ph=()=>{const e=Ti();or(),gc();const[t,n]=x.useState(!1),r=x.useRef(null);return x.useEffect(()=>{const l=o=>{r.current&&!r.current.contains(o.target)&&n(!1)};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[]),v.jsxs("div",{className:"header-container",children:[v.jsx("div",{className:"header-left",children:v.jsx("div",{className:"header-logo-container",onClick:()=>e("/"),children:v.jsx("img",{src:"logo.svg",alt:"Xenon Logo",className:"header-logo-image"})})}),v.jsxs("div",{className:"header-right",children:[v.jsx("div",{className:"header-actions",children:v.jsxs("div",{className:"header-status-pill",children:[v.jsx("div",{className:"status-dot"}),v.jsx("span",{children:"System Online"})]})}),v.jsxs("div",{className:"profile-dropdown-container",ref:r,children:[v.jsxs("button",{className:`profile-trigger ${t?"open":""}`,onClick:()=>n(!t),children:[v.jsx("div",{className:"avatar-preview",children:v.jsx(oh,{size:16})}),v.jsxs("div",{className:"profile-info-compact",children:[v.jsx("span",{className:"profile-name",children:"Administrator"}),v.jsx("span",{className:"profile-role",children:"Root Node"})]}),v.jsx(Hp,{size:14,className:`chevron-icon ${t?"rotate":""}`})]}),t&&v.jsxs("div",{className:"profile-dropdown animate-slide-up",children:[v.jsxs("div",{className:"dropdown-group",children:[v.jsxs("div",{className:"dropdown-section-header",children:[v.jsx(mc,{size:12}),v.jsx("span",{children:"Workspace Context"})]}),v.jsxs("div",{className:"dropdown-context-item",children:[v.jsx("p",{className:"context-label",children:"Current Registry"}),v.jsx("p",{className:"context-value",children:"Xenon Default Registry"})]}),v.jsxs("div",{className:"dropdown-context-item",children:[v.jsx("p",{className:"context-label",children:"Active Node"}),v.jsx("p",{className:"context-value",children:"Root Node • Primary"})]})]}),v.jsx("div",{className:"dropdown-divider"}),v.jsxs("div",{className:"dropdown-system-info",children:[v.jsxs("div",{className:"status-indicator",children:[v.jsx("div",{className:"status-dot online"}),v.jsx("span",{children:"Node: Stable"})]}),v.jsx("span",{className:"version-label",children:"v1.2.4-stable"})]})]})]})]})]})},hh="modulepreload",mh=function(e){return"/xenon/"+e},is={},kt=function(t,n,r){let l=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),u=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));l=Promise.allSettled(n.map(s=>{if(s=mh(s),s in is)return;is[s]=!0;const f=s.endsWith(".css"),m=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${s}"]${m}`))return;const g=document.createElement("link");if(g.rel=f?"stylesheet":hh,f||(g.as="script"),g.crossOrigin="",g.href=s,u&&g.setAttribute("nonce",u),document.head.appendChild(g),f)return new Promise((p,E)=>{g.addEventListener("load",p),g.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${s}`)))})}))}function o(i){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=i,window.dispatchEvent(u),!u.defaultPrevented)throw i}return l.then(i=>{for(const u of i||[])u.status==="rejected"&&o(u.reason);return t().catch(o)})};class vh extends x.Component{constructor(){super(...arguments),this.state={hasError:!1},this.handleReset=()=>{this.setState({hasError:!1}),window.location.reload()}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("Uncaught error:",t,n)}render(){return this.state.hasError?this.props.fallback||v.jsxs("div",{className:"error-boundary-container",style:{padding:"4rem 2rem",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem",color:"var(--text-main)",background:"var(--bg-main)",minHeight:"100vh"},children:[v.jsx("div",{style:{color:"var(--accent-red)",filter:"drop-shadow(0 0 10px rgba(239, 68, 68, 0.3))"},children:v.jsx(ah,{size:64})}),v.jsx("h2",{style:{fontSize:"2rem",fontWeight:700,margin:0},children:"Component Exception Detected"}),v.jsx("p",{style:{color:"var(--text-muted)",maxWidth:"500px",lineHeight:1.6},children:"An unexpected error occurred while rendering this section. Xenon's isolation engine has contained the fault to prevent a total system crash."}),this.state.error&&v.jsx("pre",{style:{background:"rgba(0,0,0,0.3)",padding:"1rem",borderRadius:"8px",fontSize:"0.8rem",color:"var(--accent-red)",maxWidth:"80%",overflowX:"auto"},children:this.state.error.message}),v.jsxs("button",{onClick:this.handleReset,style:{background:"var(--primary)",color:"var(--secondary)",border:"none",padding:"0.75rem 2rem",borderRadius:"8px",fontWeight:700,cursor:"pointer",display:"flex",alignItems:"center",gap:"0.5rem",transition:"all 0.2s"},onMouseOver:t=>t.currentTarget.style.transform="translateY(-2px)",onMouseOut:t=>t.currentTarget.style.transform="translateY(0)",children:[v.jsx(vc,{size:18}),"Reload Application"]})]}):this.props.children}}const us=x.lazy(()=>kt(()=>import("./device-explorer-DFu8Gxj4.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),yh=x.lazy(()=>kt(()=>import("./session-dashboard-C6ek4z65.js"),__vite__mapDeps([15,1,2,6,7,3,9,16]))),gh=x.lazy(()=>kt(()=>import("./apps-1sLWHOGO.js"),__vite__mapDeps([17,2,6,7,5,8,11,13,18]))),wh=x.lazy(()=>kt(()=>import("./webhook-settings-tPiwWf8y.js"),__vite__mapDeps([19,2,13,11,4,20])).then(e=>({default:e.WebhookSettings}))),xh=x.lazy(()=>kt(()=>import("./settings-BDYP8ULf.js"),__vite__mapDeps([21,2,22,23,3,24,10])).then(e=>({default:e.Settings}))),Eh=x.lazy(()=>kt(()=>import("./ai-settings-DQWDdNd7.js"),__vite__mapDeps([25,2,22,23,9,12])).then(e=>({default:e.AISettings}))),kh=x.lazy(()=>kt(()=>import("./maintenance-settings-BwfG9cu2.js"),__vite__mapDeps([26,2,22,23,13,24])).then(e=>({default:e.MaintenanceSettings}))),Sh=()=>v.jsxs("div",{className:"settings-loading",style:{height:"calc(100vh - 72px)"},children:[v.jsx(vc,{className:"animate-spin",size:32}),v.jsx("span",{children:"Hydrating View..."})]}),_h=()=>v.jsx(vh,{children:v.jsx(x.Suspense,{fallback:v.jsx(Sh,{}),children:v.jsxs(Np,{children:[v.jsx(xe,{path:"/",element:v.jsx(ts,{to:"/devices",replace:!0})}),v.jsx(xe,{path:"/devices",element:v.jsx("div",{className:"app-body-container devices-view",children:v.jsx(us,{})})}),v.jsx(xe,{path:"/devices/:udid/control/:tab?",element:v.jsx("div",{className:"app-body-container devices-view",children:v.jsx(us,{})})}),v.jsx(xe,{path:"/apps",element:v.jsx("div",{className:"app-body-container apps-view",children:v.jsx(gh,{})})}),v.jsx(xe,{path:"/builds",element:v.jsx("div",{className:"app-body-container sessions-view",children:v.jsx(yh,{})})}),v.jsx(xe,{path:"/notifications",element:v.jsx("div",{className:"app-body-container settings-view",style:{height:"calc(100vh - 72px)",overflow:"hidden",display:"flex",flexDirection:"column"},children:v.jsx(wh,{})})}),v.jsx(xe,{path:"/settings",element:v.jsx("div",{className:"app-body-container settings-view",children:v.jsx(xh,{})})}),v.jsx(xe,{path:"/ai-settings",element:v.jsx("div",{className:"app-body-container settings-view",children:v.jsx(Eh,{})})}),v.jsx(xe,{path:"/maintenance",element:v.jsx("div",{className:"app-body-container settings-view",children:v.jsx(kh,{})})}),v.jsx(xe,{path:"*",element:v.jsx(ts,{to:"/devices",replace:!0})})]})})}),wc=x.createContext(void 0),Lh=()=>{const e=x.useContext(wc);if(!e)throw new Error("useToast must be used within a ToastProvider");return e},Ch=({children:e})=>{const[t,n]=x.useState([]),r=x.useCallback(o=>{n(i=>i.filter(u=>u.id!==o))},[]),l=x.useCallback((o,i="info",u=4e3)=>{const s=Math.random().toString(36).substring(2,9);return n(f=>[...f,{id:s,message:o,type:i,duration:u}]),i!=="loading"&&u>0&&setTimeout(()=>{r(s)},u),s},[r]);return v.jsxs(wc.Provider,{value:{toast:l,removeToast:r},children:[e,v.jsx("div",{className:"toast-container","aria-live":"polite","aria-atomic":"true",role:"status",children:t.map(o=>v.jsxs("div",{className:`toast-item toast-${o.type} animate-slide-in`,children:[v.jsxs("div",{className:"toast-icon",children:[o.type==="success"&&v.jsx(Kp,{size:18}),o.type==="error"&&v.jsx(Yp,{size:18}),o.type==="info"&&v.jsx(mc,{size:18}),o.type==="loading"&&v.jsx(bp,{size:18,className:"animate-spin"})]}),v.jsx("div",{className:"toast-message",children:o.message}),v.jsx("button",{className:"toast-close",onClick:()=>r(o.id),"aria-label":`Close ${o.type} notification`,children:v.jsx(fh,{size:14})})]},o.id))})]})},vn=({icon:e,label:t,path:n,active:r,onClick:l})=>v.jsxs("div",{className:"sidebar-item-wrapper group",onClick:l,children:[r&&v.jsx("div",{className:"sidebar-active-indicator"}),v.jsx("div",{className:`sidebar-icon-container ${r?"active":""}`,children:e}),v.jsx("div",{className:"sidebar-tooltip",children:t})]}),Nh=()=>{const e=Ti(),t=or(),n=gc(),r=l=>t.pathname===l;return v.jsxs("aside",{className:"app-sidebar",children:[v.jsx("div",{className:"sidebar-nav",children:n.map(l=>v.jsx(vn,{icon:l.icon,label:l.label,path:l.path,active:r(l.path),onClick:()=>e(l.path)},l.id))}),v.jsxs("div",{className:"sidebar-footer",children:[v.jsx(vn,{icon:v.jsx(yc,{size:18}),label:"Settings",path:"/settings",active:r("/settings"),onClick:()=>e("/settings")}),v.jsx(vn,{icon:v.jsx(Vp,{size:18}),label:"AI Engine",path:"/ai-settings",active:r("/ai-settings"),onClick:()=>e("/ai-settings")}),v.jsx(vn,{icon:v.jsx(rh,{size:18}),label:"Maintenance",path:"/maintenance",active:r("/maintenance"),onClick:()=>e("/maintenance")}),v.jsx(vn,{icon:v.jsx(Bp,{size:18}),label:"API Docs",path:"/xenon/api-docs",active:!1,onClick:()=>window.open(window.location.origin+"/xenon/api-docs","_blank")})]})]})};function Ph(){return v.jsx(Ch,{children:v.jsx(Lp,{basename:"/xenon",children:v.jsxs("div",{className:"app-layout",children:[v.jsx(ph,{}),v.jsxs("div",{className:"app-main-container",children:[v.jsx(Nh,{}),v.jsx("main",{className:"app-content",children:v.jsx(_h,{})})]})]})})})}Id.render(v.jsx(x.StrictMode,{children:v.jsx(Ph,{})}),document.getElementById("root"));export{Vp as B,Yp as C,mc as I,bp as L,Oc as R,uh as S,ah as T,fh as X,Id as a,Ti as b,q as c,rh as d,Hp as e,jh as f,vc as g,kc as h,Kp as i,v as j,Up as k,oh as l,x as r,Lh as u};
|
package/lib/public/assets/{maintenance-settings-CLGqmciU.js → maintenance-settings-BwfG9cu2.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as x,r as n,j as e,g as j,l as v,d as b,I as y,i as C,T as f}from"./index-
|
|
1
|
+
import{c as x,r as n,j as e,g as j,l as v,d as b,I as y,i as C,T as f}from"./index-S71J2rWg.js";import{X as u}from"./index-C1DBaoSh.js";import{A as N}from"./Layouts-D0WSzKOh.js";import{T as S}from"./trash-2-CZWUMK5b.js";import{C as M}from"./calendar-yMyP2_Nc.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Me,h as tn,R as U,r as ve,j as s,i as qr,C as Wr,e as Xr,B as ut,S as Qr}from"./index-
|
|
1
|
+
import{c as Me,h as tn,R as U,r as ve,j as s,i as qr,C as Wr,e as Xr,B as ut,S as Qr}from"./index-S71J2rWg.js";import{H as Kr,a as Yr,p as er,u as Gr,C as nr}from"./useSocket-CliVeWS3.js";import{X as ce}from"./index-C1DBaoSh.js";import{c as Jr,D as tr,S as ct,B as De}from"./badge-BiR1gmMm.js";import{C as Gn}from"./clock-CsVplnJ2.js";import{C as Zr}from"./cpu-DNC8n7kK.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as e,g as j,l as S,B as C,i as y,T as N}from"./index-
|
|
1
|
+
import{r as i,j as e,g as j,l as S,B as C,i as y,T as N}from"./index-S71J2rWg.js";import{X as c}from"./index-C1DBaoSh.js";import{A as b}from"./Layouts-D0WSzKOh.js";import{C as k}from"./clock-CsVplnJ2.js";import{C as I}from"./calendar-yMyP2_Nc.js";import{M}from"./mouse-pointer-2-CSn_Wnc9.js";const B=()=>{const[a,t]=i.useState({healthCheckIntervalMs:3e4,healthCheckSchedule:"",enableSelfHealing:!0}),[g,d]=i.useState(!0),[m,h]=i.useState(!1),[l,n]=i.useState(null);i.useEffect(()=>{o()},[]);const o=async()=>{d(!0);try{const s=await c.getGlobalConfig();t({healthCheckIntervalMs:s.healthCheckIntervalMs||3e4,healthCheckSchedule:s.healthCheckSchedule||"",enableSelfHealing:s.enableSelfHealing!==void 0?s.enableSelfHealing:!0})}catch(s){console.error("Failed to load settings",s),n({type:"error",message:"Failed to access infrastructure parameters."})}finally{d(!1)}},u=async(s=a)=>{h(!0),n(null);try{await c.updateGlobalConfig(s),n({type:"success",message:"Infrastructure parameters synchronized across fleet."}),setTimeout(()=>n(null),5e3)}catch(r){console.error("Failed to save settings",r),n({type:"error",message:"Synchronization failed. Check network integrity."})}finally{h(!1)}},v=async()=>{const s={healthCheckIntervalMs:3e4,healthCheckSchedule:"",enableSelfHealing:!0};t(s),await u(s);try{await c.resetMetrics()}catch(r){console.error("Failed to reset metrics",r)}},p=[{label:"Battery Saver (2 AM)",value:"0 2 * * *"},{label:"Standard (Hourly)",value:"0 * * * *"},{label:"Operational Coverage (30m)",value:"*/30 * * * *"},{label:"High Performance (10m)",value:"*/10 * * * *"},{label:"Disable Schedule",value:""}],f=s=>s?s.split(" ").filter(x=>x!=="").length!==5?"Invalid Cron format (needs 5 parts)":s==="0 2 * * *"?"Quiet hours: Daily at 2:00 AM":s==="0 * * * *"?"Standard rotation: Start of every hour":s==="*/30 * * * *"?"Balanced: Every 30 minutes":s==="*/10 * * * *"?"Intensive: Every 10 minutes":`Custom orchestration: ${s}`:"Using Idle Health Frequency (Continuous/Passive mode).";return g?e.jsxs("div",{className:"settings-loading",children:[e.jsx(j,{className:"animate-spin",size:32}),e.jsx("span",{children:"Synchronizing Global Infrastructure..."})]}):e.jsxs("div",{className:"settings-container mesh-gradient-infra",children:[e.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),e.jsxs("div",{className:"settings-header",children:[e.jsxs("div",{className:"settings-title-group",children:[e.jsx(S,{className:"settings-icon infra-icon",size:28}),e.jsx("h2",{children:"Infrastructure Control"})]}),e.jsx("p",{className:"settings-subtitle",children:"Manage core farm parameters, heartbeat frequency, and maintenance orchestrations across the global registry."})]}),e.jsxs("div",{className:"settings-content",children:[e.jsxs("div",{className:"settings-grid",children:[e.jsxs("div",{className:"setting-card stagger-1",children:[e.jsxs("div",{className:"setting-card-header",children:[e.jsx(k,{size:16}),e.jsx("h4",{children:"Idle Health Frequency"})]}),e.jsx("p",{className:"section-description-dense",children:"Frequency of passive health pings when the system is in idle state."}),e.jsx("div",{className:"setting-field",children:e.jsxs("div",{className:"input-group",children:[e.jsx("input",{type:"number",value:a.healthCheckIntervalMs,onChange:s=>t({...a,healthCheckIntervalMs:parseInt(s.target.value)}),min:5e3,step:5e3}),e.jsx("span",{className:"code-font",children:"MS"})]})}),e.jsx("div",{className:"setting-hint-clean",children:"Minimum safe value: 5000ms. Note: This frequency is overridden when a schedule is active."})]}),e.jsxs("div",{className:"setting-card stagger-2",children:[e.jsxs("div",{className:"setting-card-header",children:[e.jsx(I,{size:16}),e.jsx("h4",{children:"Deep Diagnostic Schedule"})]}),e.jsx("p",{className:"section-description-dense",children:"Execute intensive reliability bursts (WDA restarts, Cache purges) using standardized Cron syntax."}),e.jsx("div",{className:"setting-field",children:e.jsx("div",{className:"setting-input-wrapper",children:e.jsx("input",{type:"text",placeholder:"e.g. 0 * * * * (At internal min 0)",value:a.healthCheckSchedule,onChange:s=>t({...a,healthCheckSchedule:s.target.value})})})}),e.jsxs("div",{className:"cron-preview",children:[e.jsx("span",{className:"preview-label",children:"Active Logic:"}),e.jsx("span",{className:"preview-value",children:f(a.healthCheckSchedule)})]}),e.jsxs("div",{className:"cron-presets",children:[e.jsxs("div",{className:"presets-label",children:[e.jsx(M,{size:12}),e.jsx("span",{children:"Intent-Based Presets:"})]}),e.jsx("div",{className:"presets-grid",children:p.map(s=>e.jsx("button",{className:`preset-chip ${a.healthCheckSchedule===s.value?"active":""}`,onClick:()=>t({...a,healthCheckSchedule:s.value}),children:s.label},s.label))})]})]}),e.jsxs("div",{className:"setting-card stagger-3",children:[e.jsxs("div",{className:"setting-card-header",children:[e.jsx(C,{size:16}),e.jsx("h4",{children:"AI Self-Healing"})]}),e.jsx("p",{className:"section-description-dense",children:"Automatically intercept and recover from failing locators using Xenon's 5-tier strategy."}),e.jsxs("div",{className:"toggle-group",children:[e.jsxs("label",{className:"switch",children:[e.jsx("input",{type:"checkbox",checked:a.enableSelfHealing,onChange:s=>t({...a,enableSelfHealing:s.target.checked})}),e.jsx("span",{className:"slider round"})]}),e.jsx("span",{className:"toggle-label",children:a.enableSelfHealing?"ENABLED":"DISABLED"})]}),e.jsx("div",{className:"setting-hint-clean",children:"When enabled, Xenon will attempt to find elements via Fuzzy XML, OCR, Visual AI, and LLM before failing a test."})]})]}),l&&e.jsxs("div",{className:`status-banner ${l.type}`,children:[l.type==="success"?e.jsx(y,{size:18}):e.jsx(N,{size:18}),e.jsx("span",{children:l.message})]})]}),e.jsx(b,{onSave:u,onDiscard:o,onRestoreDefaults:v,isSaving:m,saveLabel:"Save Configuration"})]})};export{B as Settings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as e,k,i as A,C as _}from"./index-
|
|
1
|
+
import{r as i,j as e,k,i as A,C as _}from"./index-S71J2rWg.js";import{X as n}from"./index-C1DBaoSh.js";import{T as g}from"./trash-2-CZWUMK5b.js";import{Z as W}from"./zap-ZrK5B58i.js";import{P as O}from"./plus-DfjM7G6e.js";const v=[{id:"device_offline",label:"Device Offline",icon:e.jsx(_,{size:14,className:"text-red-400"})},{id:"device_new",label:"New Device",icon:e.jsx(O,{size:14,className:"text-green-400"})},{id:"session_failed",label:"Session Failed",icon:e.jsx(g,{size:14,className:"text-orange-400"})}],J=()=>{const[x,w]=i.useState([]),[t,p]=i.useState(""),[r,j]=i.useState(["device_offline","session_failed"]),[N,u]=i.useState(!1),[d,o]=i.useState("idle"),[c,b]=i.useState(!1),[f,h]=i.useState("");i.useEffect(()=>{m()},[]);const m=async()=>{try{const s=await n.getWebhookConfigs();w(s||[])}catch(s){console.error("Failed to load webhook configs",s)}},y=async()=>{if(t){u(!0);try{await n.addWebhookConfig(t,r,"slack",f||void 0),p(""),h(""),b(!1),j(["device_offline","session_failed"]),await m()}catch(s){console.error("Failed to add webhook",s)}finally{u(!1)}}},S=async s=>{try{await n.deleteWebhookConfig(s),await m()}catch(a){console.error("Failed to delete webhook",a)}},C=async()=>{if(t){o("idle");try{await n.testWebhook(t,"slack"),o("success"),setTimeout(()=>o("idle"),3e3)}catch{o("error"),setTimeout(()=>o("idle"),3e3)}}},T=s=>{j(a=>a.includes(s)?a.filter(l=>l!==s):[...a,s])},E=s=>{h(a=>a+`{{${s}}} `)};return e.jsxs("div",{className:"webhook-settings-container",children:[e.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),e.jsxs("div",{className:"webhook-header",children:[e.jsxs("div",{className:"webhook-title",children:[e.jsx(k,{className:"webhook-icon",size:20}),e.jsx("h2",{children:"Notification Webhooks"})]}),e.jsx("p",{className:"webhook-subtitle",children:"Configure Slack or generic webhooks to receive alerts for critical infrastructure events."})]}),e.jsxs("div",{className:"webhook-list",children:[x.map(s=>e.jsxs("div",{className:"webhook-card",children:[e.jsxs("div",{className:"webhook-card-header",children:[e.jsxs("div",{className:"webhook-url-display",children:[e.jsx("span",{className:"platform-tag",children:s.payloadTemplate?"CUSTOM":"SLACK"}),e.jsx("span",{className:"url-text",children:s.url})]}),e.jsx("button",{className:"delete-btn",onClick:()=>S(s.id),children:e.jsx(g,{size:16})})]}),e.jsx("div",{className:"webhook-events-list",children:JSON.parse(s.events).map(a=>{const l=v.find(z=>z.id===a);return e.jsxs("span",{className:"event-pill",children:[l==null?void 0:l.icon,(l==null?void 0:l.label)||a]},a)})})]},s.id)),x.length===0&&e.jsxs("div",{className:"empty-webhook-state",children:[e.jsx(k,{size:48,className:"empty-icon"}),e.jsx("p",{children:"No webhooks configured yet."})]})]}),e.jsxs("div",{className:"add-webhook-form",children:[e.jsxs("div",{className:"form-scrollable-content",children:[e.jsx("h3",{children:"Add New Webhook"}),e.jsx("div",{className:"form-group",children:e.jsx("input",{type:"text",className:"webhook-input",placeholder:"https://hooks.slack.com/services/...",value:t,onChange:s=>p(s.target.value)})}),e.jsxs("div",{className:"events-selection",children:[e.jsx("label",{children:"Trigger Events:"}),e.jsx("div",{className:"events-grid",children:v.map(s=>e.jsxs("div",{className:`event-checkbox ${r.includes(s.id)?"selected":""}`,onClick:()=>T(s.id),children:[s.icon,e.jsx("span",{children:s.label}),r.includes(s.id)&&e.jsx(A,{size:14,className:"check-icon"})]},s.id))})]}),e.jsxs("div",{className:"template-section",children:[e.jsxs("div",{className:"template-header",onClick:()=>b(!c),children:[e.jsxs("div",{className:"template-toggle",children:[e.jsx(W,{size:16,className:c?"text-yellow-400":"text-gray-400"}),e.jsx("span",{children:"Use Custom Payload (Optional)"})]}),e.jsx("span",{className:"toggle-indicator",children:c?"−":"+"})]}),c&&e.jsxs("div",{className:"template-editor",children:[e.jsxs("p",{className:"template-hint",children:["Define a JSON or text template. Use variables like ",e.jsx("code",{children:"{{udid}}"})," to insert dynamic data."]}),e.jsx("div",{className:"variable-chips",children:["udid","host","name","sessionId","failureReason","eventType","platform"].map(s=>e.jsx("span",{className:"variable-chip",onClick:()=>E(s),children:s},s))}),e.jsx("textarea",{className:"template-textarea",placeholder:'Example JSON: { "text": "Alert: Device {{udid}} is offline!" }',value:f,onChange:s=>h(s.target.value),rows:3})]})]})]}),e.jsxs("div",{className:"form-actions",children:[e.jsx("button",{className:`test-btn ${d}`,onClick:C,disabled:!t,children:d==="success"?"Sent!":d==="error"?"Failed":"Test Payload"}),e.jsx("button",{className:"add-btn",onClick:y,disabled:!t||N,children:N?"Saving...":"Save Configuration"})]})]})]})};export{J as WebhookSettings};
|
package/lib/public/index.html
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
Learn how to configure a non-root public URL by running `npm run build`.
|
|
25
25
|
-->
|
|
26
26
|
<title>Xenon</title>
|
|
27
|
-
<script type="module" crossorigin src="/xenon/assets/index-
|
|
27
|
+
<script type="module" crossorigin src="/xenon/assets/index-S71J2rWg.js"></script>
|
|
28
28
|
<link rel="stylesheet" crossorigin href="/xenon/assets/index-qzCez_kk.css">
|
|
29
29
|
</head>
|
|
30
30
|
|
|
@@ -280,9 +280,54 @@ let AndroidDeviceManager = class AndroidDeviceManager {
|
|
|
280
280
|
totalUtilizationTimeMilliSec: totalUtilizationTimeMilliSec,
|
|
281
281
|
sessionStartTime: 0,
|
|
282
282
|
userBlocked: false,
|
|
283
|
+
ip: yield this.getDeviceIp(adbInstance, device.udid),
|
|
284
|
+
cpuArchitecture: yield this.getCpuArchitecture(adbInstance, device.udid),
|
|
283
285
|
};
|
|
284
286
|
});
|
|
285
287
|
}
|
|
288
|
+
getDeviceIp(adbInstance, udid) {
|
|
289
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
290
|
+
try {
|
|
291
|
+
// Primary: Check wlan0
|
|
292
|
+
const stdout = yield DeviceLockManager_1.deviceLock.acquire(udid, () => __awaiter(this, void 0, void 0, function* () {
|
|
293
|
+
return yield adbInstance.adbExec(['-s', udid, 'shell', 'ip', 'addr', 'show', 'wlan0'], {
|
|
294
|
+
timeout: 5000,
|
|
295
|
+
});
|
|
296
|
+
}));
|
|
297
|
+
const match = /inet\s+(\d+\.\d+\.\d+\.\d+)/.exec(stdout);
|
|
298
|
+
if (match)
|
|
299
|
+
return match[1];
|
|
300
|
+
// Secondary: Check ip route for default gateway source
|
|
301
|
+
const stdoutRoute = yield DeviceLockManager_1.deviceLock.acquire(udid, () => __awaiter(this, void 0, void 0, function* () {
|
|
302
|
+
return yield adbInstance.adbExec(['-s', udid, 'shell', 'ip', 'route'], { timeout: 5000 });
|
|
303
|
+
}));
|
|
304
|
+
const routeMatch = /src\s+(\d+\.\d+\.\d+\.\d+)/.exec(stdoutRoute);
|
|
305
|
+
if (routeMatch)
|
|
306
|
+
return routeMatch[1];
|
|
307
|
+
return '';
|
|
308
|
+
}
|
|
309
|
+
catch (e) {
|
|
310
|
+
logger_1.default.debug(`Failed to fetch IP for android device ${udid}: ${e}`);
|
|
311
|
+
return '';
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
getCpuArchitecture(adbInstance, udid) {
|
|
316
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
317
|
+
try {
|
|
318
|
+
const abi = yield DeviceLockManager_1.deviceLock.acquire(udid, () => __awaiter(this, void 0, void 0, function* () {
|
|
319
|
+
return yield adbInstance.adbExec(['-s', udid, 'shell', 'getprop', 'ro.product.cpu.abi'], {
|
|
320
|
+
timeout: 3000,
|
|
321
|
+
});
|
|
322
|
+
}));
|
|
323
|
+
return abi.trim();
|
|
324
|
+
}
|
|
325
|
+
catch (e) {
|
|
326
|
+
logger_1.default.debug(`Failed to fetch CPU architecture for ${udid}: ${e}`);
|
|
327
|
+
return '';
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
}
|
|
286
331
|
getAdditionalDeviceInfo(device) {
|
|
287
332
|
return __awaiter(this, void 0, void 0, function* () {
|
|
288
333
|
logger_1.default.info(`Fetching additional device info for ${device.udid} (Lazy Loading)`);
|
|
@@ -296,14 +341,17 @@ let AndroidDeviceManager = class AndroidDeviceManager {
|
|
|
296
341
|
})
|
|
297
342
|
: adbInstance;
|
|
298
343
|
try {
|
|
299
|
-
const [chromeDriverPath, screenSize] = yield Promise.all([
|
|
344
|
+
const [chromeDriverPath, screenSize, cpuArchitecture] = yield Promise.all([
|
|
300
345
|
this.getChromeVersion(adb, device.udid, this.pluginArgs),
|
|
301
346
|
this.getScreenSize(adb, device.udid),
|
|
347
|
+
this.getCpuArchitecture(adb, device.udid),
|
|
302
348
|
]);
|
|
303
349
|
return {
|
|
304
350
|
chromeDriverPath,
|
|
305
351
|
screenWidth: screenSize === null || screenSize === void 0 ? void 0 : screenSize.width,
|
|
306
352
|
screenHeight: screenSize === null || screenSize === void 0 ? void 0 : screenSize.height,
|
|
353
|
+
ip: yield this.getDeviceIp(adb, device.udid),
|
|
354
|
+
cpuArchitecture,
|
|
307
355
|
};
|
|
308
356
|
}
|
|
309
357
|
catch (err) {
|
|
@@ -193,7 +193,7 @@ let IOSDiscoveryService = class IOSDiscoveryService {
|
|
|
193
193
|
udid,
|
|
194
194
|
sdk,
|
|
195
195
|
name,
|
|
196
|
-
ip, busy: false, realDevice: true, deviceType: 'real', platform: (name.toLowerCase().includes('tv') ? 'tvos' : 'ios'), host: host, totalUtilizationTimeMilliSec, sessionStartTime: 0, state: (storeDevice === null || storeDevice === void 0 ? void 0 : storeDevice.state) || 'Unknown', userBlocked: (storeDevice === null || storeDevice === void 0 ? void 0 : storeDevice.userBlocked) || false }, (storeDevice || {}));
|
|
196
|
+
ip, busy: false, realDevice: true, deviceType: 'real', cpuArchitecture: 'arm64', platform: (name.toLowerCase().includes('tv') ? 'tvos' : 'ios'), host: host, totalUtilizationTimeMilliSec, sessionStartTime: 0, state: (storeDevice === null || storeDevice === void 0 ? void 0 : storeDevice.state) || 'Unknown', userBlocked: (storeDevice === null || storeDevice === void 0 ? void 0 : storeDevice.userBlocked) || false }, (storeDevice || {}));
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
199
|
getSimulators() {
|
package/package.json
CHANGED